@symbo.ls/element 3.14.340 → 3.14.342
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 +6 -0
- package/dist/cjs/src/create.js +3 -3
- package/dist/esm/src/create.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Y=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var lt=(t,s)=>{for(var n in s)Y(t,n,{get:s[n],enumerable:!0})},ht=(t,s,n,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of pt(s))!yt.call(t,c)&&c!==n&&Y(t,c,{get:()=>s[c],enumerable:!(i=dt(s,c))||i.enumerable});return t};var _t=t=>ht(Y({},"__esModule",{value:!0}),t);var $t={};lt($t,{create:()=>T,default:()=>Lt});module.exports=_t($t);var
|
|
1
|
+
"use strict";var Y=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var lt=(t,s)=>{for(var n in s)Y(t,n,{get:s[n],enumerable:!0})},ht=(t,s,n,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of pt(s))!yt.call(t,c)&&c!==n&&Y(t,c,{get:()=>s[c],enumerable:!(i=dt(s,c))||i.enumerable});return t};var _t=t=>ht(Y({},"__esModule",{value:!0}),t);var $t={};lt($t,{create:()=>T,default:()=>Lt});module.exports=_t($t);var S=require("@symbo.ls/signal"),j=require("@symbo.ls/signal"),N=require("./cache.js"),P=require("./registry.js"),et=require("./delegate.js"),ft=require("./extends.js"),at=require("./methods.js"),Dt=require("./dispose.js"),V=require("@symbo.ls/utils"),W=require("@symbo.ls/utils/function.js"),F=require("@symbo.ls/state"),x=require("css-in-props"),ut=require("@symbo.ls/css"),A=require("@symbo.ls/scratch"),I=require("attrs-in-props");let gt=1;function M(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function bt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function xt(t){return t.toLowerCase()}function G(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=G(c,o):n[i]=o}return n}function T(t,s,n,i={},c){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||i.context||{},o.context.__create||(o.context.__create=T);const e=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 h=n.indexOf("_");if(h>0){const l=n.substring(0,h),g=o.context?.components;g&&(g[l]||g["smbls."+l])&&(t={extends:l,...t})}}(0,ft.applyExtends)(o,t,i);const f=new Set(["childProps","attr","style","scope","data"]),r=o.props&&typeof o.props=="object"?o.props:null;for(const h in t){if(h==="parent"||h==="node"||h==="__ref"||h==="extends"||h==="context"||h==="props")continue;const l=t[h],g=o[h],b=g&&l&&typeof g=="object"&&typeof l=="object"&&!Array.isArray(g)&&!Array.isArray(l)&&typeof g!="function"&&typeof l!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=G(g,l):b&&f.has(h)?o[h]={...g,...l}:o[h]=l}function a(h){for(const l in h){const g=h[l],b=o[l],w=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";w&&l.charCodeAt(0)>=65&&l.charCodeAt(0)<=90?o[l]=G(b,g):w&&f.has(l)?o[l]={...b,...g}:o[l]=g}}r&&a(r),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,y=s?.scope,d=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,p=y||d||null;if(t.scope!==void 0||u){const h={};u&&Object.assign(h,u),t.scope!==void 0&&Object.assign(h,t.scope),o.scope=(0,S.createScopeStore)(h,p)}else p&&(o.scope=p);if(t.if!==void 0&&(o.if=t.if),(0,at.addMethods)(o),At(o,s,t),o.if!=null){let h;if(typeof o.if=="function")try{h=o.if(o,o.state,o.context)}catch(l){if(h=!1,e.__ifError=l,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,l?.message||l)}}else h=o.if;e.__if=!!h}if(e.__if)typeof t.if=="function"&&(e.__ifInitialized=!0);else return s&&(s[o.key]=o),typeof t.if=="function"&&Z(o,{if:t.if}),o;o.tag||(o.tag=(0,N.detectTag)(o)),R("Init",o,i);const _=o.node=(0,N.cacheNode)(o);if(!_)return o;R("AttachNode",o,i),_.setAttribute&&o.key&&_.setAttribute("data-key",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),rt(o,i),Z(o,t),z(o),ct(o),Pt(o);try{it(o,i)}catch(h){if(typeof console<"u"&&console.error){const l=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${l}:`,h?.message||h,h?.stack?`
|
|
2
2
|
`+h.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(J(o,s,c),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&(0,A.pushConfig)(h);try{const l=o.html(o,o.state,o.context);l!=null&&typeof l!="function"&&(o.node.innerHTML=l)}catch{}finally{h&&(0,A.popConfig)()}}if(R("Create",o,i),R("Complete",o,i),R("Render",o,i),R("RenderRouter",o,i),typeof o.onFrame=="function"){const h=o.onFrame,l=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){l&&(0,A.pushConfig)(l);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{l&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function At(t,s,n){const i=!s,c=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=i&&c&&t.context?.state,e=n.state!==void 0&&!o?n.state:t.state&&!(0,k.isStore)(t.state)?t.state:void 0;if(e==null){if(s?.state)t.state=s.state,(0,F.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,r={...f},a=t.context?.polyglot;if(a?.translations){const u=f.lang||a.defaultLang||"en",y=a.translations[u];if(y&&typeof y=="object")for(const p in y)r[p]===void 0&&(r[p]=y[p]);const d=new Set(a.languages||[]);for(const p in a.translations)!d.has(p)&&r[p]===void 0&&(r[p]=a.translations[p])}t.state=(0,k.isStore)(r)?r:(0,k.createStore)(r),t.state.__element=t,t.state.root=t.state,(0,F.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,F.applyStateMethods)(t,t.state);return}if(typeof e=="string"){if(t.state=ot(e,s),t.state&&typeof t.state=="object"&&!(0,k.isStore)(t.state)){const f=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,F.applyStateMethods)(t,t.state);return}if(typeof e=="function"){const f=e(t,s?.state);t.state=(0,k.isStore)(f)?f:(0,k.createStore)(f||{})}else(0,k.isStore)(e)?t.state=e:t.state=(0,k.createStore)({...e});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,F.applyStateMethods)(t,t.state)}function U(t,s){if(!s)return t;const n=s.split("/");let i=t;for(const c of n){if(i==null)return{};i=i[c]}return i??{}}function ot(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const c=t.slice(3);return c?U(s.state,c):s.state??{}}if(t.startsWith("~/")){const c=s.state?.root||s.state,o=t.slice(2);return o?U(c,o):c??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=U(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const i=s.context?.polyglot;if(i?.translations){const c=s.state?.root?.lang||i.defaultLang||"en",o=i.translations[c];if(o?.[t]!==void 0)return o[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}function vt(t){const s=t.__ref,n=t.tag||"div",i=t.context?.designSystem,c=[],o=Object.keys(t);for(let e=0;e<o.length;e++){const f=o[e];if(typeof t[f]!="function"||P.REGISTRY.has(f))continue;const r=f.charCodeAt(0);r>=65&&r<=90||M(f)||x.CSS_PROPS_REGISTRY[f]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,I.checkAttributeByTagName)(n,f)||c.push({prop:f,fn:t[f]})}for(let e=0;e<c.length;e++){const{prop:f,fn:r}=c[e];s.__exec[f]=r,Object.defineProperty(t,f,{get(){i&&(0,A.pushConfig)(i);try{return r(t,t.state,t.context)}catch{return}finally{i&&(0,A.popConfig)()}},set(a){delete s.__exec[f],Object.defineProperty(t,f,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Z(t,s){const n=t.__ref;if(vt(t),typeof t.text=="function"){const c=t.text,o=(0,j.createEffect)(()=>{if(!n.contentManaged)try{let e=c(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&typeof e!="object"&&(typeof e=="string"&&e.includes("{{")&&(e=V.replaceLiteralsWithObjectFields.call(t,e,t.state)),t.tag==="string"?t.node.nodeValue=e:t.node.textContent=e)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}else if(typeof t.text=="string"&&t.text.includes("{{")){const c=t.text,o=(0,j.createEffect)(()=>{if(n.contentManaged)return;const e=V.replaceLiteralsWithObjectFields.call(t,c,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(o),n.__exec.text=c}for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&typeof t[c]=="function"&&!P.REGISTRY.has(c)&&!M(c)&&!n.__exec[c]){if(x.CSS_PROPS_REGISTRY[c]){const o=t[c],e=c;let f;const r=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context),y=x.CSS_PROPS_REGISTRY[e](u,t,t.state,t.context);if(y&&t.node){const d=st(y);(d===null||d!==f)&&(f=d,K(t.node,y))}else t.node&&(e==="show"||e==="hide")&&(f=void 0,t.node.style.display="")}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec[c]=o}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c)){const o=t[c],e=c;let f;const r=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const y=e+":"+String(u);y!==f&&(f=y,K(t.node,{[e]:u}))}else f=void 0,t.node.style[e]=""}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec[c]=o}}if(typeof s.html=="function"){const c=s.html,o=(0,j.createEffect)(()=>{const e=t.context?.designSystem;e&&(0,A.pushConfig)(e);try{const f=c(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{e&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=c}if(typeof s.value=="function"){const c=s.value,o=(0,j.createEffect)(()=>{try{const e=c(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=e==null?"":String(e);if(t.node.value===f)return;const r=typeof document<"u"&&document.activeElement===t.node,a=r&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=r&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,r&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=c}if(typeof s.style=="function"){const c=s.style;let o;const e=(0,j.createEffect)(()=>{const f=c(t,t.state,t.context),r=st(f);(r===null||r!==o)&&(o=r,K(t.node,f))},{depth:n.path.length});n.__effects.push(e),n.__exec.style=c}else if(t.style&&typeof t.style=="object")for(const c in t.style){const o=t.style[c];if(typeof o!="function")continue;let e;const f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);if(t.node){const a=c+":"+String(r);a!==e&&(e=a,K(t.node,{[c]:r}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const c in t.attr)if(typeof t.attr[c]=="function"){const o=t.attr[c],e=c,f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);t.node?.setAttribute&&(r==null||r===!1?t.node.removeAttribute(e):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(e,r===!0?"":r))}catch{}},{depth:n.path.length});n.__effects.push(f)}}if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o!="function")continue;const e="aria-"+c.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);if(!t.node?.setAttribute)return;r==null||r===!1?t.node.removeAttribute(e):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(e,r===!0?"":r)}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.data&&typeof t.data=="object")for(const c in t.data){const o=t.data[c];if(typeof o!="function")continue;const f="data-"+c.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(f):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(f,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}const i=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(i)for(const c in i){const o=i[c];if(typeof o!="function")continue;const e=(0,j.createEffect)(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.classList)return;typeof f=="string"?t.node.classList.add(f):f?t.node.classList.add(c):t.node.classList.remove(c)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(typeof s.if=="function"){const c=s.if,o=(0,j.createEffect)(()=>{let e;try{e=c(t,t.state,t.context)}catch(r){if(e=!1,n.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const f=n.__if;if(n.__if=!!e,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=(0,N.cacheNode)(t)),t.node&&(t.node.ref=t);const r=t.parent,a=r?.node;if(a&&t.node){let u=null;const y=Object.keys(r),d=y.indexOf(t.key);for(let p=d+1;p<y.length;p++){const _=r[y[p]];if(_?.node?.parentNode===a){u=_.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else J(t,t.parent);z(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=(0,N.detectTag)(t)),R("Init",t,{}),t.node||(t.node=(0,N.cacheNode)(t)),!t.node)return;R("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),rt(t,{});const r=s.if;delete s.if;try{Z(t,s)}finally{s.if=r}z(t),ct(t),it(t,{}),J(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||P.REGISTRY.has(c)||typeof t[c]!="function")continue;const o=c.charCodeAt(0);if(o>=65&&o<=90||M(c))continue;const e=t[c];n.__exec[c]=e;const f=t.tag||"div";if((0,I.checkAttributeByTagName)(f,c)&&!x.CSS_PROPS_REGISTRY[c]&&!(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))){const r=c,a=(0,j.createEffect)(()=>{try{const u=e(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(r):typeof u!="function"&&typeof u!="object"&&(r==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(r,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}kt(t),Ct(t)}function z(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),Et(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"&&K(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const i=t.attr[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.setAttribute&&s.setAttribute(n,i===!0?"":i)}if(t.data&&typeof t.data=="object")for(const n in t.data){const i=t.data[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.dataset&&(s.dataset[n]=i===!0?"":i)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(i=>i&&s.classList.add(i));else if(typeof n=="object")for(const i in n){const c=typeof n[i]=="function"?n[i](t,t.state,t.context):n[i];c&&s.classList.add(typeof c=="string"?c:i)}}}}function st(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function K(t,s){if(!t||!s||!t.style)return;let n=null;for(const i in s){const c=s[i];if(c!=null){if(i.charAt(0)==="&"&&typeof c=="object"){n||(n={}),n[i]=c;continue}try{const o=String(c),e=i.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),f=o.trim(),r=/\s*!important\s*$/.test(f),a=f.replace(/\s*!important\s*$/,"");t.style.setProperty(e,a,r?"important":"")}catch{}}}n&&St(t,n)}let jt=0;function St(t,s){const n=`_ds${jt++}`;t.classList.add(n);const i=t.ownerDocument;let c=i.querySelector("style[data-smbls-scoped]");c||(c=i.createElement("style"),c.setAttribute("data-smbls-scoped",""),i.head.appendChild(c));let o="";for(const e in s){const f="."+n,r=e.replace(/&/g,f).split(",").map(u=>{const y=u.trim();return y.includes(f)?y:f+y}).join(", "),a=s[e];if(typeof a=="object"){let u="",y="";for(const d in a){const p=a[d];if(typeof p=="object"){const _=d.includes("&")?r.split(", ").map(l=>d.replace(/&/g,l)).join(", "):r.split(", ").map(l=>`${l} ${d}`).join(", ");let h="";for(const l in p)h+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${p[l]};`;y+=`${_} { ${h} }
|
|
4
|
+
`):"")}}if(J(o,s,c),s&&(s[o.key]=o,s.__ref?.__children&&(s.__ref.__children.includes(o.key)||s.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&(0,A.pushConfig)(h);try{const l=o.html(o,o.state,o.context);l!=null&&typeof l!="function"&&(o.node.innerHTML=l)}catch{}finally{h&&(0,A.popConfig)()}}if(R("Create",o,i),R("Complete",o,i),R("Render",o,i),R("RenderRouter",o,i),typeof o.onFrame=="function"){const h=o.onFrame,l=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){l&&(0,A.pushConfig)(l);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{l&&(0,A.popConfig)()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function At(t,s,n){const i=!s,c=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=i&&c&&t.context?.state,e=n.state!==void 0&&!o?n.state:t.state&&!(0,S.isStore)(t.state)?t.state:void 0;if(e==null){if(s?.state)t.state=s.state,(0,F.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,r={...f},a=t.context?.polyglot;if(a?.translations){const u=f.lang||a.defaultLang||"en",y=a.translations[u];if(y&&typeof y=="object")for(const p in y)r[p]===void 0&&(r[p]=y[p]);const d=new Set(a.languages||[]);for(const p in a.translations)!d.has(p)&&r[p]===void 0&&(r[p]=a.translations[p])}t.state=(0,S.isStore)(r)?r:(0,S.createStore)(r),t.state.__element=t,t.state.root=t.state,(0,F.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,F.applyStateMethods)(t,t.state);return}if(typeof e=="string"){if(t.state=ot(e,s),t.state&&typeof t.state=="object"&&!(0,S.isStore)(t.state)){const f=s?.state?.root||s?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,F.applyStateMethods)(t,t.state);return}if(typeof e=="function"){const f=e(t,s?.state);t.state=(0,S.isStore)(f)?f:(0,S.createStore)(f||{})}else(0,S.isStore)(e)?t.state=e:t.state=(0,S.createStore)({...e});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,F.applyStateMethods)(t,t.state)}function U(t,s){if(!s)return t;const n=s.split("/");let i=t;for(const c of n){if(i==null)return{};i=i[c]}return i??{}}function ot(t,s){if(!s)return{};if(t===".")return s.state||{};if(t.startsWith("../")){const c=t.slice(3);return c?U(s.state,c):s.state??{}}if(t.startsWith("~/")){const c=s.state?.root||s.state,o=t.slice(2);return o?U(c,o):c??{}}if(s.state?.[t]!==void 0)return s.state[t];const n=U(s.state,t);if(n!=null&&Object.keys(n).length>0)return n;const i=s.context?.polyglot;if(i?.translations){const c=s.state?.root?.lang||i.defaultLang||"en",o=i.translations[c];if(o?.[t]!==void 0)return o[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}function vt(t){const s=t.__ref,n=t.tag||"div",i=t.context?.designSystem,c=[],o=Object.keys(t);for(let e=0;e<o.length;e++){const f=o[e];if(typeof t[f]!="function"||P.REGISTRY.has(f))continue;const r=f.charCodeAt(0);r>=65&&r<=90||M(f)||x.CSS_PROPS_REGISTRY[f]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,I.checkAttributeByTagName)(n,f)||c.push({prop:f,fn:t[f]})}for(let e=0;e<c.length;e++){const{prop:f,fn:r}=c[e];s.__exec[f]=r,Object.defineProperty(t,f,{get(){i&&(0,A.pushConfig)(i);try{return r(t,t.state,t.context)}catch{return}finally{i&&(0,A.popConfig)()}},set(a){delete s.__exec[f],Object.defineProperty(t,f,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Z(t,s){const n=t.__ref;if(vt(t),typeof t.text=="function"){const c=t.text,o=(0,j.createEffect)(()=>{if(!n.contentManaged)try{let e=c(t,t.state,t.context);t.node&&e!=null&&typeof e!="function"&&typeof e!="object"&&(typeof e=="string"&&e.includes("{{")&&(e=V.replaceLiteralsWithObjectFields.call(t,e,t.state)),t.tag==="string"?t.node.nodeValue=e:t.node.textContent=e)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=c}else if(typeof t.text=="string"&&t.text.includes("{{")){const c=t.text,o=(0,j.createEffect)(()=>{if(n.contentManaged)return;const e=V.replaceLiteralsWithObjectFields.call(t,c,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(o),n.__exec.text=c}for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&typeof t[c]=="function"&&!P.REGISTRY.has(c)&&!M(c)&&!n.__exec[c]){if(x.CSS_PROPS_REGISTRY[c]){const o=t[c],e=c;let f;const r=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context),y=x.CSS_PROPS_REGISTRY[e](u,t,t.state,t.context);if(y&&t.node){const d=st(y);(d===null||d!==f)&&(f=d,K(t.node,y))}else t.node&&(e==="show"||e==="hide")&&(f=void 0,t.node.style.display="")}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec[c]=o}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c)){const o=t[c],e=c;let f;const r=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,A.pushConfig)(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const y=e+":"+String(u);y!==f&&(f=y,K(t.node,{[e]:u}))}else f=void 0,t.node.style[e]=""}finally{a&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(r),n.__exec[c]=o}}if(typeof s.html=="function"){const c=s.html,o=(0,j.createEffect)(()=>{const e=t.context?.designSystem;e&&(0,A.pushConfig)(e);try{const f=c(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{e&&(0,A.popConfig)()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=c}if(typeof s.value=="function"){const c=s.value,o=(0,j.createEffect)(()=>{try{const e=c(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=e==null?"":String(e);if(t.node.value===f)return;const r=typeof document<"u"&&document.activeElement===t.node,a=r&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=r&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,r&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=c}if(typeof s.style=="function"){const c=s.style;let o;const e=(0,j.createEffect)(()=>{const f=c(t,t.state,t.context),r=st(f);(r===null||r!==o)&&(o=r,K(t.node,f))},{depth:n.path.length});n.__effects.push(e),n.__exec.style=c}else if(t.style&&typeof t.style=="object")for(const c in t.style){const o=t.style[c];if(typeof o!="function")continue;let e;const f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);if(t.node){const a=c+":"+String(r);a!==e&&(e=a,K(t.node,{[c]:r}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const c in t.attr)if(typeof t.attr[c]=="function"){const o=t.attr[c],e=c,f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);t.node?.setAttribute&&(r==null||r===!1?t.node.removeAttribute(e):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(e,r===!0?"":r))}catch{}},{depth:n.path.length});n.__effects.push(f)}}if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o!="function")continue;const e="aria-"+c.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),f=(0,j.createEffect)(()=>{try{const r=o(t,t.state,t.context);if(!t.node?.setAttribute)return;r==null||r===!1?t.node.removeAttribute(e):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(e,r===!0?"":r)}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.data&&typeof t.data=="object")for(const c in t.data){const o=t.data[c];if(typeof o!="function")continue;const f="data-"+c.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(f):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(f,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}const i=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(i)for(const c in i){const o=i[c];if(typeof o!="function")continue;const e=(0,j.createEffect)(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.classList)return;typeof f=="string"?t.node.classList.add(f):f?t.node.classList.add(c):t.node.classList.remove(c)}catch{}},{depth:n.path.length});n.__effects.push(e)}if(typeof s.if=="function"){const c=s.if,o=(0,j.createEffect)(()=>{let e;try{e=c(t,t.state,t.context)}catch(r){if(e=!1,n.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const f=n.__if;if(n.__if=!!e,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=(0,N.cacheNode)(t)),t.node&&(t.node.ref=t);const r=t.parent,a=r?.node;if(a&&t.node){let u=null;const y=Object.keys(r),d=y.indexOf(t.key);for(let p=d+1;p<y.length;p++){const _=r[y[p]];if(_?.node?.parentNode===a){u=_.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else J(t,t.parent);z(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=(0,N.detectTag)(t)),R("Init",t,{}),t.node||(t.node=(0,N.cacheNode)(t)),!t.node)return;R("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id),rt(t,{});const r=s.if;delete s.if;try{Z(t,s)}finally{s.if=r}z(t),ct(t),it(t,{}),J(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||P.REGISTRY.has(c)||typeof t[c]!="function")continue;const o=c.charCodeAt(0);if(o>=65&&o<=90||M(c))continue;const e=t[c];n.__exec[c]=e;const f=t.tag||"div";if((0,I.checkAttributeByTagName)(f,c)&&!x.CSS_PROPS_REGISTRY[c]&&!(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))){const r=c,a=(0,j.createEffect)(()=>{try{const u=e(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(r):typeof u!="function"&&typeof u!="object"&&(r==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(r,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}St(t),Ct(t)}function z(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),Et(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"&&K(s,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const i=t.attr[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.setAttribute&&s.setAttribute(n,i===!0?"":i)}if(t.data&&typeof t.data=="object")for(const n in t.data){const i=t.data[n];typeof i=="function"||typeof i=="object"||i==null||i===!1||s.dataset&&(s.dataset[n]=i===!0?"":i)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(i=>i&&s.classList.add(i));else if(typeof n=="object")for(const i in n){const c=typeof n[i]=="function"?n[i](t,t.state,t.context):n[i];c&&s.classList.add(typeof c=="string"?c:i)}}}}function st(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function K(t,s){if(!t||!s||!t.style)return;let n=null;for(const i in s){const c=s[i];if(c!=null){if(i.charAt(0)==="&"&&typeof c=="object"){n||(n={}),n[i]=c;continue}try{const o=String(c),e=i.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),f=o.trim(),r=/\s*!important\s*$/.test(f),a=f.replace(/\s*!important\s*$/,"");t.style.setProperty(e,a,r?"important":"")}catch{}}}n&&kt(t,n)}let jt=0;function kt(t,s){const n=`_ds${jt++}`;t.classList.add(n);const i=t.ownerDocument;let c=i.querySelector("style[data-smbls-scoped]");c||(c=i.createElement("style"),c.setAttribute("data-smbls-scoped",""),i.head.appendChild(c));let o="";for(const e in s){const f="."+n,r=e.replace(/&/g,f).split(",").map(u=>{const y=u.trim();return y.includes(f)?y:f+y}).join(", "),a=s[e];if(typeof a=="object"){let u="",y="";for(const d in a){const p=a[d];if(typeof p=="object"){const _=d.includes("&")?r.split(", ").map(l=>d.replace(/&/g,l)).join(", "):r.split(", ").map(l=>`${l} ${d}`).join(", ");let h="";for(const l in p)h+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${p[l]};`;y+=`${_} { ${h} }
|
|
5
5
|
`}else u+=`${d.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${p};`}u&&(o+=`${r} { ${u} }
|
|
6
|
-
`),y&&(o+=y)}}o&&(c.textContent+=o)}function kt(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let i=0;i<s.length;i++){const c=s[i];if(typeof c!="string"||c.length===0)continue;const o=c.split("."),e=o[0],f=o.slice(1),r={value:!1},a=(0,j.createEffect)(()=>{const u=t.state&&((0,k.isStore)(t.state)?t.state.root:null);if(!u||!(0,k.isStore)(u))return;let y=u;y=y[e];for(let d=0;d<f.length&&!(y==null||typeof y!="object");d++)if((0,k.isStore)(y))y=y[f[d]];else break;if(r.value&&typeof t.onUpdate=="function"){const d=t.context?.designSystem;d&&(0,A.pushConfig)(d);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&(0,W.runPluginHook)("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{d&&(0,A.popConfig)()}}},{depth:n.path.length});r.value=!0,n.__effects.push(a)}}function Ct(t){const s=t.__ref;s.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=n.charAt(0);if(i!=="."&&i!=="!")continue;const c=n.slice(1);if(!c)continue;const o=t[n];if(!o||typeof o!="object")continue;const e=i==="!",f={lastMatch:!1,appliedKeys:null},r=()=>{if(!t.node)return;let u;const y=t[c];if(y===void 0)if(t.state&&c in t.state)u=t.state[c];else{const _=t.context?.cases?.[c];if(_===void 0)return;try{u=typeof _=="function"?_.call(t,t):_}catch(h){u=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof y=="function")try{u=y(t,t.state,t.context)}catch(_){u=!1,s.__conditionalError=_,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,_?.message||_)}else u=y;const d=e?!u:!!u;if(d===f.lastMatch)return;f.lastMatch=d;const p=t.context?.designSystem;p&&(0,A.pushConfig)(p);try{if(d){const _={};for(const l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;const g=typeof o[l]=="function"?o[l](t,t.state,t.context):o[l];if(g!=null)if(x.CSS_PROPS_REGISTRY[l]){const b=x.CSS_PROPS_REGISTRY[l](g,t,t.state,t.context);if(b){const w=Array.isArray(b)?b:[b];for(const O of w)O&&Object.assign(_,O)}}else x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(l)&&(_[l]=g)}const h=Object.keys(_);h.length?(K(t.node,_),f.appliedKeys=h):f.appliedKeys=null}else if(f.appliedKeys){for(const _ of f.appliedKeys)t.node.style[_]="";f.appliedKeys=null}}finally{p&&(0,A.popConfig)()}};s.__conditionalRunners.push(r);const a=(0,j.createEffect)(r,{depth:s.path.length});s.__effects.push(a)}}const B=new WeakSet;function wt(t){const s=t.ownerDocument;!s||B.has(s)||(B.add(s),queueMicrotask(()=>{B.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const q=new WeakSet;function Et(t){const{node:s}=t;if(!s)return;if(q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}q.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const i={};let c=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||P.REGISTRY.has(o))continue;const e=o.charCodeAt(0);if(!(e>=65&&e<=90)&&!M(o)){if(x.CSS_PROPS_REGISTRY[o]){const f=t[o],r=x.CSS_PROPS_REGISTRY[o](f,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(i,a);else Object.assign(i,r);c=!0}}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,c=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,c=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(i[o]=f,c=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const r={};for(const a in f){let u=f[a];if(typeof u=="function"&&(u=u(t,t.state,t.context)),!(u==null||typeof u=="function"))if(x.CSS_PROPS_REGISTRY[a]){const y=x.CSS_PROPS_REGISTRY[a](u,t,t.state,t.context);if(y)if(Array.isArray(y))for(const d of y)d&&Object.assign(r,d);else Object.assign(r,y)}else r[a]=u}if(Object.keys(r).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const u={};for(const d in r){const p=r[d];u[d]=typeof p=="string"&&!p.includes("!important")?p+" !important":p}const y=o.slice(1);i[`[data-theme="${y}"] &`]=u}else{let u=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=o.slice(1),p=t.context?.designSystem?.media?.[d]||t.context?.designSystem?.media?.[d];p&&(u=`@media ${p}`)}const y={};for(const d in r){const p=r[d];if(p&&typeof p=="object"&&!Array.isArray(p)){const _={};for(const l in p)if(x.CSS_PROPS_REGISTRY[l]){const g=x.CSS_PROPS_REGISTRY[l](p[l],t,t.state,t.context);if(g)if(Array.isArray(g))for(const b of g)b&&Object.assign(_,b);else Object.assign(_,g)}else _[l]=p[l];const h=d.startsWith(":")?"":" ";if(u.includes(",")){const l=u.split(",").map(g=>`${g.trim()}${h}${d}`).join(", ");i[l]=_}else i[`${u}${h}${d}`]=_}else y[d]=p}Object.keys(y).length&&(i[u]=y)}c=!0}c=!0}}}}if(c){i.display&&String(i.display).includes("!important")&&(s.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const o=(0,ut.css)(i,null,t.context?.cssPrefix);if(o&&s.classList){const f=o.split(" ").filter(Boolean);let r=!1;for(const a of f)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&&wt(s)}const e=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(e!=null){const f=i.display;if(f&&f!==e)if(e==="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,A.popConfig)(),q.delete(t)}}function ct(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const e="aria-"+c.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());s.setAttribute(e,o===!0?"":o)}const n=(0,I.applyAttrTransforms)(t);for(const c in n){const o=n[c];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(c,o===!0?"":o)}const i=t.tag||"div";for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||typeof t[c]=="function"||P.REGISTRY.has(c)||c==="on"||n[c]!==void 0)continue;const o=c.charCodeAt(0);if(!(o>=65&&o<=90)&&!M(c)&&!(x.CSS_PROPS_REGISTRY[c]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))&&(0,I.checkAttributeByTagName)(i,c)){let e=t[c];if(e==null||e===!1||(typeof e=="string"&&e.includes("{{")&&(e=(0,V.replaceLiteralsWithObjectFields)(e,t,t.state,t.context),t[c]=e),e==null||e===!1||typeof e=="function"||typeof e=="object"))continue;s.setAttribute(c,e===!0?"":e)}}}function Pt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,i=n&&typeof n=="object"&&n.max?String(n.max):null;i&&(s.style.maxHeight=i);const c=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};c(),s.addEventListener("input",c),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",c)}catch{}})}const nt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function rt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!M(n)||nt.has(n))continue;let i=t[n];if(typeof i=="string"&&/^[A-Za-z_$][\w$]*$/.test(i)){const o=i;i=function(f){return t.call(o,f)}}if(typeof i!="function")continue;const c=bt(n);P.LIFECYCLE_EVENTS.has(c)||(0,et.registerEvent)(xt(c),t,i)}Ot(t)}function Ot(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let i=!1;for(const d of nt){const p=t[d];typeof p=="function"&&(n[d]=p,i=!0)}if(!i)return;const c=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let e=0,f=0,r=0,a=!1;const u=d=>{const p=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];p&&(e=p.clientX,f=p.clientY,r=Date.now(),a=!0)},y=d=>{if(!a)return;a=!1;const p=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!p)return;const _=p.clientX-e,h=p.clientY-f,l=Date.now()-r;if(l>o)return;const g=Math.abs(_),b=Math.abs(h);if(Math.max(g,b)<c)return;let w;if(g>b*1.2)w=_<0?"left":"right";else if(b>g*1.2)w=h<0?"up":"down";else return;const O="onSwipe"+w.charAt(0).toUpperCase()+w.slice(1),S=n[O],C=n.onSwipe;S&&S.call(t,d,t,t.state,t.context),C&&C.call(t,{direction:w,dx:_,dy:h,dt:l,event:d},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",y,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",y)}catch{}})}function X(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=X(c,o):n[i]=o}return n}function Q(t,s,n){if(!s||!t.node)return;const i=t.childExtends;if(Array.isArray(s)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const e=t.childProps,f=t.childrenAs;for(let r=0;r<s.length;r++){let a=s[r];const u=a;(typeof a=="string"||typeof a=="number")&&(a={text:a});let y=e;if(typeof e=="function")try{y=e(t,a)}catch{y=null}if(f==="state"){let _=u;(typeof u=="string"||typeof u=="number")&&(_={value:u,text:u}),a=y?{...y,state:_}:{state:_}}else y&&(a=X(y,a));if(i&&!a.ignoreChildExtends)if(a.extends){const _=Array.isArray(a.extends)?a.extends:[a.extends],h=Array.isArray(i)?i:[i];a={...a,extends:[...h,..._]}}else a={extends:i,...a};const d=a?.key||`${r}`,p=T(a,t,d,n);p?.node&&o.appendChild(p.node)}t.node.appendChild(o);return}if(typeof s=="string"){const c=ot(s,t);if(Array.isArray(c)){Q(t,c,n);return}}if(typeof s=="object")for(const c in s){if(P.REGISTRY.has(c))continue;let o=s[c];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),i&&!o.ignoreChildExtends)if(o.extends){const e=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(i)?i:[i];o={...o,extends:[...f,...e]}}else o={extends:i,...o};T(o,t,c,n)}}}function it(t,s){let{children:n,content:i}=t;const c=t.childExtends;if(typeof n=="function"){const e=n;n=e(t,t.state,t.context),t.children=n;const f=t.__ref;let r=!1;const a=(0,j.createEffect)(()=>{const u=e(t,t.state,t.context);if(!r){r=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const p=t.childProps,_=[],h=new Map;for(let S=0;S<u.length;S++){const C=u[S];let v=p;if(typeof p=="function")try{v=p(t,C)}catch{v=null}const D=v&&v.key||C&&C.key||`${S}`;_.push(D),h.set(D,{rawChild:C,childProps:v})}const l=new Set(_),g=f.__children.slice();for(const S of g)if(!l.has(S)){const C=t[S];C?.remove&&C.remove(),delete t[S]}const b=t.childExtends,O=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const S of _){const C=h.get(S),v=C.rawChild,D=t[S];if(D&&D.state){if(v&&typeof v=="object"){const $=D.state;if(typeof $.replace=="function")$.replace(v);else if(typeof $.update=="function"){for(const E in $)if(!(E==="__element"||E==="root"||E==="parent"||E==="update")&&!Object.prototype.hasOwnProperty.call(v,E))try{$[E]=void 0}catch{}$.update(v)}else for(const E in v)$[E]=v[E]}continue}let H=v;(typeof v=="string"||typeof v=="number")&&(H={value:v,text:v});const m=C.childProps;let L=m?{...m,state:H}:{state:H};if(b&&!L.ignoreChildExtends)if(L.extends){const $=Array.isArray(L.extends)?L.extends:[L.extends],E=Array.isArray(b)?b:[b];L={...L,extends:[...E,...$]}}else L={extends:b,...L};const tt=T(L,t,S,s);tt?.node&&O&&O.appendChild(tt.node)}O&&O.childNodes.length&&t.node&&t.node.appendChild(O),f.__children=_;return}for(const p of[...f.__children]){const _=t[p];_?.remove&&_.remove(),delete t[p]}f.__children=[],Q(t,u,s)},{depth:f.path.length});f.__effects.push(a)}if(Q(t,n||i,s),n||i)return;const o=t.context?.components||{};{const e=Object.keys(t);for(let f=0;f<e.length;f++){const r=e[f];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 u={extends:t[r]};delete t[r];for(let y=f+1;y<e.length;y++){const d=e[y],p=d.charCodeAt(0);if(p>=65&&p<=90||P.REGISTRY.has(d)||typeof t[d]=="function"&&(d.startsWith("on")||d.startsWith(".")))break;const _=t[d];_!==void 0&&(u[d]=_,delete t[d])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e)||P.REGISTRY.has(e)||typeof t[e]!="object"||t[e]===null)continue;const f=e.charCodeAt(0);if(f<65||f>90)continue;let r=t[e];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[e]||o[`smbls.${e}`];a&&(r={extends:a,...r})}if(t.childProps&&(r={...t.childProps,...r}),c&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(c)?c:[c];r={...r,extends:[...u,...a]}}else r={extends:c,...r};T(r,t,e,s)}}}function J(t,s,n){const{node:i}=t;if(!i)return;i.ref=t;const c=s?.node||(s?.nodeType?s:null);if(c)if(n?.position==="before"&&n.node)c.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?c.insertBefore(i,o):c.appendChild(i)}else c.appendChild(i)}function R(t,s,n){const i=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,W.runPluginHook)(i,s,n);const c="on"+t,o=s[c];if(typeof o=="function"){const e=t==="Render"||t==="RenderRouter";if(e){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const f=s.context?.designSystem;f&&(0,A.pushConfig)(f);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&(0,W.runPluginHook)("error",s,{hook:c,error:r})||console.error(`[DOMQL] Lifecycle "${c}" error:`,r),s.context?.strictMode)throw r}finally{f&&(0,A.popConfig)(),e&&(s.__ref.__inRender=!1)}}return!0}var Lt=T;
|
|
6
|
+
`),y&&(o+=y)}}o&&(c.textContent+=o)}function St(t){const s=t.subscribeTo;if(!Array.isArray(s)||s.length===0)return;const n=t.__ref;for(let i=0;i<s.length;i++){const c=s[i];if(typeof c!="string"||c.length===0)continue;const o=c.split("."),e=o[0],f=o.slice(1),r={value:!1},a=(0,j.createEffect)(()=>{const u=t.state&&((0,S.isStore)(t.state)?t.state.root:null);if(!u||!(0,S.isStore)(u))return;let y=u;y=y[e];for(let d=0;d<f.length&&!(y==null||typeof y!="object");d++)if((0,S.isStore)(y))y=y[f[d]];else break;if(r.value&&typeof t.onUpdate=="function"){const d=t.context?.designSystem;d&&(0,A.pushConfig)(d);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&(0,W.runPluginHook)("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{d&&(0,A.popConfig)()}}},{depth:n.path.length});r.value=!0,n.__effects.push(a)}}function Ct(t){const s=t.__ref;s.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=n.charAt(0);if(i!=="."&&i!=="!")continue;const c=n.slice(1);if(!c)continue;const o=t[n];if(!o||typeof o!="object")continue;const e=i==="!",f={lastMatch:!1,appliedKeys:null},r=()=>{if(!t.node)return;let u;const y=t[c];if(y===void 0)if(t.state&&c in t.state)u=t.state[c];else{const _=t.context?.cases?.[c];if(_===void 0)return;try{u=typeof _=="function"?_.call(t,t):_}catch(h){u=!1,s.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof y=="function")try{u=y(t,t.state,t.context)}catch(_){u=!1,s.__conditionalError=_,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,_?.message||_)}else u=y;const d=e?!u:!!u;if(d===f.lastMatch)return;f.lastMatch=d;const p=t.context?.designSystem;p&&(0,A.pushConfig)(p);try{if(d){const _={};for(const l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;const g=typeof o[l]=="function"?o[l](t,t.state,t.context):o[l];if(g!=null)if(x.CSS_PROPS_REGISTRY[l]){const b=x.CSS_PROPS_REGISTRY[l](g,t,t.state,t.context);if(b){const w=Array.isArray(b)?b:[b];for(const O of w)O&&Object.assign(_,O)}}else x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(l)&&(_[l]=g)}const h=Object.keys(_);h.length?(K(t.node,_),f.appliedKeys=h):f.appliedKeys=null}else if(f.appliedKeys){for(const _ of f.appliedKeys)t.node.style[_]="";f.appliedKeys=null}}finally{p&&(0,A.popConfig)()}};s.__conditionalRunners.push(r);const a=(0,j.createEffect)(r,{depth:s.path.length});s.__effects.push(a)}}const B=new WeakSet;function wt(t){const s=t.ownerDocument;!s||B.has(s)||(B.add(s),queueMicrotask(()=>{B.delete(s);const n=s.body||s.documentElement;n&&n.offsetWidth}))}const q=new WeakSet;function Et(t){const{node:s}=t;if(!s)return;if(q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}q.add(t);const n=t.context?.designSystem;n&&(0,A.pushConfig)(n);try{const i={};let c=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||P.REGISTRY.has(o))continue;const e=o.charCodeAt(0);if(!(e>=65&&e<=90)&&!M(o)){if(x.CSS_PROPS_REGISTRY[o]){const f=t[o],r=x.CSS_PROPS_REGISTRY[o](f,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(i,a);else Object.assign(i,r);c=!0}}else if(x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,c=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,c=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(i[o]=f,c=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const r={};for(const a in f){let u=f[a];if(typeof u=="function"&&(u=u(t,t.state,t.context)),!(u==null||typeof u=="function"))if(x.CSS_PROPS_REGISTRY[a]){const y=x.CSS_PROPS_REGISTRY[a](u,t,t.state,t.context);if(y)if(Array.isArray(y))for(const d of y)d&&Object.assign(r,d);else Object.assign(r,y)}else r[a]=u}if(Object.keys(r).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const u={};for(const d in r){const p=r[d];u[d]=typeof p=="string"&&!p.includes("!important")?p+" !important":p}const y=o.slice(1);i[`[data-theme="${y}"] &`]=u}else{let u=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=o.slice(1),p=t.context?.designSystem?.media?.[d]||t.context?.designSystem?.media?.[d];p&&(u=`@media ${p}`)}const y={};for(const d in r){const p=r[d];if(p&&typeof p=="object"&&!Array.isArray(p)){const _={};for(const l in p)if(x.CSS_PROPS_REGISTRY[l]){const g=x.CSS_PROPS_REGISTRY[l](p[l],t,t.state,t.context);if(g)if(Array.isArray(g))for(const b of g)b&&Object.assign(_,b);else Object.assign(_,g)}else _[l]=p[l];const h=d.startsWith(":")?"":" ";if(u.includes(",")){const l=u.split(",").map(g=>`${g.trim()}${h}${d}`).join(", ");i[l]=_}else i[`${u}${h}${d}`]=_}else y[d]=p}Object.keys(y).length&&(i[u]=y)}c=!0}c=!0}}}}if(c){i.display&&String(i.display).includes("!important")&&(s.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const o=(0,ut.css)(i,null,t.context?.cssPrefix);if(o&&s.classList){const f=o.split(" ").filter(Boolean);let r=!1;for(const a of f)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&&wt(s)}const e=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(e!=null){const f=i.display;if(f&&f!==e)if(e==="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,A.popConfig)(),q.delete(t)}}function ct(t){const{node:s}=t;if(!s||!s.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const c in t.aria){const o=t.aria[c];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const e="aria-"+c.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());s.setAttribute(e,o===!0?"":o)}const n=(0,I.applyAttrTransforms)(t);for(const c in n){const o=n[c];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&s.setAttribute(c,o===!0?"":o)}const i=t.tag||"div";for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||typeof t[c]=="function"||P.REGISTRY.has(c)||c==="on"||n[c]!==void 0)continue;const o=c.charCodeAt(0);if(!(o>=65&&o<=90)&&!M(c)&&!(x.CSS_PROPS_REGISTRY[c]||x.DEFAULT_CSS_PROPERTIES_LIST&&x.DEFAULT_CSS_PROPERTIES_LIST.has(c))&&(0,I.checkAttributeByTagName)(i,c)){let e=t[c];if(e==null||e===!1||(typeof e=="string"&&e.includes("{{")&&(e=(0,V.replaceLiteralsWithObjectFields)(e,t,t.state,t.context),t[c]=e),e==null||e===!1||typeof e=="function"||typeof e=="object"))continue;s.setAttribute(c,e===!0?"":e)}}}function Pt(t){if(!t.autoGrow)return;const s=t.node;if(!s||s.tagName!=="TEXTAREA")return;const n=t.autoGrow,i=n&&typeof n=="object"&&n.max?String(n.max):null;i&&(s.style.maxHeight=i);const c=()=>{s.style.height="auto",s.style.height=s.scrollHeight+"px"};c(),s.addEventListener("input",c),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("input",c)}catch{}})}const nt=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function rt(t,s){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!M(n)||nt.has(n))continue;let i=t[n];if(typeof i=="string"&&/^[A-Za-z_$][\w$]*$/.test(i)){const o=i;i=function(f){return t.call(o,f)}}if(typeof i!="function")continue;const c=bt(n);P.LIFECYCLE_EVENTS.has(c)||(0,et.registerEvent)(xt(c),t,i)}Ot(t)}function Ot(t){const s=t.node;if(!s||!s.addEventListener)return;const n={};let i=!1;for(const d of nt){const p=t[d];typeof p=="function"&&(n[d]=p,i=!0)}if(!i)return;const c=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let e=0,f=0,r=0,a=!1;const u=d=>{const p=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];p&&(e=p.clientX,f=p.clientY,r=Date.now(),a=!0)},y=d=>{if(!a)return;a=!1;const p=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!p)return;const _=p.clientX-e,h=p.clientY-f,l=Date.now()-r;if(l>o)return;const g=Math.abs(_),b=Math.abs(h);if(Math.max(g,b)<c)return;let w;if(g>b*1.2)w=_<0?"left":"right";else if(b>g*1.2)w=h<0?"up":"down";else return;const O="onSwipe"+w.charAt(0).toUpperCase()+w.slice(1),k=n[O],C=n.onSwipe;k&&k.call(t,d,t,t.state,t.context),C&&C.call(t,{direction:w,dx:_,dy:h,dt:l,event:d},t,t.state,t.context)};s.addEventListener("touchstart",u,{passive:!0}),s.addEventListener("touchend",y,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{s.removeEventListener("touchstart",u)}catch{}try{s.removeEventListener("touchend",y)}catch{}})}function X(t,s){const n={...t};for(const i in s){const c=n[i],o=s[i];c&&o&&typeof c=="object"&&typeof o=="object"&&!Array.isArray(c)&&!Array.isArray(o)&&typeof c!="function"&&typeof o!="function"?n[i]=X(c,o):n[i]=o}return n}function Q(t,s,n){if(!s||!t.node)return;const i=t.childExtends;if(Array.isArray(s)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const e=t.childProps,f=t.childrenAs;for(let r=0;r<s.length;r++){let a=s[r];const u=a;(typeof a=="string"||typeof a=="number")&&(a={text:a});let y=e;if(typeof e=="function")try{y=e(t,a)}catch{y=null}if(f==="state"){let _=u;(typeof u=="string"||typeof u=="number")&&(_={value:u,text:u}),a=y?{...y,state:_}:{state:_}}else y&&(a=X(y,a));if(i&&!a.ignoreChildExtends)if(a.extends){const _=Array.isArray(a.extends)?a.extends:[a.extends],h=Array.isArray(i)?i:[i];a={...a,extends:[...h,..._]}}else a={extends:i,...a};const d=a?.key||u&&typeof u=="object"&&u.key||`${r}`,p=T(a,t,d,n);p?.node&&o.appendChild(p.node)}t.node.appendChild(o);return}if(typeof s=="string"){const c=ot(s,t);if(Array.isArray(c)){Q(t,c,n);return}}if(typeof s=="object")for(const c in s){if(P.REGISTRY.has(c))continue;let o=s[c];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=X(t.childProps,o)),i&&!o.ignoreChildExtends)if(o.extends){const e=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(i)?i:[i];o={...o,extends:[...f,...e]}}else o={extends:i,...o};T(o,t,c,n)}}}function it(t,s){let{children:n,content:i}=t;const c=t.childExtends;if(typeof n=="function"){const e=n;n=e(t,t.state,t.context),t.children=n;const f=t.__ref;let r=!1;const a=(0,j.createEffect)(()=>{const u=e(t,t.state,t.context);if(!r){r=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const p=t.childProps,_=[],h=new Map;for(let k=0;k<u.length;k++){const C=u[k];let v=p;if(typeof p=="function")try{v=p(t,C)}catch{v=null}const D=v&&v.key||C&&C.key||`${k}`;_.push(D),h.set(D,{rawChild:C,childProps:v})}const l=new Set(_),g=f.__children.slice();for(const k of g)if(!l.has(k)){const C=t[k];C?.remove&&C.remove(),delete t[k]}const b=t.childExtends,O=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const k of _){const C=h.get(k),v=C.rawChild,D=t[k];if(D&&D.state){if(v&&typeof v=="object"){const $=D.state;if(typeof $.replace=="function")$.replace(v);else if(typeof $.update=="function"){for(const E in $)if(!(E==="__element"||E==="root"||E==="parent"||E==="update")&&!Object.prototype.hasOwnProperty.call(v,E))try{$[E]=void 0}catch{}$.update(v)}else for(const E in v)$[E]=v[E]}continue}let H=v;(typeof v=="string"||typeof v=="number")&&(H={value:v,text:v});const m=C.childProps;let L=m?{...m,state:H}:{state:H};if(b&&!L.ignoreChildExtends)if(L.extends){const $=Array.isArray(L.extends)?L.extends:[L.extends],E=Array.isArray(b)?b:[b];L={...L,extends:[...E,...$]}}else L={extends:b,...L};const tt=T(L,t,k,s);tt?.node&&O&&O.appendChild(tt.node)}O&&O.childNodes.length&&t.node&&t.node.appendChild(O),f.__children=_;return}for(const p of[...f.__children]){const _=t[p];_?.remove&&_.remove(),delete t[p]}f.__children=[],Q(t,u,s)},{depth:f.path.length});f.__effects.push(a)}if(Q(t,n||i,s),n||i)return;const o=t.context?.components||{};{const e=Object.keys(t);for(let f=0;f<e.length;f++){const r=e[f];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 u={extends:t[r]};delete t[r];for(let y=f+1;y<e.length;y++){const d=e[y],p=d.charCodeAt(0);if(p>=65&&p<=90||P.REGISTRY.has(d)||typeof t[d]=="function"&&(d.startsWith("on")||d.startsWith(".")))break;const _=t[d];_!==void 0&&(u[d]=_,delete t[d])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e)||P.REGISTRY.has(e)||typeof t[e]!="object"||t[e]===null)continue;const f=e.charCodeAt(0);if(f<65||f>90)continue;let r=t[e];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[e]||o[`smbls.${e}`];a&&(r={extends:a,...r})}if(t.childProps&&(r={...t.childProps,...r}),c&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(c)?c:[c];r={...r,extends:[...u,...a]}}else r={extends:c,...r};T(r,t,e,s)}}}function J(t,s,n){const{node:i}=t;if(!i)return;i.ref=t;const c=s?.node||(s?.nodeType?s:null);if(c)if(n?.position==="before"&&n.node)c.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?c.insertBefore(i,o):c.appendChild(i)}else c.appendChild(i)}function R(t,s,n){const i=t.charAt(0).toLowerCase()+t.slice(1);s.context?.plugins?.length&&(0,W.runPluginHook)(i,s,n);const c="on"+t,o=s[c];if(typeof o=="function"){const e=t==="Render"||t==="RenderRouter";if(e){if(s.__ref.__inRender)return!0;s.__ref.__inRender=!0}const f=s.context?.designSystem;f&&(0,A.pushConfig)(f);try{if(o(s,s.state,s.context,n)===!1)return!1}catch(r){if(s.context?.plugins?.length&&(0,W.runPluginHook)("error",s,{hook:c,error:r})||console.error(`[DOMQL] Lifecycle "${c}" error:`,r),s.context?.strictMode)throw r}finally{f&&(0,A.popConfig)(),e&&(s.__ref.__inRender=!1)}}return!0}var Lt=T;
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as W,createScopeStore as ut,isStore as R}from"@symbo.ls/signal";import{createEffect as A}from"@symbo.ls/signal";import{cacheNode as H,detectTag as ct}from"./cache.js";import{REGISTRY as T,LIFECYCLE_EVENTS as dt}from"./registry.js";import{registerEvent as pt}from"./delegate.js";import{applyExtends as yt}from"./extends.js";import{addMethods as lt}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as Y}from"@symbo.ls/utils";import{runPluginHook as G}from"@symbo.ls/utils/function.js";import{applyStateMethods as I}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as
|
|
1
|
+
import{createStore as W,createScopeStore as ut,isStore as R}from"@symbo.ls/signal";import{createEffect as A}from"@symbo.ls/signal";import{cacheNode as H,detectTag as ct}from"./cache.js";import{REGISTRY as T,LIFECYCLE_EVENTS as dt}from"./registry.js";import{registerEvent as pt}from"./delegate.js";import{applyExtends as yt}from"./extends.js";import{addMethods as lt}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as Y}from"@symbo.ls/utils";import{runPluginHook as G}from"@symbo.ls/utils/function.js";import{applyStateMethods as I}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as k,DEFAULT_CSS_PROPERTIES_LIST as S}from"css-in-props";import{css as ht}from"@symbo.ls/css";import{pushConfig as O,popConfig as L}from"@symbo.ls/scratch";import{checkAttributeByTagName as U,applyAttrTransforms as _t}from"attrs-in-props";let gt=1;function M(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function bt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function xt(t){return t.toLowerCase()}function Z(t,c){const n={...t};for(const e in c){const s=n[e],o=c[e];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[e]=Z(s,o):n[e]=o}return n}function K(t,c,n,e={},s){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=c||null,o.context=t.context||c?.context||e.context||{},o.context.__create||(o.context.__create=K);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:c?.__ref?.root||o,path:c?.__ref?.path?[...c.__ref.path,o.key]:[o.key]};if(n&&!t.extends&&!t.extend){const h=n.indexOf("_");if(h>0){const l=n.substring(0,h),g=o.context?.components;g&&(g[l]||g["smbls."+l])&&(t={extends:l,...t})}}yt(o,t,e);const f=new Set(["childProps","attr","style","scope","data"]),r=o.props&&typeof o.props=="object"?o.props:null;for(const h in t){if(h==="parent"||h==="node"||h==="__ref"||h==="extends"||h==="context"||h==="props")continue;const l=t[h],g=o[h],b=g&&l&&typeof g=="object"&&typeof l=="object"&&!Array.isArray(g)&&!Array.isArray(l)&&typeof g!="function"&&typeof l!="function";b&&h.charCodeAt(0)>=65&&h.charCodeAt(0)<=90?o[h]=Z(g,l):b&&f.has(h)?o[h]={...g,...l}:o[h]=l}function a(h){for(const l in h){const g=h[l],b=o[l],C=b&&g&&typeof b=="object"&&typeof g=="object"&&!Array.isArray(b)&&!Array.isArray(g)&&typeof b!="function"&&typeof g!="function";C&&l.charCodeAt(0)>=65&&l.charCodeAt(0)<=90?o[l]=Z(b,g):C&&f.has(l)?o[l]={...b,...g}:o[l]=g}}r&&a(r),t.props&&typeof t.props=="object"&&a(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const u=o.scope&&typeof o.scope=="object"?o.scope:null,y=c?.scope,d=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,p=y||d||null;if(t.scope!==void 0||u){const h={};u&&Object.assign(h,u),t.scope!==void 0&&Object.assign(h,t.scope),o.scope=ut(h,p)}else p&&(o.scope=p);if(t.if!==void 0&&(o.if=t.if),lt(o),At(o,c,t),o.if!=null){let h;if(typeof o.if=="function")try{h=o.if(o,o.state,o.context)}catch(l){if(h=!1,i.__ifError=l,typeof console<"u"&&console.warn){const g=o.key||o.tag||"?";console.warn(`[smbls] \`if:\` evaluator threw on ${g} \u2014 treating as false:`,l?.message||l)}}else h=o.if;i.__if=!!h}if(i.__if)typeof t.if=="function"&&(i.__ifInitialized=!0);else return c&&(c[o.key]=o),typeof t.if=="function"&&B(o,{if:t.if}),o;o.tag||(o.tag=ct(o)),N("Init",o,e);const _=o.node=H(o);if(!_)return o;N("AttachNode",o,e),_.setAttribute&&o.key&&_.setAttribute("data-key",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,e),B(o,t),q(o),it(o),Pt(o);try{at(o,e)}catch(h){if(typeof console<"u"&&console.error){const l=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${l}:`,h?.message||h,h?.stack?`
|
|
2
2
|
`+h.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(tt(o,c,s),c&&(c[o.key]=o,c.__ref?.__children&&(c.__ref.__children.includes(o.key)||c.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&O(h);try{const l=o.html(o,o.state,o.context);l!=null&&typeof l!="function"&&(o.node.innerHTML=l)}catch{}finally{h&&L()}}if(N("Create",o,e),N("Complete",o,e),N("Render",o,e),N("RenderRouter",o,e),typeof o.onFrame=="function"){const h=o.onFrame,l=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){l&&O(l);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{l&&L()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function At(t,c,n){const e=!c,s=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=e&&s&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!R(t.state)?t.state:void 0;if(i==null){if(c?.state)t.state=c.state,I(t,t.state);else if(t.context?.state){const f=t.context.state,r={...f},a=t.context?.polyglot;if(a?.translations){const u=f.lang||a.defaultLang||"en",y=a.translations[u];if(y&&typeof y=="object")for(const p in y)r[p]===void 0&&(r[p]=y[p]);const d=new Set(a.languages||[]);for(const p in a.translations)!d.has(p)&&r[p]===void 0&&(r[p]=a.translations[p])}t.state=R(r)?r:W(r),t.state.__element=t,t.state.root=t.state,I(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),I(t,t.state);return}if(typeof i=="string"){if(t.state=nt(i,c),t.state&&typeof t.state=="object"&&!R(t.state)){const f=c?.state?.root||c?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}I(t,t.state);return}if(typeof i=="function"){const f=i(t,c?.state);t.state=R(f)?f:W(f||{})}else R(i)?t.state=i:t.state=W({...i});t.state.__element=t,c?.state?(t.state.parent=c.state,t.state.root=c.state.root||c.state):t.state.root=t.state,I(t,t.state)}function z(t,c){if(!c)return t;const n=c.split("/");let e=t;for(const s of n){if(e==null)return{};e=e[s]}return e??{}}function nt(t,c){if(!c)return{};if(t===".")return c.state||{};if(t.startsWith("../")){const s=t.slice(3);return s?z(c.state,s):c.state??{}}if(t.startsWith("~/")){const s=c.state?.root||c.state,o=t.slice(2);return o?z(s,o):s??{}}if(c.state?.[t]!==void 0)return c.state[t];const n=z(c.state,t);if(n!=null&&Object.keys(n).length>0)return n;const e=c.context?.polyglot;if(e?.translations){const s=c.state?.root?.lang||e.defaultLang||"en",o=e.translations[s];if(o?.[t]!==void 0)return o[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}function vt(t){const c=t.__ref,n=t.tag||"div",e=t.context?.designSystem,s=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const f=o[i];if(typeof t[f]!="function"||T.has(f))continue;const r=f.charCodeAt(0);r>=65&&r<=90||M(f)||S[f]||k&&k.has(f)||U(n,f)||s.push({prop:f,fn:t[f]})}for(let i=0;i<s.length;i++){const{prop:f,fn:r}=s[i];c.__exec[f]=r,Object.defineProperty(t,f,{get(){e&&O(e);try{return r(t,t.state,t.context)}catch{return}finally{e&&L()}},set(a){delete c.__exec[f],Object.defineProperty(t,f,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function B(t,c){const n=t.__ref;if(vt(t),typeof t.text=="function"){const s=t.text,o=A(()=>{if(!n.contentManaged)try{let i=s(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&typeof i!="object"&&(typeof i=="string"&&i.includes("{{")&&(i=Y.call(t,i,t.state)),t.tag==="string"?t.node.nodeValue=i:t.node.textContent=i)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=A(()=>{if(n.contentManaged)return;const i=Y.call(t,s,t.state);i!=null&&(t.text=i),t.node&&(t.tag==="string"?t.node.nodeValue=i??"":t.node.textContent=i??"")},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&typeof t[s]=="function"&&!T.has(s)&&!M(s)&&!n.__exec[s]){if(S[s]){const o=t[s],i=s;let f;const r=A(()=>{const a=t.context?.designSystem;a&&O(a);try{const u=o(t,t.state,t.context),y=S[i](u,t,t.state,t.context);if(y&&t.node){const d=rt(y);(d===null||d!==f)&&(f=d,F(t.node,y))}else t.node&&(i==="show"||i==="hide")&&(f=void 0,t.node.style.display="")}finally{a&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec[s]=o}else if(k&&k.has(s)){const o=t[s],i=s;let f;const r=A(()=>{const a=t.context?.designSystem;a&&O(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const y=i+":"+String(u);y!==f&&(f=y,F(t.node,{[i]:u}))}else f=void 0,t.node.style[i]=""}finally{a&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec[s]=o}}if(typeof c.html=="function"){const s=c.html,o=A(()=>{const i=t.context?.designSystem;i&&O(i);try{const f=s(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{i&&L()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=s}if(typeof c.value=="function"){const s=c.value,o=A(()=>{try{const i=s(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=i==null?"":String(i);if(t.node.value===f)return;const r=typeof document<"u"&&document.activeElement===t.node,a=r&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=r&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,r&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=s}if(typeof c.style=="function"){const s=c.style;let o;const i=A(()=>{const f=s(t,t.state,t.context),r=rt(f);(r===null||r!==o)&&(o=r,F(t.node,f))},{depth:n.path.length});n.__effects.push(i),n.__exec.style=s}else if(t.style&&typeof t.style=="object")for(const s in t.style){const o=t.style[s];if(typeof o!="function")continue;let i;const f=A(()=>{try{const r=o(t,t.state,t.context);if(t.node){const a=s+":"+String(r);a!==i&&(i=a,F(t.node,{[s]:r}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const s in t.attr)if(typeof t.attr[s]=="function"){const o=t.attr[s],i=s,f=A(()=>{try{const r=o(t,t.state,t.context);t.node?.setAttribute&&(r==null||r===!1?t.node.removeAttribute(i):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(i,r===!0?"":r))}catch{}},{depth:n.path.length});n.__effects.push(f)}}if(t.aria&&typeof t.aria=="object")for(const s in t.aria){const o=t.aria[s];if(typeof o!="function")continue;const i="aria-"+s.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),f=A(()=>{try{const r=o(t,t.state,t.context);if(!t.node?.setAttribute)return;r==null||r===!1?t.node.removeAttribute(i):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(i,r===!0?"":r)}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.data&&typeof t.data=="object")for(const s in t.data){const o=t.data[s];if(typeof o!="function")continue;const f="data-"+s.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=A(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(f):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(f,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}const e=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(e)for(const s in e){const o=e[s];if(typeof o!="function")continue;const i=A(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.classList)return;typeof f=="string"?t.node.classList.add(f):f?t.node.classList.add(s):t.node.classList.remove(s)}catch{}},{depth:n.path.length});n.__effects.push(i)}if(typeof c.if=="function"){const s=c.if,o=A(()=>{let i;try{i=s(t,t.state,t.context)}catch(r){if(i=!1,n.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const f=n.__if;if(n.__if=!!i,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=H(t)),t.node&&(t.node.ref=t);const r=t.parent,a=r?.node;if(a&&t.node){let u=null;const y=Object.keys(r),d=y.indexOf(t.key);for(let p=d+1;p<y.length;p++){const _=r[y[p]];if(_?.node?.parentNode===a){u=_.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else tt(t,t.parent);q(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=ct(t)),N("Init",t,{}),t.node||(t.node=H(t)),!t.node)return;N("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,{});const r=c.if;delete c.if;try{B(t,c)}finally{c.if=r}q(t),it(t),at(t,{}),tt(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||T.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||M(s))continue;const i=t[s];n.__exec[s]=i;const f=t.tag||"div";if(U(f,s)&&!S[s]&&!(k&&k.has(s))){const r=s,a=A(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(r):typeof u!="function"&&typeof u!="object"&&(r==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(r,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}kt(t),Ct(t)}function q(t){const{node:c}=t;if(c){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?c.nodeValue=t.text:c.textContent=t.text:typeof t.text=="number"&&(c.textContent=t.text),Et(t),typeof t.html=="string"&&(c.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in c){const n=String(t.value);c.value!==n&&(c.value=n)}if(t.style&&typeof t.style=="object"&&F(c,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const e=t.attr[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||c.setAttribute&&c.setAttribute(n,e===!0?"":e)}if(t.data&&typeof t.data=="object")for(const n in t.data){const e=t.data[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||c.dataset&&(c.dataset[n]=e===!0?"":e)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(e=>e&&c.classList.add(e));else if(typeof n=="object")for(const e in n){const s=typeof n[e]=="function"?n[e](t,t.state,t.context):n[e];s&&c.classList.add(typeof s=="string"?s:e)}}}}function rt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function F(t,c){if(!t||!c||!t.style)return;let n=null;for(const e in c){const s=c[e];if(s!=null){if(e.charAt(0)==="&"&&typeof s=="object"){n||(n={}),n[e]=s;continue}try{const o=String(s),i=e.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),f=o.trim(),r=/\s*!important\s*$/.test(f),a=f.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&St(t,n)}let jt=0;function St(t,c){const n=`_ds${jt++}`;t.classList.add(n);const e=t.ownerDocument;let s=e.querySelector("style[data-smbls-scoped]");s||(s=e.createElement("style"),s.setAttribute("data-smbls-scoped",""),e.head.appendChild(s));let o="";for(const i in c){const f="."+n,r=i.replace(/&/g,f).split(",").map(u=>{const y=u.trim();return y.includes(f)?y:f+y}).join(", "),a=c[i];if(typeof a=="object"){let u="",y="";for(const d in a){const p=a[d];if(typeof p=="object"){const _=d.includes("&")?r.split(", ").map(l=>d.replace(/&/g,l)).join(", "):r.split(", ").map(l=>`${l} ${d}`).join(", ");let h="";for(const l in p)h+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${p[l]};`;y+=`${_} { ${h} }
|
|
4
|
+
`):"")}}if(tt(o,c,s),c&&(c[o.key]=o,c.__ref?.__children&&(c.__ref.__children.includes(o.key)||c.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML){const h=o.context?.designSystem;h&&O(h);try{const l=o.html(o,o.state,o.context);l!=null&&typeof l!="function"&&(o.node.innerHTML=l)}catch{}finally{h&&L()}}if(N("Create",o,e),N("Complete",o,e),N("Render",o,e),N("RenderRouter",o,e),typeof o.onFrame=="function"){const h=o.onFrame,l=o.context?.designSystem,g=()=>{if(o.node){if(o.node.isConnected){l&&O(l);try{h(o,o.state,o.context)}catch(b){console.error("[DOMQL] onFrame error:",b)}finally{l&&L()}}requestAnimationFrame(g)}};requestAnimationFrame(g)}return o}function At(t,c,n){const e=!c,s=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=e&&s&&t.context?.state,i=n.state!==void 0&&!o?n.state:t.state&&!R(t.state)?t.state:void 0;if(i==null){if(c?.state)t.state=c.state,I(t,t.state);else if(t.context?.state){const f=t.context.state,r={...f},a=t.context?.polyglot;if(a?.translations){const u=f.lang||a.defaultLang||"en",y=a.translations[u];if(y&&typeof y=="object")for(const p in y)r[p]===void 0&&(r[p]=y[p]);const d=new Set(a.languages||[]);for(const p in a.translations)!d.has(p)&&r[p]===void 0&&(r[p]=a.translations[p])}t.state=R(r)?r:W(r),t.state.__element=t,t.state.root=t.state,I(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),I(t,t.state);return}if(typeof i=="string"){if(t.state=nt(i,c),t.state&&typeof t.state=="object"&&!R(t.state)){const f=c?.state?.root||c?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}I(t,t.state);return}if(typeof i=="function"){const f=i(t,c?.state);t.state=R(f)?f:W(f||{})}else R(i)?t.state=i:t.state=W({...i});t.state.__element=t,c?.state?(t.state.parent=c.state,t.state.root=c.state.root||c.state):t.state.root=t.state,I(t,t.state)}function z(t,c){if(!c)return t;const n=c.split("/");let e=t;for(const s of n){if(e==null)return{};e=e[s]}return e??{}}function nt(t,c){if(!c)return{};if(t===".")return c.state||{};if(t.startsWith("../")){const s=t.slice(3);return s?z(c.state,s):c.state??{}}if(t.startsWith("~/")){const s=c.state?.root||c.state,o=t.slice(2);return o?z(s,o):s??{}}if(c.state?.[t]!==void 0)return c.state[t];const n=z(c.state,t);if(n!=null&&Object.keys(n).length>0)return n;const e=c.context?.polyglot;if(e?.translations){const s=c.state?.root?.lang||e.defaultLang||"en",o=e.translations[s];if(o?.[t]!==void 0)return o[t];if(e.translations[t]!==void 0)return e.translations[t]}return{}}function vt(t){const c=t.__ref,n=t.tag||"div",e=t.context?.designSystem,s=[],o=Object.keys(t);for(let i=0;i<o.length;i++){const f=o[i];if(typeof t[f]!="function"||T.has(f))continue;const r=f.charCodeAt(0);r>=65&&r<=90||M(f)||k[f]||S&&S.has(f)||U(n,f)||s.push({prop:f,fn:t[f]})}for(let i=0;i<s.length;i++){const{prop:f,fn:r}=s[i];c.__exec[f]=r,Object.defineProperty(t,f,{get(){e&&O(e);try{return r(t,t.state,t.context)}catch{return}finally{e&&L()}},set(a){delete c.__exec[f],Object.defineProperty(t,f,{value:a,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function B(t,c){const n=t.__ref;if(vt(t),typeof t.text=="function"){const s=t.text,o=A(()=>{if(!n.contentManaged)try{let i=s(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&typeof i!="object"&&(typeof i=="string"&&i.includes("{{")&&(i=Y.call(t,i,t.state)),t.tag==="string"?t.node.nodeValue=i:t.node.textContent=i)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=A(()=>{if(n.contentManaged)return;const i=Y.call(t,s,t.state);i!=null&&(t.text=i),t.node&&(t.tag==="string"?t.node.nodeValue=i??"":t.node.textContent=i??"")},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&typeof t[s]=="function"&&!T.has(s)&&!M(s)&&!n.__exec[s]){if(k[s]){const o=t[s],i=s;let f;const r=A(()=>{const a=t.context?.designSystem;a&&O(a);try{const u=o(t,t.state,t.context),y=k[i](u,t,t.state,t.context);if(y&&t.node){const d=rt(y);(d===null||d!==f)&&(f=d,F(t.node,y))}else t.node&&(i==="show"||i==="hide")&&(f=void 0,t.node.style.display="")}finally{a&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec[s]=o}else if(S&&S.has(s)){const o=t[s],i=s;let f;const r=A(()=>{const a=t.context?.designSystem;a&&O(a);try{const u=o(t,t.state,t.context);if(t.node)if(u!=null){const y=i+":"+String(u);y!==f&&(f=y,F(t.node,{[i]:u}))}else f=void 0,t.node.style[i]=""}finally{a&&L()}},{depth:n.path.length});n.__effects.push(r),n.__exec[s]=o}}if(typeof c.html=="function"){const s=c.html,o=A(()=>{const i=t.context?.designSystem;i&&O(i);try{const f=s(t,t.state,t.context);t.node&&f!=null&&typeof f!="function"&&(t.node.innerHTML=f)}finally{i&&L()}},{depth:n.path.length});n.__effects.push(o),n.__exec.html=s}if(typeof c.value=="function"){const s=c.value,o=A(()=>{try{const i=s(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=i==null?"":String(i);if(t.node.value===f)return;const r=typeof document<"u"&&document.activeElement===t.node,a=r&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,u=r&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,r&&a!=null&&u!=null)try{t.node.setSelectionRange(a,u)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=s}if(typeof c.style=="function"){const s=c.style;let o;const i=A(()=>{const f=s(t,t.state,t.context),r=rt(f);(r===null||r!==o)&&(o=r,F(t.node,f))},{depth:n.path.length});n.__effects.push(i),n.__exec.style=s}else if(t.style&&typeof t.style=="object")for(const s in t.style){const o=t.style[s];if(typeof o!="function")continue;let i;const f=A(()=>{try{const r=o(t,t.state,t.context);if(t.node){const a=s+":"+String(r);a!==i&&(i=a,F(t.node,{[s]:r}))}}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.attr&&typeof t.attr=="object"){for(const s in t.attr)if(typeof t.attr[s]=="function"){const o=t.attr[s],i=s,f=A(()=>{try{const r=o(t,t.state,t.context);t.node?.setAttribute&&(r==null||r===!1?t.node.removeAttribute(i):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(i,r===!0?"":r))}catch{}},{depth:n.path.length});n.__effects.push(f)}}if(t.aria&&typeof t.aria=="object")for(const s in t.aria){const o=t.aria[s];if(typeof o!="function")continue;const i="aria-"+s.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),f=A(()=>{try{const r=o(t,t.state,t.context);if(!t.node?.setAttribute)return;r==null||r===!1?t.node.removeAttribute(i):typeof r!="function"&&typeof r!="object"&&t.node.setAttribute(i,r===!0?"":r)}catch{}},{depth:n.path.length});n.__effects.push(f)}if(t.data&&typeof t.data=="object")for(const s in t.data){const o=t.data[s];if(typeof o!="function")continue;const f="data-"+s.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),r=A(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(f):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(f,a===!0?"":a)}catch{}},{depth:n.path.length});n.__effects.push(r)}const e=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(e)for(const s in e){const o=e[s];if(typeof o!="function")continue;const i=A(()=>{try{const f=o(t,t.state,t.context);if(!t.node?.classList)return;typeof f=="string"?t.node.classList.add(f):f?t.node.classList.add(s):t.node.classList.remove(s)}catch{}},{depth:n.path.length});n.__effects.push(i)}if(typeof c.if=="function"){const s=c.if,o=A(()=>{let i;try{i=s(t,t.state,t.context)}catch(r){if(i=!1,n.__ifError=r,typeof console<"u"&&console.warn){const a=t.key||t.tag||"?";console.warn(`[smbls] \`if:\` reactive effect threw on ${a} \u2014 treating as false:`,r?.message||r)}return}const f=n.__if;if(n.__if=!!i,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=H(t)),t.node&&(t.node.ref=t);const r=t.parent,a=r?.node;if(a&&t.node){let u=null;const y=Object.keys(r),d=y.indexOf(t.key);for(let p=d+1;p<y.length;p++){const _=r[y[p]];if(_?.node?.parentNode===a){u=_.node;break}}u?a.insertBefore(t.node,u):a.appendChild(t.node)}else tt(t,t.parent);q(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=ct(t)),N("Init",t,{}),t.node||(t.node=H(t)),!t.node)return;N("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,{});const r=c.if;delete c.if;try{B(t,c)}finally{c.if=r}q(t),it(t),at(t,{}),tt(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||T.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||M(s))continue;const i=t[s];n.__exec[s]=i;const f=t.tag||"div";if(U(f,s)&&!k[s]&&!(S&&S.has(s))){const r=s,a=A(()=>{try{const u=i(t,t.state,t.context);t.node?.setAttribute&&(u==null||u===!1?t.node.removeAttribute(r):typeof u!="function"&&typeof u!="object"&&(r==="src"&&"src"in t.node?t.node.src=u:t.node.setAttribute(r,u===!0?"":u)))}catch{}},{depth:n.path.length});n.__effects.push(a)}}St(t),Ct(t)}function q(t){const{node:c}=t;if(c){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?c.nodeValue=t.text:c.textContent=t.text:typeof t.text=="number"&&(c.textContent=t.text),Et(t),typeof t.html=="string"&&(c.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in c){const n=String(t.value);c.value!==n&&(c.value=n)}if(t.style&&typeof t.style=="object"&&F(c,t.style),t.attr&&typeof t.attr=="object")for(const n in t.attr){const e=t.attr[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||c.setAttribute&&c.setAttribute(n,e===!0?"":e)}if(t.data&&typeof t.data=="object")for(const n in t.data){const e=t.data[n];typeof e=="function"||typeof e=="object"||e==null||e===!1||c.dataset&&(c.dataset[n]=e===!0?"":e)}if(t.classlist||t.class){const n=t.classlist||t.class;if(typeof n=="string")n.split(" ").forEach(e=>e&&c.classList.add(e));else if(typeof n=="object")for(const e in n){const s=typeof n[e]=="function"?n[e](t,t.state,t.context):n[e];s&&c.classList.add(typeof s=="string"?s:e)}}}}function rt(t){if(t==null||typeof t!="object")return"s:"+String(t);try{return"o:"+JSON.stringify(t)}catch{return null}}function F(t,c){if(!t||!c||!t.style)return;let n=null;for(const e in c){const s=c[e];if(s!=null){if(e.charAt(0)==="&"&&typeof s=="object"){n||(n={}),n[e]=s;continue}try{const o=String(s),i=e.replace(/[A-Z]/g,u=>"-"+u.toLowerCase()),f=o.trim(),r=/\s*!important\s*$/.test(f),a=f.replace(/\s*!important\s*$/,"");t.style.setProperty(i,a,r?"important":"")}catch{}}}n&&kt(t,n)}let jt=0;function kt(t,c){const n=`_ds${jt++}`;t.classList.add(n);const e=t.ownerDocument;let s=e.querySelector("style[data-smbls-scoped]");s||(s=e.createElement("style"),s.setAttribute("data-smbls-scoped",""),e.head.appendChild(s));let o="";for(const i in c){const f="."+n,r=i.replace(/&/g,f).split(",").map(u=>{const y=u.trim();return y.includes(f)?y:f+y}).join(", "),a=c[i];if(typeof a=="object"){let u="",y="";for(const d in a){const p=a[d];if(typeof p=="object"){const _=d.includes("&")?r.split(", ").map(l=>d.replace(/&/g,l)).join(", "):r.split(", ").map(l=>`${l} ${d}`).join(", ");let h="";for(const l in p)h+=`${l.replace(/[A-Z]/g,g=>"-"+g.toLowerCase())}: ${p[l]};`;y+=`${_} { ${h} }
|
|
5
5
|
`}else u+=`${d.replace(/[A-Z]/g,_=>"-"+_.toLowerCase())}: ${p};`}u&&(o+=`${r} { ${u} }
|
|
6
|
-
`),y&&(o+=y)}}o&&(s.textContent+=o)}function kt(t){const c=t.subscribeTo;if(!Array.isArray(c)||c.length===0)return;const n=t.__ref;for(let e=0;e<c.length;e++){const s=c[e];if(typeof s!="string"||s.length===0)continue;const o=s.split("."),i=o[0],f=o.slice(1),r={value:!1},a=A(()=>{const u=t.state&&(R(t.state)?t.state.root:null);if(!u||!R(u))return;let y=u;y=y[i];for(let d=0;d<f.length&&!(y==null||typeof y!="object");d++)if(R(y))y=y[f[d]];else break;if(r.value&&typeof t.onUpdate=="function"){const d=t.context?.designSystem;d&&O(d);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&G("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{d&&L()}}},{depth:n.path.length});r.value=!0,n.__effects.push(a)}}function Ct(t){const c=t.__ref;c.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const e=n.charAt(0);if(e!=="."&&e!=="!")continue;const s=n.slice(1);if(!s)continue;const o=t[n];if(!o||typeof o!="object")continue;const i=e==="!",f={lastMatch:!1,appliedKeys:null},r=()=>{if(!t.node)return;let u;const y=t[s];if(y===void 0)if(t.state&&s in t.state)u=t.state[s];else{const _=t.context?.cases?.[s];if(_===void 0)return;try{u=typeof _=="function"?_.call(t,t):_}catch(h){u=!1,c.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof y=="function")try{u=y(t,t.state,t.context)}catch(_){u=!1,c.__conditionalError=_,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,_?.message||_)}else u=y;const d=i?!u:!!u;if(d===f.lastMatch)return;f.lastMatch=d;const p=t.context?.designSystem;p&&O(p);try{if(d){const _={};for(const l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;const g=typeof o[l]=="function"?o[l](t,t.state,t.context):o[l];if(g!=null)if(S[l]){const b=S[l](g,t,t.state,t.context);if(b){const C=Array.isArray(b)?b:[b];for(const E of C)E&&Object.assign(_,E)}}else k&&k.has(l)&&(_[l]=g)}const h=Object.keys(_);h.length?(F(t.node,_),f.appliedKeys=h):f.appliedKeys=null}else if(f.appliedKeys){for(const _ of f.appliedKeys)t.node.style[_]="";f.appliedKeys=null}}finally{p&&L()}};c.__conditionalRunners.push(r);const a=A(r,{depth:c.path.length});c.__effects.push(a)}}const X=new WeakSet;function wt(t){const c=t.ownerDocument;!c||X.has(c)||(X.add(c),queueMicrotask(()=>{X.delete(c);const n=c.body||c.documentElement;n&&n.offsetWidth}))}const Q=new WeakSet;function Et(t){const{node:c}=t;if(!c)return;if(Q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Q.add(t);const n=t.context?.designSystem;n&&O(n);try{const e={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||T.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!M(o)){if(S[o]){const f=t[o],r=S[o](f,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(e,a);else Object.assign(e,r);s=!0}}else if(k&&k.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(e[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(e[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(e[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const r={};for(const a in f){let u=f[a];if(typeof u=="function"&&(u=u(t,t.state,t.context)),!(u==null||typeof u=="function"))if(S[a]){const y=S[a](u,t,t.state,t.context);if(y)if(Array.isArray(y))for(const d of y)d&&Object.assign(r,d);else Object.assign(r,y)}else r[a]=u}if(Object.keys(r).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const u={};for(const d in r){const p=r[d];u[d]=typeof p=="string"&&!p.includes("!important")?p+" !important":p}const y=o.slice(1);e[`[data-theme="${y}"] &`]=u}else{let u=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=o.slice(1),p=t.context?.designSystem?.media?.[d]||t.context?.designSystem?.media?.[d];p&&(u=`@media ${p}`)}const y={};for(const d in r){const p=r[d];if(p&&typeof p=="object"&&!Array.isArray(p)){const _={};for(const l in p)if(S[l]){const g=S[l](p[l],t,t.state,t.context);if(g)if(Array.isArray(g))for(const b of g)b&&Object.assign(_,b);else Object.assign(_,g)}else _[l]=p[l];const h=d.startsWith(":")?"":" ";if(u.includes(",")){const l=u.split(",").map(g=>`${g.trim()}${h}${d}`).join(", ");e[l]=_}else e[`${u}${h}${d}`]=_}else y[d]=p}Object.keys(y).length&&(e[u]=y)}s=!0}s=!0}}}}if(s){e.display&&String(e.display).includes("!important")&&(c.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const o=ht(e,null,t.context?.cssPrefix);if(o&&c.classList){const f=o.split(" ").filter(Boolean);let r=!1;for(const a of f)c.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&wt(c)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const f=e.display;if(f&&f!==i)if(i==="none"){const r=[];for(const a of c.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)c.classList.remove(a);c.classList.add("_d-none")}else c.style.display=t.display}}}finally{n&&L(),Q.delete(t)}}function it(t){const{node:c}=t;if(!c||!c.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const s in t.aria){const o=t.aria[s];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+s.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());c.setAttribute(i,o===!0?"":o)}const n=_t(t);for(const s in n){const o=n[s];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&c.setAttribute(s,o===!0?"":o)}const e=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||T.has(s)||s==="on"||n[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!M(s)&&!(S[s]||k&&k.has(s))&&U(e,s)){let i=t[s];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=Y(i,t,t.state,t.context),t[s]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;c.setAttribute(s,i===!0?"":i)}}}function Pt(t){if(!t.autoGrow)return;const c=t.node;if(!c||c.tagName!=="TEXTAREA")return;const n=t.autoGrow,e=n&&typeof n=="object"&&n.max?String(n.max):null;e&&(c.style.maxHeight=e);const s=()=>{c.style.height="auto",c.style.height=c.scrollHeight+"px"};s(),c.addEventListener("input",s),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{c.removeEventListener("input",s)}catch{}})}const et=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function ft(t,c){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!M(n)||et.has(n))continue;let e=t[n];if(typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const o=e;e=function(f){return t.call(o,f)}}if(typeof e!="function")continue;const s=bt(n);dt.has(s)||pt(xt(s),t,e)}Ot(t)}function Ot(t){const c=t.node;if(!c||!c.addEventListener)return;const n={};let e=!1;for(const d of et){const p=t[d];typeof p=="function"&&(n[d]=p,e=!0)}if(!e)return;const s=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,f=0,r=0,a=!1;const u=d=>{const p=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];p&&(i=p.clientX,f=p.clientY,r=Date.now(),a=!0)},y=d=>{if(!a)return;a=!1;const p=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!p)return;const _=p.clientX-i,h=p.clientY-f,l=Date.now()-r;if(l>o)return;const g=Math.abs(_),b=Math.abs(h);if(Math.max(g,b)<s)return;let C;if(g>b*1.2)C=_<0?"left":"right";else if(b>g*1.2)C=h<0?"up":"down";else return;const E="onSwipe"+C.charAt(0).toUpperCase()+C.slice(1),v=n[E],j=n.onSwipe;v&&v.call(t,d,t,t.state,t.context),j&&j.call(t,{direction:C,dx:_,dy:h,dt:l,event:d},t,t.state,t.context)};c.addEventListener("touchstart",u,{passive:!0}),c.addEventListener("touchend",y,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{c.removeEventListener("touchstart",u)}catch{}try{c.removeEventListener("touchend",y)}catch{}})}function J(t,c){const n={...t};for(const e in c){const s=n[e],o=c[e];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[e]=J(s,o):n[e]=o}return n}function m(t,c,n){if(!c||!t.node)return;const e=t.childExtends;if(Array.isArray(c)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const i=t.childProps,f=t.childrenAs;for(let r=0;r<c.length;r++){let a=c[r];const u=a;(typeof a=="string"||typeof a=="number")&&(a={text:a});let y=i;if(typeof i=="function")try{y=i(t,a)}catch{y=null}if(f==="state"){let _=u;(typeof u=="string"||typeof u=="number")&&(_={value:u,text:u}),a=y?{...y,state:_}:{state:_}}else y&&(a=J(y,a));if(e&&!a.ignoreChildExtends)if(a.extends){const _=Array.isArray(a.extends)?a.extends:[a.extends],h=Array.isArray(e)?e:[e];a={...a,extends:[...h,..._]}}else a={extends:e,...a};const d=a?.key||`${r}`,p=K(a,t,d,n);p?.node&&o.appendChild(p.node)}t.node.appendChild(o);return}if(typeof c=="string"){const s=nt(c,t);if(Array.isArray(s)){m(t,s,n);return}}if(typeof c=="object")for(const s in c){if(T.has(s))continue;let o=c[s];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=J(t.childProps,o)),e&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(e)?e:[e];o={...o,extends:[...f,...i]}}else o={extends:e,...o};K(o,t,s,n)}}}function at(t,c){let{children:n,content:e}=t;const s=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const f=t.__ref;let r=!1;const a=A(()=>{const u=i(t,t.state,t.context);if(!r){r=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const p=t.childProps,_=[],h=new Map;for(let v=0;v<u.length;v++){const j=u[v];let x=p;if(typeof p=="function")try{x=p(t,j)}catch{x=null}const D=x&&x.key||j&&j.key||`${v}`;_.push(D),h.set(D,{rawChild:j,childProps:x})}const l=new Set(_),g=f.__children.slice();for(const v of g)if(!l.has(v)){const j=t[v];j?.remove&&j.remove(),delete t[v]}const b=t.childExtends,E=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const v of _){const j=h.get(v),x=j.rawChild,D=t[v];if(D&&D.state){if(x&&typeof x=="object"){const $=D.state;if(typeof $.replace=="function")$.replace(x);else if(typeof $.update=="function"){for(const w in $)if(!(w==="__element"||w==="root"||w==="parent"||w==="update")&&!Object.prototype.hasOwnProperty.call(x,w))try{$[w]=void 0}catch{}$.update(x)}else for(const w in x)$[w]=x[w]}continue}let V=x;(typeof x=="string"||typeof x=="number")&&(V={value:x,text:x});const ot=j.childProps;let P=ot?{...ot,state:V}:{state:V};if(b&&!P.ignoreChildExtends)if(P.extends){const $=Array.isArray(P.extends)?P.extends:[P.extends],w=Array.isArray(b)?b:[b];P={...P,extends:[...w,...$]}}else P={extends:b,...P};const st=K(P,t,v,c);st?.node&&E&&E.appendChild(st.node)}E&&E.childNodes.length&&t.node&&t.node.appendChild(E),f.__children=_;return}for(const p of[...f.__children]){const _=t[p];_?.remove&&_.remove(),delete t[p]}f.__children=[],m(t,u,c)},{depth:f.path.length});f.__effects.push(a)}if(m(t,n||e,c),n||e)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let f=0;f<i.length;f++){const r=i[f];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 u={extends:t[r]};delete t[r];for(let y=f+1;y<i.length;y++){const d=i[y],p=d.charCodeAt(0);if(p>=65&&p<=90||T.has(d)||typeof t[d]=="function"&&(d.startsWith("on")||d.startsWith(".")))break;const _=t[d];_!==void 0&&(u[d]=_,delete t[d])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||T.has(i)||typeof t[i]!="object"||t[i]===null)continue;const f=i.charCodeAt(0);if(f<65||f>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={extends:a,...r})}if(t.childProps&&(r={...t.childProps,...r}),s&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(s)?s:[s];r={...r,extends:[...u,...a]}}else r={extends:s,...r};K(r,t,i,c)}}}function tt(t,c,n){const{node:e}=t;if(!e)return;e.ref=t;const s=c?.node||(c?.nodeType?c:null);if(s)if(n?.position==="before"&&n.node)s.insertBefore(e,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?s.insertBefore(e,o):s.appendChild(e)}else s.appendChild(e)}function N(t,c,n){const e=t.charAt(0).toLowerCase()+t.slice(1);c.context?.plugins?.length&&G(e,c,n);const s="on"+t,o=c[s];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(c.__ref.__inRender)return!0;c.__ref.__inRender=!0}const f=c.context?.designSystem;f&&O(f);try{if(o(c,c.state,c.context,n)===!1)return!1}catch(r){if(c.context?.plugins?.length&&G("error",c,{hook:s,error:r})||console.error(`[DOMQL] Lifecycle "${s}" error:`,r),c.context?.strictMode)throw r}finally{f&&L(),i&&(c.__ref.__inRender=!1)}}return!0}var qt=K;export{K as create,qt as default};
|
|
6
|
+
`),y&&(o+=y)}}o&&(s.textContent+=o)}function St(t){const c=t.subscribeTo;if(!Array.isArray(c)||c.length===0)return;const n=t.__ref;for(let e=0;e<c.length;e++){const s=c[e];if(typeof s!="string"||s.length===0)continue;const o=s.split("."),i=o[0],f=o.slice(1),r={value:!1},a=A(()=>{const u=t.state&&(R(t.state)?t.state.root:null);if(!u||!R(u))return;let y=u;y=y[i];for(let d=0;d<f.length&&!(y==null||typeof y!="object");d++)if(R(y))y=y[f[d]];else break;if(r.value&&typeof t.onUpdate=="function"){const d=t.context?.designSystem;d&&O(d);try{t.onUpdate(t,t.state,t.context)}catch(p){t.context?.plugins?.length&&G("error",t,{hook:"onUpdate",error:p})||console.error("[DOMQL] subscribeTo onUpdate error:",p)}finally{d&&L()}}},{depth:n.path.length});r.value=!0,n.__effects.push(a)}}function Ct(t){const c=t.__ref;c.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const e=n.charAt(0);if(e!=="."&&e!=="!")continue;const s=n.slice(1);if(!s)continue;const o=t[n];if(!o||typeof o!="object")continue;const i=e==="!",f={lastMatch:!1,appliedKeys:null},r=()=>{if(!t.node)return;let u;const y=t[s];if(y===void 0)if(t.state&&s in t.state)u=t.state[s];else{const _=t.context?.cases?.[s];if(_===void 0)return;try{u=typeof _=="function"?_.call(t,t):_}catch(h){u=!1,c.__conditionalError=h,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` case fn threw on ${t.key||"?"} \u2014 treating as false:`,h?.message||h)}}else if(typeof y=="function")try{u=y(t,t.state,t.context)}catch(_){u=!1,c.__conditionalError=_,typeof console<"u"&&console.warn&&console.warn(`[smbls] conditional \`${n}\` predicate threw on ${t.key||"?"} \u2014 treating as false:`,_?.message||_)}else u=y;const d=i?!u:!!u;if(d===f.lastMatch)return;f.lastMatch=d;const p=t.context?.designSystem;p&&O(p);try{if(d){const _={};for(const l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;const g=typeof o[l]=="function"?o[l](t,t.state,t.context):o[l];if(g!=null)if(k[l]){const b=k[l](g,t,t.state,t.context);if(b){const C=Array.isArray(b)?b:[b];for(const E of C)E&&Object.assign(_,E)}}else S&&S.has(l)&&(_[l]=g)}const h=Object.keys(_);h.length?(F(t.node,_),f.appliedKeys=h):f.appliedKeys=null}else if(f.appliedKeys){for(const _ of f.appliedKeys)t.node.style[_]="";f.appliedKeys=null}}finally{p&&L()}};c.__conditionalRunners.push(r);const a=A(r,{depth:c.path.length});c.__effects.push(a)}}const X=new WeakSet;function wt(t){const c=t.ownerDocument;!c||X.has(c)||(X.add(c),queueMicrotask(()=>{X.delete(c);const n=c.body||c.documentElement;n&&n.offsetWidth}))}const Q=new WeakSet;function Et(t){const{node:c}=t;if(!c)return;if(Q.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Q.add(t);const n=t.context?.designSystem;n&&O(n);try{const e={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||T.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!M(o)){if(k[o]){const f=t[o],r=k[o](f,t,t.state,t.context);if(r){if(Array.isArray(r))for(const a of r)a&&Object.assign(e,a);else Object.assign(e,r);s=!0}}else if(S&&S.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(e[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(e[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(e[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const r={};for(const a in f){let u=f[a];if(typeof u=="function"&&(u=u(t,t.state,t.context)),!(u==null||typeof u=="function"))if(k[a]){const y=k[a](u,t,t.state,t.context);if(y)if(Array.isArray(y))for(const d of y)d&&Object.assign(r,d);else Object.assign(r,y)}else r[a]=u}if(Object.keys(r).length){if(o.length>1&&o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")&&!o.startsWith("@supports")&&(o==="@dark"||o==="@light"||!t.context?.designSystem?.media?.[o.slice(1)])){const u={};for(const d in r){const p=r[d];u[d]=typeof p=="string"&&!p.includes("!important")?p+" !important":p}const y=o.slice(1);e[`[data-theme="${y}"] &`]=u}else{let u=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const d=o.slice(1),p=t.context?.designSystem?.media?.[d]||t.context?.designSystem?.media?.[d];p&&(u=`@media ${p}`)}const y={};for(const d in r){const p=r[d];if(p&&typeof p=="object"&&!Array.isArray(p)){const _={};for(const l in p)if(k[l]){const g=k[l](p[l],t,t.state,t.context);if(g)if(Array.isArray(g))for(const b of g)b&&Object.assign(_,b);else Object.assign(_,g)}else _[l]=p[l];const h=d.startsWith(":")?"":" ";if(u.includes(",")){const l=u.split(",").map(g=>`${g.trim()}${h}${d}`).join(", ");e[l]=_}else e[`${u}${h}${d}`]=_}else y[d]=p}Object.keys(y).length&&(e[u]=y)}s=!0}s=!0}}}}if(s){e.display&&String(e.display).includes("!important")&&(c.style.setProperty("display",String(e.display).replace(/\s*!important\s*$/,""),"important"),delete e.display);const o=ht(e,null,t.context?.cssPrefix);if(o&&c.classList){const f=o.split(" ").filter(Boolean);let r=!1;for(const a of f)c.classList.add(a),r||(a.charCodeAt(0)===95&&a.charCodeAt(1)===99||a.charCodeAt(0)===95&&a.indexOf("_c",1)!==-1)&&(r=!0);r&&wt(c)}const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const f=e.display;if(f&&f!==i)if(i==="none"){const r=[];for(const a of c.classList)a.startsWith("_d-")&&a!=="_d-none"&&r.push(a);for(const a of r)c.classList.remove(a);c.classList.add("_d-none")}else c.style.display=t.display}}}finally{n&&L(),Q.delete(t)}}function it(t){const{node:c}=t;if(!c||!c.setAttribute)return;if(t.aria&&typeof t.aria=="object")for(const s in t.aria){const o=t.aria[s];if(typeof o=="function"||typeof o=="object"||o==null||o===!1)continue;const i="aria-"+s.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());c.setAttribute(i,o===!0?"":o)}const n=_t(t);for(const s in n){const o=n[s];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&c.setAttribute(s,o===!0?"":o)}const e=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||T.has(s)||s==="on"||n[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!M(s)&&!(k[s]||S&&S.has(s))&&U(e,s)){let i=t[s];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=Y(i,t,t.state,t.context),t[s]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;c.setAttribute(s,i===!0?"":i)}}}function Pt(t){if(!t.autoGrow)return;const c=t.node;if(!c||c.tagName!=="TEXTAREA")return;const n=t.autoGrow,e=n&&typeof n=="object"&&n.max?String(n.max):null;e&&(c.style.maxHeight=e);const s=()=>{c.style.height="auto",c.style.height=c.scrollHeight+"px"};s(),c.addEventListener("input",s),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{c.removeEventListener("input",s)}catch{}})}const et=new Set(["onSwipe","onSwipeLeft","onSwipeRight","onSwipeUp","onSwipeDown"]);function ft(t,c){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!M(n)||et.has(n))continue;let e=t[n];if(typeof e=="string"&&/^[A-Za-z_$][\w$]*$/.test(e)){const o=e;e=function(f){return t.call(o,f)}}if(typeof e!="function")continue;const s=bt(n);dt.has(s)||pt(xt(s),t,e)}Ot(t)}function Ot(t){const c=t.node;if(!c||!c.addEventListener)return;const n={};let e=!1;for(const d of et){const p=t[d];typeof p=="function"&&(n[d]=p,e=!0)}if(!e)return;const s=typeof t.swipeThreshold=="number"?t.swipeThreshold:40,o=typeof t.swipeMaxDuration=="number"?t.swipeMaxDuration:600;let i=0,f=0,r=0,a=!1;const u=d=>{const p=d.touches&&d.touches[0]||d.changedTouches&&d.changedTouches[0];p&&(i=p.clientX,f=p.clientY,r=Date.now(),a=!0)},y=d=>{if(!a)return;a=!1;const p=d.changedTouches&&d.changedTouches[0]||d.touches&&d.touches[0];if(!p)return;const _=p.clientX-i,h=p.clientY-f,l=Date.now()-r;if(l>o)return;const g=Math.abs(_),b=Math.abs(h);if(Math.max(g,b)<s)return;let C;if(g>b*1.2)C=_<0?"left":"right";else if(b>g*1.2)C=h<0?"up":"down";else return;const E="onSwipe"+C.charAt(0).toUpperCase()+C.slice(1),v=n[E],j=n.onSwipe;v&&v.call(t,d,t,t.state,t.context),j&&j.call(t,{direction:C,dx:_,dy:h,dt:l,event:d},t,t.state,t.context)};c.addEventListener("touchstart",u,{passive:!0}),c.addEventListener("touchend",y,{passive:!0}),t.__ref.__eventCleanup||(t.__ref.__eventCleanup=[]),t.__ref.__eventCleanup.push(()=>{try{c.removeEventListener("touchstart",u)}catch{}try{c.removeEventListener("touchend",y)}catch{}})}function J(t,c){const n={...t};for(const e in c){const s=n[e],o=c[e];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[e]=J(s,o):n[e]=o}return n}function m(t,c,n){if(!c||!t.node)return;const e=t.childExtends;if(Array.isArray(c)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const i=t.childProps,f=t.childrenAs;for(let r=0;r<c.length;r++){let a=c[r];const u=a;(typeof a=="string"||typeof a=="number")&&(a={text:a});let y=i;if(typeof i=="function")try{y=i(t,a)}catch{y=null}if(f==="state"){let _=u;(typeof u=="string"||typeof u=="number")&&(_={value:u,text:u}),a=y?{...y,state:_}:{state:_}}else y&&(a=J(y,a));if(e&&!a.ignoreChildExtends)if(a.extends){const _=Array.isArray(a.extends)?a.extends:[a.extends],h=Array.isArray(e)?e:[e];a={...a,extends:[...h,..._]}}else a={extends:e,...a};const d=a?.key||u&&typeof u=="object"&&u.key||`${r}`,p=K(a,t,d,n);p?.node&&o.appendChild(p.node)}t.node.appendChild(o);return}if(typeof c=="string"){const s=nt(c,t);if(Array.isArray(s)){m(t,s,n);return}}if(typeof c=="object")for(const s in c){if(T.has(s))continue;let o=c[s];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=J(t.childProps,o)),e&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(e)?e:[e];o={...o,extends:[...f,...i]}}else o={extends:e,...o};K(o,t,s,n)}}}function at(t,c){let{children:n,content:e}=t;const s=t.childExtends;if(typeof n=="function"){const i=n;n=i(t,t.state,t.context),t.children=n;const f=t.__ref;let r=!1;const a=A(()=>{const u=i(t,t.state,t.context);if(!r){r=!0;return}if(u===t.children)return;if(t.children=u,Array.isArray(u)&&t.childrenAs==="state"){const p=t.childProps,_=[],h=new Map;for(let v=0;v<u.length;v++){const j=u[v];let x=p;if(typeof p=="function")try{x=p(t,j)}catch{x=null}const D=x&&x.key||j&&j.key||`${v}`;_.push(D),h.set(D,{rawChild:j,childProps:x})}const l=new Set(_),g=f.__children.slice();for(const v of g)if(!l.has(v)){const j=t[v];j?.remove&&j.remove(),delete t[v]}const b=t.childExtends,E=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const v of _){const j=h.get(v),x=j.rawChild,D=t[v];if(D&&D.state){if(x&&typeof x=="object"){const $=D.state;if(typeof $.replace=="function")$.replace(x);else if(typeof $.update=="function"){for(const w in $)if(!(w==="__element"||w==="root"||w==="parent"||w==="update")&&!Object.prototype.hasOwnProperty.call(x,w))try{$[w]=void 0}catch{}$.update(x)}else for(const w in x)$[w]=x[w]}continue}let V=x;(typeof x=="string"||typeof x=="number")&&(V={value:x,text:x});const ot=j.childProps;let P=ot?{...ot,state:V}:{state:V};if(b&&!P.ignoreChildExtends)if(P.extends){const $=Array.isArray(P.extends)?P.extends:[P.extends],w=Array.isArray(b)?b:[b];P={...P,extends:[...w,...$]}}else P={extends:b,...P};const st=K(P,t,v,c);st?.node&&E&&E.appendChild(st.node)}E&&E.childNodes.length&&t.node&&t.node.appendChild(E),f.__children=_;return}for(const p of[...f.__children]){const _=t[p];_?.remove&&_.remove(),delete t[p]}f.__children=[],m(t,u,c)},{depth:f.path.length});f.__effects.push(a)}if(m(t,n||e,c),n||e)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let f=0;f<i.length;f++){const r=i[f];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 u={extends:t[r]};delete t[r];for(let y=f+1;y<i.length;y++){const d=i[y],p=d.charCodeAt(0);if(p>=65&&p<=90||T.has(d)||typeof t[d]=="function"&&(d.startsWith("on")||d.startsWith(".")))break;const _=t[d];_!==void 0&&(u[d]=_,delete t[d])}t[a]&&typeof t[a]=="object"?t[a]={...u,...t[a]}:t[a]=u}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||T.has(i)||typeof t[i]!="object"||t[i]===null)continue;const f=i.charCodeAt(0);if(f<65||f>90)continue;let r=t[i];if(!r.__ref){if(!r.extends&&!r.extend){const a=o[i]||o[`smbls.${i}`];a&&(r={extends:a,...r})}if(t.childProps&&(r={...t.childProps,...r}),s&&!r.ignoreChildExtends)if(r.extends){const a=Array.isArray(r.extends)?r.extends:[r.extends],u=Array.isArray(s)?s:[s];r={...r,extends:[...u,...a]}}else r={extends:s,...r};K(r,t,i,c)}}}function tt(t,c,n){const{node:e}=t;if(!e)return;e.ref=t;const s=c?.node||(c?.nodeType?c:null);if(s)if(n?.position==="before"&&n.node)s.insertBefore(e,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?s.insertBefore(e,o):s.appendChild(e)}else s.appendChild(e)}function N(t,c,n){const e=t.charAt(0).toLowerCase()+t.slice(1);c.context?.plugins?.length&&G(e,c,n);const s="on"+t,o=c[s];if(typeof o=="function"){const i=t==="Render"||t==="RenderRouter";if(i){if(c.__ref.__inRender)return!0;c.__ref.__inRender=!0}const f=c.context?.designSystem;f&&O(f);try{if(o(c,c.state,c.context,n)===!1)return!1}catch(r){if(c.context?.plugins?.length&&G("error",c,{hook:s,error:r})||console.error(`[DOMQL] Lifecycle "${s}" error:`,r),c.context?.strictMode)throw r}finally{f&&L(),i&&(c.__ref.__inRender=!1)}}return!0}var qt=K;export{K as create,qt as default};
|