1 |
|
2 |
|
3 |
|
4 | import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
5 | import { b as getIonMode } from './ionic-global.js';
|
6 | import { m as menuController } from './index5.js';
|
7 | import { u as updateVisibility } from './menu-toggle-util.js';
|
8 |
|
9 | const menuToggleCss = ":host(.menu-toggle-hidden){display:none}";
|
10 |
|
11 | const MenuToggle = proxyCustomElement(class extends HTMLElement {
|
12 | constructor() {
|
13 | super();
|
14 | this.__registerHost();
|
15 | this.__attachShadow();
|
16 | this.visible = false;
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | this.autoHide = true;
|
24 | this.onClick = () => {
|
25 | return menuController.toggle(this.menu);
|
26 | };
|
27 | }
|
28 | connectedCallback() {
|
29 | this.visibilityChanged();
|
30 | }
|
31 | async visibilityChanged() {
|
32 | this.visible = await updateVisibility(this.menu);
|
33 | }
|
34 | render() {
|
35 | const mode = getIonMode(this);
|
36 | const hidden = this.autoHide && !this.visible;
|
37 | return (h(Host, { onClick: this.onClick, "aria-hidden": hidden ? 'true' : null, class: {
|
38 | [mode]: true,
|
39 | 'menu-toggle-hidden': hidden,
|
40 | } }, h("slot", null)));
|
41 | }
|
42 | static get style() { return menuToggleCss; }
|
43 | }, [1, "ion-menu-toggle", {
|
44 | "menu": [1],
|
45 | "autoHide": [4, "auto-hide"],
|
46 | "visible": [32]
|
47 | }, [[16, "ionMenuChange", "visibilityChanged"], [16, "ionSplitPaneVisible", "visibilityChanged"]]]);
|
48 | function defineCustomElement$1() {
|
49 | if (typeof customElements === "undefined") {
|
50 | return;
|
51 | }
|
52 | const components = ["ion-menu-toggle"];
|
53 | components.forEach(tagName => { switch (tagName) {
|
54 | case "ion-menu-toggle":
|
55 | if (!customElements.get(tagName)) {
|
56 | customElements.define(tagName, MenuToggle);
|
57 | }
|
58 | break;
|
59 | } });
|
60 | }
|
61 |
|
62 | const IonMenuToggle = MenuToggle;
|
63 | const defineCustomElement = defineCustomElement$1;
|
64 |
|
65 | export { IonMenuToggle, defineCustomElement };
|