@symbo.ls/element 3.14.3 → 3.14.4

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 ADDED
@@ -0,0 +1,10 @@
1
+ # @symbo.ls/element
2
+
3
+ ## 3.14.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated patch release for changed packages.
8
+ - Updated dependencies
9
+ - @symbo.ls/state@3.14.2
10
+ - @symbo.ls/utils@3.14.2
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./src/index.js"),module.exports);
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},x=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!b.call(e,r)&&r!==o&&c(e,r,{get:()=>t[r],enumerable:!(n=m(t,r))||n.enumerable});return e};var T=e=>x(c({},"__esModule",{value:!0}),e);var w={};v(w,{SVG_NS:()=>i,SVG_TAGS:()=>s,cacheNode:()=>S,createHTMLNode:()=>f,detectTag:()=>g,isSvgTag:()=>d,isValidTag:()=>l});module.exports=T(w);const i="http://www.w3.org/2000/svg",s=new Set(["svg","path","circle","ellipse","line","polyline","polygon","rect","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","foreignObject","desc","title","metadata"]),y=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","string","fragment","shadow"]);function l(e){return y.has(e)||s.has(e)}function d(e){return s.has(e)}function g(e){let{tag:t,key:o}=e;if(typeof t=="function"&&(t=t(e)),t===!0&&(t=o),typeof t=="string"&&l(t))return t;if(!o||typeof o!="string")return"div";const n=new Set(["html","head","body","meta","link","script","style","title","base","noscript","template"]);let r=o.toLowerCase();return r.includes(".")&&(r=r.split(".")[0]),r.includes("_")&&(r=r.split("_")[0]),l(r)&&!n.has(r)?r:"div"}const p={};function f(e,t){const o=t?.context?.document||globalThis.document;if(!o)return null;if(e==="string")return o.createTextNode(t?.text||"");if(e==="fragment")return o.createDocumentFragment();if(d(e)){const n=t?.parent;if(e==="svg"||n?.node?.namespaceURI===i)return o.createElementNS(i,e);if(e!=="svg")return o.createElement("div")}return o.createElement(e)}function S(e){const t=e.tag=g(e),n=d(t)&&(t==="svg"||e.parent?.node?.namespaceURI===i)?"svg:"+t:t,r=e?.context?.document||globalThis.document;let a=p[n];if(a||(a=p[n]=f(t,e)),!a)return null;const u=r&&a.ownerDocument!==r?f(t,e):a.cloneNode(!0);return t==="string"&&(u.nodeValue=e.text||""),u}
@@ -0,0 +1,6 @@
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:()=>R,default:()=>Ct});module.exports=yt(kt);var N=require("@symbo.ls/signal"),A=require("@symbo.ls/signal"),T=require("./cache.js"),P=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"),K=require("@symbo.ls/state"),C=require("css-in-props/src/props"),k=require("css-in-props/src/props/defaults"),ft=require("@symbo.ls/css"),v=require("@symbo.ls/scratch"),M=require("attrs-in-props");let lt=1;function D(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 R(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=R);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],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]=Z(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],w=g&&x&&typeof g=="object"&&typeof x=="object"&&!Array.isArray(g)&&!Array.isArray(x)&&typeof g!="function"&&typeof x!="function";w&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?o[y]=Z(g,x):w&&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=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,T.detectTag)(o)),$("Init",o,i);const l=o.node=(0,T.cacheNode)(o);if(!l)return o;$("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
+ `+p.stack.split(`
3
+ `).slice(0,6).join(`
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($("Create",o,i),$("Complete",o,i),$("Render",o,i),$("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(g){console.error("[DOMQL] onFrame error:",g)}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,N.isStore)(t.state)?t.state:void 0;if(r==null){if(c?.state)t.state=c.state,(0,K.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,N.isStore)(a)?a:(0,N.createStore)(a),t.state.__element=t,t.state.root=t.state,(0,K.applyStateMethods)(t,t.state)}else t.state={},Object.defineProperty(t.state,"root",{value:t.state,enumerable:!1,configurable:!0,writable:!0}),(0,K.applyStateMethods)(t,t.state);return}if(typeof r=="string"){if(t.state=tt(r,c),t.state&&typeof t.state=="object"&&!(0,N.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,K.applyStateMethods)(t,t.state);return}if(typeof r=="function"){const f=r(t,c?.state);t.state=(0,N.createStore)(f||{})}else t.state=(0,N.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,K.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 _t(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"||P.REGISTRY.has(f))continue;const a=f.charCodeAt(0);a>=65&&a<=90||D(f)||C.CSS_PROPS_REGISTRY[f]||k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(f)||(0,M.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(_t(t),typeof t.text=="function"){const s=t.text,o=(0,A.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=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,A.createEffect)(()=>{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"&&!P.REGISTRY.has(s)&&!D(s)&&!n.__exec[s]){if(C.CSS_PROPS_REGISTRY[s]){const o=t[s],r=s,f=(0,A.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,v.pushConfig)(a);try{const e=o(t,t.state,t.context),d=C.CSS_PROPS_REGISTRY[r](e,t,t.state,t.context);d&&t.node?I(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(k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(s)){const o=t[s],r=s,f=(0,A.createEffect)(()=>{const a=t.context?.designSystem;a&&(0,v.pushConfig)(a);try{const e=o(t,t.state,t.context);t.node&&(e!=null?I(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,A.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,A.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,A.createEffect)(()=>{const r=s(t,t.state,t.context);I(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,A.createEffect)(()=>{try{const f=o(t,t.state,t.context);t.node&&I(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,A.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,A.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,A.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,A.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,A.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,T.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,T.detectTag)(t)),$("Init",t,{}),t.node||(t.node=(0,T.cacheNode)(t)),!t.node)return;$("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)||P.REGISTRY.has(s)||typeof t[s]!="function")continue;const o=s.charCodeAt(0);if(o>=65&&o<=90||D(s))continue;const r=t[s];n.__exec[s]=r;const f=t.tag||"div";if((0,M.checkAttributeByTagName)(f,s)&&!C.CSS_PROPS_REGISTRY[s]&&!(k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(s))){const a=s,e=(0,A.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"&&I(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 I(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 gt=0;function At(t,c){const n=`_ds${gt++}`;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
+ `}else d+=`${b.replace(/[A-Z]/g,l=>"-"+l.toLowerCase())}: ${u};`}d&&(o+=`${a} { ${d} }
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(C.CSS_PROPS_REGISTRY[y]){const g=C.CSS_PROPS_REGISTRY[y](x,t,t.state,t.context);if(g){const w=Array.isArray(g)?g:[g];for(const j of w)j&&Object.assign(l,j)}}else k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(y)&&(l[y]=x)}const p=Object.keys(l);p.length?(I(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,A.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"||P.REGISTRY.has(o))continue;const r=o.charCodeAt(0);if(!(r>=65&&r<=90)&&!D(o)){if(C.CSS_PROPS_REGISTRY[o]){const f=t[o],a=C.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(k.DEFAULT_CSS_PROPERTIES_LIST&&k.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(C.CSS_PROPS_REGISTRY[e]){const h=C.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(C.CSS_PROPS_REGISTRY[y]){const x=C.CSS_PROPS_REGISTRY[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(", ");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,M.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"||P.REGISTRY.has(s)||s==="on"||n[s]!==void 0)continue;const o=s.charCodeAt(0);if(!(o>=65&&o<=90)&&!D(s)&&!(C.CSS_PROPS_REGISTRY[s]||k.DEFAULT_CSS_PROPERTIES_LIST&&k.DEFAULT_CSS_PROPERTIES_LIST.has(s))&&(0,M.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)||!D(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);P.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=R(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(P.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};R(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,A.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 j=0;j<d.length;j++){const S=d[j];let _=u;if(typeof u=="function")try{_=u(t,S)}catch{_=null}const F=_&&_.key||S&&S.key||`${j}`;l.push(F),p.set(F,{rawChild:S,childProps:_})}const y=new Set(l);for(let j=f.__children.length-1;j>=0;j--){const S=f.__children[j];if(!y.has(S)){const _=t[S];_?.remove&&_.remove(),delete t[S],f.__children.splice(j,1)}}const x=t.childExtends,w=(t.context?.document||globalThis.document)?.createDocumentFragment();for(const j of l){const S=p.get(j),_=S.rawChild,F=t[j];if(F&&F.state){if(_&&typeof _=="object"){const L=F.state;if(typeof L.replace=="function")L.replace(_);else if(typeof L.update=="function"){for(const O in L)if(!(O==="__element"||O==="root"||O==="parent"||O==="update")&&!Object.prototype.hasOwnProperty.call(_,O))try{L[O]=void 0}catch{}L.update(_)}else for(const O in _)L[O]=_[O]}continue}let W=_;(typeof _=="string"||typeof _=="number")&&(W={value:_,text:_});const X=S.childProps;let E=X?{...X,state:W}:{state:W};if(x&&!E.ignoreChildExtends)if(E.extends){const L=Array.isArray(E.extends)?E.extends:[E.extends],O=Array.isArray(x)?x:[x];E={...E,extends:[...O,...L]}}else E={extends:x,...E};const m=R(E,t,j,c);m?.node&&w&&w.appendChild(m.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=[],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||P.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)||P.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};R(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 $(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=R;
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var C=(t,r)=>{for(var n in r)a(t,n,{get:r[n],enumerable:!0})},M=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of S(r))!L.call(t,o)&&o!==n&&a(t,o,{get:()=>r[o],enumerable:!(e=w(r,o))||e.enumerable});return t};var T=t=>M(a({},"__esModule",{value:!0}),t);var R={};C(R,{addDelegatedEvent:()=>_,isDelegatable:()=>p,registerEvent:()=>y,removeDelegatedEvent:()=>D});module.exports=T(R);var u=require("./registry.js"),f=require("@symbo.ls/scratch");const d=new WeakMap,A={passive:!0},V={passive:!0,capture:!0},E=(t,r)=>u.PASSIVE_EVENTS.has(t)?r?V:A:r||!1;function h(t){let r=d.get(t);return r||(r={handlers:new Map,installed:new Set},d.set(t,r)),r}function x(t,r){const n=h(r);if(n.installed.has(t))return;n.installed.add(t);const e=t==="focus"||t==="blur"||t==="focusin"||t==="focusout"||t==="mouseenter"||t==="mouseleave",o=t==="mouseenter"||t==="mouseleave";r.addEventListener(t,i=>{let s=i.target;for(;s&&s!==r;){const l=n.handlers.get(t);if(l){const c=l.get(s);if(c){if(o&&i.relatedTarget&&s.contains(i.relatedTarget)){s=s.parentNode;continue}if(c(i),i.cancelBubble)return}}s=s.parentNode}},E(t,e))}function _(t,r,n,e){e||(e=r.ownerDocument?.documentElement||r.getRootNode());const o=h(e);x(t,e),o.handlers.has(t)||o.handlers.set(t,new WeakMap),o.handlers.get(t).set(r,n)}function D(t,r,n){n||(n=r.ownerDocument?.documentElement||r.getRootNode());const e=d.get(n);if(!e)return;const o=e.handlers.get(t);o&&o.delete(r)}function p(t){return u.DELEGATED_EVENTS.has(t)&&!u.LIFECYCLE_EVENTS.has(t)}function y(t,r,n){const{node:e,context:o}=r;if(!e)return;const i=o?.designSystem,s=l=>{i&&(0,f.pushConfig)(i);try{const c=n.call(r,l,r,r.state,o);if(c&&typeof c.then=="function"){c.catch(g=>{r.error=g,console.error("[DOMQL] Async event error:",g)}).finally(()=>{i&&(0,f.popConfig)()});return}}catch(c){if(r.error=c,console.error("[DOMQL] Event error:",c),o?.strictMode)throw c}i&&(0,f.popConfig)()};if(p(t)){const l=o?.rootNode||e.ownerDocument?.documentElement;_(t,e,s,l)}else e.addEventListener(t,s,E(t,!1));r.__ref.__eventCleanup||(r.__ref.__eventCleanup=[]),r.__ref.__eventCleanup.push(()=>{if(p(t)){const l=o?.rootNode||e.ownerDocument?.documentElement;D(t,e,l)}else e.removeEventListener(t,s,E(t,!1))})}
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var _ in o)i(r,_,{get:o[_],enumerable:!0})},h=(r,o,_,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of c(o))!s.call(r,f)&&f!==_&&i(r,f,{get:()=>o[f],enumerable:!(e=t(o,f))||e.enumerable});return r};var p=r=>h(i({},"__esModule",{value:!0}),r);var u={};d(u,{dispose:()=>n,remove:()=>a});module.exports=p(u);function n(r){if(!r)return;const o=r.__ref;if(o){try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(_){console.error("[smbls] onBeforeRemove error:",_)}if(o.__effects){for(let _=0;_<o.__effects.length;_++)o.__effects[_].dispose();o.__effects.length=0}if(o.__eventCleanup){for(let _=0;_<o.__eventCleanup.length;_++)o.__eventCleanup[_]();o.__eventCleanup.length=0}if(o.__children){for(let _=0;_<o.__children.length;_++){const e=o.__children[_],f=r[e];f&&f.__ref&&n(f)}o.__children.length=0}if(r.node?.parentNode&&r.node.remove(),r.state?.destroy&&r.state.__element===r&&r.state.destroy(),r.parent?.__ref?.__children){const _=r.parent.__ref.__children.indexOf(r.key);_!==-1&&r.parent.__ref.__children.splice(_,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(_){console.error("[smbls] onRemove error:",_)}r.node=null,r.parent=null,r.__ref=null}}function a(){n(this)}
@@ -0,0 +1 @@
1
+ "use strict";var l=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var d=(t,r)=>{for(var s in r)l(t,s,{get:r[s],enumerable:!0})},g=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of i(r))!h.call(t,n)&&n!==s&&l(t,n,{get:()=>r[n],enumerable:!(o=A(r,n))||o.enumerable});return t};var b=t=>g(l({},"__esModule",{value:!0}),t);var E={};d(E,{applyExtends:()=>j});module.exports=b(E);const w=new WeakMap;function y(t){const r=[];return t.extends&&(Array.isArray(t.extends)?r.push(...t.extends):r.push(t.extends)),t.extend&&(Array.isArray(t.extend)?r.push(...t.extend):r.push(t.extend)),r}function j(t,r,s){const o=y(r);if(!o.length)return;const e=(t.context||s?.context||{}).components||{};for(let c=0;c<o.length;c++){const f=a(o[c],e);f&&f!==r&&p(t,f,s,new Set([r]))}}function a(t,r){if(typeof t=="string"){if(t.includes(">")){const s=t.split(">").map(n=>n.trim());let o=r[s[0]]||r[`smbls.${s[0]}`];for(let n=1;n<s.length&&o;n++)o=o[s[n]];return o||null}return r[t]||r[`smbls.${t}`]||null}return typeof t=="object"&&t!==null?t:null}function p(t,r,s,o=new Set){if(o.has(r))return;o.add(r);const n=y(r);if(n.length){const c=(t.context||s?.context||{}).components||{};for(let f=0;f<n.length;f++){const u=a(n[f],c);u&&p(t,u,s,o)}}for(const e in r){if(e==="extends"||e==="extend")continue;const c=r[e];t[e]===void 0?c&&typeof c=="object"&&!Array.isArray(c)&&typeof c!="function"?t[e]={...c}:t[e]=c:typeof t[e]=="object"&&typeof c=="object"&&!Array.isArray(t[e])&&!Array.isArray(c)&&t[e]!==null&&c!==null?t[e]=x(t[e],c):t[e]=c}}function x(t,r){const s={...t};for(const o in r){const n=s[o],e=r[o];n&&e&&typeof n=="object"&&typeof e=="object"&&!Array.isArray(n)&&!Array.isArray(e)&&typeof n!="function"&&typeof e!="function"?s[o]=x(n,e):s[o]=e}return s}
@@ -0,0 +1 @@
1
+ var v=Object.create;var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var n=(e,r)=>{for(var t in r)p(e,t,{get:r[t],enumerable:!0})},T=(e,r,t,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let E of i(r))!N.call(e,E)&&E!==t&&p(e,E,{get:()=>r[E],enumerable:!(x=c(r,E))||x.enumerable});return e};var D=(e,r,t)=>(t=e!=null?v(l(e)):{},T(r||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e)),G=e=>T(p({},"__esModule",{value:!0}),e);var I={};n(I,{DELEGATED_EVENTS:()=>d.DELEGATED_EVENTS,LIFECYCLE_EVENTS:()=>d.LIFECYCLE_EVENTS,MIXINS:()=>d.MIXINS,REGISTRY:()=>d.REGISTRY,SVG_TAGS:()=>o.SVG_TAGS,addDelegatedEvent:()=>a.addDelegatedEvent,addMethods:()=>S.addMethods,applyExtends:()=>s.applyExtends,cacheNode:()=>o.cacheNode,create:()=>m.create,createHTMLNode:()=>o.createHTMLNode,default:()=>m.default,detectTag:()=>o.detectTag,dispose:()=>f.dispose,isSvgTag:()=>o.isSvgTag,isValidTag:()=>o.isValidTag,registerEvent:()=>a.registerEvent,remove:()=>f.remove,removeDelegatedEvent:()=>a.removeDelegatedEvent,update:()=>g.update});module.exports=G(I);var m=D(require("./create.js"),1),g=require("./update.js"),f=require("./dispose.js"),d=require("./registry.js"),a=require("./delegate.js"),o=require("./cache.js"),s=require("./extends.js"),S=require("./methods.js");
@@ -0,0 +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 o in e)c(t,o,{get:e[o],enumerable:!0})},d=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of g(e))!p.call(t,r)&&r!==o&&c(t,r,{get:()=>e[r],enumerable:!(n=_(e,r))||n.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/src/props"),s=require("@symbo.ls/utils");function l(t,e,o){const n=t?.context?.analyze;if(!n||!n.emit||e==="warn"&&!n.shouldCapture("warnings")||e==="error"&&!n.shouldCapture("errors"))return;const r=o.map(i=>i?.message||(typeof i=="string"?i:null)).filter(Boolean).join(" ");n.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:o})}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 o=this.context?.__create;o&&o(t,this,"content",e)}},reset(t){const e=this.context?.__create;if(!e)return this;const o=this.parent,n=this.key,r=this.parse();return this.remove(),e(r,o,n,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 o of e.__children){const n=this[o];if(!n)continue;if(typeof t=="function"){if(t(n))return n}else if(typeof t=="string"&&n.key===t)return n;const r=n.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const o=this.__ref;if(!o?.__children)return e;for(const n of o.__children){const r=this[n];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={},o=t?new Set(t):null,n=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!o?.has(r)){if(n&&n[r]!==void 0){e[r]=n[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),o=this.__ref;if(o?.__children)for(const n of o.__children)this[n]?.parseDeep&&(e[n]=this[n].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const o of t)e[o]=this[o];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 o=t[e];if(o==null)continue;const n=e.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),r=String(o).replace(/\s*!important\s*$/,"");this.node.style.setProperty(n,r,"important")}},call(t,...e){const o=this.context,n=o?.methods?.[t]||o?.functions?.[t]||o?.utils?.[t]||this[t];if(typeof n=="function")return n.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 o=t.__children.indexOf("content");o!==-1&&t.__children.splice(o,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 o=t.methods;if(o)for(const n in o)e[n]=o[n];return u.set(t,e),e}function C(t){const e=x(t.context);Object.setPrototypeOf(t,e)}
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!d.call(t,o)&&o!==r&&s(t,o,{get:()=>e[o],enumerable:!(n=a(e,o))||n.enumerable});return t};var l=t=>u(s({},"__esModule",{value:!0}),t);var x={};p(x,{DELEGATED_EVENTS:()=>E,LIFECYCLE_EVENTS:()=>m,MIXINS:()=>h,PASSIVE_EVENTS:()=>v,REGISTRY:()=>i});module.exports=l(x);const i=new Set(["extends","children","content","childExtends","childExtendsRecursive","childProps","inheritParentProps","state","if","define","deps","tag","attr","style","text","html","value","data","classlist","class","scope","root","context","$router","routes","fetch","variables","query","key","component","preventContentUpdate","preventContentRecreate","__name","__ref","__hash","__text","parent","node"]),h={text:"text",html:"html",style:"style",attr:"attr",data:"data",classlist:"classlist",state:"state",scope:"scope"},m=new Set(["start","init","complete","attachNode","stateInit","stateCreated","beforeUpdate","update","afterUpdate","beforeClassAssign","lazyLoad","render","renderRouter","done","create","frame","startUpdate","stateUpdate","beforeStateUpdate","initInspect","initSync","error","beforeRemove","remove"]),v=new Set(["wheel","mousewheel","touchstart","touchmove","touchend","touchcancel"]),E=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointerover","pointerout","touchstart","touchend","touchmove","keydown","keyup","keypress","input","change","submit","reset","focus","blur","focusin","focusout","scroll","wheel","contextmenu","drag","dragstart","dragend","dragenter","dragleave","dragover","drop"]);
@@ -0,0 +1 @@
1
+ "use strict";var l=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var g=(e,o)=>{for(var t in o)l(e,t,{get:o[t],enumerable:!0})},j=(e,o,t,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of h(o))!b.call(e,n)&&n!==t&&l(e,n,{get:()=>o[n],enumerable:!(f=_(o,n))||f.enumerable});return e};var v=e=>j(l({},"__esModule",{value:!0}),e);var C={};g(C,{default:()=>A,update:()=>a});module.exports=v(C);var d=require("@symbo.ls/signal"),s=require("./registry.js"),u=require("./create.js"),y=require("@symbo.ls/utils/function.js");function a(e={},o={}){const t=this,f=t.__ref;if(f){if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!o.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,o)===!1)return t;if((0,d.batch)(()=>{if(e.state&&(0,d.isStore)(t.state)&&t.state.update(e.state),e.text!==void 0&&(t.text=e.text,!f.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!f.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!f.__exec.style)for(const n in e.style){const i=e.style[n];if(i==null)continue;const r=n.replace(/[A-Z]/g,x=>"-"+x.toLowerCase()),c=String(i).replace(/\s*!important\s*$/,"");t.node.style.setProperty(r,c,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const i=e.attr[n];i==null||i===!1?t.node.removeAttribute(n):typeof i!="function"&&typeof i!="object"&&t.node.setAttribute(n,i===!0?"":i)}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(s.REGISTRY.has(n)||n==="state")continue;const i=e[n],r=t[n];if(r&&r.__ref&&typeof r.update=="function")r.update(i,o);else if(typeof i=="object"&&i!==null){const c=n.charCodeAt(0);c>=65&&c<=90&&(0,u.create)(i,t,n,o)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=i)}}),t.node&&f.__conditionalRunners)for(const n of f.__conditionalRunners)n();return(0,y.runPluginHook)("update",t),!o.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,o),t}}var A=a;
@@ -0,0 +1 @@
1
+ export*from"./src/index.js";
@@ -0,0 +1 @@
1
+ const i="http://www.w3.org/2000/svg",s=new Set(["svg","path","circle","ellipse","line","polyline","polygon","rect","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","animate","animateMotion","animateTransform","set","foreignObject","desc","title","metadata"]),p=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","string","fragment","shadow"]);function l(e){return p.has(e)||s.has(e)}function d(e){return s.has(e)}function g(e){let{tag:t,key:o}=e;if(typeof t=="function"&&(t=t(e)),t===!0&&(t=o),typeof t=="string"&&l(t))return t;if(!o||typeof o!="string")return"div";const n=new Set(["html","head","body","meta","link","script","style","title","base","noscript","template"]);let r=o.toLowerCase();return r.includes(".")&&(r=r.split(".")[0]),r.includes("_")&&(r=r.split("_")[0]),l(r)&&!n.has(r)?r:"div"}const f={};function u(e,t){const o=t?.context?.document||globalThis.document;if(!o)return null;if(e==="string")return o.createTextNode(t?.text||"");if(e==="fragment")return o.createDocumentFragment();if(d(e)){const n=t?.parent;if(e==="svg"||n?.node?.namespaceURI===i)return o.createElementNS(i,e);if(e!=="svg")return o.createElement("div")}return o.createElement(e)}function m(e){const t=e.tag=g(e),n=d(t)&&(t==="svg"||e.parent?.node?.namespaceURI===i)?"svg:"+t:t,r=e?.context?.document||globalThis.document;let a=f[n];if(a||(a=f[n]=u(t,e)),!a)return null;const c=r&&a.ownerDocument!==r?u(t,e):a.cloneNode(!0);return t==="string"&&(c.nodeValue=e.text||""),c}export{i as SVG_NS,s as SVG_TAGS,m as cacheNode,u as createHTMLNode,g as detectTag,d as isSvgTag,l as isValidTag};
@@ -0,0 +1,6 @@
1
+ import{createStore as M,isStore as V}from"@symbo.ls/signal";import{createEffect as j}from"@symbo.ls/signal";import{cacheNode as W,detectTag as tt}from"./cache.js";import{REGISTRY as E,LIFECYCLE_EVENTS as rt}from"./registry.js";import{registerEvent as ft}from"./delegate.js";import{applyExtends as at}from"./extends.js";import{addMethods as et}from"./methods.js";import"./dispose.js";import{replaceLiteralsWithObjectFields as H}from"@symbo.ls/utils";import{runPluginHook as ot}from"@symbo.ls/utils/function.js";import{applyStateMethods as I}from"@symbo.ls/state";import{CSS_PROPS_REGISTRY as v}from"css-in-props/src/props";import{DEFAULT_CSS_PROPERTIES_LIST as C}from"css-in-props/src/props/defaults";import{css as dt}from"@symbo.ls/css";import{pushConfig as $,popConfig as N}from"@symbo.ls/scratch";import{checkAttributeByTagName as Z,applyAttrTransforms as ut}from"attrs-in-props";let pt=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 yt(t){return t.charAt(2).toLowerCase()+t.slice(3)}function lt(t){return t.toLowerCase()}function z(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]=z(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||`_${pt++}`,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})}}at(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]=z(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],O=g&&x&&typeof g=="object"&&typeof x=="object"&&!Array.isArray(g)&&!Array.isArray(x)&&typeof g!="function"&&typeof x!="function";O&&y.charCodeAt(0)>=65&&y.charCodeAt(0)<=90?o[y]=z(g,x):O&&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),et(o),ht(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"&&Y(o,{if:t.if}),o;o.tag||(o.tag=tt(o)),L("Init",o,r);const l=o.node=W(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),Y(o,t),q(o),ct(o),nt(o,r);try{it(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
+ `+p.stack.split(`
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} }
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 Vt=F;export{F as create,Vt as default};
@@ -0,0 +1 @@
1
+ import{DELEGATED_EVENTS as g,LIFECYCLE_EVENTS as h,PASSIVE_EVENTS as _}from"./registry.js";import{pushConfig as D,popConfig as d}from"@symbo.ls/scratch";const u=new WeakMap,w={passive:!0},S={passive:!0,capture:!0},f=(t,r)=>_.has(t)?r?S:w:r||!1;function E(t){let r=u.get(t);return r||(r={handlers:new Map,installed:new Set},u.set(t,r)),r}function L(t,r){const s=E(r);if(s.installed.has(t))return;s.installed.add(t);const e=t==="focus"||t==="blur"||t==="focusin"||t==="focusout"||t==="mouseenter"||t==="mouseleave",o=t==="mouseenter"||t==="mouseleave";r.addEventListener(t,i=>{let n=i.target;for(;n&&n!==r;){const l=s.handlers.get(t);if(l){const c=l.get(n);if(c){if(o&&i.relatedTarget&&n.contains(i.relatedTarget)){n=n.parentNode;continue}if(c(i),i.cancelBubble)return}}n=n.parentNode}},f(t,e))}function C(t,r,s,e){e||(e=r.ownerDocument?.documentElement||r.getRootNode());const o=E(e);L(t,e),o.handlers.has(t)||o.handlers.set(t,new WeakMap),o.handlers.get(t).set(r,s)}function M(t,r,s){s||(s=r.ownerDocument?.documentElement||r.getRootNode());const e=u.get(s);if(!e)return;const o=e.handlers.get(t);o&&o.delete(r)}function p(t){return g.has(t)&&!h.has(t)}function V(t,r,s){const{node:e,context:o}=r;if(!e)return;const i=o?.designSystem,n=l=>{i&&D(i);try{const c=s.call(r,l,r,r.state,o);if(c&&typeof c.then=="function"){c.catch(a=>{r.error=a,console.error("[DOMQL] Async event error:",a)}).finally(()=>{i&&d()});return}}catch(c){if(r.error=c,console.error("[DOMQL] Event error:",c),o?.strictMode)throw c}i&&d()};if(p(t)){const l=o?.rootNode||e.ownerDocument?.documentElement;C(t,e,n,l)}else e.addEventListener(t,n,f(t,!1));r.__ref.__eventCleanup||(r.__ref.__eventCleanup=[]),r.__ref.__eventCleanup.push(()=>{if(p(t)){const l=o?.rootNode||e.ownerDocument?.documentElement;M(t,e,l)}else e.removeEventListener(t,n,f(t,!1))})}export{C as addDelegatedEvent,p as isDelegatable,V as registerEvent,M as removeDelegatedEvent};
@@ -0,0 +1 @@
1
+ function e(r){if(!r)return;const _=r.__ref;if(_){try{typeof r.onBeforeRemove=="function"&&r.onBeforeRemove(r,r.state,r.context)}catch(o){console.error("[smbls] onBeforeRemove error:",o)}if(_.__effects){for(let o=0;o<_.__effects.length;o++)_.__effects[o].dispose();_.__effects.length=0}if(_.__eventCleanup){for(let o=0;o<_.__eventCleanup.length;o++)_.__eventCleanup[o]();_.__eventCleanup.length=0}if(_.__children){for(let o=0;o<_.__children.length;o++){const i=_.__children[o],f=r[i];f&&f.__ref&&e(f)}_.__children.length=0}if(r.node?.parentNode&&r.node.remove(),r.state?.destroy&&r.state.__element===r&&r.state.destroy(),r.parent?.__ref?.__children){const o=r.parent.__ref.__children.indexOf(r.key);o!==-1&&r.parent.__ref.__children.splice(o,1),delete r.parent[r.key]}try{typeof r.onRemove=="function"&&r.onRemove(r)}catch(o){console.error("[smbls] onRemove error:",o)}r.node=null,r.parent=null,r.__ref=null}}function n(){e(this)}export{e as dispose,n as remove};
@@ -0,0 +1 @@
1
+ const x=new WeakMap;function u(t){const r=[];return t.extends&&(Array.isArray(t.extends)?r.push(...t.extends):r.push(t.extends)),t.extend&&(Array.isArray(t.extend)?r.push(...t.extend):r.push(t.extend)),r}function A(t,r,c){const e=u(r);if(!e.length)return;const n=(t.context||c?.context||{}).components||{};for(let s=0;s<e.length;s++){const f=y(e[s],n);f&&f!==r&&a(t,f,c,new Set([r]))}}function y(t,r){if(typeof t=="string"){if(t.includes(">")){const c=t.split(">").map(o=>o.trim());let e=r[c[0]]||r[`smbls.${c[0]}`];for(let o=1;o<c.length&&e;o++)e=e[c[o]];return e||null}return r[t]||r[`smbls.${t}`]||null}return typeof t=="object"&&t!==null?t:null}function a(t,r,c,e=new Set){if(e.has(r))return;e.add(r);const o=u(r);if(o.length){const s=(t.context||c?.context||{}).components||{};for(let f=0;f<o.length;f++){const l=y(o[f],s);l&&a(t,l,c,e)}}for(const n in r){if(n==="extends"||n==="extend")continue;const s=r[n];t[n]===void 0?s&&typeof s=="object"&&!Array.isArray(s)&&typeof s!="function"?t[n]={...s}:t[n]=s:typeof t[n]=="object"&&typeof s=="object"&&!Array.isArray(t[n])&&!Array.isArray(s)&&t[n]!==null&&s!==null?t[n]=p(t[n],s):t[n]=s}}function p(t,r){const c={...t};for(const e in r){const o=c[e],n=r[e];o&&n&&typeof o=="object"&&typeof n=="object"&&!Array.isArray(o)&&!Array.isArray(n)&&typeof o!="function"&&typeof n!="function"?c[e]=p(o,n):c[e]=n}return c}export{A as applyExtends};
@@ -0,0 +1 @@
1
+ import{create as r,default as t}from"./create.js";import{update as a}from"./update.js";import{dispose as p,remove as m}from"./dispose.js";import{REGISTRY as x,LIFECYCLE_EVENTS as T,DELEGATED_EVENTS as g,MIXINS as s}from"./registry.js";import{addDelegatedEvent as v,removeDelegatedEvent as c,registerEvent as i}from"./delegate.js";import{cacheNode as N,detectTag as n,createHTMLNode as D,isValidTag as G,isSvgTag as I,SVG_TAGS as L}from"./cache.js";import{applyExtends as M}from"./extends.js";import{addMethods as h}from"./methods.js";export{g as DELEGATED_EVENTS,T as LIFECYCLE_EVENTS,s as MIXINS,x as REGISTRY,L as SVG_TAGS,v as addDelegatedEvent,h as addMethods,M as applyExtends,N as cacheNode,r as create,D as createHTMLNode,t as default,n as detectTag,p as dispose,I as isSvgTag,G as isValidTag,i as registerEvent,m as remove,c as removeDelegatedEvent,a as update};
@@ -0,0 +1 @@
1
+ import{update as l}from"./update.js";import{remove as u}from"./dispose.js";import"css-in-props/src/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,o){const n=t?.context?.analyze;if(!n||!n.emit||e==="warn"&&!n.shouldCapture("warnings")||e==="error"&&!n.shouldCapture("errors"))return;const r=o.map(s=>s?.message||(typeof s=="string"?s:null)).filter(Boolean).join(" ");n.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:o})}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 o=this.context?.__create;o&&o(t,this,"content",e)}},reset(t){const e=this.context?.__create;if(!e)return this;const o=this.parent,n=this.key,r=this.parse();return this.remove(),e(r,o,n,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 o of e.__children){const n=this[o];if(!n)continue;if(typeof t=="function"){if(t(n))return n}else if(typeof t=="string"&&n.key===t)return n;const r=n.lookdown?.(t);if(r)return r}return null},lookdownAll(t,e=[]){const o=this.__ref;if(!o?.__children)return e;for(const n of o.__children){const r=this[n];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={},o=t?new Set(t):null,n=this.__ref?.__exec;for(const r in this)if(!(r==="parent"||r==="node"||r==="__ref")&&!o?.has(r)){if(n&&n[r]!==void 0){e[r]=n[r];continue}typeof this[r]!="function"&&(e[r]=this[r])}return e},parseDeep(t){const e=this.parse(t),o=this.__ref;if(o?.__children)for(const n of o.__children)this[n]?.parseDeep&&(e[n]=this[n].parseDeep(t));return e},keys(){return Object.keys(this)},log(...t){if(t.length){const e={};for(const o of t)e[o]=this[o];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 o=t[e];if(o==null)continue;const n=e.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),r=String(o).replace(/\s*!important\s*$/,"");this.node.style.setProperty(n,r,"important")}},call(t,...e){const o=this.context,n=o?.methods?.[t]||o?.functions?.[t]||o?.utils?.[t]||this[t];if(typeof n=="function")return n.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 o=t.__children.indexOf("content");o!==-1&&t.__children.splice(o,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 o=t.methods;if(o)for(const n in o)e[n]=o[n];return c.set(t,e),e}function $(t){const e=O(t.context);Object.setPrototypeOf(t,e)}export{$ as addMethods,i as elementProto};
@@ -0,0 +1 @@
1
+ const e=new Set(["extends","children","content","childExtends","childExtendsRecursive","childProps","inheritParentProps","state","if","define","deps","tag","attr","style","text","html","value","data","classlist","class","scope","root","context","$router","routes","fetch","variables","query","key","component","preventContentUpdate","preventContentRecreate","__name","__ref","__hash","__text","parent","node"]),t={text:"text",html:"html",style:"style",attr:"attr",data:"data",classlist:"classlist",state:"state",scope:"scope"},o=new Set(["start","init","complete","attachNode","stateInit","stateCreated","beforeUpdate","update","afterUpdate","beforeClassAssign","lazyLoad","render","renderRouter","done","create","frame","startUpdate","stateUpdate","beforeStateUpdate","initInspect","initSync","error","beforeRemove","remove"]),r=new Set(["wheel","mousewheel","touchstart","touchmove","touchend","touchcancel"]),s=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointerover","pointerout","touchstart","touchend","touchmove","keydown","keyup","keypress","input","change","submit","reset","focus","blur","focusin","focusout","scroll","wheel","contextmenu","drag","dragstart","dragend","dragenter","dragleave","dragover","drop"]);export{s as DELEGATED_EVENTS,o as LIFECYCLE_EVENTS,t as MIXINS,r as PASSIVE_EVENTS,e as REGISTRY};
@@ -0,0 +1 @@
1
+ import{batch as l,isStore as s}from"@symbo.ls/signal";import{REGISTRY as u}from"./registry.js";import{create as y}from"./create.js";import{runPluginHook as a}from"@symbo.ls/utils/function.js";function x(e={},i={}){const t=this,f=t.__ref;if(f){if((typeof e=="string"||typeof e=="number")&&(e={text:e}),!i.preventListeners&&typeof t.onBeforeUpdate=="function"&&t.onBeforeUpdate(t,t.state,t.context,i)===!1)return t;if(l(()=>{if(e.state&&s(t.state)&&t.state.update(e.state),e.text!==void 0&&(t.text=e.text,!f.__exec.text&&t.node&&(t.tag==="string"?t.node.nodeValue=e.text??"":t.node.textContent=e.text??"")),e.html!==void 0&&(t.html=e.html,!f.__exec.html&&t.node&&(t.node.innerHTML=e.html)),e.style&&t.node?.style){if(!f.__exec.style)for(const n in e.style){const o=e.style[n];if(o==null)continue;const r=n.replace(/[A-Z]/g,d=>"-"+d.toLowerCase()),c=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(r,c,"important")}t.style||(t.style={}),Object.assign(t.style,e.style)}if(e.attr&&t.node?.setAttribute){for(const n in e.attr){const o=e.attr[n];o==null||o===!1?t.node.removeAttribute(n):typeof o!="function"&&typeof o!="object"&&t.node.setAttribute(n,o===!0?"":o)}t.attr||(t.attr={}),Object.assign(t.attr,e.attr)}if(e.data&&t.node?.dataset){for(const n in e.data)t.node.dataset[n]=e.data[n];t.data||(t.data={}),Object.assign(t.data,e.data)}for(const n in e){if(u.has(n)||n==="state")continue;const o=e[n],r=t[n];if(r&&r.__ref&&typeof r.update=="function")r.update(o,i);else if(typeof o=="object"&&o!==null){const c=n.charCodeAt(0);c>=65&&c<=90&&y(o,t,n,i)}else n!=="text"&&n!=="html"&&n!=="style"&&n!=="attr"&&n!=="data"&&(t[n]=o)}}),t.node&&f.__conditionalRunners)for(const n of f.__conditionalRunners)n();return a("update",t),!i.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,i),t}}var j=x;export{j as default,x as update};
package/package.json CHANGED
@@ -1,13 +1,24 @@
1
1
  {
2
2
  "name": "@symbo.ls/element",
3
- "version": "3.14.3",
3
+ "version": "3.14.4",
4
4
  "description": "Core element creation, update, and disposal engine for smbls v3.14",
5
5
  "type": "module",
6
- "main": "./index.js",
7
- "module": "./index.js",
6
+ "main": "./dist/cjs/index.cjs",
7
+ "module": "./dist/esm/index.js",
8
8
  "exports": {
9
- ".": "./index.js",
10
- "./src/*": "./src/*"
9
+ ".": {
10
+ "development": "./index.js",
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.cjs",
13
+ "default": "./dist/esm/index.js"
14
+ },
15
+ "./package.json": "./package.json",
16
+ "./src/*": {
17
+ "development": "./src/*.js",
18
+ "import": "./dist/esm/src/*.js",
19
+ "require": "./dist/cjs/src/*.cjs",
20
+ "default": "./dist/esm/src/*.js"
21
+ }
11
22
  },
12
23
  "dependencies": {
13
24
  "@symbo.ls/signal": "^3.14.0",
@@ -17,8 +28,18 @@
17
28
  "attrs-in-props": "^3.14.0"
18
29
  },
19
30
  "files": [
20
- "src",
21
- "index.js"
31
+ "dist",
32
+ "*.md",
33
+ "LICENSE"
22
34
  ],
23
- "license": "CC-BY-NC-4.0"
35
+ "license": "CC-BY-NC-4.0",
36
+ "scripts": {
37
+ "build:esm": "esbuild $(find . -type f -name \"*.js\" -not -path \"*/dist/*\" -not -path \"*/node_modules/*\" -not -path \"*/__tests__/*\" -not -path \"*/test/*\" -not -name \"*.test.js\") --target=es2020 --format=esm --outbase=. --outdir=dist/esm --minify --log-level=warning",
38
+ "build:cjs": "esbuild $(find . -type f -name \"*.js\" -not -path \"*/dist/*\" -not -path \"*/node_modules/*\" -not -path \"*/__tests__/*\" -not -path \"*/test/*\" -not -name \"*.test.js\") --target=node18 --format=cjs --outbase=. --outdir=dist/cjs --out-extension:.js=.cjs --minify --log-level=warning",
39
+ "build": "rimraf dist && npm run build:esm && npm run build:cjs",
40
+ "prepublishOnly": "npm run build"
41
+ },
42
+ "publishConfig": {
43
+ "access": "restricted"
44
+ }
24
45
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './src/index.js'
package/src/cache.js DELETED
@@ -1,124 +0,0 @@
1
- 'use strict'
2
-
3
- // Node caching - cloneNode from cached prototypes instead of createElement
4
- // This is already a v3 optimization that works well -- preserved in v3.14
5
-
6
- const SVG_NS = 'http://www.w3.org/2000/svg'
7
-
8
- const SVG_TAGS = new Set([
9
- 'svg', 'path', 'circle', 'ellipse', 'line', 'polyline', 'polygon',
10
- 'rect', 'g', 'defs', 'use', 'symbol', 'clipPath', 'mask',
11
- 'pattern', 'image', 'text', 'tspan', 'textPath',
12
- 'marker', 'linearGradient', 'radialGradient', 'stop',
13
- 'filter', 'feBlend', 'feColorMatrix', 'feComponentTransfer',
14
- 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
15
- 'feDisplacementMap', 'feFlood', 'feGaussianBlur', 'feImage',
16
- 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset',
17
- 'feSpecularLighting', 'feTile', 'feTurbulence',
18
- 'animate', 'animateMotion', 'animateTransform', 'set',
19
- 'foreignObject', 'desc', 'title', 'metadata'
20
- ])
21
-
22
- const VALID_HTML_TAGS = new Set([
23
- 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio',
24
- 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button',
25
- 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup',
26
- 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt',
27
- 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form',
28
- 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr',
29
- 'i', 'iframe', 'img', 'input', 'ins', 'kbd',
30
- 'label', 'legend', 'li', 'link',
31
- 'main', 'map', 'mark', 'menu', 'meta', 'meter',
32
- 'nav', 'noscript',
33
- 'object', 'ol', 'optgroup', 'option', 'output',
34
- 'p', 'param', 'picture', 'pre', 'progress',
35
- 'q', 'rp', 'rt', 'ruby',
36
- 's', 'samp', 'script', 'search', 'section', 'select', 'slot', 'small',
37
- 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup',
38
- 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead',
39
- 'time', 'title', 'tr', 'track',
40
- 'u', 'ul', 'var', 'video', 'wbr',
41
- // special
42
- 'string', 'fragment', 'shadow'
43
- ])
44
-
45
- export function isValidTag(tag) {
46
- return VALID_HTML_TAGS.has(tag) || SVG_TAGS.has(tag)
47
- }
48
-
49
- export function isSvgTag(tag) {
50
- return SVG_TAGS.has(tag)
51
- }
52
-
53
- export function detectTag(element) {
54
- let { tag, key } = element
55
-
56
- if (typeof tag === 'function') tag = tag(element)
57
- if (tag === true) tag = key
58
-
59
- if (typeof tag === 'string' && isValidTag(tag)) return tag
60
- if (!key || typeof key !== 'string') return 'div'
61
-
62
- // Tags that should never be auto-detected from key names
63
- const STRUCTURAL_TAGS = new Set([
64
- 'html', 'head', 'body', 'meta', 'link', 'script', 'style',
65
- 'title', 'base', 'noscript', 'template'
66
- ])
67
-
68
- // Try key as tag
69
- let keyAsTag = key.toLowerCase()
70
- if (keyAsTag.includes('.')) keyAsTag = keyAsTag.split('.')[0]
71
- if (keyAsTag.includes('_')) keyAsTag = keyAsTag.split('_')[0]
72
- if (isValidTag(keyAsTag) && !STRUCTURAL_TAGS.has(keyAsTag)) return keyAsTag
73
-
74
- return 'div'
75
- }
76
-
77
- const nodeCaches = {}
78
-
79
- export function createHTMLNode(tag, element) {
80
- const doc = element?.context?.document || globalThis.document
81
- if (!doc) return null
82
-
83
- if (tag === 'string') return doc.createTextNode(element?.text || '')
84
- if (tag === 'fragment') return doc.createDocumentFragment()
85
-
86
- if (isSvgTag(tag)) {
87
- const parent = element?.parent
88
- const inSvgContext = tag === 'svg' || parent?.node?.namespaceURI === SVG_NS
89
- if (inSvgContext) {
90
- return doc.createElementNS(SVG_NS, tag)
91
- }
92
- // SVG child tags outside <svg> context — fall back to div
93
- if (tag !== 'svg') return doc.createElement('div')
94
- }
95
-
96
- return doc.createElement(tag)
97
- }
98
-
99
- export function cacheNode(element) {
100
- const tag = element.tag = detectTag(element)
101
-
102
- const isSvgContext = isSvgTag(tag) &&
103
- (tag === 'svg' || element.parent?.node?.namespaceURI === SVG_NS)
104
- const cacheKey = isSvgContext ? 'svg:' + tag : tag
105
-
106
- const targetDoc = element?.context?.document || globalThis.document
107
-
108
- let cached = nodeCaches[cacheKey]
109
- if (!cached) {
110
- cached = nodeCaches[cacheKey] = createHTMLNode(tag, element)
111
- }
112
-
113
- if (!cached) return null
114
-
115
- // If target document differs from cached node's document (e.g. iframe),
116
- // create a fresh node instead of cloning to ensure correct ownerDocument
117
- const cloned = (targetDoc && cached.ownerDocument !== targetDoc)
118
- ? createHTMLNode(tag, element)
119
- : cached.cloneNode(true)
120
- if (tag === 'string') cloned.nodeValue = element.text || ''
121
- return cloned
122
- }
123
-
124
- export { SVG_TAGS, SVG_NS }