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.

4 lines 1.08 kB
/*! * NENT 2022 */ import{a as n}from"./expressions-2c27c47c.js";import{hasToken as a,resolveTokens as s}from"./tokens-78f8cdbe.js";function c(n){t(n),o(n),f(n),r(n)}function t(n){n.querySelectorAll("[n-hide-when]").forEach((async n=>{await i(n)}))}async function i(a){const s=a.getAttribute("n-hide-when");if(!s)return;const c=await n(s);a.toggleAttribute("hidden",c)}function o(n){n.querySelectorAll("[n-show-when]").forEach((async n=>{await e(n)}))}async function e(a){const s=a.getAttribute("n-show-when");if(!s)return;const c=await n(s);a.toggleAttribute("hidden",!c)}function f(n){n.querySelectorAll("[n-class-when]").forEach((async n=>{await w(n)}))}async function w(a){const s=a.getAttribute("n-class-when"),c=a.getAttribute("n-class");if(!s||!c)return;const t=await n(s);a.classList.toggle(c,t)}function r(n){n.querySelectorAll("[n-value-from]").forEach((async n=>{await u(n)}))}async function u(n){const c=n.getAttribute("n-value-from");if(c&&a(c)){const a=await s(c);a&&n.setAttribute("value",a)}}export{t as a,i as b,o as c,e as d,f as e,w as f,r as g,u as h,c as r}