@symbo.ls/utils 3.14.2 → 3.14.3

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.
Files changed (122) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/array.cjs +1 -0
  3. package/dist/cjs/assets.cjs +1 -0
  4. package/dist/cjs/browser.cjs +1 -0
  5. package/dist/cjs/cache.cjs +1 -0
  6. package/dist/cjs/cdn.cjs +3 -0
  7. package/dist/cjs/component.cjs +1 -0
  8. package/dist/cjs/cookie.cjs +1 -0
  9. package/dist/cjs/date.cjs +1 -0
  10. package/dist/cjs/detectHeight.cjs +1 -0
  11. package/dist/cjs/element.cjs +1 -0
  12. package/dist/cjs/env.cjs +2 -0
  13. package/dist/cjs/events.cjs +1 -0
  14. package/dist/cjs/extends.cjs +1 -0
  15. package/dist/cjs/fibonacci.cjs +1 -0
  16. package/dist/cjs/files.cjs +1 -0
  17. package/dist/cjs/function.cjs +1 -0
  18. package/dist/cjs/globals.cjs +1 -0
  19. package/dist/cjs/if.cjs +1 -0
  20. package/dist/cjs/index.cjs +1 -0
  21. package/dist/cjs/key.cjs +1 -0
  22. package/dist/cjs/keys.cjs +1 -0
  23. package/dist/cjs/load.cjs +1 -0
  24. package/dist/cjs/log.cjs +1 -0
  25. package/dist/cjs/metadata.cjs +2 -0
  26. package/dist/cjs/methods.cjs +10 -0
  27. package/dist/cjs/node.cjs +1 -0
  28. package/dist/cjs/object.cjs +12 -0
  29. package/dist/cjs/projectKeys.cjs +1 -0
  30. package/dist/cjs/props.cjs +1 -0
  31. package/dist/cjs/scaling.cjs +1 -0
  32. package/dist/cjs/scope.cjs +1 -0
  33. package/dist/cjs/sharedLibraries.cjs +1 -0
  34. package/dist/cjs/state.cjs +1 -0
  35. package/dist/cjs/string-extra.cjs +1 -0
  36. package/dist/cjs/string.cjs +3 -0
  37. package/dist/cjs/style.cjs +1 -0
  38. package/dist/cjs/tags.cjs +1 -0
  39. package/dist/cjs/triggerEvent.cjs +1 -0
  40. package/dist/cjs/types.cjs +1 -0
  41. package/dist/cjs/update.cjs +1 -0
  42. package/dist/esm/array.js +1 -0
  43. package/dist/esm/assets.js +1 -0
  44. package/dist/esm/browser.js +1 -0
  45. package/dist/esm/cache.js +1 -0
  46. package/dist/esm/cdn.js +3 -0
  47. package/dist/esm/component.js +1 -0
  48. package/dist/esm/cookie.js +1 -0
  49. package/dist/esm/date.js +1 -0
  50. package/dist/esm/detectHeight.js +1 -0
  51. package/dist/esm/element.js +1 -0
  52. package/dist/esm/env.js +2 -0
  53. package/dist/esm/events.js +1 -0
  54. package/dist/esm/extends.js +1 -0
  55. package/dist/esm/fibonacci.js +1 -0
  56. package/dist/esm/files.js +1 -0
  57. package/dist/esm/function.js +1 -0
  58. package/dist/esm/globals.js +1 -0
  59. package/dist/esm/if.js +1 -0
  60. package/dist/esm/index.js +1 -0
  61. package/dist/esm/key.js +1 -0
  62. package/dist/esm/keys.js +1 -0
  63. package/dist/esm/load.js +1 -0
  64. package/dist/esm/log.js +1 -0
  65. package/dist/esm/metadata.js +2 -0
  66. package/dist/esm/methods.js +10 -0
  67. package/dist/esm/node.js +1 -0
  68. package/dist/esm/object.js +12 -0
  69. package/dist/esm/projectKeys.js +1 -0
  70. package/dist/esm/props.js +1 -0
  71. package/dist/esm/scaling.js +1 -0
  72. package/dist/esm/scope.js +1 -0
  73. package/dist/esm/sharedLibraries.js +1 -0
  74. package/dist/esm/state.js +1 -0
  75. package/dist/esm/string-extra.js +1 -0
  76. package/dist/esm/string.js +3 -0
  77. package/dist/esm/style.js +1 -0
  78. package/dist/esm/tags.js +1 -0
  79. package/dist/esm/triggerEvent.js +1 -0
  80. package/dist/esm/types.js +1 -0
  81. package/dist/esm/update.js +1 -0
  82. package/package.json +35 -18
  83. package/array.js +0 -162
  84. package/assets.js +0 -117
  85. package/browser.js +0 -13
  86. package/cache.js +0 -7
  87. package/cdn.js +0 -83
  88. package/component.js +0 -25
  89. package/cookie.js +0 -78
  90. package/date.js +0 -10
  91. package/detectHeight.js +0 -42
  92. package/element.js +0 -148
  93. package/env.js +0 -15
  94. package/events.js +0 -19
  95. package/extends.js +0 -519
  96. package/fibonacci.js +0 -9
  97. package/files.js +0 -3
  98. package/function.js +0 -145
  99. package/globals.js +0 -8
  100. package/if.js +0 -30
  101. package/index.js +0 -42
  102. package/key.js +0 -20
  103. package/keys.js +0 -176
  104. package/load.js +0 -236
  105. package/log.js +0 -12
  106. package/metadata.js +0 -392
  107. package/methods.js +0 -684
  108. package/node.js +0 -37
  109. package/object.js +0 -837
  110. package/projectKeys.js +0 -30
  111. package/props.js +0 -327
  112. package/scaling.js +0 -15
  113. package/scope.js +0 -32
  114. package/sharedLibraries.js +0 -184
  115. package/state.js +0 -203
  116. package/string-extra.js +0 -69
  117. package/string.js +0 -206
  118. package/style.js +0 -23
  119. package/tags.js +0 -176
  120. package/triggerEvent.js +0 -102
  121. package/types.js +0 -55
  122. package/update.js +0 -27
@@ -0,0 +1,10 @@
1
+ import{triggerEventOn as m}from"./triggerEvent.js";import{DOMQ_PROPERTIES as w,METHODS as k,PARSED_DOMQ_PROPERTIES as R}from"./keys.js";import{isDefined as E,isFunction as p,isObject as P,isObjectLike as x}from"./types.js";import{deepClone as A}from"./object.js";import{isProduction as b}from"./env.js";import{removeValueFromArray as C}from"./array.js";import{OPTIONS as j}from"./cache.js";const a="production";function X(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function q(e){const t=this;let{parent:n}=t;if(p(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function tt(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if(p(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function et(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if(p(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function Q(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if(P(o)&&r)Q.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function nt(e){const t=this;if(m("beforeRemove",t,e)===!1)return t;p(t.node.remove)?t.node.remove():b()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=C(t.parent.__ref.__children,t.key)),m("remove",t,e)}function ot(e){return this[e]}function rt(e,t){const n=this;if(e)return n.update(e,t),n}function st(e){return e?this.__ref&&this.__ref[e]:this.__ref}function it(){return this.getRef("__children").map(t=>this[t])}function ct(){return this.getRef().path}let y=null;const lt=e=>{y=e||null},S=()=>y||null;function ft(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=S();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=p(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=S()),e?t?.[e]:t}function ut(e){const t=this.getRootState()?.__element;return t&&Object.keys(t).length>0&&e?t[e]:t}function at(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function ht(e){const t=this.getRoot()?.context;return e?t[e]:t}function pt(e){const t=this.context;return e?t[e]:t}const dt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function N(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||w.has(n)&&!R.has(n)||t.push(n);return t}function D(e=[]){const t=this,n={},o=N.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const f=p(l&&l.parse)?l.parse():l;n[c]=p(f)?f:JSON.parse(JSON.stringify(f||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:f,update:u,...h}=t[c];n[c]=h}else E(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function v(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=D.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>x(c)?v.call(c,e,t):c):x(i)&&(o[s]=v.call(i,e,t))}return o}function T(...e){if(a!=="test"&&a!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
2
+ `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function _t(...e){(a==="test"||a==="development")&&console.log(...e)}function gt(...e){(a==="test"||a==="development")&&console.warn(...e)}function O(...e){if(a==="test"||a==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&T.call(this),new Error(...e)}}function mt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function xt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function yt(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,A(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function St(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{O.call(this,s)}),r}catch(r){if(O.call(this,r),n?.strictMode)throw r}}async function vt(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function Ot(e){const t=this,n=e||j.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(g(t,o),n===!0)return o;const r=z[n];return r?r(o):o}const g=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&I(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&g(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&g(i,t)},I=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},$=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
3
+ ${$(i,t+1)}
4
+ ${n}}`).join(`
5
+ `):""},L=e=>`{
6
+ ${$(e,1)}
7
+ }`,F=e=>{const t={fields:{},include:[]},n=(o,r)=>{const s=[];for(const i in o)if(o[i]===!0)s.push(i);else{const c=r?`${r}.${i}`:i;t.include.push(c),n(o[i],c)}s.length&&(t.fields[r||"_root"]=s)};return n(e,""),t},M=e=>{const t=s=>{const i=[],c=[];for(const l in s)if(s[l]===!0)i.push(l);else{const f=t(s[l]),u=[];f.select&&u.push(`$select=${f.select}`),f.expand&&u.push(`$expand=${f.expand}`),c.push(u.length?`${l}(${u.join(";")})`:l)}return{select:i.length?i.join(","):"",expand:c.length?c.join(","):""}},{select:n,expand:o}=t(e),r=[];return n&&r.push(`$select=${n}`),o&&r.push(`$expand=${o}`),r.join("&")},J=(e,t)=>{const n=[],o=[],r=new Set,s=(u,h,_)=>{r.add(h),_&&o.push(`LEFT JOIN ${h} ON ${h}.${_}_id = ${_}.id`);for(const d in u)u[d]===!0?n.push(`${h}.${d}`):s(u[d],d,h)},i=Object.keys(e);i.length===1&&e[i[0]]!==!0?s(e[i[0]],i[0],null):s(e,"_root",null);const c=[...r][0]||"_root",l=n.length?n.join(", "):"*",f=o.length?`
8
+ `+o.join(`
9
+ `):"";return`SELECT ${l}
10
+ FROM ${c}${f}`},V=e=>{const t=[],n=(o,r)=>{for(const s in o){const i=r?`${r}/${s}`:s;o[s]===!0?t.push(i):n(o[s],i)}};return n(e,""),t},B=e=>{const t=o=>{const r=[];for(const s in o)o[s]===!0?r.push(s):r.push(`${s}(${t(o[s])})`);return r.join(", ")},n=Object.keys(e);return n.length===1&&e[n[0]]!==!0?{from:n[0],select:t(e[n[0]])}:{from:null,select:t(e)}},z={graphql:L,"json-api":F,odata:M,sql:J,supabase:B,paths:V};function $t(e,t){return!!(k.has(e)||t?.context?.methods?.[e])}export{St as call,dt as defineSetter,O as error,ot as get,it as getChildren,pt as getContext,vt as getDB,ct as getPath,Ot as getQuery,st as getRef,ut as getRoot,ht as getRootContext,at as getRootData,ft as getRootState,$t as isMethod,N as keys,_t as log,tt as lookdown,et as lookdownAll,q as lookup,mt as nextElement,D as parse,v as parseDeep,xt as previousElement,nt as remove,lt as setActiveRootState,Q as setNodeStyles,rt as setProps,X as spotByPath,yt as variables,T as verbose,gt as warn};
@@ -0,0 +1 @@
1
+ import{window as t}from"./globals.js";const o=e=>(typeof Node=="object"?e instanceof t.Node:e&&typeof e=="object"&&typeof e.nodeType=="number"&&typeof e.nodeName=="string")||!1,d=e=>(typeof HTMLElement=="object"?e instanceof t.HTMLElement:e&&typeof e=="object"&&e!==null&&e.nodeType===1&&typeof e.nodeName=="string")||!1,f=e=>typeof t<"u"&&(t.Node&&e instanceof t.Node||t.Window&&e instanceof t.Window||e===t||e===document);export{f as isDOMNode,d as isHtmlElement,o as isNode};
@@ -0,0 +1,12 @@
1
+ import{window as S}from"./globals.js";import{isFunction as _,isObjectLike as u,isObject as d,isArray as w,isString as g,is as D}from"./types.js";import{unstackArrayOfObjects as C}from"./array.js";import{stringIncludesAny as T}from"./string.js";import{isDOMNode as h}from"./node.js";import{METHODS_EXL as W}from"./keys.js";const k="production",O=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,v=(e,t,o,r)=>{if(_(e))return t?typeof e.call!="function"?e:e.call(t,t,o||t.state,r||t.context):void 0;if(e!=null&&t?.context?.plugins&&(w(e)||d(e)&&!h(e))){const n=t.context.plugins;for(const s of n)if(s.resolveHandler){const c=s.resolveHandler(e,t);if(typeof c=="function")return v(c,t,o,r)}}return e},X=(e,t,o)=>{for(const r in t)e[r]=v(t[r],o)},Y=(e,t,o=[])=>{const r=o instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(O(n)||(r?o.has(n):o.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},m=(e,t,o=W)=>$(e,t,o,null),$=(e,t,o,r)=>{if(e===t)return e;if(r){for(let s=0;s<r.length;s+=2)if(r[s]===e&&r[s+1]===t)return e}const n=o instanceof Set;for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||O(s)||s==="constructor"||s==="prototype"||(n?o.has(s):o.includes(s)))continue;const c=e[s],i=t[s];if(u(c)&&u(i)){const l=r||[];l.push(e,t),$(c,i,o,l),l.length-=2}else c===void 0&&(e[s]=i)}return e},b=(e,t=[])=>{const o=t instanceof Set,r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(O(n)||(o?t.has(n):t.includes(n))||(r[n]=e[n]));return r},I=(e,t={})=>{const{exclude:o=[],cleanUndefined:r=!1,cleanNull:n=!1,window:s,visited:c=new WeakMap,handleExtends:i=!1}=t,l=s||S||globalThis;if(!u(e)||h(e))return e;if(c.has(e))return c.get(e);const a=w(e)?[]:{};c.set(e,a);const x=o instanceof Set?o:o.length>3?new Set(o):null;for(const p in e){if(!Object.prototype.hasOwnProperty.call(e,p)||O(p)||p==="__proto__"||(x?x.has(p):o.includes(p)))continue;const y=e[p];if(!(r&&y===void 0)&&!(n&&y===null)){if(h(y)){a[p]=y;continue}if(i&&p==="extends"&&w(y)){a[p]=C(y,o);continue}if(_(y)){a[p]=y;continue}u(y)?a[p]=I(y,{...t,visited:c}):a[p]=y}}return a},E=(e,t={})=>{(e.node||e.__ref||e.parent||e.__element||e.parse)&&((e.__element||e.parent?.__element).warn("Trying to clone element or state at",e),e=e.parse?.());for(const o in e){const r=e[o];if(_(r))t[o]=r.toString();else if(d(r))t[o]={},E(r,t[o]);else if(w(r)){const n=t[o]=[];for(let s=0;s<r.length;s++){const c=r[s];d(c)?(n[s]={},E(c,n[s])):_(c)?n[s]=c.toString():n[s]=c}}else t[o]=r}return t},R=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),A=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let o=!1;for(const s in e){o=!0;break}if(!o)return"{}";const r=" ".repeat(t);let n=`{
2
+ `;for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const c=e[s];let i=!1;for(let f=0;f<s.length;f++)if(R.has(s[f])){i=!0;break}const l=i?`'${s}'`:s;if(n+=`${r} ${l}: `,w(c)){n+=`[
3
+ `;for(const f of c)u(f)&&f!==null?n+=`${r} ${A(f,t+2)},
4
+ `:g(f)?n+=`${r} '${f}',
5
+ `:n+=`${r} ${f},
6
+ `;n+=`${r} ]`}else u(c)?n+=A(c,t+1):g(c)?n+=T(c,[`
7
+ `,"'"])?`\`${c}\``:`'${c}'`:n+=c;n+=`,
8
+ `}return n+=`${r}}`,n},M=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],F=/^["[{]/,P=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||!M.some(s=>s.test(t)))return!1;const r=t.charCodeAt(0),n=t.includes("=>");return!(r===123&&!n||r===91||F.test(t)&&!n)},L=e=>(0,eval)(e),N=(e,t={},o={window:{eval:L}})=>{for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const n=e[r];if(g(n))if(P(n))try{t[r]=o.window.eval(`(${n})`)}catch(s){typeof console<"u"&&console.warn&&console.warn('[smbls] deepDestringifyFunctions: eval failed on "'+r+'" \u2014 function will be left as a string and el.call("'+r+'") will silently no-op. Reason: '+(s&&s.message?s.message:String(s))+`.
9
+ First 200 chars of source: `+String(n).slice(0,200)),t[r]=n}else t[r]=n;else if(w(n)){const s=t[r]=[];for(let c=0;c<n.length;c++){const i=n[c];if(g(i))if(P(i))try{s.push(o.window.eval(`(${i})`))}catch(l){typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed in array at index ${c} (prop "${r}"). Reason: ${l&&l.message?l.message:String(l)}.
10
+ First 200 chars: ${String(i).slice(0,200)}`),s.push(i)}else s.push(i);else d(i)?s.push(N(i)):s.push(i)}}else d(n)?t[r]=N(n,t[r]):t[r]=n}return t},j=e=>{if(!e||typeof e!="object")return e;const t={},o=[];for(const r of Object.keys(e)){const n=e[r];g(n)&&P(n)?o.push([r,n]):t[r]=n}for(const[r,n]of o)try{const s=Object.keys(t).map(c=>`var ${c} = __gs__[${JSON.stringify(c)}];`).join(`
11
+ `);t[r]=S.eval(`(function(__gs__) { ${s}
12
+ return (${n}); })`)(t)}catch{try{t[r]=S.eval(`(${n})`)}catch{t[r]=n}}return t},ee=(e,t={verbose:!0})=>{try{return e?S.eval("("+e+")"):{}}catch(o){t.verbose&&console.warn(o)}},te=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),B=e=>{for(const t in e)return!1;return!0},ne=e=>d(e)&&B(e),re=()=>Object.create(null),oe=(e,t,o={})=>{const r=o.exclude||[],n=o.preventUnderscore;for(const s in t)r.includes(s)||!n&&O(s)||s==="constructor"||s==="prototype"||t[s]!==void 0&&(e[s]=t[s]);return e},se=(e,t,o=[])=>{const r=o instanceof Set;for(const n in t)O(n)||n==="constructor"||n==="prototype"||(r?o.has(n):o.includes(n))||(e[n]=t[n]);return e},H=(e,t,o={},r=new WeakMap)=>{if(!u(e)||!u(t)||h(e)||h(t))return t;if(r.has(e))return r.get(e);r.set(e,e);const n=o.exclude,s=n?n instanceof Set?n:new Set(n):null,c=!o.preventForce;for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||s&&s.has(i)||c&&O(i)||i==="constructor"||i==="prototype")continue;const l=e[i],f=t[i];h(f)?e[i]=f:u(l)&&u(f)?e[i]=H(l,f,o,r):f!==void 0&&(e[i]=f)}return e},J=(e,t,o=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(o.has(e)||o.has(t))return!0;o.add(e),o.add(t);const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s=0;s<r.length;s++){const c=r[s];if(!Object.prototype.hasOwnProperty.call(t,c)||!J(e[c],t[c],o))return!1}return!0},q=new Set(["node","__ref"]),ce=(e,t,o=q)=>{if(e===t)return!0;if(!u(e)||!u(t)||h(e)||h(t))return e===t;const r=o instanceof Set?o:new Set(o),n=new WeakSet;function s(c,i){if(n.has(i))return!0;n.add(i);for(const l in i){if(!Object.prototype.hasOwnProperty.call(i,l)||r.has(l))continue;if(!Object.prototype.hasOwnProperty.call(c,l))return!1;const f=i[l],a=c[l];if(h(f)||h(a)){if(f!==a)return!1}else if(u(f)&&u(a)){if(!s(a,f))return!1}else if(f!==a)return!1}return!0}return s(e,t)},ie=(e,t)=>{if(t==null)return e;if(D(t)("string","number"))delete e[t];else if(w(t))for(let o=0;o<t.length;o++)delete e[t[o]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},z=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=z(e[o]));return t},fe=(e,t)=>{if(e.length===0)return t;const o={};let r=o;for(let n=0;n<e.length;n++)n===e.length-1&&t?r[e[n]]=t:(r[e[n]]={},r=r[e[n]]);return o},le=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let n=0;n<t.length-1;n++){if(o[t[n]]===void 0)return;o=o[t[n]]}const r=t[t.length-1];o&&Object.prototype.hasOwnProperty.call(o,r)&&delete o[r]},ue=(e,t,o)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++)(!r[t[n]]||typeof r[t[n]]!="object")&&(r[t[n]]={}),r=r[t[n]];return r[t[t.length-1]]=o,e},ae=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let r=0;r<t.length;r++){if(o==null)return;o=o[t[r]]}return o},pe=e=>{let o=[],r=0;for(let n=0;n<e.length;n++)if(o.length<2)o.push(e[n]);else if(e[n]===o[n%2]?r++:(o=[e[n-1],e[n]],r=1),r>=20)return(k==="test"||k==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",o),!0},ye=e=>{const t=new WeakSet;function o(r){if(r&&typeof r=="object"){if(t.has(r))return!0;t.add(r);for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&o(r[n]))return console.log(r,"cycle at "+n),!0}return!1}return o(e)},he=(e,t)=>{const o=t instanceof Set?t:new Set(t),r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!o.has(n)&&(r[n]=e[n]);return r};export{b as clone,fe as createNestedObject,z as createObjectWithoutPrototype,I as deepClone,ce as deepContains,N as deepDestringifyFunctions,m as deepMerge,E as deepStringifyFunctions,j as destringifyGlobalScope,pe as detectInfiniteLoop,he as excludeKeysFromObject,v as exec,ae as getInObjectByPath,P as hasFunction,te as hasOwnProperty,ye as isCyclic,B as isEmpty,ne as isEmptyObject,J as isEqualDeep,re as makeObjectWithoutPrototype,X as map,Y as merge,A as objectToString,oe as overwrite,H as overwriteDeep,se as overwriteShallow,ie as removeFromObject,le as removeNestedKeyByPath,ue as setInObjectByPath,ee as stringToObject};
@@ -0,0 +1 @@
1
+ const e=new Set(["__proto__","constructor","prototype","_id","__v","id","createdAt","updatedAt","schema"]),o=t=>typeof t=="string"&&e.has(t);export{e as UNIVERSAL_RESERVED_KEYS,o as isUniversallyReservedKey};
@@ -0,0 +1 @@
1
+ import{DOMQ_PROPERTIES as k,PROPS_METHODS as S}from"./keys.js";import{addEventFromProps as m}from"./events.js";import{deepClone as w,deepMerge as F,exec as I}from"./object.js";import{is as T,isArray as H,isFunction as p,isObject as a,isObjectLike as L}from"./types.js";import{lowercaseFirstLetter as M}from"./string.js";import{hasHandlerPlugin as x}from"./function.js";const P=/^[A-Z]/,E=/^\d+$/,y=new Set([":","@","[","*","+","~","&",">","$","-",".","!"]),z=new Set(["extend","props","text","tag","on","if","childExtend","children","childrenAs","state","html","attr","define","content"]),G=t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;for(const s in t)if(z.has(s)||P.test(s))return!0;return!1},J=(t,s,n)=>{const{props:e,__ref:r}=t;if(r.__propsStack=[],e)r.__initialProps=e;else return{};return L(e)?{...e}:(r.__propsStack.push(e),{})};function N(t,s={}){const n=s.cachedKeys||[];for(const e in t){const r=t[e];if(e.length>2&&e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e[2]===e[2].toUpperCase()&&(p(r)||r!=null&&x(this.context))){const R=M(e.slice(2));t.on&&(t.on[R]=r),delete t[e];continue}if(e==="childProps"){t.props[e]=r,delete t[e],n.push(e);continue}const f=this.define?.[e],c=this.context?.define?.[e],u=a(f)||p(f),h=a(c)||p(c);if(u||h)continue;const l=e.charAt(0);if(y.has(l)){t.props[e]=r,delete t[e],n.push(e);continue}const d=P.test(e)||E.test(e)||G(r),_=k.has(e);!d&&!_&&(e in t.props||(t.props[e]=r),delete t[e],n.push(e))}return t}function U(t=this,s){const n=s.cachedKeys||[];for(const e in t.props){const r=t.props[e],o=e.length>2&&e.charCodeAt(0)===111&&e.charCodeAt(1)===110,i=p(r)||r!=null&&x(this.context);if(o&&i){m(e,t),delete t.props[e];continue}if(n.includes(e)||e==="childProps")continue;const f=e.charAt(0);if(y.has(f))continue;const c=this.define?.[e],u=this.context?.define?.[e],h=a(c)||p(c),l=a(u)||p(u),d=P.test(e)||E.test(e),_=k.has(e);(d||_||h||l)&&(t[e]===void 0||r===null)&&(t[e]=r,t.props&&delete t.props[e])}return t}function v(t=this){const s=[];return N.call(this,t,{cachedKeys:s}),U.call(this,t,{cachedKeys:s}),t}function W(t={}){return t.on||(t.on={}),t.props||(t.props={}),v.call(this,t)}const g=t=>T(t)("string","number")?{inheritedString:t}:t,b=(t,s)=>!t||!s.length?!1:s.includes(t),C=(t,s)=>{const{__ref:n}=t,e=n.__propsStack||[],r=s.props;if(!r)return e;const o=r[t.key],i=r.childProps||s.childProps,f=t.props?.ignoreChildProps;if(i&&!f){const c=g(i);e.unshift(c)}if(o){const c=g(o);e.unshift(c)}return e};function B(t,s){this.__element.update({props:t},s)}function A(t){const s={update:B.bind(t.props),__element:t};Object.setPrototypeOf(t.props,s)}const O=t=>{const s=new Set;return t.filter(n=>!n||S.has(n)||s.has(n)?!1:(s.add(n),!0))},D=(t,s,n)=>(s.props=t.reduce((e,r)=>{if(S.has(r))return e;for(;p(r);)r=I(r,s);return F(e,w(r,{exclude:S}))},{}),A(s),s.props),V=(t,s)=>{const{props:n,__ref:e}=t;let r=e.__propsStack||[];if(s?.props&&(r=[...C(t,s)]),a(n)?r.push(n):n==="inherit"&&s?.props?r.push(s.props):n&&r.push(n),H(e.__extendsStack))for(let o=0;o<e.__extendsStack.length;o++){const i=e.__extendsStack[o];i.props&&i.props!==n&&r.push(i.props)}return e.__propsStack=O(r),e.__propsStack},K=(t,s)=>{const{__ref:n}=t,e=V(t,s);e.length?D(e,t):(n.__propsStack=[],t.props={})},j=function(t,s,n){const{__ref:e}=t;if(e.__if)K(t,s);else try{K(t,s)}catch(r){t.context?.designSystem?.verbose&&console.warn("initProps error at",e.path?.join("."),r),t.props={},e.__propsStack=[]}return A(t),t},tt=(t,s,n)=>{const{__ref:e}=s;let o=[...e.__propsStack||[]];const i=C(s,n);return i.length&&(o=[...i,...o]),t&&(o=[t,...o]),e.__propsStack=O(o),e.__propsStack.length&&D(e.__propsStack,s),s};export{K as applyProps,J as createProps,V as createPropsStack,C as inheritParentProps,j as initProps,g as objectizeStringProperty,U as pickupElementFromProps,N as pickupPropsFromElement,b as propExists,v as propertizeElement,W as propertizeUpdate,O as removeDuplicateProps,A as setPropsPrototype,D as syncProps,B as update,tt as updateProps};
@@ -0,0 +1 @@
1
+ import{isObject as n,isArray as o}from"./types.js";const r=(t,e)=>(o(e)?e:Object.values(e)).reduce((s,i)=>Math.abs(i-t)<Math.abs(s-t)?i:s),b=(t,e)=>(t=parseFloat(t),n(e)&&(e=Object.values(e)),r(t,e));export{r as findClosestNumber,b as findClosestNumberInFactory};
@@ -0,0 +1 @@
1
+ const r=(o,s)=>{const{__ref:e}=o,c=o.context||s.context||e.root?.context;c&&!c.globalScope&&(c.globalScope={});const t=s.scope||e.root?.scope,p=c?.globalScope;if(!o.scope)t?o.scope=t:p?o.scope=Object.create(p):o.scope={};else if(typeof o.scope=="object"&&o.scope!==null&&Object.getPrototypeOf(o.scope)===Object.prototype){const f=t||p;f&&Object.setPrototypeOf(o.scope,f)}};export{r as createScope};
@@ -0,0 +1 @@
1
+ import{isObject as i,isString as v}from"./types.js";const d="system",w="https://smbls-kv.nika-980.workers.dev",L="https://api.symbols.app";function c(t){const n=String(t||"").trim();if(!n)return{owner:d,key:"",full:""};let r=null,e=n;if(n.includes("/")){const s=n.indexOf("/");r=n.slice(0,s),e=n.slice(s+1)}e=e.replace(/\.symbo\.ls$/iu,""),r||(r=d);const o=e?`${r}/${e}`:"";return{owner:r,key:e,full:o}}const m=(t,n)=>{for(const r in n)r in t?i(t[r])&&i(n[r])&&m(t[r],n[r]):t[r]=n[r]},A=(t,n)=>{if(!(!n||!n.length))for(let r=0;r<n.length;r++){const e=n[r];if(i(e)){for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(i(e[o])&&i(t[o]))if(o==="designSystem")m(t[o],e[o]);else for(const s in e[o])s in t[o]||(t[o][s]=e[o][s]);else o in t||(t[o]=e[o])}}};async function U(t,n={}){if((n.provider||"kv")==="api")return h(t,n);const e=await $(t,n);return e||h(t,n)}async function $(t,n={}){const r=n.kvBaseUrl||w,e=n.env||"production",o=`${r}/kv/${encodeURIComponent(t)}?env=${e}`;try{const s=await fetch(o,{method:"GET"});return s.ok&&(await s.json())?.value||null}catch{return null}}async function h(t,n={}){const r=n.apiBaseUrl||L,{key:e}=c(t);try{const o=`${r}/core/projects/libraries/available?search=${encodeURIComponent(e)}&limit=10`,s=await fetch(o,{method:"GET"});if(!s.ok)return null;const a=await s.json(),l=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(b=>{const{key:k}=c(b?.key);return k.toLowerCase()===e.toLowerCase()});if(!l?.id&&!l?._id)return null;const y=l.id||l._id,p=`${r}/core/projects/${encodeURIComponent(y)}/data?branch=main`,u=await fetch(p,{method:"GET"});if(!u.ok)return null;const f=await u.json();return f?.data||f||null}catch{return null}}async function S(t,n={}){return!t||!t.length?[]:(await Promise.all(t.map(async e=>{if(i(e))return e;if(v(e)){const{full:o}=c(e);if(!o)return null;try{const s=await U(o,n);return s||console.warn(`[smbls] Shared library "${o}" not found`),s}catch(s){return console.warn(`[smbls] Failed to fetch shared library "${o}":`,s.message),null}}return null}))).filter(Boolean)}export{m as deepDefaults,U as fetchLibraryData,A as mergeSharedLibraries,c as normalizeLibraryKey,S as resolveSharedLibraries};
@@ -0,0 +1 @@
1
+ import{addProtoToArray as a}from"./array.js";import{STATE_METHODS as p}from"./keys.js";import{deepClone as u,deepMerge as _,overwriteDeep as d,overwriteShallow as h}from"./object.js";import{is as f,isObject as g,isObjectLike as y,isString as m}from"./types.js";const k=e=>{const{state:t,props:o,__ref:r}=e,n=o?.state||t;return f(n)("string","number")?(r.__state=n,{value:n}):n===!0?(r.__state=e.key,{}):n?(r.__hasRootState=!0,n):!1},P=(e,t)=>{if(!e.includes("~/"))return;if(e.split("~/").length>1)return t.root},S=(e,t)=>{if(!e.includes("../"))return;const r=e.split("../").length-1;for(let n=0;n<r;n++){if(!t.parent)return null;t=t.parent}return t},b=(e,t,o={})=>{const r=m(e)?e.split("/"):[e],n=r.length-1;for(let c=0;c<n;c++){const i=r[c],s=r[c+1];if(i==="__proto__"||s==="__proto__")return;let l=t[i];l||(l=t[i]={}),l[s]||(l[s]={}),e=s,t=l}return o.returnParent?t:t[e]},w=(e,t,o={})=>{let n=e.__ref.__state;if(!x(e))return;const c=P(n,t.state);let i=t.state;if(c)i=c,n=n.replaceAll("~/","");else{const s=S(n,t.state);s&&(i=s,n=n.replaceAll("../",""))}if(i)return b(n,i,o)},A=(e,t)=>{const o=e.__ref,r=w(e,t);if(r===void 0)return e.state;if(f(r)("object","array"))return u(r);if(f(r)("string","number","boolean"))return o.__stateType=typeof r,{value:r};console.warn(o.__state,"is not present. Replacing with",{})},x=e=>{const{__ref:t}=e,o=t?.__state;return!!(o&&f(o)("number","string","boolean"))},T=function(e){return y(e)?!!(e.update&&e.parse&&e.clean&&e.create&&e.parent&&e.destroy&&e.rootUpdate&&e.parentUpdate&&e.keys&&e.values&&e.toggle&&e.replace&&e.quietUpdate&&e.quietReplace&&e.add&&e.apply&&e.applyReplace&&e.setByPath&&e.setPathCollection&&e.removeByPath&&e.removePathCollection&&e.getByPath&&e.applyFunction&&e.__element&&e.__children):!1},B=(e,t)=>{if(!e)return t||{};const o=e.split("/"),r={};let n=r;const c=o.length-1;for(let i=0;i<=c;i++)n[o[i]]=i===c?t||{}:{},n=n[o[i]];return r},C=(e,t)=>{const{__element:o}=t,r=o?.state;if(!r)return;const n=u(r,p),c={[e.key]:n},i=g(r.__depends)?{...r.__depends,...c}:c;return Array.isArray(r)?a(r,{...Object.getPrototypeOf(r),__depends:i}):Object.setPrototypeOf(r,{...Object.getPrototypeOf(r),__depends:i}),n},R=(e,t,o={})=>{const{overwrite:r}=o;if(!r)return;const n=r==="shallow";if(r==="merge"){_(e,t,p);return}(n?h:d)(e,t,p)};export{C as applyDependentState,k as checkForStateTypes,x as checkIfInherits,A as createInheritedState,B as createNestedObjectByKeyPath,w as findInheritedState,b as getChildStateInKey,S as getParentStateInKey,P as getRootStateInKey,T as isState,R as overwriteState};
@@ -0,0 +1 @@
1
+ import{isString as o,isObject as a,isArray as c,isNumber as i}from"./types.js";const s=async e=>{try{await navigator.clipboard.writeText(e)}catch(r){console.warn("Failed to copy text: ",r)}},n=async e=>{try{const r=new Blob([e],{type:"text/javascript"}),t=new window.ClipboardItem({"text/plain":r});await navigator.clipboard.write([t]),console.log("JavaScript code copied to clipboard as text/javascript")}catch(r){console.error("Failed to copy JavaScript code: ",r)}},l=e=>e.replace(/[^a-zA-Z0-9_]/g,""),g=e=>(typeof e!="string"&&(e=String(e||"")),e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(r,t){return t===0?r.toLowerCase():r.toUpperCase()}).replace(/\s+/g,"")),u=e=>e&&e.replace(/\w\S*/g,r=>r.charAt(0).toUpperCase()+r.substr(1).toLowerCase()),b=e=>e.replace(/[^a-zA-Z0-9]/g," ").trim().toLowerCase().replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),C=(e="")=>{if(typeof e!="string")return;const r=e.replace(/([A-Z])/g," $1");return r.charAt(0).toUpperCase()+r.slice(1)},w=e=>{if(c(e))return e;if(o(e))return e.split(" ");if(a(e))return Object.values(e);if(i(e))return[e]};export{w as arrayzeValue,n as copyJavaScriptToClipboard,s as copyStringToClipboard,l as removeChars,g as toCamelCase,b as toDashCase,C as toDescriptionCase,u as toTitleCase};
@@ -0,0 +1,3 @@
1
+ const O=(e,r)=>{for(const t of r)if(e.includes(t))return!0;return!1},j=(e,r)=>{const t=new RegExp(`[${r.join("\\")}]`,"g");return e.replace(t,"")},L={2:/{{\s*((?:\.\.\/)*)([\w\d.]+)\s*(?:\|\s*([\w\d.]+))?\s*}}/g,3:/{{{(\s*(?:\.\.\/)*)([\w\d.]+)\s*(?:\|\s*([\w\d.]+))?\s*}}}/g},m=(e,r)=>r.split(".").reduce((t,a)=>t?.[a],e);function I(e,r,t={}){const{bracketsLength:a=2}=t,f=a===3?"{{{":"{{";if(!e.includes(f))return e;const h=L[a],o=r||this.state||{},i=this;return e.replace(h,(u,d,n,c)=>{const g=n.trim();if(c){const l=i?.context,s=l?.functions?.[c]||l?.utils?.[c]||l?.methods?.[c]||l?.snippets?.[c]||i?.[c];if(s&&typeof s=="function")try{return String(s.call(i,g)??"")}catch{return""}return""}if(d){const l=(d.match(/\.\.\//g)||[]).length;let s=o;for(let p=0;p<l;p++){if(!s||!s.parent)return"";s=s.parent}if(g==="parent")return String(s.value??"");const x=m(s,g);return String(x??"")}else{const l=m(o,g);if(l!=null)return String(l);const s=i?.context?.polyglot;if(s?.translations){const x=o?.root?.lang||o?.lang||i?.context?.state?.lang||s.defaultLang||"en",p=s.translations[x];if(p){const C=m(p,g);if(C!=null&&typeof C!="object")return String(C);for(const w in p){const b=p[w];if(b&&typeof b=="object"&&!Array.isArray(b)){const S=m(b,g);if(S!=null&&typeof S!="object")return String(S)}}}const y=m(s.translations,g);if(y!=null&&typeof y!="object")return String(y)}return""}})}const R=e=>`${e.charAt(0).toLowerCase()}${e.slice(1)}`,k=(e,r)=>{const t=e.split(`
2
+ `);let a=-1,f=-1,h=-1,o=-1;const i=new RegExp(`\\b${r}\\b\\s*:\\s*`);let u=0,d=!1;for(let n=0;n<t.length;n++)if(i.test(t[n])&&!d){if(d=!0,a=n+1,h=t[n].indexOf(r)+1,t[n].includes("{}")){f=a,o=t[n].indexOf("{}")+3;break}const c=t[n].slice(h+r.length);if(c.includes("{")||c.includes("["))u=1;else{f=n+1,o=t[n].length+1;break}}else if(d&&(u+=(t[n].match(/{/g)||[]).length,u+=(t[n].match(/\[/g)||[]).length,u-=(t[n].match(/}/g)||[]).length,u-=(t[n].match(/]/g)||[]).length,u===0)){f=n+1,o=t[n].lastIndexOf("}")!==-1?t[n].lastIndexOf("}")+2:t[n].length+1;break}return{startColumn:h,endColumn:o,startLineNumber:a,endLineNumber:f}},A=/\\([0-7]{1,3})/g,E=e=>e.replace(A,(r,t)=>String.fromCharCode(parseInt(t,8))),$=e=>e.replace(/\n/g,"/////n").replace(/`/g,"/////tilde").replace(/\$/g,"/////dlrsgn"),F=e=>e.replace(/\/\/\/\/\/n/g,`
3
+ `).replace(/\/\/\/\/\/tilde/g,"`").replace(/\/\/\/\/\/dlrsgn/g,"$"),N=/[^a-zA-Z0-9\s]/g,_=e=>e.replace(N,r=>"%"+r.charCodeAt(0).toString(16).toUpperCase()),v=e=>e.replace(/%[0-9A-Fa-f]{2}/g,r=>String.fromCharCode(parseInt(r.slice(1),16)));export{v as customDecodeURIComponent,_ as customEncodeURIComponent,F as decodeNewlines,$ as encodeNewlines,k as findKeyPosition,R as lowercaseFirstLetter,I as replaceLiteralsWithObjectFields,E as replaceOctalEscapeSequences,O as stringIncludesAny,j as trimStringFromSymbols};
@@ -0,0 +1 @@
1
+ const l=()=>{const s=document.styleSheets[0];let o="";if(s)try{const e=s.cssRules||s.rules;for(let t=0;t<e.length;t++)o+=e[t].cssText}catch(e){console.error("Unable to access CSS rules. This may be due to CORS restrictions:",e)}else console.log("No stylesheets found in document.styleSheets[0].");return o};export{l as getEmotionStylesheet};
@@ -0,0 +1 @@
1
+ const t={root:["body","html"],head:["title","base","meta","style","noscript","script"],body:new Set(["string","style","fragment","a","abbr","acronym","address","applet","area","article","aside","audio","b","basefont","bdi","bdo","big","blockquote","br","button","canvas","caption","center","cite","code","search","col","colgroup","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","hgroup","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","template","hgroup","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr","svg","path","circle","ellipse","line","polygon","polyline","rect","g","defs","symbol","use","text","tspan","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feFlood","feComposite","foreignObject"])},r=new Set(["svg","path","circle","ellipse","line","polygon","polyline","rect","g","defs","symbol","use","text","tspan","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feFlood","feComposite","foreignObject"]),a=e=>t.body.has(e);export{t as HTML_TAGS,r as SVG_TAGS,a as isValidHtmlTag};
@@ -0,0 +1 @@
1
+ import{isFunction as f}from"./types.js";import{resolveHandler as u,runPluginHook as p}from"./function.js";const a=(t,r)=>{const o="on"+t.charAt(0).toUpperCase()+t.slice(1);return r[o]},h=(t,r,o,s,e)=>{if(t=u(t,r),!!f(t))try{const n=t.call(r,r,o||r.state,s||r.context,e);return n&&typeof n.then=="function"&&n.catch(c=>{r.error=c,c instanceof ReferenceError?console.warn("[DOMQL] Async event warning:",c.message):console.error("[DOMQL] Async event error:",c)}),n}catch(n){if(r.error=n,n instanceof ReferenceError?console.warn("[DOMQL] Event handler warning:",n.message):console.error("[DOMQL] Event handler error:",n),r.context?.strictMode)throw n}},g=(t,r,o)=>{if(!r)throw new Error("Element is required");p(t,r,o);const s=a(t,r);if(s){const{state:e,context:n}=r;return h(s,r,e,n,o)}},v=(t,r,o,s,e,n)=>{if(t=u(t,o),!!f(t))try{const c=t.call(o,r,o,s||o.state,e||o.context,n);return c&&typeof c.then=="function"&&c.catch(i=>{o.error=i,console.error("[DOMQL] Async event update error:",i)}),c}catch(c){if(o.error=c,console.error("[DOMQL] Event update error:",c),o.context?.strictMode)throw c}},x=(t,r,o,s)=>{p(t,o,r,s);const e=a(t,o);if(e){const{state:n,context:c}=o;return v(e,r,o,n,c,s)}};export{h as applyEvent,v as applyEventUpdate,g as triggerEventOn,x as triggerEventOnUpdate};
@@ -0,0 +1 @@
1
+ import{isHtmlElement as r,isNode as s}from"./node.js";const i=t=>t===null?!1:typeof t=="object"&&t.constructor===Object,c=t=>typeof t=="string",u=t=>typeof t=="number",p=t=>typeof t=="function",f=t=>t===!0||t===!1,l=t=>t===null,x=t=>Array.isArray(t),d=t=>t instanceof Date,b=t=>t===null?!1:typeof t=="object",m=t=>t!==void 0,y=t=>t===void 0,n={boolean:f,array:x,object:i,string:c,date:d,number:u,null:l,function:p,objectLike:b,node:s,htmlElement:r,defined:m},j=t=>(...e)=>e.some(o=>n[o](t)),N=t=>(...e)=>!e.some(o=>n[o](t));export{n as TYPES,j as is,x as isArray,f as isBoolean,d as isDate,m as isDefined,p as isFunction,N as isNot,l as isNull,u as isNumber,i as isObject,b as isObjectLike,c as isString,y as isUndefined};
@@ -0,0 +1 @@
1
+ import{createSnapshotId as c}from"./key.js";const p={snapshotId:c},_=(s,e)=>{const o=s.__ref,{currentSnapshot:a,calleeElement:t}=e;if(!t||t===s){const r=p.snapshotId();return o.__currentSnapshot=r,[r,s]}const n=t.__ref.__currentSnapshot;return a<n?[n,t,!0]:[n,t]};export{_ as captureSnapshot};
package/package.json CHANGED
@@ -1,29 +1,48 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "3.14.2",
3
+ "version": "3.14.3",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
- "module": "./index.js",
7
- "main": "./index.js",
6
+ "module": "./dist/esm/index.js",
7
+ "main": "./dist/cjs/index.cjs",
8
8
  "exports": {
9
- ".": "./index.js",
10
- "./methods": "./methods.js",
11
- "./*.js": "./*.js",
12
- "./*": "./*.js",
13
- "./package.json": "./package.json"
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
+ "./methods": {
17
+ "development": "./methods.js",
18
+ "import": "./dist/esm/methods.js",
19
+ "require": "./dist/cjs/methods.cjs",
20
+ "default": "./dist/esm/methods.js"
21
+ },
22
+ "./*.js": {
23
+ "development": "./*.js",
24
+ "import": "./dist/esm/*.js",
25
+ "require": "./dist/cjs/*.cjs",
26
+ "default": "./dist/esm/*.js"
27
+ },
28
+ "./*": {
29
+ "development": "./*.js",
30
+ "import": "./dist/esm/*.js",
31
+ "require": "./dist/cjs/*.cjs",
32
+ "default": "./dist/esm/*.js"
33
+ }
14
34
  },
15
35
  "source": "index.js",
16
36
  "files": [
17
37
  "dist",
18
- "*.js"
38
+ "*.md",
39
+ "LICENSE"
19
40
  ],
20
41
  "scripts": {
21
- "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
22
- "build:esm": "NODE_ENV=$NODE_ENV esbuild *.js --target=es2020 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV",
23
- "build:cjs": "NODE_ENV=$NODE_ENV esbuild *.js --target=node18 --format=cjs --outdir=dist/cjs --define:process.env.NODE_ENV=process.env.NODE_ENV",
24
- "build": "node ../../build/build.js",
25
- "prepublish": "npm run build && npm run copy:package:cjs",
26
- "build:iife": "NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=DomqlUtils --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV --external:@symbo.ls/element"
42
+ "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",
43
+ "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",
44
+ "build": "rimraf dist && npm run build:esm && npm run build:cjs",
45
+ "prepublishOnly": "npm run build"
27
46
  },
28
47
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
29
48
  "peerDependencies": {
@@ -38,10 +57,8 @@
38
57
  "@babel/core": "^7.26.0"
39
58
  },
40
59
  "browser": "./index.js",
41
- "unpkg": "./dist/iife/index.js",
42
- "jsdelivr": "./dist/iife/index.js",
43
60
  "sideEffects": false,
44
61
  "publishConfig": {
45
- "access": "public"
62
+ "access": "restricted"
46
63
  }
47
64
  }
package/array.js DELETED
@@ -1,162 +0,0 @@
1
- 'use strict'
2
-
3
- import { deepClone, deepMerge } from './object.js'
4
- import { isArray, isNumber, isString } from './types.js'
5
-
6
- export const arrayContainsOtherArray = (arr1, arr2) => {
7
- return arr2.every(val => arr1.includes(val))
8
- }
9
-
10
- export const getFrequencyInArray = (arr, value) => {
11
- let count = 0
12
- for (let i = 0; i < arr.length; i++) {
13
- if (arr[i] === value) count++
14
- }
15
- return count
16
- }
17
-
18
- export const removeFromArray = (arr, index) => {
19
- if (isString(index)) index = parseInt(index)
20
- if (isNumber(index)) {
21
- if (index < 0 || index >= arr.length || isNaN(index)) {
22
- throw new Error('Invalid index')
23
- }
24
- arr.splice(index, 1)
25
- } else {
26
- throw new Error('Invalid index')
27
- }
28
- return arr
29
- }
30
-
31
- export const swapItemsInArray = (arr, i, j) => {
32
- if (i < 0 || j < 0 || i >= arr.length || j >= arr.length) return
33
- ;[arr[i], arr[j]] = [arr[j], arr[i]]
34
- }
35
-
36
- export const joinArrays = (...arrays) => {
37
- return [].concat(...arrays)
38
- }
39
-
40
- /**
41
- * Merges array extendtypes
42
- */
43
- export const unstackArrayOfObjects = (arr, exclude = []) => {
44
- return arr.reduce(
45
- (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
46
- {}
47
- )
48
- }
49
-
50
- export const cutArrayBeforeValue = (arr, value) => {
51
- const index = arr.indexOf(value)
52
- if (index !== -1) {
53
- return arr.slice(0, index)
54
- }
55
- return arr
56
- }
57
-
58
- export const cutArrayAfterValue = (arr, value) => {
59
- if (!isArray(arr)) return
60
- const index = arr.indexOf(value)
61
- if (index !== -1) {
62
- return arr.slice(index + 1)
63
- }
64
- return arr
65
- }
66
-
67
- export const removeValueFromArray = (arr, value) => {
68
- const index = arr.indexOf(value)
69
- if (index > -1) {
70
- const newArray = [...arr]
71
- newArray.splice(index, 1)
72
- return newArray
73
- }
74
- return arr
75
- }
76
-
77
- export const removeValueFromArrayAll = (arr, value) => {
78
- return arr.filter(item => item !== value)
79
- }
80
-
81
- export const addItemAfterEveryElement = (array, item) => {
82
- // Create a new array to hold the result
83
- const result = []
84
-
85
- // Loop through the input array
86
- for (let i = 0; i < array.length; i++) {
87
- // Add the current element to the result array
88
- result.push(array[i])
89
-
90
- // If it's not the last element, add the item
91
- if (i < array.length - 1) {
92
- result.push(item)
93
- }
94
- }
95
-
96
- return result
97
- }
98
-
99
- export const reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
100
- const newArray = [...array] // Create a copy of the original array
101
- const indexToMove = newArray.indexOf(valueToMove) // Find the index of the value to move
102
- const indexToInsertBefore = newArray.indexOf(insertBeforeValue) // Find the index to insert before
103
- if (indexToMove !== -1 && indexToInsertBefore !== -1) {
104
- const removedItem = newArray.splice(indexToMove, 1)[0] // Remove the item to move
105
- const insertIndex =
106
- indexToInsertBefore < indexToMove
107
- ? indexToInsertBefore
108
- : indexToInsertBefore + 1 // Adjust insert index
109
- newArray.splice(insertIndex, 0, removedItem) // Insert the removed item before the specified value
110
- }
111
- return newArray
112
- }
113
-
114
- export const arraysEqual = (arr1, arr2) => {
115
- if (arr1.length !== arr2.length) {
116
- return false
117
- }
118
-
119
- for (let i = 0; i < arr1.length; i++) {
120
- if (arr1[i] !== arr2[i]) {
121
- return false
122
- }
123
- }
124
-
125
- return true
126
- }
127
-
128
- // Using filter and includes
129
- export const filterArrays = (sourceArr, excludeArr) => {
130
- return sourceArr.filter(item => !excludeArr.includes(item))
131
- }
132
-
133
- // Using Set for better performance with large arrays
134
- export const filterArraysFast = (sourceArr, excludeArr) => {
135
- const excludeSet = new Set(excludeArr)
136
- return sourceArr.filter(item => !excludeSet.has(item))
137
- }
138
-
139
- export const checkIfStringIsInArray = (string, arr) => {
140
- if (!string) return 0
141
- let count = 0
142
- for (let i = 0; i < arr.length; i++) {
143
- if (string.includes(arr[i])) count++
144
- }
145
- return count
146
- }
147
-
148
- export const removeDuplicatesInArray = arr => {
149
- if (!isArray(arr)) return arr
150
- return [...new Set(arr)]
151
- }
152
-
153
- export const addProtoToArray = (state, proto) => {
154
- for (const key in proto) {
155
- Object.defineProperty(state, key, {
156
- value: proto[key],
157
- enumerable: false, // Set this to true if you want the method to appear in for...in loops
158
- configurable: true, // Set this to true if you want to allow redefining/removing the property later
159
- writable: true // Set this to true if you want to allow changing the function later
160
- })
161
- }
162
- }
package/assets.js DELETED
@@ -1,117 +0,0 @@
1
- 'use strict'
2
-
3
- /**
4
- * Asset resolution + variant emitters shared across media components
5
- * (Img, Video, Audio, AssetPicture, …) and any plugin that reads from
6
- * `context.assets` / `context.files`.
7
- *
8
- * Components don't care WHERE an asset lives — runner-discovered file,
9
- * cloud-uploaded entry, or hand-authored URL — they call `resolveAsset`
10
- * with the element and get back a normalized shape (or null).
11
- */
12
-
13
- /**
14
- * Look up `el.src` in `el.context.assets`, falling back to
15
- * `el.context.files`. Normalizes the two source-side shapes:
16
- *
17
- * - **String URL** — cloud-resolved or hand-authored bare URLs.
18
- * Returns `{ src, type: null, variants: null }`. Components emit
19
- * a single-source tag with no `<source>` chain and no `srcset`.
20
- *
21
- * - **Manifest object** — `{ src, type, category, variants[] }`.
22
- * Shape produced by the runner's filename-based asset walker
23
- * (and any cloud provider that exposes variant metadata). Returned
24
- * verbatim.
25
- *
26
- * Anything else (object without `.src`, missing key, non-string `el.src`)
27
- * returns null. Components fall through to plain markup using `el.src`.
28
- */
29
- export const resolveAsset = (el) => {
30
- const key = el && el.src
31
- if (!key || typeof key !== 'string') return null
32
- const ctx = el.context
33
- if (!ctx) return null
34
- const found = (ctx.assets && ctx.assets[key]) || (ctx.files && ctx.files[key])
35
- if (!found) return null
36
- if (typeof found === 'string') {
37
- return { src: found, type: null, variants: null }
38
- }
39
- if (typeof found === 'object' && typeof found.src === 'string') {
40
- return found
41
- }
42
- return null
43
- }
44
-
45
- /**
46
- * Render an `srcset` value from a list of variants.
47
- *
48
- * Width descriptors take precedence over scale when present. Bare 1x
49
- * entries are kept or dropped based on context:
50
- *
51
- * - `<source srcset>` (`keepOneX: true`, default): bare 1x URLs are
52
- * required because `<source>` has no `src` fallback — without a 1x
53
- * entry the source can't match default-DPR clients.
54
- * - `<img srcset>` (`keepOneX: false`): bare 1x URLs are redundant
55
- * because the `src` attribute already covers them.
56
- */
57
- export const srcsetFor = (variants, { keepOneX = true } = {}) => {
58
- if (!Array.isArray(variants) || !variants.length) return ''
59
- const usingWidth = variants.some((v) => typeof v.width === 'number')
60
- const parts = []
61
- for (const v of variants) {
62
- if (usingWidth && typeof v.width === 'number') {
63
- parts.push(`${v.src} ${v.width}w`)
64
- } else if (!usingWidth) {
65
- if (v.scale === 1 && keepOneX) parts.push(v.src)
66
- else if (v.scale && v.scale !== 1) parts.push(`${v.src} ${v.scale}x`)
67
- }
68
- }
69
- return parts.join(', ')
70
- }
71
-
72
- /**
73
- * Same-format srcset for an `<img>` tag — filtered to the asset's
74
- * primary format and with `keepOneX: false`. Used by `<Img>`.
75
- */
76
- export const buildImgSrcset = (asset) => {
77
- if (!asset || !Array.isArray(asset.variants)) return ''
78
- const sameFormat = asset.variants.filter((v) => v.format === asset.type)
79
- return srcsetFor(sameFormat, { keepOneX: false })
80
- }
81
-
82
- /**
83
- * Build the children of an `<picture>` (or any format-negotiating tag)
84
- * from an asset manifest: one `<source type="…" srcset="…">` per non-
85
- * primary format, plus a trailing `<img>` for the primary format.
86
- *
87
- * Returns a list of DOMQL element configs. When the asset has no
88
- * variants array (cloud-string URL or single-source entry), returns
89
- * just the `<img>`.
90
- */
91
- export const buildSourcesAndImg = (asset, alt) => {
92
- if (!asset || typeof asset !== 'object' || typeof asset.src !== 'string') return []
93
- if (!Array.isArray(asset.variants) || !asset.variants.length) {
94
- return [{ tag: 'img', attr: { src: asset.src, alt: alt || '' } }]
95
- }
96
- // Group by format. Format that matches `asset.type` is the fallback
97
- // and gets emitted as the trailing `<img>` (browsers fall through to
98
- // it when no `<source>` matches). Other formats become `<source>`.
99
- const byFormat = new Map()
100
- for (const v of asset.variants) {
101
- if (!byFormat.has(v.format)) byFormat.set(v.format, [])
102
- byFormat.get(v.format).push(v)
103
- }
104
- const sources = []
105
- for (const [format, list] of byFormat) {
106
- if (format === asset.type) continue
107
- sources.push({
108
- tag: 'source',
109
- attr: { type: format, srcset: srcsetFor(list, { keepOneX: true }) }
110
- })
111
- }
112
- const sameFormat = byFormat.get(asset.type) || []
113
- const fallbackSrcset = srcsetFor(sameFormat, { keepOneX: false })
114
- const imgAttr = { src: asset.src, alt: alt || '' }
115
- if (fallbackSrcset) imgAttr.srcset = fallbackSrcset
116
- return [...sources, { tag: 'img', attr: imgAttr }]
117
- }
package/browser.js DELETED
@@ -1,13 +0,0 @@
1
- 'use strict'
2
-
3
- export async function toggleFullscreen (opts) {
4
- if (!document.fullscreenElement) {
5
- try {
6
- await (this.node || document).requestFullscreen()
7
- } catch (err) {
8
- console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`)
9
- }
10
- } else {
11
- await document.exitFullscreen()
12
- }
13
- }
package/cache.js DELETED
@@ -1,7 +0,0 @@
1
- 'use strict'
2
-
3
- export const cache = {}
4
-
5
- // Shared mutable options populated by create.js (cacheOptions/resetOptions).
6
- // Holds .create (initial create options) and .defaultOptions (per-render overrides).
7
- export const OPTIONS = {}
package/cdn.js DELETED
@@ -1,83 +0,0 @@
1
- 'use strict'
2
-
3
- function onlyDotsAndNumbers (str) {
4
- return /^[0-9.]+$/.test(str) && str !== ''
5
- }
6
-
7
- export const CDN_PROVIDERS = {
8
- skypack: {
9
- url: 'https://cdn.skypack.dev',
10
- formatUrl: (pkg, version) =>
11
- `${CDN_PROVIDERS.skypack.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}`
12
- },
13
- esmsh: {
14
- url: 'https://esm.sh',
15
- formatUrl: (pkg, version) =>
16
- `${CDN_PROVIDERS.esmsh.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}`
17
- },
18
- unpkg: {
19
- url: 'https://unpkg.com',
20
- formatUrl: (pkg, version) =>
21
- `${CDN_PROVIDERS.unpkg.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}?module`
22
- },
23
- jsdelivr: {
24
- url: 'https://cdn.jsdelivr.net/npm',
25
- formatUrl: (pkg, version) =>
26
- `${CDN_PROVIDERS.jsdelivr.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}/+esm`
27
- },
28
- symbols: {
29
- url: 'https://pkg.symbo.ls',
30
- formatUrl: (pkg, version) => {
31
- if (pkg.split('/').length > 2 || !onlyDotsAndNumbers(version)) {
32
- return `${CDN_PROVIDERS.symbols.url}/${pkg}`
33
- }
34
- return `${CDN_PROVIDERS.symbols.url}/${pkg}/${version}.js`
35
- }
36
- }
37
- }
38
-
39
- // Maps symbols.json packageManager values to CDN_PROVIDERS keys
40
- export const PACKAGE_MANAGER_TO_CDN = {
41
- 'esm.sh': 'esmsh',
42
- 'unpkg': 'unpkg',
43
- 'skypack': 'skypack',
44
- 'jsdelivr': 'jsdelivr',
45
- 'pkg.symbo.ls': 'symbols'
46
- }
47
-
48
- /**
49
- * Derive the CDN provider key from a symbols config object.
50
- * Returns null when packageManager is a local tool (npm/yarn/pnpm/bun).
51
- */
52
- export const getCdnProviderFromConfig = (symbolsConfig = {}) => {
53
- const { packageManager } = symbolsConfig
54
- return PACKAGE_MANAGER_TO_CDN[packageManager] || null
55
- }
56
-
57
- export const getCDNUrl = (
58
- packageName,
59
- version = 'latest',
60
- provider = 'esmsh'
61
- ) => {
62
- const cdnConfig = CDN_PROVIDERS[provider] || CDN_PROVIDERS.esmsh
63
- return cdnConfig.formatUrl(packageName, version)
64
- }
65
-
66
- /**
67
- * Generate an HTML <script type="importmap"> tag from project dependencies.
68
- */
69
- export const getImportMapScript = (data, defaultProvider = 'skypack') => {
70
- const dependencies = data.dependencies || {}
71
- const keys = Object.keys(dependencies)
72
- if (!keys.length) return ''
73
-
74
- const imports = {}
75
- for (const pkgName of keys) {
76
- const version = dependencies[pkgName] || 'latest'
77
- imports[pkgName] = getCDNUrl(pkgName, version, defaultProvider)
78
- }
79
-
80
- return `<script type="importmap">{
81
- "imports": ${JSON.stringify(imports, null, 2)}
82
- }</script>`
83
- }
package/component.js DELETED
@@ -1,25 +0,0 @@
1
- 'use strict'
2
-
3
- import { createExtendsFromKeys } from './extends.js'
4
- import { isString } from './types.js'
5
-
6
- export const matchesComponentNaming = key => {
7
- if (!isString(key) || !key.length) return false
8
- const code = key.charCodeAt(0)
9
- return code >= 65 && code <= 90 // A-Z
10
- }
11
-
12
- export function getCapitalCaseKeys (obj) {
13
- return Object.keys(obj).filter(key => /^[A-Z]/.test(key))
14
- }
15
-
16
- export function getSpreadChildren (obj) {
17
- return Object.keys(obj).filter(key => /^\d+$/.test(key))
18
- }
19
-
20
- export function isContextComponent (element, parent, passedKey) {
21
- const { context } = parent || {}
22
- const [extendsKey] = createExtendsFromKeys(passedKey)
23
- const key = passedKey || extendsKey
24
- return context?.components?.[key] || context?.pages?.[key]
25
- }