Skip to content

Commit e0fe65d

Browse files
author
Fred Heusschen
committed
improved the webcomponent
1 parent a4fed75 commit e0fe65d

23 files changed

+555
-370
lines changed

bin/demo.css

+11-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ h1 {
2424
letter-spacing: -6px;
2525
}
2626

27+
pre {
28+
font-size: 16px;
29+
line-height: 24px;
30+
width: 100%;
31+
overflow: auto;
32+
margin: 75px 0;
33+
}
34+
2735
button.reset {
2836
appearance: none;
2937
padding: 0;
@@ -98,7 +106,7 @@ a:hover {
98106
.xmpl > button,
99107
.xmpl > m-burger {
100108
--mb-cross-timeout: 0s;
101-
109+
102110
position: absolute;
103111
top: 50%;
104112
left: 50%;
@@ -131,6 +139,7 @@ button.custom-button-2 {
131139
--mb-bar-height: 2px;
132140
--mb-bar-spacing: 12px;
133141

142+
border-radius: 40px;
134143
background-color: rgba( 255, 255, 255, 0.7 );
135144
color: #3ea7e1;
136-
}
145+
}

bin/mburger.js

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* mburger webcomponent CSS v1.3.0
3+
* mmenujs.com/mburger
4+
*
5+
* Copyright (c) Fred Heusschen
6+
* www.frebsite.nl
7+
*
8+
* License: CC-BY-4.0
9+
* http://creativecommons.org/licenses/by/4.0/
10+
*/
11+
export const mBurger = document.createElement('template');
12+
mBurger.innerHTML = `
13+
<style>[__STYLES__]</style>
14+
<b></b>
15+
<b></b>
16+
<b></b>
17+
<span><slot></slot></span>`;
18+
customElements.define('m-burger', class extends HTMLElement {
19+
constructor() {
20+
super();
21+
var content = mBurger.content.cloneNode(true);
22+
// Attach shadow DOM
23+
this.attachShadow({ mode: 'open' }).appendChild(content);
24+
this.menu = null;
25+
}
26+
static get observedAttributes() {
27+
return ['menu'];
28+
}
29+
attributeChangedCallback(name, oldValue, newValue) {
30+
if (name == 'menu') {
31+
this.menu = newValue ? document.getElementById(newValue) : null;
32+
if (this.menu) {
33+
let API = this.menu['mmenu'];
34+
if (API) {
35+
API.bind('open:after', () => {
36+
this.setAttribute('state', 'cross');
37+
});
38+
API.bind('close:after', () => {
39+
this.removeAttribute('state');
40+
});
41+
}
42+
}
43+
}
44+
}
45+
connectedCallback() {
46+
this.addEventListener('click', evnt => {
47+
if (this.menu && this.menu.classList.contains('mm-menu')) {
48+
let API = this.menu['mmenu'];
49+
if (API && API.open) {
50+
API.open();
51+
}
52+
}
53+
});
54+
}
55+
});

bin/webcomponent-affix.txt

-46
This file was deleted.

bin/webcomponent-prefix.txt

-3
This file was deleted.

bin/webcomponent.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)