@symbo.ls/element 3.14.678 → 3.14.682
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/CHANGELOG.md +8 -0
- package/dist/cjs/src/cache.js +1 -1
- package/dist/cjs/src/create.js +4 -4
- package/dist/esm/src/cache.js +1 -1
- package/dist/esm/src/create.js +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/src/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},v=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h(t))!b.call(e,o)&&o!==r&&c(e,o,{get:()=>t[o],enumerable:!(n=m(t,o))||n.enumerable});return e};var x=e=>v(c({},"__esModule",{value:!0}),e);var k={};y(k,{SVG_NS:()=>i,SVG_TAGS:()=>s,cacheNode:()=>S,createHTMLNode:()=>f,detectTag:()=>g,isSvgTag:()=>l,isValidTag:()=>d});module.exports=x(k);const i="http://www.w3.org/2000/svg",s=new Set(["svg","path","circle","ellipse","line","polyline","polygon","rect","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","foreignObject","desc","title","metadata"]),T=new Set(["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","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","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","string","fragment","shadow"]);function d(e){return T.has(e)||s.has(e)}function l(e){return s.has(e)}function g(e){let{tag:t,key:r}=e;if(typeof t=="function")try{t=t(e,e.state,e.context)}catch(a){t=void 0,typeof console<"u"&&console.error&&console.error(`[smbls] \`tag:\` factory threw on "${r||"<anon>"}" \u2014 falling back to key-based tag detection:`,a?.message||a)}if(t===!0&&(t=r),typeof t=="string"&&d(t))return t;if(!r||typeof r!="string")return"div";const n=new Set(["html","head","body","meta","link","script","style","title","base","noscript","template","th","tr","td","thead","tbody","tfoot","caption","col","colgroup"]);let o=r.toLowerCase();return o.includes(".")&&(o=o.split(".")[0]),o.includes("_")&&(o=o.split("_")[0]),d(o)&&!n.has(o)?o:"div"}const p={};function f(e,t){const r=t?.context?.document||globalThis.document;if(!r)return null;if(e==="string")return r.createTextNode(t?.text||"");if(e==="fragment")return r.createDocumentFragment();if(l(e)){const n=t?.parent;if(e==="svg"||n?.node?.namespaceURI===i)return r.createElementNS(i,e);if(e!=="svg")return r.createElement("div")}return r.createElement(e)}function S(e){const t=e.tag=g(e),n=l(t)&&(t==="svg"||e.parent?.node?.namespaceURI===i)?"svg:"+t:t,o=e?.context?.document||globalThis.document;let a=p[n];if(a||(a=p[n]=f(t,e)),!a)return null;const u=o&&a.ownerDocument!==o?f(t,e):a.cloneNode(!0);return t==="string"&&(u.nodeValue=e.text||""),u}
|
package/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var it=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Kt=Object.prototype.hasOwnProperty;var Ut=(t,s)=>{for(var n in s)it(t,n,{get:s[n],enumerable:!0})},Vt=(t,s,n,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of It(s))!Kt.call(t,f)&&f!==n&&it(t,f,{get:()=>s[f],enumerable:!(c=Mt(s,f))||c.enumerable});return t};var Wt=t=>Vt(it({},"__esModule",{value:!0}),t);var io={};Ut(io,{create:()=>V,default:()=>ro,flushMounts:()=>gt});module.exports=Wt(io);var E=require("@symbo.ls/signal"),j=require("@symbo.ls/signal"),W=require("./cache.js"),T=require("./registry.js"),Tt=require("./delegate.js"),Rt=require("./extends.js"),Nt=require("./methods.js"),uo=require("./dispose.js"),_t=require("./devRuntime.js"),st=require("@symbo.ls/utils"),U=require("@symbo.ls/utils/function.js"),q=require("@symbo.ls/state"),A=require("css-in-props"),B=require("@symbo.ls/css"),b=require("@symbo.ls/scratch"),K=require("attrs-in-props");let Bt=1;const tt=[];let et=!1;function Ht(){et||(et=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(gt):setTimeout(gt,0))}function gt(){if(et=!1,!tt.length)return;const t=tt.splice(0,tt.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||I("Mounted",n,n.__ref?.__mountOptions||{})}}function At(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,tt.push(t),Ht())}function vt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&(0,U.runPluginHook)("contentUpdate",t,s);const n=t.context?.designSystem;n&&(0,b.pushConfig)(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(c){if(t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onContentUpdate",error:c})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',c),t.context?.strictMode)throw c}finally{n&&(0,b.popConfig)()}}function z(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Yt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function zt(t){return t.toLowerCase()}function Ct(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function X(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=X(f,o):n[c]=o}return n}function V(t,s,n,c={},f){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${Bt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=V);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const u=n.indexOf("_");if(u>0){const h=n.substring(0,u),g=o.context?.components;g&&(g[h]||g["smbls."+h])?t={...t,extends:h}:g&&(0,_t.isLoudDevRuntime)()&&/^[A-Z]\w*_\d+$/.test(n)&&console.warn(`[smbls] auto-extend: key "${n}" looks like a multi-instance (${h}_N) but neither "${h}" nor "smbls.${h}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}(0,Rt.applyExtends)(o,t,c);const e=new Set(["childProps","attr","style","scope","data"]),r=o.props&&typeof o.props=="object"?o.props:null;for(const u in t){if(u==="parent"||u==="node"||u==="__ref"||u==="extends"||u==="context"||u==="props")continue;const h=t[u],g=o[u],k=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";k&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?o[u]=X(g,h):k&&e.has(u)?o[u]={...g,...h}:k&&Ct(u)?o[u]=X(g,h):o[u]=h}function a(u){for(const h in u){const g=u[h],k=o[h],x=k&&g&&typeof k=="object"&&typeof g=="object"&&!Array.isArray(k)&&!Array.isArray(g)&&typeof k!="function"&&typeof g!="function";x&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=X(k,g):x&&e.has(h)?o[h]={...k,...g}:x&&Ct(h)?o[h]=X(k,g):o[h]=g}}r&&a(r),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const d=o.scope&&typeof o.scope=="object"?o.scope:null,l=s?.scope,p=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=l||p||null;if(t.scope!==void 0||d){const u={};d&&Object.assign(u,d),t.scope!==void 0&&Object.assign(u,t.scope),o.scope=(0,E.createScopeStore)(u,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),(0,Nt.addMethods)(o),Gt(o,s,t),o.if!=null){let u;if(typeof o.if=="function")try{u=o.if(o,o.state,o.context)}catch(h){if(u=!1,i.__ifError=h,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,h?.message||h)}}else u=o.if;i.__if=!!u}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&wt(o,i,o.if),o;o.tag||(o.tag=(0,W.detectTag)(o)),I("Init",o,c);const _=o.node=(0,W.cacheNode)(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}I("AttachNode",o,c),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),_.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&_.setAttribute("data-smbls-app",o.context.key),o.id&&_.setAttribute&&(_.id=o.id),$t(o,c),kt(o),at(o),Ot(o),no(o);try{Dt(o,c)}catch(u){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,u?.message||u,u?.stack?`
|
|
2
2
|
`+u.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(pt(o,!0),lt(o,s,f),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&(0,b.pushConfig)(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&(0,b.popConfig)()}}if(I("Create",o,c),I("Complete",o,c),I("Render",o,c),I("RenderRouter",o,c),bt(o,c),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&(0,b.pushConfig)(h);try{u(o,o.state,o.context)}catch(S){console.error("[DOMQL] onFrame error:",S)}finally{h&&(0,b.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Gt(t,s,n){const c=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!(0,E.isStore)(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,(0,Z.applyStateMethods)(t,t.state);else if(t.context?.state){const e=t.context.state,r={...e},a=t.context?.polyglot;if(a?.translations){const d=e.lang||a.defaultLang||"en",l=a.translations[d];if(l&&typeof l=="object")for(const y in l)r[y]===void 0&&(r[y]=l[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&r[y]===void 0&&(r[y]=a.translations[y])}t.state=(0,E.isStore)(r)?r:(0,E.createStore)(r),t.state.__element=t,t.state.root=t.state,(0,Z.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,Z.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=Ct(i,s),t.state&&typeof t.state=="object"&&!(0,E.isStore)(t.state)){const e=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}(0,Z.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const e=i(t,s?.state);t.state=(0,E.isStore)(e)?e:(0,E.createStore)(e||{})}else(0,E.isStore)(i)?t.state=i:t.state=(0,E.createStore)({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,(0,Z.applyStateMethods)(t,t.state)}function it(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const f of n){if(c==null)return{};c=c[f]}return c??{}}function Ct(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?it(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?it(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=it(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const f=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[f];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function Zt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const e=o[i];if(typeof t[e]!="function"||T.REGISTRY.has(e))continue;const r=e.charCodeAt(0);r>=65&&r<=90||H(e)||A.CSS_PROPS_REGISTRY[e]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(e)||(0,z.checkAttributeByTagName)(n,e)||f.push({prop:e,fn:t[e]})}for(let i=0;i<f.length;i++){const{prop:e,fn:r}=f[i];s.__exec[e]=r,Object.defineProperty(t,e,{get(){c&&(0,b.pushConfig)(c);try{return r(t,t.state,t.context)}catch{return}finally{c&&(0,b.popConfig)()}},set(a){delete s.__exec[e],Object.defineProperty(t,e,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function zt(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function P(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return zt(t,s),n.apply(this,c)}}function X(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function St(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(Zt(t),typeof t.text=="function"){const o=t.text,i=P(t,t.textDeps,o),e=(0,j.createEffect)(()=>{if(!n.contentManaged)try{let r=i(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=st.replaceLiteralsWithObjectFields.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,j.createEffect)(()=>{if(n.contentManaged)return;const e=st.replaceLiteralsWithObjectFields.call(t,o,t.state);e!=null&&(t.text=e),t.node&&(t.tag==="string"?t.node.nodeValue=e??"":t.node.textContent=e??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!T.REGISTRY.has(o)&&!H(o)&&!n.__exec[o]){if(A.CSS_PROPS_REGISTRY[o]){const i=t[o],e=P(t,t[o+"Deps"],i),r=o;let a;const d=(0,j.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,b.pushConfig)(l);try{const p=e(t,t.state,t.context),y=A.CSS_PROPS_REGISTRY[r](p,t,t.state,t.context);if(y&&t.node){const _=wt(y);(_===null||_!==a)&&(a=_,Y(t.node,y))}else t.node&&(r==="show"||r==="hide")&&(a=void 0,t.node.style.display="")}finally{l&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],e=P(t,t[o+"Deps"],i),r=o;let a;const d=(0,j.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,b.pushConfig)(l);try{const p=e(t,t.state,t.context);if(t.node)if(p!=null){const y=r+":"+String(p);y!==a&&(a=y,Y(t.node,{[r]:p}))}else a=void 0,t.node.style[r]=""}finally{l&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=P(t,t.htmlDeps,o),e=(0,j.createEffect)(()=>{const r=t.context?.designSystem;r&&(0,b.pushConfig)(r);try{const a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&(t.node.innerHTML=a)}finally{r&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(e),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=P(t,t.valueDeps,o),e=(0,j.createEffect)(()=>{try{const r=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const a=r==null?"":String(r);if(t.node.value===a)return;const d=typeof document<"u"&&document.activeElement===t.node,l=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=a,d&&l!=null&&p!=null)try{t.node.setSelectionRange(l,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=P(t,t.styleDeps,o);let e;const r=(0,j.createEffect)(()=>{const a=i(t,t.state,t.context),d=wt(a);(d===null||d!==e)&&(e=d,Y(t.node,a))},{depth:n.path.length});n.__effects.push(r),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const e=P(t,X(t.styleDeps,o),i);let r;const a=(0,j.createEffect)(()=>{try{const d=e(t,t.state,t.context);if(t.node){const l=o+":"+String(d);l!==r&&(r=l,Y(t.node,{[o]:d}))}}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=P(t,X(t.attrDeps,o),t.attr[o]),e=o,r=(0,j.createEffect)(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(r)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=P(t,X(t.ariaDeps,o),t.aria[o]),e="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=(0,j.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=P(t,X(t.dataDeps,o),t.data[o]),r="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=(0,j.createEffect)(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(r):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(r,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){if(typeof f[o]!="function")continue;const i=P(t,X(t.classDeps,o),f[o]),e=(0,j.createEffect)(()=>{try{const r=i(t,t.state,t.context);if(!t.node?.classList)return;typeof r=="string"?t.node.classList.add(r):r?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(e)}!c&&typeof t.if=="function"&&kt(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||T.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||H(o))continue;const e=t[o];n.__exec[o]=e;const r=t.tag||"div";if((0,z.checkAttributeByTagName)(r,o)&&!A.CSS_PROPS_REGISTRY[o]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const a=o,d=P(t,t[o+"Deps"],e),l=(0,j.createEffect)(()=>{try{const p=d(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(l)}}if(Xt(t),mt(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let e=!1,r=[];const a=(0,j.createEffect)(()=>{const d=[];for(let _=0;_<i.length;_++){const u=i[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!e){e=!0,r=d;return}let l=d.length!==r.length;for(let _=0;!l&&_<d.length;_++)d[_]!==r[_]&&(l=!0);const p=r;if(r=d,!l)return;const y=t.context?.designSystem;y&&(0,b.pushConfig)(y);try{o(t,t.state,t.context,{prev:p,next:d})}catch(_){if(t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(a)}}function kt(t,s,n){const c=P(t,t.ifDeps,n),f=(0,j.createEffect)(()=>{let o;try{o=c(t,t.state,t.context)}catch(e){if(o=!1,s.__ifError=e,typeof console<"u"&&console.warn){const r=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${r} \u2014 treating as false:`,e?.message||e)}return}const i=s.__if;if(s.__if=!!o,i&&!s.__if&&t.node)t.node.remove();else if(!i&&s.__if)if(s.__ifInitialized){t.node||(t.node=(0,V.cacheNode)(t)),t.node&&(t.node.ref=t);const e=t.parent,r=e?.node;if(r&&t.node){let a=null;const d=Object.keys(e),l=d.indexOf(t.key);for(let p=l+1;p<d.length;p++){const y=e[d[p]];if(y?.node?.parentNode===r){a=y.node;break}}a?r.insertBefore(t.node,a):r.appendChild(t.node)}else lt(t,t.parent);et(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,V.detectTag)(t)),I("Init",t,{}),t.node||(t.node=(0,V.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const r=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(r),s.__fragmentAnchor=r}I("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Lt(t,{}),St(t,{skipIfEffect:!0}),et(t),Pt(t),Dt(t,{}),lt(t,t.parent),bt(t,{})}},{depth:s.path.length});s.__effects.push(f)}function et(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),oo(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&Y(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const f=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];f&&s.classList.add(typeof f=="string"?f:c)}}}}function wt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Y(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const f=s[c];if(f!=null){if(c.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[c]=f;continue}try{const o=String(f),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),e=o.trim(),r=/\s*!important\s*$/.test(e),a=e.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&Qt(t,n)}let qt=0;function Qt(t,s){const n=`_ds${qt++}`;t.classList.add(n);const c=t.ownerDocument;let f=c.querySelector("style[data-smbls-scoped]");f||(f=c.createElement("style"),f.setAttribute("data-smbls-scoped",""),c.head.appendChild(f));let o="";for(const i in s){const e="."+n,r=i.replace(/&/g,e).split(",").map(d=>{const l=d.trim();return l.includes(e)?l:e+l}).join(", "),a=s[i];if(typeof a=="object"){let d="",l="";for(const p in a){const y=a[p];if(typeof y=="object"){const _=p.includes("&")?r.split(", ").map(h=>p.replace(/&/g,h)).join(", "):r.split(", ").map(h=>`${h} ${p}`).join(", ");let u="";for(const h in y)u+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;l+=(0,W.wrapHoverRule)(`${_} { ${u} }`,_)+`
|
|
5
|
-
`}else d+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=(0,
|
|
6
|
-
`),l&&(o+=l)}}o&&(f.textContent+=o)}function Xt(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const f=s[c];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],e=o.slice(1),r={value:!1},a=(0,j.createEffect)(()=>{const d=t.state&&((0,E.isStore)(t.state)?t.state.root:null);if(!d||!(0,E.isStore)(d))return;let l=d;l=l[i];for(let y=0;y<e.length&&!(l==null||typeof l!="object");y++)if((0,E.isStore)(l))l=l[e[y]];else break;if(!r.value)return;let p=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&(0,b.pushConfig)(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(p=!0)}catch(_){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&(0,b.popConfig)()}}if(!p&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!p&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&(0,b.pushConfig)(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&(0,K.runPluginHook)("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&(0,b.popConfig)()}}},{depth:n.path.length});r.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function ft(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}const jt=new Set;function Jt(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;jt.has(c)||(jt.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function G(t,s,n){const c={},f=(o,i)=>{if(A.CSS_PROPS_REGISTRY[o]){const e=A.CSS_PROPS_REGISTRY[o](i,s,s.state,s.context);if(e){const r=Array.isArray(e)?e:[e];for(const a of r)a&&Object.assign(c,a)}}else c[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let d=i[a];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&f(a,d)}continue}if(ft(o,s)){const a=G(i,s,!0);Object.keys(a).length&&(c[`[data-theme="${o.slice(1)}"] &`]=a);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(o)){(0,yt.isLoudDevRuntime)()&&Jt(o,s);continue}let e=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(e=`@media ${a}`)}const r=G(i,s,!1);Object.keys(r).length&&(c[e]=r);continue}f(o,i)}}if(n)for(const o in c){const i=c[o];typeof i=="string"&&!i.includes("!important")&&(c[o]=i+" !important")}return c}function mt(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const f=c.charAt(0);if(f!=="."&&f!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const l=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${f}\` is read as one prop name. Nest the selector inside instead: \`${f}${l}: { '${o.slice(l.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const e=f==="!",r={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let l;const p=t[o];if(p===void 0)if(t.state&&o in t.state)l=t.state[o];else{const u=t.context?.cases?.[o];if(u===void 0)return;try{l=typeof u=="function"?u.call(t,t):u}catch(h){l=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof p=="function")try{l=p(t,t.state,t.context)}catch(u){l=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else l=p;const y=e?!l:!!l;if(y===r.lastMatch)return;r.lastMatch=y;const _=t.context?.designSystem;_&&(0,b.pushConfig)(_);try{if(y){const u={},h={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const v=i[x],k=x.charAt(0);if((k===":"||k==="@"||k==="&")&&v&&typeof v=="object"&&!Array.isArray(v)){if(ft(x,t)){const O=G(v,t,!0);Object.keys(O).length&&(h[`[data-theme="${x.slice(1)}"] &`]=O,g=!0)}else{let O=x;if(k==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const D=t.context?.designSystem?.media?.[x.slice(1)];D&&(O=`@media ${D}`)}const B=G(v,t,!1);Object.keys(B).length&&(h[O]=B,g=!0)}continue}const N=typeof v=="function"?v(t,t.state,t.context):v;if(N!=null)if(A.CSS_PROPS_REGISTRY[x]){const O=A.CSS_PROPS_REGISTRY[x](N,t,t.state,t.context);if(O){const B=Array.isArray(O)?O:[O];for(const D of B)D&&Object.assign(u,D)}}else A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(u[x]=N)}const S=Object.keys(u);if(S.length){Y(t.node,u);for(const x of S)n.set(x,c);r.appliedKeys=S}else r.appliedKeys=null;if(g){const x=(0,W.css)(h,null,t.context?.cssPrefix),v=x?x.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const k of v)t.node.classList.add(k);r.appliedClasses=v}else r.appliedClasses=null}else if(r.appliedClasses){for(const x of r.appliedClasses)t.node.classList.remove(x);r.appliedClasses=null}}else{if(r.appliedKeys){for(const u of r.appliedKeys)n.get(u)===c&&(t.node.style[u]="",n.delete(u));r.appliedKeys=null}if(r.appliedClasses){for(const u of r.appliedClasses)t.node.classList.remove(u);r.appliedClasses=null}}}finally{_&&(0,b.popConfig)()}};s.__conditionalRunners.push(a);const d=(0,j.createEffect)(a,{depth:s.path.length});s.__effects.push(d)}}const at=new WeakSet;function to(t){const s=t.ownerDocument;!s||at.has(s)||(at.add(s),queueMicrotask(()=>{at.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const dt=new WeakSet;let Et=!1;function oo(t){const{node:s}=t;if(!s)return;if(Et||(Et=!0,(0,W.css)({display:"none"})),dt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}dt.add(t);const n=t.context?.designSystem;n&&(0,b.pushConfig)(n);try{const c={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||T.REGISTRY.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!H(o)){if(A.CSS_PROPS_REGISTRY[o]){const e=t[o],r=A.CSS_PROPS_REGISTRY[o](e,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(c,a);else Object.assign(c,r);f=!0}}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const e=t[o];if(e&&typeof e=="object"){if(ft(o,t)){const r=G(e,t,!0);Object.keys(r).length&&(c[`[data-theme="${o.slice(1)}"] &`]=r,f=!0)}else{let r=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(r=`@media ${d}`)}const a=G(e,t,!1);Object.keys(a).length&&(c[r]=a,f=!0)}f=!0}}}}if(f){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=(0,W.css)(c,null,t.context?.cssPrefix);if(o&&s.classList){const e=o.split(" ").filter(Boolean);let r=!1;for(const a of e)s.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&to(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const e=c.display;if(e&&e!==i)if(i==="none"){const r=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,b.popConfig)(),dt.delete(t)}}function Pt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=(0,z.applyAttrTransforms)(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const c=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||T.REGISTRY.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!H(f)&&!(A.CSS_PROPS_REGISTRY[f]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(f))&&(0,z.checkAttributeByTagName)(c,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=(0,st.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(f,i===!0?"":i)}}}function so(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const Ot=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Lt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!H(n)||Ot.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(e){return t.call(o,e)}}if(typeof c!="function")continue;const f=Ht(n);T.LIFECYCLE_EVENTS.has(f)||(0,$t.registerEvent)(Yt(f),t,c)}no(t)}function no(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const p of Ot){const y=t[p];typeof y=="function"&&(n[p]=y,c=!0)}if(!c)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,e=0,r=0,a=!1;const d=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(i=y.clientX,e=y.clientY,r=Date.now(),a=!0)},l=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const _=y.clientX-i,u=y.clientY-e,h=Date.now()-r;if(h>o)return;const g=Math.abs(_),S=Math.abs(u);if(Math.max(g,S)<f)return;let x;if(g>S*1.2)x=_<0?"left":"right";else if(S>g*1.2)x=u<0?"up":"down";else return;const v="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),k=n[v],N=n.onSwipe;k&&k.call(t,p,t,t.state,t.context),N&&N.call(t,{direction:x,dx:_,dy:u,dt:h,event:p},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",l,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",l)}catch{}})}function ot(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=ot(f,o):n[c]=o}return n}function ut(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const e=t.childProps,r=t.childrenAs;for(let a=0;a<s.length;a++){let d=s[a];const l=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let p=e;if(typeof e=="function")try{p=e(t,d)}catch{p=null}if(r==="state"){let u=l;(typeof l=="string"||typeof l=="number")&&(u={value:l,text:l}),d=p?{...p,state:u}:{state:u}}else p&&(d=ot(p,d));if(c&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(c)?c:[c];d={...d,extends:[...h,...u]}}else d={...d,extends:c};const y=d?.key||l&&typeof l=="object"&&l.key||`${a}`,_=U(d,t,y,n);!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=Ct(s,t);if(Array.isArray(f)){ut(t,f,n);return}}if(typeof s=="object")for(const f in s){if(T.REGISTRY.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=ot(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],e=Array.isArray(c)?c:[c];o={...o,extends:[...e,...i]}}else o={...o,extends:c};U(o,t,f,n)}}}function pt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",e=t.value!=null&&typeof t.value!="function";if(i||e){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const l=d==null?"":String(d);n.value!==l&&(n.value=l);return}const r=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!r)return;let a=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(a=d);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Dt(t,s){let{children:n,content:c}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;try{n=i(t,t.state,t.context)}catch(l){if(n=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,l?.message||l)}}t.children=n;const e=t.__ref;let r=!1;const a=P(t,t.childrenDeps,i),d=(0,j.createEffect)(()=>{const l=r;r=!0;let p;try{p=a(t,t.state,t.context)}catch(v){if(typeof console<"u"&&console.error){const k=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${k}${l?"":" (initial tracking run)"}:`,v?.message||v)}return}if(!l||p===t.children)return;t.children=p;const y=typeof t.onContentUpdate=="function",_=y?[]:null,u=y?[]:null,h=y?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const v=t.childProps,k=[],N=new Map;for(let w=0;w<p.length;w++){const L=p[w];let C=v;if(typeof v=="function")try{C=v(t,L)}catch{C=null}const F=C&&C.key||L&&L.key||`${w}`;k.push(F),N.set(F,{rawChild:L,childProps:C})}const O=new Set(k),B=e.__children.slice();for(const w of B)if(!O.has(w)){const L=t[w];L?.remove&&L.remove(),delete t[w],u&&u.push(w)}const D=t.childExtends,J=t.tag==="fragment",Nt=t.context?.document||globalThis.document,q=J?null:Nt?.createDocumentFragment();for(const w of k){const L=N.get(w),C=L.rawChild,F=t[w];if(F&&F.state){if(C&&typeof C=="object"){const $=F.state,m=$.$replace||$.replace,xt=$.$update||$.update;if(typeof m=="function")m.call($,C);else if(typeof xt=="function"){for(const M in $)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(C,M))try{$[M]=void 0}catch{}xt.call($,C)}else for(const M in C)$[M]=C[M]}h&&h.push(w);continue}let nt=C;(typeof C=="string"||typeof C=="number")&&(nt={value:C,text:C});const _t=L.childProps;let R=_t?{..._t,state:nt}:{state:nt};if(D&&!R.ignoreChildExtends)if(R.extends){const $=Array.isArray(R.extends)?R.extends:[R.extends],m=Array.isArray(D)?D:[D];R={...R,extends:[...m,...$]}}else R={...R,extends:D};const gt=U(R,t,w,s);!J&>?.node&&q&&q.appendChild(gt.node),_&&_.push(w)}if(!J&&q&&q.childNodes.length&&t.node&&t.node.appendChild(q),!J&&t.node){let w=null;for(const L of k){const C=t[L]?.node;if(!C)continue;const F=w?w.nextSibling:t.node.firstChild;C!==F&&t.node.insertBefore(C,F),w=C}}e.__children=k,y&&(_.length||u.length)&&At(t,{added:_,removed:u,kept:h}),pt(t,!1);return}const x=y?[...e.__children]:null;for(const v of[...e.__children]){const k=t[v];k?.remove&&k.remove(),delete t[v]}e.__children=[],ut(t,p,s),pt(t,!1),y&&At(t,{added:[...e.__children],removed:x,kept:[]})},{depth:e.path.length});e.__effects.push(d)}if(ut(t,n||c,s),n||c)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let e=0;e<i.length;e++){const r=i[e];if(!r.endsWith("Extends")||typeof t[r]!="string")continue;const a=r.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const d={extends:t[r]};delete t[r];for(let l=e+1;l<i.length;l++){const p=i[l],y=p.charCodeAt(0);if(y>=65&&y<=90||T.REGISTRY.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const _=t[p];_!==void 0&&(d[p]=_,delete t[p])}t[a]&&typeof t[a]=="object"?t[a]={...d,...t[a]}:t[a]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||T.REGISTRY.has(i)||typeof t[i]!="object"||t[i]===null)continue;const e=i.charCodeAt(0);if(e<65||e>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={...r,extends:a})}if(t.childProps&&(r=ot(t.childProps,r)),f&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],d=Array.isArray(f)?f:[f];r={...r,extends:[...d,...a]}}else r={...r,extends:f};U(r,t,i,s)}}}function lt(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;i.insertBefore(c,e||f)}else i.insertBefore(c,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(c,i):o.appendChild(c)}else o.appendChild(c)}function I(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,K.runPluginHook)(c,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const e=s.context?.designSystem;e&&(0,b.pushConfig)(e);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&(0,K.runPluginHook)("error",s,{hook:f,error:r})||console.error(`[DOMQL] Lifecycle "${f}" error:`,r),s.context?.strictMode)throw r}finally{e&&(0,b.popConfig)(),i&&(s.__ref.__inRender=!1)}}return!0}var co=U;
|
|
4
|
+
`):"")}}if(yt(o,!0),ht(o,s,f),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&(0,b.pushConfig)(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&(0,b.popConfig)()}}if(I("Create",o,c),I("Complete",o,c),I("Render",o,c),I("RenderRouter",o,c),At(o,c),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&(0,b.pushConfig)(h);try{u(o,o.state,o.context)}catch(k){console.error("[DOMQL] onFrame error:",k)}finally{h&&(0,b.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Gt(t,s,n){const c=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!(0,E.isStore)(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,(0,q.applyStateMethods)(t,t.state);else if(t.context?.state){const e=t.context.state,r={...e},a=t.context?.polyglot;if(a?.translations){const d=e.lang||a.defaultLang||"en",l=a.translations[d];if(l&&typeof l=="object")for(const y in l)r[y]===void 0&&(r[y]=l[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&r[y]===void 0&&(r[y]=a.translations[y])}t.state=(0,E.isStore)(r)?r:(0,E.createStore)(r),t.state.__element=t,t.state.root=t.state,(0,q.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,q.applyStateMethods)(t,t.state);return}if(typeof i=="string"){if(t.state=St(i,s),t.state&&typeof t.state=="object"&&!(0,E.isStore)(t.state)){const e=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}(0,q.applyStateMethods)(t,t.state);return}if(typeof i=="function"){const e=i(t,s?.state);t.state=(0,E.isStore)(e)?e:(0,E.createStore)(e||{})}else(0,E.isStore)(i)?t.state=i:t.state=(0,E.createStore)({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,(0,q.applyStateMethods)(t,t.state)}function ft(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const f of n){if(c==null)return{};c=c[f]}return c??{}}function St(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?ft(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?ft(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=ft(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const f=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[f];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function Zt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const e=o[i];if(typeof t[e]!="function"||T.REGISTRY.has(e))continue;const r=e.charCodeAt(0);r>=65&&r<=90||z(e)||A.CSS_PROPS_REGISTRY[e]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(e)||(0,K.checkAttributeByTagName)(n,e)||f.push({prop:e,fn:t[e]})}for(let i=0;i<f.length;i++){const{prop:e,fn:r}=f[i];s.__exec[e]=r,Object.defineProperty(t,e,{get(){c&&(0,b.pushConfig)(c);try{return r(t,t.state,t.context)}catch{return}finally{c&&(0,b.popConfig)()}},set(a){delete s.__exec[e],Object.defineProperty(t,e,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function qt(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function O(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return qt(t,s),n.apply(this,c)}}function J(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function kt(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(Zt(t),typeof t.text=="function"){const o=t.text,i=O(t,t.textDeps,o),e=(0,j.createEffect)(()=>{if(!n.contentManaged)try{let r=i(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=st.replaceLiteralsWithObjectFields.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=(0,j.createEffect)(()=>{if(n.contentManaged)return;const e=st.replaceLiteralsWithObjectFields.call(t,o,t.state);e!=null&&(t.text=e),t.node&&(t.tag==="string"?t.node.nodeValue=e??"":t.node.textContent=e??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!T.REGISTRY.has(o)&&!z(o)&&!n.__exec[o]){if(A.CSS_PROPS_REGISTRY[o]){const i=t[o],e=O(t,t[o+"Deps"],i),r=o;let a;const d=(0,j.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,b.pushConfig)(l);try{const p=e(t,t.state,t.context),y=A.CSS_PROPS_REGISTRY[r](p,t,t.state,t.context);if(y&&t.node){const _=jt(y);(_===null||_!==a)&&(a=_,G(t.node,y))}else t.node&&(r==="show"||r==="hide")&&(a=void 0,t.node.style.display="")}finally{l&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const i=t[o],e=O(t,t[o+"Deps"],i),r=o;let a;const d=(0,j.createEffect)(()=>{const l=t.context?.designSystem;l&&(0,b.pushConfig)(l);try{const p=e(t,t.state,t.context);if(t.node)if(p!=null){const y=r+":"+String(p);y!==a&&(a=y,G(t.node,{[r]:p}))}else a=void 0,t.node.style[r]=""}finally{l&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=O(t,t.htmlDeps,o),e=(0,j.createEffect)(()=>{const r=t.context?.designSystem;r&&(0,b.pushConfig)(r);try{const a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&(t.node.innerHTML=a)}finally{r&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(e),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=O(t,t.valueDeps,o),e=(0,j.createEffect)(()=>{try{const r=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const a=r==null?"":String(r);if(t.node.value===a)return;const d=typeof document<"u"&&document.activeElement===t.node,l=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=a,d&&l!=null&&p!=null)try{t.node.setSelectionRange(l,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=O(t,t.styleDeps,o);let e;const r=(0,j.createEffect)(()=>{const a=i(t,t.state,t.context),d=jt(a);(d===null||d!==e)&&(e=d,G(t.node,a))},{depth:n.path.length});n.__effects.push(r),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const e=O(t,J(t.styleDeps,o),i);let r;const a=(0,j.createEffect)(()=>{try{const d=e(t,t.state,t.context);if(t.node){const l=o+":"+String(d);l!==r&&(r=l,G(t.node,{[o]:d}))}}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=O(t,J(t.attrDeps,o),t.attr[o]),e=o,r=(0,j.createEffect)(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(r)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=O(t,J(t.ariaDeps,o),t.aria[o]),e="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=(0,j.createEffect)(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=O(t,J(t.dataDeps,o),t.data[o]),r="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=(0,j.createEffect)(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(r):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(r,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){if(typeof f[o]!="function")continue;const i=O(t,J(t.classDeps,o),f[o]),e=(0,j.createEffect)(()=>{try{const r=i(t,t.state,t.context);if(!t.node?.classList)return;typeof r=="string"?t.node.classList.add(r):r?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(e)}!c&&typeof t.if=="function"&&wt(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||T.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||z(o))continue;const e=t[o];n.__exec[o]=e;const r=t.tag||"div";if((0,K.checkAttributeByTagName)(r,o)&&!A.CSS_PROPS_REGISTRY[o]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const a=(0,K.camelToAttr)(o)||o,d=O(t,t[o+"Deps"],e),l=(0,j.createEffect)(()=>{try{const p=d(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(l)}}if(Jt(t),to(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let e=!1,r=[];const a=(0,j.createEffect)(()=>{const d=[];for(let _=0;_<i.length;_++){const u=i[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!e){e=!0,r=d;return}let l=d.length!==r.length;for(let _=0;!l&&_<d.length;_++)d[_]!==r[_]&&(l=!0);const p=r;if(r=d,!l)return;const y=t.context?.designSystem;y&&(0,b.pushConfig)(y);try{o(t,t.state,t.context,{prev:p,next:d})}catch(_){if(t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&(0,b.popConfig)()}},{depth:n.path.length});n.__effects.push(a)}}function wt(t,s,n){const c=O(t,t.ifDeps,n),f=(0,j.createEffect)(()=>{let o;try{o=c(t,t.state,t.context)}catch(e){if(o=!1,s.__ifError=e,typeof console<"u"&&console.warn){const r=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${r} \u2014 treating as false:`,e?.message||e)}return}const i=s.__if;if(s.__if=!!o,i&&!s.__if&&t.node)t.node.remove();else if(!i&&s.__if)if(s.__ifInitialized){t.node||(t.node=(0,W.cacheNode)(t)),t.node&&(t.node.ref=t);const e=t.parent,r=e?.node;if(r&&t.node){let a=null;const d=Object.keys(e),l=d.indexOf(t.key);for(let p=l+1;p<d.length;p++){const y=e[d[p]];if(y?.node?.parentNode===r){a=y.node;break}}a?r.insertBefore(t.node,a):r.appendChild(t.node)}else ht(t,t.parent);at(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,W.detectTag)(t)),I("Init",t,{}),t.node||(t.node=(0,W.cacheNode)(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const r=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(r),s.__fragmentAnchor=r}I("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),$t(t,{}),kt(t,{skipIfEffect:!0}),at(t),Ot(t),Dt(t,{}),ht(t,t.parent),At(t,{})}},{depth:s.path.length});s.__effects.push(f)}function at(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),so(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&G(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const f=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];f&&s.classList.add(typeof f=="string"?f:c)}}}}function jt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function G(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const f=s[c];if(f!=null){if(c.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[c]=f;continue}try{const o=String(f),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),e=o.trim(),r=/\s*!important\s*$/.test(e),a=e.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&Xt(t,n)}let Qt=0;function Xt(t,s){const n=`_ds${Qt++}`;t.classList.add(n);const c=t.ownerDocument;let f=c.querySelector("style[data-smbls-scoped]");f||(f=c.createElement("style"),f.setAttribute("data-smbls-scoped",""),c.head.appendChild(f));let o="";for(const i in s){const e="."+n,r=i.replace(/&/g,e).split(",").map(d=>{const l=d.trim();return l.includes(e)?l:e+l}).join(", "),a=s[i];if(typeof a=="object"){let d="",l="";for(const p in a){const y=a[p];if(typeof y=="object"){const _=p.includes("&")?r.split(", ").map(h=>p.replace(/&/g,h)).join(", "):r.split(", ").map(h=>`${h} ${p}`).join(", ");let u="";for(const h in y)u+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;l+=(0,B.wrapHoverRule)(`${_} { ${u} }`,_)+`
|
|
5
|
+
`}else d+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=(0,B.wrapHoverRule)(`${r} { ${d} }`,r)+`
|
|
6
|
+
`),l&&(o+=l)}}o&&(f.textContent+=o)}function Jt(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const f=s[c];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],e=o.slice(1),r={value:!1},a=(0,j.createEffect)(()=>{const d=t.state&&((0,E.isStore)(t.state)?t.state.root:null);if(!d||!(0,E.isStore)(d))return;let l=d;l=l[i];for(let y=0;y<e.length&&!(l==null||typeof l!="object");y++)if((0,E.isStore)(l))l=l[e[y]];else break;if(!r.value)return;let p=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&(0,b.pushConfig)(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(p=!0)}catch(_){t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&(0,b.popConfig)()}}if(!p&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!p&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&(0,b.pushConfig)(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&(0,U.runPluginHook)("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&(0,b.popConfig)()}}},{depth:n.path.length});r.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function dt(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}const Et=new Set;function mt(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Et.has(c)||(Et.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function Z(t,s,n){const c={},f=(o,i)=>{if(A.CSS_PROPS_REGISTRY[o]){const e=A.CSS_PROPS_REGISTRY[o](i,s,s.state,s.context);if(e){const r=Array.isArray(e)?e:[e];for(const a of r)a&&Object.assign(c,a)}}else c[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let d=i[a];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&f(a,d)}continue}if(dt(o,s)){const a=Z(i,s,!0);Object.keys(a).length&&(c[`[data-theme="${o.slice(1)}"] &`]=a);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(o)){(0,_t.isLoudDevRuntime)()&&mt(o,s);continue}let e=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(e=`@media ${a}`)}const r=Z(i,s,!1);Object.keys(r).length&&(c[e]=r);continue}f(o,i)}}if(n)for(const o in c){const i=c[o];typeof i=="string"&&!i.includes("!important")&&(c[o]=i+" !important")}return c}function to(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const f=c.charAt(0);if(f!=="."&&f!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const l=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${f}\` is read as one prop name. Nest the selector inside instead: \`${f}${l}: { '${o.slice(l.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const e=f==="!",r={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let l;const p=t[o];if(p===void 0)if(t.state&&o in t.state)l=t.state[o];else{const u=t.context?.cases?.[o];if(u===void 0)return;try{l=typeof u=="function"?u.call(t,t):u}catch(h){l=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof p=="function")try{l=p(t,t.state,t.context)}catch(u){l=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else l=p;const y=e?!l:!!l;if(y===r.lastMatch)return;r.lastMatch=y;const _=t.context?.designSystem;_&&(0,b.pushConfig)(_);try{if(y){const u={},h={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const v=i[x],w=x.charAt(0);if((w===":"||w==="@"||w==="&")&&v&&typeof v=="object"&&!Array.isArray(v)){if(dt(x,t)){const L=Z(v,t,!0);Object.keys(L).length&&(h[`[data-theme="${x.slice(1)}"] &`]=L,g=!0)}else{let L=x;if(w==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const D=t.context?.designSystem?.media?.[x.slice(1)];D&&(L=`@media ${D}`)}const H=Z(v,t,!1);Object.keys(H).length&&(h[L]=H,g=!0)}continue}const N=typeof v=="function"?v(t,t.state,t.context):v;if(N!=null)if(A.CSS_PROPS_REGISTRY[x]){const L=A.CSS_PROPS_REGISTRY[x](N,t,t.state,t.context);if(L){const H=Array.isArray(L)?L:[L];for(const D of H)D&&Object.assign(u,D)}}else A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(u[x]=N)}const k=Object.keys(u);if(k.length){G(t.node,u);for(const x of k)n.set(x,c);r.appliedKeys=k}else r.appliedKeys=null;if(g){const x=(0,B.css)(h,null,t.context?.cssPrefix),v=x?x.split(" ").filter(Boolean):[];if(v.length&&t.node.classList){for(const w of v)t.node.classList.add(w);r.appliedClasses=v}else r.appliedClasses=null}else if(r.appliedClasses){for(const x of r.appliedClasses)t.node.classList.remove(x);r.appliedClasses=null}}else{if(r.appliedKeys){for(const u of r.appliedKeys)n.get(u)===c&&(t.node.style[u]="",n.delete(u));r.appliedKeys=null}if(r.appliedClasses){for(const u of r.appliedClasses)t.node.classList.remove(u);r.appliedClasses=null}}}finally{_&&(0,b.popConfig)()}};s.__conditionalRunners.push(a);const d=(0,j.createEffect)(a,{depth:s.path.length});s.__effects.push(d)}}const ut=new WeakSet;function oo(t){const s=t.ownerDocument;!s||ut.has(s)||(ut.add(s),queueMicrotask(()=>{ut.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const pt=new WeakSet;let Pt=!1;function so(t){const{node:s}=t;if(!s)return;if(Pt||(Pt=!0,(0,B.css)({display:"none"})),pt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}pt.add(t);const n=t.context?.designSystem;n&&(0,b.pushConfig)(n);try{const c={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||T.REGISTRY.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!z(o)){if(A.CSS_PROPS_REGISTRY[o]){const e=t[o],r=A.CSS_PROPS_REGISTRY[o](e,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(c,a);else Object.assign(c,r);f=!0}}else if(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const e=t[o];if(e&&typeof e=="object"){if(dt(o,t)){const r=Z(e,t,!0);Object.keys(r).length&&(c[`[data-theme="${o.slice(1)}"] &`]=r,f=!0)}else{let r=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(r=`@media ${d}`)}const a=Z(e,t,!1);Object.keys(a).length&&(c[r]=a,f=!0)}f=!0}}}}if(f){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=(0,B.css)(c,null,t.context?.cssPrefix);if(o&&s.classList){const e=o.split(" ").filter(Boolean);let r=!1;for(const a of e)s.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&oo(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const e=c.display;if(e&&e!==i)if(i==="none"){const r=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&(0,b.popConfig)(),pt.delete(t)}}function Ot(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=(0,K.applyAttrTransforms)(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const c=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||T.REGISTRY.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!z(f)&&!(A.CSS_PROPS_REGISTRY[f]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(f))&&(0,K.checkAttributeByTagName)(c,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=(0,st.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute((0,K.camelToAttr)(f)||f,i===!0?"":i)}}}function no(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const Lt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function $t(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!z(n)||Lt.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(e){return t.call(o,e)}}if(typeof c!="function")continue;const f=Yt(n);T.LIFECYCLE_EVENTS.has(f)||(0,Tt.registerEvent)(zt(f),t,c)}co(t)}function co(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const p of Lt){const y=t[p];typeof y=="function"&&(n[p]=y,c=!0)}if(!c)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,e=0,r=0,a=!1;const d=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(i=y.clientX,e=y.clientY,r=Date.now(),a=!0)},l=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const _=y.clientX-i,u=y.clientY-e,h=Date.now()-r;if(h>o)return;const g=Math.abs(_),k=Math.abs(u);if(Math.max(g,k)<f)return;let x;if(g>k*1.2)x=_<0?"left":"right";else if(k>g*1.2)x=u<0?"up":"down";else return;const v="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),w=n[v],N=n.onSwipe;w&&w.call(t,p,t,t.state,t.context),N&&N.call(t,{direction:x,dx:_,dy:u,dt:h,event:p},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",l,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",l)}catch{}})}function ot(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=ot(f,o):n[c]=o}return n}function lt(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const e=t.childProps,r=t.childrenAs;for(let a=0;a<s.length;a++){let d=s[a];const l=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let p=e;if(typeof e=="function")try{p=e(t,d)}catch{p=null}if(r==="state"){let u=l;(typeof l=="string"||typeof l=="number")&&(u={value:l,text:l}),d=p?{...p,state:u}:{state:u}}else p&&(d=ot(p,d));if(c&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(c)?c:[c];d={...d,extends:[...h,...u]}}else d={...d,extends:c};const y=d?.key||l&&typeof l=="object"&&l.key||`${a}`;let _;try{_=V(d,t,y,n)}catch(u){if(typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${y}" failed to construct at ${h} (initial render, skipping this row):`,u?.message||u)}continue}!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=St(s,t);if(Array.isArray(f)){lt(t,f,n);return}}if(typeof s=="object")for(const f in s){if(T.REGISTRY.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=ot(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],e=Array.isArray(c)?c:[c];o={...o,extends:[...e,...i]}}else o={...o,extends:c};V(o,t,f,n)}}}function yt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",e=t.value!=null&&typeof t.value!="function";if(i||e){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const l=d==null?"":String(d);n.value!==l&&(n.value=l);return}const r=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!r)return;let a=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(a=d);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Dt(t,s){let{children:n,content:c}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;try{n=i(t,t.state,t.context)}catch(l){if(n=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,l?.message||l)}}t.children=n;const e=t.__ref;let r=!1;const a=O(t,t.childrenDeps,i),d=(0,j.createEffect)(()=>{const l=r;r=!0;let p;try{p=a(t,t.state,t.context)}catch(v){if(typeof console<"u"&&console.error){const w=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${w}${l?"":" (initial tracking run)"}:`,v?.message||v)}return}if(!l||p===t.children)return;t.children=p;const y=typeof t.onContentUpdate=="function",_=y?[]:null,u=y?[]:null,h=y?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const v=t.childProps,w=[],N=new Map;for(let C=0;C<p.length;C++){const $=p[C];let S=v;if(typeof v=="function")try{S=v(t,$)}catch{S=null}const F=S&&S.key||$&&$.key||`${C}`;w.push(F),N.set(F,{rawChild:$,childProps:S})}const L=new Set(w),H=e.__children.slice();for(const C of H)if(!L.has(C)){const $=t[C];$?.remove&&$.remove(),delete t[C],u&&u.push(C)}const D=t.childExtends,m=t.tag==="fragment",Ft=t.context?.document||globalThis.document,Q=m?null:Ft?.createDocumentFragment(),nt=new Set;for(const C of w){const $=N.get(C),S=$.rawChild,F=t[C];if(F&&F.state){if(S&&typeof S=="object"){const P=F.state,Y=P.$replace||P.replace,bt=P.$update||P.update;if(typeof Y=="function")Y.call(P,S);else if(typeof bt=="function"){for(const M in P)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(S,M))try{P[M]=void 0}catch{}bt.call(P,S)}else for(const M in S)P[M]=S[M]}h&&h.push(C);continue}let ct=S;(typeof S=="string"||typeof S=="number")&&(ct={value:S,text:S});const xt=$.childProps;let R=xt?{...xt,state:ct}:{state:ct};if(D&&!R.ignoreChildExtends)if(R.extends){const P=Array.isArray(R.extends)?R.extends:[R.extends],Y=Array.isArray(D)?D:[D];R={...R,extends:[...Y,...P]}}else R={...R,extends:D};let rt;try{rt=V(R,t,C,s)}catch(P){if(typeof console<"u"&&console.error){const Y=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${Y} (reconcile, skipping this row):`,P?.message||P)}nt.add(C);continue}!m&&rt?.node&&Q&&Q.appendChild(rt.node),_&&_.push(C)}if(!m&&Q&&Q.childNodes.length&&t.node&&t.node.appendChild(Q),!m&&t.node){let C=null;for(const $ of w){const S=t[$]?.node;if(!S)continue;const F=C?C.nextSibling:t.node.firstChild;S!==F&&t.node.insertBefore(S,F),C=S}}e.__children=nt.size?w.filter(C=>!nt.has(C)):w,y&&(_.length||u.length)&&vt(t,{added:_,removed:u,kept:h}),yt(t,!1);return}const x=y?[...e.__children]:null;for(const v of[...e.__children]){const w=t[v];w?.remove&&w.remove(),delete t[v]}e.__children=[],lt(t,p,s),yt(t,!1),y&&vt(t,{added:[...e.__children],removed:x,kept:[]})},{depth:e.path.length});e.__effects.push(d)}if(lt(t,n||c,s),n||c)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let e=0;e<i.length;e++){const r=i[e];if(!r.endsWith("Extends")||typeof t[r]!="string")continue;const a=r.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const d={extends:t[r]};delete t[r];for(let l=e+1;l<i.length;l++){const p=i[l],y=p.charCodeAt(0);if(y>=65&&y<=90||T.REGISTRY.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const _=t[p];_!==void 0&&(d[p]=_,delete t[p])}t[a]&&typeof t[a]=="object"?t[a]={...d,...t[a]}:t[a]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||T.REGISTRY.has(i)||typeof t[i]!="object"||t[i]===null)continue;const e=i.charCodeAt(0);if(e<65||e>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={...r,extends:a})}if(t.childProps&&(r=ot(t.childProps,r)),f&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],d=Array.isArray(f)?f:[f];r={...r,extends:[...d,...a]}}else r={...r,extends:f};V(r,t,i,s)}}}function ht(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;i.insertBefore(c,e||f)}else i.insertBefore(c,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(c,i):o.appendChild(c)}else o.appendChild(c)}function I(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,U.runPluginHook)(c,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const e=s.context?.designSystem;e&&(0,b.pushConfig)(e);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&(0,U.runPluginHook)("error",s,{hook:f,error:r})||console.error(`[DOMQL] Lifecycle "${f}" error:`,r),s.context?.strictMode)throw r}finally{e&&(0,b.popConfig)(),i&&(s.__ref.__inRender=!1)}}return!0}var ro=V;
|
package/dist/esm/src/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const i="http://www.w3.org/2000/svg",s=new Set(["svg","path","circle","ellipse","line","polyline","polygon","rect","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","foreignObject","desc","title","metadata"]),p=new Set(["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","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","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","string","fragment","shadow"]);function
|
|
1
|
+
const i="http://www.w3.org/2000/svg",s=new Set(["svg","path","circle","ellipse","line","polyline","polygon","rect","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","foreignObject","desc","title","metadata"]),p=new Set(["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","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","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","string","fragment","shadow"]);function d(e){return p.has(e)||s.has(e)}function l(e){return s.has(e)}function g(e){let{tag:t,key:o}=e;if(typeof t=="function")try{t=t(e,e.state,e.context)}catch(n){t=void 0,typeof console<"u"&&console.error&&console.error(`[smbls] \`tag:\` factory threw on "${o||"<anon>"}" \u2014 falling back to key-based tag detection:`,n?.message||n)}if(t===!0&&(t=o),typeof t=="string"&&d(t))return t;if(!o||typeof o!="string")return"div";const a=new Set(["html","head","body","meta","link","script","style","title","base","noscript","template","th","tr","td","thead","tbody","tfoot","caption","col","colgroup"]);let r=o.toLowerCase();return r.includes(".")&&(r=r.split(".")[0]),r.includes("_")&&(r=r.split("_")[0]),d(r)&&!a.has(r)?r:"div"}const f={};function u(e,t){const o=t?.context?.document||globalThis.document;if(!o)return null;if(e==="string")return o.createTextNode(t?.text||"");if(e==="fragment")return o.createDocumentFragment();if(l(e)){const a=t?.parent;if(e==="svg"||a?.node?.namespaceURI===i)return o.createElementNS(i,e);if(e!=="svg")return o.createElement("div")}return o.createElement(e)}function m(e){const t=e.tag=g(e),a=l(t)&&(t==="svg"||e.parent?.node?.namespaceURI===i)?"svg:"+t:t,r=e?.context?.document||globalThis.document;let n=f[a];if(n||(n=f[a]=u(t,e)),!n)return null;const c=r&&n.ownerDocument!==r?u(t,e):n.cloneNode(!0);return t==="string"&&(c.nodeValue=e.text||""),c}export{i as SVG_NS,s as SVG_TAGS,m as cacheNode,u as createHTMLNode,g as detectTag,l as isSvgTag,d as isValidTag};
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
1
|
+
import{createStore as ct,createScopeStore as Kt,isStore as K}from"@symbo.ls/signal";import{createEffect as k}from"@symbo.ls/signal";import{cacheNode as rt,detectTag as At}from"./cache.js";import{REGISTRY as U,LIFECYCLE_EVENTS as Ut}from"./registry.js";import{registerEvent as Vt}from"./delegate.js";import{applyExtends as Wt}from"./extends.js";import{addMethods as Bt}from"./methods.js";import"./dispose.js";import{isLoudDevRuntime as vt}from"./devRuntime.js";import{replaceLiteralsWithObjectFields as it}from"@symbo.ls/utils";import{runPluginHook as V}from"@symbo.ls/utils/function.js";import{applyStateMethods as q}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as T,DEFAULT_CSS_PROPERTIES_LIST as $}from"css-in-props";import{css as et,wrapHoverRule as Ct}from"@symbo.ls/css";import{pushConfig as E,popConfig as P}from"@symbo.ls/scratch";import{checkAttributeByTagName as ft,applyAttrTransforms as Ht,camelToAttr as St}from"attrs-in-props";let Yt=1;const m=[];let at=!1;function zt(){at||(at=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(kt):setTimeout(kt,0))}function kt(){if(at=!1,!m.length)return;const t=m.splice(0,m.length);for(let s=0;s<t.length;s++){const n=t[s];!n.node||!n.node.isConnected||I("Mounted",n,n.__ref?.__mountOptions||{})}}function wt(t,s){typeof t.onMounted=="function"&&(t.__ref.__mountOptions=s,m.push(t),zt())}function jt(t,s){if(typeof t.onContentUpdate!="function")return;t.context?.plugins?.length&&V("contentUpdate",t,s);const n=t.context?.designSystem;n&&E(n);try{t.onContentUpdate(t,t.state,t.context,s)}catch(c){if(t.context?.plugins?.length&&V("error",t,{hook:"onContentUpdate",error:c})||console.error('[DOMQL] Lifecycle "onContentUpdate" error:',c),t.context?.strictMode)throw c}finally{n&&P()}}function H(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function Gt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Zt(t){return t.toLowerCase()}function Et(t){const s=t.charCodeAt(0);return s===58||s===64||s===38}function Q(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=Q(f,o):n[c]=o}return n}function Y(t,s,n,c={},f){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=n||t.key||`_${Yt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=Y);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:s?.__ref?.root||o,path:s?.__ref?.path?[...s.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const u=n.indexOf("_");if(u>0){const h=n.substring(0,u),g=o.context?.components;g&&(g[h]||g["smbls."+h])?t={...t,extends:h}:g&&vt()&&/^[A-Z]\w*_\d+$/.test(n)&&console.warn(`[smbls] auto-extend: key "${n}" looks like a multi-instance (${h}_N) but neither "${h}" nor "smbls.${h}" is registered in context.components \u2014 element will render as a plain <div>. Register the base component or rename the key.`)}}Wt(o,t,c);const e=new Set(["childProps","attr","style","scope","data"]),r=o.props&&typeof o.props=="object"?o.props:null;for(const u in t){if(u==="parent"||u==="node"||u==="__ref"||u==="extends"||u==="context"||u==="props")continue;const h=t[u],g=o[u],C=g&&h&&typeof g=="object"&&typeof h=="object"&&!Array.isArray(g)&&!Array.isArray(h)&&typeof g!="function"&&typeof h!="function";C&&u.charCodeAt(0)>=65&&u.charCodeAt(0)<=90?o[u]=Q(g,h):C&&e.has(u)?o[u]={...g,...h}:C&&Et(u)?o[u]=Q(g,h):o[u]=h}function a(u){for(const h in u){const g=u[h],C=o[h],x=C&&g&&typeof C=="object"&&typeof g=="object"&&!Array.isArray(C)&&!Array.isArray(g)&&typeof C!="function"&&typeof g!="function";x&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Q(C,g):x&&e.has(h)?o[h]={...C,...g}:x&&Et(h)?o[h]=Q(C,g):o[h]=g}}r&&a(r),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const d=o.scope&&typeof o.scope=="object"?o.scope:null,l=s?.scope,p=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,y=l||p||null;if(t.scope!==void 0||d){const u={};d&&Object.assign(u,d),t.scope!==void 0&&Object.assign(u,t.scope),o.scope=Kt(u,y)}else y&&(o.scope=y);if(t.if!==void 0&&(o.if=t.if),Bt(o),qt(o,s,t),o.if!=null){let u;if(typeof o.if=="function")try{u=o.if(o,o.state,o.context)}catch(h){if(u=!1,i.__ifError=h,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,h?.message||h)}}else u=o.if;i.__if=!!u}if(i.__if)typeof o.if=="function"&&(i.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof o.if=="function"&&Lt(o,i,o.if),o;o.tag||(o.tag=At(o)),I("Init",o,c);const _=o.node=rt(o);if(!_)return o;if(o.tag==="fragment"){const h=(o.context?.document||globalThis.document).createComment("");_.appendChild(h),i.__fragmentAnchor=h}I("AttachNode",o,c),_.setAttribute&&o.key&&_.setAttribute("data-key",o.key),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),_.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&_.setAttribute("data-smbls-app",o.context.key),o.id&&_.setAttribute&&(_.id=o.id),Ft(o,c),Ot(o),ut(o),Rt(o),ro(o);try{Mt(o,c)}catch(u){if(typeof console<"u"&&console.error){const h=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${h}:`,u?.message||u,u?.stack?`
|
|
2
2
|
`+u.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(yt(o,!0),ht(o,s,f),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&j(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&E()}}if(I("Create",o,c),I("Complete",o,c),I("Render",o,c),I("RenderRouter",o,c),St(o,c),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&j(h);try{u(o,o.state,o.context)}catch(v){console.error("[DOMQL] onFrame error:",v)}finally{h&&E()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function Zt(t,s,n){const c=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,z(t,t.state);else if(t.context?.state){const e=t.context.state,r={...e},a=t.context?.polyglot;if(a?.translations){const d=e.lang||a.defaultLang||"en",l=a.translations[d];if(l&&typeof l=="object")for(const y in l)r[y]===void 0&&(r[y]=l[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&r[y]===void 0&&(r[y]=a.translations[y])}t.state=K(r)?r:st(r),t.state.__element=t,t.state.root=t.state,z(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),z(t,t.state);return}if(typeof i=="string"){if(t.state=jt(i,s),t.state&&typeof t.state=="object"&&!K(t.state)){const e=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}z(t,t.state);return}if(typeof i=="function"){const e=i(t,s?.state);t.state=K(e)?e:st(e||{})}else K(i)?t.state=i:t.state=st({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,z(t,t.state)}function ft(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const f of n){if(c==null)return{};c=c[f]}return c??{}}function jt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?ft(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?ft(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=ft(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const f=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[f];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function zt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const e=o[i];if(typeof t[e]!="function"||U.has(e))continue;const r=e.charCodeAt(0);r>=65&&r<=90||B(e)||T[e]||L&&L.has(e)||it(n,e)||f.push({prop:e,fn:t[e]})}for(let i=0;i<f.length;i++){const{prop:e,fn:r}=f[i];s.__exec[e]=r,Object.defineProperty(t,e,{get(){c&&j(c);try{return r(t,t.state,t.context)}catch{return}finally{c&&E()}},set(a){delete s.__exec[e],Object.defineProperty(t,e,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function qt(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function w(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return qt(t,s),n.apply(this,c)}}function Q(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function Et(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(zt(t),typeof t.text=="function"){const o=t.text,i=w(t,t.textDeps,o),e=k(()=>{if(!n.contentManaged)try{let r=i(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=ct.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=k(()=>{if(n.contentManaged)return;const e=ct.call(t,o,t.state);e!=null&&(t.text=e),t.node&&(t.tag==="string"?t.node.nodeValue=e??"":t.node.textContent=e??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!U.has(o)&&!B(o)&&!n.__exec[o]){if(T[o]){const i=t[o],e=w(t,t[o+"Deps"],i),r=o;let a;const d=k(()=>{const l=t.context?.designSystem;l&&j(l);try{const p=e(t,t.state,t.context),y=T[r](p,t,t.state,t.context);if(y&&t.node){const _=Ot(y);(_===null||_!==a)&&(a=_,Y(t.node,y))}else t.node&&(r==="show"||r==="hide")&&(a=void 0,t.node.style.display="")}finally{l&&E()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}else if(L&&L.has(o)){const i=t[o],e=w(t,t[o+"Deps"],i),r=o;let a;const d=k(()=>{const l=t.context?.designSystem;l&&j(l);try{const p=e(t,t.state,t.context);if(t.node)if(p!=null){const y=r+":"+String(p);y!==a&&(a=y,Y(t.node,{[r]:p}))}else a=void 0,t.node.style[r]=""}finally{l&&E()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=w(t,t.htmlDeps,o),e=k(()=>{const r=t.context?.designSystem;r&&j(r);try{const a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&(t.node.innerHTML=a)}finally{r&&E()}},{depth:n.path.length});n.__effects.push(e),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=w(t,t.valueDeps,o),e=k(()=>{try{const r=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const a=r==null?"":String(r);if(t.node.value===a)return;const d=typeof document<"u"&&document.activeElement===t.node,l=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=a,d&&l!=null&&p!=null)try{t.node.setSelectionRange(l,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=w(t,t.styleDeps,o);let e;const r=k(()=>{const a=i(t,t.state,t.context),d=Ot(a);(d===null||d!==e)&&(e=d,Y(t.node,a))},{depth:n.path.length});n.__effects.push(r),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const e=w(t,Q(t.styleDeps,o),i);let r;const a=k(()=>{try{const d=e(t,t.state,t.context);if(t.node){const l=o+":"+String(d);l!==r&&(r=l,Y(t.node,{[o]:d}))}}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=w(t,Q(t.attrDeps,o),t.attr[o]),e=o,r=k(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(r)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=w(t,Q(t.ariaDeps,o),t.aria[o]),e="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=k(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=w(t,Q(t.dataDeps,o),t.data[o]),r="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=k(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(r):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(r,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){if(typeof f[o]!="function")continue;const i=w(t,Q(t.classDeps,o),f[o]),e=k(()=>{try{const r=i(t,t.state,t.context);if(!t.node?.classList)return;typeof r=="string"?t.node.classList.add(r):r?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(e)}!c&&typeof t.if=="function"&&Pt(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||U.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||B(o))continue;const e=t[o];n.__exec[o]=e;const r=t.tag||"div";if(it(r,o)&&!T[o]&&!(L&&L.has(o))){const a=o,d=w(t,t[o+"Deps"],e),l=k(()=>{try{const p=d(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(l)}}if(Jt(t),to(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let e=!1,r=[];const a=k(()=>{const d=[];for(let _=0;_<i.length;_++){const u=i[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!e){e=!0,r=d;return}let l=d.length!==r.length;for(let _=0;!l&&_<d.length;_++)d[_]!==r[_]&&(l=!0);const p=r;if(r=d,!l)return;const y=t.context?.designSystem;y&&j(y);try{o(t,t.state,t.context,{prev:p,next:d})}catch(_){if(t.context?.plugins?.length&&V("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&E()}},{depth:n.path.length});n.__effects.push(a)}}function Pt(t,s,n){const c=w(t,t.ifDeps,n),f=k(()=>{let o;try{o=c(t,t.state,t.context)}catch(e){if(o=!1,s.__ifError=e,typeof console<"u"&&console.warn){const r=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${r} \u2014 treating as false:`,e?.message||e)}return}const i=s.__if;if(s.__if=!!o,i&&!s.__if&&t.node)t.node.remove();else if(!i&&s.__if)if(s.__ifInitialized){t.node||(t.node=nt(t)),t.node&&(t.node.ref=t);const e=t.parent,r=e?.node;if(r&&t.node){let a=null;const d=Object.keys(e),l=d.indexOf(t.key);for(let p=l+1;p<d.length;p++){const y=e[d[p]];if(y?.node?.parentNode===r){a=y.node;break}}a?r.insertBefore(t.node,a):r.appendChild(t.node)}else ht(t,t.parent);at(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=bt(t)),I("Init",t,{}),t.node||(t.node=nt(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const r=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(r),s.__fragmentAnchor=r}I("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Rt(t,{}),Et(t,{skipIfEffect:!0}),at(t),$t(t),Nt(t,{}),ht(t,t.parent),St(t,{})}},{depth:s.path.length});s.__effects.push(f)}function at(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),so(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&Y(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const f=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];f&&s.classList.add(typeof f=="string"?f:c)}}}}function Ot(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function Y(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const f=s[c];if(f!=null){if(c.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[c]=f;continue}try{const o=String(f),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),e=o.trim(),r=/\s*!important\s*$/.test(e),a=e.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&Xt(t,n)}let Qt=0;function Xt(t,s){const n=`_ds${Qt++}`;t.classList.add(n);const c=t.ownerDocument;let f=c.querySelector("style[data-smbls-scoped]");f||(f=c.createElement("style"),f.setAttribute("data-smbls-scoped",""),c.head.appendChild(f));let o="";for(const i in s){const e="."+n,r=i.replace(/&/g,e).split(",").map(d=>{const l=d.trim();return l.includes(e)?l:e+l}).join(", "),a=s[i];if(typeof a=="object"){let d="",l="";for(const p in a){const y=a[p];if(typeof y=="object"){const _=p.includes("&")?r.split(", ").map(h=>p.replace(/&/g,h)).join(", "):r.split(", ").map(h=>`${h} ${p}`).join(", ");let u="";for(const h in y)u+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;l+=vt(`${_} { ${u} }`,_)+`
|
|
5
|
-
`}else d+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=
|
|
6
|
-
`),l&&(o+=l)}}o&&(f.textContent+=o)}function Jt(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const f=s[c];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],e=o.slice(1),r={value:!1},a=k(()=>{const d=t.state&&(K(t.state)?t.state.root:null);if(!d||!K(d))return;let l=d;l=l[i];for(let y=0;y<e.length&&!(l==null||typeof l!="object");y++)if(K(l))l=l[e[y]];else break;if(!r.value)return;let p=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&j(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(p=!0)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&E()}}if(!p&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!p&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&j(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&E()}}},{depth:n.path.length});r.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function dt(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}const Lt=new Set;function mt(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Lt.has(c)||(Lt.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function G(t,s,n){const c={},f=(o,i)=>{if(T[o]){const e=T[o](i,s,s.state,s.context);if(e){const r=Array.isArray(e)?e:[e];for(const a of r)a&&Object.assign(c,a)}}else c[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let d=i[a];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&f(a,d)}continue}if(dt(o,s)){const a=G(i,s,!0);Object.keys(a).length&&(c[`[data-theme="${o.slice(1)}"] &`]=a);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(o)){At()&&mt(o,s);continue}let e=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(e=`@media ${a}`)}const r=G(i,s,!1);Object.keys(r).length&&(c[e]=r);continue}f(o,i)}}if(n)for(const o in c){const i=c[o];typeof i=="string"&&!i.includes("!important")&&(c[o]=i+" !important")}return c}function to(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const f=c.charAt(0);if(f!=="."&&f!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const l=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${f}\` is read as one prop name. Nest the selector inside instead: \`${f}${l}: { '${o.slice(l.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const e=f==="!",r={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let l;const p=t[o];if(p===void 0)if(t.state&&o in t.state)l=t.state[o];else{const u=t.context?.cases?.[o];if(u===void 0)return;try{l=typeof u=="function"?u.call(t,t):u}catch(h){l=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof p=="function")try{l=p(t,t.state,t.context)}catch(u){l=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else l=p;const y=e?!l:!!l;if(y===r.lastMatch)return;r.lastMatch=y;const _=t.context?.designSystem;_&&j(_);try{if(y){const u={},h={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const b=i[x],C=x.charAt(0);if((C===":"||C==="@"||C==="&")&&b&&typeof b=="object"&&!Array.isArray(b)){if(dt(x,t)){const P=G(b,t,!0);Object.keys(P).length&&(h[`[data-theme="${x.slice(1)}"] &`]=P,g=!0)}else{let P=x;if(C==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const D=t.context?.designSystem?.media?.[x.slice(1)];D&&(P=`@media ${D}`)}const W=G(b,t,!1);Object.keys(W).length&&(h[P]=W,g=!0)}continue}const N=typeof b=="function"?b(t,t.state,t.context):b;if(N!=null)if(T[x]){const P=T[x](N,t,t.state,t.context);if(P){const W=Array.isArray(P)?P:[P];for(const D of W)D&&Object.assign(u,D)}}else L&&L.has(x)&&(u[x]=N)}const v=Object.keys(u);if(v.length){Y(t.node,u);for(const x of v)n.set(x,c);r.appliedKeys=v}else r.appliedKeys=null;if(g){const x=rt(h,null,t.context?.cssPrefix),b=x?x.split(" ").filter(Boolean):[];if(b.length&&t.node.classList){for(const C of b)t.node.classList.add(C);r.appliedClasses=b}else r.appliedClasses=null}else if(r.appliedClasses){for(const x of r.appliedClasses)t.node.classList.remove(x);r.appliedClasses=null}}else{if(r.appliedKeys){for(const u of r.appliedKeys)n.get(u)===c&&(t.node.style[u]="",n.delete(u));r.appliedKeys=null}if(r.appliedClasses){for(const u of r.appliedClasses)t.node.classList.remove(u);r.appliedClasses=null}}}finally{_&&E()}};s.__conditionalRunners.push(a);const d=k(a,{depth:s.path.length});s.__effects.push(d)}}const ut=new WeakSet;function oo(t){const s=t.ownerDocument;!s||ut.has(s)||(ut.add(s),queueMicrotask(()=>{ut.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const pt=new WeakSet;let Dt=!1;function so(t){const{node:s}=t;if(!s)return;if(Dt||(Dt=!0,rt({display:"none"})),pt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}pt.add(t);const n=t.context?.designSystem;n&&j(n);try{const c={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||U.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!B(o)){if(T[o]){const e=t[o],r=T[o](e,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(c,a);else Object.assign(c,r);f=!0}}else if(L&&L.has(o)){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const e=t[o];if(e&&typeof e=="object"){if(dt(o,t)){const r=G(e,t,!0);Object.keys(r).length&&(c[`[data-theme="${o.slice(1)}"] &`]=r,f=!0)}else{let r=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(r=`@media ${d}`)}const a=G(e,t,!1);Object.keys(a).length&&(c[r]=a,f=!0)}f=!0}}}}if(f){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=rt(c,null,t.context?.cssPrefix);if(o&&s.classList){const e=o.split(" ").filter(Boolean);let r=!1;for(const a of e)s.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&oo(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const e=c.display;if(e&&e!==i)if(i==="none"){const r=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&E(),pt.delete(t)}}function $t(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=Wt(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const c=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||U.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!B(f)&&!(T[f]||L&&L.has(f))&&it(c,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=ct(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(f,i===!0?"":i)}}}function no(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const Tt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Rt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!B(n)||Tt.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(e){return t.call(o,e)}}if(typeof c!="function")continue;const f=Yt(n);It.has(f)||Kt(Gt(f),t,c)}co(t)}function co(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const p of Tt){const y=t[p];typeof y=="function"&&(n[p]=y,c=!0)}if(!c)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,e=0,r=0,a=!1;const d=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(i=y.clientX,e=y.clientY,r=Date.now(),a=!0)},l=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const _=y.clientX-i,u=y.clientY-e,h=Date.now()-r;if(h>o)return;const g=Math.abs(_),v=Math.abs(u);if(Math.max(g,v)<f)return;let x;if(g>v*1.2)x=_<0?"left":"right";else if(v>g*1.2)x=u<0?"up":"down";else return;const b="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),C=n[b],N=n.onSwipe;C&&C.call(t,p,t,t.state,t.context),N&&N.call(t,{direction:x,dx:_,dy:u,dt:h,event:p},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",l,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",l)}catch{}})}function tt(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=tt(f,o):n[c]=o}return n}function lt(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const e=t.childProps,r=t.childrenAs;for(let a=0;a<s.length;a++){let d=s[a];const l=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let p=e;if(typeof e=="function")try{p=e(t,d)}catch{p=null}if(r==="state"){let u=l;(typeof l=="string"||typeof l=="number")&&(u={value:l,text:l}),d=p?{...p,state:u}:{state:u}}else p&&(d=tt(p,d));if(c&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(c)?c:[c];d={...d,extends:[...h,...u]}}else d={...d,extends:c};const y=d?.key||l&&typeof l=="object"&&l.key||`${a}`,_=H(d,t,y,n);!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=jt(s,t);if(Array.isArray(f)){lt(t,f,n);return}}if(typeof s=="object")for(const f in s){if(U.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=tt(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],e=Array.isArray(c)?c:[c];o={...o,extends:[...e,...i]}}else o={...o,extends:c};H(o,t,f,n)}}}function yt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",e=t.value!=null&&typeof t.value!="function";if(i||e){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const l=d==null?"":String(d);n.value!==l&&(n.value=l);return}const r=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!r)return;let a=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(a=d);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Nt(t,s){let{children:n,content:c}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;try{n=i(t,t.state,t.context)}catch(l){if(n=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,l?.message||l)}}t.children=n;const e=t.__ref;let r=!1;const a=w(t,t.childrenDeps,i),d=k(()=>{const l=r;r=!0;let p;try{p=a(t,t.state,t.context)}catch(b){if(typeof console<"u"&&console.error){const C=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${C}${l?"":" (initial tracking run)"}:`,b?.message||b)}return}if(!l||p===t.children)return;t.children=p;const y=typeof t.onContentUpdate=="function",_=y?[]:null,u=y?[]:null,h=y?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const b=t.childProps,C=[],N=new Map;for(let S=0;S<p.length;S++){const O=p[S];let A=b;if(typeof b=="function")try{A=b(t,O)}catch{A=null}const F=A&&A.key||O&&O.key||`${S}`;C.push(F),N.set(F,{rawChild:O,childProps:A})}const P=new Set(C),W=e.__children.slice();for(const S of W)if(!P.has(S)){const O=t[S];O?.remove&&O.remove(),delete t[S],u&&u.push(S)}const D=t.childExtends,X=t.tag==="fragment",Ft=t.context?.document||globalThis.document,Z=X?null:Ft?.createDocumentFragment();for(const S of C){const O=N.get(S),A=O.rawChild,F=t[S];if(F&&F.state){if(A&&typeof A=="object"){const $=F.state,J=$.$replace||$.replace,xt=$.$update||$.update;if(typeof J=="function")J.call($,A);else if(typeof xt=="function"){for(const M in $)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(A,M))try{$[M]=void 0}catch{}xt.call($,A)}else for(const M in A)$[M]=A[M]}h&&h.push(S);continue}let ot=A;(typeof A=="string"||typeof A=="number")&&(ot={value:A,text:A});const _t=O.childProps;let R=_t?{..._t,state:ot}:{state:ot};if(D&&!R.ignoreChildExtends)if(R.extends){const $=Array.isArray(R.extends)?R.extends:[R.extends],J=Array.isArray(D)?D:[D];R={...R,extends:[...J,...$]}}else R={...R,extends:D};const gt=H(R,t,S,s);!X&>?.node&&Z&&Z.appendChild(gt.node),_&&_.push(S)}if(!X&&Z&&Z.childNodes.length&&t.node&&t.node.appendChild(Z),!X&&t.node){let S=null;for(const O of C){const A=t[O]?.node;if(!A)continue;const F=S?S.nextSibling:t.node.firstChild;A!==F&&t.node.insertBefore(A,F),S=A}}e.__children=C,y&&(_.length||u.length)&&kt(t,{added:_,removed:u,kept:h}),yt(t,!1);return}const x=y?[...e.__children]:null;for(const b of[...e.__children]){const C=t[b];C?.remove&&C.remove(),delete t[b]}e.__children=[],lt(t,p,s),yt(t,!1),y&&kt(t,{added:[...e.__children],removed:x,kept:[]})},{depth:e.path.length});e.__effects.push(d)}if(lt(t,n||c,s),n||c)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let e=0;e<i.length;e++){const r=i[e];if(!r.endsWith("Extends")||typeof t[r]!="string")continue;const a=r.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const d={extends:t[r]};delete t[r];for(let l=e+1;l<i.length;l++){const p=i[l],y=p.charCodeAt(0);if(y>=65&&y<=90||U.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const _=t[p];_!==void 0&&(d[p]=_,delete t[p])}t[a]&&typeof t[a]=="object"?t[a]={...d,...t[a]}:t[a]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||U.has(i)||typeof t[i]!="object"||t[i]===null)continue;const e=i.charCodeAt(0);if(e<65||e>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={...r,extends:a})}if(t.childProps&&(r=tt(t.childProps,r)),f&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],d=Array.isArray(f)?f:[f];r={...r,extends:[...d,...a]}}else r={...r,extends:f};H(r,t,i,s)}}}function ht(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;i.insertBefore(c,e||f)}else i.insertBefore(c,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(c,i):o.appendChild(c)}else o.appendChild(c)}function I(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&V(c,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const e=s.context?.designSystem;e&&j(e);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&V("error",s,{hook:f,error:r})||console.error(`[DOMQL] Lifecycle "${f}" error:`,r),s.context?.strictMode)throw r}finally{e&&E(),i&&(s.__ref.__inRender=!1)}}return!0}var jo=H;export{H as create,jo as default,Ct as flushMounts};
|
|
4
|
+
`):"")}}if(_t(o,!0),gt(o,s,f),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const u=o.context?.designSystem;u&&E(u);try{const h=o.html(o,o.state,o.context);h!=null&&typeof h!="function"&&(o.node.innerHTML=h)}catch{}finally{u&&P()}}if(I("Create",o,c),I("Complete",o,c),I("Render",o,c),I("RenderRouter",o,c),wt(o,c),typeof o.onFrame=="function"){const u=o.onFrame,h=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){h&&E(h);try{u(o,o.state,o.context)}catch(C){console.error("[DOMQL] onFrame error:",C)}finally{h&&P()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function qt(t,s,n){const c=!s,f=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&f&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!K(t.state)?t.state:void 0;if(i==null){if(s?.state)t.state=s.state,q(t,t.state);else if(t.context?.state){const e=t.context.state,r={...e},a=t.context?.polyglot;if(a?.translations){const d=e.lang||a.defaultLang||"en",l=a.translations[d];if(l&&typeof l=="object")for(const y in l)r[y]===void 0&&(r[y]=l[y]);const p=new Set(a.languages||[]);for(const y in a.translations)!p.has(y)&&r[y]===void 0&&(r[y]=a.translations[y])}t.state=K(r)?r:ct(r),t.state.__element=t,t.state.root=t.state,q(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),q(t,t.state);return}if(typeof i=="string"){if(t.state=Pt(i,s),t.state&&typeof t.state=="object"&&!K(t.state)){const e=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:e,enumerable:!1,configurable:!0,writable:!0})}q(t,t.state);return}if(typeof i=="function"){const e=i(t,s?.state);t.state=K(e)?e:ct(e||{})}else K(i)?t.state=i:t.state=ct({...i});t.state.__element=t,s?.state?(t.state.parent=s.state,t.state.root=s.state.root||s.state):t.state.root=t.state,q(t,t.state)}function dt(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const f of n){if(c==null)return{};c=c[f]}return c??{}}function Pt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const f=t.slice(3);return f?dt(s.state,f):s.state??{}}if(t.startsWith("~/")){const f=s.state?.root||s.state,o=t.slice(2);return o?dt(f,o):f??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=dt(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const f=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[f];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function Qt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,f=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const e=o[i];if(typeof t[e]!="function"||U.has(e))continue;const r=e.charCodeAt(0);r>=65&&r<=90||H(e)||T[e]||$&&$.has(e)||ft(n,e)||f.push({prop:e,fn:t[e]})}for(let i=0;i<f.length;i++){const{prop:e,fn:r}=f[i];s.__exec[e]=r,Object.defineProperty(t,e,{get(){c&&E(c);try{return r(t,t.state,t.context)}catch{return}finally{c&&P()}},set(a){delete s.__exec[e],Object.defineProperty(t,e,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Xt(t,s){if(!(!Array.isArray(s)||s.length===0))for(let n=0;n<s.length;n++){const c=s[n];try{typeof c=="function"?c(t,t.state,t.context):typeof c=="string"&&t.state?.[c]}catch{}}}function j(t,s,n){return!Array.isArray(s)||s.length===0?n:function(...c){return Xt(t,s),n.apply(this,c)}}function X(t,s){if(!(!t||Array.isArray(t)||typeof t!="object"))return t[s]}function Ot(t,s){const n=t.__ref,c=!!(s&&s.skipIfEffect);if(Qt(t),typeof t.text=="function"){const o=t.text,i=j(t,t.textDeps,o),e=k(()=>{if(!n.contentManaged)try{let r=i(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=it.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.text=o}else if(typeof t.text=="string"&&t.text.includes("{{")){const o=t.text,i=k(()=>{if(n.contentManaged)return;const e=it.call(t,o,t.state);e!=null&&(t.text=e),t.node&&(t.tag==="string"?t.node.nodeValue=e??"":t.node.textContent=e??"")},{depth:n.path.length});n.__effects.push(i),n.__exec.text=o}for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&typeof t[o]=="function"&&!U.has(o)&&!H(o)&&!n.__exec[o]){if(T[o]){const i=t[o],e=j(t,t[o+"Deps"],i),r=o;let a;const d=k(()=>{const l=t.context?.designSystem;l&&E(l);try{const p=e(t,t.state,t.context),y=T[r](p,t,t.state,t.context);if(y&&t.node){const _=$t(y);(_===null||_!==a)&&(a=_,z(t.node,y))}else t.node&&(r==="show"||r==="hide")&&(a=void 0,t.node.style.display="")}finally{l&&P()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}else if($&&$.has(o)){const i=t[o],e=j(t,t[o+"Deps"],i),r=o;let a;const d=k(()=>{const l=t.context?.designSystem;l&&E(l);try{const p=e(t,t.state,t.context);if(t.node)if(p!=null){const y=r+":"+String(p);y!==a&&(a=y,z(t.node,{[r]:p}))}else a=void 0,t.node.style[r]=""}finally{l&&P()}},{depth:n.path.length});n.__effects.push(d),n.__exec[o]=i}}if(typeof t.html=="function"){const o=t.html,i=j(t,t.htmlDeps,o),e=k(()=>{const r=t.context?.designSystem;r&&E(r);try{const a=i(t,t.state,t.context);t.node&&a!=null&&typeof a!="function"&&(t.node.innerHTML=a)}finally{r&&P()}},{depth:n.path.length});n.__effects.push(e),n.__exec.html=o}if(typeof t.value=="function"){const o=t.value,i=j(t,t.valueDeps,o),e=k(()=>{try{const r=i(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const a=r==null?"":String(r);if(t.node.value===a)return;const d=typeof document<"u"&&document.activeElement===t.node,l=d&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,p=d&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=a,d&&l!=null&&p!=null)try{t.node.setSelectionRange(l,p)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(e),n.__exec.value=o}if(typeof t.style=="function"){const o=t.style,i=j(t,t.styleDeps,o);let e;const r=k(()=>{const a=i(t,t.state,t.context),d=$t(a);(d===null||d!==e)&&(e=d,z(t.node,a))},{depth:n.path.length});n.__effects.push(r),n.__exec.style=o}else if(t.style&&typeof t.style=="object")for(const o in t.style){const i=t.style[o];if(typeof i!="function")continue;const e=j(t,X(t.styleDeps,o),i);let r;const a=k(()=>{try{const d=e(t,t.state,t.context);if(t.node){const l=o+":"+String(d);l!==r&&(r=l,z(t.node,{[o]:d}))}}catch{}},{depth:n.path.length});n.__effects.push(a)}if(t.attr&&typeof t.attr=="object"){for(const o in t.attr)if(typeof t.attr[o]=="function"){const i=j(t,X(t.attrDeps,o),t.attr[o]),e=o,r=k(()=>{try{const a=i(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a))}catch{}},{depth:n.path.length});n.__effects.push(r)}}if(t.aria&&typeof t.aria=="object")for(const o in t.aria){if(typeof t.aria[o]!="function")continue;const i=j(t,X(t.ariaDeps,o),t.aria[o]),e="aria-"+o.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=k(()=>{try{const a=i(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(e):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(e,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(t.data&&typeof t.data=="object")for(const o in t.data){if(typeof t.data[o]!="function")continue;const i=j(t,X(t.dataDeps,o),t.data[o]),r="data-"+o.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),a=k(()=>{try{const d=i(t,t.state,t.context);if(!t.node?.setAttribute)return;d==null||d===!1?t.node.removeAttribute(r):typeof d!="function"&&typeof d!="object"&&t.node.setAttribute(r,d===!0?"":d)}catch{}},{depth:n.path.length});n.__effects.push(a)}const f=t.classlist&&typeof t.classlist=="object"&&!Array.isArray(t.classlist)?t.classlist:t.class&&typeof t.class=="object"&&!Array.isArray(t.class)?t.class:null;if(f)for(const o in f){if(typeof f[o]!="function")continue;const i=j(t,X(t.classDeps,o),f[o]),e=k(()=>{try{const r=i(t,t.state,t.context);if(!t.node?.classList)return;typeof r=="string"?t.node.classList.add(r):r?t.node.classList.add(o):t.node.classList.remove(o)}catch{}},{depth:n.path.length});n.__effects.push(e)}!c&&typeof t.if=="function"&&Lt(t,n,t.if);for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||U.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||H(o))continue;const e=t[o];n.__exec[o]=e;const r=t.tag||"div";if(ft(r,o)&&!T[o]&&!($&&$.has(o))){const a=St(o)||o,d=j(t,t[o+"Deps"],e),l=k(()=>{try{const p=d(t,t.state,t.context);t.node?.setAttribute&&(p==null||p===!1?t.node.removeAttribute(a):typeof p!="function"&&typeof p!="object"&&(a==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(a,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(l)}}if(to(t),so(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let e=!1,r=[];const a=k(()=>{const d=[];for(let _=0;_<i.length;_++){const u=i[_];try{d[_]=typeof u=="function"?u(t,t.state,t.context):t.state?.[u]}catch{d[_]=void 0}}if(!e){e=!0,r=d;return}let l=d.length!==r.length;for(let _=0;!l&&_<d.length;_++)d[_]!==r[_]&&(l=!0);const p=r;if(r=d,!l)return;const y=t.context?.designSystem;y&&E(y);try{o(t,t.state,t.context,{prev:p,next:d})}catch(_){if(t.context?.plugins?.length&&V("error",t,{hook:"onStateUpdate",error:_})||console.error('[DOMQL] Lifecycle "onStateUpdate" error:',_),t.context?.strictMode)throw _}finally{y&&P()}},{depth:n.path.length});n.__effects.push(a)}}function Lt(t,s,n){const c=j(t,t.ifDeps,n),f=k(()=>{let o;try{o=c(t,t.state,t.context)}catch(e){if(o=!1,s.__ifError=e,typeof console<"u"&&console.warn){const r=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${r} \u2014 treating as false:`,e?.message||e)}return}const i=s.__if;if(s.__if=!!o,i&&!s.__if&&t.node)t.node.remove();else if(!i&&s.__if)if(s.__ifInitialized){t.node||(t.node=rt(t)),t.node&&(t.node.ref=t);const e=t.parent,r=e?.node;if(r&&t.node){let a=null;const d=Object.keys(e),l=d.indexOf(t.key);for(let p=l+1;p<d.length;p++){const y=e[d[p]];if(y?.node?.parentNode===r){a=y.node;break}}a?r.insertBefore(t.node,a):r.appendChild(t.node)}else gt(t,t.parent);ut(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=At(t)),I("Init",t,{}),t.node||(t.node=rt(t)),!t.node)return;if(t.parent?.__ref?.__children&&!t.parent.__ref.__children.includes(t.key)&&t.parent.__ref.__children.push(t.key),t.tag==="fragment"&&!s.__fragmentAnchor){const r=(t.context?.document||globalThis.document).createComment("");t.node.appendChild(r),s.__fragmentAnchor=r}I("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),Ft(t,{}),Ot(t,{skipIfEffect:!0}),ut(t),Rt(t),Mt(t,{}),gt(t,t.parent),wt(t,{})}},{depth:s.path.length});s.__effects.push(f)}function ut(t){const{node:s}=t;if(s){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?s.nodeValue=t.text:s.textContent=t.text:typeof t.text=="number"&&(s.textContent=t.text),co(t),typeof t.html=="string"&&(s.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in s){const n=String(t.value);s.value!==n&&(s.value=n)}if(t.style&&typeof t.style=="object"&&z(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const c=t.attr[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.setAttribute&&s.setAttribute(n,c===!0?"":c)}if(t.data&&typeof t.data=="object")for(const n in t.data){const c=t.data[n];typeof c=="function"||typeof c=="object"||c==null||c===!1||s.dataset&&(s.dataset[n]=c===!0?"":c)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(c=>c&&s.classList.add(c));else if(typeof n=="object")for(const c in n){const f=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];f&&s.classList.add(typeof f=="string"?f:c)}}}}function $t(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function z(t,s){if(!t||!s||!t.style)return;let n=null;for(const c in s){const f=s[c];if(f!=null){if(c.charAt(0)==="&"&&typeof f=="object"){n||(n={}),n[c]=f;continue}try{const o=String(f),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),e=o.trim(),r=/\s*!important\s*$/.test(e),a=e.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&mt(t,n)}let Jt=0;function mt(t,s){const n=`_ds${Jt++}`;t.classList.add(n);const c=t.ownerDocument;let f=c.querySelector("style[data-smbls-scoped]");f||(f=c.createElement("style"),f.setAttribute("data-smbls-scoped",""),c.head.appendChild(f));let o="";for(const i in s){const e="."+n,r=i.replace(/&/g,e).split(",").map(d=>{const l=d.trim();return l.includes(e)?l:e+l}).join(", "),a=s[i];if(typeof a=="object"){let d="",l="";for(const p in a){const y=a[p];if(typeof y=="object"){const _=p.includes("&")?r.split(", ").map(h=>p.replace(/&/g,h)).join(", "):r.split(", ").map(h=>`${h} ${p}`).join(", ");let u="";for(const h in y)u+=`${h.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${y[h]};`;l+=Ct(`${_} { ${u} }`,_)+`
|
|
5
|
+
`}else d+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=Ct(`${r} { ${d} }`,r)+`
|
|
6
|
+
`),l&&(o+=l)}}o&&(f.textContent+=o)}function to(t){let s=t.subscribeTo;if(typeof s=="function")try{s=s(t,t.state,t.context)}catch{s=null}if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let c=0;c<s.length;c++){const f=s[c];if(typeof f!="string"||f.length===0)continue;const o=f.split("."),i=o[0],e=o.slice(1),r={value:!1},a=k(()=>{const d=t.state&&(K(t.state)?t.state.root:null);if(!d||!K(d))return;let l=d;l=l[i];for(let y=0;y<e.length&&!(l==null||typeof l!="object");y++)if(K(l))l=l[e[y]];else break;if(!r.value)return;let p=!1;if(typeof t.onBeforeUpdate=="function"){const y=t.context?.designSystem;y&&E(y);try{t.onBeforeUpdate(t,t.state,t.context,{updateBySubscription:!0})===!1&&(p=!0)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onBeforeUpdate",error:_})||console.error("[DOMQL] subscribeTo onBeforeUpdate error:",_)}finally{y&&P()}}if(!p&&t.node&&n.__effects)for(let y=0;y<n.__effects.length;y++){const _=n.__effects[y];_&&_!==a&&!_._disposed&&!_._isSubscribeToEffect&&typeof _._execute=="function"&&_._execute()}if(!p&&typeof t.onUpdate=="function"){const y=t.context?.designSystem;y&&E(y);try{t.onUpdate(t,t.state,t.context)}catch(_){t.context?.plugins?.length&&V("error",t,{hook:"onUpdate",error:_})||console.error("[DOMQL] subscribeTo onUpdate error:",_)}finally{y&&P()}}},{depth:n.path.length});r.value=!0,a._isSubscribeToEffect=!0,n.__effects.push(a)}}function pt(t,s){return t.charCodeAt(0)===64&&t.length>1&&!t.startsWith("@media")&&!t.startsWith("@keyframes")&&!t.startsWith("@supports")&&(t==="@dark"||t==="@light"||!s.context?.designSystem?.media?.[t.slice(1)])}const Dt=new Set;function oo(t,s){const n=s?.__ref?.path?s.__ref.path.join("."):s?.key||"?",c=n+"::"+t;Dt.has(c)||(Dt.add(c),console.warn(`[smbls/css] "${t}" at ${n} is a CHILD-COMPONENT key nested inside a pseudo/selector block (":hover", "@dark", etc.) \u2014 that is never a valid CSS selector fragment. The rule is DROPPED (not shipped as a dead/never-matching selector). To reveal a child on a parent state, target the child's OWN class from the parent selector instead, e.g. move the declaration onto the child element itself, or use a sibling-selector combinator in a top-level style block.`))}function G(t,s,n){const c={},f=(o,i)=>{if(T[o]){const e=T[o](i,s,s.state,s.context);if(e){const r=Array.isArray(e)?e:[e];for(const a of r)a&&Object.assign(c,a)}}else c[o]=i};for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let i=t[o];if(typeof i=="function"&&(i=i(s,s.state,s.context)),!(i==null||typeof i=="function")){if(typeof i=="object"&&!Array.isArray(i)){if(o==="style"){for(const a in i){let d=i[a];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&f(a,d)}continue}if(pt(o,s)){const a=G(i,s,!0);Object.keys(a).length&&(c[`[data-theme="${o.slice(1)}"] &`]=a);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(o)){vt()&&oo(o,s);continue}let e=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const a=s.context?.designSystem?.media?.[o.slice(1)];a&&(e=`@media ${a}`)}const r=G(i,s,!1);Object.keys(r).length&&(c[e]=r);continue}f(o,i)}}if(n)for(const o in c){const i=c[o];typeof i=="string"&&!i.includes("!important")&&(c[o]=i+" !important")}return c}function so(t){const s=t.__ref;s.__conditionalRunners=[];const n=new Map;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const f=c.charAt(0);if(f!=="."&&f!=="!")continue;const o=c.slice(1);if(!o)continue;if(/[:@\s>~+[\]]/.test(o)){if(typeof console<"u"&&console.warn){const l=o.split(/[:@\s>~+[\]]/)[0];console.warn(`[smbls] conditional \`${c}\` on ${t.key||"?"} will never match \u2014 the whole string after \`${f}\` is read as one prop name. Nest the selector inside instead: \`${f}${l}: { '${o.slice(l.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const e=f==="!",r={lastMatch:!1,appliedKeys:null,appliedClasses:null},a=()=>{if(!t.node)return;let l;const p=t[o];if(p===void 0)if(t.state&&o in t.state)l=t.state[o];else{const u=t.context?.cases?.[o];if(u===void 0)return;try{l=typeof u=="function"?u.call(t,t):u}catch(h){l=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof p=="function")try{l=p(t,t.state,t.context)}catch(u){l=!1,s.__conditionalError=u,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${c}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,u?.message||u)}else l=p;const y=e?!l:!!l;if(y===r.lastMatch)return;r.lastMatch=y;const _=t.context?.designSystem;_&&E(_);try{if(y){const u={},h={};let g=!1;for(const x in i){if(!Object.prototype.hasOwnProperty.call(i,x))continue;const b=i[x],S=x.charAt(0);if((S===":"||S==="@"||S==="&")&&b&&typeof b=="object"&&!Array.isArray(b)){if(pt(x,t)){const O=G(b,t,!0);Object.keys(O).length&&(h[`[data-theme="${x.slice(1)}"] &`]=O,g=!0)}else{let O=x;if(S==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const D=t.context?.designSystem?.media?.[x.slice(1)];D&&(O=`@media ${D}`)}const W=G(b,t,!1);Object.keys(W).length&&(h[O]=W,g=!0)}continue}const N=typeof b=="function"?b(t,t.state,t.context):b;if(N!=null)if(T[x]){const O=T[x](N,t,t.state,t.context);if(O){const W=Array.isArray(O)?O:[O];for(const D of W)D&&Object.assign(u,D)}}else $&&$.has(x)&&(u[x]=N)}const C=Object.keys(u);if(C.length){z(t.node,u);for(const x of C)n.set(x,c);r.appliedKeys=C}else r.appliedKeys=null;if(g){const x=et(h,null,t.context?.cssPrefix),b=x?x.split(" ").filter(Boolean):[];if(b.length&&t.node.classList){for(const S of b)t.node.classList.add(S);r.appliedClasses=b}else r.appliedClasses=null}else if(r.appliedClasses){for(const x of r.appliedClasses)t.node.classList.remove(x);r.appliedClasses=null}}else{if(r.appliedKeys){for(const u of r.appliedKeys)n.get(u)===c&&(t.node.style[u]="",n.delete(u));r.appliedKeys=null}if(r.appliedClasses){for(const u of r.appliedClasses)t.node.classList.remove(u);r.appliedClasses=null}}}finally{_&&P()}};s.__conditionalRunners.push(a);const d=k(a,{depth:s.path.length});s.__effects.push(d)}}const lt=new WeakSet;function no(t){const s=t.ownerDocument;!s||lt.has(s)||(lt.add(s),queueMicrotask(()=>{lt.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const yt=new WeakSet;let Tt=!1;function co(t){const{node:s}=t;if(!s)return;if(Tt||(Tt=!0,et({display:"none"})),yt.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}yt.add(t);const n=t.context?.designSystem;n&&E(n);try{const c={};let f=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||U.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!H(o)){if(T[o]){const e=t[o],r=T[o](e,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(c,a);else Object.assign(c,r);f=!0}}else if($&&$.has(o)){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(c[o]=e,f=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const e=t[o];if(e&&typeof e=="object"){if(pt(o,t)){const r=G(e,t,!0);Object.keys(r).length&&(c[`[data-theme="${o.slice(1)}"] &`]=r,f=!0)}else{let r=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=t.context?.designSystem?.media?.[o.slice(1)];d&&(r=`@media ${d}`)}const a=G(e,t,!1);Object.keys(a).length&&(c[r]=a,f=!0)}f=!0}}}}if(f){c.display&&String(c.display).includes("!important")&&(s.style.setProperty("display",String(c.display).replace(/\s*!important\s*$/,""),"important"),delete c.display);const o=et(c,null,t.context?.cssPrefix);if(o&&s.classList){const e=o.split(" ").filter(Boolean);let r=!1;for(const a of e)s.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&no(s)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const e=c.display;if(e&&e!==i)if(i==="none"){const r=[];for(const a of s.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)s.classList.remove(a);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&P(),yt.delete(t)}}function Rt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const f in t.aria){const o=t.aria[f];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+f.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=Ht(t);for(const f in n){const o=n[f];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(f,o===!0?"":o)}const c=t.tag||"div";for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||typeof t[f]=="function"||U.has(f)||f==="on"||n[f]!==void 0)continue;const o=f.charCodeAt(0);if(!(o>=65&&o<=90)&&!H(f)&&!(T[f]||$&&$.has(f))&&ft(c,f)){let i=t[f];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=it(i,t,t.state,t.context),t[f]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;s.setAttribute(St(f)||f,i===!0?"":i)}}}function ro(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,c=n&&typeof n=="object"&&n.max?String(n.max):null;c&&(s.style.maxHeight=c);const f=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};f(),s.addEventListener("input",f),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",f)}catch{}})}const Nt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function Ft(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!H(n)||Nt.has(n))continue;let c=t[n];if(typeof c=="string"&&/^[A-Za-z_$][\w$]*$/.test(c)){const o=c;c=function(e){return t.call(o,e)}}if(typeof c!="function")continue;const f=Gt(n);Ut.has(f)||Vt(Zt(f),t,c)}io(t)}function io(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let c=!1;for(const p of Nt){const y=t[p];typeof y=="function"&&(n[p]=y,c=!0)}if(!c)return;const f=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,e=0,r=0,a=!1;const d=p=>{const y=p.touches&&p.touches[0]||p.changedTouches&&p.changedTouches[0];y&&(i=y.clientX,e=y.clientY,r=Date.now(),a=!0)},l=p=>{if(!a)return;a=!1;const y=p.changedTouches&&p.changedTouches[0]||p.touches&&p.touches[0];if(!y)return;const _=y.clientX-i,u=y.clientY-e,h=Date.now()-r;if(h>o)return;const g=Math.abs(_),C=Math.abs(u);if(Math.max(g,C)<f)return;let x;if(g>C*1.2)x=_<0?"left":"right";else if(C>g*1.2)x=u<0?"up":"down";else return;const b="onSwipe"+x.charAt(0).toUpperCase()+x.slice(1),S=n[b],N=n.onSwipe;S&&S.call(t,p,t,t.state,t.context),N&&N.call(t,{direction:x,dx:_,dy:u,dt:h,event:p},t,t.state,t.context)};s.addEventListener("touchstart",d,{passive:!0}),s.addEventListener("touchend",l,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",d)}catch{}try{s.removeEventListener("touchend",l)}catch{}})}function tt(t,s){const n={...t};for(const c in s){const f=n[c],o=s[c];f&&o&&typeof f=="object"&&typeof o=="object"&&!Array.isArray(f)&&!Array.isArray(o)&&typeof f!="function"&&typeof o!="function"?n[c]=tt(f,o):n[c]=o}return n}function ht(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const f=t.tag==="fragment",o=t.context?.document||globalThis.document,i=f?null:o?.createDocumentFragment();if(!f&&!i)return;const e=t.childProps,r=t.childrenAs;for(let a=0;a<s.length;a++){let d=s[a];const l=d;(typeof d=="string"||typeof d=="number")&&(d={text:d});let p=e;if(typeof e=="function")try{p=e(t,d)}catch{p=null}if(r==="state"){let u=l;(typeof l=="string"||typeof l=="number")&&(u={value:l,text:l}),d=p?{...p,state:u}:{state:u}}else p&&(d=tt(p,d));if(c&&!d.ignoreChildExtends)if(d.extends){const u=Array.isArray(d.extends)?d.extends:[d.extends],h=Array.isArray(c)?c:[c];d={...d,extends:[...h,...u]}}else d={...d,extends:c};const y=d?.key||l&&typeof l=="object"&&l.key||`${a}`;let _;try{_=Y(d,t,y,n)}catch(u){if(typeof console<"u"&&console.error){const h=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${y}" failed to construct at ${h} (initial render, skipping this row):`,u?.message||u)}continue}!f&&_?.node&&i.appendChild(_.node)}f||t.node.appendChild(i);return}if(typeof s=="string"){const f=Pt(s,t);if(Array.isArray(f)){ht(t,f,n);return}}if(typeof s=="object")for(const f in s){if(U.has(f))continue;let o=s[f];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=tt(t.childProps,o)),c&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],e=Array.isArray(c)?c:[c];o={...o,extends:[...e,...i]}}else o={...o,extends:c};Y(o,t,f,n)}}}function _t(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const f=t.__ref,o=f&&f.__exec&&f.__exec.value,i=typeof o=="function",e=t.value!=null&&typeof t.value!="function";if(i||e){let d;if(i)try{d=o(t,t.state,t.context)}catch{return}else d=t.value;const l=d==null?"":String(d);n.value!==l&&(n.value=l);return}const r=s||!(f&&f.__selectSynced);if(f&&(f.__selectSynced=!0),!r)return;let a=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(a=d);a>=0&&n.selectedIndex!==a&&(n.selectedIndex=a)}function Mt(t,s){let{children:n,content:c}=t;const f=t.childExtends;if(typeof n=="function"){const i=n;try{n=i(t,t.state,t.context)}catch(l){if(n=void 0,typeof console<"u"&&console.error){const p=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${p} (initial run, treating as empty):`,l?.message||l)}}t.children=n;const e=t.__ref;let r=!1;const a=j(t,t.childrenDeps,i),d=k(()=>{const l=r;r=!0;let p;try{p=a(t,t.state,t.context)}catch(b){if(typeof console<"u"&&console.error){const S=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] \`children:\` factory threw at ${S}${l?"":" (initial tracking run)"}:`,b?.message||b)}return}if(!l||p===t.children)return;t.children=p;const y=typeof t.onContentUpdate=="function",_=y?[]:null,u=y?[]:null,h=y?[]:null;if(Array.isArray(p)&&t.childrenAs==="state"){const b=t.childProps,S=[],N=new Map;for(let A=0;A<p.length;A++){const L=p[A];let v=b;if(typeof b=="function")try{v=b(t,L)}catch{v=null}const F=v&&v.key||L&&L.key||`${A}`;S.push(F),N.set(F,{rawChild:L,childProps:v})}const O=new Set(S),W=e.__children.slice();for(const A of W)if(!O.has(A)){const L=t[A];L?.remove&&L.remove(),delete t[A],u&&u.push(A)}const D=t.childExtends,J=t.tag==="fragment",It=t.context?.document||globalThis.document,Z=J?null:It?.createDocumentFragment(),ot=new Set;for(const A of S){const L=N.get(A),v=L.rawChild,F=t[A];if(F&&F.state){if(v&&typeof v=="object"){const w=F.state,B=w.$replace||w.replace,bt=w.$update||w.update;if(typeof B=="function")B.call(w,v);else if(typeof bt=="function"){for(const M in w)if(!(M==="__element"||M==="root"||M==="parent"||M==="update")&&!Object.prototype.hasOwnProperty.call(v,M))try{w[M]=void 0}catch{}bt.call(w,v)}else for(const M in v)w[M]=v[M]}h&&h.push(A);continue}let st=v;(typeof v=="string"||typeof v=="number")&&(st={value:v,text:v});const xt=L.childProps;let R=xt?{...xt,state:st}:{state:st};if(D&&!R.ignoreChildExtends)if(R.extends){const w=Array.isArray(R.extends)?R.extends:[R.extends],B=Array.isArray(D)?D:[D];R={...R,extends:[...B,...w]}}else R={...R,extends:D};let nt;try{nt=Y(R,t,A,s)}catch(w){if(typeof console<"u"&&console.error){const B=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${A}" failed to construct at ${B} (reconcile, skipping this row):`,w?.message||w)}ot.add(A);continue}!J&&nt?.node&&Z&&Z.appendChild(nt.node),_&&_.push(A)}if(!J&&Z&&Z.childNodes.length&&t.node&&t.node.appendChild(Z),!J&&t.node){let A=null;for(const L of S){const v=t[L]?.node;if(!v)continue;const F=A?A.nextSibling:t.node.firstChild;v!==F&&t.node.insertBefore(v,F),A=v}}e.__children=ot.size?S.filter(A=>!ot.has(A)):S,y&&(_.length||u.length)&&jt(t,{added:_,removed:u,kept:h}),_t(t,!1);return}const x=y?[...e.__children]:null;for(const b of[...e.__children]){const S=t[b];S?.remove&&S.remove(),delete t[b]}e.__children=[],ht(t,p,s),_t(t,!1),y&&jt(t,{added:[...e.__children],removed:x,kept:[]})},{depth:e.path.length});e.__effects.push(d)}if(ht(t,n||c,s),n||c)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let e=0;e<i.length;e++){const r=i[e];if(!r.endsWith("Extends")||typeof t[r]!="string")continue;const a=r.slice(0,-7);if(!a||a.charCodeAt(0)<65||a.charCodeAt(0)>90)continue;const d={extends:t[r]};delete t[r];for(let l=e+1;l<i.length;l++){const p=i[l],y=p.charCodeAt(0);if(y>=65&&y<=90||U.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const _=t[p];_!==void 0&&(d[p]=_,delete t[p])}t[a]&&typeof t[a]=="object"?t[a]={...d,...t[a]}:t[a]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||U.has(i)||typeof t[i]!="object"||t[i]===null)continue;const e=i.charCodeAt(0);if(e<65||e>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={...r,extends:a})}if(t.childProps&&(r=tt(t.childProps,r)),f&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],d=Array.isArray(f)?f:[f];r={...r,extends:[...d,...a]}}else r={...r,extends:f};Y(r,t,i,s)}}}function gt(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const f=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(f){const i=f.parentNode;if(i){if(n?.position==="before"&&n.node)i.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const e=n.node.nextSibling;i.insertBefore(c,e||f)}else i.insertBefore(c,f);return}}const o=s?.node||(s?.nodeType?s:null);if(o)if(n?.position==="before"&&n.node)o.insertBefore(c,n.node);else if(n?.position==="after"&&n.node){const i=n.node.nextSibling;i?o.insertBefore(c,i):o.appendChild(c)}else o.appendChild(c)}function I(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&V(c,s,n);const f="on"+t,o=s[f];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const e=s.context?.designSystem;e&&E(e);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&V("error",s,{hook:f,error:r})||console.error(`[DOMQL] Lifecycle "${f}" error:`,r),s.context?.strictMode)throw r}finally{e&&P(),i&&(s.__ref.__inRender=!1)}}return!0}var Po=Y;export{Y as create,Po as default,kt as flushMounts};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/element",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.682",
|
|
4
4
|
"description": "Core element creation, update, and disposal engine for smbls v3.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@symbo.ls/state": "^3.14.678",
|
|
26
26
|
"@symbo.ls/utils": "^3.14.599",
|
|
27
27
|
"css-in-props": "^3.14.612",
|
|
28
|
-
"attrs-in-props": "^3.14.
|
|
28
|
+
"attrs-in-props": "^3.14.682"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|