sibujs 4.9.0 → 4.10.1

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 (62) hide show
  1. package/dist/browser.cjs +41 -4
  2. package/dist/browser.js +4 -4
  3. package/dist/build.cjs +102 -38
  4. package/dist/build.js +10 -10
  5. package/dist/cdn.dev.global.js +14 -14
  6. package/dist/cdn.full.dev.global.js +13 -13
  7. package/dist/cdn.full.global.js +12 -12
  8. package/dist/cdn.global.js +15 -15
  9. package/dist/{chunk-7OV5Q2UU.js → chunk-2D47RVVK.js} +4 -4
  10. package/dist/{chunk-5MLWTIQE.js → chunk-2T73SWKF.js} +2 -2
  11. package/dist/{chunk-YW6HQKGO.js → chunk-42REZXE4.js} +2 -2
  12. package/dist/{chunk-SBTZEYNI.js → chunk-6DYRY2NF.js} +8 -1
  13. package/dist/{chunk-562UVHMM.js → chunk-ADJEMTRC.js} +11 -6
  14. package/dist/{chunk-SYHGGDNW.js → chunk-BNZDDNBR.js} +1 -1
  15. package/dist/{chunk-K6K5ACO6.js → chunk-CID4BYBF.js} +3 -3
  16. package/dist/{chunk-TV464N2M.js → chunk-CYUU3XXG.js} +3 -3
  17. package/dist/{chunk-FNOK662L.js → chunk-CZINTERN.js} +73 -43
  18. package/dist/{chunk-CDBKFGXN.js → chunk-DA2LJXK3.js} +1 -1
  19. package/dist/{chunk-MPWDSTYK.js → chunk-DS6PFIZK.js} +1 -1
  20. package/dist/{chunk-XJVTQUIV.js → chunk-GEQNWNYS.js} +5 -5
  21. package/dist/{chunk-FHCZMHHE.js → chunk-GVVZPMA5.js} +1 -1
  22. package/dist/{chunk-NQMKWBKU.js → chunk-HZQEL575.js} +1 -1
  23. package/dist/{chunk-CF2KCWRE.js → chunk-JZMLRF2G.js} +2 -2
  24. package/dist/{chunk-X7NRHFZR.js → chunk-LK3VK47W.js} +1 -1
  25. package/dist/{chunk-2K3Z3XO4.js → chunk-LYM6TT2R.js} +4 -4
  26. package/dist/{chunk-KG25XMGP.js → chunk-MJZUXQHR.js} +15 -8
  27. package/dist/{chunk-G2WHYEL7.js → chunk-NROLUUCO.js} +39 -4
  28. package/dist/{chunk-DRMLIF6M.js → chunk-WHZKRSHQ.js} +19 -12
  29. package/dist/{chunk-QBKCK6MJ.js → chunk-YNE4FSVX.js} +1 -1
  30. package/dist/data.cjs +48 -6
  31. package/dist/data.d.cts +9 -1
  32. package/dist/data.d.ts +9 -1
  33. package/dist/data.js +5 -5
  34. package/dist/devtools.cjs +41 -4
  35. package/dist/devtools.js +4 -4
  36. package/dist/ecosystem.cjs +41 -4
  37. package/dist/ecosystem.js +7 -7
  38. package/dist/extras.cjs +75 -25
  39. package/dist/extras.js +20 -20
  40. package/dist/index.cjs +102 -38
  41. package/dist/index.d.cts +32 -4
  42. package/dist/index.d.ts +32 -4
  43. package/dist/index.js +10 -10
  44. package/dist/motion.cjs +36 -4
  45. package/dist/motion.js +3 -3
  46. package/dist/patterns.cjs +41 -4
  47. package/dist/patterns.js +5 -5
  48. package/dist/performance.cjs +55 -14
  49. package/dist/performance.js +4 -4
  50. package/dist/plugins.cjs +163 -51
  51. package/dist/plugins.d.cts +56 -2
  52. package/dist/plugins.d.ts +56 -2
  53. package/dist/plugins.js +130 -52
  54. package/dist/ssr.cjs +50 -9
  55. package/dist/ssr.js +7 -7
  56. package/dist/testing.cjs +41 -4
  57. package/dist/testing.js +2 -2
  58. package/dist/ui.cjs +41 -4
  59. package/dist/ui.js +7 -7
  60. package/dist/widgets.cjs +36 -4
  61. package/dist/widgets.js +6 -6
  62. package/package.json +1 -1
package/dist/testing.cjs CHANGED
@@ -407,6 +407,24 @@ function untracked(fn) {
407
407
  resumeTracking();
408
408
  }
409
409
  }
410
+ var currentOwnerScope = null;
411
+ function getOwnerScope() {
412
+ return currentOwnerScope;
413
+ }
414
+ function runWithOwnerScope(scope, fn) {
415
+ const prev = currentOwnerScope;
416
+ currentOwnerScope = scope;
417
+ try {
418
+ return fn();
419
+ } finally {
420
+ currentOwnerScope = prev;
421
+ }
422
+ }
423
+ function bindOwnerScope(fn) {
424
+ const scope = currentOwnerScope;
425
+ if (scope === null) return fn;
426
+ return (...args) => runWithOwnerScope(scope, () => fn(...args));
427
+ }
410
428
  var subscriberEpochCounter = 0;
411
429
  function retrack(effectFn, subscriber) {
412
430
  const prev = currentSubscriber;
@@ -422,6 +440,10 @@ function retrack(effectFn, subscriber) {
422
440
  currentSubscriber = subscriber;
423
441
  const sub = subscriber;
424
442
  if (sub._cap === void 0) sub._cap = currentDisposerCapture();
443
+ const prevScope = currentOwnerScope;
444
+ if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
445
+ const scope = sub._scope === void 0 ? null : sub._scope;
446
+ if (scope !== prevScope) currentOwnerScope = scope;
425
447
  const epoch = ++subscriberEpochCounter;
426
448
  sub._epoch = epoch;
427
449
  sub._structDirty = false;
@@ -434,6 +456,7 @@ function retrack(effectFn, subscriber) {
434
456
  effectFn();
435
457
  } finally {
436
458
  currentSubscriber = prev;
459
+ currentOwnerScope = prevScope;
437
460
  if (savedDepth !== 0) {
438
461
  suspendDepth = savedDepth;
439
462
  suspendSavedSub = savedSuspendSub;
@@ -468,23 +491,26 @@ function track(effectFn, subscriber) {
468
491
  trackingSuspended = false;
469
492
  }
470
493
  currentSubscriber = subscriber;
494
+ const sub = subscriber;
495
+ if (sub._scope === void 0) sub._scope = currentOwnerScope;
496
+ const prevScope = currentOwnerScope;
497
+ currentOwnerScope = sub._scope;
471
498
  try {
472
499
  effectFn();
473
500
  } finally {
474
501
  currentSubscriber = prev;
502
+ currentOwnerScope = prevScope;
475
503
  if (savedDepth !== 0) {
476
504
  suspendDepth = savedDepth;
477
505
  suspendSavedSub = savedSuspendSub;
478
506
  trackingSuspended = true;
479
507
  }
480
- const sub2 = subscriber;
481
- for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
508
+ for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
482
509
  const sig = n.sig;
483
510
  sig.__activeNode = n.prevActive;
484
511
  n.prevActive = null;
485
512
  }
486
513
  }
487
- const sub = subscriber;
488
514
  return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
489
515
  }
490
516
  function reactiveBinding(commit, ownerNode) {
@@ -754,7 +780,7 @@ function forEachSubscriber(signal, visit) {
754
780
  }
755
781
 
756
782
  // src/reactivity/track.ts
757
- var _runtimeVersion = true ? "4.9.0" : "dev";
783
+ var _runtimeVersion = true ? "4.10.1" : "dev";
758
784
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
759
785
  function resolveReactiveApi() {
760
786
  const g = globalThis;
@@ -786,6 +812,9 @@ function resolveReactiveApi() {
786
812
  getSubscriberCount,
787
813
  getSubscriberDeps,
788
814
  forEachSubscriber,
815
+ getOwnerScope,
816
+ runWithOwnerScope,
817
+ bindOwnerScope,
789
818
  version: _runtimeVersion
790
819
  };
791
820
  g[REGISTRY_KEY] = local;
@@ -809,6 +838,9 @@ var notifySubscribers2 = API.notifySubscribers;
809
838
  var getSubscriberCount2 = API.getSubscriberCount;
810
839
  var getSubscriberDeps2 = API.getSubscriberDeps;
811
840
  var forEachSubscriber2 = API.forEachSubscriber;
841
+ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
842
+ var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
843
+ var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
812
844
 
813
845
  // src/core/devtoolsHook.ts
814
846
  function emitDevtools(hook, event, payload) {
@@ -864,6 +896,11 @@ function flushUserCleanups(ctx) {
864
896
  const list = ctx.userCleanups;
865
897
  if (list.length === 0) return;
866
898
  ctx.userCleanups = [];
899
+ const scope = ctx.subscriber._scope ?? null;
900
+ if (scope === getOwnerScope2()) runCleanups(list);
901
+ else runWithOwnerScope2(scope, () => runCleanups(list));
902
+ }
903
+ function runCleanups(list) {
867
904
  for (let i = list.length - 1; i >= 0; i--) {
868
905
  try {
869
906
  list[i]();
package/dist/testing.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-7ZHH77QA.js";
4
4
  import {
5
5
  effect
6
- } from "./chunk-SBTZEYNI.js";
6
+ } from "./chunk-6DYRY2NF.js";
7
7
  import "./chunk-7XHATCIH.js";
8
- import "./chunk-G2WHYEL7.js";
8
+ import "./chunk-NROLUUCO.js";
9
9
  import {
10
10
  dispose,
11
11
  replaceChildrenSafely,
package/dist/ui.cjs CHANGED
@@ -487,6 +487,24 @@ function untracked(fn) {
487
487
  resumeTracking();
488
488
  }
489
489
  }
490
+ var currentOwnerScope = null;
491
+ function getOwnerScope() {
492
+ return currentOwnerScope;
493
+ }
494
+ function runWithOwnerScope(scope, fn) {
495
+ const prev = currentOwnerScope;
496
+ currentOwnerScope = scope;
497
+ try {
498
+ return fn();
499
+ } finally {
500
+ currentOwnerScope = prev;
501
+ }
502
+ }
503
+ function bindOwnerScope(fn) {
504
+ const scope = currentOwnerScope;
505
+ if (scope === null) return fn;
506
+ return (...args) => runWithOwnerScope(scope, () => fn(...args));
507
+ }
490
508
  var subscriberEpochCounter = 0;
491
509
  function retrack(effectFn, subscriber) {
492
510
  const prev = currentSubscriber;
@@ -502,6 +520,10 @@ function retrack(effectFn, subscriber) {
502
520
  currentSubscriber = subscriber;
503
521
  const sub = subscriber;
504
522
  if (sub._cap === void 0) sub._cap = currentDisposerCapture();
523
+ const prevScope = currentOwnerScope;
524
+ if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
525
+ const scope = sub._scope === void 0 ? null : sub._scope;
526
+ if (scope !== prevScope) currentOwnerScope = scope;
505
527
  const epoch = ++subscriberEpochCounter;
506
528
  sub._epoch = epoch;
507
529
  sub._structDirty = false;
@@ -514,6 +536,7 @@ function retrack(effectFn, subscriber) {
514
536
  effectFn();
515
537
  } finally {
516
538
  currentSubscriber = prev;
539
+ currentOwnerScope = prevScope;
517
540
  if (savedDepth !== 0) {
518
541
  suspendDepth = savedDepth;
519
542
  suspendSavedSub = savedSuspendSub;
@@ -548,23 +571,26 @@ function track(effectFn, subscriber) {
548
571
  trackingSuspended = false;
549
572
  }
550
573
  currentSubscriber = subscriber;
574
+ const sub = subscriber;
575
+ if (sub._scope === void 0) sub._scope = currentOwnerScope;
576
+ const prevScope = currentOwnerScope;
577
+ currentOwnerScope = sub._scope;
551
578
  try {
552
579
  effectFn();
553
580
  } finally {
554
581
  currentSubscriber = prev;
582
+ currentOwnerScope = prevScope;
555
583
  if (savedDepth !== 0) {
556
584
  suspendDepth = savedDepth;
557
585
  suspendSavedSub = savedSuspendSub;
558
586
  trackingSuspended = true;
559
587
  }
560
- const sub2 = subscriber;
561
- for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
588
+ for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
562
589
  const sig = n.sig;
563
590
  sig.__activeNode = n.prevActive;
564
591
  n.prevActive = null;
565
592
  }
566
593
  }
567
- const sub = subscriber;
568
594
  return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
569
595
  }
570
596
  function reactiveBinding(commit, ownerNode) {
@@ -834,7 +860,7 @@ function forEachSubscriber(signal2, visit) {
834
860
  }
835
861
 
836
862
  // src/reactivity/track.ts
837
- var _runtimeVersion = true ? "4.9.0" : "dev";
863
+ var _runtimeVersion = true ? "4.10.1" : "dev";
838
864
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
839
865
  function resolveReactiveApi() {
840
866
  const g = globalThis;
@@ -866,6 +892,9 @@ function resolveReactiveApi() {
866
892
  getSubscriberCount,
867
893
  getSubscriberDeps,
868
894
  forEachSubscriber,
895
+ getOwnerScope,
896
+ runWithOwnerScope,
897
+ bindOwnerScope,
869
898
  version: _runtimeVersion
870
899
  };
871
900
  g[REGISTRY_KEY] = local;
@@ -889,6 +918,9 @@ var notifySubscribers2 = API.notifySubscribers;
889
918
  var getSubscriberCount2 = API.getSubscriberCount;
890
919
  var getSubscriberDeps2 = API.getSubscriberDeps;
891
920
  var forEachSubscriber2 = API.forEachSubscriber;
921
+ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
922
+ var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
923
+ var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
892
924
 
893
925
  // src/core/devtoolsHook.ts
894
926
  function emitDevtools(hook, event, payload) {
@@ -3447,6 +3479,11 @@ function flushUserCleanups(ctx) {
3447
3479
  const list = ctx.userCleanups;
3448
3480
  if (list.length === 0) return;
3449
3481
  ctx.userCleanups = [];
3482
+ const scope = ctx.subscriber._scope ?? null;
3483
+ if (scope === getOwnerScope2()) runCleanups(list);
3484
+ else runWithOwnerScope2(scope, () => runCleanups(list));
3485
+ }
3486
+ function runCleanups(list) {
3450
3487
  for (let i = list.length - 1; i >= 0; i--) {
3451
3488
  try {
3452
3489
  list[i]();
package/dist/ui.js CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  toast,
39
39
  withScopedStyle,
40
40
  zipMask
41
- } from "./chunk-XJVTQUIV.js";
41
+ } from "./chunk-GEQNWNYS.js";
42
42
  import {
43
43
  RenderProp,
44
44
  assertType,
@@ -57,24 +57,24 @@ import {
57
57
  } from "./chunk-TUCPL2HB.js";
58
58
  import {
59
59
  createId
60
- } from "./chunk-FHCZMHHE.js";
61
- import "./chunk-MPWDSTYK.js";
60
+ } from "./chunk-GVVZPMA5.js";
61
+ import "./chunk-DS6PFIZK.js";
62
62
  import "./chunk-3ACAAQIN.js";
63
- import "./chunk-X7NRHFZR.js";
63
+ import "./chunk-LK3VK47W.js";
64
64
  import {
65
65
  globalSingleton
66
66
  } from "./chunk-7ZHH77QA.js";
67
67
  import {
68
68
  effect
69
- } from "./chunk-SBTZEYNI.js";
69
+ } from "./chunk-6DYRY2NF.js";
70
70
  import "./chunk-EXXSN3BW.js";
71
71
  import "./chunk-7XHATCIH.js";
72
72
  import "./chunk-5HZXGZ6T.js";
73
73
  import {
74
74
  batch,
75
75
  signal
76
- } from "./chunk-SYHGGDNW.js";
77
- import "./chunk-G2WHYEL7.js";
76
+ } from "./chunk-BNZDDNBR.js";
77
+ import "./chunk-NROLUUCO.js";
78
78
  import {
79
79
  registerDisposer,
80
80
  unregisterDisposer
package/dist/widgets.cjs CHANGED
@@ -362,6 +362,24 @@ function untracked(fn) {
362
362
  resumeTracking();
363
363
  }
364
364
  }
365
+ var currentOwnerScope = null;
366
+ function getOwnerScope() {
367
+ return currentOwnerScope;
368
+ }
369
+ function runWithOwnerScope(scope, fn) {
370
+ const prev = currentOwnerScope;
371
+ currentOwnerScope = scope;
372
+ try {
373
+ return fn();
374
+ } finally {
375
+ currentOwnerScope = prev;
376
+ }
377
+ }
378
+ function bindOwnerScope(fn) {
379
+ const scope = currentOwnerScope;
380
+ if (scope === null) return fn;
381
+ return (...args) => runWithOwnerScope(scope, () => fn(...args));
382
+ }
365
383
  var subscriberEpochCounter = 0;
366
384
  function retrack(effectFn, subscriber) {
367
385
  const prev = currentSubscriber;
@@ -377,6 +395,10 @@ function retrack(effectFn, subscriber) {
377
395
  currentSubscriber = subscriber;
378
396
  const sub = subscriber;
379
397
  if (sub._cap === void 0) sub._cap = currentDisposerCapture();
398
+ const prevScope = currentOwnerScope;
399
+ if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
400
+ const scope = sub._scope === void 0 ? null : sub._scope;
401
+ if (scope !== prevScope) currentOwnerScope = scope;
380
402
  const epoch = ++subscriberEpochCounter;
381
403
  sub._epoch = epoch;
382
404
  sub._structDirty = false;
@@ -389,6 +411,7 @@ function retrack(effectFn, subscriber) {
389
411
  effectFn();
390
412
  } finally {
391
413
  currentSubscriber = prev;
414
+ currentOwnerScope = prevScope;
392
415
  if (savedDepth !== 0) {
393
416
  suspendDepth = savedDepth;
394
417
  suspendSavedSub = savedSuspendSub;
@@ -423,23 +446,26 @@ function track(effectFn, subscriber) {
423
446
  trackingSuspended = false;
424
447
  }
425
448
  currentSubscriber = subscriber;
449
+ const sub = subscriber;
450
+ if (sub._scope === void 0) sub._scope = currentOwnerScope;
451
+ const prevScope = currentOwnerScope;
452
+ currentOwnerScope = sub._scope;
426
453
  try {
427
454
  effectFn();
428
455
  } finally {
429
456
  currentSubscriber = prev;
457
+ currentOwnerScope = prevScope;
430
458
  if (savedDepth !== 0) {
431
459
  suspendDepth = savedDepth;
432
460
  suspendSavedSub = savedSuspendSub;
433
461
  trackingSuspended = true;
434
462
  }
435
- const sub2 = subscriber;
436
- for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
463
+ for (let n = sub.depsHead ?? null; n !== null; n = n.subNext) {
437
464
  const sig = n.sig;
438
465
  sig.__activeNode = n.prevActive;
439
466
  n.prevActive = null;
440
467
  }
441
468
  }
442
- const sub = subscriber;
443
469
  return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
444
470
  }
445
471
  function reactiveBinding(commit, ownerNode) {
@@ -709,7 +735,7 @@ function forEachSubscriber(signal2, visit) {
709
735
  }
710
736
 
711
737
  // src/reactivity/track.ts
712
- var _runtimeVersion = true ? "4.9.0" : "dev";
738
+ var _runtimeVersion = true ? "4.10.1" : "dev";
713
739
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
714
740
  function resolveReactiveApi() {
715
741
  const g = globalThis;
@@ -741,6 +767,9 @@ function resolveReactiveApi() {
741
767
  getSubscriberCount,
742
768
  getSubscriberDeps,
743
769
  forEachSubscriber,
770
+ getOwnerScope,
771
+ runWithOwnerScope,
772
+ bindOwnerScope,
744
773
  version: _runtimeVersion
745
774
  };
746
775
  g[REGISTRY_KEY] = local;
@@ -764,6 +793,9 @@ var notifySubscribers2 = API.notifySubscribers;
764
793
  var getSubscriberCount2 = API.getSubscriberCount;
765
794
  var getSubscriberDeps2 = API.getSubscriberDeps;
766
795
  var forEachSubscriber2 = API.forEachSubscriber;
796
+ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
797
+ var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
798
+ var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
767
799
 
768
800
  // src/core/devtoolsHook.ts
769
801
  function emitDevtools(hook, event, payload) {
package/dist/widgets.js CHANGED
@@ -8,14 +8,14 @@ import {
8
8
  select,
9
9
  tabs,
10
10
  tooltip
11
- } from "./chunk-2K3Z3XO4.js";
12
- import "./chunk-CDBKFGXN.js";
13
- import "./chunk-FHCZMHHE.js";
14
- import "./chunk-X7NRHFZR.js";
11
+ } from "./chunk-LYM6TT2R.js";
12
+ import "./chunk-DA2LJXK3.js";
13
+ import "./chunk-GVVZPMA5.js";
14
+ import "./chunk-LK3VK47W.js";
15
15
  import "./chunk-EXXSN3BW.js";
16
16
  import "./chunk-7XHATCIH.js";
17
- import "./chunk-SYHGGDNW.js";
18
- import "./chunk-G2WHYEL7.js";
17
+ import "./chunk-BNZDDNBR.js";
18
+ import "./chunk-NROLUUCO.js";
19
19
  import "./chunk-NYNYSPK7.js";
20
20
  export {
21
21
  accordion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sibujs",
3
- "version": "4.9.0",
3
+ "version": "4.10.1",
4
4
  "description": "A function-based frontend framework with fine-grained reactivity and no virtual DOM. Tag factories return live DOM nodes you can hold and mutate, signals update only what changed, and nothing needs a compiler — it runs from a script tag or a bundler.",
5
5
  "keywords": [
6
6
  "frontend",