ajo 0.0.24 → 0.0.25
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/index.cjs +18 -19
- package/index.js +25 -25
- package/index.min.js +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -160,27 +160,11 @@ const { isArray, from } = Array, { is } = Object, noop = () => {
|
|
|
160
160
|
if (globalThis.navigator?.scheduling?.isInputPending()) {
|
|
161
161
|
idleQueue.add(host);
|
|
162
162
|
host.$idle = true;
|
|
163
|
-
idleId ??= requestIdleCallback(
|
|
164
|
-
idleId = null;
|
|
165
|
-
const queue = from(idleQueue);
|
|
166
|
-
for (const host2 of queue) {
|
|
167
|
-
idleQueue.delete(host2);
|
|
168
|
-
host2.$idle = false;
|
|
169
|
-
schedule(host2);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
163
|
+
idleId ??= requestIdleCallback(runIdle);
|
|
172
164
|
return;
|
|
173
165
|
}
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
if (host.$queued)
|
|
177
|
-
return;
|
|
178
|
-
host.$queued = true;
|
|
179
|
-
microtask(() => {
|
|
180
|
-
host.$queued = false;
|
|
181
|
-
runComponent(host);
|
|
182
|
-
});
|
|
183
|
-
}, runComponent = (host) => {
|
|
166
|
+
run(host);
|
|
167
|
+
}, run = (host) => {
|
|
184
168
|
if (host.$idle) {
|
|
185
169
|
idleQueue.delete(host);
|
|
186
170
|
host.$idle = false;
|
|
@@ -198,6 +182,21 @@ const { isArray, from } = Array, { is } = Object, noop = () => {
|
|
|
198
182
|
host.$layoutQueued = true;
|
|
199
183
|
layoutId ??= task(runLayouts);
|
|
200
184
|
}
|
|
185
|
+
}, runIdle = () => {
|
|
186
|
+
idleId = null;
|
|
187
|
+
for (const host of from(idleQueue)) {
|
|
188
|
+
idleQueue.delete(host);
|
|
189
|
+
host.$idle = false;
|
|
190
|
+
schedule(host);
|
|
191
|
+
}
|
|
192
|
+
}, runMutations = (host) => {
|
|
193
|
+
if (host.$runQueued)
|
|
194
|
+
return;
|
|
195
|
+
host.$runQueued = true;
|
|
196
|
+
microtask(() => {
|
|
197
|
+
host.$runQueued = false;
|
|
198
|
+
run(host);
|
|
199
|
+
});
|
|
201
200
|
}, runLayouts = () => {
|
|
202
201
|
layoutId = null;
|
|
203
202
|
for (const host of layoutQueue) {
|
package/index.js
CHANGED
|
@@ -200,38 +200,16 @@ const
|
|
|
200
200
|
if (host.$idle) return
|
|
201
201
|
|
|
202
202
|
if (globalThis.navigator?.scheduling?.isInputPending()) {
|
|
203
|
-
|
|
204
203
|
idleQueue.add(host)
|
|
205
204
|
host.$idle = true
|
|
206
|
-
|
|
207
|
-
idleId ??= requestIdleCallback(() => {
|
|
208
|
-
idleId = null
|
|
209
|
-
const queue = from(idleQueue)
|
|
210
|
-
for (const host of queue) {
|
|
211
|
-
idleQueue.delete(host)
|
|
212
|
-
host.$idle = false
|
|
213
|
-
schedule(host)
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
|
|
205
|
+
idleId ??= requestIdleCallback(runIdle)
|
|
217
206
|
return
|
|
218
207
|
}
|
|
219
208
|
|
|
220
|
-
|
|
209
|
+
run(host)
|
|
221
210
|
},
|
|
222
211
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (host.$queued) return
|
|
226
|
-
|
|
227
|
-
host.$queued = true
|
|
228
|
-
microtask(() => {
|
|
229
|
-
host.$queued = false
|
|
230
|
-
runComponent(host)
|
|
231
|
-
})
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
runComponent = host => {
|
|
212
|
+
run = host => {
|
|
235
213
|
|
|
236
214
|
if (host.$idle) {
|
|
237
215
|
idleQueue.delete(host)
|
|
@@ -254,6 +232,28 @@ const
|
|
|
254
232
|
}
|
|
255
233
|
},
|
|
256
234
|
|
|
235
|
+
runIdle = () => {
|
|
236
|
+
|
|
237
|
+
idleId = null
|
|
238
|
+
|
|
239
|
+
for (const host of from(idleQueue)) {
|
|
240
|
+
idleQueue.delete(host)
|
|
241
|
+
host.$idle = false
|
|
242
|
+
schedule(host)
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
runMutations = host => {
|
|
247
|
+
|
|
248
|
+
if (host.$runQueued) return
|
|
249
|
+
|
|
250
|
+
host.$runQueued = true
|
|
251
|
+
microtask(() => {
|
|
252
|
+
host.$runQueued = false
|
|
253
|
+
run(host)
|
|
254
|
+
})
|
|
255
|
+
},
|
|
256
|
+
|
|
257
257
|
runLayouts = () => {
|
|
258
258
|
|
|
259
259
|
layoutId = null
|
package/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ajo=(()=>{var x=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var
|
|
1
|
+
var ajo=(()=>{var x=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var u in t)x(e,u,{get:t[u],enumerable:!0})},J=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of W(t))!D.call(e,l)&&l!==u&&x(e,l,{get:()=>t[l],enumerable:!(n=V(t,l))||n.enumerable});return e};var K=e=>J(x({},"__esModule",{value:!0}),e);var $e={};G($e,{Fragment:()=>U,component:()=>X,h:()=>F,render:()=>N,useCallback:()=>h,useCatch:()=>Y,useEffect:()=>te,useHost:()=>p,useLayout:()=>ee,useMemo:()=>S,useReducer:()=>Q,useRef:()=>_,useState:()=>Z});const U=({children:e})=>e,F=(e,t,...u)=>{const{length:n}=u;return u=n==0?null:n==1?u[0]:u,{children:u,...t,nodeName:e}},N=(e,t,u)=>{let n=t.firstChild;for(e of b(e)){let l=n;if(e instanceof Node)l=e;else if(typeof e=="string"){for(;l&&l.nodeType!=3;)l=l.nextSibling;l?l.data!=e&&(l.data=e):l=document.createTextNode(e)}else{const{xmlns:a=u,nodeName:r,key:i,ref:o,memo:v,children:z,[T]:A,...P}=e;for(;l&&!(l.localName==r&&$(l.$key??=i,i));)l=l.nextSibling;l??=re(a,r,i),ne(o)&&(o.current=l,l.$ref=o),(v==null||w(l.$deps,l.$deps=v))&&(ie(P,l),f(A)?A(l):N(z,l,a))}l==n?n=n.nextSibling:fe(t,l,n)}for(;n;){const l=n.nextSibling;H(n),t.removeChild(n),n=l}},X=e=>({nodeName:t,as:u,props:n,key:l,ref:a,memo:r,...i})=>F(u??e?.as??"c-host",{...e?.props,...n,key:l,ref:a,memo:r,[T]:o=>{o.$fn=f(e)?e:le,o.$args={...e?.args,...i},q(o)}}),Q=(e,t)=>{const u=p(),n=g(),[l,a]=n;return l==a.length&&(a[l]=[f(t)?t():t,r=>{const i=a[l][0],o=f(r)?r(i):r;$(i,a[l][0]=f(e)?e(i,o):o)||ce(u)}]),a[n[0]++]},S=(e,t)=>{const u=g(),[n,l]=u;return(n==l.length||t==null||w(t,l[n][1]))&&(l[n]=[e(),t]),l[u[0]++][0]},Y=e=>{const t=p(),[u,n]=Q(),l=g(),[a,r]=l;return r[l[0]++]=e,t.$catch??=i=>{f(r[a])&&r[a](i),n(i)},[u,()=>n()]},p=()=>c,Z=e=>Q(null,e),_=e=>S(()=>({current:e}),[]),h=(e,t)=>S(()=>e,t),ee=(e,t)=>j(e,t,"$layout"),te=(e,t)=>j(e,t,"$effect"),{isArray:s,from:I}=Array,{is:$}=Object,le=()=>{},T=Symbol(),ne=e=>e&&typeof e=="object",f=e=>typeof e=="function",w=(e,t)=>s(e)&&s(t)?e.some((u,n)=>!$(u,t[n])):!$(e,t),ue=e=>I(e).reduce(ae,{}),ae=(e,{name:t,value:u})=>(e[t]=u,e),C=globalThis.queueMicrotask??(e=>e()),E=globalThis.requestAnimationFrame??C,re=(e,t,u)=>{const n=e?document.createElementNS(e,t):document.createElement(t);return n.$key=u,n},b=function*(e,t={data:""},u=!0){let n;for(e of s(e)?e:[e])e==null||typeof e=="boolean"||(typeof e.nodeName=="string"?((n=t.data)&&(t.data="",yield n),yield e):f(e.nodeName)?yield*b(e.nodeName(e),t,!1):s(e)?yield*b(e,t,!1):t.data+=e);u&&(n=t.data)&&(yield n)},ie=(e,t)=>{const u=t.$props??=t.hasAttributes()?ue(t.attributes):{};for(const n in{...u,...t.$props=e}){let l=e[n];l!==u[n]&&(n.startsWith("set:")?t[n.slice(4)]=l:l==null||l===!1?t.removeAttribute(n):t.setAttribute(n,l===!0?"":l))}},fe=(e,t,u)=>{if(t.contains?.(document.activeElement)){const n=t.nextSibling;for(;u&&u!=t;){const l=u.nextSibling;e.insertBefore(u,n),u=l}}else e.insertBefore(t,u)},g=()=>c.$hooks??=[0,[]],j=(e,t,u)=>{const n=p(),l=g(),[a,r]=l;a==r.length?(n[u]??=new Set).add(r[a]=[null,e,t]):(t==null||w(t,r[a][2]))&&(r[a][1]=e,r[a][2]=t),l[0]++},q=e=>{if(!e.$idle){if(globalThis.navigator?.scheduling?.isInputPending()){d.add(e),e.$idle=!0,R??=requestIdleCallback(oe);return}M(e)}},M=e=>{e.$idle&&(d.delete(e),e.$idle=!1),c=e,c.$hooks&&(c.$hooks[0]=0);try{e.$h=e.$fn(e.$args)}catch(t){k(t,e.parentNode)}finally{c=null,y.add(e),e.$layoutQueued=!0,L??=E(de)}},oe=()=>{R=null;for(const e of I(d))d.delete(e),e.$idle=!1,q(e)},ce=e=>{e.$runQueued||(e.$runQueued=!0,C(()=>{e.$runQueued=!1,M(e)}))},de=()=>{L=null;for(const e of y){y.delete(e),e.$layoutQueued=!1;try{N(e.$h,e),e.$h=null}catch(t){k(t,e)}finally{B(e,"$layout"),m.add(e),e.$effectQueued=!0,O??=E(se)}}},se=()=>{O=null;for(const e of m)m.delete(e),e.$effectQueued=!1,B(e,"$effect")},B=(e,t)=>{if(e[t])for(const u of e[t]){const[n,l]=u;if(f(l))try{f(n)&&n(),u[0]=l()}catch(a){u[0]=null,k(a,e.parentNode)}finally{u[1]=null}}},H=e=>{if(e.nodeType==1){for(const t of e.children)H(t);if(e.$ref&&(e.$ref.current=null),!!e.$fn){e.$idle&&(d.delete(e),e.$idle=!1),e.$layoutQueued&&(y.delete(e),e.$layoutQueued=!1),e.$effectQueued&&(m.delete(e),e.$effectQueued=!1);for(const t of["$layout","$effect"])if(e[t])for(const u of e[t]){e[t].delete(u);try{const[n]=u;f(n)&&n()}catch(n){k(n,e.parentNode)}finally{u[0]=u[1]=null}}}}},k=(e,t)=>{for(let u;t;t=t.parentNode)if(f(u=t.$catch))return void u(e);throw e};let c=null,y=new Set,m=new Set,d=new Set,L=null,O=null,R=null;return K($e);})();
|