@symbo.ls/element 3.14.11 → 3.14.13
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 +22 -0
- package/dist/cjs/src/create.js +3 -3
- package/dist/cjs/src/methods.js +1 -1
- package/dist/esm/src/create.js +3 -3
- package/dist/esm/src/methods.js +1 -1
- package/index.js +1 -0
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @symbo.ls/element
|
|
2
2
|
|
|
3
|
+
## 3.14.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Auto-generated cross-repo patch release.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @symbo.ls/utils@3.14.14
|
|
10
|
+
|
|
11
|
+
## 3.14.12
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Manual patch bump triggered via workflow_dispatch (scope: @symbo.ls).
|
|
16
|
+
No source change behind this bump — released to refresh dist or
|
|
17
|
+
coordinate a cross-package version line.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @symbo.ls/signal@3.14.9
|
|
20
|
+
- @symbo.ls/state@3.14.10
|
|
21
|
+
- @symbo.ls/utils@3.14.11
|
|
22
|
+
- attrs-in-props@3.14.7
|
|
23
|
+
- css-in-props@3.14.7
|
|
24
|
+
|
|
3
25
|
## 3.14.11
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/cjs/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var H=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var ut=(t,c)=>{for(var n in c)H(t,n,{get:c[n],enumerable:!0})},pt=(t,c,n,i)=>{if(c&&typeof c=="object"||typeof c=="function")for(let s of et(c))!dt.call(t,s)&&s!==n&&H(t,s,{get:()=>c[s],enumerable:!(i=at(c,s))||i.enumerable});return t};var yt=t=>pt(H({},"__esModule",{value:!0}),t);var kt={};ut(kt,{create:()=>N,default:()=>Ct});module.exports=yt(kt);var $=require("@symbo.ls/signal"),j=require("@symbo.ls/signal"),R=require("./cache.js"),S=require("./registry.js"),nt=require("./delegate.js"),it=require("./extends.js"),rt=require("./methods.js"),Pt=require("./dispose.js"),V=require("@symbo.ls/utils"),J=require("@symbo.ls/utils/function.js"),I=require("@symbo.ls/state"),g=require("css-in-props"),ft=require("@symbo.ls/css"),v=require("@symbo.ls/scratch"),K=require("attrs-in-props");let lt=1;function F(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function ht(t){return t.charAt(2).toLowerCase()+t.slice(3)}function bt(t){return t.toLowerCase()}function Z(t,c){const n={...t};for(const i in c){const s=n[i],o=c[i];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[i]=Z(s,o):n[i]=o}return n}function N(t,c,n,i={},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||`_${lt++}`,o.parent=c||null,o.context=t.context||c?.context||i.context||{},o.context.__create||(o.context.__create=N);const r=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 p=n.indexOf("_");if(p>0){const y=n.substring(0,p),x=o.context?.components;x&&(x[y]||x["smbls."+y])&&(t={extends:y,...t})}}(0,it.applyExtends)(o,t,i);const f=new Set(["childProps","attr","style","scope","data"]),a=o.props&&typeof o.props=="object"?o.props:null;for(const p in t){if(p==="parent"||p==="node"||p==="__ref"||p==="extends"||p==="context"||p==="props")continue;const y=t[p],x=o[p],_=x&&y&&typeof x=="object"&&typeof y=="object"&&!Array.isArray(x)&&!Array.isArray(y)&&typeof x!="function"&&typeof y!="function";_&&p.charCodeAt(0)>=65&&p.charCodeAt(0)<=90?o[p]=Z(x,y):_&&f.has(p)?o[p]={...x,...y}:o[p]=y}function e(p){for(const y in p){const x=p[y],_=o[y],M=_&&x&&typeof _=="object"&&typeof x=="object"&&!Array.isArray(_)&&!Array.isArray(x)&&typeof _!="function"&&typeof x!="function";M&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?o[y]=Z(_,x):M&&f.has(y)?o[y]={..._,...x}:o[y]=x}}a&&e(a),t.props&&typeof t.props=="object"&&e(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const d=o.scope&&typeof o.scope=="object"?o.scope:null,h=c?.scope,b=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,u=h||(b?Object.create(b):null);if(t.scope!==void 0||d){const p=u?Object.create(u):{};d&&Object.assign(p,d),t.scope!==void 0&&Object.assign(p,t.scope),o.scope=p}else u&&(o.scope=Object.create(u));if(t.if!==void 0&&(o.if=t.if),(0,rt.addMethods)(o),xt(o,c,t),o.if!=null){const p=typeof o.if=="function"?o.if(o,o.state,o.context):o.if;r.__if=!!p}if(r.__if)typeof t.if=="function"&&(r.__ifInitialized=!0);else return c&&(c[o.key]=o),typeof t.if=="function"&&B(o,{if:t.if}),o;o.tag||(o.tag=(0,R.detectTag)(o)),L("Init",o,i);const l=o.node=(0,R.cacheNode)(o);if(!l)return o;L("AttachNode",o,i),l.setAttribute&&o.key&&l.setAttribute("data-key",o.key),l.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&l.setAttribute("data-smbls-app",o.context.key),o.id&&l.setAttribute&&(l.id=o.id),B(o,t),Y(o),ot(o),st(o,i);try{ct(o,i)}catch(p){if(typeof console<"u"&&console.error){const y=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${y}:`,p?.message||p,p?.stack?`
|
|
2
2
|
`+p.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(Q(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)try{const p=o.html(o,o.state,o.context);p!=null&&typeof p!="function"&&(o.node.innerHTML=p)}catch{}if(L("Create",o,i),L("Complete",o,i),L("Render",o,i),L("RenderRouter",o,i),typeof o.onFrame=="function"){const p=o.onFrame,y=o.context?.designSystem,x=()=>{if(o.node){if(o.node.isConnected){y&&(0,C.pushConfig)(y);try{p(o,o.state,o.context)}catch(A){console.error("[DOMQL] onFrame error:",A)}finally{y&&(0,C.popConfig)()}}requestAnimationFrame(x)}};requestAnimationFrame(x)}return o}function bt(t,c,n){const i=!c,s=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=i&&s&&t.context?.state,r=n.state!==void 0&&!o?n.state:t.state&&!(0,$.isStore)(t.state)?t.state:void 0;if(r==null){if(c?.state)t.state=c.state,(0,I.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,a={...f},e=t.context?.polyglot;if(e?.translations){const d=f.lang||e.defaultLang||"en",h=e.translations[d];if(h&&typeof h=="object")for(const u in h)a[u]===void 0&&(a[u]=h[u]);const b=new Set(e.languages||[]);for(const u in e.translations)!b.has(u)&&a[u]===void 0&&(a[u]=e.translations[u])}t.state=(0,$.isStore)(a)?a:(0,$.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,I.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,I.applyStateMethods)(t,t.state);return}if(typeof r=="string"){if(t.state=m(r,c),t.state&&typeof t.state=="object"&&!(0,$.isStore)(t.state)){const f=c?.state?.root||c?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,I.applyStateMethods)(t,t.state);return}if(typeof r=="function"){const f=r(t,c?.state);t.state=(0,$.createStore)(f||{})}else t.state=(0,$.createStore)({...r});t.state.__element=t,c?.state?(t.state.parent=c.state,t.state.root=c.state.root||c.state):t.state.root=t.state,(0,I.applyStateMethods)(t,t.state)}function Z(t,c){if(!c)return t;const n=c.split("/");let i=t;for(const s of n){if(i==null)return{};i=i[s]}return i??{}}function m(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 i=c.context?.polyglot;if(i?.translations){const s=c.state?.root?.lang||i.defaultLang||"en",o=i.translations[s];if(o?.[t]!==void 0)return o[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}function xt(t){const c=t.__ref,n=t.tag||"div",i=t.context?.designSystem,s=[],o=Object.keys(t);for(let r=0;r<o.length;r++){const f=o[r];if(typeof t[f]!="function"||O.REGISTRY.has(f))continue;const a=f.charCodeAt(0);a>=65&&a<=90||F(f)||_.CSS_PROPS_REGISTRY[f]||_.DEFAULT_CSS_PROPERTIES_LIST&&_.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,K.checkAttributeByTagName)(n,f)||s.push({prop:f,fn:t[f]})}for(let r=0;r<s.length;r++){const{prop:f,fn:a}=s[r];c.__exec[f]=a,Object.defineProperty(t,f,{get(){i&&(0,C.pushConfig)(i);try{return a(t,t.state,t.context)}catch{return}finally{i&&(0,C.popConfig)()}},set(e){delete c.__exec[f],Object.defineProperty(t,f,{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function z(t,c){const n=t.__ref;if(xt(t),typeof t.text=="function"){const s=t.text,o=(0,j.createEffect)(()=>{try{let r=s(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=M.replaceLiteralsWithObjectFields.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=(0,j.createEffect)(()=>{const r=M.replaceLiteralsWithObjectFields.call(t,s,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{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"&&!O.REGISTRY.has(s)&&!F(s)&&!n.__exec[s]){if(_.CSS_PROPS_REGISTRY[s]){const o=t[s],r=s,f=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,C.pushConfig)(a);try{const e=o(t,t.state,t.context),d=_.CSS_PROPS_REGISTRY[r](e,t,t.state,t.context);d&&t.node?D(t.node,d):t.node&&(r==="show"||r==="hide")&&(t.node.style.display="")}finally{a&&(0,C.popConfig)()}},{depth:n.path.length});n.__effects.push(f),n.__exec[s]=o}else if(_.DEFAULT_CSS_PROPERTIES_LIST&&_.DEFAULT_CSS_PROPERTIES_LIST.has(s)){const o=t[s],r=s,f=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,C.pushConfig)(a);try{const e=o(t,t.state,t.context);t.node&&(e!=null?D(t.node,{[r]:e}):t.node.style[r]="")}finally{a&&(0,C.popConfig)()}},{depth:n.path.length});n.__effects.push(f),n.__exec[s]=o}}if(typeof c.html=="function"){const s=c.html,o=(0,j.createEffect)(()=>{const r=s(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&(t.node.innerHTML=r)},{depth:n.path.length});n.__effects.push(o),n.__exec.html=s}if(typeof c.value=="function"){const s=c.value,o=(0,j.createEffect)(()=>{try{const r=s(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=r==null?"":String(r);if(t.node.value===f)return;const a=typeof document<"u"&&document.activeElement===t.node,e=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,d=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,a&&e!=null&&d!=null)try{t.node.setSelectionRange(e,d)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=s}if(typeof c.style=="function"){const s=c.style,o=(0,j.createEffect)(()=>{const r=s(t,t.state,t.context);D(t.node,r)},{depth:n.path.length});n.__effects.push(o),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;const r=(0,j.createEffect)(()=>{try{const f=o(t,t.state,t.context);t.node&&D(t.node,{[s]:f})}catch{}},{depth:n.path.length});n.__effects.push(r)}if(t.attr&&typeof t.attr=="object"){for(const s in t.attr)if(typeof t.attr[s]=="function"){const o=t.attr[s],r=s,f=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,a===!0?"":a))}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 r="aria-"+s.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),f=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,a===!0?"":a)}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,e=>"-"+e.toLowerCase()),a=(0,j.createEffect)(()=>{try{const e=o(t,t.state,t.context);if(!t.node?.setAttribute)return;e==null||e===!1?t.node.removeAttribute(f):typeof e!="function"&&typeof e!="object"&&t.node.setAttribute(f,e===!0?"":e)}catch{}},{depth:n.path.length});n.__effects.push(a)}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 s in i){const o=i[s];if(typeof o!="function")continue;const r=(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(s):t.node.classList.remove(s)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(typeof c.if=="function"){const s=c.if,o=(0,j.createEffect)(()=>{const r=s(t,t.state,t.context),f=n.__if;if(n.__if=!!r,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=(0,R.cacheNode)(t));const a=t.parent,e=a?.node;if(e&&t.node){let d=null;const h=Object.keys(a),b=h.indexOf(t.key);for(let u=b+1;u<h.length;u++){const l=a[h[u]];if(l?.node?.parentNode===e){d=l.node;break}}d?e.insertBefore(t.node,d):e.appendChild(t.node)}else Q(t,t.parent);B(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=(0,R.detectTag)(t)),L("Init",t,{}),t.node||(t.node=(0,R.cacheNode)(t)),!t.node)return;L("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id);const a=c.if;delete c.if;try{z(t,c)}finally{c.if=a}B(t),tt(t),ot(t,{}),st(t,{}),Q(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||O.REGISTRY.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||F(s))continue;const r=t[s];n.__exec[s]=r;const f=t.tag||"div";if((0,K.checkAttributeByTagName)(f,s)&&!_.CSS_PROPS_REGISTRY[s]&&!(_.DEFAULT_CSS_PROPERTIES_LIST&&_.DEFAULT_CSS_PROPERTIES_LIST.has(s))){const a=s,e=(0,j.createEffect)(()=>{try{const d=r(t,t.state,t.context);t.node?.setAttribute&&(d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&(a==="src"&&"src"in t.node?t.node.src=d:t.node.setAttribute(a,d===!0?"":d)))}catch{}},{depth:n.path.length});n.__effects.push(e)}}At(t)}function B(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),jt(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"&&D(c,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||c.setAttribute&&c.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||c.dataset&&(c.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&&c.classList.add(i));else if(typeof n=="object")for(const i in n){const s=typeof n[i]=="function"?n[i](t,t.state,t.context):n[i];s&&c.classList.add(typeof s=="string"?s:i)}}}}function D(t,c){if(!t||!c||!t.style)return;let n=null;for(const i in c){const s=c[i];if(s!=null){if(i.charAt(0)==="&"&&typeof s=="object"){n||(n={}),n[i]=s;continue}try{const o=String(s),r=i.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),f=o.trim(),a=/\s*!important\s*$/.test(f),e=f.replace(/\s*!important\s*$/,"");t.style.setProperty(r,e,a?"important":"")}catch{}}}n&>(t,n)}let _t=0;function gt(t,c){const n=`_ds${_t++}`;t.classList.add(n);const i=t.ownerDocument;let s=i.querySelector("style[data-smbls-scoped]");s||(s=i.createElement("style"),s.setAttribute("data-smbls-scoped",""),i.head.appendChild(s));let o="";for(const r in c){const f="."+n,a=r.replace(/&/g,f).split(",").map(d=>{const h=d.trim();return h.includes(f)?h:f+h}).join(", "),e=c[r];if(typeof e=="object"){let d="",h="";for(const b in e){const u=e[b];if(typeof u=="object"){const l=b.includes("&")?a.split(", ").map(y=>b.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${b}`).join(", ");let p="";for(const y in u)p+=`${y.replace(/[A-Z]/g,x=>"-"+x.toLowerCase())}: ${u[y]};`;h+=`${l} { ${p} }
|
|
4
|
+
`):"")}}if(U(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)try{const p=o.html(o,o.state,o.context);p!=null&&typeof p!="function"&&(o.node.innerHTML=p)}catch{}if(L("Create",o,i),L("Complete",o,i),L("Render",o,i),L("RenderRouter",o,i),typeof o.onFrame=="function"){const p=o.onFrame,y=o.context?.designSystem,x=()=>{if(o.node){if(o.node.isConnected){y&&(0,v.pushConfig)(y);try{p(o,o.state,o.context)}catch(_){console.error("[DOMQL] onFrame error:",_)}finally{y&&(0,v.popConfig)()}}requestAnimationFrame(x)}};requestAnimationFrame(x)}return o}function xt(t,c,n){const i=!c,s=n.state&&typeof n.state=="object"&&!Array.isArray(n.state)&&Object.keys(n.state).length===0,o=i&&s&&t.context?.state,r=n.state!==void 0&&!o?n.state:t.state&&!(0,$.isStore)(t.state)?t.state:void 0;if(r==null){if(c?.state)t.state=c.state,(0,I.applyStateMethods)(t,t.state);else if(t.context?.state){const f=t.context.state,a={...f},e=t.context?.polyglot;if(e?.translations){const d=f.lang||e.defaultLang||"en",h=e.translations[d];if(h&&typeof h=="object")for(const u in h)a[u]===void 0&&(a[u]=h[u]);const b=new Set(e.languages||[]);for(const u in e.translations)!b.has(u)&&a[u]===void 0&&(a[u]=e.translations[u])}t.state=(0,$.isStore)(a)?a:(0,$.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,I.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,I.applyStateMethods)(t,t.state);return}if(typeof r=="string"){if(t.state=tt(r,c),t.state&&typeof t.state=="object"&&!(0,$.isStore)(t.state)){const f=c?.state?.root||c?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}(0,I.applyStateMethods)(t,t.state);return}if(typeof r=="function"){const f=r(t,c?.state);t.state=(0,$.createStore)(f||{})}else t.state=(0,$.createStore)({...r});t.state.__element=t,c?.state?(t.state.parent=c.state,t.state.root=c.state.root||c.state):t.state.root=t.state,(0,I.applyStateMethods)(t,t.state)}function z(t,c){if(!c)return t;const n=c.split("/");let i=t;for(const s of n){if(i==null)return{};i=i[s]}return i??{}}function tt(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 i=c.context?.polyglot;if(i?.translations){const s=c.state?.root?.lang||i.defaultLang||"en",o=i.translations[s];if(o?.[t]!==void 0)return o[t];if(i.translations[t]!==void 0)return i.translations[t]}return{}}function gt(t){const c=t.__ref,n=t.tag||"div",i=t.context?.designSystem,s=[],o=Object.keys(t);for(let r=0;r<o.length;r++){const f=o[r];if(typeof t[f]!="function"||S.REGISTRY.has(f))continue;const a=f.charCodeAt(0);a>=65&&a<=90||F(f)||g.CSS_PROPS_REGISTRY[f]||g.DEFAULT_CSS_PROPERTIES_LIST&&g.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,K.checkAttributeByTagName)(n,f)||s.push({prop:f,fn:t[f]})}for(let r=0;r<s.length;r++){const{prop:f,fn:a}=s[r];c.__exec[f]=a,Object.defineProperty(t,f,{get(){i&&(0,v.pushConfig)(i);try{return a(t,t.state,t.context)}catch{return}finally{i&&(0,v.popConfig)()}},set(e){delete c.__exec[f],Object.defineProperty(t,f,{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function B(t,c){const n=t.__ref;if(gt(t),typeof t.text=="function"){const s=t.text,o=(0,j.createEffect)(()=>{if(!n.contentManaged)try{let r=s(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&typeof r!="object"&&(typeof r=="string"&&r.includes("{{")&&(r=V.replaceLiteralsWithObjectFields.call(t,r,t.state)),t.tag==="string"?t.node.nodeValue=r:t.node.textContent=r)}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=(0,j.createEffect)(()=>{if(n.contentManaged)return;const r=V.replaceLiteralsWithObjectFields.call(t,s,t.state);r!=null&&(t.text=r),t.node&&(t.tag==="string"?t.node.nodeValue=r??"":t.node.textContent=r??"")},{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"&&!S.REGISTRY.has(s)&&!F(s)&&!n.__exec[s]){if(g.CSS_PROPS_REGISTRY[s]){const o=t[s],r=s,f=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,v.pushConfig)(a);try{const e=o(t,t.state,t.context),d=g.CSS_PROPS_REGISTRY[r](e,t,t.state,t.context);d&&t.node?D(t.node,d):t.node&&(r==="show"||r==="hide")&&(t.node.style.display="")}finally{a&&(0,v.popConfig)()}},{depth:n.path.length});n.__effects.push(f),n.__exec[s]=o}else if(g.DEFAULT_CSS_PROPERTIES_LIST&&g.DEFAULT_CSS_PROPERTIES_LIST.has(s)){const o=t[s],r=s,f=(0,j.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,v.pushConfig)(a);try{const e=o(t,t.state,t.context);t.node&&(e!=null?D(t.node,{[r]:e}):t.node.style[r]="")}finally{a&&(0,v.popConfig)()}},{depth:n.path.length});n.__effects.push(f),n.__exec[s]=o}}if(typeof c.html=="function"){const s=c.html,o=(0,j.createEffect)(()=>{const r=s(t,t.state,t.context);t.node&&r!=null&&typeof r!="function"&&(t.node.innerHTML=r)},{depth:n.path.length});n.__effects.push(o),n.__exec.html=s}if(typeof c.value=="function"){const s=c.value,o=(0,j.createEffect)(()=>{try{const r=s(t,t.state,t.context);if(!t.node||!("value"in t.node))return;const f=r==null?"":String(r);if(t.node.value===f)return;const a=typeof document<"u"&&document.activeElement===t.node,e=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,d=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,a&&e!=null&&d!=null)try{t.node.setSelectionRange(e,d)}catch{}}catch{}},{depth:n.path.length});n.__effects.push(o),n.__exec.value=s}if(typeof c.style=="function"){const s=c.style,o=(0,j.createEffect)(()=>{const r=s(t,t.state,t.context);D(t.node,r)},{depth:n.path.length});n.__effects.push(o),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;const r=(0,j.createEffect)(()=>{try{const f=o(t,t.state,t.context);t.node&&D(t.node,{[s]:f})}catch{}},{depth:n.path.length});n.__effects.push(r)}if(t.attr&&typeof t.attr=="object"){for(const s in t.attr)if(typeof t.attr[s]=="function"){const o=t.attr[s],r=s,f=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,a===!0?"":a))}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 r="aria-"+s.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()),f=(0,j.createEffect)(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(r):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(r,a===!0?"":a)}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,e=>"-"+e.toLowerCase()),a=(0,j.createEffect)(()=>{try{const e=o(t,t.state,t.context);if(!t.node?.setAttribute)return;e==null||e===!1?t.node.removeAttribute(f):typeof e!="function"&&typeof e!="object"&&t.node.setAttribute(f,e===!0?"":e)}catch{}},{depth:n.path.length});n.__effects.push(a)}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 s in i){const o=i[s];if(typeof o!="function")continue;const r=(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(s):t.node.classList.remove(s)}catch{}},{depth:n.path.length});n.__effects.push(r)}if(typeof c.if=="function"){const s=c.if,o=(0,j.createEffect)(()=>{const r=s(t,t.state,t.context),f=n.__if;if(n.__if=!!r,f&&!n.__if&&t.node)t.node.remove();else if(!f&&n.__if)if(n.__ifInitialized){t.node||(t.node=(0,R.cacheNode)(t));const a=t.parent,e=a?.node;if(e&&t.node){let d=null;const h=Object.keys(a),b=h.indexOf(t.key);for(let u=b+1;u<h.length;u++){const l=a[h[u]];if(l?.node?.parentNode===e){d=l.node;break}}d?e.insertBefore(t.node,d):e.appendChild(t.node)}else U(t,t.parent);Y(t)}else{if(n.__ifInitialized=!0,t.tag||(t.tag=(0,R.detectTag)(t)),L("Init",t,{}),t.node||(t.node=(0,R.cacheNode)(t)),!t.node)return;L("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id);const a=c.if;delete c.if;try{B(t,c)}finally{c.if=a}Y(t),ot(t),st(t,{}),ct(t,{}),U(t,t.parent)}},{depth:n.path.length});n.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||S.REGISTRY.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||F(s))continue;const r=t[s];n.__exec[s]=r;const f=t.tag||"div";if((0,K.checkAttributeByTagName)(f,s)&&!g.CSS_PROPS_REGISTRY[s]&&!(g.DEFAULT_CSS_PROPERTIES_LIST&&g.DEFAULT_CSS_PROPERTIES_LIST.has(s))){const a=s,e=(0,j.createEffect)(()=>{try{const d=r(t,t.state,t.context);t.node?.setAttribute&&(d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&(a==="src"&&"src"in t.node?t.node.src=d:t.node.setAttribute(a,d===!0?"":d)))}catch{}},{depth:n.path.length});n.__effects.push(e)}}jt(t)}function Y(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),vt(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"&&D(c,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||c.setAttribute&&c.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||c.dataset&&(c.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&&c.classList.add(i));else if(typeof n=="object")for(const i in n){const s=typeof n[i]=="function"?n[i](t,t.state,t.context):n[i];s&&c.classList.add(typeof s=="string"?s:i)}}}}function D(t,c){if(!t||!c||!t.style)return;let n=null;for(const i in c){const s=c[i];if(s!=null){if(i.charAt(0)==="&"&&typeof s=="object"){n||(n={}),n[i]=s;continue}try{const o=String(s),r=i.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),f=o.trim(),a=/\s*!important\s*$/.test(f),e=f.replace(/\s*!important\s*$/,"");t.style.setProperty(r,e,a?"important":"")}catch{}}}n&&At(t,n)}let _t=0;function At(t,c){const n=`_ds${_t++}`;t.classList.add(n);const i=t.ownerDocument;let s=i.querySelector("style[data-smbls-scoped]");s||(s=i.createElement("style"),s.setAttribute("data-smbls-scoped",""),i.head.appendChild(s));let o="";for(const r in c){const f="."+n,a=r.replace(/&/g,f).split(",").map(d=>{const h=d.trim();return h.includes(f)?h:f+h}).join(", "),e=c[r];if(typeof e=="object"){let d="",h="";for(const b in e){const u=e[b];if(typeof u=="object"){const l=b.includes("&")?a.split(", ").map(y=>b.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${b}`).join(", ");let p="";for(const y in u)p+=`${y.replace(/[A-Z]/g,x=>"-"+x.toLowerCase())}: ${u[y]};`;h+=`${l} { ${p} }
|
|
5
5
|
`}else d+=`${b.replace(/[A-Z]/g,l=>"-"+l.toLowerCase())}: ${u};`}d&&(o+=`${a} { ${d} }
|
|
6
|
-
`),h&&(o+=h)}}o&&(s.textContent+=o)}function At(t){const c=t.__ref;c.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=n.charAt(0);if(i!=="."&&i!=="!")continue;const s=n.slice(1);if(!s)continue;const o=t[n];if(!o||typeof o!="object")continue;const r=i==="!",f={lastMatch:!1,appliedKeys:null},a=()=>{if(!t.node)return;let d;const h=t[s];if(h===void 0)if(t.state&&s in t.state)d=t.state[s];else{const l=t.context?.cases?.[s];if(l===void 0)return;d=typeof l=="function"?l.call(t,t):l}else typeof h=="function"?d=h(t,t.state,t.context):d=h;const b=r?!d:!!d;if(b===f.lastMatch)return;f.lastMatch=b;const u=t.context?.designSystem;u&&(0,C.pushConfig)(u);try{if(b){const l={};for(const y in o){if(!Object.prototype.hasOwnProperty.call(o,y))continue;const x=typeof o[y]=="function"?o[y](t,t.state,t.context):o[y];if(x!=null)if(_.CSS_PROPS_REGISTRY[y]){const A=_.CSS_PROPS_REGISTRY[y](x,t,t.state,t.context);if(A){const P=Array.isArray(A)?A:[A];for(const v of P)v&&Object.assign(l,v)}}else _.DEFAULT_CSS_PROPERTIES_LIST&&_.DEFAULT_CSS_PROPERTIES_LIST.has(y)&&(l[y]=x)}const p=Object.keys(l);p.length?(D(t.node,l),f.appliedKeys=p):f.appliedKeys=null}else if(f.appliedKeys){for(const l of f.appliedKeys)t.node.style[l]="";f.appliedKeys=null}}finally{u&&(0,C.popConfig)()}};c.__conditionalRunners.push(a);const e=(0,j.createEffect)(a,{depth:c.path.length});c.__effects.push(e)}}const Y=new WeakSet;function jt(t){const{node:c}=t;if(!c)return;if(Y.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}Y.add(t);const n=t.context?.designSystem;n&&(0,C.pushConfig)(n);try{const i={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||O.REGISTRY.has(o))continue;const r=o.charCodeAt(0);if(!(r>=65&&r<=90)&&!F(o)){if(_.CSS_PROPS_REGISTRY[o]){const f=t[o],a=_.CSS_PROPS_REGISTRY[o](f,t,t.state,t.context);if(a){if(Array.isArray(a))for(const e of a)e&&Object.assign(i,e);else Object.assign(i,a);s=!0}}else if(_.DEFAULT_CSS_PROPERTIES_LIST&&_.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(i[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const a={};for(const e in f){let d=f[e];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function"))if(_.CSS_PROPS_REGISTRY[e]){const h=_.CSS_PROPS_REGISTRY[e](d,t,t.state,t.context);if(h)if(Array.isArray(h))for(const b of h)b&&Object.assign(a,b);else Object.assign(a,h)}else a[e]=d}if(Object.keys(a).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 d={};for(const b in a){const u=a[b];d[b]=typeof u=="string"&&!u.includes("!important")?u+" !important":u}const h=o.slice(1);i[`[data-theme="${h}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const b=o.slice(1),u=t.context?.designSystem?.media?.[b]||t.context?.designSystem?.media?.[b];u&&(d=`@media ${u}`)}const h={};for(const b in a){const u=a[b];if(u&&typeof u=="object"&&!Array.isArray(u)){const l={};for(const y in u)if(_.CSS_PROPS_REGISTRY[y]){const x=_.CSS_PROPS_REGISTRY[y](u[y],t,t.state,t.context);if(x)if(Array.isArray(x))for(const A of x)A&&Object.assign(l,A);else Object.assign(l,x)}else l[y]=u[y];const p=b.startsWith(":")?"":" ";if(d.includes(",")){const y=d.split(",").map(x=>`${x.trim()}${p}${b}`).join(", ");i[y]=l}else i[`${d}${p}${b}`]=l}else h[b]=u}Object.keys(h).length&&(i[d]=h)}s=!0}s=!0}}}}if(s){i.display&&String(i.display).includes("!important")&&(c.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const o=(0,rt.css)(i,null,t.context?.cssPrefix);o&&c.classList&&o.split(" ").forEach(f=>f&&c.classList.add(f));const r=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(r!=null){const f=i.display;if(f&&f!==r)if(r==="none"){const a=[];for(const e of c.classList)e.startsWith("_d-")&&e!=="_d-none"&&a.push(e);for(const e of a)c.classList.remove(e);c.classList.add("_d-none")}else c.style.display=t.display}}}finally{n&&(0,C.popConfig)(),Y.delete(t)}}function tt(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 r="aria-"+s.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());c.setAttribute(r,o===!0?"":o)}const n=(0,K.applyAttrTransforms)(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 i=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||O.REGISTRY.has(s)||s==="on"||n[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!F(s)&&!(_.CSS_PROPS_REGISTRY[s]||_.DEFAULT_CSS_PROPERTIES_LIST&&_.DEFAULT_CSS_PROPERTIES_LIST.has(s))&&(0,K.checkAttributeByTagName)(i,s)){let r=t[s];if(r==null||r===!1||(typeof r=="string"&&r.includes("{{")&&(r=(0,M.replaceLiteralsWithObjectFields)(r,t,t.state,t.context),t[s]=r),r==null||r===!1||typeof r=="function"||typeof r=="object"))continue;c.setAttribute(s,r===!0?"":r)}}}function ot(t,c){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!F(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 s=lt(n);O.LIFECYCLE_EVENTS.has(s)||(0,ct.registerEvent)(ht(s),t,i)}}function q(t,c){const n={...t};for(const i in c){const s=n[i],o=c[i];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[i]=q(s,o):n[i]=o}return n}function G(t,c,n){if(!c||!t.node)return;const i=t.childExtends;if(Array.isArray(c)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const r=t.childProps,f=t.childrenAs;for(let a=0;a<c.length;a++){let e=c[a];const d=e;(typeof e=="string"||typeof e=="number")&&(e={text:e});let h=r;if(typeof r=="function")try{h=r(t,e)}catch{h=null}if(f==="state"){let l=d;(typeof d=="string"||typeof d=="number")&&(l={value:d,text:d}),e=h?{...h,state:l}:{state:l}}else h&&(e=q(h,e));if(i&&!e.ignoreChildExtends)if(e.extends){const l=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(i)?i:[i];e={...e,extends:[...p,...l]}}else e={extends:i,...e};const b=e?.key||`${a}`,u=N(e,t,b,n);u?.node&&o.appendChild(u.node)}t.node.appendChild(o);return}if(typeof c=="string"){const s=m(c,t);if(Array.isArray(s)){G(t,s,n);return}}if(typeof c=="object")for(const s in c){if(O.REGISTRY.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=q(t.childProps,o)),i&&!o.ignoreChildExtends)if(o.extends){const r=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(i)?i:[i];o={...o,extends:[...f,...r]}}else o={extends:i,...o};N(o,t,s,n)}}}function st(t,c){let{children:n,content:i}=t;const s=t.childExtends;if(typeof n=="function"){const r=n;n=r(t,t.state,t.context),t.children=n;const f=t.__ref;let a=!1;const e=(0,j.createEffect)(()=>{const d=r(t,t.state,t.context);if(!a){a=!0;return}if(d===t.children)return;if(t.children=d,Array.isArray(d)&&t.childrenAs==="state"){const u=t.childProps,l=[],p=new Map;for(let v=0;v<d.length;v++){const k=d[v];let g=u;if(typeof u=="function")try{g=u(t,k)}catch{g=null}const T=g&&g.key||k&&k.key||`${v}`;l.push(T),p.set(T,{rawChild:k,childProps:g})}const y=new Set(l);for(let v=f.__children.length-1;v>=0;v--){const k=f.__children[v];if(!y.has(k)){const g=t[k];g?.remove&&g.remove(),delete t[k],f.__children.splice(v,1)}}const x=t.childExtends,P=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const v of l){const k=p.get(v),g=k.rawChild,T=t[v];if(T&&T.state){if(g&&typeof g=="object"){const E=T.state;if(typeof E.replace=="function")E.replace(g);else if(typeof E.update=="function"){for(const S in E)if(!(S==="__element"||S==="root"||S==="parent"||S==="update")&&!Object.prototype.hasOwnProperty.call(g,S))try{E[S]=void 0}catch{}E.update(g)}else for(const S in g)E[S]=g[S]}continue}let V=g;(typeof g=="string"||typeof g=="number")&&(V={value:g,text:g});const J=k.childProps;let w=J?{...J,state:V}:{state:V};if(x&&!w.ignoreChildExtends)if(w.extends){const E=Array.isArray(w.extends)?w.extends:[w.extends],S=Array.isArray(x)?x:[x];w={...w,extends:[...S,...E]}}else w={extends:x,...w};const X=N(w,t,v,c);X?.node&&P&&P.appendChild(X.node)}P&&P.childNodes.length&&t.node&&t.node.appendChild(P),f.__children=l;return}for(const u of[...f.__children]){const l=t[u];l?.remove&&l.remove(),delete t[u]}f.__children=[],G(t,d,c)},{depth:f.path.length});f.__effects.push(e)}if(G(t,n||i,c),n||i)return;const o=t.context?.components||{};{const r=Object.keys(t);for(let f=0;f<r.length;f++){const a=r[f];if(!a.endsWith("Extends")||typeof t[a]!="string")continue;const e=a.slice(0,-7);if(!e||e.charCodeAt(0)<65||e.charCodeAt(0)>90)continue;const d={extends:t[a]};delete t[a];for(let h=f+1;h<r.length;h++){const b=r[h],u=b.charCodeAt(0);if(u>=65&&u<=90||O.REGISTRY.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const l=t[b];l!==void 0&&(d[b]=l,delete t[b])}t[e]&&typeof t[e]=="object"?t[e]={...d,...t[e]}:t[e]=d}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||O.REGISTRY.has(r)||typeof t[r]!="object"||t[r]===null)continue;const f=r.charCodeAt(0);if(f<65||f>90)continue;let a=t[r];if(!a.__ref){if(!a.extends&&!a.extend){const e=o[r]||o[`smbls.${r}`];e&&(a={extends:e,...a})}if(t.childProps&&(a={...t.childProps,...a}),s&&!a.ignoreChildExtends)if(a.extends){const e=Array.isArray(a.extends)?a.extends:[a.extends],d=Array.isArray(s)?s:[s];a={...a,extends:[...d,...e]}}else a={extends:s,...a};N(a,t,r,c)}}}function Q(t,c,n){const{node:i}=t;if(!i)return;const s=c?.node||(c?.nodeType?c:null);if(s)if(n?.position==="before"&&n.node)s.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?s.insertBefore(i,o):s.appendChild(i)}else s.appendChild(i)}function L(t,c,n){const i=t.charAt(0).toLowerCase()+t.slice(1);c.context?.plugins?.length&&(0,U.runPluginHook)(i,c,n);const s="on"+t,o=c[s];if(typeof o=="function"){const r=c.context?.designSystem;r&&(0,C.pushConfig)(r);try{if(o(c,c.state,c.context,n)===!1)return!1}catch(f){if(c.context?.plugins?.length&&(0,U.runPluginHook)("error",c,{hook:s,error:f})||console.error(`[DOMQL] Lifecycle "${s}" error:`,f),c.context?.strictMode)throw f}finally{r&&(0,C.popConfig)()}}return!0}var vt=N;
|
|
6
|
+
`),h&&(o+=h)}}o&&(s.textContent+=o)}function jt(t){const c=t.__ref;c.__conditionalRunners=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=n.charAt(0);if(i!=="."&&i!=="!")continue;const s=n.slice(1);if(!s)continue;const o=t[n];if(!o||typeof o!="object")continue;const r=i==="!",f={lastMatch:!1,appliedKeys:null},a=()=>{if(!t.node)return;let d;const h=t[s];if(h===void 0)if(t.state&&s in t.state)d=t.state[s];else{const l=t.context?.cases?.[s];if(l===void 0)return;d=typeof l=="function"?l.call(t,t):l}else typeof h=="function"?d=h(t,t.state,t.context):d=h;const b=r?!d:!!d;if(b===f.lastMatch)return;f.lastMatch=b;const u=t.context?.designSystem;u&&(0,v.pushConfig)(u);try{if(b){const l={};for(const y in o){if(!Object.prototype.hasOwnProperty.call(o,y))continue;const x=typeof o[y]=="function"?o[y](t,t.state,t.context):o[y];if(x!=null)if(g.CSS_PROPS_REGISTRY[y]){const _=g.CSS_PROPS_REGISTRY[y](x,t,t.state,t.context);if(_){const M=Array.isArray(_)?_:[_];for(const E of M)E&&Object.assign(l,E)}}else g.DEFAULT_CSS_PROPERTIES_LIST&&g.DEFAULT_CSS_PROPERTIES_LIST.has(y)&&(l[y]=x)}const p=Object.keys(l);p.length?(D(t.node,l),f.appliedKeys=p):f.appliedKeys=null}else if(f.appliedKeys){for(const l of f.appliedKeys)t.node.style[l]="";f.appliedKeys=null}}finally{u&&(0,v.popConfig)()}};c.__conditionalRunners.push(a);const e=(0,j.createEffect)(a,{depth:c.path.length});c.__effects.push(e)}}const q=new WeakSet;function vt(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&&(0,v.pushConfig)(n);try{const i={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||S.REGISTRY.has(o))continue;const r=o.charCodeAt(0);if(!(r>=65&&r<=90)&&!F(o)){if(g.CSS_PROPS_REGISTRY[o]){const f=t[o],a=g.CSS_PROPS_REGISTRY[o](f,t,t.state,t.context);if(a){if(Array.isArray(a))for(const e of a)e&&Object.assign(i,e);else Object.assign(i,a);s=!0}}else if(g.DEFAULT_CSS_PROPERTIES_LIST&&g.DEFAULT_CSS_PROPERTIES_LIST.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(i[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(i[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const a={};for(const e in f){let d=f[e];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function"))if(g.CSS_PROPS_REGISTRY[e]){const h=g.CSS_PROPS_REGISTRY[e](d,t,t.state,t.context);if(h)if(Array.isArray(h))for(const b of h)b&&Object.assign(a,b);else Object.assign(a,h)}else a[e]=d}if(Object.keys(a).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 d={};for(const b in a){const u=a[b];d[b]=typeof u=="string"&&!u.includes("!important")?u+" !important":u}const h=o.slice(1);i[`[data-theme="${h}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const b=o.slice(1),u=t.context?.designSystem?.media?.[b]||t.context?.designSystem?.media?.[b];u&&(d=`@media ${u}`)}const h={};for(const b in a){const u=a[b];if(u&&typeof u=="object"&&!Array.isArray(u)){const l={};for(const y in u)if(g.CSS_PROPS_REGISTRY[y]){const x=g.CSS_PROPS_REGISTRY[y](u[y],t,t.state,t.context);if(x)if(Array.isArray(x))for(const _ of x)_&&Object.assign(l,_);else Object.assign(l,x)}else l[y]=u[y];const p=b.startsWith(":")?"":" ";if(d.includes(",")){const y=d.split(",").map(x=>`${x.trim()}${p}${b}`).join(", ");i[y]=l}else i[`${d}${p}${b}`]=l}else h[b]=u}Object.keys(h).length&&(i[d]=h)}s=!0}s=!0}}}}if(s){i.display&&String(i.display).includes("!important")&&(c.style.setProperty("display",String(i.display).replace(/\s*!important\s*$/,""),"important"),delete i.display);const o=(0,ft.css)(i,null,t.context?.cssPrefix);o&&c.classList&&o.split(" ").forEach(f=>f&&c.classList.add(f));const r=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(r!=null){const f=i.display;if(f&&f!==r)if(r==="none"){const a=[];for(const e of c.classList)e.startsWith("_d-")&&e!=="_d-none"&&a.push(e);for(const e of a)c.classList.remove(e);c.classList.add("_d-none")}else c.style.display=t.display}}}finally{n&&(0,v.popConfig)(),q.delete(t)}}function ot(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 r="aria-"+s.replace(/[A-Z]/g,f=>"-"+f.toLowerCase());c.setAttribute(r,o===!0?"":o)}const n=(0,K.applyAttrTransforms)(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 i=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||S.REGISTRY.has(s)||s==="on"||n[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!F(s)&&!(g.CSS_PROPS_REGISTRY[s]||g.DEFAULT_CSS_PROPERTIES_LIST&&g.DEFAULT_CSS_PROPERTIES_LIST.has(s))&&(0,K.checkAttributeByTagName)(i,s)){let r=t[s];if(r==null||r===!1||(typeof r=="string"&&r.includes("{{")&&(r=(0,V.replaceLiteralsWithObjectFields)(r,t,t.state,t.context),t[s]=r),r==null||r===!1||typeof r=="function"||typeof r=="object"))continue;c.setAttribute(s,r===!0?"":r)}}}function st(t,c){for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n)||!F(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 s=ht(n);S.LIFECYCLE_EVENTS.has(s)||(0,nt.registerEvent)(bt(s),t,i)}}function G(t,c){const n={...t};for(const i in c){const s=n[i],o=c[i];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?n[i]=G(s,o):n[i]=o}return n}function Q(t,c,n){if(!c||!t.node)return;const i=t.childExtends;if(Array.isArray(c)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const r=t.childProps,f=t.childrenAs;for(let a=0;a<c.length;a++){let e=c[a];const d=e;(typeof e=="string"||typeof e=="number")&&(e={text:e});let h=r;if(typeof r=="function")try{h=r(t,e)}catch{h=null}if(f==="state"){let l=d;(typeof d=="string"||typeof d=="number")&&(l={value:d,text:d}),e=h?{...h,state:l}:{state:l}}else h&&(e=G(h,e));if(i&&!e.ignoreChildExtends)if(e.extends){const l=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(i)?i:[i];e={...e,extends:[...p,...l]}}else e={extends:i,...e};const b=e?.key||`${a}`,u=N(e,t,b,n);u?.node&&o.appendChild(u.node)}t.node.appendChild(o);return}if(typeof c=="string"){const s=tt(c,t);if(Array.isArray(s)){Q(t,s,n);return}}if(typeof c=="object")for(const s in c){if(S.REGISTRY.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=G(t.childProps,o)),i&&!o.ignoreChildExtends)if(o.extends){const r=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(i)?i:[i];o={...o,extends:[...f,...r]}}else o={extends:i,...o};N(o,t,s,n)}}}function ct(t,c){let{children:n,content:i}=t;const s=t.childExtends;if(typeof n=="function"){const r=n;n=r(t,t.state,t.context),t.children=n;const f=t.__ref;let a=!1;const e=(0,j.createEffect)(()=>{const d=r(t,t.state,t.context);if(!a){a=!0;return}if(d===t.children)return;if(t.children=d,Array.isArray(d)&&t.childrenAs==="state"){const u=t.childProps,l=[],p=new Map;for(let C=0;C<d.length;C++){const O=d[C];let A=u;if(typeof u=="function")try{A=u(t,O)}catch{A=null}const T=A&&A.key||O&&O.key||`${C}`;l.push(T),p.set(T,{rawChild:O,childProps:A})}const y=new Set(l),x=f.__children.slice();for(const C of x)if(!y.has(C)){const O=t[C];O?.remove&&O.remove(),delete t[C]}const _=t.childExtends,E=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const C of l){const O=p.get(C),A=O.rawChild,T=t[C];if(T&&T.state){if(A&&typeof A=="object"){const w=T.state;if(typeof w.replace=="function")w.replace(A);else if(typeof w.update=="function"){for(const k in w)if(!(k==="__element"||k==="root"||k==="parent"||k==="update")&&!Object.prototype.hasOwnProperty.call(A,k))try{w[k]=void 0}catch{}w.update(A)}else for(const k in A)w[k]=A[k]}continue}let W=A;(typeof A=="string"||typeof A=="number")&&(W={value:A,text:A});const X=O.childProps;let P=X?{...X,state:W}:{state:W};if(_&&!P.ignoreChildExtends)if(P.extends){const w=Array.isArray(P.extends)?P.extends:[P.extends],k=Array.isArray(_)?_:[_];P={...P,extends:[...k,...w]}}else P={extends:_,...P};const m=N(P,t,C,c);m?.node&&E&&E.appendChild(m.node)}E&&E.childNodes.length&&t.node&&t.node.appendChild(E),f.__children=l;return}for(const u of[...f.__children]){const l=t[u];l?.remove&&l.remove(),delete t[u]}f.__children=[],Q(t,d,c)},{depth:f.path.length});f.__effects.push(e)}if(Q(t,n||i,c),n||i)return;const o=t.context?.components||{};{const r=Object.keys(t);for(let f=0;f<r.length;f++){const a=r[f];if(!a.endsWith("Extends")||typeof t[a]!="string")continue;const e=a.slice(0,-7);if(!e||e.charCodeAt(0)<65||e.charCodeAt(0)>90)continue;const d={extends:t[a]};delete t[a];for(let h=f+1;h<r.length;h++){const b=r[h],u=b.charCodeAt(0);if(u>=65&&u<=90||S.REGISTRY.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const l=t[b];l!==void 0&&(d[b]=l,delete t[b])}t[e]&&typeof t[e]=="object"?t[e]={...d,...t[e]}:t[e]=d}}for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||S.REGISTRY.has(r)||typeof t[r]!="object"||t[r]===null)continue;const f=r.charCodeAt(0);if(f<65||f>90)continue;let a=t[r];if(!a.__ref){if(!a.extends&&!a.extend){const e=o[r]||o[`smbls.${r}`];e&&(a={extends:e,...a})}if(t.childProps&&(a={...t.childProps,...a}),s&&!a.ignoreChildExtends)if(a.extends){const e=Array.isArray(a.extends)?a.extends:[a.extends],d=Array.isArray(s)?s:[s];a={...a,extends:[...d,...e]}}else a={extends:s,...a};N(a,t,r,c)}}}function U(t,c,n){const{node:i}=t;if(!i)return;const s=c?.node||(c?.nodeType?c:null);if(s)if(n?.position==="before"&&n.node)s.insertBefore(i,n.node);else if(n?.position==="after"&&n.node){const o=n.node.nextSibling;o?s.insertBefore(i,o):s.appendChild(i)}else s.appendChild(i)}function L(t,c,n){const i=t.charAt(0).toLowerCase()+t.slice(1);c.context?.plugins?.length&&(0,J.runPluginHook)(i,c,n);const s="on"+t,o=c[s];if(typeof o=="function"){const r=c.context?.designSystem;r&&(0,v.pushConfig)(r);try{if(o(c,c.state,c.context,n)===!1)return!1}catch(f){if(c.context?.plugins?.length&&(0,J.runPluginHook)("error",c,{hook:s,error:f})||console.error(`[DOMQL] Lifecycle "${s}" error:`,f),c.context?.strictMode)throw f}finally{r&&(0,v.popConfig)()}}return!0}var Ct=N;
|
package/dist/cjs/src/methods.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},d=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of g(e))!p.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(o=_(e,r))||o.enumerable});return t};var k=t=>d(c({},"__esModule",{value:!0}),t);var R={};y(R,{addMethods:()=>C,elementProto:()=>f});module.exports=k(R);var h=require("./update.js"),a=require("./dispose.js"),v=require("css-in-props"),s=require("@symbo.ls/utils");function l(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(i=>i?.message||(typeof i=="string"?i:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}function m(...t){return l(this,"warn",t),s.warn.apply(this,t)}function w(...t){return l(this,"error",t),s.error.apply(this,t)}const f={update:h.update,remove:a.remove,getDB:s.getDB,getQuery:s.getQuery,getRootData:s.getRootData,getChildren:s.getChildren,getPath:s.getPath,nextElement:s.nextElement,previousElement:s.previousElement,verbose:s.verbose,warn:m,error:w,variables:s.variables,spotByPath:s.spotByPath,set(t,e){if(this.removeContent(),t!=null){const n=this.context?.__create;n&&n(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(){return this.__ref},getRoot:s.getRoot,getRootState:s.getRootState,getRootContext:s.getRootContext,getContext:s.getContext,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},u=new WeakMap;function x(t){if(!t)return f;let e=u.get(t);if(e)return e;e=Object.create(f);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return u.set(t,e),e}function C(t){const e=x(t.context);Object.setPrototypeOf(t,e)}
|
package/dist/esm/src/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createStore as
|
|
1
|
+
import{createStore as V,isStore as W}from"@symbo.ls/signal";import{createEffect as A}from"@symbo.ls/signal";import{cacheNode as H,detectTag as ot}from"./cache.js";import{REGISTRY as E,LIFECYCLE_EVENTS as ft}from"./registry.js";import{registerEvent as at}from"./delegate.js";import{applyExtends as et}from"./extends.js";import{addMethods as dt}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as Z}from"@symbo.ls/utils";import{runPluginHook as st}from"@symbo.ls/utils/function.js";import{applyStateMethods as K}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as j,DEFAULT_CSS_PROPERTIES_LIST as C}from"css-in-props";import{css as ut}from"@symbo.ls/css";import{pushConfig as $,popConfig as N}from"@symbo.ls/scratch";import{checkAttributeByTagName as z,applyAttrTransforms as pt}from"attrs-in-props";let yt=1;function T(t){return t.length>2&&t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90}function lt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function ht(t){return t.toLowerCase()}function B(t,n){const c={...t};for(const r in n){const s=c[r],o=n[r];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?c[r]=B(s,o):c[r]=o}return c}function F(t,n,c,r={},s){if(t==null||t===!1)return null;(typeof t=="string"||typeof t=="number")&&(t={text:t});const o=Object.create(null);o.key=c||t.key||`_${yt++}`,o.parent=n||null,o.context=t.context||n?.context||r.context||{},o.context.__create||(o.context.__create=F);const i=o.__ref={__if:!0,__children:[],__exec:{},__effects:[],__eventCleanup:[],root:n?.__ref?.root||o,path:n?.__ref?.path?[...n.__ref.path,o.key]:[o.key]};if(c&&!t.extends&&!t.extend){const p=c.indexOf("_");if(p>0){const y=c.substring(0,p),x=o.context?.components;x&&(x[y]||x["smbls."+y])&&(t={extends:y,...t})}}et(o,t,r);const f=new Set(["childProps","attr","style","scope","data"]),a=o.props&&typeof o.props=="object"?o.props:null;for(const p in t){if(p==="parent"||p==="node"||p==="__ref"||p==="extends"||p==="context"||p==="props")continue;const y=t[p],x=o[p],g=x&&y&&typeof x=="object"&&typeof y=="object"&&!Array.isArray(x)&&!Array.isArray(y)&&typeof x!="function"&&typeof y!="function";g&&p.charCodeAt(0)>=65&&p.charCodeAt(0)<=90?o[p]=B(x,y):g&&f.has(p)?o[p]={...x,...y}:o[p]=y}function e(p){for(const y in p){const x=p[y],g=o[y],I=g&&x&&typeof g=="object"&&typeof x=="object"&&!Array.isArray(g)&&!Array.isArray(x)&&typeof g!="function"&&typeof x!="function";I&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?o[y]=B(g,x):I&&f.has(y)?o[y]={...g,...x}:o[y]=x}}a&&e(a),t.props&&typeof t.props=="object"&&e(t.props),t.data!==void 0&&(o.data=t.data),t.classlist!==void 0&&(o.classlist=t.classlist),t.text!==void 0&&(o.text=t.text),t.html!==void 0&&(o.html=t.html);const d=o.scope&&typeof o.scope=="object"?o.scope:null,h=n?.scope,b=o.context&&typeof o.context.globalScope=="object"&&o.context.globalScope||null,u=h||(b?Object.create(b):null);if(t.scope!==void 0||d){const p=u?Object.create(u):{};d&&Object.assign(p,d),t.scope!==void 0&&Object.assign(p,t.scope),o.scope=p}else u&&(o.scope=Object.create(u));if(t.if!==void 0&&(o.if=t.if),dt(o),bt(o,n,t),o.if!=null){const p=typeof o.if=="function"?o.if(o,o.state,o.context):o.if;i.__if=!!p}if(i.__if)typeof t.if=="function"&&(i.__ifInitialized=!0);else return n&&(n[o.key]=o),typeof t.if=="function"&&q(o,{if:t.if}),o;o.tag||(o.tag=ot(o)),L("Init",o,r);const l=o.node=H(o);if(!l)return o;L("AttachNode",o,r),l.setAttribute&&o.key&&l.setAttribute("data-key",o.key),l.setAttribute&&o.context?.scopeSelector&&o.context.scopeSelector!==":root"&&o.context.key&&o.key===o.context.key&&l.setAttribute("data-smbls-app",o.context.key),o.id&&l.setAttribute&&(l.id=o.id),q(o,t),G(o),nt(o),it(o,r);try{rt(o,r)}catch(p){if(typeof console<"u"&&console.error){const y=o.__ref?.path?.join(".")||o.key||"<root>";console.error(`[smbls] createChildren failed at ${y}:`,p?.message||p,p?.stack?`
|
|
2
2
|
`+p.stack.split(`
|
|
3
3
|
`).slice(0,6).join(`
|
|
4
|
-
`):"")}}if(J(o,n,s),n&&(n[o.key]=o,n.__ref?.__children&&(n.__ref.__children.includes(o.key)||n.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML)try{const p=o.html(o,o.state,o.context);p!=null&&typeof p!="function"&&(o.node.innerHTML=p)}catch{}if(L("Create",o,r),L("Complete",o,r),L("Render",o,r),L("RenderRouter",o,r),typeof o.onFrame=="function"){const p=o.onFrame,y=o.context?.designSystem,x=()=>{if(o.node){if(o.node.isConnected){y&&$(y);try{p(o,o.state,o.context)}catch(g){console.error("[DOMQL] onFrame error:",g)}finally{y&&N()}}requestAnimationFrame(x)}};requestAnimationFrame(x)}return o}function ht(t,n,c){const r=!n,s=c.state&&typeof c.state=="object"&&!Array.isArray(c.state)&&Object.keys(c.state).length===0,o=r&&s&&t.context?.state,i=c.state!==void 0&&!o?c.state:t.state&&!V(t.state)?t.state:void 0;if(i==null){if(n?.state)t.state=n.state,I(t,t.state);else if(t.context?.state){const f=t.context.state,a={...f},e=t.context?.polyglot;if(e?.translations){const d=f.lang||e.defaultLang||"en",h=e.translations[d];if(h&&typeof h=="object")for(const u in h)a[u]===void 0&&(a[u]=h[u]);const b=new Set(e.languages||[]);for(const u in e.translations)!b.has(u)&&a[u]===void 0&&(a[u]=e.translations[u])}t.state=V(a)?a:M(a),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=st(i,n),t.state&&typeof t.state=="object"&&!V(t.state)){const f=n?.state?.root||n?.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,n?.state);t.state=M(f||{})}else t.state=M({...i});t.state.__element=t,n?.state?(t.state.parent=n.state,t.state.root=n.state.root||n.state):t.state.root=t.state,I(t,t.state)}function B(t,n){if(!n)return t;const c=n.split("/");let r=t;for(const s of c){if(r==null)return{};r=r[s]}return r??{}}function st(t,n){if(!n)return{};if(t===".")return n.state||{};if(t.startsWith("../")){const s=t.slice(3);return s?B(n.state,s):n.state??{}}if(t.startsWith("~/")){const s=n.state?.root||n.state,o=t.slice(2);return o?B(s,o):s??{}}if(n.state?.[t]!==void 0)return n.state[t];const c=B(n.state,t);if(c!=null&&Object.keys(c).length>0)return c;const r=n.context?.polyglot;if(r?.translations){const s=n.state?.root?.lang||r.defaultLang||"en",o=r.translations[s];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}function bt(t){const n=t.__ref,c=t.tag||"div",r=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"||E.has(f))continue;const a=f.charCodeAt(0);a>=65&&a<=90||T(f)||v[f]||C&&C.has(f)||Z(c,f)||s.push({prop:f,fn:t[f]})}for(let i=0;i<s.length;i++){const{prop:f,fn:a}=s[i];n.__exec[f]=a,Object.defineProperty(t,f,{get(){r&&$(r);try{return a(t,t.state,t.context)}catch{return}finally{r&&N()}},set(e){delete n.__exec[f],Object.defineProperty(t,f,{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function Y(t,n){const c=t.__ref;if(bt(t),typeof t.text=="function"){const s=t.text,o=j(()=>{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=H.call(t,i,t.state)),t.tag==="string"?t.node.nodeValue=i:t.node.textContent=i)}catch{}},{depth:c.path.length});c.__effects.push(o),c.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=j(()=>{const i=H.call(t,s,t.state);i!=null&&(t.text=i),t.node&&(t.tag==="string"?t.node.nodeValue=i??"":t.node.textContent=i??"")},{depth:c.path.length});c.__effects.push(o),c.__exec.text=s}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&typeof t[s]=="function"&&!E.has(s)&&!T(s)&&!c.__exec[s]){if(v[s]){const o=t[s],i=s,f=j(()=>{const a=t.context?.designSystem;a&&$(a);try{const e=o(t,t.state,t.context),d=v[i](e,t,t.state,t.context);d&&t.node?D(t.node,d):t.node&&(i==="show"||i==="hide")&&(t.node.style.display="")}finally{a&&N()}},{depth:c.path.length});c.__effects.push(f),c.__exec[s]=o}else if(C&&C.has(s)){const o=t[s],i=s,f=j(()=>{const a=t.context?.designSystem;a&&$(a);try{const e=o(t,t.state,t.context);t.node&&(e!=null?D(t.node,{[i]:e}):t.node.style[i]="")}finally{a&&N()}},{depth:c.path.length});c.__effects.push(f),c.__exec[s]=o}}if(typeof n.html=="function"){const s=n.html,o=j(()=>{const i=s(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&(t.node.innerHTML=i)},{depth:c.path.length});c.__effects.push(o),c.__exec.html=s}if(typeof n.value=="function"){const s=n.value,o=j(()=>{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 a=typeof document<"u"&&document.activeElement===t.node,e=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,d=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,a&&e!=null&&d!=null)try{t.node.setSelectionRange(e,d)}catch{}}catch{}},{depth:c.path.length});c.__effects.push(o),c.__exec.value=s}if(typeof n.style=="function"){const s=n.style,o=j(()=>{const i=s(t,t.state,t.context);D(t.node,i)},{depth:c.path.length});c.__effects.push(o),c.__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;const i=j(()=>{try{const f=o(t,t.state,t.context);t.node&&D(t.node,{[s]:f})}catch{}},{depth:c.path.length});c.__effects.push(i)}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=j(()=>{try{const a=o(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(i):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(i,a===!0?"":a))}catch{}},{depth:c.path.length});c.__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,a=>"-"+a.toLowerCase()),f=j(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(i):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(i,a===!0?"":a)}catch{}},{depth:c.path.length});c.__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,e=>"-"+e.toLowerCase()),a=j(()=>{try{const e=o(t,t.state,t.context);if(!t.node?.setAttribute)return;e==null||e===!1?t.node.removeAttribute(f):typeof e!="function"&&typeof e!="object"&&t.node.setAttribute(f,e===!0?"":e)}catch{}},{depth:c.path.length});c.__effects.push(a)}const r=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(r)for(const s in r){const o=r[s];if(typeof o!="function")continue;const i=j(()=>{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:c.path.length});c.__effects.push(i)}if(typeof n.if=="function"){const s=n.if,o=j(()=>{const i=s(t,t.state,t.context),f=c.__if;if(c.__if=!!i,f&&!c.__if&&t.node)t.node.remove();else if(!f&&c.__if)if(c.__ifInitialized){t.node||(t.node=W(t));const a=t.parent,e=a?.node;if(e&&t.node){let d=null;const h=Object.keys(a),b=h.indexOf(t.key);for(let u=b+1;u<h.length;u++){const l=a[h[u]];if(l?.node?.parentNode===e){d=l.node;break}}d?e.insertBefore(t.node,d):e.appendChild(t.node)}else J(t,t.parent);q(t)}else{if(c.__ifInitialized=!0,t.tag||(t.tag=tt(t)),L("Init",t,{}),t.node||(t.node=W(t)),!t.node)return;L("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id);const a=n.if;delete n.if;try{Y(t,n)}finally{n.if=a}q(t),ct(t),nt(t,{}),it(t,{}),J(t,t.parent)}},{depth:c.path.length});c.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||E.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||T(s))continue;const i=t[s];c.__exec[s]=i;const f=t.tag||"div";if(Z(f,s)&&!v[s]&&!(C&&C.has(s))){const a=s,e=j(()=>{try{const d=i(t,t.state,t.context);t.node?.setAttribute&&(d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&(a==="src"&&"src"in t.node?t.node.src=d:t.node.setAttribute(a,d===!0?"":d)))}catch{}},{depth:c.path.length});c.__effects.push(e)}}gt(t)}function q(t){const{node:n}=t;if(n){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?n.nodeValue=t.text:n.textContent=t.text:typeof t.text=="number"&&(n.textContent=t.text),At(t),typeof t.html=="string"&&(n.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in n){const c=String(t.value);n.value!==c&&(n.value=c)}if(t.style&&typeof t.style=="object"&&D(n,t.style),t.attr&&typeof t.attr=="object")for(const c in t.attr){const r=t.attr[c];typeof r=="function"||typeof r=="object"||r==null||r===!1||n.setAttribute&&n.setAttribute(c,r===!0?"":r)}if(t.data&&typeof t.data=="object")for(const c in t.data){const r=t.data[c];typeof r=="function"||typeof r=="object"||r==null||r===!1||n.dataset&&(n.dataset[c]=r===!0?"":r)}if(t.classlist||t.class){const c=t.classlist||t.class;if(typeof c=="string")c.split(" ").forEach(r=>r&&n.classList.add(r));else if(typeof c=="object")for(const r in c){const s=typeof c[r]=="function"?c[r](t,t.state,t.context):c[r];s&&n.classList.add(typeof s=="string"?s:r)}}}}function D(t,n){if(!t||!n||!t.style)return;let c=null;for(const r in n){const s=n[r];if(s!=null){if(r.charAt(0)==="&"&&typeof s=="object"){c||(c={}),c[r]=s;continue}try{const o=String(s),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),f=o.trim(),a=/\s*!important\s*$/.test(f),e=f.replace(/\s*!important\s*$/,"");t.style.setProperty(i,e,a?"important":"")}catch{}}}c&&_t(t,c)}let xt=0;function _t(t,n){const c=`_ds${xt++}`;t.classList.add(c);const r=t.ownerDocument;let s=r.querySelector("style[data-smbls-scoped]");s||(s=r.createElement("style"),s.setAttribute("data-smbls-scoped",""),r.head.appendChild(s));let o="";for(const i in n){const f="."+c,a=i.replace(/&/g,f).split(",").map(d=>{const h=d.trim();return h.includes(f)?h:f+h}).join(", "),e=n[i];if(typeof e=="object"){let d="",h="";for(const b in e){const u=e[b];if(typeof u=="object"){const l=b.includes("&")?a.split(", ").map(y=>b.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${b}`).join(", ");let p="";for(const y in u)p+=`${y.replace(/[A-Z]/g,x=>"-"+x.toLowerCase())}: ${u[y]};`;h+=`${l} { ${p} }
|
|
4
|
+
`):"")}}if(X(o,n,s),n&&(n[o.key]=o,n.__ref?.__children&&(n.__ref.__children.includes(o.key)||n.__ref.__children.push(o.key))),typeof o.html=="function"&&o.node&&!o.node.innerHTML)try{const p=o.html(o,o.state,o.context);p!=null&&typeof p!="function"&&(o.node.innerHTML=p)}catch{}if(L("Create",o,r),L("Complete",o,r),L("Render",o,r),L("RenderRouter",o,r),typeof o.onFrame=="function"){const p=o.onFrame,y=o.context?.designSystem,x=()=>{if(o.node){if(o.node.isConnected){y&&$(y);try{p(o,o.state,o.context)}catch(g){console.error("[DOMQL] onFrame error:",g)}finally{y&&N()}}requestAnimationFrame(x)}};requestAnimationFrame(x)}return o}function bt(t,n,c){const r=!n,s=c.state&&typeof c.state=="object"&&!Array.isArray(c.state)&&Object.keys(c.state).length===0,o=r&&s&&t.context?.state,i=c.state!==void 0&&!o?c.state:t.state&&!W(t.state)?t.state:void 0;if(i==null){if(n?.state)t.state=n.state,K(t,t.state);else if(t.context?.state){const f=t.context.state,a={...f},e=t.context?.polyglot;if(e?.translations){const d=f.lang||e.defaultLang||"en",h=e.translations[d];if(h&&typeof h=="object")for(const u in h)a[u]===void 0&&(a[u]=h[u]);const b=new Set(e.languages||[]);for(const u in e.translations)!b.has(u)&&a[u]===void 0&&(a[u]=e.translations[u])}t.state=W(a)?a:V(a),t.state.__element=t,t.state.root=t.state,K(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),K(t,t.state);return}if(typeof i=="string"){if(t.state=ct(i,n),t.state&&typeof t.state=="object"&&!W(t.state)){const f=n?.state?.root||n?.state||t.state;Object.defineProperty(t.state,"root",{value:f,enumerable:!1,configurable:!0,writable:!0})}K(t,t.state);return}if(typeof i=="function"){const f=i(t,n?.state);t.state=V(f||{})}else t.state=V({...i});t.state.__element=t,n?.state?(t.state.parent=n.state,t.state.root=n.state.root||n.state):t.state.root=t.state,K(t,t.state)}function Y(t,n){if(!n)return t;const c=n.split("/");let r=t;for(const s of c){if(r==null)return{};r=r[s]}return r??{}}function ct(t,n){if(!n)return{};if(t===".")return n.state||{};if(t.startsWith("../")){const s=t.slice(3);return s?Y(n.state,s):n.state??{}}if(t.startsWith("~/")){const s=n.state?.root||n.state,o=t.slice(2);return o?Y(s,o):s??{}}if(n.state?.[t]!==void 0)return n.state[t];const c=Y(n.state,t);if(c!=null&&Object.keys(c).length>0)return c;const r=n.context?.polyglot;if(r?.translations){const s=n.state?.root?.lang||r.defaultLang||"en",o=r.translations[s];if(o?.[t]!==void 0)return o[t];if(r.translations[t]!==void 0)return r.translations[t]}return{}}function xt(t){const n=t.__ref,c=t.tag||"div",r=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"||E.has(f))continue;const a=f.charCodeAt(0);a>=65&&a<=90||T(f)||j[f]||C&&C.has(f)||z(c,f)||s.push({prop:f,fn:t[f]})}for(let i=0;i<s.length;i++){const{prop:f,fn:a}=s[i];n.__exec[f]=a,Object.defineProperty(t,f,{get(){r&&$(r);try{return a(t,t.state,t.context)}catch{return}finally{r&&N()}},set(e){delete n.__exec[f],Object.defineProperty(t,f,{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}}function q(t,n){const c=t.__ref;if(xt(t),typeof t.text=="function"){const s=t.text,o=A(()=>{if(!c.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=Z.call(t,i,t.state)),t.tag==="string"?t.node.nodeValue=i:t.node.textContent=i)}catch{}},{depth:c.path.length});c.__effects.push(o),c.__exec.text=s}else if(typeof t.text=="string"&&t.text.includes("{{")){const s=t.text,o=A(()=>{if(c.contentManaged)return;const i=Z.call(t,s,t.state);i!=null&&(t.text=i),t.node&&(t.tag==="string"?t.node.nodeValue=i??"":t.node.textContent=i??"")},{depth:c.path.length});c.__effects.push(o),c.__exec.text=s}for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&typeof t[s]=="function"&&!E.has(s)&&!T(s)&&!c.__exec[s]){if(j[s]){const o=t[s],i=s,f=A(()=>{const a=t.context?.designSystem;a&&$(a);try{const e=o(t,t.state,t.context),d=j[i](e,t,t.state,t.context);d&&t.node?D(t.node,d):t.node&&(i==="show"||i==="hide")&&(t.node.style.display="")}finally{a&&N()}},{depth:c.path.length});c.__effects.push(f),c.__exec[s]=o}else if(C&&C.has(s)){const o=t[s],i=s,f=A(()=>{const a=t.context?.designSystem;a&&$(a);try{const e=o(t,t.state,t.context);t.node&&(e!=null?D(t.node,{[i]:e}):t.node.style[i]="")}finally{a&&N()}},{depth:c.path.length});c.__effects.push(f),c.__exec[s]=o}}if(typeof n.html=="function"){const s=n.html,o=A(()=>{const i=s(t,t.state,t.context);t.node&&i!=null&&typeof i!="function"&&(t.node.innerHTML=i)},{depth:c.path.length});c.__effects.push(o),c.__exec.html=s}if(typeof n.value=="function"){const s=n.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 a=typeof document<"u"&&document.activeElement===t.node,e=a&&typeof t.node.selectionStart=="number"?t.node.selectionStart:null,d=a&&typeof t.node.selectionEnd=="number"?t.node.selectionEnd:null;if(t.node.value=f,a&&e!=null&&d!=null)try{t.node.setSelectionRange(e,d)}catch{}}catch{}},{depth:c.path.length});c.__effects.push(o),c.__exec.value=s}if(typeof n.style=="function"){const s=n.style,o=A(()=>{const i=s(t,t.state,t.context);D(t.node,i)},{depth:c.path.length});c.__effects.push(o),c.__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;const i=A(()=>{try{const f=o(t,t.state,t.context);t.node&&D(t.node,{[s]:f})}catch{}},{depth:c.path.length});c.__effects.push(i)}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 a=o(t,t.state,t.context);t.node?.setAttribute&&(a==null||a===!1?t.node.removeAttribute(i):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(i,a===!0?"":a))}catch{}},{depth:c.path.length});c.__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,a=>"-"+a.toLowerCase()),f=A(()=>{try{const a=o(t,t.state,t.context);if(!t.node?.setAttribute)return;a==null||a===!1?t.node.removeAttribute(i):typeof a!="function"&&typeof a!="object"&&t.node.setAttribute(i,a===!0?"":a)}catch{}},{depth:c.path.length});c.__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,e=>"-"+e.toLowerCase()),a=A(()=>{try{const e=o(t,t.state,t.context);if(!t.node?.setAttribute)return;e==null||e===!1?t.node.removeAttribute(f):typeof e!="function"&&typeof e!="object"&&t.node.setAttribute(f,e===!0?"":e)}catch{}},{depth:c.path.length});c.__effects.push(a)}const r=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(r)for(const s in r){const o=r[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:c.path.length});c.__effects.push(i)}if(typeof n.if=="function"){const s=n.if,o=A(()=>{const i=s(t,t.state,t.context),f=c.__if;if(c.__if=!!i,f&&!c.__if&&t.node)t.node.remove();else if(!f&&c.__if)if(c.__ifInitialized){t.node||(t.node=H(t));const a=t.parent,e=a?.node;if(e&&t.node){let d=null;const h=Object.keys(a),b=h.indexOf(t.key);for(let u=b+1;u<h.length;u++){const l=a[h[u]];if(l?.node?.parentNode===e){d=l.node;break}}d?e.insertBefore(t.node,d):e.appendChild(t.node)}else X(t,t.parent);G(t)}else{if(c.__ifInitialized=!0,t.tag||(t.tag=ot(t)),L("Init",t,{}),t.node||(t.node=H(t)),!t.node)return;L("AttachNode",t,{}),t.node.setAttribute&&t.key&&t.node.setAttribute("data-key",t.key),t.id&&t.node.setAttribute&&(t.node.id=t.id);const a=n.if;delete n.if;try{q(t,n)}finally{n.if=a}G(t),nt(t),it(t,{}),rt(t,{}),X(t,t.parent)}},{depth:c.path.length});c.__effects.push(o)}for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||E.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||T(s))continue;const i=t[s];c.__exec[s]=i;const f=t.tag||"div";if(z(f,s)&&!j[s]&&!(C&&C.has(s))){const a=s,e=A(()=>{try{const d=i(t,t.state,t.context);t.node?.setAttribute&&(d==null||d===!1?t.node.removeAttribute(a):typeof d!="function"&&typeof d!="object"&&(a==="src"&&"src"in t.node?t.node.src=d:t.node.setAttribute(a,d===!0?"":d)))}catch{}},{depth:c.path.length});c.__effects.push(e)}}At(t)}function G(t){const{node:n}=t;if(n){if(typeof t.text=="string"&&!t.text.includes("{{")?t.tag==="string"?n.nodeValue=t.text:n.textContent=t.text:typeof t.text=="number"&&(n.textContent=t.text),jt(t),typeof t.html=="string"&&(n.innerHTML=t.html),t.value!=null&&typeof t.value!="function"&&"value"in n){const c=String(t.value);n.value!==c&&(n.value=c)}if(t.style&&typeof t.style=="object"&&D(n,t.style),t.attr&&typeof t.attr=="object")for(const c in t.attr){const r=t.attr[c];typeof r=="function"||typeof r=="object"||r==null||r===!1||n.setAttribute&&n.setAttribute(c,r===!0?"":r)}if(t.data&&typeof t.data=="object")for(const c in t.data){const r=t.data[c];typeof r=="function"||typeof r=="object"||r==null||r===!1||n.dataset&&(n.dataset[c]=r===!0?"":r)}if(t.classlist||t.class){const c=t.classlist||t.class;if(typeof c=="string")c.split(" ").forEach(r=>r&&n.classList.add(r));else if(typeof c=="object")for(const r in c){const s=typeof c[r]=="function"?c[r](t,t.state,t.context):c[r];s&&n.classList.add(typeof s=="string"?s:r)}}}}function D(t,n){if(!t||!n||!t.style)return;let c=null;for(const r in n){const s=n[r];if(s!=null){if(r.charAt(0)==="&"&&typeof s=="object"){c||(c={}),c[r]=s;continue}try{const o=String(s),i=r.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),f=o.trim(),a=/\s*!important\s*$/.test(f),e=f.replace(/\s*!important\s*$/,"");t.style.setProperty(i,e,a?"important":"")}catch{}}}c&&_t(t,c)}let gt=0;function _t(t,n){const c=`_ds${gt++}`;t.classList.add(c);const r=t.ownerDocument;let s=r.querySelector("style[data-smbls-scoped]");s||(s=r.createElement("style"),s.setAttribute("data-smbls-scoped",""),r.head.appendChild(s));let o="";for(const i in n){const f="."+c,a=i.replace(/&/g,f).split(",").map(d=>{const h=d.trim();return h.includes(f)?h:f+h}).join(", "),e=n[i];if(typeof e=="object"){let d="",h="";for(const b in e){const u=e[b];if(typeof u=="object"){const l=b.includes("&")?a.split(", ").map(y=>b.replace(/&/g,y)).join(", "):a.split(", ").map(y=>`${y} ${b}`).join(", ");let p="";for(const y in u)p+=`${y.replace(/[A-Z]/g,x=>"-"+x.toLowerCase())}: ${u[y]};`;h+=`${l} { ${p} }
|
|
5
5
|
`}else d+=`${b.replace(/[A-Z]/g,l=>"-"+l.toLowerCase())}: ${u};`}d&&(o+=`${a} { ${d} }
|
|
6
|
-
`),h&&(o+=h)}}o&&(s.textContent+=o)}function gt(t){const n=t.__ref;n.__conditionalRunners=[];for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const r=c.charAt(0);if(r!=="."&&r!=="!")continue;const s=c.slice(1);if(!s)continue;const o=t[c];if(!o||typeof o!="object")continue;const i=r==="!",f={lastMatch:!1,appliedKeys:null},a=()=>{if(!t.node)return;let d;const h=t[s];if(h===void 0)if(t.state&&s in t.state)d=t.state[s];else{const l=t.context?.cases?.[s];if(l===void 0)return;d=typeof l=="function"?l.call(t,t):l}else typeof h=="function"?d=h(t,t.state,t.context):d=h;const b=i?!d:!!d;if(b===f.lastMatch)return;f.lastMatch=b;const u=t.context?.designSystem;u&&$(u);try{if(b){const l={};for(const y in o){if(!Object.prototype.hasOwnProperty.call(o,y))continue;const x=typeof o[y]=="function"?o[y](t,t.state,t.context):o[y];if(x!=null)if(v[y]){const g=v[y](x,t,t.state,t.context);if(g){const O=Array.isArray(g)?g:[g];for(const A of O)A&&Object.assign(l,A)}}else C&&C.has(y)&&(l[y]=x)}const p=Object.keys(l);p.length?(D(t.node,l),f.appliedKeys=p):f.appliedKeys=null}else if(f.appliedKeys){for(const l of f.appliedKeys)t.node.style[l]="";f.appliedKeys=null}}finally{u&&N()}};n.__conditionalRunners.push(a);const e=j(a,{depth:n.path.length});n.__effects.push(e)}}const G=new WeakSet;function At(t){const{node:n}=t;if(!n)return;if(G.has(t)){console.error("[applyCssInProps] re-entry detected for element",t.key,"prop path:",t.__ref?.path);return}G.add(t);const c=t.context?.designSystem;c&&$(c);try{const r={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||E.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!T(o)){if(v[o]){const f=t[o],a=v[o](f,t,t.state,t.context);if(a){if(Array.isArray(a))for(const e of a)e&&Object.assign(r,e);else Object.assign(r,a);s=!0}}else if(C&&C.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(r[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(r[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(r[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const a={};for(const e in f){let d=f[e];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function"))if(v[e]){const h=v[e](d,t,t.state,t.context);if(h)if(Array.isArray(h))for(const b of h)b&&Object.assign(a,b);else Object.assign(a,h)}else a[e]=d}if(Object.keys(a).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 d={};for(const b in a){const u=a[b];d[b]=typeof u=="string"&&!u.includes("!important")?u+" !important":u}const h=o.slice(1);r[`[data-theme="${h}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const b=o.slice(1),u=t.context?.designSystem?.media?.[b]||t.context?.designSystem?.media?.[b];u&&(d=`@media ${u}`)}const h={};for(const b in a){const u=a[b];if(u&&typeof u=="object"&&!Array.isArray(u)){const l={};for(const y in u)if(v[y]){const x=v[y](u[y],t,t.state,t.context);if(x)if(Array.isArray(x))for(const g of x)g&&Object.assign(l,g);else Object.assign(l,x)}else l[y]=u[y];const p=b.startsWith(":")?"":" ";if(d.includes(",")){const y=d.split(",").map(x=>`${x.trim()}${p}${b}`).join(", ");r[y]=l}else r[`${d}${p}${b}`]=l}else h[b]=u}Object.keys(h).length&&(r[d]=h)}s=!0}s=!0}}}}if(s){r.display&&String(r.display).includes("!important")&&(n.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const o=dt(r,null,t.context?.cssPrefix);o&&n.classList&&o.split(" ").forEach(f=>f&&n.classList.add(f));const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const f=r.display;if(f&&f!==i)if(i==="none"){const a=[];for(const e of n.classList)e.startsWith("_d-")&&e!=="_d-none"&&a.push(e);for(const e of a)n.classList.remove(e);n.classList.add("_d-none")}else n.style.display=t.display}}}finally{c&&N(),G.delete(t)}}function ct(t){const{node:n}=t;if(!n||!n.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());n.setAttribute(i,o===!0?"":o)}const c=ut(t);for(const s in c){const o=c[s];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&n.setAttribute(s,o===!0?"":o)}const r=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||E.has(s)||s==="on"||c[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!T(s)&&!(v[s]||C&&C.has(s))&&Z(r,s)){let i=t[s];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=H(i,t,t.state,t.context),t[s]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;n.setAttribute(s,i===!0?"":i)}}}function nt(t,n){for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||!T(c))continue;let r=t[c];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const o=r;r=function(f){return t.call(o,f)}}if(typeof r!="function")continue;const s=yt(c);rt.has(s)||ft(lt(s),t,r)}}function Q(t,n){const c={...t};for(const r in n){const s=c[r],o=n[r];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?c[r]=Q(s,o):c[r]=o}return c}function U(t,n,c){if(!n||!t.node)return;const r=t.childExtends;if(Array.isArray(n)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const i=t.childProps,f=t.childrenAs;for(let a=0;a<n.length;a++){let e=n[a];const d=e;(typeof e=="string"||typeof e=="number")&&(e={text:e});let h=i;if(typeof i=="function")try{h=i(t,e)}catch{h=null}if(f==="state"){let l=d;(typeof d=="string"||typeof d=="number")&&(l={value:d,text:d}),e=h?{...h,state:l}:{state:l}}else h&&(e=Q(h,e));if(r&&!e.ignoreChildExtends)if(e.extends){const l=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(r)?r:[r];e={...e,extends:[...p,...l]}}else e={extends:r,...e};const b=e?.key||`${a}`,u=F(e,t,b,c);u?.node&&o.appendChild(u.node)}t.node.appendChild(o);return}if(typeof n=="string"){const s=st(n,t);if(Array.isArray(s)){U(t,s,c);return}}if(typeof n=="object")for(const s in n){if(E.has(s))continue;let o=n[s];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=Q(t.childProps,o)),r&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(r)?r:[r];o={...o,extends:[...f,...i]}}else o={extends:r,...o};F(o,t,s,c)}}}function it(t,n){let{children:c,content:r}=t;const s=t.childExtends;if(typeof c=="function"){const i=c;c=i(t,t.state,t.context),t.children=c;const f=t.__ref;let a=!1;const e=j(()=>{const d=i(t,t.state,t.context);if(!a){a=!0;return}if(d===t.children)return;if(t.children=d,Array.isArray(d)&&t.childrenAs==="state"){const u=t.childProps,l=[],p=new Map;for(let A=0;A<d.length;A++){const k=d[A];let _=u;if(typeof u=="function")try{_=u(t,k)}catch{_=null}const R=_&&_.key||k&&k.key||`${A}`;l.push(R),p.set(R,{rawChild:k,childProps:_})}const y=new Set(l);for(let A=f.__children.length-1;A>=0;A--){const k=f.__children[A];if(!y.has(k)){const _=t[k];_?.remove&&_.remove(),delete t[k],f.__children.splice(A,1)}}const x=t.childExtends,O=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const A of l){const k=p.get(A),_=k.rawChild,R=t[A];if(R&&R.state){if(_&&typeof _=="object"){const w=R.state;if(typeof w.replace=="function")w.replace(_);else if(typeof w.update=="function"){for(const S in w)if(!(S==="__element"||S==="root"||S==="parent"||S==="update")&&!Object.prototype.hasOwnProperty.call(_,S))try{w[S]=void 0}catch{}w.update(_)}else for(const S in _)w[S]=_[S]}continue}let K=_;(typeof _=="string"||typeof _=="number")&&(K={value:_,text:_});const X=k.childProps;let P=X?{...X,state:K}:{state:K};if(x&&!P.ignoreChildExtends)if(P.extends){const w=Array.isArray(P.extends)?P.extends:[P.extends],S=Array.isArray(x)?x:[x];P={...P,extends:[...S,...w]}}else P={extends:x,...P};const m=F(P,t,A,n);m?.node&&O&&O.appendChild(m.node)}O&&O.childNodes.length&&t.node&&t.node.appendChild(O),f.__children=l;return}for(const u of[...f.__children]){const l=t[u];l?.remove&&l.remove(),delete t[u]}f.__children=[],U(t,d,n)},{depth:f.path.length});f.__effects.push(e)}if(U(t,c||r,n),c||r)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let f=0;f<i.length;f++){const a=i[f];if(!a.endsWith("Extends")||typeof t[a]!="string")continue;const e=a.slice(0,-7);if(!e||e.charCodeAt(0)<65||e.charCodeAt(0)>90)continue;const d={extends:t[a]};delete t[a];for(let h=f+1;h<i.length;h++){const b=i[h],u=b.charCodeAt(0);if(u>=65&&u<=90||E.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const l=t[b];l!==void 0&&(d[b]=l,delete t[b])}t[e]&&typeof t[e]=="object"?t[e]={...d,...t[e]}:t[e]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||E.has(i)||typeof t[i]!="object"||t[i]===null)continue;const f=i.charCodeAt(0);if(f<65||f>90)continue;let a=t[i];if(!a.__ref){if(!a.extends&&!a.extend){const e=o[i]||o[`smbls.${i}`];e&&(a={extends:e,...a})}if(t.childProps&&(a={...t.childProps,...a}),s&&!a.ignoreChildExtends)if(a.extends){const e=Array.isArray(a.extends)?a.extends:[a.extends],d=Array.isArray(s)?s:[s];a={...a,extends:[...d,...e]}}else a={extends:s,...a};F(a,t,i,n)}}}function J(t,n,c){const{node:r}=t;if(!r)return;const s=n?.node||(n?.nodeType?n:null);if(s)if(c?.position==="before"&&c.node)s.insertBefore(r,c.node);else if(c?.position==="after"&&c.node){const o=c.node.nextSibling;o?s.insertBefore(r,o):s.appendChild(r)}else s.appendChild(r)}function L(t,n,c){const r=t.charAt(0).toLowerCase()+t.slice(1);n.context?.plugins?.length&&ot(r,n,c);const s="on"+t,o=n[s];if(typeof o=="function"){const i=n.context?.designSystem;i&&$(i);try{if(o(n,n.state,n.context,c)===!1)return!1}catch(f){if(n.context?.plugins?.length&&ot("error",n,{hook:s,error:f})||console.error(`[DOMQL] Lifecycle "${s}" error:`,f),n.context?.strictMode)throw f}finally{i&&N()}}return!0}var Mt=F;export{F as create,Mt as default};
|
|
6
|
+
`),h&&(o+=h)}}o&&(s.textContent+=o)}function At(t){const n=t.__ref;n.__conditionalRunners=[];for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const r=c.charAt(0);if(r!=="."&&r!=="!")continue;const s=c.slice(1);if(!s)continue;const o=t[c];if(!o||typeof o!="object")continue;const i=r==="!",f={lastMatch:!1,appliedKeys:null},a=()=>{if(!t.node)return;let d;const h=t[s];if(h===void 0)if(t.state&&s in t.state)d=t.state[s];else{const l=t.context?.cases?.[s];if(l===void 0)return;d=typeof l=="function"?l.call(t,t):l}else typeof h=="function"?d=h(t,t.state,t.context):d=h;const b=i?!d:!!d;if(b===f.lastMatch)return;f.lastMatch=b;const u=t.context?.designSystem;u&&$(u);try{if(b){const l={};for(const y in o){if(!Object.prototype.hasOwnProperty.call(o,y))continue;const x=typeof o[y]=="function"?o[y](t,t.state,t.context):o[y];if(x!=null)if(j[y]){const g=j[y](x,t,t.state,t.context);if(g){const I=Array.isArray(g)?g:[g];for(const w of I)w&&Object.assign(l,w)}}else C&&C.has(y)&&(l[y]=x)}const p=Object.keys(l);p.length?(D(t.node,l),f.appliedKeys=p):f.appliedKeys=null}else if(f.appliedKeys){for(const l of f.appliedKeys)t.node.style[l]="";f.appliedKeys=null}}finally{u&&N()}};n.__conditionalRunners.push(a);const e=A(a,{depth:n.path.length});n.__effects.push(e)}}const Q=new WeakSet;function jt(t){const{node:n}=t;if(!n)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 c=t.context?.designSystem;c&&$(c);try{const r={};let s=!1;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||typeof t[o]=="function"||E.has(o))continue;const i=o.charCodeAt(0);if(!(i>=65&&i<=90)&&!T(o)){if(j[o]){const f=t[o],a=j[o](f,t,t.state,t.context);if(a){if(Array.isArray(a))for(const e of a)e&&Object.assign(r,e);else Object.assign(r,a);s=!0}}else if(C&&C.has(o)){const f=t[o];f!=null&&typeof f!="object"&&(r[o]=f,s=!0)}else if(o.charCodeAt(0)===45){const f=t[o];f!=null&&typeof f!="object"&&(r[o]=f,s=!0)}else if(o.charAt(0)==="&"){const f=t[o];f&&typeof f=="object"&&(r[o]=f,s=!0)}else if(o.charAt(0)==="@"||o.charAt(0)===":"){const f=t[o];if(f&&typeof f=="object"){const a={};for(const e in f){let d=f[e];if(typeof d=="function"&&(d=d(t,t.state,t.context)),!(d==null||typeof d=="function"))if(j[e]){const h=j[e](d,t,t.state,t.context);if(h)if(Array.isArray(h))for(const b of h)b&&Object.assign(a,b);else Object.assign(a,h)}else a[e]=d}if(Object.keys(a).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 d={};for(const b in a){const u=a[b];d[b]=typeof u=="string"&&!u.includes("!important")?u+" !important":u}const h=o.slice(1);r[`[data-theme="${h}"] &`]=d}else{let d=o;if(o.charAt(0)==="@"&&!o.startsWith("@media")&&!o.startsWith("@keyframes")){const b=o.slice(1),u=t.context?.designSystem?.media?.[b]||t.context?.designSystem?.media?.[b];u&&(d=`@media ${u}`)}const h={};for(const b in a){const u=a[b];if(u&&typeof u=="object"&&!Array.isArray(u)){const l={};for(const y in u)if(j[y]){const x=j[y](u[y],t,t.state,t.context);if(x)if(Array.isArray(x))for(const g of x)g&&Object.assign(l,g);else Object.assign(l,x)}else l[y]=u[y];const p=b.startsWith(":")?"":" ";if(d.includes(",")){const y=d.split(",").map(x=>`${x.trim()}${p}${b}`).join(", ");r[y]=l}else r[`${d}${p}${b}`]=l}else h[b]=u}Object.keys(h).length&&(r[d]=h)}s=!0}s=!0}}}}if(s){r.display&&String(r.display).includes("!important")&&(n.style.setProperty("display",String(r.display).replace(/\s*!important\s*$/,""),"important"),delete r.display);const o=ut(r,null,t.context?.cssPrefix);o&&n.classList&&o.split(" ").forEach(f=>f&&n.classList.add(f));const i=t.display!=null&&typeof t.display!="function"?t.display:t.hide===!0||t.show===!1?"none":null;if(i!=null){const f=r.display;if(f&&f!==i)if(i==="none"){const a=[];for(const e of n.classList)e.startsWith("_d-")&&e!=="_d-none"&&a.push(e);for(const e of a)n.classList.remove(e);n.classList.add("_d-none")}else n.style.display=t.display}}}finally{c&&N(),Q.delete(t)}}function nt(t){const{node:n}=t;if(!n||!n.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());n.setAttribute(i,o===!0?"":o)}const c=pt(t);for(const s in c){const o=c[s];o!=null&&o!==!1&&typeof o!="function"&&typeof o!="object"&&n.setAttribute(s,o===!0?"":o)}const r=t.tag||"div";for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||typeof t[s]=="function"||E.has(s)||s==="on"||c[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!T(s)&&!(j[s]||C&&C.has(s))&&z(r,s)){let i=t[s];if(i==null||i===!1||(typeof i=="string"&&i.includes("{{")&&(i=Z(i,t,t.state,t.context),t[s]=i),i==null||i===!1||typeof i=="function"||typeof i=="object"))continue;n.setAttribute(s,i===!0?"":i)}}}function it(t,n){for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||!T(c))continue;let r=t[c];if(typeof r=="string"&&/^[A-Za-z_$][\w$]*$/.test(r)){const o=r;r=function(f){return t.call(o,f)}}if(typeof r!="function")continue;const s=lt(c);ft.has(s)||at(ht(s),t,r)}}function U(t,n){const c={...t};for(const r in n){const s=c[r],o=n[r];s&&o&&typeof s=="object"&&typeof o=="object"&&!Array.isArray(s)&&!Array.isArray(o)&&typeof s!="function"&&typeof o!="function"?c[r]=U(s,o):c[r]=o}return c}function J(t,n,c){if(!n||!t.node)return;const r=t.childExtends;if(Array.isArray(n)){const o=(t.context?.document||globalThis.document)?.createDocumentFragment();if(!o)return;const i=t.childProps,f=t.childrenAs;for(let a=0;a<n.length;a++){let e=n[a];const d=e;(typeof e=="string"||typeof e=="number")&&(e={text:e});let h=i;if(typeof i=="function")try{h=i(t,e)}catch{h=null}if(f==="state"){let l=d;(typeof d=="string"||typeof d=="number")&&(l={value:d,text:d}),e=h?{...h,state:l}:{state:l}}else h&&(e=U(h,e));if(r&&!e.ignoreChildExtends)if(e.extends){const l=Array.isArray(e.extends)?e.extends:[e.extends],p=Array.isArray(r)?r:[r];e={...e,extends:[...p,...l]}}else e={extends:r,...e};const b=e?.key||`${a}`,u=F(e,t,b,c);u?.node&&o.appendChild(u.node)}t.node.appendChild(o);return}if(typeof n=="string"){const s=ct(n,t);if(Array.isArray(s)){J(t,s,c);return}}if(typeof n=="object")for(const s in n){if(E.has(s))continue;let o=n[s];if(!(o==null||o===!1)){if((typeof o=="string"||typeof o=="number")&&(o={text:o}),t.childProps&&(o=U(t.childProps,o)),r&&!o.ignoreChildExtends)if(o.extends){const i=Array.isArray(o.extends)?o.extends:[o.extends],f=Array.isArray(r)?r:[r];o={...o,extends:[...f,...i]}}else o={extends:r,...o};F(o,t,s,c)}}}function rt(t,n){let{children:c,content:r}=t;const s=t.childExtends;if(typeof c=="function"){const i=c;c=i(t,t.state,t.context),t.children=c;const f=t.__ref;let a=!1;const e=A(()=>{const d=i(t,t.state,t.context);if(!a){a=!0;return}if(d===t.children)return;if(t.children=d,Array.isArray(d)&&t.childrenAs==="state"){const u=t.childProps,l=[],p=new Map;for(let v=0;v<d.length;v++){const S=d[v];let _=u;if(typeof u=="function")try{_=u(t,S)}catch{_=null}const R=_&&_.key||S&&S.key||`${v}`;l.push(R),p.set(R,{rawChild:S,childProps:_})}const y=new Set(l),x=f.__children.slice();for(const v of x)if(!y.has(v)){const S=t[v];S?.remove&&S.remove(),delete t[v]}const g=t.childExtends,w=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const v of l){const S=p.get(v),_=S.rawChild,R=t[v];if(R&&R.state){if(_&&typeof _=="object"){const P=R.state;if(typeof P.replace=="function")P.replace(_);else if(typeof P.update=="function"){for(const k in P)if(!(k==="__element"||k==="root"||k==="parent"||k==="update")&&!Object.prototype.hasOwnProperty.call(_,k))try{P[k]=void 0}catch{}P.update(_)}else for(const k in _)P[k]=_[k]}continue}let M=_;(typeof _=="string"||typeof _=="number")&&(M={value:_,text:_});const m=S.childProps;let O=m?{...m,state:M}:{state:M};if(g&&!O.ignoreChildExtends)if(O.extends){const P=Array.isArray(O.extends)?O.extends:[O.extends],k=Array.isArray(g)?g:[g];O={...O,extends:[...k,...P]}}else O={extends:g,...O};const tt=F(O,t,v,n);tt?.node&&w&&w.appendChild(tt.node)}w&&w.childNodes.length&&t.node&&t.node.appendChild(w),f.__children=l;return}for(const u of[...f.__children]){const l=t[u];l?.remove&&l.remove(),delete t[u]}f.__children=[],J(t,d,n)},{depth:f.path.length});f.__effects.push(e)}if(J(t,c||r,n),c||r)return;const o=t.context?.components||{};{const i=Object.keys(t);for(let f=0;f<i.length;f++){const a=i[f];if(!a.endsWith("Extends")||typeof t[a]!="string")continue;const e=a.slice(0,-7);if(!e||e.charCodeAt(0)<65||e.charCodeAt(0)>90)continue;const d={extends:t[a]};delete t[a];for(let h=f+1;h<i.length;h++){const b=i[h],u=b.charCodeAt(0);if(u>=65&&u<=90||E.has(b)||typeof t[b]=="function"&&(b.startsWith("on")||b.startsWith(".")))break;const l=t[b];l!==void 0&&(d[b]=l,delete t[b])}t[e]&&typeof t[e]=="object"?t[e]={...d,...t[e]}:t[e]=d}}for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||E.has(i)||typeof t[i]!="object"||t[i]===null)continue;const f=i.charCodeAt(0);if(f<65||f>90)continue;let a=t[i];if(!a.__ref){if(!a.extends&&!a.extend){const e=o[i]||o[`smbls.${i}`];e&&(a={extends:e,...a})}if(t.childProps&&(a={...t.childProps,...a}),s&&!a.ignoreChildExtends)if(a.extends){const e=Array.isArray(a.extends)?a.extends:[a.extends],d=Array.isArray(s)?s:[s];a={...a,extends:[...d,...e]}}else a={extends:s,...a};F(a,t,i,n)}}}function X(t,n,c){const{node:r}=t;if(!r)return;const s=n?.node||(n?.nodeType?n:null);if(s)if(c?.position==="before"&&c.node)s.insertBefore(r,c.node);else if(c?.position==="after"&&c.node){const o=c.node.nextSibling;o?s.insertBefore(r,o):s.appendChild(r)}else s.appendChild(r)}function L(t,n,c){const r=t.charAt(0).toLowerCase()+t.slice(1);n.context?.plugins?.length&&st(r,n,c);const s="on"+t,o=n[s];if(typeof o=="function"){const i=n.context?.designSystem;i&&$(i);try{if(o(n,n.state,n.context,c)===!1)return!1}catch(f){if(n.context?.plugins?.length&&st("error",n,{hook:s,error:f})||console.error(`[DOMQL] Lifecycle "${s}" error:`,f),n.context?.strictMode)throw f}finally{i&&N()}}return!0}var Vt=F;export{F as create,Vt as default};
|
package/dist/esm/src/methods.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{update as l}from"./update.js";import{remove as u}from"./dispose.js";import"css-in-props";import{getDB as h,getQuery as a,getRootData as _,getRootState as g,getRoot as p,getRootContext as y,getContext as d,getChildren as k,getPath as m,nextElement as w,previousElement as x,verbose as C,warn as R,error as S,variables as v,spotByPath as P}from"@symbo.ls/utils";function f(t,e,
|
|
1
|
+
import{update as l}from"./update.js";import{remove as u}from"./dispose.js";import"css-in-props";import{getDB as h,getQuery as a,getRootData as _,getRootState as g,getRoot as p,getRootContext as y,getContext as d,getChildren as k,getPath as m,nextElement as w,previousElement as x,verbose as C,warn as R,error as S,variables as v,spotByPath as P}from"@symbo.ls/utils";function f(t,e,n){const o=t?.context?.analyze;if(!o||!o.emit||e==="warn"&&!o.shouldCapture("warnings")||e==="error"&&!o.shouldCapture("errors"))return;const r=n.map(s=>s?.message||(typeof s=="string"?s:null)).filter(Boolean).join(" ");o.emit({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,ts:Date.now(),type:e==="error"?"error":"warning",level:e,hook:e==="error"?"el.error":"el.warn",element:{key:t.key!=null?String(t.key):null,name:t.__name||null,tag:t.tag||null},message:r||null,args:n})}function b(...t){return f(this,"warn",t),R.apply(this,t)}function D(...t){return f(this,"error",t),S.apply(this,t)}const i={update:l,remove:u,getDB:h,getQuery:a,getRootData:_,getChildren:k,getPath:m,nextElement:w,previousElement:x,verbose:C,warn:b,error:D,variables:v,spotByPath:P,set(t,e){if(this.removeContent(),t!=null){const n=this.context?.__create;n&&n(t,this,"content",e)}this.__ref&&(this.__ref.contentManaged=!0)},reset(t){const e=this.context?.__create;if(!e)return this;const n=this.parent,o=this.key,r=this.parse();return this.remove(),e(r,n,o,t)},lookup(t){let e=this.parent;for(;e;){if(typeof t=="function"){if(t(e))return e}else if(typeof t=="string"){if(e.key===t)return e;if(e[t]&&e[t].__ref)return e[t]}e=e.parent}return null},lookdown(t){const e=this.__ref;if(!e?.__children)return null;for(const n of e.__children){const o=this[n];if(!o)continue;if(typeof t=="function"){if(t(o))return o}else if(typeof t=="string"&&o.key===t)return o;const r=o.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const n=this.__ref;if(!n?.__children)return e;for(const o of n.__children){const r=this[o];r&&(typeof t=="function"?t(r)&&e.push(r):typeof t=="string"&&r.key===t&&e.push(r),r.lookdownAll?.(t,e))}return e},getRef(){return this.__ref},getRoot:p,getRootState:g,getRootContext:y,getContext:d,parse(t){const e={},n=t?new Set(t):null,o=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!n?.has(r)){if(o&&o[r]!==void 0){e[r]=o[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),n=this.__ref;if(n?.__children)for(const o of n.__children)this[o]?.parseDeep&&(e[o]=this[o].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const n of t)e[n]=this[n];console.log(e)}else console.log(this)},setProps(t,e){return this.update(t,e)},setNodeStyles(t){if(this.node?.style)for(const e in t){const n=t[e];if(n==null)continue;const o=e.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),r=String(n).replace(/\s*!important\s*$/,"");this.node.style.setProperty(o,r,"important")}},call(t,...e){const n=this.context,o=n?.methods?.[t]||n?.functions?.[t]||n?.utils?.[t]||this[t];if(typeof o=="function")return o.call(this,...e)},removeContent(){const t=this.__ref;if(!t?.__children)return;const e=this.content;if(e?.remove){e.remove(),delete this.content;const n=t.__children.indexOf("content");n!==-1&&t.__children.splice(n,1)}e?.node?.parentNode&&e.node.parentNode.removeChild(e.node)}},c=new WeakMap;function O(t){if(!t)return i;let e=c.get(t);if(e)return e;e=Object.create(i);const n=t.methods;if(n)for(const o in n)e[o]=n[o];return c.set(t,e),e}function $(t){const e=O(t.context);Object.setPrototypeOf(t,e)}export{$ as addMethods,i as elementProto};
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/element",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.13",
|
|
4
4
|
"description": "Core element creation, update, and disposal engine for smbls v3.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -21,14 +21,15 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@symbo.ls/signal": "^3.14.
|
|
25
|
-
"@symbo.ls/state": "^3.14.
|
|
26
|
-
"@symbo.ls/utils": "^3.14.
|
|
27
|
-
"css-in-props": "^3.14.
|
|
28
|
-
"attrs-in-props": "^3.14.
|
|
24
|
+
"@symbo.ls/signal": "^3.14.9",
|
|
25
|
+
"@symbo.ls/state": "^3.14.10",
|
|
26
|
+
"@symbo.ls/utils": "^3.14.14",
|
|
27
|
+
"css-in-props": "^3.14.7",
|
|
28
|
+
"attrs-in-props": "^3.14.7"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
|
32
|
+
"*.js",
|
|
32
33
|
"*.md",
|
|
33
34
|
"LICENSE"
|
|
34
35
|
],
|