@nent/core
Version:
47 lines (43 loc) • 1.32 kB
JavaScript
/*!
* NENT 2022
*/
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { s as state } from './state2.js';
const AppThemeSwitch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
constructor() {
super();
this.__registerHost();
/**
* The inner input ID
*/
this.inputId = 'dark-mode';
}
render() {
return (h(Host, { onClick: () => {
state.darkMode = !state.darkMode;
} }, h("input", { type: "checkbox", ref: el => {
this.checkbox = el;
}, class: this.inputClass, id: this.inputId, onChange: () => {
state.darkMode = this.checkbox.checked;
}, checked: state.darkMode || false })));
}
}, [0, "n-app-theme-switch", {
"inputClass": [1, "input-class"],
"inputId": [1, "input-id"]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["n-app-theme-switch"];
components.forEach(tagName => { switch (tagName) {
case "n-app-theme-switch":
if (!customElements.get(tagName)) {
customElements.define(tagName, AppThemeSwitch);
}
break;
} });
}
const NAppThemeSwitch = AppThemeSwitch;
const defineCustomElement = defineCustomElement$1;
export { NAppThemeSwitch, defineCustomElement };