nuclo 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nuclo.js CHANGED
@@ -1,2 +1,2 @@
1
- function e(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function t(e){return e instanceof Node}function n(e){return"object"==typeof e&&null!==e}function r(e){return n(e)&&"tagName"in e}function o(e){return"boolean"==typeof e}function i(e){return"function"==typeof e}function c(e){return i(e)&&0===e.length}function u(e,t){"undefined"!=typeof console&&console.error(`nuclo: ${e}`,t)}function a(e,t){try{return e()}catch(e){return u("Operation failed",e),t}}const l="undefined"!=typeof window&&"undefined"!=typeof document;function s(e){if(!e?.parentNode)return!1;try{return e.parentNode.removeChild(e),!0}catch(e){return u("Failed to remove child node",e),!1}}function d(e){if(!l)return null;try{return document.createComment(e)}catch(e){return u("Failed to create comment node",e),null}}function f(e){return d(e)}function p(e,t="hidden"){try{return document.createComment(`conditional-${e}-${t}`)}catch(e){return u("Failed to create conditional comment",e),null}}function h(e){if(!l)throw new Error("Cannot create comment in non-browser environment");const t=d(`${e}-${Math.random().toString(36).slice(2)}`);if(!t)throw new Error("Failed to create comment");return t}function m(e){const t=d(`${e}-end`);if(!t)throw new Error("Failed to create end comment");return{start:h(`${e}-start`),end:t}}function g(e,t){const n=t.parentNode;n&&e.forEach(e=>function(e,t,n){if(!e||!t)return!1;try{return e.insertBefore(t,n),!0}catch(e){return u("Failed to insert node before reference",e),!1}}(n,e,t))}function y(e,...t){return e?(t.forEach(t=>{if(null!=t){let n;if("string"==typeof t){const e=function(e){if(!l)return null;try{return document.createTextNode(String(e))}catch(e){return u("Failed to create text node",e),null}}(t);if(!e)return;n=e}else n=t;!function(e,t){if(!e||!t)return!1;try{return e.appendChild(t),!0}catch(e){return u("Failed to append child node",e),!1}}(e,n)}}),e):e}function v(e){return!!e&&("boolean"==typeof e.isConnected?e.isConnected:!(!l||"undefined"==typeof document)&&document.contains(e))}function b(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return u("Error replacing conditional node",e),!1}}const w=new Map,E=new Map;function C(e,t){t.attributeResolvers.forEach(({resolver:e,applyValue:t},n)=>{try{t(a(e))}catch(e){u(`Failed to update reactive attribute: ${n}`,e)}})}function x(e,t,n,r){if(!(e instanceof Element&&t&&"function"==typeof n))return void u("Invalid parameters for registerAttributeResolver");const o=function(e){let t=E.get(e);return t||(t={attributeResolvers:new Map},E.set(e,t)),t}(e);o.attributeResolvers.set(t,{resolver:n,applyValue:r});try{r(a(n))}catch(e){u("Failed to apply initial attribute value",e)}if(!o.updateListener){const t=()=>C(0,o);e.addEventListener("update",t),o.updateListener=t}}function M(e,t,n){try{if(null==n||""===n)return e.style[t]="",!0;const r=String(n);return e.style[t]=r,!0}catch{return!1}}function S(e,t){if(e?.style&&t)for(const[n,r]of Object.entries(t)){M(e,n,r)||u(`Failed to set style property '${n}'`)}}function N(e,t,n){if(null==n)return;if("style"===t)return o=n,void((r=e)&&(i(o)?x(r,"style",()=>{try{return o()}catch(e){return u("Error in style resolver function",e),null}},e=>{S(r,e)}):S(r,o)));var r,o;const c=n=>{if(null==n)return;if(e instanceof Element&&"http://www.w3.org/2000/svg"===e.namespaceURI)e.setAttribute(String(t),String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(String(t),String(n))}else e instanceof Element&&e.setAttribute(String(t),String(n))};if(i(n)&&0===n.length){const r=n;x(e,String(t),r,c)}else c(n)}function k(e,t){if(t)for(const n of Object.keys(t)){N(e,n,t[n])}}const F=new WeakMap;function I(e){const{value:t,error:n}=function(e){const t=F.get(e);if(t)return t;try{const t={value:e(),error:!1};return F.set(e,t),t}catch{const t={value:void 0,error:!0};return F.set(e,t),t}}(e);return!n&&"boolean"==typeof t}function $(e,r,o){if(!i(e)||0!==e.length)return!1;if(!I(e))return!1;const c=r.filter((e,t)=>t!==o);if(0===c.length)return!1;return c.some(e=>!(!n(e)&&!t(e))||!!(i(e)&&e.length>0))}function T(r,o,a){if(null==o)return null;if(i(o)){if(c(o))try{let t=F.get(o);if(!t){t={value:o(),error:!1},F.set(o,t)}if(t.error)return L(a,()=>"");const n=t.value;return e(n)&&null!=n?L(a,o,n):null}catch(e){return F.set(o,{value:void 0,error:!0}),u("Error evaluating reactive text function:",e),L(a,()=>"")}const i=o(r,a);return null==i?null:e(i)?_(a,i):t(i)?i:(n(i)&&k(r,i),null)}const l=o;return null==l?null:e(l)?_(a,l):t(l)?l:(n(l)&&k(r,l),null)}function L(e,t,n){const r=document.createDocumentFragment(),o=f(` text-${e} `);o&&r.appendChild(o);const i=function(e,t){if("function"!=typeof e)return u("Invalid resolver provided to createReactiveTextNode"),document.createTextNode("");const n=arguments.length>1?t:a(e,""),r=void 0===n?"":String(n),o=document.createTextNode(r);return w.set(o,{resolver:e,lastValue:r}),o}(t,n);return r.appendChild(i),r}function _(e,t){const n=document.createDocumentFragment(),r=f(` text-${e} `);r&&n.appendChild(r);const o=document.createTextNode(String(t));return n.appendChild(o),n}const O=new Set;function j(e,t){e._conditionalInfo=t,O.add(e)}function B(e,t,n=0){if(!t||0===t.length)return{element:e,nextIndex:n,appended:0};let r=n,o=0;const i=e;for(let n=0;n<t.length;n+=1){const c=t[n];if(null==c)continue;const u=T(e,c,r);u&&(u.parentNode!==i&&i.appendChild(u),r+=1,o+=1)}return{element:e,nextIndex:r,appended:o}}function D(e,t){const n=document.createElement(e);return B(n,t,0),n}function R(e){const t=function(e){for(let t=0;t<e.length;t+=1)if($(e[t],e,t))return t;return-1}(e);return-1===t?{condition:null,otherModifiers:e}:{condition:e[t],otherModifiers:e.filter((e,n)=>n!==t)}}function A(e){return function(e){return q.includes(e)}(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function P(e,...t){return(n,r)=>{const{condition:o,otherModifiers:i}=R(t);if(o)return function(e,t,n){const r=t();if(!l)return r?D(e,n):p(e,"ssr");const o={condition:t,tagName:e,modifiers:n};if(r){const t=D(e,n);return j(t,o),t}const i=p(e);if(!i)throw new Error(`Failed to create conditional comment for ${e}`);return j(i,o),i}(e,o,i);const c=A(e);return B(c,i,r),c}}function V(e){return(...t)=>P(e,...t)}const G=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],q=["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","use","view"],U=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"];function W(e=globalThis){const t="__nuclo_tags_registered";e[t]||(q.forEach(t=>function(e,t){let n=t;["a","script","style","title","text"].includes(t)?n=`${t}_svg`:["stop"].includes(t)&&(n=`${t}_`),n in e||(e[n]=V(t))}(e,t)),G.forEach(t=>function(e,t){t in e&&"function"!=typeof e[t]||(e[t]=V(t))}(e,t)),e[t]=!0)}const z=new Set;function H(e,t,n){return function(e,t,n){if(i(e)){const o=e(t,n);return o&&r(o)?o:null}return e&&r(e)?e:null}(e.renderItem(t,n),e.host,n)}function J(e){s(e.element)}function K(e){const{host:t,startMarker:n,endMarker:r}=e,o=n.parentNode??t,i=e.itemsProvider();if(function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if((n in e?e[n]:void 0)!==(n in t?t[n]:void 0))return!1;return!0}(e.lastSyncedItems,i))return;const c=new Map,u=new Map;e.records.forEach(e=>{const t=u.get(e.item);t?t.push(e):u.set(e.item,[e])}),i.forEach((t,n)=>{if(n<e.lastSyncedItems.length&&e.lastSyncedItems[n]===t){const r=e.records[n];if(r&&r.item===t){c.set(n,r);const e=u.get(t);if(e){const n=e.indexOf(r);n>=0&&(e.splice(n,1),0===e.length&&u.delete(t))}}}});const a=[],l=new Set(e.records);let s=r;for(let t=i.length-1;t>=0;t--){const n=i[t];let r=c.get(t);if(!r){const e=u.get(n);e&&e.length>0&&(r=e.shift(),0===e.length&&u.delete(n))}if(r)l.delete(r);else{const o=H(e,n,t);if(!o)continue;r={item:n,element:o}}a.unshift(r);const d=r.element;d.nextSibling!==s&&o.insertBefore(d,s),s=d}l.forEach(J),e.records=a,e.lastSyncedItems=[...i]}function Q(e,t){return(n,r)=>{const o=function(e,t,n){const{start:r,end:o}=m("list"),i={itemsProvider:e,renderItem:t,startMarker:r,endMarker:o,records:[],host:n,lastSyncedItems:[]},c=n;return c.appendChild(r),c.appendChild(o),z.add(i),K(i),i}(e,t,n);return o.startMarker}}function X(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function Y(e,t){return"function"==typeof e?X(e,t):Boolean(e)}const Z=new Set;function ee(e,t,n,r){return i(e)?c(e)?(F.delete(e),T(t,e,n)):function(e,t,n){const r=e,o=r.appendChild.bind(r),i=r.insertBefore.bind(r);r.appendChild=function(e){return i(e,t)};try{return n()}finally{r.appendChild=o}}(t,r,()=>{const r=T(t,e,n);return r&&!r.parentNode?r:null}):T(t,e,n)}function te(e){const{groups:t,elseContent:n,host:r,index:o,endMarker:i}=e,c=function(e,t){for(let t=0;t<e.length;t++)if(Y(e[t].condition))return t;return t.length>0?-1:null}(t,n);if(c===e.activeIndex)return;if(function(e,t){let n=e.nextSibling;for(;n&&n!==t;){const e=n.nextSibling;s(n),n=e}}(e.startMarker,e.endMarker),e.activeIndex=c,null===c)return;const u=function(e,t,n,r){const o=[];for(const i of e){const e=ee(i,t,n,r);e&&o.push(e)}return o}(c>=0?t[c].content:n,r,o,i);g(u,i)}class ne{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){if(!l){return f("when-ssr")||null}const{start:n,end:r}=m("when"),o={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:null,update:()=>te(o)};Z.add(o);const i=e;return i.appendChild(n),i.appendChild(r),te(o),n}}function re(e){return Object.assign((t,n)=>e.render(t,n),{when:(t,...n)=>(e.when(t,...n),re(e)),else:(...t)=>(e.else(...t),re(e))})}function oe(e,...t){return re(new ne(e,...t))}function ie(e){const t=function(e){return e._conditionalInfo??null}(e);if(!t)return;const n=X(t.condition,e=>{u("Error evaluating conditional condition",e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){const n=function(e){try{return D(e.tagName,e.modifiers)}catch(t){return u(`Error applying modifiers in conditional element "${e.tagName}"`,t),document.createElement(e.tagName)}}(t);j(n,t),b(e,n)}else if(!n&&r){const n=p(t.tagName);n&&(j(n,t),b(e,n))}}const ce=[function(){z.forEach(e=>{e.startMarker.isConnected&&e.endMarker.isConnected?K(e):z.delete(e)})},function(){Z.forEach(e=>{try{e.update()}catch(t){Z.delete(e)}})},function(){if(l)try{O.forEach(e=>{e.isConnected?ie(e):function(e){O.delete(e)}(e)})}catch(e){u("Error during conditional elements update",e)}},function(){E.forEach((e,t)=>{if(!v(t))return e.updateListener&&t.removeEventListener("update",e.updateListener),void E.delete(t);C(0,e)})},function(){w.forEach((e,t)=>{if(v(t))try{const n=a(e.resolver),r=void 0===n?"":String(n);r!==e.lastValue&&(t.textContent=r,e.lastValue=r)}catch(e){u("Failed to update reactive text node",e)}else w.delete(t)})},function(){if("undefined"==typeof document)return;const e=document.body?[document.body,document]:[document];for(const t of e)try{t.dispatchEvent(new Event("update",{bubbles:!0}))}catch(e){u("Error dispatching global update event",e)}}];function ue(){for(const e of ce)e()}function ae(e,t,n){return r=>{if(!r||"function"!=typeof r.addEventListener)return;const o=r;o.addEventListener(e,n=>{try{t.call(o,n)}catch(t){u(`Error in '${e}' listener`,t)}},n)}}function le(e,t,n=0){const r=e(t||document.body,n);return(t||document.body).appendChild(r),r}function se(){if(W(),"undefined"!=typeof globalThis){const e=globalThis;e.list=Q,e.update=ue,e.when=oe,e.on=ae,e.render=le}}"undefined"!=typeof globalThis&&se();export{G as HTML_TAGS,U as SELF_CLOSING_TAGS,q as SVG_TAGS,y as appendChildren,k as applyAttributes,T as applyNodeModifier,f as createComment,p as createConditionalComment,P as createElementFactory,D as createElementWithModifiers,V as createTagBuilder,se as initializeRuntime,o as isBoolean,l as isBrowser,i as isFunction,t as isNode,n as isObject,e as isPrimitive,r as isTagLike,c as isZeroArityFunction,Q as list,ae as on,W as registerGlobalTagBuilders,le as render,b as replaceNodeSafely,ue as update,oe as when};
1
+ function e(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function t(e){return e instanceof Node}function n(e){return"object"==typeof e&&null!==e}function r(e){return n(e)&&"tagName"in e}function o(e){return"boolean"==typeof e}function i(e){return"function"==typeof e}function s(e){return i(e)&&0===e.length}function c(e,t){"undefined"!=typeof console&&console.error(`nuclo: ${e}`,t)}function a(e,t){try{return e()}catch(e){return c("Operation failed",e),t}}const l="undefined"!=typeof window&&"undefined"!=typeof document;function u(e){if(!e?.parentNode)return!1;try{return e.parentNode.removeChild(e),!0}catch(e){return c("Failed to remove child node",e),!1}}function d(e){if(!l)return null;try{return document.createComment(e)}catch(e){return c("Failed to create comment node",e),null}}function f(e){return d(e)}function h(e,t="hidden"){try{return document.createComment(`conditional-${e}-${t}`)}catch(e){return c("Failed to create conditional comment",e),null}}function p(e){if(!l)throw new Error("Cannot create comment in non-browser environment");const t=d(`${e}-${Math.random().toString(36).slice(2)}`);if(!t)throw new Error("Failed to create comment");return t}function m(e){const t=d(`${e}-end`);if(!t)throw new Error("Failed to create end comment");return{start:p(`${e}-start`),end:t}}function g(e,t){const n=t.parentNode;n&&e.forEach(e=>function(e,t,n){if(!e||!t)return!1;try{return e.insertBefore(t,n),!0}catch(e){return c("Failed to insert node before reference",e),!1}}(n,e,t))}function y(e,...t){return e?(t.forEach(t=>{if(null!=t){let n;if("string"==typeof t){const e=function(e){if(!l)return null;try{return document.createTextNode(String(e))}catch(e){return c("Failed to create text node",e),null}}(t);if(!e)return;n=e}else n=t;!function(e,t){if(!e||!t)return!1;try{return e.appendChild(t),!0}catch(e){return c("Failed to append child node",e),!1}}(e,n)}}),e):e}function b(e){return!!e&&("boolean"==typeof e.isConnected?e.isConnected:!(!l||"undefined"==typeof document)&&document.contains(e))}function w(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return c("Error replacing conditional node",e),!1}}const C=new Map,x=new Map;function v(e,t){t.attributeResolvers.forEach(({resolver:e,applyValue:t},n)=>{try{t(a(e))}catch(e){c(`Failed to update reactive attribute: ${n}`,e)}})}function S(e,t,n,r){if(!(e instanceof Element&&t&&"function"==typeof n))return void c("Invalid parameters for registerAttributeResolver");const o=function(e){let t=x.get(e);return t||(t={attributeResolvers:new Map},x.set(e,t)),t}(e);o.attributeResolvers.set(t,{resolver:n,applyValue:r});try{r(a(n))}catch(e){c("Failed to apply initial attribute value",e)}if(!o.updateListener){const t=()=>v(0,o);e.addEventListener("update",t),o.updateListener=t}}function E(e,t,n){try{if(null==n||""===n)return e.style[t]="",!0;const r=String(n);return e.style[t]=r,!0}catch{return!1}}function N(e,t){if(e?.style&&t)for(const[n,r]of Object.entries(t)){E(e,n,r)||c(`Failed to set style property '${n}'`)}}function $(e,t,n,r=!1){if(null==n)return;if("style"===t)return s=n,void((o=e)&&(i(s)?S(o,"style",()=>{try{return s()}catch(e){return c("Error in style resolver function",e),null}},e=>{N(o,e)}):N(o,s)));var o,s;const a=(n,r=!1)=>{if(null==n)return;if("className"===t&&e instanceof HTMLElement&&r){const t=String(n),r=e.className;if(r&&r!==t){const n=new Set(r.split(" ").filter(e=>e));t.split(" ").filter(e=>e).forEach(e=>n.add(e)),e.className=Array.from(n).join(" ")}else t&&(e.className=t);return}if(e instanceof Element&&"http://www.w3.org/2000/svg"===e.namespaceURI)e.setAttribute(String(t),String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(String(t),String(n))}else e instanceof Element&&e.setAttribute(String(t),String(n))};if(i(n)&&0===n.length){const r=n;S(e,String(t),r,e=>a(e,!1))}else a(n,r)}function M(e,t,n=!0){if(t)for(const r of Object.keys(t)){$(e,r,t[r],n&&"className"===r)}}const k=new WeakMap;function R(e){const{value:t,error:n}=function(e){const t=k.get(e);if(t)return t;try{const t={value:e(),error:!1};return k.set(e,t),t}catch{const t={value:void 0,error:!0};return k.set(e,t),t}}(e);return!n&&"boolean"==typeof t}function j(e,r,o){if(!i(e)||0!==e.length)return!1;if(!R(e))return!1;const s=r.filter((e,t)=>t!==o);if(0===s.length)return!1;return s.some(e=>!(!n(e)&&!t(e))||!!(i(e)&&e.length>0))}function F(r,o,a){if(null==o)return null;if(i(o)){if(s(o))try{let t=k.get(o);if(!t){t={value:o(),error:!1},k.set(o,t)}if(t.error)return I(a,()=>"");const n=t.value;return e(n)&&null!=n?I(a,o,n):null}catch(e){return k.set(o,{value:void 0,error:!0}),c("Error evaluating reactive text function:",e),I(a,()=>"")}const i=o(r,a);return null==i?null:e(i)?T(a,i):t(i)?i:(n(i)&&M(r,i),null)}const l=o;return null==l?null:e(l)?T(a,l):t(l)?l:(n(l)&&M(r,l),null)}function I(e,t,n){const r=document.createDocumentFragment(),o=f(` text-${e} `);o&&r.appendChild(o);const i=function(e,t){if("function"!=typeof e)return c("Invalid resolver provided to createReactiveTextNode"),document.createTextNode("");const n=arguments.length>1?t:a(e,""),r=void 0===n?"":String(n),o=document.createTextNode(r);return C.set(o,{resolver:e,lastValue:r}),o}(t,n);return r.appendChild(i),r}function T(e,t){const n=document.createDocumentFragment(),r=f(` text-${e} `);r&&n.appendChild(r);const o=document.createTextNode(String(t));return n.appendChild(o),n}const D=new Set;function L(e,t){e._conditionalInfo=t,D.add(e)}function A(e,t,n=0){if(!t||0===t.length)return{element:e,nextIndex:n,appended:0};let r=n,o=0;const i=e;for(let n=0;n<t.length;n+=1){const s=t[n];if(null==s)continue;const c=F(e,s,r);c&&(c.parentNode!==i&&i.appendChild(c),r+=1,o+=1)}return{element:e,nextIndex:r,appended:o}}function O(e,t){const n=document.createElement(e);return A(n,t,0),n}function _(e){const t=function(e){for(let t=0;t<e.length;t+=1)if(j(e[t],e,t))return t;return-1}(e);return-1===t?{condition:null,otherModifiers:e}:{condition:e[t],otherModifiers:e.filter((e,n)=>n!==t)}}function B(e){return function(e){return V.includes(e)}(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function z(e,...t){return(n,r)=>{const{condition:o,otherModifiers:i}=_(t);if(o)return function(e,t,n){const r=t();if(!l)return r?O(e,n):h(e,"ssr");const o={condition:t,tagName:e,modifiers:n};if(r){const t=O(e,n);return L(t,o),t}const i=h(e);if(!i)throw new Error(`Failed to create conditional comment for ${e}`);return L(i,o),i}(e,o,i);const s=B(e);return A(s,i,r),s}}function q(e){return(...t)=>z(e,...t)}const P=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],V=["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","use","view"],G=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"];function W(e=globalThis){const t="__nuclo_tags_registered";e[t]||(V.forEach(t=>function(e,t){let n=t;["a","script","style","title","text"].includes(t)?n=`${t}_svg`:["stop"].includes(t)&&(n=`${t}_`),n in e||(e[n]=q(t))}(e,t)),P.forEach(t=>function(e,t){t in e&&"function"!=typeof e[t]||(e[t]=q(t))}(e,t)),e[t]=!0)}const H=new Set;function U(e,t,n){return function(e,t,n){if(i(e)){const o=e(t,n);return o&&r(o)?o:null}return e&&r(e)?e:null}(e.renderItem(t,n),e.host,n)}function Z(e){u(e.element)}function J(e){const{host:t,startMarker:n,endMarker:r}=e,o=n.parentNode??t,i=e.itemsProvider();if(function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if((n in e?e[n]:void 0)!==(n in t?t[n]:void 0))return!1;return!0}(e.lastSyncedItems,i))return;const s=new Map,c=new Map;e.records.forEach(e=>{const t=c.get(e.item);t?t.push(e):c.set(e.item,[e])}),i.forEach((t,n)=>{if(n<e.lastSyncedItems.length&&e.lastSyncedItems[n]===t){const r=e.records[n];if(r&&r.item===t){s.set(n,r);const e=c.get(t);if(e){const n=e.indexOf(r);n>=0&&(e.splice(n,1),0===e.length&&c.delete(t))}}}});const a=[],l=new Set(e.records);let u=r;for(let t=i.length-1;t>=0;t--){const n=i[t];let r=s.get(t);if(!r){const e=c.get(n);e&&e.length>0&&(r=e.shift(),0===e.length&&c.delete(n))}if(r)l.delete(r);else{const o=U(e,n,t);if(!o)continue;r={item:n,element:o}}a.unshift(r);const d=r.element;d.nextSibling!==u&&o.insertBefore(d,u),u=d}l.forEach(Z),e.records=a,e.lastSyncedItems=[...i]}function K(e,t){return(n,r)=>{const o=function(e,t,n){const{start:r,end:o}=m("list"),i={itemsProvider:e,renderItem:t,startMarker:r,endMarker:o,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(r),s.appendChild(o),H.add(i),J(i),i}(e,t,n);return o.startMarker}}function Q(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function X(e,t){return"function"==typeof e?Q(e,t):Boolean(e)}const Y=new Set;function ee(e,t,n,r){return i(e)?s(e)?(k.delete(e),F(t,e,n)):function(e,t,n){const r=e,o=r.appendChild.bind(r),i=r.insertBefore.bind(r);r.appendChild=function(e){return i(e,t)};try{return n()}finally{r.appendChild=o}}(t,r,()=>{const r=F(t,e,n);return r&&!r.parentNode?r:null}):F(t,e,n)}function te(e){const{groups:t,elseContent:n,host:r,index:o,endMarker:i}=e,s=function(e,t){for(let t=0;t<e.length;t++)if(X(e[t].condition))return t;return t.length>0?-1:null}(t,n);if(s===e.activeIndex)return;if(function(e,t){let n=e.nextSibling;for(;n&&n!==t;){const e=n.nextSibling;u(n),n=e}}(e.startMarker,e.endMarker),e.activeIndex=s,null===s)return;const c=function(e,t,n,r){const o=[];for(const i of e){const e=ee(i,t,n,r);e&&o.push(e)}return o}(s>=0?t[s].content:n,r,o,i);g(c,i)}class ne{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){if(!l){return f("when-ssr")||null}const{start:n,end:r}=m("when"),o={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:null,update:()=>te(o)};Y.add(o);const i=e;return i.appendChild(n),i.appendChild(r),te(o),n}}function re(e){return Object.assign((t,n)=>e.render(t,n),{when:(t,...n)=>(e.when(t,...n),re(e)),else:(...t)=>(e.else(...t),re(e))})}function oe(e,...t){return re(new ne(e,...t))}function ie(e){const t=function(e){return e._conditionalInfo??null}(e);if(!t)return;const n=Q(t.condition,e=>{c("Error evaluating conditional condition",e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){const n=function(e){try{return O(e.tagName,e.modifiers)}catch(t){return c(`Error applying modifiers in conditional element "${e.tagName}"`,t),document.createElement(e.tagName)}}(t);L(n,t),w(e,n)}else if(!n&&r){const n=h(t.tagName);n&&(L(n,t),w(e,n))}}const se=[function(){H.forEach(e=>{e.startMarker.isConnected&&e.endMarker.isConnected?J(e):H.delete(e)})},function(){Y.forEach(e=>{try{e.update()}catch(t){Y.delete(e)}})},function(){if(l)try{D.forEach(e=>{e.isConnected?ie(e):function(e){D.delete(e)}(e)})}catch(e){c("Error during conditional elements update",e)}},function(){x.forEach((e,t)=>{if(!b(t))return e.updateListener&&t.removeEventListener("update",e.updateListener),void x.delete(t);v(0,e)})},function(){C.forEach((e,t)=>{if(b(t))try{const n=a(e.resolver),r=void 0===n?"":String(n);r!==e.lastValue&&(t.textContent=r,e.lastValue=r)}catch(e){c("Failed to update reactive text node",e)}else C.delete(t)})},function(){if("undefined"==typeof document)return;const e=document.body?[document.body,document]:[document];for(const t of e)try{t.dispatchEvent(new Event("update",{bubbles:!0}))}catch(e){c("Error dispatching global update event",e)}}];function ce(){for(const e of se)e()}function ae(e,t,n){return r=>{if(!r||"function"!=typeof r.addEventListener)return;const o=r;o.addEventListener(e,n=>{try{t.call(o,n)}catch(t){c(`Error in '${e}' listener`,t)}},n)}}function le(e,t,n=0){const r=e(t||document.body,n);return(t||document.body).appendChild(r),r}const ue=new Map;function de(e,t,n){let r=document.querySelector("#nuclo-styles");r||(r=document.createElement("style"),r.id="nuclo-styles",document.head.appendChild(r));Array.from(r.sheet?.cssRules||[]).some(t=>t instanceof CSSStyleRule&&t.selectorText===`.${e}`)||r.sheet?.insertRule(`.${e} { ${t}: ${n}; }`,r.sheet.cssRules.length)}function fe(e,t,n,r){let o=document.querySelector("#nuclo-styles");o||(o=document.createElement("style"),o.id="nuclo-styles",document.head.appendChild(o));const i=Array.from(o.sheet?.cssRules||[]);let s=null;for(const e of i)if(e instanceof CSSMediaRule&&e.media.mediaText===r){s=e;break}if(!s){const e=o.sheet?.cssRules.length||0;o.sheet?.insertRule(`@media ${r} {}`,e),s=o.sheet?.cssRules[e]}Array.from(s.cssRules).some(t=>t instanceof CSSStyleRule&&t.selectorText===`.${e}`)||s.insertRule(`.${e} { ${t}: ${n}; }`,s.cssRules.length)}class he{classNames=[];classDefinitions=[];getClassNames(){return[...this.classNames]}getClassDefinitions(){return[...this.classDefinitions]}toString(){return this.classNames.join(" ")}addClass(e,t){const n=function(e,t){const n=`${e}:${t}`;if(ue.has(n))return ue.get(n);let r;const o={"background-color":"bg",color:"text","font-size":"text",display:"display",flex:"flex","justify-content":"justify","align-items":"items","font-weight":"font",padding:"p",margin:"m",width:"w",height:"h",border:"border","border-radius":"rounded","text-align":"text",gap:"gap","flex-direction":"flex",position:"position",opacity:"opacity",cursor:"cursor","box-shadow":"shadow",transition:"transition","text-decoration":"underline","letter-spacing":"tracking","min-width":"min-w","max-width":"max-w","min-height":"min-h","accent-color":"accent","line-height":"leading","font-family":"font",outline:"outline"}[e]||e.replace(/-/g,"-"),i=function(e){return(e=(e=(e=e.replace(/^#/,"")).replace(/[^a-zA-Z0-9]/g,"-")).replace(/^-+|-+$/g,"").replace(/-+/g,"-")).toLowerCase()}(t);return r="display"===e&&"flex"===t?"flex":"display"===e&&"grid"===t?"grid":"display"===e&&"block"===t?"display-block":"display"===e&&"none"===t?"display-none":"justify-content"===e&&"center"===t&&"justify"===o?"justify-center":"align-items"===e&&"center"===t&&"items"===o?"items-center":"font-weight"===e&&"bold"===t?"font-bold":"text-align"===e&&"center"===t?"text-center":"flex-direction"===e&&"column"===t?"flex-col":"flex-direction"===e&&"row"===t?"flex-row":"cursor"===e&&"pointer"===t?"cursor-pointer":"text-decoration"===e&&"line-through"===t?"line-through":`${o}-${i}`,ue.set(n,r),r}(e,t);return pe.set(n,{property:e,value:t}),this.classDefinitions.push({className:n,property:e,value:t}),de(n,e,t),this.classNames.includes(n)||this.classNames.push(n),this}add(e,t){return this.addClass(e,t)}bg(e){return this.addClass("background-color",e)}color(e){return this.addClass("color",e)}fontSize(e){return this.addClass("font-size",e)}display(e){return this.addClass("display",e)}flex(e){return void 0!==e?this.addClass("flex",e):this.addClass("display","flex")}center(){return this.addClass("justify-content","center"),this.addClass("align-items","center")}bold(){return this.addClass("font-weight","bold")}padding(e){return this.addClass("padding",e)}margin(e){return this.addClass("margin",e)}width(e){return this.addClass("width",e)}height(e){return this.addClass("height",e)}border(e){return this.addClass("border",e)}borderRadius(e){return this.addClass("border-radius",e)}textAlign(e){return this.addClass("text-align",e)}gap(e){return this.addClass("gap",e)}flexDirection(e){return this.addClass("flex-direction",e)}grid(){return this.addClass("display","grid")}position(e){return this.addClass("position",e)}opacity(e){return this.addClass("opacity",e)}cursor(e){return this.addClass("cursor",e)}boxShadow(e){return this.addClass("box-shadow",e)}transition(e){return this.addClass("transition",e)}textDecoration(e){return this.addClass("text-decoration",e)}letterSpacing(e){return this.addClass("letter-spacing",e)}fontWeight(e){return this.addClass("font-weight",e)}alignItems(e){return this.addClass("align-items",e)}justifyContent(e){return this.addClass("justify-content",e)}minWidth(e){return this.addClass("min-width",e)}maxWidth(e){return this.addClass("max-width",e)}minHeight(e){return this.addClass("min-height",e)}accentColor(e){return this.addClass("accent-color",e)}lineHeight(e){return this.addClass("line-height",e)}fontFamily(e){return this.addClass("font-family",e)}outline(e){return this.addClass("outline",e)}}const pe=new Map;function me(e){return function(t,n){let r,o;if(void 0!==n?(r=t,o=n):t instanceof he?(r=t,o=void 0):(r=void 0,o=t),!(r||o&&0!==Object.keys(o).length))return"";const i=[];if(r){const e=r.getClassDefinitions();for(const{className:t,property:n,value:r}of e)de(t,n,r),i.push(t)}if(o&&Object.keys(o).length>0){const t=Object.entries(e);for(const[e,n]of t){const t=o[e];if(t){const r=t.getClassDefinitions();for(const{className:t,property:o,value:s}of r){const r=`${e}-${t}`;fe(r,o,s,n),i.push(r)}}}}return{className:i.join(" ")}}}function ge(e,t){let n=document.querySelector("#nuclo-styles");n||(n=document.createElement("style"),n.id="nuclo-styles",document.head.appendChild(n));const r=Object.entries(t).map(([e,t])=>`${e}: ${t}`).join("; ");n.sheet?.insertRule(`.${e} { ${r} }`,n.sheet.cssRules.length)}function ye(e){return(new he).bg(e)}function be(e){return(new he).color(e)}function we(e){return(new he).fontSize(e)}function Ce(e){return(new he).flex(e)}function xe(){return(new he).center()}function ve(){return(new he).bold()}function Se(e){return(new he).padding(e)}function Ee(e){return(new he).margin(e)}function Ne(e){return(new he).width(e)}function $e(e){return(new he).height(e)}function Me(e){return(new he).border(e)}function ke(e){return(new he).borderRadius(e)}function Re(e){return(new he).textAlign(e)}function je(e){return(new he).gap(e)}function Fe(e){return(new he).flexDirection(e)}function Ie(){return(new he).grid()}function Te(e){return(new he).position(e)}function De(e){return(new he).opacity(e)}function Le(e){return(new he).cursor(e)}function Ae(){if(W(),"undefined"!=typeof globalThis){const e=globalThis;e.list=K,e.update=ce,e.when=oe,e.on=ae,e.render=le,e.createCSSClass=ge,e.createBreakpoints=me,e.bg=ye,e.color=be,e.fontSize=we,e.flex=Ce,e.center=xe,e.bold=ve,e.padding=Se,e.margin=Ee,e.width=Ne,e.height=$e,e.border=Me,e.borderRadius=ke,e.textAlign=Re,e.gap=je,e.flexDirection=Fe,e.grid=Ie,e.position=Te,e.opacity=De,e.cursor=Le}}"undefined"!=typeof globalThis&&Ae();export{P as HTML_TAGS,G as SELF_CLOSING_TAGS,V as SVG_TAGS,y as appendChildren,M as applyAttributes,F as applyNodeModifier,ye as bg,ve as bold,Me as border,ke as borderRadius,xe as center,be as color,me as createBreakpoints,ge as createCSSClass,f as createComment,h as createConditionalComment,z as createElementFactory,O as createElementWithModifiers,q as createTagBuilder,Le as cursor,Ce as flex,Fe as flexDirection,we as fontSize,je as gap,Ie as grid,$e as height,Ae as initializeRuntime,o as isBoolean,l as isBrowser,i as isFunction,t as isNode,n as isObject,e as isPrimitive,r as isTagLike,s as isZeroArityFunction,K as list,Ee as margin,ae as on,De as opacity,Se as padding,Te as position,W as registerGlobalTagBuilders,le as render,w as replaceNodeSafely,Re as textAlign,ce as update,oe as when,Ne as width};
2
2
  //# sourceMappingURL=nuclo.js.map