nuclo 0.1.47 → 0.1.48

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.
@@ -1,3 +1,3 @@
1
- export declare function applyAttributes<TTagName extends ElementTagName>(element: ExpandedElement<TTagName>, attributes: ExpandedElementAttributes<TTagName>): void;
1
+ export declare function applyAttributes<TTagName extends ElementTagName>(element: ExpandedElement<TTagName>, attributes: ExpandedElementAttributes<TTagName>, mergeClassName?: boolean): void;
2
2
  export { createReactiveTextNode } from "./reactive";
3
3
  //# sourceMappingURL=attributeManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributeManager.d.ts","sourceRoot":"","sources":["../../src/core/attributeManager.ts"],"names":[],"mappings":"AAsDA,wBAAgB,eAAe,CAAC,QAAQ,SAAS,cAAc,EAC7D,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAClC,UAAU,EAAE,yBAAyB,CAAC,QAAQ,CAAC,GAC9C,IAAI,CAON;AAED,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"attributeManager.d.ts","sourceRoot":"","sources":["../../src/core/attributeManager.ts"],"names":[],"mappings":"AA0EA,wBAAgB,eAAe,CAAC,QAAQ,SAAS,cAAc,EAC7D,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAClC,UAAU,EAAE,yBAAyB,CAAC,QAAQ,CAAC,EAC/C,cAAc,UAAO,GACpB,IAAI,CASN;AAED,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeBootstrap.d.ts","sourceRoot":"","sources":["../../src/core/runtimeBootstrap.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAWxC"}
1
+ {"version":3,"file":"runtimeBootstrap.d.ts","sourceRoot":"","sources":["../../src/core/runtimeBootstrap.ts"],"names":[],"mappings":"AA8BA;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAkCxC"}
package/dist/index.d.ts CHANGED
@@ -12,5 +12,6 @@ export { render } from "./utility/render";
12
12
  export { isBoolean, isFunction, isNode, isObject, isPrimitive, isTagLike, isZeroArityFunction } from "./utility/typeGuards";
13
13
  export { isBrowser } from "./utility/environment";
14
14
  export { createElementWithModifiers } from "./internal/applyModifiers";
15
+ export { createCSSClass, createBreakpoints, bg, color, fontSize, flex, center, bold, padding, margin, width, height, border, borderRadius, textAlign, gap, flexDirection, grid, position, opacity, cursor } from "./style";
15
16
  import "./core/runtimeBootstrap";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,EAAE,EACF,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,YAAY,EACZ,SAAS,EACT,GAAG,EACH,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,SAAS,CAAC;AAGjB,OAAO,yBAAyB,CAAC"}
package/dist/nuclo.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";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"function"==typeof e}function i(e){return o(e)&&0===e.length}function c(e,t){"undefined"!=typeof console&&console.error(`nuclo: ${e}`,t)}function u(e,t){try{return e()}catch(e){return c("Operation failed",e),t}}const s="undefined"!=typeof window&&"undefined"!=typeof document;function a(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 l(e){if(!s)return null;try{return document.createComment(e)}catch(e){return c("Failed to create comment node",e),null}}function d(e){return l(e)}function f(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(!s)throw new Error("Cannot create comment in non-browser environment");const t=l(`${e}-${Math.random().toString(36).slice(2)}`);if(!t)throw new Error("Failed to create comment");return t}function h(e){const t=l(`${e}-end`);if(!t)throw new Error("Failed to create end comment");return{start:p(`${e}-start`),end:t}}function m(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 g(e){return!!e&&("boolean"==typeof e.isConnected?e.isConnected:!(!s||"undefined"==typeof document)&&document.contains(e))}function y(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 b=new Map,v=new Map;function x(e,t){t.attributeResolvers.forEach(({resolver:e,applyValue:t},n)=>{try{t(u(e))}catch(e){c(`Failed to update reactive attribute: ${n}`,e)}})}function E(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=v.get(e);return t||(t={attributeResolvers:new Map},v.set(e,t)),t}(e);o.attributeResolvers.set(t,{resolver:n,applyValue:r});try{r(u(n))}catch(e){c("Failed to apply initial attribute value",e)}if(!o.updateListener){const t=()=>x(0,o);e.addEventListener("update",t),o.updateListener=t}}function w(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 C(e,t){if(e?.style&&t)for(const[n,r]of Object.entries(t)){w(e,n,r)||c(`Failed to set style property '${n}'`)}}function S(e,t,n){if(null==n)return;if("style"===t)return i=n,void((r=e)&&(o(i)?E(r,"style",()=>{try{return i()}catch(e){return c("Error in style resolver function",e),null}},e=>{C(r,e)}):C(r,i)));var r,i;const u=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(o(n)&&0===n.length){const r=n;E(e,String(t),r,u)}else u(n)}function M(e,t){if(t)for(const n of Object.keys(t)){S(e,n,t[n])}}const N=new WeakMap;function k(e){const{value:t,error:n}=function(e){const t=N.get(e);if(t)return t;try{const t={value:e(),error:!1};return N.set(e,t),t}catch{const t={value:void 0,error:!0};return N.set(e,t),t}}(e);return!n&&"boolean"==typeof t}function F(e,r,i){if(!o(e)||0!==e.length)return!1;if(!k(e))return!1;const c=r.filter((e,t)=>t!==i);if(0===c.length)return!1;return c.some(e=>!(!n(e)&&!t(e))||!!(o(e)&&e.length>0))}function T(r,u,s){if(null==u)return null;if(o(u)){if(i(u))try{let t=N.get(u);if(!t){t={value:u(),error:!1},N.set(u,t)}if(t.error)return I(s,()=>"");const n=t.value;return e(n)&&null!=n?I(s,u,n):null}catch(e){return N.set(u,{value:void 0,error:!0}),c("Error evaluating reactive text function:",e),I(s,()=>"")}const o=u(r,s);return null==o?null:e(o)?L(s,o):t(o)?o:(n(o)&&M(r,o),null)}const a=u;return null==a?null:e(a)?L(s,a):t(a)?a:(n(a)&&M(r,a),null)}function I(e,t,n){const r=document.createDocumentFragment(),o=d(` 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:u(e,""),r=void 0===n?"":String(n),o=document.createTextNode(r);return b.set(o,{resolver:e,lastValue:r}),o}(t,n);return r.appendChild(i),r}function L(e,t){const n=document.createDocumentFragment(),r=d(` text-${e} `);r&&n.appendChild(r);const o=document.createTextNode(String(t));return n.appendChild(o),n}const $=new Set;function _(e,t){e._conditionalInfo=t,$.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 A(e,t){const n=document.createElement(e);return B(n,t,0),n}function G(e){const t=function(e){for(let t=0;t<e.length;t+=1)if(F(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 O(e){return function(e){return P.includes(e)}(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function j(e,...t){return(n,r)=>{const{condition:o,otherModifiers:i}=G(t);if(o)return function(e,t,n){const r=t();if(!s)return r?A(e,n):f(e,"ssr");const o={condition:t,tagName:e,modifiers:n};if(r){const t=A(e,n);return _(t,o),t}const i=f(e);if(!i)throw new Error(`Failed to create conditional comment for ${e}`);return _(i,o),i}(e,o,i);const c=O(e);return B(c,i,r),c}}function R(e){return(...t)=>j(e,...t)}const D=["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"],P=["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"];function V(e=globalThis){const t="__nuclo_tags_registered";e[t]||(P.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]=R(t))}(e,t)),D.forEach(t=>function(e,t){t in e&&"function"!=typeof e[t]||(e[t]=R(t))}(e,t)),e[t]=!0)}const q=new Set;function W(e,t,n){return function(e,t,n){if(o(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){a(e.element)}function H(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 s=[],a=new Set(e.records);let l=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)a.delete(r);else{const o=W(e,n,t);if(!o)continue;r={item:n,element:o}}s.unshift(r);const d=r.element;d.nextSibling!==l&&o.insertBefore(d,l),l=d}a.forEach(z),e.records=s,e.lastSyncedItems=[...i]}function U(e,t){return(n,r)=>{const o=function(e,t,n){const{start:r,end:o}=h("list"),i={itemsProvider:e,renderItem:t,startMarker:r,endMarker:o,records:[],host:n,lastSyncedItems:[]},c=n;return c.appendChild(r),c.appendChild(o),q.add(i),H(i),i}(e,t,n);return o.startMarker}}function Z(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function J(e,t){return"function"==typeof e?Z(e,t):Boolean(e)}const K=new Set;function Q(e,t,n,r){return o(e)?i(e)?(N.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 X(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(J(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;a(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=Q(i,t,n,r);e&&o.push(e)}return o}(c>=0?t[c].content:n,r,o,i);m(u,i)}class Y{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(!s){return d("when-ssr")||null}const{start:n,end:r}=h("when"),o={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:null,update:()=>X(o)};K.add(o);const i=e;return i.appendChild(n),i.appendChild(r),X(o),n}}function ee(e){return Object.assign((t,n)=>e.render(t,n),{when:(t,...n)=>(e.when(t,...n),ee(e)),else:(...t)=>(e.else(...t),ee(e))})}function te(e,...t){return ee(new Y(e,...t))}function ne(e){const t=function(e){return e._conditionalInfo??null}(e);if(!t)return;const n=Z(t.condition,e=>{c("Error evaluating conditional condition",e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){const n=function(e){try{return A(e.tagName,e.modifiers)}catch(t){return c(`Error applying modifiers in conditional element "${e.tagName}"`,t),document.createElement(e.tagName)}}(t);_(n,t),y(e,n)}else if(!n&&r){const n=f(t.tagName);n&&(_(n,t),y(e,n))}}const re=[function(){q.forEach(e=>{e.startMarker.isConnected&&e.endMarker.isConnected?H(e):q.delete(e)})},function(){K.forEach(e=>{try{e.update()}catch(t){K.delete(e)}})},function(){if(s)try{$.forEach(e=>{e.isConnected?ne(e):function(e){$.delete(e)}(e)})}catch(e){c("Error during conditional elements update",e)}},function(){v.forEach((e,t)=>{if(!g(t))return e.updateListener&&t.removeEventListener("update",e.updateListener),void v.delete(t);x(0,e)})},function(){b.forEach((e,t)=>{if(g(t))try{const n=u(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 b.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 oe(){for(const e of re)e()}function ie(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 ce(e,t,n=0){const r=e(t||document.body,n);return(t||document.body).appendChild(r),r}function ue(){if(V(),"undefined"!=typeof globalThis){const e=globalThis;e.list=U,e.update=oe,e.when=te,e.on=ie,e.render=ce}}"undefined"!=typeof globalThis&&ue(),exports.HTML_TAGS=D,exports.SELF_CLOSING_TAGS=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"],exports.SVG_TAGS=P,exports.appendChildren=function(e,...t){return e?(t.forEach(t=>{if(null!=t){let n;if("string"==typeof t){const e=function(e){if(!s)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},exports.applyAttributes=M,exports.applyNodeModifier=T,exports.createComment=d,exports.createConditionalComment=f,exports.createElementFactory=j,exports.createElementWithModifiers=A,exports.createTagBuilder=R,exports.initializeRuntime=ue,exports.isBoolean=function(e){return"boolean"==typeof e},exports.isBrowser=s,exports.isFunction=o,exports.isNode=t,exports.isObject=n,exports.isPrimitive=e,exports.isTagLike=r,exports.isZeroArityFunction=i,exports.list=U,exports.on=ie,exports.registerGlobalTagBuilders=V,exports.render=ce,exports.replaceNodeSafely=y,exports.update=oe,exports.when=te;
1
+ "use strict";function t(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function e(t){return t instanceof Node}function n(t){return"object"==typeof t&&null!==t}function r(t){return n(t)&&"tagName"in t}function o(t){return"function"==typeof t}function i(t){return o(t)&&0===t.length}function s(t,e){"undefined"!=typeof console&&console.error(`nuclo: ${t}`,e)}function c(t,e){try{return t()}catch(t){return s("Operation failed",t),e}}const u="undefined"!=typeof window&&"undefined"!=typeof document;function l(t){if(!t?.parentNode)return!1;try{return t.parentNode.removeChild(t),!0}catch(t){return s("Failed to remove child node",t),!1}}function a(t){if(!u)return null;try{return document.createComment(t)}catch(t){return s("Failed to create comment node",t),null}}function d(t){return a(t)}function f(t,e="hidden"){try{return document.createComment(`conditional-${t}-${e}`)}catch(t){return s("Failed to create conditional comment",t),null}}function h(t){if(!u)throw new Error("Cannot create comment in non-browser environment");const e=a(`${t}-${Math.random().toString(36).slice(2)}`);if(!e)throw new Error("Failed to create comment");return e}function p(t){const e=a(`${t}-end`);if(!e)throw new Error("Failed to create end comment");return{start:h(`${t}-start`),end:e}}function m(t,e){const n=e.parentNode;n&&t.forEach(t=>function(t,e,n){if(!t||!e)return!1;try{return t.insertBefore(e,n),!0}catch(t){return s("Failed to insert node before reference",t),!1}}(n,t,e))}function g(t){return!!t&&("boolean"==typeof t.isConnected?t.isConnected:!(!u||"undefined"==typeof document)&&document.contains(t))}function y(t,e){if(!t?.parentNode)return!1;try{return t.parentNode.replaceChild(e,t),!0}catch(t){return s("Error replacing conditional node",t),!1}}const x=new Map,b=new Map;function w(t,e){e.attributeResolvers.forEach(({resolver:t,applyValue:e},n)=>{try{e(c(t))}catch(t){s(`Failed to update reactive attribute: ${n}`,t)}})}function v(t,e,n,r){if(!(t instanceof Element&&e&&"function"==typeof n))return void s("Invalid parameters for registerAttributeResolver");const o=function(t){let e=b.get(t);return e||(e={attributeResolvers:new Map},b.set(t,e)),e}(t);o.attributeResolvers.set(e,{resolver:n,applyValue:r});try{r(c(n))}catch(t){s("Failed to apply initial attribute value",t)}if(!o.updateListener){const e=()=>w(0,o);t.addEventListener("update",e),o.updateListener=e}}function S(t,e,n){try{if(null==n||""===n)return t.style[e]="",!0;const r=String(n);return t.style[e]=r,!0}catch{return!1}}function E(t,e){if(t?.style&&e)for(const[n,r]of Object.entries(e)){S(t,n,r)||s(`Failed to set style property '${n}'`)}}function C(t,e,n,r=!1){if(null==n)return;if("style"===e)return c=n,void((i=t)&&(o(c)?v(i,"style",()=>{try{return c()}catch(t){return s("Error in style resolver function",t),null}},t=>{E(i,t)}):E(i,c)));var i,c;const u=(n,r=!1)=>{if(null==n)return;if("className"===e&&t instanceof HTMLElement&&r){const e=String(n),r=t.className;if(r&&r!==e){const n=new Set(r.split(" ").filter(t=>t));e.split(" ").filter(t=>t).forEach(t=>n.add(t)),t.className=Array.from(n).join(" ")}else e&&(t.className=e);return}if(t instanceof Element&&"http://www.w3.org/2000/svg"===t.namespaceURI)t.setAttribute(String(e),String(n));else if(e in t)try{t[e]=n}catch{t instanceof Element&&t.setAttribute(String(e),String(n))}else t instanceof Element&&t.setAttribute(String(e),String(n))};if(o(n)&&0===n.length){const r=n;v(t,String(e),r,t=>u(t,!1))}else u(n,r)}function N(t,e,n=!0){if(e)for(const r of Object.keys(e)){C(t,r,e[r],n&&"className"===r)}}const M=new WeakMap;function k(t){const{value:e,error:n}=function(t){const e=M.get(t);if(e)return e;try{const e={value:t(),error:!1};return M.set(t,e),e}catch{const e={value:void 0,error:!0};return M.set(t,e),e}}(t);return!n&&"boolean"==typeof e}function F(t,r,i){if(!o(t)||0!==t.length)return!1;if(!k(t))return!1;const s=r.filter((t,e)=>e!==i);if(0===s.length)return!1;return s.some(t=>!(!n(t)&&!e(t))||!!(o(t)&&t.length>0))}function $(r,c,u){if(null==c)return null;if(o(c)){if(i(c))try{let e=M.get(c);if(!e){e={value:c(),error:!1},M.set(c,e)}if(e.error)return T(u,()=>"");const n=e.value;return t(n)&&null!=n?T(u,c,n):null}catch(t){return M.set(c,{value:void 0,error:!0}),s("Error evaluating reactive text function:",t),T(u,()=>"")}const o=c(r,u);return null==o?null:t(o)?I(u,o):e(o)?o:(n(o)&&N(r,o),null)}const l=c;return null==l?null:t(l)?I(u,l):e(l)?l:(n(l)&&N(r,l),null)}function T(t,e,n){const r=document.createDocumentFragment(),o=d(` text-${t} `);o&&r.appendChild(o);const i=function(t,e){if("function"!=typeof t)return s("Invalid resolver provided to createReactiveTextNode"),document.createTextNode("");const n=arguments.length>1?e:c(t,""),r=void 0===n?"":String(n),o=document.createTextNode(r);return x.set(o,{resolver:t,lastValue:r}),o}(e,n);return r.appendChild(i),r}function I(t,e){const n=document.createDocumentFragment(),r=d(` text-${t} `);r&&n.appendChild(r);const o=document.createTextNode(String(e));return n.appendChild(o),n}const L=new Set;function j(t,e){t._conditionalInfo=e,L.add(t)}function R(t,e,n=0){if(!e||0===e.length)return{element:t,nextIndex:n,appended:0};let r=n,o=0;const i=t;for(let n=0;n<e.length;n+=1){const s=e[n];if(null==s)continue;const c=$(t,s,r);c&&(c.parentNode!==i&&i.appendChild(c),r+=1,o+=1)}return{element:t,nextIndex:r,appended:o}}function A(t,e){const n=document.createElement(t);return R(n,e,0),n}function O(t){const e=function(t){for(let e=0;e<t.length;e+=1)if(F(t[e],t,e))return e;return-1}(t);return-1===e?{condition:null,otherModifiers:t}:{condition:t[e],otherModifiers:t.filter((t,n)=>n!==e)}}function B(t){return function(t){return z.includes(t)}(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function _(t,...e){return(n,r)=>{const{condition:o,otherModifiers:i}=O(e);if(o)return function(t,e,n){const r=e();if(!u)return r?A(t,n):f(t,"ssr");const o={condition:e,tagName:t,modifiers:n};if(r){const e=A(t,n);return j(e,o),e}const i=f(t);if(!i)throw new Error(`Failed to create conditional comment for ${t}`);return j(i,o),i}(t,o,i);const s=B(t);return R(s,i,r),s}}function D(t){return(...e)=>_(t,...e)}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"],z=["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"];function P(t=globalThis){const e="__nuclo_tags_registered";t[e]||(z.forEach(e=>function(t,e){let n=e;["a","script","style","title","text"].includes(e)?n=`${e}_svg`:["stop"].includes(e)&&(n=`${e}_`),n in t||(t[n]=D(e))}(t,e)),G.forEach(e=>function(t,e){e in t&&"function"!=typeof t[e]||(t[e]=D(e))}(t,e)),t[e]=!0)}const V=new Set;function W(t,e,n){return function(t,e,n){if(o(t)){const o=t(e,n);return o&&r(o)?o:null}return t&&r(t)?t:null}(t.renderItem(e,n),t.host,n)}function q(t){l(t.element)}function H(t){const{host:e,startMarker:n,endMarker:r}=t,o=n.parentNode??e,i=t.itemsProvider();if(function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if((n in t?t[n]:void 0)!==(n in e?e[n]:void 0))return!1;return!0}(t.lastSyncedItems,i))return;const s=new Map,c=new Map;t.records.forEach(t=>{const e=c.get(t.item);e?e.push(t):c.set(t.item,[t])}),i.forEach((e,n)=>{if(n<t.lastSyncedItems.length&&t.lastSyncedItems[n]===e){const r=t.records[n];if(r&&r.item===e){s.set(n,r);const t=c.get(e);if(t){const n=t.indexOf(r);n>=0&&(t.splice(n,1),0===t.length&&c.delete(e))}}}});const u=[],l=new Set(t.records);let a=r;for(let e=i.length-1;e>=0;e--){const n=i[e];let r=s.get(e);if(!r){const t=c.get(n);t&&t.length>0&&(r=t.shift(),0===t.length&&c.delete(n))}if(r)l.delete(r);else{const o=W(t,n,e);if(!o)continue;r={item:n,element:o}}u.unshift(r);const d=r.element;d.nextSibling!==a&&o.insertBefore(d,a),a=d}l.forEach(q),t.records=u,t.lastSyncedItems=[...i]}function U(t,e){return(n,r)=>{const o=function(t,e,n){const{start:r,end:o}=p("list"),i={itemsProvider:t,renderItem:e,startMarker:r,endMarker:o,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(r),s.appendChild(o),V.add(i),H(i),i}(t,e,n);return o.startMarker}}function Z(t,e){try{return t()}catch(t){if(e)return e(t),!1;throw t}}function J(t,e){return"function"==typeof t?Z(t,e):Boolean(t)}const K=new Set;function Q(t,e,n,r){return o(t)?i(t)?(M.delete(t),$(e,t,n)):function(t,e,n){const r=t,o=r.appendChild.bind(r),i=r.insertBefore.bind(r);r.appendChild=function(t){return i(t,e)};try{return n()}finally{r.appendChild=o}}(e,r,()=>{const r=$(e,t,n);return r&&!r.parentNode?r:null}):$(e,t,n)}function X(t){const{groups:e,elseContent:n,host:r,index:o,endMarker:i}=t,s=function(t,e){for(let e=0;e<t.length;e++)if(J(t[e].condition))return e;return e.length>0?-1:null}(e,n);if(s===t.activeIndex)return;if(function(t,e){let n=t.nextSibling;for(;n&&n!==e;){const t=n.nextSibling;l(n),n=t}}(t.startMarker,t.endMarker),t.activeIndex=s,null===s)return;const c=function(t,e,n,r){const o=[];for(const i of t){const t=Q(i,e,n,r);t&&o.push(t)}return o}(s>=0?e[s].content:n,r,o,i);m(c,i)}class Y{groups=[];elseContent=[];constructor(t,...e){this.groups.push({condition:t,content:e})}when(t,...e){return this.groups.push({condition:t,content:e}),this}else(...t){return this.elseContent=t,this}render(t,e){if(!u){return d("when-ssr")||null}const{start:n,end:r}=p("when"),o={startMarker:n,endMarker:r,host:t,index:e,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:null,update:()=>X(o)};K.add(o);const i=t;return i.appendChild(n),i.appendChild(r),X(o),n}}function tt(t){return Object.assign((e,n)=>t.render(e,n),{when:(e,...n)=>(t.when(e,...n),tt(t)),else:(...e)=>(t.else(...e),tt(t))})}function et(t,...e){return tt(new Y(t,...e))}function nt(t){const e=function(t){return t._conditionalInfo??null}(t);if(!e)return;const n=Z(e.condition,t=>{s("Error evaluating conditional condition",t)}),r=t.nodeType===Node.ELEMENT_NODE;if(n&&!r){const n=function(t){try{return A(t.tagName,t.modifiers)}catch(e){return s(`Error applying modifiers in conditional element "${t.tagName}"`,e),document.createElement(t.tagName)}}(e);j(n,e),y(t,n)}else if(!n&&r){const n=f(e.tagName);n&&(j(n,e),y(t,n))}}const rt=[function(){V.forEach(t=>{t.startMarker.isConnected&&t.endMarker.isConnected?H(t):V.delete(t)})},function(){K.forEach(t=>{try{t.update()}catch(e){K.delete(t)}})},function(){if(u)try{L.forEach(t=>{t.isConnected?nt(t):function(t){L.delete(t)}(t)})}catch(t){s("Error during conditional elements update",t)}},function(){b.forEach((t,e)=>{if(!g(e))return t.updateListener&&e.removeEventListener("update",t.updateListener),void b.delete(e);w(0,t)})},function(){x.forEach((t,e)=>{if(g(e))try{const n=c(t.resolver),r=void 0===n?"":String(n);r!==t.lastValue&&(e.textContent=r,t.lastValue=r)}catch(t){s("Failed to update reactive text node",t)}else x.delete(e)})},function(){if("undefined"==typeof document)return;const t=document.body?[document.body,document]:[document];for(const e of t)try{e.dispatchEvent(new Event("update",{bubbles:!0}))}catch(t){s("Error dispatching global update event",t)}}];function ot(){for(const t of rt)t()}function it(t,e,n){return r=>{if(!r||"function"!=typeof r.addEventListener)return;const o=r;o.addEventListener(t,n=>{try{e.call(o,n)}catch(e){s(`Error in '${t}' listener`,e)}},n)}}function st(t,e,n=0){const r=t(e||document.body,n);return(e||document.body).appendChild(r),r}function ct(t,e){let n=document.querySelector("#nuclo-styles");n||(n=document.createElement("style"),n.id="nuclo-styles",document.head.appendChild(n));const r=Object.entries(e).map(([t,e])=>`${t}: ${e}`).join("; ");n.sheet?.insertRule(`.${t} { ${r} }`,n.sheet.cssRules.length)}class ut{styles={};getStyles(){return{...this.styles}}add(t,e){return this.styles[t]=e,this}bg(t){return this.styles["background-color"]=t,this}color(t){return this.styles.color=t,this}fontSize(t){return this.styles["font-size"]=t,this}display(t){return this.styles.display=t,this}flex(t){return void 0!==t?this.styles.flex=t:this.styles.display="flex",this}center(){return this.styles["justify-content"]="center",this.styles["align-items"]="center",this}bold(){return this.styles["font-weight"]="bold",this}padding(t){return this.styles.padding=t,this}margin(t){return this.styles.margin=t,this}width(t){return this.styles.width=t,this}height(t){return this.styles.height=t,this}border(t){return this.styles.border=t,this}borderRadius(t){return this.styles["border-radius"]=t,this}textAlign(t){return this.styles["text-align"]=t,this}gap(t){return this.styles.gap=t,this}flexDirection(t){return this.styles["flex-direction"]=t,this}grid(){return this.styles.display="grid",this}position(t){return this.styles.position=t,this}opacity(t){return this.styles.opacity=t,this}cursor(t){return this.styles.cursor=t,this}boxShadow(t){return this.styles["box-shadow"]=t,this}transition(t){return this.styles.transition=t,this}textDecoration(t){return this.styles["text-decoration"]=t,this}letterSpacing(t){return this.styles["letter-spacing"]=t,this}fontWeight(t){return this.styles["font-weight"]=t,this}alignItems(t){return this.styles["align-items"]=t,this}justifyContent(t){return this.styles["justify-content"]=t,this}minWidth(t){return this.styles["min-width"]=t,this}maxWidth(t){return this.styles["max-width"]=t,this}minHeight(t){return this.styles["min-height"]=t,this}accentColor(t){return this.styles["accent-color"]=t,this}lineHeight(t){return this.styles["line-height"]=t,this}fontFamily(t){return this.styles["font-family"]=t,this}outline(t){return this.styles.outline=t,this}}let lt=0;function at(t){return function(e){if(!e||0===Object.keys(e).length)return"";const n="nuclo-bp-"+lt++,r=Object.entries(t);let o=!0;for(const[t,i]of r){const r=e[t];if(r){const t=r.getStyles();o?(ct(n,t),o=!1):dt(n,t,i)}}return{className:n}}}function dt(t,e,n){let r=document.querySelector("#nuclo-styles");r||(r=document.createElement("style"),r.id="nuclo-styles",document.head.appendChild(r));const o=`@media ${n} { .${t} { ${Object.entries(e).map(([t,e])=>`${t}: ${e}`).join("; ")} } }`;r.sheet?.insertRule(o,r.sheet.cssRules.length)}function ft(t){return(new ut).bg(t)}function ht(t){return(new ut).color(t)}function pt(t){return(new ut).fontSize(t)}function mt(t){return(new ut).flex(t)}function gt(){return(new ut).center()}function yt(){return(new ut).bold()}function xt(t){return(new ut).padding(t)}function bt(t){return(new ut).margin(t)}function wt(t){return(new ut).width(t)}function vt(t){return(new ut).height(t)}function St(t){return(new ut).border(t)}function Et(t){return(new ut).borderRadius(t)}function Ct(t){return(new ut).textAlign(t)}function Nt(t){return(new ut).gap(t)}function Mt(t){return(new ut).flexDirection(t)}function kt(){return(new ut).grid()}function Ft(t){return(new ut).position(t)}function $t(t){return(new ut).opacity(t)}function Tt(t){return(new ut).cursor(t)}function It(){if(P(),"undefined"!=typeof globalThis){const t=globalThis;t.list=U,t.update=ot,t.when=et,t.on=it,t.render=st,t.createCSSClass=ct,t.createBreakpoints=at,t.bg=ft,t.color=ht,t.fontSize=pt,t.flex=mt,t.center=gt,t.bold=yt,t.padding=xt,t.margin=bt,t.width=wt,t.height=vt,t.border=St,t.borderRadius=Et,t.textAlign=Ct,t.gap=Nt,t.flexDirection=Mt,t.grid=kt,t.position=Ft,t.opacity=$t,t.cursor=Tt}}"undefined"!=typeof globalThis&&It(),exports.HTML_TAGS=G,exports.SELF_CLOSING_TAGS=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"],exports.SVG_TAGS=z,exports.appendChildren=function(t,...e){return t?(e.forEach(e=>{if(null!=e){let n;if("string"==typeof e){const t=function(t){if(!u)return null;try{return document.createTextNode(String(t))}catch(t){return s("Failed to create text node",t),null}}(e);if(!t)return;n=t}else n=e;!function(t,e){if(!t||!e)return!1;try{return t.appendChild(e),!0}catch(t){return s("Failed to append child node",t),!1}}(t,n)}}),t):t},exports.applyAttributes=N,exports.applyNodeModifier=$,exports.bg=ft,exports.bold=yt,exports.border=St,exports.borderRadius=Et,exports.center=gt,exports.color=ht,exports.createBreakpoints=at,exports.createCSSClass=ct,exports.createComment=d,exports.createConditionalComment=f,exports.createElementFactory=_,exports.createElementWithModifiers=A,exports.createTagBuilder=D,exports.cursor=Tt,exports.flex=mt,exports.flexDirection=Mt,exports.fontSize=pt,exports.gap=Nt,exports.grid=kt,exports.height=vt,exports.initializeRuntime=It,exports.isBoolean=function(t){return"boolean"==typeof t},exports.isBrowser=u,exports.isFunction=o,exports.isNode=e,exports.isObject=n,exports.isPrimitive=t,exports.isTagLike=r,exports.isZeroArityFunction=i,exports.list=U,exports.margin=bt,exports.on=it,exports.opacity=$t,exports.padding=xt,exports.position=Ft,exports.registerGlobalTagBuilders=P,exports.render=st,exports.replaceNodeSafely=y,exports.textAlign=Ct,exports.update=ot,exports.when=et,exports.width=wt;
2
2
  //# sourceMappingURL=nuclo.cjs.map