@symbo.ls/element 3.14.804 → 3.14.806
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 +32 -0
- package/README.md +197 -0
- package/dist/cjs/src/cache.js +1 -1
- package/dist/cjs/src/connected.js +1 -0
- package/dist/cjs/src/core.js +6 -0
- package/dist/cjs/src/create.js +1 -6
- package/dist/cjs/src/cssLonghands.js +1 -1
- package/dist/cjs/src/delegate.js +1 -1
- package/dist/cjs/src/dispose.js +1 -1
- package/dist/cjs/src/extends.js +1 -1
- package/dist/cjs/src/features.js +1 -0
- package/dist/cjs/src/handlerChain.js +1 -0
- package/dist/cjs/src/hydration.js +1 -0
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/src/install.js +1 -0
- package/dist/cjs/src/lean.js +1 -0
- package/dist/cjs/src/methods.js +1 -1
- package/dist/cjs/src/mountRecord.js +1 -0
- package/dist/cjs/src/mountScheduler.js +1 -1
- package/dist/cjs/src/mountYield.js +1 -0
- package/dist/cjs/src/plainRows.js +1 -0
- package/dist/cjs/src/update.js +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/cjs/src/viewEvents.js +1 -0
- package/dist/esm/src/cache.js +1 -1
- package/dist/esm/src/connected.js +1 -0
- package/dist/esm/src/core.js +6 -0
- package/dist/esm/src/create.js +1 -6
- package/dist/esm/src/cssLonghands.js +1 -1
- package/dist/esm/src/delegate.js +1 -1
- package/dist/esm/src/dispose.js +1 -1
- package/dist/esm/src/extends.js +1 -1
- package/dist/esm/src/features.js +1 -0
- package/dist/esm/src/handlerChain.js +1 -0
- package/dist/esm/src/hydration.js +1 -0
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/install.js +1 -0
- package/dist/esm/src/lean.js +1 -0
- package/dist/esm/src/methods.js +1 -1
- package/dist/esm/src/mountRecord.js +1 -0
- package/dist/esm/src/mountScheduler.js +1 -1
- package/dist/esm/src/mountYield.js +1 -0
- package/dist/esm/src/plainRows.js +1 -0
- package/dist/esm/src/update.js +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/esm/src/viewEvents.js +1 -0
- package/package.json +6 -6
package/dist/esm/src/methods.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{update as k}from"./update.js";import{remove as m}from"./dispose.js";import{isLoudDevRuntime as f}from"./devRuntime.js";import"css-in-props";import{getDB as
|
|
1
|
+
import{update as k}from"./update.js";import{remove as m}from"./dispose.js";import{whenConnected as S}from"./connected.js";import{isLoudDevRuntime as f}from"./devRuntime.js";import"css-in-props";import{getDB as x,getQuery as C,getRootData as R,getRootState as b,getRoot as v,getRootContext as P,getContext as O,getPath as D,nextElement as E,previousElement as $,verbose as A,warn as j,error as W,variables as L,spotByPath as M}from"@symbo.ls/utils";import*as c from"@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})}const _=new Set;function d(t,e,o){const n=String(e);if(_.has(n))return;_.add(n);const r=t?.__ref?.path,i=Array.isArray(r)&&r.length?r.join("."):t?.key!=null?String(t.key):"(unknown element)",w=o!=null?`resolves to a non-function (${typeof o}) \u2014 it cannot be called`:"is not registered in context.methods, context.functions, or context.utils, and is not an element method",h=`[smbls] el.call('${n}') at <${i}>: "${n}" ${w}. Returning undefined (unchanged behavior) \u2014 check the name for typos or register the function on the project. Warned once per name; repeat misses are silent.`;l(t,"error",[h]),console.error(h)}const p=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),T=new Set,g=t=>p(s,t)&&!(c.ELEMENT_METHOD_OVERRIDE_POINTS||T).has(t),u=new Set,Y=()=>{u.clear()};function y(t,e){u.has(t)||(u.add(t),f()&&console.warn(`[smbls] ${e}: context.methods.${t} is named like a built-in element method and is not the app's own override (it was not on the element prototype when it was built) \u2014 ignored; the built-in keeps winning. Declare an intentional override in the app's OWN methods.`))}function B(...t){return l(this,"warn",t),j.apply(this,t)}function F(...t){return l(this,"error",t),W.apply(this,t)}const s={update:k,remove:m,getDB:x,getQuery:C,getRootData:R,getPath:D,nextElement:E,previousElement:$,verbose:A,warn:B,error:F,variables:L,spotByPath:M,set(t,e,o){const n=this.__ref;if(n){if(n.__setLocked){n.__setQueued={content:t,options:e};return}n.__setLocked=!0}let r;try{if(this.removeContent(),t!=null){const i=this.context?.__create;i&&(r=i(t,this,"content",e,o))}this.__ref&&(this.__ref.contentManaged=!0)}finally{if(n){n.__setLocked=!1;const i=n.__setQueued;i&&(n.__setQueued=null,this.set(i.content,i.options))}}return r},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},whenConnected(t){return S(this,t)},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(t){return t?this.__ref&&this.__ref[t]:this.__ref},getChildren(){const t=this.__ref&&this.__ref.__children;return Array.isArray(t)?t.map(e=>this[e]):[]},getRoot:v,getRootState:b,getRootContext:P,getContext:O,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=g(t);n&&o?.methods?.[t]&&o.methods[t]!==this[t]&&y(t,"el.call");const r=n?this[t]:o?.methods?.[t]||o?.functions?.[t]||o?.utils?.[t]||this[t];if(typeof r=="function"){const i=c.isFailedRevival;if(!i||!i(r))return r.call(this,...e);f()&&d(this,t,c.getFunctionSource(r));return}f()&&d(this,t,r)},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)}},a=new WeakMap;function I(t){if(!t)return s;let e=a.get(t);if(e)return e;e=Object.create(s);const o=t.methods;if(o)for(const n in o)e[n]=o[n];return a.set(t,e),e}function Z(t){const e=I(t.context);Object.setPrototypeOf(t,e)}function J(t){if(!t)return!1;const e=a.get(t);if(!e)return!1;const o=t.methods;if(!o)return!1;for(const n in o){if(g(n)&&!p(e,n)){y(n,"refreshContextProto");continue}e[n]=o[n]}return!0}export{Y as __resetFoldShadowWarnings,Z as addMethods,s as elementProto,J as refreshContextProto};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(n){return n.__mount||(n.__mount={pending:0,tail:null,holder:null,waiters:null,chunkGen:0,attachLater:!1,held:!1})}function u(n){const t=n.__mount;return t?t.pending:0}export{u as mountPendingOf,e as mountRecord};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{mountRecord as D}from"./mountRecord.js";const _=50;function U(e){return e===!0?_:typeof e=="number"&&e>0?e:0}const r=[];let f=!1,u=0,i=_,a=!1,M=[];const d=typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now(),x=[];let h=null;function E(e){if(!h){const t=new MessageChannel;t.port1.onmessage=()=>{const n=x.shift();!x.length&&typeof t.port1.unref=="function"&&t.port1.unref(),n&&n()},h=t}x.push(e),x.length===1&&typeof h.port1.ref=="function"&&h.port1.ref(),h.port2.postMessage(0)}function w(e){const t=typeof globalThis<"u"?globalThis.scheduler:null;if(t&&typeof t.yield=="function"){t.yield().then(e,e);return}if(typeof setImmediate=="function"){setImmediate(e);return}if(typeof MessageChannel=="function"){E(e);return}setTimeout(e,0)}function Y(){return new Promise(e=>w(e))}function A(e=0,t){return!u||(t||d())-u+e<i?!1:(a=!0,!0)}let g=0,y=0,k=0,p=0;function T(){g=0,y=u,k=0,p=0}function G(){if(!u)return!1;if(g++,p>0)return p--,!1;const e=d(),t=e-u,n=t/g,o=(e-y)/(g-k),c=o>n?o:n;y=e,k=g;const P=i-t-c;return P<=0?(a=!0,!0):(p=c>0?Math.floor(P/c/2):0,!1)}let s=0;function L(e=_){s===0&&!u?(u=d(),a=!1,i=e,T()):e<i&&(i=e,p=0),s++}let l=null,I=!1;const Q=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function m(){u=0,a=!1,i=_,T()}function R(){I||(I=!0,Q(()=>{I=!1,s===0&&m()}))}function N(){s>0&&s--,!(s!==0||l!==null)&&(f?R():m())}function O(e,t=_){const n={fn:e,budget:t};l?l.push(n):r.push(n),f||(f=!0,w(B))}function q(e){const t=l;l=[];try{e.fn()}catch(n){typeof console<"u"&&console.error&&console.error("[smbls] deferred mount chunk failed:",n?.message||n)}finally{const n=l;l=t,n.length&&r.unshift(...n)}}function j(){return!f&&!r.length?Promise.resolve():new Promise(e=>M.push(e))}function v(){return!f&&!r.length}function b(){if(!M.length)return;const e=M;M=[];for(let t=0;t<e.length;t++)e[t]()}function B(){for(u=d(),a=!1,i=1/0,T();r.length;){const e=r.shift();if(e.budget<i&&(i=e.budget,p=0),q(e),a||d()-u>=i)break}if(s=0,m(),r.length){w(B);return}f=!1,b()}function z(){let t=0;for(u=0;r.length&&t++<1e5;)q(r.shift());f=!1,s=0,m(),b()}function F(){return r.length}function H(){r.length=0,l=null,f=!1,s=0,m(),b()}function J(e){D(e.__ref).pending++}function C(e){const t=e&&e.__ref,n=t&&t.__mount;if(!n||!(n.pending>0)||--n.pending>0||t.__disposed)return;const o=n.tail;o&&(n.tail=null,o())}function K(e){const t=e&&e.__ref&&e.__ref.__mount;return!!(t&&t.tail)}function V(e){const t=e&&e.__ref&&e.__ref.__mount;return!t||!t.tail?Promise.resolve(e):new Promise(n=>{(t.waiters||(t.waiters=[])).push(n)})}function S(e,t=e&&e.__ref){const n=t&&t.__mount,o=n&&n.waiters;if(o){n.waiters=null;for(let c=0;c<o.length;c++)o[c](e)}}function X(e,t=e&&e.__ref){const n=t&&t.__mount;if(!n||!n.tail)return;n.tail=null,n.pending=0;const o=n.holder;n.holder=null,S(e,t),o&&C(o)}export{_ as MOUNT_YIELD_BUDGET_MS,z as __flushMountQueueSync,F as __pendingMountChunks,H as __resetMountQueue,X as abandonMount,N as closeMountBudget,O as enqueueMountWork,J as holdMount,A as mountBudgetExhausted,v as mountIdle,K as mountPending,G as mountTick,U as mountYieldBudget,L as openMountBudget,C as releaseMount,C as settleMount,S as settleMountWaiters,j as whenMountIdle,V as whenMounted,Y as yieldToMain};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mountTick as R,mountYieldBudget as p,openMountBudget as k,closeMountBudget as x,enqueueMountWork as y,holdMount as h,settleMount as _,settleMountWaiters as B,abandonMount as E}from"./mountScheduler.js";import{reportCreateChildrenError as g,completeCreate as b,syncSelectValue as A,placedRowNode as N,rowAttach as O,attachWhole as W}from"./core.js";import{mountRecord as Y}from"./mountRecord.js";import{FEATURES as C}from"./features.js";function F(n,t){const r=t&&t.mountYield;if(!r&&!n.yieldChildren)return 0;const o=C.hydration!==null&&n.context?n.context.__hydration:null;if(o&&C.hydration.whole(o,n))return 0;const e=r?p(r):0,u=p(n.yieldChildren);return e&&u?e<u?e:u:e||u}function w(n,t,r,o,e){k(o);try{S(n,n.__ref,0,t,r,o,e,!1)}finally{x()}}function S(n,t,r,o,e,u,f,c){try{for(let i=r;i<o;i++){const s=t.__mount,l=s?s.pending:0;if(e(i)===!1)continue;if(t.__disposed)break;const d=R(),a=t.__mount;if(i+1<o&&(d||(a?a.pending:0)>l)){f&&f.onSuspend&&f.onSuspend(),c||h(n);const m=i+1;y(()=>G(n,t,m,o,e,u,f),u);return}}}catch(i){if(!c)throw i;g(n,i)}c&&_(n)}function G(n,t,r,o,e,u,f){if(t.__disposed||f&&f.isStale&&f.isStale()){_(n);return}S(n,t,r,o,e,u,f,!0)}function T(n,t,r){h(n),y(()=>{try{const o=n.__ref;o&&!o.__disposed&&r()}catch(o){g(n,o)}finally{_(n)}},t)}function q(n,t,r,o){const e=n.__ref,u=Y(e),f=++u.chunkGen,c=n.node,i=[];let s=!1;w(n,t,l=>{const d=r(l,s?O(n,D(c,i)):void 0),a=M(d);return a?i.push(a):d&&d.__ref.__mount&&d.__ref.__mount.held&&i.push(d),d},o,{isStale:()=>u.chunkGen!==f,onSuspend:()=>{s=!0}})}function M(n){const t=N(n);if(t)return t;const r=n&&n.__ref;return r&&r.__if!==!1&&n.tag==="fragment"&&r.__fragmentAnchor||null}function D(n,t){for(let r=t.length-1;r>=0;r--){const o=t[r].__ref?M(t[r]):t[r];if(o&&o.parentNode===n)return o}return null}function I(n,t){const r=n.__ref;try{A(n,!0),W(n),b(n,t)}finally{B(n,r);const o=r.__mount,e=o&&o.holder;e&&(o.holder=null,_(e))}}const v={budgetOf:F,run:w,rows:q,defer:T,hold:h,finish:I,abandon:E};export{v as mountYieldFeature};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isStore as J,getObserver as m}from"@symbo.ls/signal";import{untrack as V}from"./runContext.js";import{deepMergeChild as Q}from"./extends.js";import{create as X,arrayRowDefinition as Y,runtimeViewOf as Z,markRuntimeSupplied as v,placedRowNode as z,placeAfter as ee,rowAttach as te,placeRows as re,triggerContentUpdate as oe}from"./core.js";const p=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),I=1e3,K=24,b=Object.freeze({}),E=Object.freeze({});let a=0;const g=e=>{if(J(e)||p(e,"__ref"))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null};function j(e,t,i){if(e===null||typeof e!="object")return e;if(--a<0||t>K){a=-1;return}if(Array.isArray(e)){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=i?e[n]:j(e[n],t+1,!1);return r}if(i||!g(e))return e;const c={};for(const r in e)p(e,r)&&(c[r]=j(e[r],t+1,r==="extends"||r==="childExtends"));return c}function L(e){a=I;let t;try{t=j(e,0,!1)}catch{return b}return a<0?b:t}function x(e,t,i,c){if(e===t)return!0;if(e===null||typeof e!="object"||t===null||typeof t!="object"||--a<0||i>K)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||t.length!==e.length)return!1;for(let n=0;n<e.length;n++)if(c?e[n]!==t[n]:!x(e[n],t[n],i+1,!1))return!1;return!0}if(c||Array.isArray(t)||!g(e)||!g(t))return!1;let r=0;for(const n in e)if(p(e,n)&&(r++,!p(t,n)||!x(e[n],t[n],i+1,n==="extends"||n==="childExtends")))return!1;for(const n in t)p(t,n)&&r--;return r===0}function U(e,t){if(t===b||t===E)return!1;a=I;try{return x(e,t,0,!1)}catch{return!1}}const A=e=>m()?V(()=>L(e)):L(e),$=(e,t)=>m()?V(()=>U(e,t)):U(e,t);function B(e,t,i,c){let r=e;return r&&typeof r=="object"&&!Array.isArray(r)&&!g(r)&&(c||i&&!r.ignoreChildExtends)&&(r=c?Q({},r):{...r}),typeof t=="function"?{item:r,props:c}:r}const C=e=>({childProps:typeof e.childProps=="function"?void 0:e.childProps,childExtends:e.childExtends});class F{constructor(t,i){this.shared=t,this.rows=i}add(t,i,c,r,n){this.rows.set(t,A(B(i,r,n,c.props)))}failed(t){this.rows.set(t,E)}none(t){this.rows.delete(t)}}const ne=Object.freeze([]);function se(e,t,i,c,r){const n=t.__plainRows.rows,M=t.__plainRows.shared,D=C(e),T=$(D,M),N=e.childProps,G=Z(e,"childProps"),W=e.childExtends,d=new Array(i.length),O=new Map;for(let s=0;s<i.length;s++){const o=Y(e,i[s],s,N,G,W,!1,!0);if(O.has(o.key))return!1;O.set(o.key,o),d[s]=o}for(let s=0;s<d.length;s++){const o=d[s];o.input=B(i[s],N,W,o.props);const f=T?n.get(o.key):void 0;if(f===void 0)continue;const u=e[o.key];u&&u.__ref&&u.parent===e&&$(o.input,f)&&(o.kept=!0,o.snap=f)}const y=r?[]:null;for(const s of n.keys()){const o=O.get(s);if(o&&o.kept)continue;const f=e[s];f?.remove&&f.remove(),delete e[s],y&&y.push(s)}const w=r?[]:null,S=r?[]:null,l=new Map;let k=null,_=null;for(let s=0;s<d.length;s++){const o=d[s];if(o.kept){l.set(o.key,o.snap),S&&S.push(o.key);const h=z(e[o.key]);h&&(_=ee(e,h,_));continue}l.set(o.key,A(o.input));let f;try{f=X(v(o.def,o.supplied),e,o.key,c,te(e,_))}catch(h){if(l.set(o.key,E),k||(k=new Set),k.add(o.key),typeof console<"u"&&console.error){const q=t.path?.join(".")||e.key||"<root>";console.error(`[smbls] child "${o.key}" failed to construct at ${q} (re-run, skipping this row):`,h?.message||h)}continue}if(t.__disposed)return!0;if(!f){l.delete(o.key);continue}const u=z(f);u&&(_=u),w&&w.push(o.key)}t.__plainRows=new F(T?M:A(D),l);const R=Array.from(l.keys());re(e,R,k);const H=new Set(t.__children),P=[];for(let s=0;s<R.length;s++)H.has(R[s])&&P.push(R[s]);for(const s of t.__children)l.has(s)||P.push(s);return t.__children=P,r&&(w.length||y.length)&&oe(e,{added:w,removed:y,kept:S}),!0}const ue={track:e=>new F(A(C(e)),new Map),reconcile(e,t,i,c,r){const n=Array.isArray(i)?i:i==null||i===!1?ne:null;return!!n&&se(e,t,n,c,r)}};export{ue as plainRows};
|
package/dist/esm/src/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{batch as h,isStore as _}from"@symbo.ls/signal";import{REGISTRY as v}from"./registry.js";import{create as x,resolveStyleBlock as p,acquireBeforeUpdateGuard as b,releaseBeforeUpdateGuard as l,writeElementText as g,reconcileAttrProp as P,writeAttr as A,isStaticCssProp as U,recompileStaticCss as j}from"./
|
|
1
|
+
import{batch as h,isStore as _}from"@symbo.ls/signal";import{REGISTRY as v}from"./registry.js";import{create as x,resolveStyleBlock as p,acquireBeforeUpdateGuard as b,releaseBeforeUpdateGuard as l,writeElementText as g,reconcileAttrProp as P,writeAttr as A,isStaticCssProp as U,recompileStaticCss as j}from"./core.js";import{dispatchPluginHook as u}from"./pluginHooks.js";import{cssPropName as B}from"./cssLonghands.js";function S(o={},f={}){const t=this,i=t.__ref;if(!i)return;if((typeof o=="string"||typeof o=="number")&&(o={text:o}),!f.preventListeners&&typeof t.onBeforeUpdate=="function"&&b(i))try{const e=t.onBeforeUpdate(t,t.state,t.context,f);if(e&&typeof e.then=="function")e.then(()=>l(i,!1),n=>{l(i,!0),u("error",t,{hook:"onBeforeUpdate",error:n})||console.error("[DOMQL] onBeforeUpdate error:",n)});else if(l(i,!1),e===!1)return t}catch(e){throw l(i,!0),e}const a=!o||Object.keys(o).length===0,c=[];let d=!1;h(()=>{if(o.state&&_(t.state)&&t.state.$update(o.state),o.text!==void 0&&(t.text=o.text,!i.__exec.text&&t.node&&g(t,o.text??"")),o.html!==void 0&&(t.html=o.html,!i.__exec.html&&t.node&&(t.node.innerHTML=o.html)),o.style&&t.node?.style){if(!i.__exec.style){const e=p(t,o.style);for(const n in e){const r=e[n];if(r==null)continue;const s=B(n),y=String(r).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,y,"important")}}t.style||(t.style={}),Object.assign(t.style,o.style)}if(o.attr&&t.node?.setAttribute){for(const e in o.attr){const n=o.attr[e];A(t.node,e,n)}t.attr||(t.attr={}),Object.assign(t.attr,o.attr)}if(o.data&&t.node?.dataset){for(const e in o.data)t.node.dataset[e]=o.data[e];t.data||(t.data={}),Object.assign(t.data,o.data)}if(o.vars&&typeof o.vars=="object"&&!Array.isArray(o.vars)){const e=t.vars&&typeof t.vars=="object"&&!Array.isArray(t.vars)?t.vars:null;t.vars={...e,...o.vars},d=!0}for(const e in o){if(v.has(e)||e==="state")continue;const n=o[e],r=t[e];if(r&&r.__ref&&typeof r.update=="function")r.update(n,f);else if(typeof n=="object"&&n!==null){const s=e.charCodeAt(0);s>=65&&s<=90&&x(n,t,e,f)}else e!=="text"&&e!=="html"&&e!=="style"&&e!=="attr"&&e!=="data"&&(t[e]=n,typeof n!="function"&&c.push(e))}});for(let e=0;e<c.length;e++)P(t,c[e]);if(t.node){let e=d;for(let n=0;!e&&n<c.length;n++)U(c[n])&&(e=!0);e&&j(t)}if(t.node&&a&&i.__effects&&i.__effects.length)for(let e=0;e<i.__effects.length;e++){const n=i.__effects[e];n&&!n._disposed&&!n._isSubscribeToEffect&&typeof n._execute=="function"&&n._execute()}else if(t.node&&i.__conditionalRunners)for(const e of i.__conditionalRunners)e();return u("update",t),!f.preventListeners&&typeof t.onUpdate=="function"&&t.onUpdate(t,t.state,t.context,f),t}var L=S;export{L as default,S as update};
|
package/dist/esm/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="3.14.
|
|
1
|
+
const o="3.14.806";export{o as VERSION};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{wrapEventHandler as w,stringHandler as y}from"./delegate.js";import{handlerEntries as b}from"./handlerChain.js";const V=1e-6,g=new WeakMap;function _(e,t,r){const o=e.defaultView,c=o&&o.IntersectionObserver;if(typeof c!="function")return null;let s=g.get(e);s||g.set(e,s=new Map);const n=t+"|"+r;let i=s.get(n);if(i)return i;i={id:n,byKey:s,threshold:t,targets:new Map,observer:null};try{const f=r?{threshold:t,rootMargin:r}:{threshold:t};i.observer=new c(u=>I(i,u),f)}catch{return null}return s.set(n,i),i}function I(e,t){for(let r=0;r<t.length;r++){const o=t[r],c=e.targets.get(o.target);if(!c)continue;const s=!!o.isIntersecting&&o.intersectionRatio>=e.threshold-V;if(s===c.inView)continue;c.inView=s;const n=s?"in":"leave",i=c.subs.slice();for(let f=0;f<i.length;f++){const u=i[f];if(!(u.kind!==n||u.dead)){u.once&&v(e,c,u);try{u.run(o)}catch(a){E(a)}}}}}function E(e){typeof globalThis.reportError=="function"?globalThis.reportError(e):queueMicrotask(()=>{throw e})}function v(e,t,r){if(r.dead)return;r.dead=!0;const o=t.subs.indexOf(r);o!==-1&&t.subs.splice(o,1),!t.subs.length&&(e.targets.delete(t.node),e.observer.unobserve(t.node),!e.targets.size&&(e.observer.disconnect(),e.byKey.delete(e.id)))}function h(e,t,r,o,c){const s=y(e,c.handler),n=c.options;if(typeof s!="function")return;const i=n&&n.threshold,f=typeof i=="number"&&i>=0&&i<=1?i:0,u=n&&typeof n.rootMargin=="string"?n.rootMargin.trim():"",a=_(r,f,u);if(!a)return;let l=a.targets.get(t);l||(l={node:t,inView:!1,subs:[]},a.targets.set(t,l),a.observer.observe(t));const d={kind:o,once:!!(n&&n.once===!0),run:w(e,s),dead:!1};l.subs.push(d);const p=e.__ref;p.__eventCleanup||(p.__eventCleanup=[]),p.__eventCleanup.push(()=>v(a,l,d))}function k(e){const t=e.node;if(!t||t.nodeType!==1)return;const r=t.ownerDocument,o=r&&r.defaultView;if(!o||typeof o.IntersectionObserver!="function")return;const c=b(e.onInView);for(let n=0;n<c.length;n++)h(e,t,r,"in",c[n]);const s=b(e.onLeaveView);for(let n=0;n<s.length;n++)h(e,t,r,"leave",s[n])}export{k as registerViewEvents};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/element",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.806",
|
|
4
4
|
"description": "Core element creation, update, and disposal engine for smbls v3.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@symbo.ls/css": "^3.14.
|
|
24
|
-
"@symbo.ls/scratch": "^3.14.
|
|
25
|
-
"@symbo.ls/signal": "^3.14.
|
|
23
|
+
"@symbo.ls/css": "^3.14.780",
|
|
24
|
+
"@symbo.ls/scratch": "^3.14.790",
|
|
25
|
+
"@symbo.ls/signal": "^3.14.789",
|
|
26
26
|
"@symbo.ls/state": "^3.14.681",
|
|
27
|
-
"@symbo.ls/utils": "^3.14.
|
|
28
|
-
"css-in-props": "^3.14.
|
|
27
|
+
"@symbo.ls/utils": "^3.14.789",
|
|
28
|
+
"css-in-props": "^3.14.763",
|
|
29
29
|
"attrs-in-props": "^3.14.696"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|