UNPKG

@nent/core

Version:

Functional elements to add routing, data-binding, dynamic HTML, declarative actions, audio, video, and so much more. Supercharge static HTML files into web apps without script or builds.

38 lines (35 loc) 1.29 kB
/*! * NENT 2022 */ import { r as registerInstance, h, H as Host, a as getElement } from './index-916ca544.js'; import { C as CommonStateSubscriber } from './state-subscriber-eb44164a.js'; import { D as DATA_EVENTS } from './interfaces-8c5cd1b8.js'; import { R as ROUTE_EVENTS } from './interfaces-3b78db83.js'; import { a as state } from './state-27a8a5bc.js'; import './index-f7016b94.js'; import './index-4bfabbbd.js'; const ContentShow = class { constructor(hostRef) { registerInstance(this, hostRef); this.show = false; } componentWillLoad() { this.dataSubscription = new CommonStateSubscriber(this, 'dataEnabled', DATA_EVENTS.DataChanged); this.routeSubscription = new CommonStateSubscriber(this, 'routingEnabled', ROUTE_EVENTS.RouteChanged); } async componentWillRender() { if (state.dataEnabled) { const { evaluatePredicate } = await import('./expressions-2c27c47c.js').then(function (n) { return n.f; }); this.show = await evaluatePredicate(this.when); } } disconnectedCallback() { this.dataSubscription.destroy(); this.routeSubscription.destroy(); } render() { return (h(Host, { hidden: !this.show }, h("slot", null))); } get el() { return getElement(this); } }; export { ContentShow as n_content_show };