sibujs 3.0.0 → 3.2.0

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 (78) hide show
  1. package/README.md +6 -0
  2. package/dist/browser.cjs +16 -8
  3. package/dist/browser.js +6 -5
  4. package/dist/build.cjs +276 -150
  5. package/dist/build.js +35 -24
  6. package/dist/cdn.global.js +7 -7
  7. package/dist/{chunk-RJIRT46U.js → chunk-2C4E3HBM.js} +5 -5
  8. package/dist/{chunk-XDKP4T7G.js → chunk-4JCAUOLN.js} +45 -23
  9. package/dist/{chunk-VSNLICTS.js → chunk-5N74TKLD.js} +1 -1
  10. package/dist/{chunk-XVYB3J6C.js → chunk-7XDYVJLE.js} +19 -9
  11. package/dist/{chunk-L52H775O.js → chunk-BGNLPNGV.js} +20 -12
  12. package/dist/{chunk-6QZO7MMG.js → chunk-C427DVQF.js} +1 -1
  13. package/dist/{chunk-5WD7BYTZ.js → chunk-FDY42FIU.js} +3 -2
  14. package/dist/{chunk-4YTVESDX.js → chunk-FOI23UJL.js} +11 -1
  15. package/dist/{chunk-2RA7SHDA.js → chunk-GOJMFRBL.js} +20 -4
  16. package/dist/{chunk-2KM2724A.js → chunk-GOUM4JCT.js} +6 -6
  17. package/dist/chunk-H3SRKIYX.js +17 -0
  18. package/dist/{chunk-NEWH4O5U.js → chunk-H6PCHJZQ.js} +2 -2
  19. package/dist/{chunk-UCS6AMJ7.js → chunk-HMJFCBRR.js} +26 -3
  20. package/dist/{chunk-JYD2PWXH.js → chunk-HXMS4SNP.js} +22 -15
  21. package/dist/{chunk-DF3GTP4Q.js → chunk-JYXOEYI4.js} +12 -18
  22. package/dist/{chunk-KZA7ANXP.js → chunk-NFYWLRUO.js} +11 -18
  23. package/dist/{chunk-KH4OE6WY.js → chunk-NPIEEKPT.js} +20 -11
  24. package/dist/{chunk-V65KTDZW.js → chunk-OYLPZO4N.js} +33 -15
  25. package/dist/{chunk-LYTCUZ7H.js → chunk-RDRSWYNP.js} +1 -1
  26. package/dist/{chunk-UKMXT5T6.js → chunk-RLUJL2MV.js} +7 -12
  27. package/dist/{chunk-INBOWHQ3.js → chunk-V2MTG5FT.js} +99 -36
  28. package/dist/{chunk-CNZ35WI2.js → chunk-VJE6DDYM.js} +2 -2
  29. package/dist/{chunk-2JQUV4Y3.js → chunk-VOCE4NNK.js} +157 -75
  30. package/dist/{chunk-STFTTMO2.js → chunk-X67UYC74.js} +31 -12
  31. package/dist/{chunk-YMOIAHWA.js → chunk-YFDGQWDA.js} +1 -1
  32. package/dist/{chunk-L4DAT4WU.js → chunk-Z2FWAE4B.js} +28 -1
  33. package/dist/data.cjs +211 -93
  34. package/dist/data.d.cts +7 -1
  35. package/dist/data.d.ts +7 -1
  36. package/dist/data.js +8 -8
  37. package/dist/devtools.cjs +38 -10
  38. package/dist/devtools.d.cts +1 -1
  39. package/dist/devtools.d.ts +1 -1
  40. package/dist/devtools.js +6 -6
  41. package/dist/ecosystem.cjs +163 -65
  42. package/dist/ecosystem.js +9 -9
  43. package/dist/extras.cjs +420 -198
  44. package/dist/extras.d.cts +2 -2
  45. package/dist/extras.d.ts +2 -2
  46. package/dist/extras.js +27 -24
  47. package/dist/index.cjs +255 -139
  48. package/dist/index.d.cts +15 -2
  49. package/dist/index.d.ts +15 -2
  50. package/dist/index.js +15 -13
  51. package/dist/{introspect-BZWKvQUZ.d.ts → introspect-DOZfmC-4.d.ts} +1 -1
  52. package/dist/{introspect-DsJlDD2T.d.cts → introspect-RjLfIFpL.d.cts} +1 -1
  53. package/dist/motion.cjs +10 -0
  54. package/dist/motion.js +3 -3
  55. package/dist/patterns.cjs +66 -39
  56. package/dist/patterns.js +8 -7
  57. package/dist/performance.cjs +101 -25
  58. package/dist/performance.d.cts +2 -2
  59. package/dist/performance.d.ts +2 -2
  60. package/dist/performance.js +8 -7
  61. package/dist/plugins.cjs +243 -138
  62. package/dist/plugins.d.cts +1 -1
  63. package/dist/plugins.d.ts +1 -1
  64. package/dist/plugins.js +96 -45
  65. package/dist/{ssr-FXD2PPMC.js → ssr-2QDQ27EV.js} +5 -3
  66. package/dist/{ssr-CrVNy6Pa.d.cts → ssr-D62yFwuw.d.cts} +8 -1
  67. package/dist/{ssr-CrVNy6Pa.d.ts → ssr-D62yFwuw.d.ts} +8 -1
  68. package/dist/ssr.cjs +185 -68
  69. package/dist/ssr.d.cts +1 -1
  70. package/dist/ssr.d.ts +1 -1
  71. package/dist/ssr.js +12 -10
  72. package/dist/testing.cjs +9 -4
  73. package/dist/testing.js +3 -3
  74. package/dist/ui.cjs +76 -39
  75. package/dist/ui.js +10 -9
  76. package/dist/widgets.cjs +61 -23
  77. package/dist/widgets.js +8 -8
  78. package/package.json +3 -1
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { T as TagProps, N as NodeChildren, a as NodeChild } from './tagFactory-S17H2qxu.cjs';
2
2
  export { D as Dispose, S as SVG_NS, t as tagFactory } from './tagFactory-S17H2qxu.cjs';
3
3
  import { R as ReactiveSignal } from './signal-BnWpq6WB.cjs';
4
- export { T as TrustedHTML, t as trustHTML } from './ssr-CrVNy6Pa.cjs';
4
+ export { T as TrustedHTML, t as trustHTML } from './ssr-D62yFwuw.cjs';
5
5
 
6
6
  type reactive<T> = T | (() => T);
7
7
  interface AnchorProps extends TagProps {
@@ -1226,11 +1226,24 @@ declare function strictEffect(fn: () => void): () => void;
1226
1226
  interface SSRStore {
1227
1227
  ssr: boolean;
1228
1228
  suspenseIdCounter: number;
1229
+ /**
1230
+ * Per-request data caches (e.g. the query cache). Lazily created and keyed
1231
+ * by subsystem so request-scoped data never bleeds between concurrent
1232
+ * server renders. Typed loosely to avoid a dependency cycle with data/.
1233
+ */
1234
+ caches?: Map<string, Map<string, unknown>>;
1229
1235
  }
1230
1236
  /** Returns the active store (ALS or fallback). */
1231
1237
  declare function getSSRStore(): SSRStore;
1232
1238
  /** Returns true when running in SSR mode. */
1233
1239
  declare function isSSR(): boolean;
1240
+ /**
1241
+ * Returns a request-scoped cache map for the given subsystem when running
1242
+ * under SSR (so concurrent requests never share it), or `null` on the client
1243
+ * where a process-global cache is correct. On Node the store is backed by
1244
+ * AsyncLocalStorage, giving each request its own caches.
1245
+ */
1246
+ declare function getRequestScopedCache<V>(name: string): Map<string, V> | null;
1234
1247
  /** Enable SSR mode. Side effects (effect, watch, onMount) become no-ops. */
1235
1248
  declare function enableSSR(): void;
1236
1249
  /** Disable SSR mode. Side effects resume normal behavior. */
@@ -1538,4 +1551,4 @@ interface LoadingProps {
1538
1551
  */
1539
1552
  declare function Loading(props?: LoadingProps): HTMLElement;
1540
1553
 
1541
- export { type Accessor, type ActionFn, type AnchorProps, type ArrayActions, type AsyncDerivedState, type AudioProps, type ButtonProps, type Context, DynamicComponent, type EffectBody, type EffectOptions, ErrorBoundary, type ErrorBoundaryOptions, type ErrorBoundaryProps, ErrorDisplay, type ErrorDisplayProps, type ErrorSeverity, type FormProps, Fragment, type ImgProps, type InputProps, type InputType, KeepAlive, type KeepAliveOptions, type LabelProps, Loading, type LoadingProps, type LongPressOptions, type MediaProps, NodeChild, NodeChildren, type OnCleanup, type OptionProps, Portal, type Ref, type SSRStore, type SelectProps, type SignalOptions, type SlotFn, type Slots, type StoreActions, Suspense, type SuspenseProps, TagProps, type TextareaProps, type TypedTagFunction, type VideoProps, __resetIdCounter, a, abbr, action, address, area, array, article, aside, asyncDerived, audio, autoResize, b, base, batch, bdi, bdo, bindDynamic, blockquote, body, br, button, canvas, caption, catchError, catchErrorAsync, center, checkLeaks, circle, cite, clickOutside, clipPath, code, col, colgroup, context, copyOnClick, createId, customElement, data, datalist, dd, deepEqual, deepSignal, defer, defs, del, derived, details, dfn, dialog, disableSSR, dispose, div, dl, dt, each, effect, ellipse, em, embed, enableSSR, enqueueBatchedSignal, fieldset, figcaption, figure, font, footer, form, g, getSSRStore, getSlot, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, ins, isBatching, isSSR, kbd, label, lazy, legend, li, line, linearGradient, link, longPress, main, map, mark, marker, marquee, mask, match, math, menu, meta, meter, mount, nav, nextTick, noscript, object, ol, on, onCleanup, onMount, onUnmount, optgroup, option, output, p, param, path, pattern, picture, polygon, polyline, portal, pre, progress, q, radialGradient, reactiveArray, rect, ref, registerComponent, registerDisposer, resolveComponent, retrack, rp, rt, ruby, runInSSRContext, s, samp, script, section, select, setGlobalErrorHandler, setMaxDrainIterations, show, signal, slot, small, source, span, stop, store, strict, strictEffect, strong, style, sub, summary, sup, svg, symbol, table, takePendingError, tbody, td, template, text, textarea, tfoot, th, thead, time, title, tr, track, transition, trapFocus, tspan, u, ul, unregisterComponent, untracked, use, var_, video, watch, when, withSSR, writable };
1554
+ export { type Accessor, type ActionFn, type AnchorProps, type ArrayActions, type AsyncDerivedState, type AudioProps, type ButtonProps, type Context, DynamicComponent, type EffectBody, type EffectOptions, ErrorBoundary, type ErrorBoundaryOptions, type ErrorBoundaryProps, ErrorDisplay, type ErrorDisplayProps, type ErrorSeverity, type FormProps, Fragment, type ImgProps, type InputProps, type InputType, KeepAlive, type KeepAliveOptions, type LabelProps, Loading, type LoadingProps, type LongPressOptions, type MediaProps, NodeChild, NodeChildren, type OnCleanup, type OptionProps, Portal, type Ref, type SSRStore, type SelectProps, type SignalOptions, type SlotFn, type Slots, type StoreActions, Suspense, type SuspenseProps, TagProps, type TextareaProps, type TypedTagFunction, type VideoProps, __resetIdCounter, a, abbr, action, address, area, array, article, aside, asyncDerived, audio, autoResize, b, base, batch, bdi, bdo, bindDynamic, blockquote, body, br, button, canvas, caption, catchError, catchErrorAsync, center, checkLeaks, circle, cite, clickOutside, clipPath, code, col, colgroup, context, copyOnClick, createId, customElement, data, datalist, dd, deepEqual, deepSignal, defer, defs, del, derived, details, dfn, dialog, disableSSR, dispose, div, dl, dt, each, effect, ellipse, em, embed, enableSSR, enqueueBatchedSignal, fieldset, figcaption, figure, font, footer, form, g, getRequestScopedCache, getSSRStore, getSlot, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, ins, isBatching, isSSR, kbd, label, lazy, legend, li, line, linearGradient, link, longPress, main, map, mark, marker, marquee, mask, match, math, menu, meta, meter, mount, nav, nextTick, noscript, object, ol, on, onCleanup, onMount, onUnmount, optgroup, option, output, p, param, path, pattern, picture, polygon, polyline, portal, pre, progress, q, radialGradient, reactiveArray, rect, ref, registerComponent, registerDisposer, resolveComponent, retrack, rp, rt, ruby, runInSSRContext, s, samp, script, section, select, setGlobalErrorHandler, setMaxDrainIterations, show, signal, slot, small, source, span, stop, store, strict, strictEffect, strong, style, sub, summary, sup, svg, symbol, table, takePendingError, tbody, td, template, text, textarea, tfoot, th, thead, time, title, tr, track, transition, trapFocus, tspan, u, ul, unregisterComponent, untracked, use, var_, video, watch, when, withSSR, writable };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { T as TagProps, N as NodeChildren, a as NodeChild } from './tagFactory-S17H2qxu.js';
2
2
  export { D as Dispose, S as SVG_NS, t as tagFactory } from './tagFactory-S17H2qxu.js';
3
3
  import { R as ReactiveSignal } from './signal-BnWpq6WB.js';
4
- export { T as TrustedHTML, t as trustHTML } from './ssr-CrVNy6Pa.js';
4
+ export { T as TrustedHTML, t as trustHTML } from './ssr-D62yFwuw.js';
5
5
 
6
6
  type reactive<T> = T | (() => T);
7
7
  interface AnchorProps extends TagProps {
@@ -1226,11 +1226,24 @@ declare function strictEffect(fn: () => void): () => void;
1226
1226
  interface SSRStore {
1227
1227
  ssr: boolean;
1228
1228
  suspenseIdCounter: number;
1229
+ /**
1230
+ * Per-request data caches (e.g. the query cache). Lazily created and keyed
1231
+ * by subsystem so request-scoped data never bleeds between concurrent
1232
+ * server renders. Typed loosely to avoid a dependency cycle with data/.
1233
+ */
1234
+ caches?: Map<string, Map<string, unknown>>;
1229
1235
  }
1230
1236
  /** Returns the active store (ALS or fallback). */
1231
1237
  declare function getSSRStore(): SSRStore;
1232
1238
  /** Returns true when running in SSR mode. */
1233
1239
  declare function isSSR(): boolean;
1240
+ /**
1241
+ * Returns a request-scoped cache map for the given subsystem when running
1242
+ * under SSR (so concurrent requests never share it), or `null` on the client
1243
+ * where a process-global cache is correct. On Node the store is backed by
1244
+ * AsyncLocalStorage, giving each request its own caches.
1245
+ */
1246
+ declare function getRequestScopedCache<V>(name: string): Map<string, V> | null;
1234
1247
  /** Enable SSR mode. Side effects (effect, watch, onMount) become no-ops. */
1235
1248
  declare function enableSSR(): void;
1236
1249
  /** Disable SSR mode. Side effects resume normal behavior. */
@@ -1538,4 +1551,4 @@ interface LoadingProps {
1538
1551
  */
1539
1552
  declare function Loading(props?: LoadingProps): HTMLElement;
1540
1553
 
1541
- export { type Accessor, type ActionFn, type AnchorProps, type ArrayActions, type AsyncDerivedState, type AudioProps, type ButtonProps, type Context, DynamicComponent, type EffectBody, type EffectOptions, ErrorBoundary, type ErrorBoundaryOptions, type ErrorBoundaryProps, ErrorDisplay, type ErrorDisplayProps, type ErrorSeverity, type FormProps, Fragment, type ImgProps, type InputProps, type InputType, KeepAlive, type KeepAliveOptions, type LabelProps, Loading, type LoadingProps, type LongPressOptions, type MediaProps, NodeChild, NodeChildren, type OnCleanup, type OptionProps, Portal, type Ref, type SSRStore, type SelectProps, type SignalOptions, type SlotFn, type Slots, type StoreActions, Suspense, type SuspenseProps, TagProps, type TextareaProps, type TypedTagFunction, type VideoProps, __resetIdCounter, a, abbr, action, address, area, array, article, aside, asyncDerived, audio, autoResize, b, base, batch, bdi, bdo, bindDynamic, blockquote, body, br, button, canvas, caption, catchError, catchErrorAsync, center, checkLeaks, circle, cite, clickOutside, clipPath, code, col, colgroup, context, copyOnClick, createId, customElement, data, datalist, dd, deepEqual, deepSignal, defer, defs, del, derived, details, dfn, dialog, disableSSR, dispose, div, dl, dt, each, effect, ellipse, em, embed, enableSSR, enqueueBatchedSignal, fieldset, figcaption, figure, font, footer, form, g, getSSRStore, getSlot, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, ins, isBatching, isSSR, kbd, label, lazy, legend, li, line, linearGradient, link, longPress, main, map, mark, marker, marquee, mask, match, math, menu, meta, meter, mount, nav, nextTick, noscript, object, ol, on, onCleanup, onMount, onUnmount, optgroup, option, output, p, param, path, pattern, picture, polygon, polyline, portal, pre, progress, q, radialGradient, reactiveArray, rect, ref, registerComponent, registerDisposer, resolveComponent, retrack, rp, rt, ruby, runInSSRContext, s, samp, script, section, select, setGlobalErrorHandler, setMaxDrainIterations, show, signal, slot, small, source, span, stop, store, strict, strictEffect, strong, style, sub, summary, sup, svg, symbol, table, takePendingError, tbody, td, template, text, textarea, tfoot, th, thead, time, title, tr, track, transition, trapFocus, tspan, u, ul, unregisterComponent, untracked, use, var_, video, watch, when, withSSR, writable };
1554
+ export { type Accessor, type ActionFn, type AnchorProps, type ArrayActions, type AsyncDerivedState, type AudioProps, type ButtonProps, type Context, DynamicComponent, type EffectBody, type EffectOptions, ErrorBoundary, type ErrorBoundaryOptions, type ErrorBoundaryProps, ErrorDisplay, type ErrorDisplayProps, type ErrorSeverity, type FormProps, Fragment, type ImgProps, type InputProps, type InputType, KeepAlive, type KeepAliveOptions, type LabelProps, Loading, type LoadingProps, type LongPressOptions, type MediaProps, NodeChild, NodeChildren, type OnCleanup, type OptionProps, Portal, type Ref, type SSRStore, type SelectProps, type SignalOptions, type SlotFn, type Slots, type StoreActions, Suspense, type SuspenseProps, TagProps, type TextareaProps, type TypedTagFunction, type VideoProps, __resetIdCounter, a, abbr, action, address, area, array, article, aside, asyncDerived, audio, autoResize, b, base, batch, bdi, bdo, bindDynamic, blockquote, body, br, button, canvas, caption, catchError, catchErrorAsync, center, checkLeaks, circle, cite, clickOutside, clipPath, code, col, colgroup, context, copyOnClick, createId, customElement, data, datalist, dd, deepEqual, deepSignal, defer, defs, del, derived, details, dfn, dialog, disableSSR, dispose, div, dl, dt, each, effect, ellipse, em, embed, enableSSR, enqueueBatchedSignal, fieldset, figcaption, figure, font, footer, form, g, getRequestScopedCache, getSSRStore, getSlot, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, ins, isBatching, isSSR, kbd, label, lazy, legend, li, line, linearGradient, link, longPress, main, map, mark, marker, marquee, mask, match, math, menu, meta, meter, mount, nav, nextTick, noscript, object, ol, on, onCleanup, onMount, onUnmount, optgroup, option, output, p, param, path, pattern, picture, polygon, polyline, portal, pre, progress, q, radialGradient, reactiveArray, rect, ref, registerComponent, registerDisposer, resolveComponent, retrack, rp, rt, ruby, runInSSRContext, s, samp, script, section, select, setGlobalErrorHandler, setMaxDrainIterations, show, signal, slot, small, source, span, stop, store, strict, strictEffect, strong, style, sub, summary, sup, svg, symbol, table, takePendingError, tbody, td, template, text, textarea, tfoot, th, thead, time, title, tr, track, transition, trapFocus, tspan, u, ul, unregisterComponent, untracked, use, var_, video, watch, when, withSSR, writable };
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  unregisterComponent,
45
45
  when,
46
46
  writable
47
- } from "./chunk-INBOWHQ3.js";
47
+ } from "./chunk-V2MTG5FT.js";
48
48
  import {
49
49
  __resetIdCounter,
50
50
  createId
@@ -186,55 +186,56 @@ import {
186
186
  use,
187
187
  var_,
188
188
  video
189
- } from "./chunk-VSNLICTS.js";
189
+ } from "./chunk-5N74TKLD.js";
190
190
  import {
191
191
  watch
192
- } from "./chunk-NEWH4O5U.js";
192
+ } from "./chunk-H6PCHJZQ.js";
193
193
  import {
194
194
  trustHTML
195
- } from "./chunk-JYD2PWXH.js";
195
+ } from "./chunk-HXMS4SNP.js";
196
196
  import {
197
197
  context
198
- } from "./chunk-YMOIAHWA.js";
198
+ } from "./chunk-YFDGQWDA.js";
199
199
  import {
200
200
  SVG_NS,
201
201
  tagFactory
202
- } from "./chunk-STFTTMO2.js";
202
+ } from "./chunk-X67UYC74.js";
203
203
  import {
204
204
  bindDynamic
205
- } from "./chunk-UKMXT5T6.js";
205
+ } from "./chunk-RLUJL2MV.js";
206
206
  import {
207
207
  derived
208
- } from "./chunk-DF3GTP4Q.js";
208
+ } from "./chunk-JYXOEYI4.js";
209
209
  import {
210
210
  checkLeaks,
211
211
  dispose,
212
212
  registerDisposer
213
213
  } from "./chunk-2UPRY23K.js";
214
- import "./chunk-UCS6AMJ7.js";
214
+ import "./chunk-HMJFCBRR.js";
215
215
  import {
216
216
  effect,
217
217
  on
218
- } from "./chunk-5WD7BYTZ.js";
218
+ } from "./chunk-FDY42FIU.js";
219
219
  import {
220
220
  disableSSR,
221
221
  enableSSR,
222
+ getRequestScopedCache,
222
223
  getSSRStore,
223
224
  isSSR,
224
225
  runInSSRContext,
225
226
  withSSR
226
- } from "./chunk-2RA7SHDA.js";
227
+ } from "./chunk-GOJMFRBL.js";
227
228
  import {
228
229
  batch,
229
230
  enqueueBatchedSignal,
230
231
  isBatching,
231
232
  signal
232
- } from "./chunk-6QZO7MMG.js";
233
+ } from "./chunk-C427DVQF.js";
233
234
  import {
234
235
  retrack,
235
236
  setMaxDrainIterations,
236
237
  untracked
237
- } from "./chunk-L4DAT4WU.js";
238
+ } from "./chunk-Z2FWAE4B.js";
238
239
  import "./chunk-LMLD24FC.js";
239
240
  export {
240
241
  DynamicComponent,
@@ -316,6 +317,7 @@ export {
316
317
  footer,
317
318
  form,
318
319
  g,
320
+ getRequestScopedCache,
319
321
  getSSRStore,
320
322
  getSlot,
321
323
  h1,
@@ -370,7 +370,7 @@ declare function withErrorTracking(name: string, component: () => HTMLElement, r
370
370
  */
371
371
  declare function formatError(error: Error, context?: {
372
372
  component?: string;
373
- }): string;
373
+ }, seen?: Set<Error>): string;
374
374
 
375
375
  /**
376
376
  * Registers a reactive value for DevTools inspection.
@@ -370,7 +370,7 @@ declare function withErrorTracking(name: string, component: () => HTMLElement, r
370
370
  */
371
371
  declare function formatError(error: Error, context?: {
372
372
  component?: string;
373
- }): string;
373
+ }, seen?: Set<Error>): string;
374
374
 
375
375
  /**
376
376
  * Registers a reactive value for DevTools inspection.
package/dist/motion.cjs CHANGED
@@ -58,11 +58,17 @@ function transition(element, options = {}) {
58
58
  } = options;
59
59
  const transitionValue = `${property} ${duration}ms ${easing} ${delay}ms`;
60
60
  let activeTimer = null;
61
+ let pendingResolve = null;
61
62
  function cancelPending() {
62
63
  if (activeTimer !== null) {
63
64
  clearTimeout(activeTimer);
64
65
  activeTimer = null;
65
66
  }
67
+ if (pendingResolve !== null) {
68
+ const resolvePrev = pendingResolve;
69
+ pendingResolve = null;
70
+ resolvePrev();
71
+ }
66
72
  }
67
73
  function enter() {
68
74
  return new Promise((resolve) => {
@@ -74,11 +80,13 @@ function transition(element, options = {}) {
74
80
  if (activeClass) element.classList.add(activeClass);
75
81
  const done = () => {
76
82
  activeTimer = null;
83
+ pendingResolve = null;
77
84
  if (enterClass) element.classList.remove(enterClass);
78
85
  onEnterDone?.();
79
86
  resolve();
80
87
  };
81
88
  if (duration > 0) {
89
+ pendingResolve = resolve;
82
90
  activeTimer = setTimeout(done, duration + delay);
83
91
  } else {
84
92
  done();
@@ -94,11 +102,13 @@ function transition(element, options = {}) {
94
102
  if (enterClass) element.classList.remove(enterClass);
95
103
  const done = () => {
96
104
  activeTimer = null;
105
+ pendingResolve = null;
97
106
  if (leaveClass) element.classList.remove(leaveClass);
98
107
  onLeaveDone?.();
99
108
  resolve();
100
109
  };
101
110
  if (duration > 0) {
111
+ pendingResolve = resolve;
102
112
  activeTimer = setTimeout(done, duration + delay);
103
113
  } else {
104
114
  done();
package/dist/motion.js CHANGED
@@ -19,9 +19,9 @@ import {
19
19
  stagger,
20
20
  transition,
21
21
  viewTransition
22
- } from "./chunk-4YTVESDX.js";
23
- import "./chunk-6QZO7MMG.js";
24
- import "./chunk-L4DAT4WU.js";
22
+ } from "./chunk-FOI23UJL.js";
23
+ import "./chunk-C427DVQF.js";
24
+ import "./chunk-Z2FWAE4B.js";
25
25
  import "./chunk-LMLD24FC.js";
26
26
  export {
27
27
  TransitionGroup,
package/dist/patterns.cjs CHANGED
@@ -188,7 +188,7 @@ function retrack(effectFn, subscriber) {
188
188
  }
189
189
  }
190
190
  function track(effectFn, subscriber) {
191
- if (!subscriber) subscriber = effectFn;
191
+ if (!subscriber) return reactiveBinding(effectFn);
192
192
  cleanup(subscriber);
193
193
  const prev = currentSubscriber;
194
194
  currentSubscriber = subscriber;
@@ -206,6 +206,32 @@ function track(effectFn, subscriber) {
206
206
  const sub = subscriber;
207
207
  return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
208
208
  }
209
+ function reactiveBinding(commit) {
210
+ const run = () => {
211
+ const s = subscriber;
212
+ if (s._disposed || s._reentrant) return;
213
+ s._reentrant = true;
214
+ try {
215
+ retrack(commit, subscriber);
216
+ } finally {
217
+ s._reentrant = false;
218
+ }
219
+ };
220
+ const subscriber = run;
221
+ subscriber.depsHead = null;
222
+ subscriber.depsTail = null;
223
+ subscriber._epoch = 0;
224
+ subscriber._structDirty = false;
225
+ subscriber._runEpoch = 0;
226
+ subscriber._runs = 0;
227
+ subscriber._reentrant = false;
228
+ subscriber._disposed = false;
229
+ run();
230
+ return subscriber._dispose ?? (subscriber._dispose = () => {
231
+ subscriber._disposed = true;
232
+ cleanup(subscriber);
233
+ });
234
+ }
209
235
  function recordDependency(signal2) {
210
236
  if (!currentSubscriber) return;
211
237
  const sub = currentSubscriber;
@@ -487,6 +513,19 @@ function signal(initial, options) {
487
513
  return [get, set];
488
514
  }
489
515
 
516
+ // src/utils/guards.ts
517
+ var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
518
+ function isUnsafeKey(key) {
519
+ return UNSAFE_KEYS.has(key);
520
+ }
521
+ function stripUnsafeKeys(obj) {
522
+ const out = {};
523
+ for (const k of Object.keys(obj)) {
524
+ if (!isUnsafeKey(k)) out[k] = obj[k];
525
+ }
526
+ return out;
527
+ }
528
+
490
529
  // src/patterns/machine.ts
491
530
  function machine(config) {
492
531
  const [state, setState] = signal(config.initial);
@@ -518,11 +557,7 @@ function machine(config) {
518
557
  }
519
558
  if (action) {
520
559
  const rawPatch = action(ctx);
521
- const next = { ...ctx };
522
- for (const key of Object.keys(rawPatch)) {
523
- if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
524
- next[key] = rawPatch[key];
525
- }
560
+ const next = { ...ctx, ...stripUnsafeKeys(rawPatch) };
526
561
  setContext(next);
527
562
  }
528
563
  setState(target);
@@ -553,11 +588,15 @@ function machine(config) {
553
588
  var als = null;
554
589
  try {
555
590
  if (typeof process !== "undefined" && process.versions && process.versions.node) {
556
- const req = Function("return typeof require==='function'?require:null")();
557
- if (req) {
558
- const mod = req("node:async_hooks");
559
- als = new mod.AsyncLocalStorage();
591
+ let mod = null;
592
+ const getBuiltin = process.getBuiltinModule;
593
+ if (typeof getBuiltin === "function") {
594
+ mod = getBuiltin("node:async_hooks");
595
+ } else {
596
+ const req = Function("return typeof require==='function'?require:null")();
597
+ if (req) mod = req("node:async_hooks");
560
598
  }
599
+ if (mod) als = new mod.AsyncLocalStorage();
561
600
  }
562
601
  } catch {
563
602
  als = null;
@@ -659,6 +698,7 @@ function effect(effectFn, options) {
659
698
  ctx.fn(ctx.onCleanup);
660
699
  };
661
700
  const sub = (() => {
701
+ if (ctx.disposed) return;
662
702
  if (ctx.running) {
663
703
  ctx.rerunPending = true;
664
704
  return;
@@ -698,10 +738,7 @@ function effect(effectFn, options) {
698
738
  function persisted(key, initial, options = {}) {
699
739
  const storage = options.session ? sessionStorage : localStorage;
700
740
  const serialize = options.serialize || JSON.stringify;
701
- const safeReviver = (k, v) => {
702
- if (k === "__proto__" || k === "constructor" || k === "prototype") return void 0;
703
- return v;
704
- };
741
+ const safeReviver = (k, v) => isUnsafeKey(k) ? void 0 : v;
705
742
  const deserialize = options.deserialize || ((raw) => JSON.parse(raw, safeReviver));
706
743
  const encrypt = options.encrypt;
707
744
  const decrypt = options.decrypt;
@@ -923,6 +960,7 @@ function derived(getter, options) {
923
960
  const equals = options?.equals;
924
961
  const cs = {};
925
962
  cs._d = false;
963
+ cs._init = false;
926
964
  cs._g = getter;
927
965
  cs.__v = 0;
928
966
  const markDirty = () => {
@@ -931,11 +969,18 @@ function derived(getter, options) {
931
969
  };
932
970
  markDirty._c = 1;
933
971
  markDirty._sig = cs;
972
+ const recompute = () => {
973
+ const next = getter();
974
+ cs._v = equals && cs._init ? equals(cs._v, next) ? cs._v : next : next;
975
+ cs._d = false;
976
+ cs._init = true;
977
+ };
934
978
  track(() => {
935
979
  let threw = true;
936
980
  try {
937
981
  cs._v = getter();
938
982
  cs._d = false;
983
+ cs._init = true;
939
984
  threw = false;
940
985
  } finally {
941
986
  if (threw) cs._d = true;
@@ -951,20 +996,13 @@ function derived(getter, options) {
951
996
  }
952
997
  if (trackingSuspended) {
953
998
  if (cs._d) {
999
+ const prev = cs._v;
954
1000
  evaluating = true;
955
- let threw = true;
956
1001
  try {
957
- const prev = cs._v;
958
- retrack(() => {
959
- const next = getter();
960
- cs._v = equals && cs._v !== void 0 ? equals(cs._v, next) ? cs._v : next : next;
961
- cs._d = false;
962
- threw = false;
963
- }, markDirty);
1002
+ retrack(recompute, markDirty);
964
1003
  if (!Object.is(prev, cs._v)) cs.__v++;
965
1004
  } finally {
966
1005
  evaluating = false;
967
- if (threw) cs._d = true;
968
1006
  }
969
1007
  }
970
1008
  return cs._v;
@@ -973,18 +1011,11 @@ function derived(getter, options) {
973
1011
  if (cs._d) {
974
1012
  const oldValue = cs._v;
975
1013
  evaluating = true;
976
- let threw = true;
977
1014
  try {
978
- retrack(() => {
979
- const next = getter();
980
- cs._v = equals && cs._v !== void 0 ? equals(cs._v, next) ? cs._v : next : next;
981
- cs._d = false;
982
- threw = false;
983
- }, markDirty);
1015
+ retrack(recompute, markDirty);
984
1016
  if (!Object.is(oldValue, cs._v)) cs.__v++;
985
1017
  } finally {
986
1018
  evaluating = false;
987
- if (threw) cs._d = true;
988
1019
  }
989
1020
  if (hook && oldValue !== cs._v) {
990
1021
  hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
@@ -1076,6 +1107,7 @@ function deepClone(value) {
1076
1107
  if (Array.isArray(v)) return v.map(clone);
1077
1108
  const out = {};
1078
1109
  for (const k of Object.keys(v)) {
1110
+ if (k === "__proto__") continue;
1079
1111
  out[k] = clone(v[k]);
1080
1112
  }
1081
1113
  return out;
@@ -1093,12 +1125,7 @@ function globalStore(config) {
1093
1125
  const execute = () => {
1094
1126
  const current = getState();
1095
1127
  const rawPatch = actionFn(current, payload);
1096
- const patch = {};
1097
- for (const key of Object.keys(rawPatch)) {
1098
- if (key !== "__proto__" && key !== "constructor" && key !== "prototype") {
1099
- patch[key] = rawPatch[key];
1100
- }
1101
- }
1128
+ const patch = stripUnsafeKeys(rawPatch);
1102
1129
  setState({ ...current, ...patch });
1103
1130
  const newState = getState();
1104
1131
  for (const listener of listeners) {
@@ -1171,7 +1198,7 @@ function withBoundary(name, component) {
1171
1198
  function createSlots(slots) {
1172
1199
  return {
1173
1200
  renderSlot(name, fallback) {
1174
- const slotFn = slots[name];
1201
+ const slotFn = Object.hasOwn(slots, name) ? slots[name] : void 0;
1175
1202
  if (slotFn) {
1176
1203
  const result = slotFn();
1177
1204
  if (Array.isArray(result)) {
@@ -1185,7 +1212,7 @@ function createSlots(slots) {
1185
1212
  return fallback ? fallback() : null;
1186
1213
  },
1187
1214
  hasSlot(name) {
1188
- return name in slots;
1215
+ return Object.hasOwn(slots, name);
1189
1216
  }
1190
1217
  };
1191
1218
  }
package/dist/patterns.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  optimisticList,
6
6
  persisted,
7
7
  timeline
8
- } from "./chunk-KZA7ANXP.js";
8
+ } from "./chunk-NFYWLRUO.js";
9
9
  import {
10
10
  RenderProp,
11
11
  assertType,
@@ -21,12 +21,13 @@ import {
21
21
  withDefaults,
22
22
  withProps,
23
23
  withWrapper
24
- } from "./chunk-CNZ35WI2.js";
25
- import "./chunk-DF3GTP4Q.js";
26
- import "./chunk-5WD7BYTZ.js";
27
- import "./chunk-2RA7SHDA.js";
28
- import "./chunk-6QZO7MMG.js";
29
- import "./chunk-L4DAT4WU.js";
24
+ } from "./chunk-VJE6DDYM.js";
25
+ import "./chunk-H3SRKIYX.js";
26
+ import "./chunk-JYXOEYI4.js";
27
+ import "./chunk-FDY42FIU.js";
28
+ import "./chunk-GOJMFRBL.js";
29
+ import "./chunk-C427DVQF.js";
30
+ import "./chunk-Z2FWAE4B.js";
30
31
  import "./chunk-LMLD24FC.js";
31
32
  export {
32
33
  RenderProp,