sibujs 3.3.0 → 3.3.2

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 (60) hide show
  1. package/dist/browser.cjs +230 -40
  2. package/dist/browser.js +5 -5
  3. package/dist/build.cjs +240 -108
  4. package/dist/build.js +13 -13
  5. package/dist/cdn.global.js +7 -7
  6. package/dist/{chunk-BEIKESVL.js → chunk-2ARSB7NG.js} +36 -13
  7. package/dist/{chunk-X3NHE2DK.js → chunk-4NJEAPLI.js} +83 -17
  8. package/dist/{chunk-JBXNCZSC.js → chunk-5VH3GIDX.js} +1 -1
  9. package/dist/{chunk-6G6UNHZI.js → chunk-62V653X2.js} +16 -21
  10. package/dist/{chunk-S4FHR5ZZ.js → chunk-655B7MMR.js} +3 -3
  11. package/dist/{chunk-24DBWDTK.js → chunk-6TCOWMGY.js} +1 -1
  12. package/dist/{chunk-USDR2GFV.js → chunk-A7CZH3GN.js} +3 -3
  13. package/dist/{chunk-SLCUP2EK.js → chunk-AEOLHSSQ.js} +3 -3
  14. package/dist/chunk-CCSJMTRN.js +15 -0
  15. package/dist/{chunk-R3QEDXFS.js → chunk-EX77FXTT.js} +1 -1
  16. package/dist/{chunk-ZUVLC7TM.js → chunk-FJIRS3FM.js} +1 -1
  17. package/dist/{chunk-4WXWJ4SW.js → chunk-FJO2ZL4Q.js} +4 -4
  18. package/dist/{chunk-CVMMULHO.js → chunk-G6N3LMO2.js} +4 -4
  19. package/dist/{chunk-XQ7XSGYP.js → chunk-IQJ36UTJ.js} +1 -1
  20. package/dist/{chunk-5K72I3UQ.js → chunk-JCQG2I2G.js} +21 -4
  21. package/dist/{chunk-7JHWAGRQ.js → chunk-N5TQVEKE.js} +2 -2
  22. package/dist/{chunk-IHBVTURX.js → chunk-P7C7SEJV.js} +4 -4
  23. package/dist/{chunk-M6WSIGYW.js → chunk-Q46YIQYW.js} +2 -2
  24. package/dist/{chunk-Q2ERM6NT.js → chunk-QCFBIVIQ.js} +1 -1
  25. package/dist/{chunk-F4UM7QBJ.js → chunk-RLTFJYDN.js} +2 -2
  26. package/dist/{chunk-GOJMFRBL.js → chunk-S3NFJO6L.js} +20 -14
  27. package/dist/{chunk-MWZFOIBG.js → chunk-YUBEOWII.js} +5 -5
  28. package/dist/{chunk-WVJJUFPC.js → chunk-YUR5SX7F.js} +2 -2
  29. package/dist/{chunk-NUWKIEHE.js → chunk-ZEUP4TUD.js} +2 -2
  30. package/dist/data.cjs +181 -37
  31. package/dist/data.js +7 -7
  32. package/dist/devtools.cjs +265 -45
  33. package/dist/devtools.js +5 -5
  34. package/dist/ecosystem.cjs +203 -59
  35. package/dist/ecosystem.js +8 -8
  36. package/dist/extras.cjs +216 -116
  37. package/dist/extras.js +22 -22
  38. package/dist/index.cjs +242 -108
  39. package/dist/index.d.cts +78 -14
  40. package/dist/index.d.ts +78 -14
  41. package/dist/index.js +17 -13
  42. package/dist/motion.cjs +329 -13
  43. package/dist/motion.js +3 -3
  44. package/dist/patterns.cjs +181 -37
  45. package/dist/patterns.js +6 -6
  46. package/dist/performance.cjs +278 -37
  47. package/dist/performance.js +6 -6
  48. package/dist/plugins.cjs +353 -153
  49. package/dist/plugins.js +95 -94
  50. package/dist/{ssr-6D67RAVB.js → ssr-2PPULEK2.js} +2 -2
  51. package/dist/ssr.cjs +203 -58
  52. package/dist/ssr.js +9 -9
  53. package/dist/testing.cjs +416 -19
  54. package/dist/testing.js +3 -3
  55. package/dist/ui.cjs +256 -65
  56. package/dist/ui.js +8 -8
  57. package/dist/widgets.cjs +166 -40
  58. package/dist/widgets.js +7 -7
  59. package/package.json +1 -1
  60. package/dist/chunk-YT6HQ6AM.js +0 -14
package/dist/extras.cjs CHANGED
@@ -145,7 +145,7 @@ __export(extras_exports, {
145
145
  getPerformanceReport: () => getPerformanceReport,
146
146
  getQueryData: () => getQueryData,
147
147
  getSignalName: () => getSignalName,
148
- getSubscriberCount: () => getSubscriberCount2,
148
+ getSubscriberCount: () => getSubscriberCount3,
149
149
  globalStore: () => globalStore,
150
150
  healthCheck: () => healthCheck,
151
151
  hmrState: () => hmrState,
@@ -337,7 +337,7 @@ function devWarn(message) {
337
337
  }
338
338
  }
339
339
 
340
- // src/reactivity/track.ts
340
+ // src/reactivity/track-core.ts
341
341
  var _isDev2 = isDev();
342
342
  var POOL_MAX = 4096;
343
343
  var nodePool = [];
@@ -451,6 +451,17 @@ function resumeTracking() {
451
451
  trackingSuspended = false;
452
452
  }
453
453
  }
454
+ function isTrackingSuspended() {
455
+ return trackingSuspended;
456
+ }
457
+ function untracked(fn) {
458
+ suspendTracking();
459
+ try {
460
+ return fn();
461
+ } finally {
462
+ resumeTracking();
463
+ }
464
+ }
454
465
  var subscriberEpochCounter = 0;
455
466
  function retrack(effectFn, subscriber) {
456
467
  const prev = currentSubscriber;
@@ -560,6 +571,16 @@ function cleanup(subscriber) {
560
571
  var maxSubscriberRepeats = 50;
561
572
  var maxDrainIterations = 1e6;
562
573
  var drainEpoch = 0;
574
+ function setMaxSubscriberRepeats(n) {
575
+ const prev = maxSubscriberRepeats;
576
+ if (Number.isFinite(n) && n > 0) maxSubscriberRepeats = Math.floor(n);
577
+ return prev;
578
+ }
579
+ function setMaxDrainIterations(n) {
580
+ const prev = maxDrainIterations;
581
+ if (Number.isFinite(n) && n > 0) maxDrainIterations = Math.floor(n);
582
+ return prev;
583
+ }
563
584
  function tickRepeat(sub2) {
564
585
  const s2 = sub2;
565
586
  if (s2._runEpoch !== drainEpoch) {
@@ -730,6 +751,64 @@ function forEachSubscriber(signal2, visit) {
730
751
  }
731
752
  }
732
753
 
754
+ // src/reactivity/track.ts
755
+ var _isDev3 = isDev();
756
+ var _runtimeVersion = true ? "3.3.2" : "dev";
757
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
758
+ function resolveReactiveApi() {
759
+ const g2 = globalThis;
760
+ const existing = g2[REGISTRY_KEY];
761
+ if (existing) {
762
+ if (_isDev3 && !existing.__dupWarned) {
763
+ existing.__dupWarned = true;
764
+ devWarn(
765
+ `Multiple instances of the reactive runtime detected on this page (active: ${existing.version}, duplicate: ${_runtimeVersion}). Reactivity still works \u2014 all copies share the first one \u2014 but de-duplicate sibujs in your bundler (e.g. Vite optimizeDeps.exclude: ['sibujs'] or resolve.dedupe: ['sibujs']).`
766
+ );
767
+ }
768
+ return existing;
769
+ }
770
+ const local = {
771
+ suspendTracking,
772
+ resumeTracking,
773
+ isTrackingSuspended,
774
+ untracked,
775
+ retrack,
776
+ track,
777
+ reactiveBinding,
778
+ recordDependency,
779
+ cleanup,
780
+ setMaxSubscriberRepeats,
781
+ setMaxDrainIterations,
782
+ drainNotificationQueue,
783
+ queueSignalNotification,
784
+ notifySubscribers,
785
+ getSubscriberCount,
786
+ getSubscriberDeps,
787
+ forEachSubscriber,
788
+ version: _runtimeVersion
789
+ };
790
+ g2[REGISTRY_KEY] = local;
791
+ return local;
792
+ }
793
+ var API = resolveReactiveApi();
794
+ var suspendTracking2 = API.suspendTracking;
795
+ var resumeTracking2 = API.resumeTracking;
796
+ var isTrackingSuspended2 = API.isTrackingSuspended;
797
+ var untracked2 = API.untracked;
798
+ var retrack2 = API.retrack;
799
+ var track2 = API.track;
800
+ var reactiveBinding2 = API.reactiveBinding;
801
+ var recordDependency2 = API.recordDependency;
802
+ var cleanup2 = API.cleanup;
803
+ var setMaxSubscriberRepeats2 = API.setMaxSubscriberRepeats;
804
+ var setMaxDrainIterations2 = API.setMaxDrainIterations;
805
+ var drainNotificationQueue2 = API.drainNotificationQueue;
806
+ var queueSignalNotification2 = API.queueSignalNotification;
807
+ var notifySubscribers2 = API.notifySubscribers;
808
+ var getSubscriberCount2 = API.getSubscriberCount;
809
+ var getSubscriberDeps2 = API.getSubscriberDeps;
810
+ var forEachSubscriber2 = API.forEachSubscriber;
811
+
733
812
  // src/core/signals/derived.ts
734
813
  function derived(getter, options) {
735
814
  devAssert(typeof getter === "function", "derived: argument must be a getter function.");
@@ -752,7 +831,7 @@ function derived(getter, options) {
752
831
  cs._d = false;
753
832
  cs._init = true;
754
833
  };
755
- track(() => {
834
+ track2(() => {
756
835
  let threw = true;
757
836
  try {
758
837
  cs._v = getter();
@@ -771,12 +850,12 @@ function derived(getter, options) {
771
850
  `[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
772
851
  );
773
852
  }
774
- if (trackingSuspended) {
853
+ if (isTrackingSuspended2()) {
775
854
  if (cs._d) {
776
855
  const prev = cs._v;
777
856
  evaluating = true;
778
857
  try {
779
- retrack(recompute, markDirty);
858
+ retrack2(recompute, markDirty);
780
859
  if (!Object.is(prev, cs._v)) cs.__v++;
781
860
  } finally {
782
861
  evaluating = false;
@@ -784,12 +863,12 @@ function derived(getter, options) {
784
863
  }
785
864
  return cs._v;
786
865
  }
787
- recordDependency(cs);
866
+ recordDependency2(cs);
788
867
  if (cs._d) {
789
868
  const oldValue = cs._v;
790
869
  evaluating = true;
791
870
  try {
792
- retrack(recompute, markDirty);
871
+ retrack2(recompute, markDirty);
793
872
  if (!Object.is(oldValue, cs._v)) cs.__v++;
794
873
  } finally {
795
874
  evaluating = false;
@@ -810,23 +889,29 @@ function derived(getter, options) {
810
889
  }
811
890
 
812
891
  // src/core/ssr-context.ts
813
- var als = null;
814
- try {
815
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
816
- let mod = null;
817
- const getBuiltin = process.getBuiltinModule;
818
- if (typeof getBuiltin === "function") {
819
- mod = getBuiltin("node:async_hooks");
820
- } else {
821
- const req = Function("return typeof require==='function'?require:null")();
822
- if (req) mod = req("node:async_hooks");
892
+ var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
893
+ function detectSSRShared() {
894
+ let detected = null;
895
+ try {
896
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
897
+ let mod = null;
898
+ const getBuiltin = process.getBuiltinModule;
899
+ if (typeof getBuiltin === "function") {
900
+ mod = getBuiltin("node:async_hooks");
901
+ } else {
902
+ const req = Function("return typeof require==='function'?require:null")();
903
+ if (req) mod = req("node:async_hooks");
904
+ }
905
+ if (mod) detected = new mod.AsyncLocalStorage();
823
906
  }
824
- if (mod) als = new mod.AsyncLocalStorage();
907
+ } catch {
908
+ detected = null;
825
909
  }
826
- } catch {
827
- als = null;
910
+ return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
828
911
  }
829
- var fallbackStore = { ssr: false, suspenseIdCounter: 0 };
912
+ var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
913
+ var als = _shared.als;
914
+ var fallbackStore = _shared.fallbackStore;
830
915
  function getSSRStore() {
831
916
  if (als) {
832
917
  const s2 = als.getStore();
@@ -869,7 +954,7 @@ function drainReruns(ctx) {
869
954
  do {
870
955
  ctx.rerunPending = false;
871
956
  if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
872
- retrack(ctx.bodyFn, ctx.subscriber);
957
+ retrack2(ctx.bodyFn, ctx.subscriber);
873
958
  } while (ctx.rerunPending && ++reruns <= MAX_RERUNS);
874
959
  if (ctx.rerunPending) {
875
960
  ctx.rerunPending = false;
@@ -898,7 +983,7 @@ function disposeEffect(ctx) {
898
983
  }
899
984
  }
900
985
  try {
901
- cleanup(ctx.subscriber);
986
+ cleanup2(ctx.subscriber);
902
987
  } catch (err) {
903
988
  if (typeof console !== "undefined") {
904
989
  console.warn("[SibuJS effect] dispose threw:", err);
@@ -943,7 +1028,7 @@ function effect(effectFn, options) {
943
1028
  try {
944
1029
  ctx.rerunPending = false;
945
1030
  if (ctx.userCleanups.length > 0) flushUserCleanups(ctx);
946
- retrack(ctx.bodyFn, sub2);
1031
+ retrack2(ctx.bodyFn, sub2);
947
1032
  if (ctx.rerunPending) drainReruns(ctx);
948
1033
  } finally {
949
1034
  ctx.running = false;
@@ -959,7 +1044,7 @@ function effect(effectFn, options) {
959
1044
  ctx.subscriber = sub2;
960
1045
  ctx.running = true;
961
1046
  try {
962
- retrack(ctx.bodyFn, ctx.subscriber);
1047
+ retrack2(ctx.bodyFn, ctx.subscriber);
963
1048
  if (ctx.rerunPending) drainReruns(ctx);
964
1049
  } finally {
965
1050
  ctx.running = false;
@@ -973,7 +1058,7 @@ function effect(effectFn, options) {
973
1058
  // src/reactivity/batch.ts
974
1059
  var batchDepth = 0;
975
1060
  var pendingSignals = /* @__PURE__ */ new Set();
976
- function batch(fn) {
1061
+ function batchImpl(fn) {
977
1062
  batchDepth++;
978
1063
  try {
979
1064
  return fn();
@@ -984,25 +1069,45 @@ function batch(fn) {
984
1069
  }
985
1070
  }
986
1071
  }
987
- function enqueueBatchedSignal(signal2) {
1072
+ function enqueueBatchedSignalImpl(signal2) {
988
1073
  if (batchDepth === 0) return false;
989
1074
  pendingSignals.add(signal2);
990
1075
  return true;
991
1076
  }
1077
+ function isBatchingImpl() {
1078
+ return batchDepth > 0;
1079
+ }
992
1080
  function flushBatch() {
993
1081
  try {
994
1082
  for (const signal2 of pendingSignals) {
995
- queueSignalNotification(signal2);
1083
+ queueSignalNotification2(signal2);
996
1084
  }
997
1085
  } finally {
998
1086
  pendingSignals.clear();
999
1087
  }
1000
- drainNotificationQueue();
1088
+ drainNotificationQueue2();
1001
1089
  }
1090
+ var BATCH_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.batch.v1");
1091
+ function resolveBatchApi() {
1092
+ const g2 = globalThis;
1093
+ const existing = g2[BATCH_REGISTRY_KEY];
1094
+ if (existing) return existing;
1095
+ const local = {
1096
+ batch: batchImpl,
1097
+ enqueueBatchedSignal: enqueueBatchedSignalImpl,
1098
+ isBatching: isBatchingImpl
1099
+ };
1100
+ g2[BATCH_REGISTRY_KEY] = local;
1101
+ return local;
1102
+ }
1103
+ var API2 = resolveBatchApi();
1104
+ var batch = API2.batch;
1105
+ var enqueueBatchedSignal = API2.enqueueBatchedSignal;
1106
+ var isBatching = API2.isBatching;
1002
1107
 
1003
1108
  // src/core/signals/signal.ts
1004
1109
  var _g2 = globalThis;
1005
- var _isDev3 = isDev();
1110
+ var _isDev4 = isDev();
1006
1111
  function signal(initial, options) {
1007
1112
  const state = {
1008
1113
  value: initial,
@@ -1013,11 +1118,11 @@ function signal(initial, options) {
1013
1118
  __activeNode: null,
1014
1119
  __name: void 0
1015
1120
  };
1016
- const debugName = _isDev3 ? options?.name : void 0;
1121
+ const debugName = _isDev4 ? options?.name : void 0;
1017
1122
  const equalsFn = options?.equals;
1018
1123
  if (debugName) state.__name = debugName;
1019
1124
  function get() {
1020
- recordDependency(state);
1125
+ recordDependency2(state);
1021
1126
  return state.value;
1022
1127
  }
1023
1128
  get.__signal = state;
@@ -1030,15 +1135,15 @@ function signal(initial, options) {
1030
1135
  if (equalsFn(prev, newValue)) return;
1031
1136
  state.value = newValue;
1032
1137
  state.__v++;
1033
- if (_isDev3) {
1138
+ if (_isDev4) {
1034
1139
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1035
1140
  if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
1036
1141
  }
1037
1142
  if (!enqueueBatchedSignal(state)) {
1038
- notifySubscribers(state);
1143
+ notifySubscribers2(state);
1039
1144
  }
1040
1145
  };
1041
- } else if (_isDev3) {
1146
+ } else if (_isDev4) {
1042
1147
  set = (next) => {
1043
1148
  const prev = state.value;
1044
1149
  const newValue = typeof next === "function" ? next(prev) : next;
@@ -1048,7 +1153,7 @@ function signal(initial, options) {
1048
1153
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1049
1154
  if (hook) hook.emit("signal:update", { signal: state, name: debugName, oldValue: prev, newValue });
1050
1155
  if (!enqueueBatchedSignal(state)) {
1051
- notifySubscribers(state);
1156
+ notifySubscribers2(state);
1052
1157
  }
1053
1158
  };
1054
1159
  } else {
@@ -1059,11 +1164,11 @@ function signal(initial, options) {
1059
1164
  state.value = newValue;
1060
1165
  state.__v++;
1061
1166
  if (!enqueueBatchedSignal(state)) {
1062
- notifySubscribers(state);
1167
+ notifySubscribers2(state);
1063
1168
  }
1064
1169
  };
1065
1170
  }
1066
- if (_isDev3) {
1171
+ if (_isDev4) {
1067
1172
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1068
1173
  if (hook) hook.emit("signal:create", { signal: state, name: debugName, getter: get, initial });
1069
1174
  }
@@ -2430,7 +2535,7 @@ function resize(target) {
2430
2535
  } };
2431
2536
  }
2432
2537
  const getter = resolveTarget(target);
2433
- const cleanup2 = effect(() => {
2538
+ const cleanup3 = effect(() => {
2434
2539
  const el = getter();
2435
2540
  if (observer) {
2436
2541
  observer.disconnect();
@@ -2449,7 +2554,7 @@ function resize(target) {
2449
2554
  observer.observe(el);
2450
2555
  });
2451
2556
  function dispose2() {
2452
- cleanup2();
2557
+ cleanup3();
2453
2558
  if (observer) {
2454
2559
  observer.disconnect();
2455
2560
  observer = null;
@@ -2733,7 +2838,7 @@ function draggable(element, data2) {
2733
2838
  let onDragStart = null;
2734
2839
  let onDragEnd = null;
2735
2840
  const getter = resolveTarget2(element);
2736
- const cleanup2 = effect(() => {
2841
+ const cleanup3 = effect(() => {
2737
2842
  if (currentEl && onDragStart && onDragEnd) {
2738
2843
  currentEl.removeEventListener("dragstart", onDragStart);
2739
2844
  currentEl.removeEventListener("dragend", onDragEnd);
@@ -2755,7 +2860,7 @@ function draggable(element, data2) {
2755
2860
  el.addEventListener("dragend", onDragEnd);
2756
2861
  });
2757
2862
  function dispose2() {
2758
- cleanup2();
2863
+ cleanup3();
2759
2864
  if (currentEl && onDragStart && onDragEnd) {
2760
2865
  currentEl.removeEventListener("dragstart", onDragStart);
2761
2866
  currentEl.removeEventListener("dragend", onDragEnd);
@@ -2776,7 +2881,7 @@ function dropZone(element, options) {
2776
2881
  let onDragLeave = null;
2777
2882
  let onDrop = null;
2778
2883
  const getter = resolveTarget2(element);
2779
- const cleanup2 = effect(() => {
2884
+ const cleanup3 = effect(() => {
2780
2885
  if (currentEl && onDragOver && onDragEnter && onDragLeave && onDrop) {
2781
2886
  currentEl.removeEventListener("dragover", onDragOver);
2782
2887
  currentEl.removeEventListener("dragenter", onDragEnter);
@@ -2818,7 +2923,7 @@ function dropZone(element, options) {
2818
2923
  el.addEventListener("drop", onDrop);
2819
2924
  });
2820
2925
  function dispose2() {
2821
- cleanup2();
2926
+ cleanup3();
2822
2927
  if (currentEl && onDragOver && onDragEnter && onDragLeave && onDrop) {
2823
2928
  currentEl.removeEventListener("dragover", onDragOver);
2824
2929
  currentEl.removeEventListener("dragenter", onDragEnter);
@@ -2838,11 +2943,11 @@ function title(value) {
2838
2943
  }
2839
2944
  const previousTitle = document.title;
2840
2945
  if (typeof value === "function") {
2841
- const cleanup2 = effect(() => {
2946
+ const cleanup3 = effect(() => {
2842
2947
  document.title = value();
2843
2948
  });
2844
2949
  return () => {
2845
- cleanup2();
2950
+ cleanup3();
2846
2951
  document.title = previousTitle;
2847
2952
  };
2848
2953
  }
@@ -4535,7 +4640,7 @@ function TransitionGroup(options) {
4535
4640
  }
4536
4641
  setElements((prev) => prev.filter((e) => e !== el));
4537
4642
  }
4538
- function track3(newElements) {
4643
+ function track4(newElements) {
4539
4644
  const oldPositions = /* @__PURE__ */ new Map();
4540
4645
  for (const el of elements()) {
4541
4646
  if (typeof el.getBoundingClientRect === "function") {
@@ -4577,7 +4682,7 @@ function TransitionGroup(options) {
4577
4682
  }
4578
4683
  }
4579
4684
  }
4580
- return { add, remove, track: track3 };
4685
+ return { add, remove, track: track4 };
4581
4686
  }
4582
4687
 
4583
4688
  // src/ui/viewTransition.ts
@@ -4737,23 +4842,18 @@ function custom(fn, message) {
4737
4842
  return (value) => fn(value) ? null : message;
4738
4843
  }
4739
4844
  function bindField(field, extras) {
4845
+ const readControlValue = (target) => {
4846
+ if ("checked" in target && target.type === "checkbox") {
4847
+ return target.checked;
4848
+ }
4849
+ if (target instanceof HTMLSelectElement && target.multiple) {
4850
+ return Array.from(target.selectedOptions, (o) => o.value);
4851
+ }
4852
+ return target.value;
4853
+ };
4740
4854
  const fieldOn = {
4741
- input: (e) => {
4742
- const target = e.target;
4743
- if (target.type === "checkbox") {
4744
- field.set(target.checked);
4745
- } else {
4746
- field.set(target.value);
4747
- }
4748
- },
4749
- change: (e) => {
4750
- const target = e.target;
4751
- if ("checked" in target && target.type === "checkbox") {
4752
- field.set(target.checked);
4753
- } else {
4754
- field.set(target.value);
4755
- }
4756
- },
4855
+ input: (e) => field.set(readControlValue(e.target)),
4856
+ change: (e) => field.set(readControlValue(e.target)),
4757
4857
  blur: () => field.touch()
4758
4858
  };
4759
4859
  const { on: extraOn, value: _ignoreValue, ...restExtras } = extras ?? {};
@@ -4881,7 +4981,7 @@ function form(config) {
4881
4981
 
4882
4982
  // src/core/rendering/dispose.ts
4883
4983
  var elementDisposers = /* @__PURE__ */ new WeakMap();
4884
- var _isDev4 = isDev();
4984
+ var _isDev5 = isDev();
4885
4985
  var activeBindingCount = 0;
4886
4986
  function registerDisposer(node, teardown) {
4887
4987
  let disposers = elementDisposers.get(node);
@@ -4890,7 +4990,7 @@ function registerDisposer(node, teardown) {
4890
4990
  elementDisposers.set(node, disposers);
4891
4991
  }
4892
4992
  disposers.push(teardown);
4893
- if (_isDev4) activeBindingCount++;
4993
+ if (_isDev5) activeBindingCount++;
4894
4994
  }
4895
4995
  function dispose(node) {
4896
4996
  const stack = [node];
@@ -4909,12 +5009,12 @@ function dispose(node) {
4909
5009
  if (disposers) {
4910
5010
  const snapshot = disposers.slice();
4911
5011
  elementDisposers.delete(current);
4912
- if (_isDev4) activeBindingCount -= snapshot.length;
5012
+ if (_isDev5) activeBindingCount -= snapshot.length;
4913
5013
  for (const d of snapshot) {
4914
5014
  try {
4915
5015
  d();
4916
5016
  } catch (err) {
4917
- if (_isDev4 && typeof console !== "undefined") {
5017
+ if (_isDev5 && typeof console !== "undefined") {
4918
5018
  console.warn("[SibuJS] Disposer threw during cleanup:", err);
4919
5019
  }
4920
5020
  }
@@ -4925,12 +5025,12 @@ function dispose(node) {
4925
5025
  if (!added || added.length === 0) break;
4926
5026
  const moreSnapshot = added.slice();
4927
5027
  elementDisposers.delete(current);
4928
- if (_isDev4) activeBindingCount -= moreSnapshot.length;
5028
+ if (_isDev5) activeBindingCount -= moreSnapshot.length;
4929
5029
  for (const d of moreSnapshot) {
4930
5030
  try {
4931
5031
  d();
4932
5032
  } catch (err) {
4933
- if (_isDev4 && typeof console !== "undefined") {
5033
+ if (_isDev5 && typeof console !== "undefined") {
4934
5034
  console.warn("[SibuJS] Disposer threw during cleanup:", err);
4935
5035
  }
4936
5036
  }
@@ -5168,7 +5268,7 @@ function aria(element, attrs) {
5168
5268
  const getter = value;
5169
5269
  registerDisposer(
5170
5270
  element,
5171
- track(() => {
5271
+ track2(() => {
5172
5272
  element.setAttribute(ariaKey, String(getter()));
5173
5273
  })
5174
5274
  );
@@ -5441,13 +5541,13 @@ function removeScopedStyle(scopeId) {
5441
5541
  }
5442
5542
 
5443
5543
  // src/reactivity/bindAttribute.ts
5444
- var _isDev5 = isDev();
5544
+ var _isDev6 = isDev();
5445
5545
  function setProp(el, key, val) {
5446
5546
  el[key] = val;
5447
5547
  }
5448
5548
  function bindAttribute(el, attr, getter) {
5449
5549
  if (isEventHandlerAttr(attr)) {
5450
- if (_isDev5)
5550
+ if (_isDev6)
5451
5551
  devWarn(
5452
5552
  `bindAttribute: refusing to bind event-handler attribute "${attr}". Use on:{ ${attr.slice(2)}: fn } instead.`
5453
5553
  );
@@ -5459,7 +5559,7 @@ function bindAttribute(el, attr, getter) {
5459
5559
  try {
5460
5560
  value = getter();
5461
5561
  } catch (err) {
5462
- if (_isDev5)
5562
+ if (_isDev6)
5463
5563
  devWarn(`bindAttribute: getter for "${attr}" threw: ${err instanceof Error ? err.message : String(err)}`);
5464
5564
  return;
5465
5565
  }
@@ -5480,7 +5580,7 @@ function bindAttribute(el, attr, getter) {
5480
5580
  el.setAttribute(attr, sanitizeAttributeString(attr, str));
5481
5581
  }
5482
5582
  }
5483
- return reactiveBinding(commit);
5583
+ return reactiveBinding2(commit);
5484
5584
  }
5485
5585
 
5486
5586
  // src/ui/reactiveAttr.ts
@@ -5530,7 +5630,7 @@ function bindBoolAttr(el, attr, getter) {
5530
5630
  el.removeAttribute(attr);
5531
5631
  }
5532
5632
  }
5533
- const teardown = track(commit);
5633
+ const teardown = track2(commit);
5534
5634
  return teardown;
5535
5635
  }
5536
5636
  function bindData(el, key, getter) {
@@ -5991,7 +6091,7 @@ function uniqueId(suffix) {
5991
6091
  }
5992
6092
 
5993
6093
  // src/performance/domRecycler.ts
5994
- var _isDev6 = isDev();
6094
+ var _isDev7 = isDev();
5995
6095
  var DOMPool = class {
5996
6096
  constructor(maxSize = 50) {
5997
6097
  this.pools = /* @__PURE__ */ new Map();
@@ -6018,7 +6118,7 @@ var DOMPool = class {
6018
6118
  * is almost certainly a bug.
6019
6119
  */
6020
6120
  release(element) {
6021
- if (_isDev6 && element.isConnected) {
6121
+ if (_isDev7 && element.isConnected) {
6022
6122
  devWarn(
6023
6123
  "DOMPool.release() called on a still-connected element. Detach it from the DOM first (remove() / dispose())."
6024
6124
  );
@@ -6133,7 +6233,7 @@ function noSideEffect(fn) {
6133
6233
  function sanitizeUrlAttr(name, value) {
6134
6234
  return name === "srcset" ? sanitizeSrcset(value) : sanitizeUrl(value);
6135
6235
  }
6136
- var _isDev7 = isDev();
6236
+ var _isDev8 = isDev();
6137
6237
  var SAFE_ATTR_NAME = /^[A-Za-z_:][-A-Za-z0-9_.:]*$/;
6138
6238
  function isSafeAttrName(name) {
6139
6239
  return SAFE_ATTR_NAME.test(name);
@@ -6153,7 +6253,7 @@ var URL_ATTRS = /* @__PURE__ */ new Set([
6153
6253
  "xlink:href"
6154
6254
  ]);
6155
6255
  function ssrErrorComment(err) {
6156
- if (_isDev7) {
6256
+ if (_isDev8) {
6157
6257
  const msg = escapeHtml(err instanceof Error ? err.message : String(err));
6158
6258
  return `<!--SSR error: ${safeCommentText(msg)}-->`;
6159
6259
  }
@@ -6199,10 +6299,10 @@ function renderToString(element) {
6199
6299
  }
6200
6300
  const tag = element.tagName.toLowerCase();
6201
6301
  if (tag === "script" || tag === "style") {
6202
- return _isDev7 ? `<!--ssr:${tag}-stripped-->` : "";
6302
+ return _isDev8 ? `<!--ssr:${tag}-stripped-->` : "";
6203
6303
  }
6204
6304
  if (!/^[a-z][a-z0-9-]*$/i.test(tag)) {
6205
- return _isDev7 ? "<!--ssr:invalid-tag-->" : "";
6305
+ return _isDev8 ? "<!--ssr:invalid-tag-->" : "";
6206
6306
  }
6207
6307
  let html2 = `<${tag}`;
6208
6308
  for (const attr of Array.from(element.attributes)) {
@@ -6243,7 +6343,7 @@ function hydrate(component, container, options = {}) {
6243
6343
  const first = mismatches[0];
6244
6344
  if (options.onMismatch) {
6245
6345
  options.onMismatch(first);
6246
- } else if (_isDev7) {
6346
+ } else if (_isDev8) {
6247
6347
  console.warn(
6248
6348
  `[SibuJS hydration] ${first.message}
6249
6349
  at ${first.path}
@@ -6438,11 +6538,11 @@ async function* renderToStream(element) {
6438
6538
  }
6439
6539
  const tag = element.tagName.toLowerCase();
6440
6540
  if (tag === "script" || tag === "style") {
6441
- if (_isDev7) yield `<!--ssr:${tag}-stripped-->`;
6541
+ if (_isDev8) yield `<!--ssr:${tag}-stripped-->`;
6442
6542
  return;
6443
6543
  }
6444
6544
  if (!/^[a-z][a-z0-9-]*$/i.test(tag)) {
6445
- if (_isDev7) yield "<!--ssr:invalid-tag-->";
6545
+ if (_isDev8) yield "<!--ssr:invalid-tag-->";
6446
6546
  return;
6447
6547
  }
6448
6548
  let openTag = `<${tag}`;
@@ -6546,7 +6646,7 @@ function hydrateProgressively(container, islands, options) {
6546
6646
  }
6547
6647
  container.setAttribute("data-sibu-hydrated", "progressive");
6548
6648
  return () => {
6549
- for (const cleanup2 of cleanups) cleanup2();
6649
+ for (const cleanup3 of cleanups) cleanup3();
6550
6650
  };
6551
6651
  }
6552
6652
  function resetSSRState() {
@@ -6575,7 +6675,7 @@ function ssrSuspense(props) {
6575
6675
  },
6576
6676
  (err) => {
6577
6677
  if (timer) clearTimeout(timer);
6578
- if (_isDev7) console.warn("[SibuJS SSR] ssrSuspense rejected:", err);
6678
+ if (_isDev8) console.warn("[SibuJS SSR] ssrSuspense rejected:", err);
6579
6679
  return { id, html: fallbackHtml };
6580
6680
  }
6581
6681
  );
@@ -6621,7 +6721,7 @@ function serializeState(state, nonce, options) {
6621
6721
  }
6622
6722
  function deserializeState(validate) {
6623
6723
  if (typeof window === "undefined") return void 0;
6624
- if (_isDev7 && !validate) {
6724
+ if (_isDev8 && !validate) {
6625
6725
  console.warn(
6626
6726
  "[SibuJS SSR] deserializeState() called without a validate guard \u2014 tampered SSR payloads will not be detected."
6627
6727
  );
@@ -7025,7 +7125,7 @@ function Head(props) {
7025
7125
  const anchor = document.createComment("sibu-head");
7026
7126
  const managedElements = [];
7027
7127
  const effectCleanups = [];
7028
- const cleanup2 = () => {
7128
+ const cleanup3 = () => {
7029
7129
  for (const el of managedElements) {
7030
7130
  if (el.parentNode) el.parentNode.removeChild(el);
7031
7131
  }
@@ -7034,7 +7134,7 @@ function Head(props) {
7034
7134
  effectCleanups.length = 0;
7035
7135
  };
7036
7136
  const apply = () => {
7037
- cleanup2();
7137
+ cleanup3();
7038
7138
  if (props.title) {
7039
7139
  if (typeof props.title === "function") {
7040
7140
  const cleanupFn = effect(() => {
@@ -7588,7 +7688,7 @@ function isWasmCached(key) {
7588
7688
  }
7589
7689
 
7590
7690
  // src/reactivity/bindChildNode.ts
7591
- var _isDev8 = isDev();
7691
+ var _isDev9 = isDev();
7592
7692
  function bindChildNode(placeholder, getter) {
7593
7693
  let lastNodes = [];
7594
7694
  function commit() {
@@ -7596,7 +7696,7 @@ function bindChildNode(placeholder, getter) {
7596
7696
  try {
7597
7697
  result = getter();
7598
7698
  } catch (err) {
7599
- if (_isDev8) devWarn(`bindChildNode: getter threw: ${err instanceof Error ? err.message : String(err)}`);
7699
+ if (_isDev9) devWarn(`bindChildNode: getter threw: ${err instanceof Error ? err.message : String(err)}`);
7600
7700
  return;
7601
7701
  }
7602
7702
  if (result == null || typeof result === "boolean") {
@@ -7622,7 +7722,7 @@ function bindChildNode(placeholder, getter) {
7622
7722
  if (item == null || typeof item === "boolean") continue;
7623
7723
  const node = item instanceof Node ? item : document.createTextNode(String(item));
7624
7724
  if (seen.has(node)) {
7625
- if (_isDev8)
7725
+ if (_isDev9)
7626
7726
  devWarn("bindChildNode: duplicate node reference in array \u2014 only the first occurrence is rendered.");
7627
7727
  continue;
7628
7728
  }
@@ -7657,12 +7757,12 @@ function bindChildNode(placeholder, getter) {
7657
7757
  }
7658
7758
  lastNodes = newNodes;
7659
7759
  }
7660
- return reactiveBinding(commit);
7760
+ return reactiveBinding2(commit);
7661
7761
  }
7662
7762
 
7663
7763
  // src/core/rendering/tagFactory.ts
7664
7764
  var SVG_NS = "http://www.w3.org/2000/svg";
7665
- var _isDev9 = isDev();
7765
+ var _isDev10 = isDev();
7666
7766
  var BLOCKED_TAGS = /* @__PURE__ */ new Set(["script", "iframe", "object", "embed", "frame", "frameset"]);
7667
7767
  function isBlockedTag(tag) {
7668
7768
  return BLOCKED_TAGS.has(tag.toLowerCase());
@@ -7705,7 +7805,7 @@ function toKebab(prop) {
7705
7805
  }
7706
7806
  function applyStyle(el, style2) {
7707
7807
  if (typeof style2 === "function") {
7708
- const teardown = track(() => {
7808
+ const teardown = track2(() => {
7709
7809
  el.setAttribute("style", style2());
7710
7810
  });
7711
7811
  registerDisposer(el, teardown);
@@ -7721,7 +7821,7 @@ function applyStyle(el, style2) {
7721
7821
  const name = toKebab(prop);
7722
7822
  if (typeof val === "function") {
7723
7823
  const getter = val;
7724
- const teardown = track(() => {
7824
+ const teardown = track2(() => {
7725
7825
  htmlEl.style.setProperty(name, sanitizeCSSValue(String(getter())));
7726
7826
  });
7727
7827
  registerDisposer(el, teardown);
@@ -7736,7 +7836,7 @@ function applyClass(el, cls) {
7736
7836
  return;
7737
7837
  }
7738
7838
  if (typeof cls === "function") {
7739
- const teardown = track(() => {
7839
+ const teardown = track2(() => {
7740
7840
  el.setAttribute("class", cls());
7741
7841
  });
7742
7842
  registerDisposer(el, teardown);
@@ -7763,7 +7863,7 @@ function applyClass(el, cls) {
7763
7863
  }
7764
7864
  el.setAttribute("class", r);
7765
7865
  };
7766
- const teardown = track(update);
7866
+ const teardown = track2(update);
7767
7867
  registerDisposer(el, teardown);
7768
7868
  } else {
7769
7869
  el.setAttribute("class", result);
@@ -7833,7 +7933,7 @@ var tagFactory = (tag, ns) => {
7833
7933
  appendChildren(el, second);
7834
7934
  return el;
7835
7935
  }
7836
- if (_isDev9 && looksLikeClassList(first)) {
7936
+ if (_isDev10 && looksLikeClassList(first)) {
7837
7937
  devWarn(
7838
7938
  `tagFactory: lone string "${first}" looks like a class list but is being rendered as TEXT. For a class, use ${tag}({ class: "${first}" }) \u2014 or ${tag}("${first}", children) to set the class AND add children.`
7839
7939
  );
@@ -7854,7 +7954,7 @@ var tagFactory = (tag, ns) => {
7854
7954
  if (pClass != null) applyClass(el, pClass);
7855
7955
  const pId = props.id;
7856
7956
  if (pId != null) {
7857
- if (_isDev9 && typeof pId === "string" && CLOBBER_RISKY_IDS.has(pId.toLowerCase())) {
7957
+ if (_isDev10 && typeof pId === "string" && CLOBBER_RISKY_IDS.has(pId.toLowerCase())) {
7858
7958
  devWarn(
7859
7959
  `tagFactory: element id="${pId}" matches a common global and may cause DOM clobbering. Avoid setting ids from untrusted input.`
7860
7960
  );
@@ -7869,7 +7969,7 @@ var tagFactory = (tag, ns) => {
7869
7969
  const handler = pOn[ev];
7870
7970
  if (typeof handler === "function") {
7871
7971
  el.addEventListener(ev, handler);
7872
- } else if (_isDev9) {
7972
+ } else if (_isDev10) {
7873
7973
  devWarn(
7874
7974
  `tagFactory: on.${ev} handler is not a function (got ${typeof handler}). Event listener was not attached.`
7875
7975
  );
@@ -7982,7 +8082,7 @@ var area = tagFactory("area");
7982
8082
  var audio = tagFactory("audio");
7983
8083
  var img = tagFactory("img");
7984
8084
  var map = tagFactory("map");
7985
- var track2 = tagFactory("track");
8085
+ var track3 = tagFactory("track");
7986
8086
  var video = tagFactory("video");
7987
8087
  var embed = tagFactory("embed");
7988
8088
  var iframe = tagFactory("iframe");
@@ -9314,18 +9414,18 @@ function clearPerformanceData() {
9314
9414
  perfMarks.clear();
9315
9415
  }
9316
9416
  var trackedCleanups = /* @__PURE__ */ new Map();
9317
- function trackCleanup(component, cleanup2) {
9417
+ function trackCleanup(component, cleanup3) {
9318
9418
  if (!trackedCleanups.has(component)) {
9319
9419
  trackedCleanups.set(component, []);
9320
9420
  }
9321
- trackedCleanups.get(component)?.push(cleanup2);
9421
+ trackedCleanups.get(component)?.push(cleanup3);
9322
9422
  }
9323
9423
  function runCleanups(component) {
9324
9424
  const cleanups = trackedCleanups.get(component);
9325
9425
  if (cleanups) {
9326
- for (const cleanup2 of cleanups) {
9426
+ for (const cleanup3 of cleanups) {
9327
9427
  try {
9328
- cleanup2();
9428
+ cleanup3();
9329
9429
  } catch (err) {
9330
9430
  if (typeof console !== "undefined") {
9331
9431
  console.warn("[SibuJS debug] cleanup threw:", err);
@@ -10332,13 +10432,13 @@ function startMeasure(profiler) {
10332
10432
  function getSignalName(getter) {
10333
10433
  return getter.__name;
10334
10434
  }
10335
- function getSubscriberCount2(getter) {
10435
+ function getSubscriberCount3(getter) {
10336
10436
  const signal2 = getter.__signal;
10337
10437
  if (!signal2) return 0;
10338
- return getSubscriberCount(signal2);
10438
+ return getSubscriberCount2(signal2);
10339
10439
  }
10340
10440
  function getDependencies(subscriberFn) {
10341
- return getSubscriberDeps(subscriberFn);
10441
+ return getSubscriberDeps2(subscriberFn);
10342
10442
  }
10343
10443
  function inspectSignal(getter) {
10344
10444
  const signal2 = getter.__signal;
@@ -10346,7 +10446,7 @@ function inspectSignal(getter) {
10346
10446
  return {
10347
10447
  name: getter.__name,
10348
10448
  signal: signal2,
10349
- subscriberCount: getSubscriberCount(signal2)
10449
+ subscriberCount: getSubscriberCount2(signal2)
10350
10450
  };
10351
10451
  }
10352
10452
  function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ new WeakSet()) {
@@ -10356,7 +10456,7 @@ function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ ne
10356
10456
  }
10357
10457
  visited.add(signal2);
10358
10458
  const downstream = [];
10359
- forEachSubscriber(signal2, (sub2) => {
10459
+ forEachSubscriber2(signal2, (sub2) => {
10360
10460
  const subSig = sub2._sig;
10361
10461
  if (subSig && !visited.has(subSig)) {
10362
10462
  const subName = subSig.__name;
@@ -10369,7 +10469,7 @@ function walkDependencyGraph(getter, maxDepth = 10, visited = /* @__PURE__ */ ne
10369
10469
  });
10370
10470
  return {
10371
10471
  name: getSignalName(getter),
10372
- subscribers: getSubscriberCount(signal2),
10472
+ subscribers: getSubscriberCount2(signal2),
10373
10473
  downstream
10374
10474
  };
10375
10475
  }
@@ -10426,15 +10526,15 @@ function watch(getter, callback) {
10426
10526
  if (!Object.is(newValue, oldValue)) {
10427
10527
  const prev = oldValue;
10428
10528
  oldValue = newValue;
10429
- suspendTracking();
10529
+ suspendTracking2();
10430
10530
  try {
10431
10531
  callback(newValue, prev);
10432
10532
  } finally {
10433
- resumeTracking();
10533
+ resumeTracking2();
10434
10534
  }
10435
10535
  }
10436
10536
  };
10437
- const teardown = track(subscriber);
10537
+ const teardown = track2(subscriber);
10438
10538
  return teardown;
10439
10539
  }
10440
10540