refactor(all): updating to newest stencil apis (#18578)

* chore(): update ionicons

* refactor(all): updating to newest stencil apis

* fix lint issues

* more changes

* moreee

* fix treeshaking

* fix config

* fix checkbox

* fix stuff

* chore(): update ionicons

* fix linting errors
This commit is contained in:
Manu MA
2019-06-23 11:26:42 +02:00
committed by GitHub
parent 78e477b2a7
commit 34dfc3ce98
112 changed files with 1229 additions and 1233 deletions

View File

@ -1,4 +1,4 @@
import { Component, ComponentInterface, Listen, Prop, State, h } from '@stencil/core';
import { Component, ComponentInterface, Host, Listen, Prop, State, h } from '@stencil/core';
import { getIonMode } from '../../global/ionic-global';
@ -9,8 +9,6 @@ import { getIonMode } from '../../global/ionic-global';
})
export class MenuToggle implements ComponentInterface {
@Prop({ context: 'document' }) doc!: Document;
@State() visible = false;
/**
@ -35,17 +33,6 @@ export class MenuToggle implements ComponentInterface {
return this.updateVisibility();
}
@Listen('click')
async onClick() {
const menuCtrl = await getMenuController(document);
if (menuCtrl) {
const menu = await menuCtrl.get(this.menu);
if (menu) {
menuCtrl.toggle(this.menu);
}
}
}
@Listen('ionMenuChange', { target: 'body' })
@Listen('ionSplitPaneVisible', { target: 'body' })
async updateVisibility() {
@ -60,20 +47,31 @@ export class MenuToggle implements ComponentInterface {
this.visible = false;
}
hostData() {
const mode = getIonMode(this);
const hidden = this.autoHide && !this.visible;
return {
'aria-hidden': hidden ? 'true' : null,
class: {
[`${mode}`]: true,
'menu-toggle-hidden': hidden,
private onClick = async () => {
const menuCtrl = await getMenuController(document);
if (menuCtrl) {
const menu = await menuCtrl.get(this.menu);
if (menu) {
menuCtrl.toggle(this.menu);
}
};
}
}
render() {
return <slot></slot>;
const mode = getIonMode(this);
const hidden = this.autoHide && !this.visible;
return (
<Host
onClick={this.onClick}
aria-hidden={hidden ? 'true' : null}
class={{
[mode]: true,
'menu-toggle-hidden': hidden,
}}
>
<slot></slot>
</Host>
);
}
}