sibujs 3.4.0 → 4.0.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 (98) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +118 -15
  3. package/dist/browser.cjs +410 -101
  4. package/dist/browser.d.cts +50 -5
  5. package/dist/browser.d.ts +50 -5
  6. package/dist/browser.js +8 -6
  7. package/dist/build.cjs +777 -385
  8. package/dist/build.js +15 -15
  9. package/dist/cdn.global.js +11 -7
  10. package/dist/{chunk-JCO7AHNU.js → chunk-3EKJK5FZ.js} +73 -34
  11. package/dist/chunk-4MFZMLUU.js +147 -0
  12. package/dist/chunk-52XFPGSN.js +123 -0
  13. package/dist/chunk-5INI7D2L.js +194 -0
  14. package/dist/{chunk-OAVXAFAY.js → chunk-6LG2T7LO.js} +5 -5
  15. package/dist/{chunk-OOUQUCNN.js → chunk-ACBT6UZS.js} +57 -22
  16. package/dist/{chunk-F7HW2NI5.js → chunk-AW6HPJ3L.js} +1 -1
  17. package/dist/chunk-DHDZ7IVN.js +109 -0
  18. package/dist/{chunk-JNGGM2XE.js → chunk-DQVUBVNX.js} +16 -25
  19. package/dist/{chunk-AXFWGY32.js → chunk-DR7H6UGM.js} +232 -67
  20. package/dist/{chunk-WSGLJYFI.js → chunk-E62UADKL.js} +9 -3
  21. package/dist/{chunk-3Z2NGWQI.js → chunk-ES2GERY2.js} +1 -1
  22. package/dist/{chunk-S3V6ZXPI.js → chunk-EWEE7NBF.js} +115 -41
  23. package/dist/{chunk-3DVGCW7O.js → chunk-F64ZPCFE.js} +8 -8
  24. package/dist/{chunk-APFRCIRI.js → chunk-GCSGGA3Q.js} +295 -198
  25. package/dist/{chunk-EX77FXTT.js → chunk-HYCCIYNS.js} +228 -51
  26. package/dist/{chunk-ELXMRSVN.js → chunk-NF3LYCQH.js} +259 -124
  27. package/dist/chunk-O3QQ3XOL.js +61 -0
  28. package/dist/{chunk-BUKYCWHX.js → chunk-PBQEW5VW.js} +14 -10
  29. package/dist/{chunk-H5FI5WDP.js → chunk-RRIDJQ5C.js} +3 -3
  30. package/dist/{chunk-S3NFJO6L.js → chunk-TIRZCERI.js} +36 -5
  31. package/dist/{chunk-ODXVQ3CS.js → chunk-VFHIVEPF.js} +309 -188
  32. package/dist/chunk-VPP2FONR.js +142 -0
  33. package/dist/{chunk-KZBEVFXZ.js → chunk-W55YHPEP.js} +5 -3
  34. package/dist/{chunk-FKQG7FTY.js → chunk-WN6WDFCB.js} +4 -4
  35. package/dist/{chunk-CEBWDD63.js → chunk-WOOMUJFT.js} +228 -86
  36. package/dist/{chunk-ITWCTZYH.js → chunk-Z2CE42DB.js} +19 -25
  37. package/dist/{contracts-ey_Qh8ef.d.cts → contracts-Hg6ITAEF.d.cts} +6 -6
  38. package/dist/{contracts-ey_Qh8ef.d.ts → contracts-Hg6ITAEF.d.ts} +6 -6
  39. package/dist/{customElement-CPfIrbvg.d.ts → customElement-CKLoO63w.d.cts} +73 -11
  40. package/dist/{customElement-CPfIrbvg.d.cts → customElement-CKLoO63w.d.ts} +73 -11
  41. package/dist/data.cjs +483 -205
  42. package/dist/data.d.cts +139 -7
  43. package/dist/data.d.ts +139 -7
  44. package/dist/data.js +9 -9
  45. package/dist/devtools.cjs +222 -87
  46. package/dist/devtools.js +8 -8
  47. package/dist/dispose-4FZ6OFXR.js +19 -0
  48. package/dist/ecosystem.cjs +419 -175
  49. package/dist/ecosystem.js +11 -11
  50. package/dist/extras.cjs +1981 -765
  51. package/dist/extras.d.cts +7 -7
  52. package/dist/extras.d.ts +7 -7
  53. package/dist/extras.js +29 -26
  54. package/dist/index.cjs +784 -385
  55. package/dist/index.d.cts +299 -28
  56. package/dist/index.d.ts +299 -28
  57. package/dist/index.js +33 -18
  58. package/dist/motion.cjs +180 -50
  59. package/dist/motion.d.cts +26 -0
  60. package/dist/motion.d.ts +26 -0
  61. package/dist/motion.js +5 -5
  62. package/dist/patterns.cjs +437 -170
  63. package/dist/patterns.d.cts +60 -13
  64. package/dist/patterns.d.ts +60 -13
  65. package/dist/patterns.js +7 -7
  66. package/dist/performance.cjs +333 -148
  67. package/dist/performance.d.cts +55 -7
  68. package/dist/performance.d.ts +55 -7
  69. package/dist/performance.js +9 -9
  70. package/dist/plugins.cjs +1374 -576
  71. package/dist/plugins.d.cts +227 -9
  72. package/dist/plugins.d.ts +227 -9
  73. package/dist/plugins.js +613 -321
  74. package/dist/{ssr-D62yFwuw.d.cts → ssr-BiPRdZ6n.d.cts} +44 -15
  75. package/dist/{ssr-D62yFwuw.d.ts → ssr-BiPRdZ6n.d.ts} +44 -15
  76. package/dist/{ssr-2PPULEK2.js → ssr-JFP5535P.js} +5 -4
  77. package/dist/ssr.cjs +1104 -443
  78. package/dist/ssr.d.cts +230 -20
  79. package/dist/ssr.d.ts +230 -20
  80. package/dist/ssr.js +15 -12
  81. package/dist/{startup-0Qv6aosO.d.cts → startup-BMpaiMhP.d.cts} +1 -1
  82. package/dist/{startup-0Qv6aosO.d.ts → startup-BMpaiMhP.d.ts} +1 -1
  83. package/dist/testing.cjs +205 -63
  84. package/dist/testing.d.cts +1 -1
  85. package/dist/testing.d.ts +1 -1
  86. package/dist/testing.js +8 -10
  87. package/dist/ui.cjs +640 -199
  88. package/dist/ui.d.cts +2 -2
  89. package/dist/ui.d.ts +2 -2
  90. package/dist/ui.js +10 -10
  91. package/dist/widgets.cjs +207 -82
  92. package/dist/widgets.js +9 -9
  93. package/package.json +12 -7
  94. package/dist/chunk-5VGSK6D2.js +0 -80
  95. package/dist/chunk-COY6PUD2.js +0 -34
  96. package/dist/chunk-K35BAR4P.js +0 -96
  97. package/dist/chunk-L3GAGWCC.js +0 -111
  98. package/dist/chunk-RT3IYFN2.js +0 -38
@@ -1,5 +1,5 @@
1
- import { T as TrustedHTML } from './ssr-D62yFwuw.cjs';
2
- export { t as trustHTML } from './ssr-D62yFwuw.cjs';
1
+ import { T as TrustedHTML } from './ssr-BiPRdZ6n.cjs';
2
+ export { t as trustHTML } from './ssr-BiPRdZ6n.cjs';
3
3
 
4
4
  declare const Priority: {
5
5
  readonly IMMEDIATE: 0;
@@ -283,7 +283,7 @@ interface NormalizedStoreActions<T> {
283
283
  * const bobs = users.select(u => u.name.startsWith("B"));
284
284
  * ```
285
285
  */
286
- declare function normalizedStore<T extends Record<string, unknown>>(schema: NormalizedSchema): NormalizedStoreActions<T>;
286
+ declare function normalizedStore<T extends object>(schema: NormalizedSchema): NormalizedStoreActions<T>;
287
287
  /** A map of entity type names to their flat entity tables */
288
288
  type NormalizedEntities = Record<string, Record<string, unknown>>;
289
289
  /** Result of normalizing nested data */
@@ -328,7 +328,7 @@ interface NormalizeResult {
328
328
  * // entities.comment["c1"] === { id: "c1", text: "Great!" }
329
329
  * ```
330
330
  */
331
- declare function normalize<T extends Record<string, unknown>>(data: T | T[], schema: NormalizedSchema): NormalizeResult;
331
+ declare function normalize<T extends object>(data: T | T[], schema: NormalizedSchema): NormalizeResult;
332
332
  /**
333
333
  * denormalize reconstructs a nested object from a flat normalized entities
334
334
  * map, resolving relation references back to their full objects.
@@ -345,7 +345,7 @@ declare function normalize<T extends Record<string, unknown>>(data: T | T[], sch
345
345
  * // post.comments is an array of full comment objects
346
346
  * ```
347
347
  */
348
- declare function denormalize<T extends Record<string, unknown>>(id: string, entities: NormalizedEntities, schema: NormalizedSchema): T | undefined;
348
+ declare function denormalize<T extends object>(id: string, entities: NormalizedEntities, schema: NormalizedSchema): T | undefined;
349
349
 
350
350
  /**
351
351
  * Advanced runtime chunk loading with caching strategies for SibuJS.
@@ -371,6 +371,44 @@ interface ChunkConfig {
371
371
  }
372
372
  /**
373
373
  * Central registry for managing dynamic chunks with caching and lifecycle callbacks.
374
+ *
375
+ * INVALIDATION IS A PUBLICATION BARRIER
376
+ * ------------------------------------
377
+ * `invalidate(id)` and `clear()` used to delete cache entries and leave the
378
+ * `pending` map untouched, so an in-flight load that started *before* the
379
+ * invalidation still ran its `.then` afterwards and wrote the now-stale value
380
+ * back into the cache. The sequence
381
+ *
382
+ * load("a") starts → clear() → old load resolves → cache.set("a", stale)
383
+ *
384
+ * left `has("a") === true` holding data the caller had explicitly discarded.
385
+ * The same load also ran `pending.delete(id)` unconditionally, so a *newer*
386
+ * pending entry for the same id was removed by its predecessor's settlement.
387
+ * And because the stale promise stayed in `pending`, a `load(id, freshLoader)`
388
+ * issued after the invalidation deduplicated against it: the new loader was
389
+ * never called and the caller received the stale value.
390
+ *
391
+ * OWNERSHIP IS THE PENDING ENTRY ITSELF. Each load creates an entry object and
392
+ * installs it in `pending`; that object *is* the load's claim on the key.
393
+ * `invalidate(id)` removes the key's entry and `clear()` removes all of them,
394
+ * which revokes the claim without needing a generation counter or any map that
395
+ * grows over time. On settlement a load re-reads `pending.get(id)` and only
396
+ * publishes or cleans up when it finds its own entry still there.
397
+ *
398
+ * Work started before an invalidation still resolves or rejects normally *for
399
+ * its original caller* — it simply cannot touch shared state any more. Nothing
400
+ * is cancelled: the loader API takes no abort signal, so no cancellation is
401
+ * claimed here.
402
+ *
403
+ * LIFECYCLE CALLBACKS ARE OBSERVERS
404
+ * ---------------------------------
405
+ * `onLoadStart` / `onLoadEnd` / `onLoadError` used to run inside the operation's
406
+ * control flow. `onLoadStart` ran before the loader, so a throwing one stopped
407
+ * the load from ever starting; `onLoadEnd` ran inside the `.then`, so a throwing
408
+ * one converted a cached success into a rejection *and* then delivered the
409
+ * observer's own error to `onLoadError`, leaving the caller told "failed" while
410
+ * the cache held the value. Every callback now runs through `notify`, which
411
+ * contains and reports the failure without letting it reach the operation.
374
412
  */
375
413
  declare function createChunkRegistry(config?: ChunkConfig): {
376
414
  load: <T>(id: string, loader: () => Promise<T>) => Promise<T>;
@@ -391,15 +429,25 @@ declare function createChunkRegistry(config?: ChunkConfig): {
391
429
  */
392
430
  get<T>(id: string): T | undefined;
393
431
  /**
394
- * Invalidate a cached chunk.
432
+ * Invalidate a cached chunk, and supersede any load still in flight for it.
433
+ *
434
+ * In-flight work is not cancelled — the loader API takes no abort signal, so
435
+ * claiming cancellation would be a lie. It is *superseded*: it still settles
436
+ * for whoever called `load()`, but it can no longer write to the cache, and
437
+ * a subsequent `load(id, …)` starts fresh work rather than adopting it.
395
438
  */
396
439
  invalidate(id: string): void;
397
440
  /**
398
- * Clear all cached chunks.
441
+ * Clear all cached chunks, and supersede every load still in flight.
442
+ *
443
+ * Same barrier as `invalidate`, applied to every key at once.
399
444
  */
400
445
  clear(): void;
401
446
  /**
402
447
  * Get cache statistics.
448
+ *
449
+ * Describes currently OWNED state: superseded loads are already absent from
450
+ * `pending`, so the counts never include work whose result will be discarded.
403
451
  */
404
452
  stats(): {
405
453
  size: number;
@@ -1,5 +1,5 @@
1
- import { T as TrustedHTML } from './ssr-D62yFwuw.js';
2
- export { t as trustHTML } from './ssr-D62yFwuw.js';
1
+ import { T as TrustedHTML } from './ssr-BiPRdZ6n.js';
2
+ export { t as trustHTML } from './ssr-BiPRdZ6n.js';
3
3
 
4
4
  declare const Priority: {
5
5
  readonly IMMEDIATE: 0;
@@ -283,7 +283,7 @@ interface NormalizedStoreActions<T> {
283
283
  * const bobs = users.select(u => u.name.startsWith("B"));
284
284
  * ```
285
285
  */
286
- declare function normalizedStore<T extends Record<string, unknown>>(schema: NormalizedSchema): NormalizedStoreActions<T>;
286
+ declare function normalizedStore<T extends object>(schema: NormalizedSchema): NormalizedStoreActions<T>;
287
287
  /** A map of entity type names to their flat entity tables */
288
288
  type NormalizedEntities = Record<string, Record<string, unknown>>;
289
289
  /** Result of normalizing nested data */
@@ -328,7 +328,7 @@ interface NormalizeResult {
328
328
  * // entities.comment["c1"] === { id: "c1", text: "Great!" }
329
329
  * ```
330
330
  */
331
- declare function normalize<T extends Record<string, unknown>>(data: T | T[], schema: NormalizedSchema): NormalizeResult;
331
+ declare function normalize<T extends object>(data: T | T[], schema: NormalizedSchema): NormalizeResult;
332
332
  /**
333
333
  * denormalize reconstructs a nested object from a flat normalized entities
334
334
  * map, resolving relation references back to their full objects.
@@ -345,7 +345,7 @@ declare function normalize<T extends Record<string, unknown>>(data: T | T[], sch
345
345
  * // post.comments is an array of full comment objects
346
346
  * ```
347
347
  */
348
- declare function denormalize<T extends Record<string, unknown>>(id: string, entities: NormalizedEntities, schema: NormalizedSchema): T | undefined;
348
+ declare function denormalize<T extends object>(id: string, entities: NormalizedEntities, schema: NormalizedSchema): T | undefined;
349
349
 
350
350
  /**
351
351
  * Advanced runtime chunk loading with caching strategies for SibuJS.
@@ -371,6 +371,44 @@ interface ChunkConfig {
371
371
  }
372
372
  /**
373
373
  * Central registry for managing dynamic chunks with caching and lifecycle callbacks.
374
+ *
375
+ * INVALIDATION IS A PUBLICATION BARRIER
376
+ * ------------------------------------
377
+ * `invalidate(id)` and `clear()` used to delete cache entries and leave the
378
+ * `pending` map untouched, so an in-flight load that started *before* the
379
+ * invalidation still ran its `.then` afterwards and wrote the now-stale value
380
+ * back into the cache. The sequence
381
+ *
382
+ * load("a") starts → clear() → old load resolves → cache.set("a", stale)
383
+ *
384
+ * left `has("a") === true` holding data the caller had explicitly discarded.
385
+ * The same load also ran `pending.delete(id)` unconditionally, so a *newer*
386
+ * pending entry for the same id was removed by its predecessor's settlement.
387
+ * And because the stale promise stayed in `pending`, a `load(id, freshLoader)`
388
+ * issued after the invalidation deduplicated against it: the new loader was
389
+ * never called and the caller received the stale value.
390
+ *
391
+ * OWNERSHIP IS THE PENDING ENTRY ITSELF. Each load creates an entry object and
392
+ * installs it in `pending`; that object *is* the load's claim on the key.
393
+ * `invalidate(id)` removes the key's entry and `clear()` removes all of them,
394
+ * which revokes the claim without needing a generation counter or any map that
395
+ * grows over time. On settlement a load re-reads `pending.get(id)` and only
396
+ * publishes or cleans up when it finds its own entry still there.
397
+ *
398
+ * Work started before an invalidation still resolves or rejects normally *for
399
+ * its original caller* — it simply cannot touch shared state any more. Nothing
400
+ * is cancelled: the loader API takes no abort signal, so no cancellation is
401
+ * claimed here.
402
+ *
403
+ * LIFECYCLE CALLBACKS ARE OBSERVERS
404
+ * ---------------------------------
405
+ * `onLoadStart` / `onLoadEnd` / `onLoadError` used to run inside the operation's
406
+ * control flow. `onLoadStart` ran before the loader, so a throwing one stopped
407
+ * the load from ever starting; `onLoadEnd` ran inside the `.then`, so a throwing
408
+ * one converted a cached success into a rejection *and* then delivered the
409
+ * observer's own error to `onLoadError`, leaving the caller told "failed" while
410
+ * the cache held the value. Every callback now runs through `notify`, which
411
+ * contains and reports the failure without letting it reach the operation.
374
412
  */
375
413
  declare function createChunkRegistry(config?: ChunkConfig): {
376
414
  load: <T>(id: string, loader: () => Promise<T>) => Promise<T>;
@@ -391,15 +429,25 @@ declare function createChunkRegistry(config?: ChunkConfig): {
391
429
  */
392
430
  get<T>(id: string): T | undefined;
393
431
  /**
394
- * Invalidate a cached chunk.
432
+ * Invalidate a cached chunk, and supersede any load still in flight for it.
433
+ *
434
+ * In-flight work is not cancelled — the loader API takes no abort signal, so
435
+ * claiming cancellation would be a lie. It is *superseded*: it still settles
436
+ * for whoever called `load()`, but it can no longer write to the cache, and
437
+ * a subsequent `load(id, …)` starts fresh work rather than adopting it.
395
438
  */
396
439
  invalidate(id: string): void;
397
440
  /**
398
- * Clear all cached chunks.
441
+ * Clear all cached chunks, and supersede every load still in flight.
442
+ *
443
+ * Same barrier as `invalidate`, applied to every key at once.
399
444
  */
400
445
  clear(): void;
401
446
  /**
402
447
  * Get cache statistics.
448
+ *
449
+ * Describes currently OWNED state: superseded loads are already absent from
450
+ * `pending`, so the counts never include work whose result will be discarded.
403
451
  */
404
452
  stats(): {
405
453
  size: number;
@@ -33,18 +33,18 @@ import {
33
33
  transitionState,
34
34
  uniqueId,
35
35
  yieldToMain
36
- } from "./chunk-JCO7AHNU.js";
36
+ } from "./chunk-3EKJK5FZ.js";
37
37
  import {
38
38
  trustHTML
39
- } from "./chunk-EX77FXTT.js";
39
+ } from "./chunk-HYCCIYNS.js";
40
+ import "./chunk-5INI7D2L.js";
40
41
  import "./chunk-7ZHH77QA.js";
41
- import "./chunk-L3GAGWCC.js";
42
- import "./chunk-BUKYCWHX.js";
43
- import "./chunk-S3NFJO6L.js";
44
- import "./chunk-5VGSK6D2.js";
45
- import "./chunk-KZBEVFXZ.js";
46
- import "./chunk-OOUQUCNN.js";
47
- import "./chunk-COY6PUD2.js";
42
+ import "./chunk-PBQEW5VW.js";
43
+ import "./chunk-TIRZCERI.js";
44
+ import "./chunk-DHDZ7IVN.js";
45
+ import "./chunk-W55YHPEP.js";
46
+ import "./chunk-ACBT6UZS.js";
47
+ import "./chunk-VPP2FONR.js";
48
48
  export {
49
49
  DOMPool,
50
50
  Features,