ajo 0.0.22 → 0.0.24

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 CHANGED
@@ -48,14 +48,14 @@ const Fragment = ({ children }) => children, h = (nodeName, props, ...children)
48
48
  node ? node.data != h2 && (node.data = h2) : node = document.createTextNode(h2);
49
49
  } else {
50
50
  const { xmlns = ns, nodeName, key, ref, memo, children, [FN]: fn, ...props } = h2;
51
- while (node && !(node.localName == nodeName && (node.$key ??= key) == key))
51
+ while (node && !(node.localName == nodeName && is(node.$key ??= key, key)))
52
52
  node = node.nextSibling;
53
53
  node ??= create(xmlns, nodeName, key);
54
54
  if (isObject(ref)) {
55
55
  ref.current = node;
56
56
  node.$ref = ref;
57
57
  }
58
- if (memo == null || some(node.$memo, node.$memo = memo)) {
58
+ if (memo == null || some(node.$deps, node.$deps = memo)) {
59
59
  update(props, node);
60
60
  isFunction(fn) ? fn(node) : render(children, node, xmlns);
61
61
  }
@@ -64,7 +64,8 @@ const Fragment = ({ children }) => children, h = (nodeName, props, ...children)
64
64
  }
65
65
  while (child) {
66
66
  const next = child.nextSibling;
67
- dispose(host.removeChild(child));
67
+ dispose(child);
68
+ host.removeChild(child);
68
69
  child = next;
69
70
  }
70
71
  }, component = (fn) => ({ nodeName, as, props, key, ref, memo, ...args }) => h(as ?? fn?.as ?? "c-host", {
@@ -105,8 +106,8 @@ const Fragment = ({ children }) => children, h = (nodeName, props, ...children)
105
106
  };
106
107
  return [value, () => setValue()];
107
108
  }, useHost = () => current, useState = (init) => useReducer(null, init), useRef = (current2) => useMemo(() => ({ current: current2 }), []), useCallback = (fn, deps) => useMemo(() => fn, deps), useLayout = (fn, deps) => useFx(fn, deps, "$layout"), useEffect = (fn, deps) => useFx(fn, deps, "$effect");
108
- const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis.requestAnimationFrame ?? microtask, { isArray, from } = Array, { is } = Object, noop = () => {
109
- }, FN = Symbol(), isObject = (v) => v && typeof v == "object", isFunction = (v) => typeof v == "function", some = (a, b) => isArray(a) && isArray(b) ? a.some((v, i) => !is(v, b[i])) : !is(a, b), reduce = (v) => from(v).reduce(assign, {}), assign = (v, { name, value }) => (v[name] = value, v), create = (ns, name, key) => {
109
+ const { isArray, from } = Array, { is } = Object, noop = () => {
110
+ }, FN = Symbol(), isObject = (v) => v && typeof v == "object", isFunction = (v) => typeof v == "function", some = (a, b) => isArray(a) && isArray(b) ? a.some((v, i) => !is(v, b[i])) : !is(a, b), reduce = (v) => from(v).reduce(assign, {}), assign = (v, { name, value }) => (v[name] = value, v), microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis.requestAnimationFrame ?? microtask, create = (ns, name, key) => {
110
111
  const node = ns ? document.createElementNS(ns, name) : document.createElement(name);
111
112
  return node.$key = key, node;
112
113
  }, normalize = function* (h2, buffer = { data: "" }, root = true) {
@@ -157,9 +158,16 @@ const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis
157
158
  if (host.$idle)
158
159
  return;
159
160
  if (globalThis.navigator?.scheduling?.isInputPending()) {
160
- host.$idle = requestIdleCallback(() => {
161
- host.$idle = null;
162
- schedule(host);
161
+ idleQueue.add(host);
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
+ }
163
171
  });
164
172
  return;
165
173
  }
@@ -174,8 +182,8 @@ const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis
174
182
  });
175
183
  }, runComponent = (host) => {
176
184
  if (host.$idle) {
177
- cancelIdleCallback(host.$idle);
178
- host.$idle = null;
185
+ idleQueue.delete(host);
186
+ host.$idle = false;
179
187
  }
180
188
  current = host;
181
189
  if (current.$hooks)
@@ -186,13 +194,15 @@ const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis
186
194
  propagate(value, host.parentNode);
187
195
  } finally {
188
196
  current = null;
189
- layoutsQueue.add(host);
190
- layoutsId ??= task(runLayouts);
197
+ layoutQueue.add(host);
198
+ host.$layoutQueued = true;
199
+ layoutId ??= task(runLayouts);
191
200
  }
192
201
  }, runLayouts = () => {
193
- layoutsId = null;
194
- for (const host of layoutsQueue) {
195
- layoutsQueue.delete(host);
202
+ layoutId = null;
203
+ for (const host of layoutQueue) {
204
+ layoutQueue.delete(host);
205
+ host.$layoutQueued = false;
196
206
  try {
197
207
  render(host.$h, host);
198
208
  host.$h = null;
@@ -200,14 +210,16 @@ const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis
200
210
  propagate(value, host);
201
211
  } finally {
202
212
  runFx(host, "$layout");
203
- effectsQueue.add(host);
204
- effectsId ??= task(runEffects);
213
+ effectQueue.add(host);
214
+ host.$effectQueued = true;
215
+ effectId ??= task(runEffects);
205
216
  }
206
217
  }
207
218
  }, runEffects = () => {
208
- effectsId = null;
209
- for (const host of effectsQueue) {
210
- effectsQueue.delete(host);
219
+ effectId = null;
220
+ for (const host of effectQueue) {
221
+ effectQueue.delete(host);
222
+ host.$effectQueued = false;
211
223
  runFx(host, "$effect");
212
224
  }
213
225
  }, runFx = (host, key) => {
@@ -234,16 +246,33 @@ const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis
234
246
  dispose(child);
235
247
  if (host.$ref)
236
248
  host.$ref.current = null;
237
- layoutsQueue.delete(host);
238
- effectsQueue.delete(host);
249
+ if (!host.$fn)
250
+ return;
251
+ if (host.$idle) {
252
+ idleQueue.delete(host);
253
+ host.$idle = false;
254
+ }
255
+ if (host.$layoutQueued) {
256
+ layoutQueue.delete(host);
257
+ host.$layoutQueued = false;
258
+ }
259
+ if (host.$effectQueued) {
260
+ effectQueue.delete(host);
261
+ host.$effectQueued = false;
262
+ }
239
263
  for (const key of ["$layout", "$effect"])
240
264
  if (host[key]) {
241
- for (const fx of host[key])
265
+ for (const fx of host[key]) {
266
+ host[key].delete(fx);
242
267
  try {
243
- isFunction(fx[0]) && fx[0]();
244
- } catch {
268
+ const [cleanup] = fx;
269
+ isFunction(cleanup) && cleanup();
270
+ } catch (value) {
271
+ propagate(value, host.parentNode);
272
+ } finally {
273
+ fx[0] = fx[1] = null;
245
274
  }
246
- host[key].clear();
275
+ }
247
276
  }
248
277
  }, propagate = (value, host) => {
249
278
  for (let fn; host; host = host.parentNode)
@@ -251,4 +280,4 @@ const microtask = globalThis.queueMicrotask ?? ((fn) => fn()), task = globalThis
251
280
  return void fn(value);
252
281
  throw value;
253
282
  };
254
- let current = null, layoutsQueue = /* @__PURE__ */ new Set(), layoutsId = null, effectsQueue = /* @__PURE__ */ new Set(), effectsId = null;
283
+ let current = null, layoutQueue = /* @__PURE__ */ new Set(), effectQueue = /* @__PURE__ */ new Set(), idleQueue = /* @__PURE__ */ new Set(), layoutId = null, effectId = null, idleId = null;
package/index.js CHANGED
@@ -27,7 +27,7 @@ export const
27
27
 
28
28
  const { xmlns = ns, nodeName, key, ref, memo, children, [FN]: fn, ...props } = h
29
29
 
30
- while (node && !(node.localName == nodeName && (node.$key ??= key) == key)) node = node.nextSibling
30
+ while (node && !(node.localName == nodeName && is(node.$key ??= key, key))) node = node.nextSibling
31
31
  node ??= create(xmlns, nodeName, key)
32
32
 
33
33
  if (isObject(ref)) {
@@ -35,7 +35,7 @@ export const
35
35
  node.$ref = ref
36
36
  }
37
37
 
38
- if (memo == null || some(node.$memo, node.$memo = memo)) {
38
+ if (memo == null || some(node.$deps, node.$deps = memo)) {
39
39
  update(props, node)
40
40
  isFunction(fn) ? fn(node) : render(children, node, xmlns)
41
41
  }
@@ -46,7 +46,8 @@ export const
46
46
 
47
47
  while (child) {
48
48
  const next = child.nextSibling
49
- dispose(host.removeChild(child))
49
+ dispose(child)
50
+ host.removeChild(child)
50
51
  child = next
51
52
  }
52
53
  },
@@ -119,11 +120,7 @@ export const
119
120
 
120
121
  const
121
122
 
122
- microtask = globalThis.queueMicrotask ?? (fn => fn()),
123
-
124
- task = globalThis.requestAnimationFrame ?? microtask,
125
-
126
- { isArray, from } = Array, { is } = Object, noop = () => { }, FN = Symbol(),
123
+ { isArray, from } = Array, { is } = Object, noop = () => { }, FN = Symbol(),
127
124
 
128
125
  isObject = v => v && typeof v == 'object', isFunction = v => typeof v == 'function',
129
126
 
@@ -131,6 +128,8 @@ const
131
128
 
132
129
  reduce = v => from(v).reduce(assign, {}), assign = (v, { name, value }) => ((v[name] = value), v),
133
130
 
131
+ microtask = globalThis.queueMicrotask ?? (fn => fn()), task = globalThis.requestAnimationFrame ?? microtask,
132
+
134
133
  create = (ns, name, key) => {
135
134
  const node = ns ? document.createElementNS(ns, name) : document.createElement(name)
136
135
  return node.$key = key, node
@@ -202,9 +201,17 @@ const
202
201
 
203
202
  if (globalThis.navigator?.scheduling?.isInputPending()) {
204
203
 
205
- host.$idle = requestIdleCallback(() => {
206
- host.$idle = null
207
- schedule(host)
204
+ idleQueue.add(host)
205
+ 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
+ }
208
215
  })
209
216
 
210
217
  return
@@ -227,8 +234,8 @@ const
227
234
  runComponent = host => {
228
235
 
229
236
  if (host.$idle) {
230
- cancelIdleCallback(host.$idle)
231
- host.$idle = null
237
+ idleQueue.delete(host)
238
+ host.$idle = false
232
239
  }
233
240
 
234
241
  current = host
@@ -241,18 +248,20 @@ const
241
248
  propagate(value, host.parentNode)
242
249
  } finally {
243
250
  current = null
244
- layoutsQueue.add(host)
245
- layoutsId ??= task(runLayouts)
251
+ layoutQueue.add(host)
252
+ host.$layoutQueued = true
253
+ layoutId ??= task(runLayouts)
246
254
  }
247
255
  },
248
256
 
249
257
  runLayouts = () => {
250
258
 
251
- layoutsId = null
259
+ layoutId = null
252
260
 
253
- for (const host of layoutsQueue) {
261
+ for (const host of layoutQueue) {
254
262
 
255
- layoutsQueue.delete(host)
263
+ layoutQueue.delete(host)
264
+ host.$layoutQueued = false
256
265
 
257
266
  try {
258
267
  render(host.$h, host)
@@ -261,18 +270,20 @@ const
261
270
  propagate(value, host)
262
271
  } finally {
263
272
  runFx(host, '$layout')
264
- effectsQueue.add(host)
265
- effectsId ??= task(runEffects)
273
+ effectQueue.add(host)
274
+ host.$effectQueued = true
275
+ effectId ??= task(runEffects)
266
276
  }
267
277
  }
268
278
  },
269
279
 
270
280
  runEffects = () => {
271
281
 
272
- effectsId = null
282
+ effectId = null
273
283
 
274
- for (const host of effectsQueue) {
275
- effectsQueue.delete(host)
284
+ for (const host of effectQueue) {
285
+ effectQueue.delete(host)
286
+ host.$effectQueued = false
276
287
  runFx(host, '$effect')
277
288
  }
278
289
  },
@@ -305,14 +316,38 @@ const
305
316
 
306
317
  if (host.$ref) host.$ref.current = null
307
318
 
308
- layoutsQueue.delete(host)
309
- effectsQueue.delete(host)
319
+ if (!host.$fn) return
320
+
321
+ if (host.$idle) {
322
+ idleQueue.delete(host)
323
+ host.$idle = false
324
+ }
325
+
326
+ if (host.$layoutQueued) {
327
+ layoutQueue.delete(host)
328
+ host.$layoutQueued = false
329
+ }
330
+
331
+ if (host.$effectQueued) {
332
+ effectQueue.delete(host)
333
+ host.$effectQueued = false
334
+ }
310
335
 
311
336
  for (const key of ['$layout', '$effect']) if (host[key]) {
312
337
 
313
- for (const fx of host[key]) try { isFunction(fx[0]) && fx[0]() } catch { }
338
+ for (const fx of host[key]) {
314
339
 
315
- host[key].clear()
340
+ host[key].delete(fx)
341
+
342
+ try {
343
+ const [cleanup] = fx
344
+ isFunction(cleanup) && cleanup()
345
+ } catch (value) {
346
+ propagate(value, host.parentNode)
347
+ } finally {
348
+ fx[0] = fx[1] = null
349
+ }
350
+ }
316
351
  }
317
352
  },
318
353
 
@@ -321,4 +356,11 @@ const
321
356
  throw value
322
357
  }
323
358
 
324
- let current = null, layoutsQueue = new Set, layoutsId = null, effectsQueue = new Set, effectsId = null
359
+ let
360
+ current = null,
361
+ layoutQueue = new Set,
362
+ effectQueue = new Set,
363
+ idleQueue = new Set,
364
+ layoutId = null,
365
+ effectId = null,
366
+ idleId = null
package/index.min.js CHANGED
@@ -1 +1 @@
1
- var ajo=(()=>{var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var l in t)g(e,l,{get:t[l],enumerable:!0})},W=(e,t,l,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of z(t))!P.call(e,n)&&n!==l&&g(e,n,{get:()=>t[n],enumerable:!(r=R(t,n))||r.enumerable});return e};var D=e=>W(g({},"__esModule",{value:!0}),e);var fe={};V(fe,{Fragment:()=>G,component:()=>J,h:()=>v,render:()=>x,useCallback:()=>Y,useCatch:()=>K,useEffect:()=>_,useHost:()=>m,useLayout:()=>Z,useMemo:()=>N,useReducer:()=>b,useRef:()=>X,useState:()=>U});const G=({children:e})=>e,v=(e,t,...l)=>{const{length:r}=l;return l=r==0?null:r==1?l[0]:l,{children:l,...t,nodeName:e}},x=(e,t,l)=>{let r=t.firstChild;for(e of k(e)){let n=r;if(e instanceof Node)n=e;else if(typeof e=="string"){for(;n&&n.nodeType!=3;)n=n.nextSibling;n?n.data!=e&&(n.data=e):n=document.createTextNode(e)}else{const{xmlns:a=l,nodeName:i,key:o,ref:c,memo:C,children:O,[T]:q,...Q}=e;for(;n&&!(n.localName==i&&(n.$key??=o)==o);)n=n.nextSibling;n??=re(a,i,o),te(c)&&(c.current=n,n.$ref=c),(C==null||S(n.$memo,n.$memo=C))&&(ae(Q,n),u(q)?q(n):x(O,n,a))}n==r?r=r.nextSibling:ie(t,n,r)}for(;r;){const n=r.nextSibling;B(t.removeChild(r)),r=n}},J=e=>({nodeName:t,as:l,props:r,key:n,ref:a,memo:i,...o})=>v(l??e?.as??"c-host",{...e?.props,...r,key:n,ref:a,memo:i,[T]:c=>{c.$fn=u(e)?e:ee,c.$args={...e?.args,...o},I(c)}}),b=(e,t)=>{const l=m(),r=y(),[n,a]=r;return n==a.length&&(a[n]=[u(t)?t():t,i=>{const o=a[n][0],c=u(i)?i(o):i;p(o,a[n][0]=u(e)?e(o,c):c)||oe(l)}]),a[r[0]++]},N=(e,t)=>{const l=y(),[r,n]=l;return(r==n.length||t==null||S(t,n[r][1]))&&(n[r]=[e(),t]),n[l[0]++][0]},K=e=>{const t=m(),[l,r]=b(),n=y(),[a,i]=n;return i[n[0]++]=e,t.$catch??=o=>{u(i[a])&&i[a](o),r(o)},[l,()=>r()]},m=()=>f,U=e=>b(null,e),X=e=>N(()=>({current:e}),[]),Y=(e,t)=>N(()=>e,t),Z=(e,t)=>E(e,t,"$layout"),_=(e,t)=>E(e,t,"$effect"),A=globalThis.queueMicrotask??(e=>e()),F=globalThis.requestAnimationFrame??A,{isArray:s,from:h}=Array,{is:p}=Object,ee=()=>{},T=Symbol(),te=e=>e&&typeof e=="object",u=e=>typeof e=="function",S=(e,t)=>s(e)&&s(t)?e.some((l,r)=>!p(l,t[r])):!p(e,t),ne=e=>h(e).reduce(le,{}),le=(e,{name:t,value:l})=>(e[t]=l,e),re=(e,t,l)=>{const r=e?document.createElementNS(e,t):document.createElement(t);return r.$key=l,r},k=function*(e,t={data:""},l=!0){let r;for(e of s(e)?e:[e])e==null||typeof e=="boolean"||(typeof e.nodeName=="string"?((r=t.data)&&(t.data="",yield r),yield e):u(e.nodeName)?yield*k(e.nodeName(e),t,!1):s(e)?yield*k(e,t,!1):t.data+=e);l&&(r=t.data)&&(yield r)},ae=(e,t)=>{const l=t.$props??=t.hasAttributes()?ne(t.attributes):{};for(const r in{...l,...t.$props=e}){let n=e[r];n!==l[r]&&(r.startsWith("set:")?t[r.slice(4)]=n:n==null||n===!1?t.removeAttribute(r):t.setAttribute(r,n===!0?"":n))}},ie=(e,t,l)=>{if(t.contains?.(document.activeElement)){const r=t.nextSibling;for(;l&&l!=t;){const n=l.nextSibling;e.insertBefore(l,r),l=n}}else e.insertBefore(t,l)},y=()=>f.$hooks??=[0,[]],E=(e,t,l)=>{const r=m(),n=y(),[a,i]=n;a==i.length?(r[l]??=new Set).add(i[a]=[null,e,t]):(t==null||S(t,i[a][2]))&&(i[a][1]=e,i[a][2]=t),n[0]++},I=e=>{if(!e.$idle){if(globalThis.navigator?.scheduling?.isInputPending()){e.$idle=requestIdleCallback(()=>{e.$idle=null,I(e)});return}j(e)}},oe=e=>{e.$queued||(e.$queued=!0,A(()=>{e.$queued=!1,j(e)}))},j=e=>{e.$idle&&(cancelIdleCallback(e.$idle),e.$idle=null),f=e,f.$hooks&&(f.$hooks[0]=0);try{e.$h=e.$fn(e.$args)}catch(t){w(t,e.parentNode)}finally{f=null,d.add(e),H??=F(ue)}},ue=()=>{H=null;for(const e of d){d.delete(e);try{x(e.$h,e),e.$h=null}catch(t){w(t,e)}finally{M(e,"$layout"),$.add(e),L??=F(ce)}}},ce=()=>{L=null;for(const e of $)$.delete(e),M(e,"$effect")},M=(e,t)=>{if(e[t])for(const l of e[t]){const[r,n]=l;if(u(n))try{u(r)&&r(),l[0]=n()}catch(a){l[0]=null,w(a,e.parentNode)}finally{l[1]=null}}},B=e=>{if(e.nodeType==1){for(const t of e.children)B(t);e.$ref&&(e.$ref.current=null),d.delete(e),$.delete(e);for(const t of["$layout","$effect"])if(e[t]){for(const l of e[t])try{u(l[0])&&l[0]()}catch{}e[t].clear()}}},w=(e,t)=>{for(let l;t;t=t.parentNode)if(u(l=t.$catch))return void l(e);throw e};let f=null,d=new Set,H=null,$=new Set,L=null;return D(fe);})();
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 n in t)x(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of W(t))!D.call(e,l)&&l!==n&&x(e,l,{get:()=>t[l],enumerable:!(u=V(t,l))||u.enumerable});return e};var K=e=>J(x({},"__esModule",{value:!0}),e);var se={};G(se,{Fragment:()=>U,component:()=>X,h:()=>C,render:()=>N,useCallback:()=>h,useCatch:()=>Y,useEffect:()=>te,useHost:()=>p,useLayout:()=>ee,useMemo:()=>Q,useReducer:()=>S,useRef:()=>_,useState:()=>Z});const U=({children:e})=>e,C=(e,t,...n)=>{const{length:u}=n;return n=u==0?null:u==1?n[0]:n,{children:n,...t,nodeName:e}},N=(e,t,n)=>{let u=t.firstChild;for(e of b(e)){let l=u;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=n,nodeName:i,key:r,ref:o,memo:q,children:z,[T]:v,...P}=e;for(;l&&!(l.localName==i&&$(l.$key??=r,r));)l=l.nextSibling;l??=ie(a,i,r),ne(o)&&(o.current=l,l.$ref=o),(q==null||w(l.$deps,l.$deps=q))&&(re(P,l),f(v)?v(l):N(z,l,a))}l==u?u=u.nextSibling:fe(t,l,u)}for(;u;){const l=u.nextSibling;L(u),t.removeChild(u),u=l}},X=e=>({nodeName:t,as:n,props:u,key:l,ref:a,memo:i,...r})=>C(n??e?.as??"c-host",{...e?.props,...u,key:l,ref:a,memo:i,[T]:o=>{o.$fn=f(e)?e:le,o.$args={...e?.args,...r},M(o)}}),S=(e,t)=>{const n=p(),u=g(),[l,a]=u;return l==a.length&&(a[l]=[f(t)?t():t,i=>{const r=a[l][0],o=f(i)?i(r):i;$(r,a[l][0]=f(e)?e(r,o):o)||oe(n)}]),a[u[0]++]},Q=(e,t)=>{const n=g(),[u,l]=n;return(u==l.length||t==null||w(t,l[u][1]))&&(l[u]=[e(),t]),l[n[0]++][0]},Y=e=>{const t=p(),[n,u]=S(),l=g(),[a,i]=l;return i[l[0]++]=e,t.$catch??=r=>{f(i[a])&&i[a](r),u(r)},[n,()=>u()]},p=()=>c,Z=e=>S(null,e),_=e=>Q(()=>({current:e}),[]),h=(e,t)=>Q(()=>e,t),ee=(e,t)=>j(e,t,"$layout"),te=(e,t)=>j(e,t,"$effect"),{isArray:s,from:F}=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((n,u)=>!$(n,t[u])):!$(e,t),ue=e=>F(e).reduce(ae,{}),ae=(e,{name:t,value:n})=>(e[t]=n,e),E=globalThis.queueMicrotask??(e=>e()),I=globalThis.requestAnimationFrame??E,ie=(e,t,n)=>{const u=e?document.createElementNS(e,t):document.createElement(t);return u.$key=n,u},b=function*(e,t={data:""},n=!0){let u;for(e of s(e)?e:[e])e==null||typeof e=="boolean"||(typeof e.nodeName=="string"?((u=t.data)&&(t.data="",yield u),yield e):f(e.nodeName)?yield*b(e.nodeName(e),t,!1):s(e)?yield*b(e,t,!1):t.data+=e);n&&(u=t.data)&&(yield u)},re=(e,t)=>{const n=t.$props??=t.hasAttributes()?ue(t.attributes):{};for(const u in{...n,...t.$props=e}){let l=e[u];l!==n[u]&&(u.startsWith("set:")?t[u.slice(4)]=l:l==null||l===!1?t.removeAttribute(u):t.setAttribute(u,l===!0?"":l))}},fe=(e,t,n)=>{if(t.contains?.(document.activeElement)){const u=t.nextSibling;for(;n&&n!=t;){const l=n.nextSibling;e.insertBefore(n,u),n=l}}else e.insertBefore(t,n)},g=()=>c.$hooks??=[0,[]],j=(e,t,n)=>{const u=p(),l=g(),[a,i]=l;a==i.length?(u[n]??=new Set).add(i[a]=[null,e,t]):(t==null||w(t,i[a][2]))&&(i[a][1]=e,i[a][2]=t),l[0]++},M=e=>{if(!e.$idle){if(globalThis.navigator?.scheduling?.isInputPending()){d.add(e),e.$idle=!0,A??=requestIdleCallback(()=>{A=null;const t=F(d);for(const n of t)d.delete(n),n.$idle=!1,M(n)});return}B(e)}},oe=e=>{e.$queued||(e.$queued=!0,E(()=>{e.$queued=!1,B(e)}))},B=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,O??=I(ce)}},ce=()=>{O=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{H(e,"$layout"),m.add(e),e.$effectQueued=!0,R??=I(de)}}},de=()=>{R=null;for(const e of m)m.delete(e),e.$effectQueued=!1,H(e,"$effect")},H=(e,t)=>{if(e[t])for(const n of e[t]){const[u,l]=n;if(f(l))try{f(u)&&u(),n[0]=l()}catch(a){n[0]=null,k(a,e.parentNode)}finally{n[1]=null}}},L=e=>{if(e.nodeType==1){for(const t of e.children)L(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 n of e[t]){e[t].delete(n);try{const[u]=n;f(u)&&u()}catch(u){k(u,e.parentNode)}finally{n[0]=n[1]=null}}}}},k=(e,t)=>{for(let n;t;t=t.parentNode)if(f(n=t.$catch))return void n(e);throw e};let c=null,y=new Set,m=new Set,d=new Set,O=null,R=null,A=null;return K(se);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ajo",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "ajo is a JavaScript view library for building user interfaces",
5
5
  "type": "module",
6
6
  "module": "index.js",