@symbo.ls/element 3.14.682 → 3.14.692
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 +16 -0
- package/dist/cjs/src/create.js +3 -3
- package/dist/cjs/src/update.js +1 -1
- package/dist/esm/src/create.js +4 -4
- package/dist/esm/src/update.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @symbo.ls/element
|
|
2
2
|
|
|
3
|
+
## 3.14.692
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Auto-generated cross-repo patch release.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- attrs-in-props@3.14.692
|
|
10
|
+
|
|
11
|
+
## 3.14.689
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Auto-generated cross-repo patch release.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- attrs-in-props@3.14.689
|
|
18
|
+
|
|
3
19
|
## 3.14.682
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
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 a of It(s))!Kt.call(t,a)&&a!==n&&it(t,a,{get:()=>s[a],enumerable:!(c=Mt(s,a))||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"),R=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"),L=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||K("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 Y(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function zt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Yt(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 a=n[c],o=s[c];a&&o&&typeof a=="object"&&typeof o=="object"&&!Array.isArray(a)&&!Array.isArray(o)&&typeof a!="function"&&typeof o!="function"?n[c]=X(a,o):n[c]=o}return n}function V(t,s,n,c={},a){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 f(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&&f(r),t.props&&typeof t.props=="object"&&f(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)),K("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}K("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),ft(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(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} }`,_)+`
|
|
4
|
+
`):"")}}if(yt(o,!0),ht(o,s,a),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(K("Create",o,c),K("Complete",o,c),K("Render",o,c),K("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,a=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&a&&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},f=t.context?.polyglot;if(f?.translations){const d=e.lang||f.defaultLang||"en",l=f.translations[d];if(l&&typeof l=="object")for(const y in l)r[y]===void 0&&(r[y]=l[y]);const p=new Set(f.languages||[]);for(const y in f.translations)!p.has(y)&&r[y]===void 0&&(r[y]=f.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 at(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const a of n){if(c==null)return{};c=c[a]}return c??{}}function St(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const a=t.slice(3);return a?at(s.state,a):s.state??{}}if(t.startsWith("~/")){const a=s.state?.root||s.state,o=t.slice(2);return o?at(a,o):a??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=at(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const a=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[a];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,a=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const e=o[i];if(typeof t[e]!="function"||R.REGISTRY.has(e))continue;const r=e.charCodeAt(0);r>=65&&r<=90||Y(e)||A.CSS_PROPS_REGISTRY[e]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(e)||(0,L.checkAttributeByTagName)(n,e)||a.push({prop:e,fn:t[e]})}for(let i=0;i<a.length;i++){const{prop:e,fn:r}=a[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(f){delete s.__exec[e],Object.defineProperty(t,e,{value:f,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"&&!R.REGISTRY.has(o)&&!Y(o)&&!n.__exec[o]){if(A.CSS_PROPS_REGISTRY[o]){const i=t[o],e=O(t,t[o+"Deps"],i),r=o;let f;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||_!==f)&&(f=_,G(t.node,y))}else t.node&&(r==="show"||r==="hide")&&(f=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 f;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!==f&&(f=y,G(t.node,{[r]:p}))}else f=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 f=i(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}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 f=r==null?"":String(r);if(t.node.value===f)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=f,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 f=i(t,t.state,t.context),d=jt(f);(d===null||d!==e)&&(e=d,G(t.node,f))},{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 f=(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(f)}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 f=i(t,t.state,t.context);t.node?.setAttribute&&(f==null||f===!1?t.node.removeAttribute(e):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(e,f===!0?"":f))}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,f=>"-"+f.toLowerCase()),r=(0,j.createEffect)(()=>{try{const f=i(t,t.state,t.context);if(!t.node?.setAttribute)return;f==null||f===!1?t.node.removeAttribute(e):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(e,f===!0?"":f)}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()),f=(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(f)}const a=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(a)for(const o in a){if(typeof a[o]!="function")continue;const i=O(t,J(t.classDeps,o),a[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)||R.REGISTRY.has(o)||typeof t[o]!="function")continue;const i=o.charCodeAt(0);if(i>=65&&i<=90||Y(o))continue;const e=t[o];n.__exec[o]=e;const r=t.tag||"div";if((0,L.checkAttributeByTagName)(r,o)&&!A.CSS_PROPS_REGISTRY[o]&&!(A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(o))){const f=(0,L.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(f):typeof p!="function"&&typeof p!="object"&&(f==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(f,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 f=(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(f)}}function wt(t,s,n){const c=O(t,t.ifDeps,n),a=(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 f=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){f=y.node;break}}f?r.insertBefore(t.node,f):r.appendChild(t.node)}else ht(t,t.parent);ft(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=(0,W.detectTag)(t)),K("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}K("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}),ft(t),Ot(t),Dt(t,{}),ht(t,t.parent),At(t,{})}},{depth:s.path.length});s.__effects.push(a)}function ft(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 a=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];a&&s.classList.add(typeof a=="string"?a: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 a=s[c];if(a!=null){if(c.charAt(0)==="&"&&typeof a=="object"){n||(n={}),n[c]=a;continue}try{const o=String(a),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),e=o.trim(),r=/\s*!important\s*$/.test(e),f=e.replace(/\s*!important\s*$/,"");t.style.setProperty(i,f,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 a=c.querySelector("style[data-smbls-scoped]");a||(a=c.createElement("style"),a.setAttribute("data-smbls-scoped",""),c.head.appendChild(a));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(", "),f=s[i];if(typeof f=="object"){let d="",l="";for(const p in f){const y=f[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
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;
|
|
6
|
+
`),l&&(o+=l)}}o&&(a.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 a=s[c];if(typeof a!="string"||a.length===0)continue;const o=a.split("."),i=o[0],e=o.slice(1),r={value:!1},f=(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];_&&_!==f&&!_._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,f._isSubscribeToEffect=!0,n.__effects.push(f)}}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={},a=(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 f of r)f&&Object.assign(c,f)}}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 f in i){let d=i[f];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&a(f,d)}continue}if(dt(o,s)){const f=Z(i,s,!0);Object.keys(f).length&&(c[`[data-theme="${o.slice(1)}"] &`]=f);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 f=s.context?.designSystem?.media?.[o.slice(1)];f&&(e=`@media ${f}`)}const r=Z(i,s,!1);Object.keys(r).length&&(c[e]=r);continue}a(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 a=c.charAt(0);if(a!=="."&&a!=="!")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 \`${a}\` is read as one prop name. Nest the selector inside instead: \`${a}${l}: { '${o.slice(l.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const e=a==="!",r={lastMatch:!1,appliedKeys:null,appliedClasses:null},f=()=>{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 $=Z(v,t,!0);Object.keys($).length&&(h[`[data-theme="${x.slice(1)}"] &`]=$,g=!0)}else{let $=x;if(w==="@"&&!x.startsWith("@media")&&!x.startsWith("@keyframes")){const T=t.context?.designSystem?.media?.[x.slice(1)];T&&($=`@media ${T}`)}const H=Z(v,t,!1);Object.keys(H).length&&(h[$]=H,g=!0)}continue}const F=typeof v=="function"?v(t,t.state,t.context):v;if(F!=null)if(A.CSS_PROPS_REGISTRY[x]){const $=A.CSS_PROPS_REGISTRY[x](F,t,t.state,t.context);if($){const H=Array.isArray($)?$:[$];for(const T of H)T&&Object.assign(u,T)}}else A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(x)&&(u[x]=F)}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(f);const d=(0,j.createEffect)(f,{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 a=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||R.REGISTRY.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!Y(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 f of r)f&&Object.assign(c,f);else Object.assign(c,r);a=!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,a=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,a=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(c[o]=e,a=!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,a=!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 f=Z(e,t,!1);Object.keys(f).length&&(c[r]=f,a=!0)}a=!0}}}}if(a){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 f of e)s.classList.add(f),r||(f.charCodeAt(0)===95&&f.charCodeAt(1)===99||f.charCodeAt(0)===95&&f.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 f of s.classList)f.startsWith("_d-")&&f!=="_d-none"&&r.push(f);for(const f of r)s.classList.remove(f);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 a in t.aria){const o=t.aria[a];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+a.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=(0,L.applyAttrTransforms)(t);for(const a in n){const o=n[a];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(a,o===!0?"":o)}const c=t.tag||"div";for(const a in t){if(!Object.prototype.hasOwnProperty.call(t,a)||typeof t[a]=="function"||R.REGISTRY.has(a)||a==="on"||n[a]!==void 0)continue;const o=a.charCodeAt(0);if(!(o>=65&&o<=90)&&!Y(a)&&!(A.CSS_PROPS_REGISTRY[a]||A.DEFAULT_CSS_PROPERTIES_LIST&&A.DEFAULT_CSS_PROPERTIES_LIST.has(a))&&(0,L.checkAttributeByTagName)(c,a)){let i=t[a];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=(0,st.replaceLiteralsWithObjectFields)(i,t,t.state,t.context),t[a]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!(0,L.isEnumeratedTrueFalseAttr)((0,L.camelToAttr)(a)||a))continue;const e=(0,L.camelToAttr)(a)||a;s.setAttribute(e,(0,L.serializeAttrValue)(e,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 a=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};a(),s.addEventListener("input",a),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",a)}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)||!Y(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 a=zt(n);R.LIFECYCLE_EVENTS.has(a)||(0,Tt.registerEvent)(Yt(a),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 a=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,e=0,r=0,f=!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(),f=!0)},l=p=>{if(!f)return;f=!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)<a)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],F=n.onSwipe;w&&w.call(t,p,t,t.state,t.context),F&&F.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 a=n[c],o=s[c];a&&o&&typeof a=="object"&&typeof o=="object"&&!Array.isArray(a)&&!Array.isArray(o)&&typeof a!="function"&&typeof o!="function"?n[c]=ot(a,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 a=t.tag==="fragment",o=t.context?.document||globalThis.document,i=a?null:o?.createDocumentFragment();if(!a&&!i)return;const e=t.childProps,r=t.childrenAs;for(let f=0;f<s.length;f++){let d=s[f];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||`${f}`;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}!a&&_?.node&&i.appendChild(_.node)}a||t.node.appendChild(i);return}if(typeof s=="string"){const a=St(s,t);if(Array.isArray(a)){lt(t,a,n);return}}if(typeof s=="object")for(const a in s){if(R.REGISTRY.has(a))continue;let o=s[a];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,a,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 a=t.__ref,o=a&&a.__exec&&a.__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||!(a&&a.__selectSynced);if(a&&(a.__selectSynced=!0),!r)return;let f=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(f=d);f>=0&&n.selectedIndex!==f&&(n.selectedIndex=f)}function Dt(t,s){let{children:n,content:c}=t;const a=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 f=O(t,t.childrenDeps,i),d=(0,j.createEffect)(()=>{const l=r;r=!0;let p;try{p=f(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=[],F=new Map;for(let C=0;C<p.length;C++){const D=p[C];let S=v;if(typeof v=="function")try{S=v(t,D)}catch{S=null}const M=S&&S.key||D&&D.key||`${C}`;w.push(M),F.set(M,{rawChild:D,childProps:S})}const $=new Set(w),H=e.__children.slice();for(const C of H)if(!$.has(C)){const D=t[C];D?.remove&&D.remove(),delete t[C],u&&u.push(C)}const T=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 D=F.get(C),S=D.rawChild,M=t[C];if(M&&M.state){if(S&&typeof S=="object"){const P=M.state,z=P.$replace||P.replace,bt=P.$update||P.update;if(typeof z=="function")z.call(P,S);else if(typeof bt=="function"){for(const I in P)if(!(I==="__element"||I==="root"||I==="parent"||I==="update")&&!Object.prototype.hasOwnProperty.call(S,I))try{P[I]=void 0}catch{}bt.call(P,S)}else for(const I in S)P[I]=S[I]}h&&h.push(C);continue}let ct=S;(typeof S=="string"||typeof S=="number")&&(ct={value:S,text:S});const xt=D.childProps;let N=xt?{...xt,state:ct}:{state:ct};if(T&&!N.ignoreChildExtends)if(N.extends){const P=Array.isArray(N.extends)?N.extends:[N.extends],z=Array.isArray(T)?T:[T];N={...N,extends:[...z,...P]}}else N={...N,extends:T};let rt;try{rt=V(N,t,C,s)}catch(P){if(typeof console<"u"&&console.error){const z=t.__ref?.path?.join(".")||t.key||"<root>";console.error(`[smbls] child "${C}" failed to construct at ${z} (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 D of w){const S=t[D]?.node;if(!S)continue;const M=C?C.nextSibling:t.node.firstChild;S!==M&&t.node.insertBefore(S,M),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 f=r.slice(0,-7);if(!f||f.charCodeAt(0)<65||f.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||R.REGISTRY.has(p)||typeof t[p]=="function"&&(p.startsWith("on")||p.startsWith(".")))break;const _=t[p];_!==void 0&&(d[p]=_,delete t[p])}t[f]&&typeof t[f]=="object"?t[f]={...d,...t[f]}:t[f]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||R.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 f=o[i]||o[`smbls.${i}`];f&&(r={...r,extends:f})}if(t.childProps&&(r=ot(t.childProps,r)),a&&!r.ignoreChildExtends)if(r.extends){const f=Array.isArray(r.extends)?r.extends:[r.extends],d=Array.isArray(a)?a:[a];r={...r,extends:[...d,...f]}}else r={...r,extends:a};V(r,t,i,s)}}}function ht(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const a=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(a){const i=a.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||a)}else i.insertBefore(c,a);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 K(t,s,n){const c=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,U.runPluginHook)(c,s,n);const a="on"+t,o=s[a];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:a,error:r})||console.error(`[DOMQL] Lifecycle "${a}" error:`,r),s.context?.strictMode)throw r}finally{e&&(0,b.popConfig)(),i&&(s.__ref.__inRender=!1)}}return!0}var ro=V;
|
package/dist/cjs/src/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var A=(e,i)=>{for(var t in i)d(e,t,{get:i[t],enumerable:!0})},p=(e,i,t,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of g(i))!j.call(e,c)&&c!==t&&d(e,c,{get:()=>i[c],enumerable:!(f=b(i,c))||f.enumerable});return e};var v=e=>p(d({},"__esModule",{value:!0}),e);var k={};A(k,{default:()=>P,update:()=>a});module.exports=v(k);var r=require("@symbo.ls/signal"),u=require("./registry.js"),_=require("./create.js"),y=require("@symbo.ls/utils/function.js"),x=require("attrs-in-props");function a(e={},i={}){const t=this,f=t.__ref;if(!f)return;if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!i.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,i)===!1)return t;const c=!e||Object.keys(e).length===0;if((0,r.batch)(()=>{if(e.state&&(0,r.isStore)(t.state)&&t.state.$update(e.state),e.text!==void 0&&(t.text=e.text,!f.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!f.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!f.__exec.style)for(const n in e.style){const o=e.style[n];if(o==null)continue;const s=n.replace(/[A-Z]/g,h=>"-"+h.toLowerCase()),l=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,l,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const o=e.attr[n];o==null||o===!1?t.node.removeAttribute(n):typeof o!="function"&&typeof o!="object"&&t.node.setAttribute(n,(0,x.serializeAttrValue)(n,o))}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(u.REGISTRY.has(n)||n==="state")continue;const o=e[n],s=t[n];if(s&&s.__ref&&typeof s.update=="function")s.update(o,i);else if(typeof o=="object"&&o!==null){const l=n.charCodeAt(0);l>=65&&l<=90&&(0,_.create)(o,t,n,i)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=o)}}),t.node&&c&&f.__effects&&f.__effects.length)for(let n=0;n<f.__effects.length;n++){const o=f.__effects[n];o&&!o._disposed&&!o._isSubscribeToEffect&&typeof o._execute=="function"&&o._execute()}else if(t.node&&f.__conditionalRunners)for(const n of f.__conditionalRunners)n();return(0,y.runPluginHook)("update",t),!i.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,i),t}var P=a;
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
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 vt}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 Ct}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 St}from"@symbo.ls/css";import{pushConfig as E,popConfig as P}from"@symbo.ls/scratch";import{checkAttributeByTagName as at,applyAttrTransforms as Ht,camelToAttr as ft,serializeAttrValue as zt,isEnumeratedTrueFalseAttr as Yt}from"attrs-in-props";let Gt=1;const m=[];let dt=!1;function Zt(){dt||(dt=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(kt):setTimeout(kt,0))}function kt(){if(dt=!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 qt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function Qt(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 a=n[c],o=s[c];a&&o&&typeof a=="object"&&typeof o=="object"&&!Array.isArray(a)&&!Array.isArray(o)&&typeof a!="function"&&typeof o!="function"?n[c]=Q(a,o):n[c]=o}return n}function z(t,s,n,c={},a){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||`_${Gt++}`,o.parent=s||null,o.context=t.context||s?.context||c.context||{},o.context.__create||(o.context.__create=z);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&&Ct()&&/^[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 f(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&&f(r),t.props&&typeof t.props=="object"&&f(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),Xt(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=vt(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),pt(o),Rt(o),eo(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(_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+=
|
|
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};
|
|
4
|
+
`):"")}}if(gt(o,!0),xt(o,s,a),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 Xt(t,s,n){const c=!s,a=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=c&&a&&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},f=t.context?.polyglot;if(f?.translations){const d=e.lang||f.defaultLang||"en",l=f.translations[d];if(l&&typeof l=="object")for(const y in l)r[y]===void 0&&(r[y]=l[y]);const p=new Set(f.languages||[]);for(const y in f.translations)!p.has(y)&&r[y]===void 0&&(r[y]=f.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 ut(t,s){if(!s)return t;const n=s.split("/");let c=t;for(const a of n){if(c==null)return{};c=c[a]}return c??{}}function Pt(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const a=t.slice(3);return a?ut(s.state,a):s.state??{}}if(t.startsWith("~/")){const a=s.state?.root||s.state,o=t.slice(2);return o?ut(a,o):a??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=ut(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const c=s.context?.polyglot;if(c?.translations){const a=s.state?.root?.lang||c.defaultLang||"en",o=c.translations[a];if(o?.[t]!==void 0)return o[t];if(c.translations[t]!==void 0)return c.translations[t]}return{}}function Jt(t){const s=t.__ref,n=t.tag||"div",c=t.context?.designSystem,a=[],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)||at(n,e)||a.push({prop:e,fn:t[e]})}for(let i=0;i<a.length;i++){const{prop:e,fn:r}=a[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(f){delete s.__exec[e],Object.defineProperty(t,e,{value:f,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function mt(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 mt(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(Jt(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 f;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||_!==f)&&(f=_,Y(t.node,y))}else t.node&&(r==="show"||r==="hide")&&(f=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 f;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!==f&&(f=y,Y(t.node,{[r]:p}))}else f=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 f=i(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}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 f=r==null?"":String(r);if(t.node.value===f)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=f,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 f=i(t,t.state,t.context),d=$t(f);(d===null||d!==e)&&(e=d,Y(t.node,f))},{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 f=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(f)}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 f=i(t,t.state,t.context);t.node?.setAttribute&&(f==null||f===!1?t.node.removeAttribute(e):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(e,f===!0?"":f))}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,f=>"-"+f.toLowerCase()),r=k(()=>{try{const f=i(t,t.state,t.context);if(!t.node?.setAttribute)return;f==null||f===!1?t.node.removeAttribute(e):typeof f!="function"&&typeof f!="object"&&t.node.setAttribute(e,f===!0?"":f)}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()),f=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(f)}const a=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(a)for(const o in a){if(typeof a[o]!="function")continue;const i=j(t,X(t.classDeps,o),a[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(at(r,o)&&!T[o]&&!($&&$.has(o))){const f=ft(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(f):typeof p!="function"&&typeof p!="object"&&(f==="src"&&"src"in t.node?t.node.src=p:t.node.setAttribute(f,p===!0?"":p)))}catch{}},{depth:n.path.length});n.__effects.push(l)}}if(so(t),co(t),typeof t.onStateUpdate=="function"&&Array.isArray(t.stateDeps)){const o=t.onStateUpdate,i=t.stateDeps;let e=!1,r=[];const f=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(f)}}function Lt(t,s,n){const c=j(t,t.ifDeps,n),a=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 f=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){f=y.node;break}}f?r.insertBefore(t.node,f):r.appendChild(t.node)}else xt(t,t.parent);pt(t)}else{if(s.__ifInitialized=!0,t.tag||(t.tag=vt(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}),pt(t),Rt(t),Mt(t,{}),xt(t,t.parent),wt(t,{})}},{depth:s.path.length});s.__effects.push(a)}function pt(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),io(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 a=typeof n[c]=="function"?n[c](t,t.state,t.context):n[c];a&&s.classList.add(typeof a=="string"?a:c)}}}}function $t(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 a=s[c];if(a!=null){if(c.charAt(0)==="&"&&typeof a=="object"){n||(n={}),n[c]=a;continue}try{const o=String(a),i=c.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),e=o.trim(),r=/\s*!important\s*$/.test(e),f=e.replace(/\s*!important\s*$/,"");t.style.setProperty(i,f,r?"important":"")}catch{}}}n&&oo(t,n)}let to=0;function oo(t,s){const n=`_ds${to++}`;t.classList.add(n);const c=t.ownerDocument;let a=c.querySelector("style[data-smbls-scoped]");a||(a=c.createElement("style"),a.setAttribute("data-smbls-scoped",""),c.head.appendChild(a));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(", "),f=s[i];if(typeof f=="object"){let d="",l="";for(const p in f){const y=f[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+=St(`${_} { ${u} }`,_)+`
|
|
5
|
+
`}else d+=`${p.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${y};`}d&&(o+=St(`${r} { ${d} }`,r)+`
|
|
6
|
+
`),l&&(o+=l)}}o&&(a.textContent+=o)}function so(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 a=s[c];if(typeof a!="string"||a.length===0)continue;const o=a.split("."),i=o[0],e=o.slice(1),r={value:!1},f=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];_&&_!==f&&!_._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,f._isSubscribeToEffect=!0,n.__effects.push(f)}}function lt(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 no(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={},a=(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 f of r)f&&Object.assign(c,f)}}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 f in i){let d=i[f];typeof d=="function"&&(d=d(s,s.state,s.context)),!(d==null||typeof d=="function")&&a(f,d)}continue}if(lt(o,s)){const f=G(i,s,!0);Object.keys(f).length&&(c[`[data-theme="${o.slice(1)}"] &`]=f);continue}if(/^[A-Z][A-Za-z0-9]*$/.test(o)){Ct()&&no(o,s);continue}let e=o;if(o.charCodeAt(0)===64&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const f=s.context?.designSystem?.media?.[o.slice(1)];f&&(e=`@media ${f}`)}const r=G(i,s,!1);Object.keys(r).length&&(c[e]=r);continue}a(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 co(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 a=c.charAt(0);if(a!=="."&&a!=="!")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 \`${a}\` is read as one prop name. Nest the selector inside instead: \`${a}${l}: { '${o.slice(l.length)}': {...} }\`.`)}continue}const i=t[c];if(!i||typeof i!="object")continue;const e=a==="!",r={lastMatch:!1,appliedKeys:null,appliedClasses:null},f=()=>{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(lt(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){Y(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(f);const d=k(f,{depth:s.path.length});s.__effects.push(d)}}const yt=new WeakSet;function ro(t){const s=t.ownerDocument;!s||yt.has(s)||(yt.add(s),queueMicrotask(()=>{yt.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const ht=new WeakSet;let Tt=!1;function io(t){const{node:s}=t;if(!s)return;if(Tt||(Tt=!0,et({display:"none"})),ht.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}ht.add(t);const n=t.context?.designSystem;n&&E(n);try{const c={};let a=!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 f of r)f&&Object.assign(c,f);else Object.assign(c,r);a=!0}}else if($&&$.has(o)){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,a=!0)}else if(o.charCodeAt(0)===45){const e=t[o];e!=null&&typeof e!="object"&&(c[o]=e,a=!0)}else if(o.charAt(0)==="&"){const e=t[o];e&&typeof e=="object"&&(c[o]=e,a=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const e=t[o];if(e&&typeof e=="object"){if(lt(o,t)){const r=G(e,t,!0);Object.keys(r).length&&(c[`[data-theme="${o.slice(1)}"] &`]=r,a=!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 f=G(e,t,!1);Object.keys(f).length&&(c[r]=f,a=!0)}a=!0}}}}if(a){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 f of e)s.classList.add(f),r||(f.charCodeAt(0)===95&&f.charCodeAt(1)===99||f.charCodeAt(0)===95&&f.indexOf("_c",1)!==-1)&&(r=!0);r&&ro(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 f of s.classList)f.startsWith("_d-")&&f!=="_d-none"&&r.push(f);for(const f of r)s.classList.remove(f);s.classList.add("_d-none")}else s.style.display=t.display}}}finally{n&&P(),ht.delete(t)}}function Rt(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const a in t.aria){const o=t.aria[a];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+a.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());s.setAttribute(i,o===!0?"":o)}const n=Ht(t);for(const a in n){const o=n[a];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(a,o===!0?"":o)}const c=t.tag||"div";for(const a in t){if(!Object.prototype.hasOwnProperty.call(t,a)||typeof t[a]=="function"||U.has(a)||a==="on"||n[a]!==void 0)continue;const o=a.charCodeAt(0);if(!(o>=65&&o<=90)&&!H(a)&&!(T[a]||$&&$.has(a))&&at(c,a)){let i=t[a];if(i==null||(typeof i=="string"&&i.includes("{{")&&(i=it(i,t,t.state,t.context),t[a]=i),i==null||typeof i=="function"||typeof i=="object")||i===!1&&!Yt(ft(a)||a))continue;const e=ft(a)||a;s.setAttribute(e,zt(e,i))}}}function eo(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 a=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};a(),s.addEventListener("input",a),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",a)}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 a=qt(n);Ut.has(a)||Vt(Qt(a),t,c)}ao(t)}function ao(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 a=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,e=0,r=0,f=!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(),f=!0)},l=p=>{if(!f)return;f=!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)<a)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 a=n[c],o=s[c];a&&o&&typeof a=="object"&&typeof o=="object"&&!Array.isArray(a)&&!Array.isArray(o)&&typeof a!="function"&&typeof o!="function"?n[c]=tt(a,o):n[c]=o}return n}function _t(t,s,n){if(!s||!t.node)return;const c=t.childExtends;if(Array.isArray(s)){const a=t.tag==="fragment",o=t.context?.document||globalThis.document,i=a?null:o?.createDocumentFragment();if(!a&&!i)return;const e=t.childProps,r=t.childrenAs;for(let f=0;f<s.length;f++){let d=s[f];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||`${f}`;let _;try{_=z(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}!a&&_?.node&&i.appendChild(_.node)}a||t.node.appendChild(i);return}if(typeof s=="string"){const a=Pt(s,t);if(Array.isArray(a)){_t(t,a,n);return}}if(typeof s=="object")for(const a in s){if(U.has(a))continue;let o=s[a];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};z(o,t,a,n)}}}function gt(t,s){const n=t.node;if(!n||n.tagName!=="SELECT")return;const c=n.options;if(!c||!c.length)return;const a=t.__ref,o=a&&a.__exec&&a.__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||!(a&&a.__selectSynced);if(a&&(a.__selectSynced=!0),!r)return;let f=-1;for(let d=0;d<c.length;d++)c[d].defaultSelected&&(f=d);f>=0&&n.selectedIndex!==f&&(n.selectedIndex=f)}function Mt(t,s){let{children:n,content:c}=t;const a=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 f=j(t,t.childrenDeps,i),d=k(()=>{const l=r;r=!0;let p;try{p=f(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,At=w.$update||w.update;if(typeof B=="function")B.call(w,v);else if(typeof At=="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{}At.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 bt=L.childProps;let R=bt?{...bt,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=z(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}),gt(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=[],_t(t,p,s),gt(t,!1),y&&jt(t,{added:[...e.__children],removed:x,kept:[]})},{depth:e.path.length});e.__effects.push(d)}if(_t(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 f=r.slice(0,-7);if(!f||f.charCodeAt(0)<65||f.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[f]&&typeof t[f]=="object"?t[f]={...d,...t[f]}:t[f]=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 f=o[i]||o[`smbls.${i}`];f&&(r={...r,extends:f})}if(t.childProps&&(r=tt(t.childProps,r)),a&&!r.ignoreChildExtends)if(r.extends){const f=Array.isArray(r.extends)?r.extends:[r.extends],d=Array.isArray(a)?a:[a];r={...r,extends:[...d,...f]}}else r={...r,extends:a};z(r,t,i,s)}}}function xt(t,s,n){const{node:c}=t;if(!c)return;c.ref=t;const a=s?.tag==="fragment"?s.__ref?.__fragmentAnchor:null;if(a){const i=a.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||a)}else i.insertBefore(c,a);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 a="on"+t,o=s[a];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:a,error:r})||console.error(`[DOMQL] Lifecycle "${a}" error:`,r),s.context?.strictMode)throw r}finally{e&&P(),i&&(s.__ref.__inRender=!1)}}return!0}var Lo=z;export{z as create,Lo as default,kt as flushMounts};
|
package/dist/esm/src/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{batch as
|
|
1
|
+
import{batch as d,isStore as u}from"@symbo.ls/signal";import{REGISTRY as _}from"./registry.js";import{create as y}from"./create.js";import{runPluginHook as x}from"@symbo.ls/utils/function.js";import{serializeAttrValue as a}from"attrs-in-props";function h(n={},f={}){const t=this,i=t.__ref;if(!i)return;if((typeof n=="string"||typeof n=="number")&&(n={text:n}),!f.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,f)===!1)return t;const l=!n||Object.keys(n).length===0;if(d(()=>{if(n.state&&u(t.state)&&t.state.$update(n.state),n.text!==void 0&&(t.text=n.text,!i.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=n.text??"":t.node.textContent=n.text??"")),n.html!==void 0&&(t.html=n.html,!i.__exec.html&&t.node&&(t.node.innerHTML=n.html)),n.style&&t.node?.style){if(!i.__exec.style)for(const e in n.style){const o=n.style[e];if(o==null)continue;const c=e.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),s=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(c,s,"important")}t.style||(t.style={}),Object.assign(t.style,n.style)}if(n.attr&&t.node?.setAttribute){for(const e in n.attr){const o=n.attr[e];o==null||o===!1?t.node.removeAttribute(e):typeof o!="function"&&typeof o!="object"&&t.node.setAttribute(e,a(e,o))}t.attr||(t.attr={}),Object.assign(t.attr,n.attr)}if(n.data&&t.node?.dataset){for(const e in n.data)t.node.dataset[e]=n.data[e];t.data||(t.data={}),Object.assign(t.data,n.data)}for(const e in n){if(_.has(e)||e==="state")continue;const o=n[e],c=t[e];if(c&&c.__ref&&typeof c.update=="function")c.update(o,f);else if(typeof o=="object"&&o!==null){const s=e.charCodeAt(0);s>=65&&s<=90&&y(o,t,e,f)}else e!=="text"&&e!=="html"&&e!=="style"&&e!=="attr"&&e!=="data"&&(t[e]=o)}}),t.node&&l&&i.__effects&&i.__effects.length)for(let e=0;e<i.__effects.length;e++){const o=i.__effects[e];o&&!o._disposed&&!o._isSubscribeToEffect&&typeof o._execute=="function"&&o._execute()}else if(t.node&&i.__conditionalRunners)for(const e of i.__conditionalRunners)e();return x("update",t),!f.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,f),t}var v=h;export{v as default,h as update};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/element",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.692",
|
|
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.692"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|