45 lines
1.5 KiB
JavaScript
Executable file
45 lines
1.5 KiB
JavaScript
Executable file
import { attachShadow, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
|
import { b as getIonMode } from './ionic-global.js';
|
|
import { m as menuController } from './index5.js';
|
|
import { u as updateVisibility } from './menu-toggle-util.js';
|
|
|
|
const menuToggleCss = ":host(.menu-toggle-hidden){display:none}";
|
|
|
|
const MenuToggle = class extends HTMLElement {
|
|
constructor() {
|
|
super();
|
|
this.__registerHost();
|
|
attachShadow(this);
|
|
this.visible = false;
|
|
/**
|
|
* Automatically hides the content when the corresponding menu is not active.
|
|
*
|
|
* By default, it's `true`. Change it to `false` in order to
|
|
* keep `ion-menu-toggle` always visible regardless the state of the menu.
|
|
*/
|
|
this.autoHide = true;
|
|
this.onClick = () => {
|
|
return menuController.toggle(this.menu);
|
|
};
|
|
}
|
|
connectedCallback() {
|
|
this.visibilityChanged();
|
|
}
|
|
async visibilityChanged() {
|
|
this.visible = await updateVisibility(this.menu);
|
|
}
|
|
render() {
|
|
const mode = getIonMode(this);
|
|
const hidden = this.autoHide && !this.visible;
|
|
return (h(Host, { onClick: this.onClick, "aria-hidden": hidden ? 'true' : null, class: {
|
|
[mode]: true,
|
|
'menu-toggle-hidden': hidden,
|
|
} }, h("slot", null)));
|
|
}
|
|
static get style() { return menuToggleCss; }
|
|
};
|
|
|
|
const IonMenuToggle = /*@__PURE__*/proxyCustomElement(MenuToggle, [1,"ion-menu-toggle",{"menu":[1],"autoHide":[4,"auto-hide"],"visible":[32]},[[16,"ionMenuChange","visibilityChanged"],[16,"ionSplitPaneVisible","visibilityChanged"]]]);
|
|
|
|
export { IonMenuToggle };
|