@fictjs/runtime 0.9.0 → 0.10.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 (75) hide show
  1. package/dist/advanced.cjs +9 -9
  2. package/dist/advanced.d.cts +4 -4
  3. package/dist/advanced.d.ts +4 -4
  4. package/dist/advanced.js +4 -4
  5. package/dist/{binding-BWchH3Kp.d.ts → binding-DUEukRxl.d.cts} +4 -2
  6. package/dist/{binding-BWchH3Kp.d.cts → binding-DqxS9ZQf.d.ts} +4 -2
  7. package/dist/{chunk-JVYH76ZX.js → chunk-2JRPPCG7.js} +3 -3
  8. package/dist/{chunk-FVX77557.js → chunk-DKA2I6ET.js} +3 -3
  9. package/dist/{chunk-UBFDB6OL.cjs → chunk-EQ5E4WOV.cjs} +216 -50
  10. package/dist/chunk-EQ5E4WOV.cjs.map +1 -0
  11. package/dist/{chunk-DXG3TARY.js → chunk-F4RVNXOL.js} +196 -30
  12. package/dist/chunk-F4RVNXOL.js.map +1 -0
  13. package/dist/{chunk-OAM7HABA.cjs → chunk-I4GKKAAY.cjs} +226 -182
  14. package/dist/chunk-I4GKKAAY.cjs.map +1 -0
  15. package/dist/{chunk-PG4QX2I2.cjs → chunk-K3DH5SD5.cjs} +17 -17
  16. package/dist/{chunk-PG4QX2I2.cjs.map → chunk-K3DH5SD5.cjs.map} +1 -1
  17. package/dist/{chunk-N6ODUM2Y.js → chunk-P4TZLFV6.js} +3 -3
  18. package/dist/{chunk-T2LNV5Q5.js → chunk-R6FINS25.js} +50 -6
  19. package/dist/chunk-R6FINS25.js.map +1 -0
  20. package/dist/{chunk-LBE6DC3V.cjs → chunk-SZLJCQFZ.cjs} +40 -40
  21. package/dist/{chunk-LBE6DC3V.cjs.map → chunk-SZLJCQFZ.cjs.map} +1 -1
  22. package/dist/{chunk-PD6IQY2Y.cjs → chunk-V7BC64W2.cjs} +8 -8
  23. package/dist/{chunk-PD6IQY2Y.cjs.map → chunk-V7BC64W2.cjs.map} +1 -1
  24. package/dist/{devtools-5AipK9CX.d.cts → devtools-C4Hgfa-S.d.ts} +14 -2
  25. package/dist/{devtools-BDp76luf.d.ts → devtools-CMxlJUTx.d.cts} +14 -2
  26. package/dist/index.cjs +42 -42
  27. package/dist/index.d.cts +5 -5
  28. package/dist/index.d.ts +5 -5
  29. package/dist/index.dev.js +230 -25
  30. package/dist/index.dev.js.map +1 -1
  31. package/dist/index.js +3 -3
  32. package/dist/internal-list.cjs +4 -4
  33. package/dist/internal-list.d.cts +2 -2
  34. package/dist/internal-list.d.ts +2 -2
  35. package/dist/internal-list.js +3 -3
  36. package/dist/internal.cjs +5 -5
  37. package/dist/internal.d.cts +6 -6
  38. package/dist/internal.d.ts +6 -6
  39. package/dist/internal.js +4 -4
  40. package/dist/jsx-dev-runtime.d.cts +671 -0
  41. package/dist/jsx-dev-runtime.d.ts +671 -0
  42. package/dist/jsx-runtime.d.cts +671 -0
  43. package/dist/jsx-runtime.d.ts +671 -0
  44. package/dist/{list-DL5DOFcO.d.ts → list-BBzsJhrm.d.ts} +1 -1
  45. package/dist/{list-hP7hQ9Vk.d.cts → list-_NJCcjl1.d.cts} +1 -1
  46. package/dist/loader.cjs +24 -20
  47. package/dist/loader.cjs.map +1 -1
  48. package/dist/loader.d.cts +2 -2
  49. package/dist/loader.d.ts +2 -2
  50. package/dist/loader.js +7 -3
  51. package/dist/loader.js.map +1 -1
  52. package/dist/{props-BpZz0AOq.d.cts → props--zJ4ebbT.d.cts} +2 -2
  53. package/dist/{props-CjLH0JE-.d.ts → props-BAGR7j-j.d.ts} +2 -2
  54. package/dist/{resume-BJ4oHLi_.d.cts → resume-C5IKAIdh.d.ts} +2 -2
  55. package/dist/{resume-CuyJWXP_.d.ts → resume-DPZxmA95.d.cts} +2 -2
  56. package/dist/{scope-jPt5DHRT.d.ts → scope-CuImnvh1.d.ts} +1 -1
  57. package/dist/{scope-BJCtq8hJ.d.cts → scope-Dq5hOu7c.d.cts} +1 -1
  58. package/dist/{signal-C4ISF17w.d.cts → signal-Z4KkDk9h.d.cts} +12 -1
  59. package/dist/{signal-C4ISF17w.d.ts → signal-Z4KkDk9h.d.ts} +12 -1
  60. package/package.json +2 -2
  61. package/src/devtools.ts +19 -2
  62. package/src/dom.ts +58 -4
  63. package/src/effect.ts +5 -5
  64. package/src/hooks.ts +13 -5
  65. package/src/lifecycle.ts +41 -3
  66. package/src/loader.ts +10 -4
  67. package/src/signal.ts +191 -18
  68. package/src/transition.ts +9 -3
  69. package/dist/chunk-DXG3TARY.js.map +0 -1
  70. package/dist/chunk-OAM7HABA.cjs.map +0 -1
  71. package/dist/chunk-T2LNV5Q5.js.map +0 -1
  72. package/dist/chunk-UBFDB6OL.cjs.map +0 -1
  73. /package/dist/{chunk-JVYH76ZX.js.map → chunk-2JRPPCG7.js.map} +0 -0
  74. /package/dist/{chunk-FVX77557.js.map → chunk-DKA2I6ET.js.map} +0 -0
  75. /package/dist/{chunk-N6ODUM2Y.js.map → chunk-P4TZLFV6.js.map} +0 -0
@@ -181,8 +181,35 @@ var currentRoot;
181
181
  var currentEffectCleanups;
182
182
  var globalErrorHandlers = /* @__PURE__ */ new WeakMap();
183
183
  var globalSuspenseHandlers = /* @__PURE__ */ new WeakMap();
184
+ var rootDevtoolsIds = /* @__PURE__ */ new WeakMap();
185
+ var nextRootDevtoolsId = 0;
186
+ function registerRootDevtools(root) {
187
+ if (!isDev2) return;
188
+ const hook = getDevtoolsHook();
189
+ if (!_optionalChain([hook, 'optionalAccess', _7 => _7.registerRoot])) return;
190
+ const id = ++nextRootDevtoolsId;
191
+ rootDevtoolsIds.set(root, id);
192
+ hook.registerRoot(id);
193
+ }
194
+ function disposeRootDevtools(root) {
195
+ if (!isDev2) return;
196
+ const id = rootDevtoolsIds.get(root);
197
+ if (id === void 0) return;
198
+ const hook = getDevtoolsHook();
199
+ _optionalChain([hook, 'optionalAccess', _8 => _8.disposeRoot, 'optionalCall', _9 => _9(id)]);
200
+ rootDevtoolsIds.delete(root);
201
+ }
202
+ function setRootSuspendDevtools(root, suspended) {
203
+ if (!isDev2) return;
204
+ const id = rootDevtoolsIds.get(root);
205
+ if (id === void 0) return;
206
+ const hook = getDevtoolsHook();
207
+ _optionalChain([hook, 'optionalAccess', _10 => _10.rootSuspend, 'optionalCall', _11 => _11(id, suspended)]);
208
+ }
184
209
  function createRootContext(parent) {
185
- return { parent, cleanups: [], destroyCallbacks: [], suspended: false };
210
+ const root = { parent, cleanups: [], destroyCallbacks: [], suspended: false };
211
+ registerRootDevtools(root);
212
+ return root;
186
213
  }
187
214
  function pushRoot(root) {
188
215
  if (!enterRootGuard(root)) {
@@ -262,9 +289,10 @@ function destroyRoot(root) {
262
289
  if (globalSuspenseHandlers.has(root)) {
263
290
  globalSuspenseHandlers.delete(root);
264
291
  }
292
+ disposeRootDevtools(root);
265
293
  }
266
294
  function createRoot(fn, options2) {
267
- const parent = _optionalChain([options2, 'optionalAccess', _7 => _7.inherit]) ? currentRoot : void 0;
295
+ const parent = _optionalChain([options2, 'optionalAccess', _12 => _12.inherit]) ? currentRoot : void 0;
268
296
  const root = createRootContext(parent);
269
297
  const prev = pushRoot(root);
270
298
  let value;
@@ -398,7 +426,10 @@ function handleSuspend(token, startRoot) {
398
426
  const handler = handlers[i];
399
427
  const handled = handler(token);
400
428
  if (handled !== false) {
401
- if (originRoot) originRoot.suspended = true;
429
+ if (originRoot) {
430
+ originRoot.suspended = true;
431
+ setRootSuspendDevtools(originRoot, true);
432
+ }
402
433
  return true;
403
434
  }
404
435
  }
@@ -411,7 +442,10 @@ function handleSuspend(token, startRoot) {
411
442
  const handler = globalForRoot[i];
412
443
  const handled = handler(token);
413
444
  if (handled !== false) {
414
- if (originRoot) originRoot.suspended = true;
445
+ if (originRoot) {
446
+ originRoot.suspended = true;
447
+ setRootSuspendDevtools(originRoot, true);
448
+ }
415
449
  return true;
416
450
  }
417
451
  }
@@ -425,7 +459,7 @@ function createMemo(fn, options2) {
425
459
  }
426
460
 
427
461
  // src/hooks.ts
428
- var isDev3 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _8 => _8.env, 'optionalAccess', _9 => _9.NODE_ENV]) !== "production";
462
+ var isDev3 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _13 => _13.env, 'optionalAccess', _14 => _14.NODE_ENV]) !== "production";
429
463
  var ctxStack = [];
430
464
  var preparedContext = null;
431
465
  function assertRenderContext(ctx, hookName) {
@@ -456,7 +490,7 @@ function __fictPrepareContext(ctx) {
456
490
  preparedContext = ctx;
457
491
  }
458
492
  function __fictGetCurrentComponentId() {
459
- return _optionalChain([ctxStack, 'access', _10 => _10[ctxStack.length - 1], 'optionalAccess', _11 => _11.componentId]);
493
+ return _optionalChain([ctxStack, 'access', _15 => _15[ctxStack.length - 1], 'optionalAccess', _16 => _16.componentId]);
460
494
  }
461
495
  function __fictPopContext() {
462
496
  const ctx = ctxStack.pop();
@@ -473,7 +507,7 @@ function __fictUseSignal(ctx, initial, optionsOrSlot, slot) {
473
507
  if (!ctx.slots[index]) {
474
508
  ctx.slots[index] = signal(initial, options2);
475
509
  }
476
- if (_optionalChain([options2, 'optionalAccess', _12 => _12.name])) {
510
+ if (_optionalChain([options2, 'optionalAccess', _17 => _17.name])) {
477
511
  if (!ctx.slotMap) ctx.slotMap = {};
478
512
  ctx.slotMap[options2.name] = index;
479
513
  }
@@ -489,18 +523,20 @@ function __fictUseMemo(ctx, fn, optionsOrSlot, slot) {
489
523
  }
490
524
  return ctx.slots[index];
491
525
  }
492
- function __fictUseEffect(ctx, fn, slot) {
493
- if (slot !== void 0) {
494
- if (ctx.slots[slot]) {
526
+ function __fictUseEffect(ctx, fn, optionsOrSlot, slot) {
527
+ const options2 = typeof optionsOrSlot === "number" ? void 0 : optionsOrSlot;
528
+ const resolvedSlot = typeof optionsOrSlot === "number" ? optionsOrSlot : slot;
529
+ if (resolvedSlot !== void 0) {
530
+ if (ctx.slots[resolvedSlot]) {
495
531
  return;
496
532
  }
497
- ctx.slots[slot] = createEffect(fn);
533
+ ctx.slots[resolvedSlot] = createEffect(fn, options2);
498
534
  return;
499
535
  }
500
536
  assertRenderContext(ctx, "__fictUseEffect");
501
537
  const index = ctx.cursor++;
502
538
  if (!ctx.slots[index]) {
503
- ctx.slots[index] = createEffect(fn);
539
+ ctx.slots[index] = createEffect(fn, options2);
504
540
  }
505
541
  }
506
542
  function __fictRender(ctx, fn) {
@@ -516,7 +552,7 @@ function __fictRender(ctx, fn) {
516
552
  }
517
553
 
518
554
  // src/signal.ts
519
- var isDev4 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _13 => _13.env, 'optionalAccess', _14 => _14.NODE_ENV]) !== "production";
555
+ var isDev4 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _18 => _18.env, 'optionalAccess', _19 => _19.NODE_ENV]) !== "production";
520
556
  var Mutable = 1;
521
557
  var Watching = 2;
522
558
  var Running = 4;
@@ -763,6 +799,15 @@ function purgeDeps(sub) {
763
799
  while (dep !== void 0) dep = unlink(dep, sub);
764
800
  }
765
801
  function disposeNode(node) {
802
+ if (isDev4) {
803
+ if ("fn" in node && typeof node.fn === "function") {
804
+ disposeEffectDevtools(node);
805
+ } else if ("getter" in node && typeof node.getter === "function") {
806
+ disposeComputedDevtools(node);
807
+ } else if ("currentValue" in node) {
808
+ disposeSignalDevtools(node);
809
+ }
810
+ }
766
811
  node.depsTail = void 0;
767
812
  node.flags = 0;
768
813
  purgeDeps(node);
@@ -816,6 +861,7 @@ function runEffect(e) {
816
861
  const flags = e.flags;
817
862
  const runCleanup = () => {
818
863
  if (!e.runCleanup) return;
864
+ if (isDev4) effectCleanupDevtools(e);
819
865
  inCleanup = true;
820
866
  activeCleanupFlushId = currentFlushId;
821
867
  try {
@@ -828,7 +874,6 @@ function runEffect(e) {
828
874
  if (flags & Dirty) {
829
875
  runCleanup();
830
876
  ++cycle;
831
- if (isDev4) effectRunDevtools(e);
832
877
  e.depsTail = void 0;
833
878
  e.flags = WatchingRunning;
834
879
  const prevSub = activeSub;
@@ -866,7 +911,6 @@ function runEffect(e) {
866
911
  if (isDirty) {
867
912
  runCleanup();
868
913
  ++cycle;
869
- if (isDev4) effectRunDevtools(e);
870
914
  e.depsTail = void 0;
871
915
  e.flags = WatchingRunning;
872
916
  const prevSub = activeSub;
@@ -900,19 +944,30 @@ function scheduleFlush() {
900
944
  }
901
945
  function flush() {
902
946
  beginFlushGuard();
947
+ let flushReported = false;
948
+ const finishFlush = () => {
949
+ if (flushReported && isDev4) {
950
+ flushEndDevtools();
951
+ }
952
+ endFlushGuard();
953
+ };
903
954
  if (batchDepth > 0) {
904
955
  scheduleFlush();
905
- endFlushGuard();
956
+ finishFlush();
906
957
  return;
907
958
  }
908
959
  const hasWork = highPriorityQueue.length > 0 || lowPriorityQueue.length > 0;
909
960
  if (!hasWork) {
910
961
  flushScheduled = false;
911
- endFlushGuard();
962
+ finishFlush();
912
963
  return;
913
964
  }
914
965
  currentFlushId++;
915
966
  flushScheduled = false;
967
+ if (isDev4) {
968
+ flushStartDevtools();
969
+ flushReported = true;
970
+ }
916
971
  let highIndex = 0;
917
972
  while (highIndex < highPriorityQueue.length) {
918
973
  const e = highPriorityQueue[highIndex];
@@ -932,7 +987,7 @@ function flush() {
932
987
  highPriorityQueue.length = 0;
933
988
  lowPriorityQueue.length = 0;
934
989
  flushScheduled = false;
935
- endFlushGuard();
990
+ finishFlush();
936
991
  return;
937
992
  }
938
993
  highIndex++;
@@ -947,7 +1002,7 @@ function flush() {
947
1002
  lowPriorityQueue.length -= lowIndex;
948
1003
  }
949
1004
  scheduleFlush();
950
- endFlushGuard();
1005
+ finishFlush();
951
1006
  return;
952
1007
  }
953
1008
  const e = lowPriorityQueue[lowIndex];
@@ -967,14 +1022,14 @@ function flush() {
967
1022
  highPriorityQueue.length = 0;
968
1023
  lowPriorityQueue.length = 0;
969
1024
  flushScheduled = false;
970
- endFlushGuard();
1025
+ finishFlush();
971
1026
  return;
972
1027
  }
973
1028
  lowIndex++;
974
1029
  runEffect(e);
975
1030
  }
976
1031
  lowPriorityQueue.length = 0;
977
- endFlushGuard();
1032
+ finishFlush();
978
1033
  }
979
1034
  function signal(initialValue, options2) {
980
1035
  const s = {
@@ -985,9 +1040,9 @@ function signal(initialValue, options2) {
985
1040
  flags: Mutable,
986
1041
  __id: void 0
987
1042
  };
988
- if (_optionalChain([options2, 'optionalAccess', _15 => _15.equals]) !== void 0) s.equals = options2.equals;
989
- if (_optionalChain([options2, 'optionalAccess', _16 => _16.name]) !== void 0) s.name = options2.name;
990
- if (_optionalChain([options2, 'optionalAccess', _17 => _17.devToolsSource]) !== void 0) s.devToolsSource = options2.devToolsSource;
1043
+ if (_optionalChain([options2, 'optionalAccess', _20 => _20.equals]) !== void 0) s.equals = options2.equals;
1044
+ if (_optionalChain([options2, 'optionalAccess', _21 => _21.name]) !== void 0) s.name = options2.name;
1045
+ if (_optionalChain([options2, 'optionalAccess', _22 => _22.devToolsSource]) !== void 0) s.devToolsSource = options2.devToolsSource;
991
1046
  if (isDev4) registerSignalDevtools(s);
992
1047
  const accessor = signalOper.bind(s);
993
1048
  accessor[SIGNAL_MARKER] = true;
@@ -1044,9 +1099,10 @@ function computed(getter, options2) {
1044
1099
  getter,
1045
1100
  __id: void 0
1046
1101
  };
1047
- if (_optionalChain([options2, 'optionalAccess', _18 => _18.equals]) !== void 0) c.equals = options2.equals;
1048
- if (_optionalChain([options2, 'optionalAccess', _19 => _19.name]) !== void 0) c.name = options2.name;
1049
- if (_optionalChain([options2, 'optionalAccess', _20 => _20.devToolsSource]) !== void 0) c.devToolsSource = options2.devToolsSource;
1102
+ if (_optionalChain([options2, 'optionalAccess', _23 => _23.equals]) !== void 0) c.equals = options2.equals;
1103
+ if (_optionalChain([options2, 'optionalAccess', _24 => _24.name]) !== void 0) c.name = options2.name;
1104
+ if (_optionalChain([options2, 'optionalAccess', _25 => _25.devToolsSource]) !== void 0) c.devToolsSource = options2.devToolsSource;
1105
+ if (_optionalChain([options2, 'optionalAccess', _26 => _26.internal]) === true) c.devToolsInternal = true;
1050
1106
  if (isDev4) registerComputedDevtools(c);
1051
1107
  const bound = computedOper.bind(
1052
1108
  c
@@ -1097,7 +1153,7 @@ function computedOper() {
1097
1153
  if (activeSub !== void 0) link(this, activeSub, cycle);
1098
1154
  return this.value;
1099
1155
  }
1100
- function effect(fn) {
1156
+ function effect(fn, options2) {
1101
1157
  const e = {
1102
1158
  fn,
1103
1159
  subs: void 0,
@@ -1105,6 +1161,8 @@ function effect(fn) {
1105
1161
  deps: void 0,
1106
1162
  depsTail: void 0,
1107
1163
  flags: WatchingRunning,
1164
+ ..._optionalChain([options2, 'optionalAccess', _27 => _27.name]) !== void 0 ? { name: options2.name } : {},
1165
+ ..._optionalChain([options2, 'optionalAccess', _28 => _28.devToolsSource]) !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
1108
1166
  __id: void 0
1109
1167
  };
1110
1168
  const root = getCurrentRoot();
@@ -1112,14 +1170,14 @@ function effect(fn) {
1112
1170
  e.root = root;
1113
1171
  }
1114
1172
  if (isDev4) registerEffectDevtools(e);
1173
+ e.fn = wrapEffectFnWithDevtoolsTiming(e, fn);
1115
1174
  const prevSub = activeSub;
1116
1175
  if (prevSub !== void 0) link(e, prevSub, 0);
1117
1176
  activeSub = e;
1118
1177
  let didThrow = false;
1119
1178
  let thrown;
1120
1179
  try {
1121
- if (isDev4) effectRunDevtools(e);
1122
- fn();
1180
+ e.fn();
1123
1181
  } catch (err) {
1124
1182
  didThrow = true;
1125
1183
  thrown = err;
@@ -1136,7 +1194,7 @@ function effect(fn) {
1136
1194
  disposer[EFFECT_MARKER] = true;
1137
1195
  return disposer;
1138
1196
  }
1139
- function effectWithCleanup(fn, cleanupRunner, root) {
1197
+ function effectWithCleanup(fn, cleanupRunner, root, options2) {
1140
1198
  const e = {
1141
1199
  fn,
1142
1200
  subs: void 0,
@@ -1145,6 +1203,8 @@ function effectWithCleanup(fn, cleanupRunner, root) {
1145
1203
  depsTail: void 0,
1146
1204
  flags: WatchingRunning,
1147
1205
  runCleanup: cleanupRunner,
1206
+ ..._optionalChain([options2, 'optionalAccess', _29 => _29.name]) !== void 0 ? { name: options2.name } : {},
1207
+ ..._optionalChain([options2, 'optionalAccess', _30 => _30.devToolsSource]) !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
1148
1208
  __id: void 0
1149
1209
  };
1150
1210
  const resolvedRoot = _nullishCoalesce(root, () => ( getCurrentRoot()));
@@ -1152,14 +1212,14 @@ function effectWithCleanup(fn, cleanupRunner, root) {
1152
1212
  e.root = resolvedRoot;
1153
1213
  }
1154
1214
  if (isDev4) registerEffectDevtools(e);
1215
+ e.fn = wrapEffectFnWithDevtoolsTiming(e, fn);
1155
1216
  const prevSub = activeSub;
1156
1217
  if (prevSub !== void 0) link(e, prevSub, 0);
1157
1218
  activeSub = e;
1158
1219
  let didThrow = false;
1159
1220
  let thrown;
1160
1221
  try {
1161
- if (isDev4) effectRunDevtools(e);
1162
- fn();
1222
+ e.fn();
1163
1223
  } catch (err) {
1164
1224
  didThrow = true;
1165
1225
  thrown = err;
@@ -1206,7 +1266,11 @@ function effectScopeOper() {
1206
1266
  disposeNode(this);
1207
1267
  }
1208
1268
  function batch(fn) {
1269
+ const enteringOuterBatch = batchDepth === 0;
1209
1270
  ++batchDepth;
1271
+ if (enteringOuterBatch && isDev4) {
1272
+ batchStartDevtools();
1273
+ }
1210
1274
  let result;
1211
1275
  let error;
1212
1276
  try {
@@ -1216,6 +1280,9 @@ function batch(fn) {
1216
1280
  } finally {
1217
1281
  --batchDepth;
1218
1282
  if (batchDepth === 0) {
1283
+ if (isDev4) {
1284
+ batchEndDevtools();
1285
+ }
1219
1286
  try {
1220
1287
  flush();
1221
1288
  } catch (flushErr) {
@@ -1246,6 +1313,7 @@ function __resetReactiveState() {
1246
1313
  cycle = 0;
1247
1314
  currentFlushId = 0;
1248
1315
  activeCleanupFlushId = 0;
1316
+ clearDevtoolsSignalSetters();
1249
1317
  }
1250
1318
  function untrack(fn) {
1251
1319
  const prev = activeSub;
@@ -1276,18 +1344,49 @@ function setTransitionContext(value) {
1276
1344
  var registerSignalDevtools = () => void 0;
1277
1345
  var updateSignalDevtools = () => {
1278
1346
  };
1347
+ var disposeSignalDevtools = () => {
1348
+ };
1279
1349
  var registerComputedDevtools = () => void 0;
1280
1350
  var updateComputedDevtools = () => {
1281
1351
  };
1352
+ var disposeComputedDevtools = () => {
1353
+ };
1282
1354
  var registerEffectDevtools = () => void 0;
1283
1355
  var effectRunDevtools = () => {
1284
1356
  };
1357
+ var wrapEffectFnWithDevtoolsTiming = (_node, fn) => fn;
1358
+ var effectCleanupDevtools = () => {
1359
+ };
1360
+ var disposeEffectDevtools = () => {
1361
+ };
1285
1362
  var trackDependencyDevtools = () => {
1286
1363
  };
1287
1364
  var untrackDependencyDevtools = () => {
1288
1365
  };
1289
- if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _21 => _21.env, 'optionalAccess', _22 => _22.NODE_ENV]) !== "production") {
1366
+ var batchStartDevtools = () => {
1367
+ };
1368
+ var batchEndDevtools = () => {
1369
+ };
1370
+ var flushStartDevtools = () => {
1371
+ };
1372
+ var flushEndDevtools = () => {
1373
+ };
1374
+ var clearDevtoolsSignalSetters = () => {
1375
+ };
1376
+ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _31 => _31.env, 'optionalAccess', _32 => _32.NODE_ENV]) !== "production") {
1290
1377
  let nextDevtoolsId = 0;
1378
+ const getSignalSetterMap = () => {
1379
+ if (typeof globalThis === "undefined") return void 0;
1380
+ const global = globalThis;
1381
+ if (!global.__FICT_DEVTOOLS_SIGNALS__) {
1382
+ global.__FICT_DEVTOOLS_SIGNALS__ = /* @__PURE__ */ new Map();
1383
+ }
1384
+ return global.__FICT_DEVTOOLS_SIGNALS__;
1385
+ };
1386
+ const getExistingSignalSetterMap = () => {
1387
+ if (typeof globalThis === "undefined") return void 0;
1388
+ return globalThis.__FICT_DEVTOOLS_SIGNALS__;
1389
+ };
1291
1390
  registerSignalDevtools = (node) => {
1292
1391
  const hook = getDevtoolsHook();
1293
1392
  if (!hook) return void 0;
@@ -1299,6 +1398,9 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
1299
1398
  if (ownerId !== void 0) options2.ownerId = ownerId;
1300
1399
  hook.registerSignal(id, node.currentValue, options2);
1301
1400
  node.__id = id;
1401
+ _optionalChain([getSignalSetterMap, 'call', _33 => _33(), 'optionalAccess', _34 => _34.set, 'call', _35 => _35(id, (value) => {
1402
+ signalOper.call(node, value);
1403
+ })]);
1302
1404
  return id;
1303
1405
  };
1304
1406
  updateSignalDevtools = (node, value) => {
@@ -1307,9 +1409,19 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
1307
1409
  const id = node.__id;
1308
1410
  if (id) hook.updateSignal(id, value);
1309
1411
  };
1412
+ disposeSignalDevtools = (node) => {
1413
+ const identifiable = node;
1414
+ const id = identifiable.__id;
1415
+ if (!id) return;
1416
+ const hook = getDevtoolsHook();
1417
+ _optionalChain([hook, 'optionalAccess', _36 => _36.disposeSignal, 'optionalCall', _37 => _37(id)]);
1418
+ _optionalChain([getExistingSignalSetterMap, 'call', _38 => _38(), 'optionalAccess', _39 => _39.delete, 'call', _40 => _40(id)]);
1419
+ delete identifiable.__id;
1420
+ };
1310
1421
  registerComputedDevtools = (node) => {
1311
1422
  const hook = getDevtoolsHook();
1312
1423
  if (!hook) return void 0;
1424
+ if (node.devToolsInternal) return void 0;
1313
1425
  const id = ++nextDevtoolsId;
1314
1426
  const options2 = {};
1315
1427
  if (node.name !== void 0) options2.name = node.name;
@@ -1327,35 +1439,89 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
1327
1439
  const id = node.__id;
1328
1440
  if (id) hook.updateComputed(id, value);
1329
1441
  };
1442
+ disposeComputedDevtools = (node) => {
1443
+ const identifiable = node;
1444
+ const id = identifiable.__id;
1445
+ if (!id) return;
1446
+ const hook = getDevtoolsHook();
1447
+ _optionalChain([hook, 'optionalAccess', _41 => _41.disposeComputed, 'optionalCall', _42 => _42(id)]);
1448
+ delete identifiable.__id;
1449
+ };
1330
1450
  registerEffectDevtools = (node) => {
1331
1451
  const hook = getDevtoolsHook();
1332
1452
  if (!hook) return void 0;
1333
1453
  const id = ++nextDevtoolsId;
1454
+ const options2 = {};
1334
1455
  const ownerId = __fictGetCurrentComponentId();
1335
- hook.registerEffect(id, ownerId !== void 0 ? { ownerId } : void 0);
1456
+ if (ownerId !== void 0) options2.ownerId = ownerId;
1457
+ if (node.devToolsSource !== void 0) options2.source = node.devToolsSource;
1458
+ hook.registerEffect(id, Object.keys(options2).length > 0 ? options2 : void 0);
1336
1459
  node.__id = id;
1337
1460
  return id;
1338
1461
  };
1339
- effectRunDevtools = (node) => {
1462
+ effectRunDevtools = (node, duration) => {
1340
1463
  const hook = getDevtoolsHook();
1341
1464
  if (!hook) return;
1342
1465
  const id = node.__id;
1343
- if (id) hook.effectRun(id);
1466
+ if (id) hook.effectRun(id, duration);
1467
+ };
1468
+ wrapEffectFnWithDevtoolsTiming = (node, fn) => {
1469
+ return () => {
1470
+ const startedAt = performance.now();
1471
+ try {
1472
+ fn();
1473
+ } finally {
1474
+ effectRunDevtools(node, performance.now() - startedAt);
1475
+ }
1476
+ };
1477
+ };
1478
+ effectCleanupDevtools = (node) => {
1479
+ const hook = getDevtoolsHook();
1480
+ if (!hook) return;
1481
+ const id = node.__id;
1482
+ if (id) _optionalChain([hook, 'access', _43 => _43.effectCleanup, 'optionalCall', _44 => _44(id)]);
1483
+ };
1484
+ disposeEffectDevtools = (node) => {
1485
+ const identifiable = node;
1486
+ const id = identifiable.__id;
1487
+ if (!id) return;
1488
+ const hook = getDevtoolsHook();
1489
+ _optionalChain([hook, 'optionalAccess', _45 => _45.disposeEffect, 'optionalCall', _46 => _46(id)]);
1490
+ delete identifiable.__id;
1344
1491
  };
1345
1492
  trackDependencyDevtools = (dep, sub) => {
1346
1493
  const hook = getDevtoolsHook();
1347
- if (!_optionalChain([hook, 'optionalAccess', _23 => _23.trackDependency])) return;
1494
+ if (!_optionalChain([hook, 'optionalAccess', _47 => _47.trackDependency])) return;
1348
1495
  const depId = dep.__id;
1349
1496
  const subId = sub.__id;
1350
1497
  if (depId && subId) hook.trackDependency(subId, depId);
1351
1498
  };
1352
1499
  untrackDependencyDevtools = (dep, sub) => {
1353
1500
  const hook = getDevtoolsHook();
1354
- if (!_optionalChain([hook, 'optionalAccess', _24 => _24.untrackDependency])) return;
1501
+ if (!_optionalChain([hook, 'optionalAccess', _48 => _48.untrackDependency])) return;
1355
1502
  const depId = dep.__id;
1356
1503
  const subId = sub.__id;
1357
1504
  if (depId && subId) hook.untrackDependency(subId, depId);
1358
1505
  };
1506
+ batchStartDevtools = () => {
1507
+ const hook = getDevtoolsHook();
1508
+ _optionalChain([hook, 'optionalAccess', _49 => _49.batchStart, 'optionalCall', _50 => _50()]);
1509
+ };
1510
+ batchEndDevtools = () => {
1511
+ const hook = getDevtoolsHook();
1512
+ _optionalChain([hook, 'optionalAccess', _51 => _51.batchEnd, 'optionalCall', _52 => _52()]);
1513
+ };
1514
+ flushStartDevtools = () => {
1515
+ const hook = getDevtoolsHook();
1516
+ _optionalChain([hook, 'optionalAccess', _53 => _53.flushStart, 'optionalCall', _54 => _54()]);
1517
+ };
1518
+ flushEndDevtools = () => {
1519
+ const hook = getDevtoolsHook();
1520
+ _optionalChain([hook, 'optionalAccess', _55 => _55.flushEnd, 'optionalCall', _56 => _56()]);
1521
+ };
1522
+ clearDevtoolsSignalSetters = () => {
1523
+ _optionalChain([getExistingSignalSetterMap, 'call', _57 => _57(), 'optionalAccess', _58 => _58.clear, 'call', _59 => _59()]);
1524
+ };
1359
1525
  }
1360
1526
  function createSelector(source, equalityFn = (a, b) => a === b) {
1361
1527
  let current = source();
@@ -1385,7 +1551,7 @@ function createSelector(source, equalityFn = (a, b) => a === b) {
1385
1551
  }
1386
1552
 
1387
1553
  // src/effect.ts
1388
- function createEffect(fn) {
1554
+ function createEffect(fn, options2) {
1389
1555
  let cleanups = [];
1390
1556
  const rootForError = getCurrentRoot();
1391
1557
  const doCleanup = () => {
@@ -1412,7 +1578,7 @@ function createEffect(fn) {
1412
1578
  });
1413
1579
  cleanups = bucket;
1414
1580
  };
1415
- const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
1581
+ const disposeEffect = effectWithCleanup(run, doCleanup, rootForError, options2);
1416
1582
  const teardown = () => {
1417
1583
  runCleanupList(cleanups);
1418
1584
  disposeEffect();
@@ -1420,7 +1586,7 @@ function createEffect(fn) {
1420
1586
  registerRootCleanup(teardown);
1421
1587
  return teardown;
1422
1588
  }
1423
- function createRenderEffect(fn) {
1589
+ function createRenderEffect(fn, options2) {
1424
1590
  let cleanup;
1425
1591
  const rootForError = getCurrentRoot();
1426
1592
  const doCleanup = () => {
@@ -1446,7 +1612,7 @@ function createRenderEffect(fn) {
1446
1612
  throw err;
1447
1613
  }
1448
1614
  };
1449
- const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
1615
+ const disposeEffect = effectWithCleanup(run, doCleanup, rootForError, options2);
1450
1616
  const teardown = () => {
1451
1617
  if (cleanup) {
1452
1618
  cleanup();
@@ -1485,7 +1651,7 @@ var DelegatedEventNames = [
1485
1651
  ];
1486
1652
 
1487
1653
  // src/constants.ts
1488
- var isDev5 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _25 => _25.env, 'optionalAccess', _26 => _26.NODE_ENV]) !== "production";
1654
+ var isDev5 = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && _optionalChain([process, 'access', _60 => _60.env, 'optionalAccess', _61 => _61.NODE_ENV]) !== "production";
1489
1655
  var booleans = isDev5 ? [
1490
1656
  "allowfullscreen",
1491
1657
  "async",
@@ -2220,18 +2386,18 @@ function __fictMergeSSRState(state) {
2220
2386
  Object.assign(snapshotState.scopes, state.scopes);
2221
2387
  }
2222
2388
  function __fictGetSSRScope(id) {
2223
- return _optionalChain([snapshotState, 'optionalAccess', _27 => _27.scopes, 'access', _28 => _28[id]]);
2389
+ return _optionalChain([snapshotState, 'optionalAccess', _62 => _62.scopes, 'access', _63 => _63[id]]);
2224
2390
  }
2225
2391
  function __fictEnsureScope(scopeId, host, snapshot) {
2226
2392
  const existing = resumedScopes.get(scopeId);
2227
2393
  if (existing) return existing.ctx;
2228
2394
  const ctx = createContextFromSnapshot(snapshot);
2229
2395
  ctx.scopeId = scopeId;
2230
- if (_optionalChain([snapshot, 'optionalAccess', _29 => _29.t]) !== void 0) {
2396
+ if (_optionalChain([snapshot, 'optionalAccess', _64 => _64.t]) !== void 0) {
2231
2397
  ctx.scopeType = snapshot.t;
2232
2398
  }
2233
2399
  const entry = { ctx, host };
2234
- if (_optionalChain([snapshot, 'optionalAccess', _30 => _30.props]) !== void 0) {
2400
+ if (_optionalChain([snapshot, 'optionalAccess', _65 => _65.props]) !== void 0) {
2235
2401
  entry.props = snapshot.props;
2236
2402
  }
2237
2403
  resumedScopes.set(scopeId, entry);
@@ -2247,11 +2413,11 @@ function __fictUseLexicalScope(scopeId, names) {
2247
2413
  return names.map((name) => ctx.slots[_nullishCoalesce(map[name], () => ( -1))]);
2248
2414
  }
2249
2415
  function __fictGetScopeProps(scopeId) {
2250
- return _optionalChain([resumedScopes, 'access', _31 => _31.get, 'call', _32 => _32(scopeId), 'optionalAccess', _33 => _33.props]);
2416
+ return _optionalChain([resumedScopes, 'access', _66 => _66.get, 'call', _67 => _67(scopeId), 'optionalAccess', _68 => _68.props]);
2251
2417
  }
2252
2418
  function __fictQrl(moduleId, exportName) {
2253
2419
  const manifest = globalThis.__FICT_MANIFEST__;
2254
- if (_optionalChain([manifest, 'optionalAccess', _34 => _34[moduleId]])) {
2420
+ if (_optionalChain([manifest, 'optionalAccess', _69 => _69[moduleId]])) {
2255
2421
  return `${manifest[moduleId]}#${exportName}`;
2256
2422
  }
2257
2423
  if (moduleId.startsWith("file://")) {
@@ -2555,4 +2721,4 @@ function deserializeValue(value, refs = /* @__PURE__ */ new Map(), path = "$") {
2555
2721
 
2556
2722
 
2557
2723
  exports.getDevtoolsHook = getDevtoolsHook; exports.setCycleProtectionOptions = setCycleProtectionOptions; exports.createRootContext = createRootContext; exports.pushRoot = pushRoot; exports.getCurrentRoot = getCurrentRoot; exports.popRoot = popRoot; exports.onMount = onMount; exports.onDestroy = onDestroy; exports.onCleanup = onCleanup; exports.flushOnMount = flushOnMount; exports.registerRootCleanup = registerRootCleanup; exports.destroyRoot = destroyRoot; exports.createRoot = createRoot; exports.registerErrorHandler = registerErrorHandler; exports.registerSuspenseHandler = registerSuspenseHandler; exports.handleError = handleError; exports.handleSuspend = handleSuspend; exports.createEffect = createEffect; exports.createRenderEffect = createRenderEffect; exports.__fictUseContext = __fictUseContext; exports.__fictPushContext = __fictPushContext; exports.__fictPrepareContext = __fictPrepareContext; exports.__fictGetCurrentComponentId = __fictGetCurrentComponentId; exports.__fictPopContext = __fictPopContext; exports.__fictResetContext = __fictResetContext; exports.__fictUseSignal = __fictUseSignal; exports.__fictUseMemo = __fictUseMemo; exports.__fictUseEffect = __fictUseEffect; exports.__fictRender = __fictRender; exports.scheduleFlush = scheduleFlush; exports.flush = flush; exports.signal = signal; exports.computed = computed; exports.effectScope = effectScope; exports.batch = batch; exports.setActiveSub = setActiveSub; exports.__resetReactiveState = __resetReactiveState; exports.untrack = untrack; exports.isSignal = isSignal; exports.isComputed = isComputed; exports.isEffect = isEffect; exports.isEffectScope = isEffectScope; exports.setTransitionContext = setTransitionContext; exports.createSelector = createSelector; exports.createMemo = createMemo; exports.BooleanAttributes = BooleanAttributes; exports.Properties = Properties; exports.ChildProperties = ChildProperties; exports.Aliases = Aliases; exports.getPropAlias = getPropAlias; exports.$$EVENTS = $$EVENTS; exports.DelegatedEvents = DelegatedEvents; exports.SVGElements = SVGElements; exports.SVGNamespace = SVGNamespace; exports.UnitlessStyles = UnitlessStyles; exports.__fictSetSSRStreamHooks = __fictSetSSRStreamHooks; exports.__fictGetSSRStreamHooks = __fictGetSSRStreamHooks; exports.__fictPushSSRBoundary = __fictPushSSRBoundary; exports.__fictPopSSRBoundary = __fictPopSSRBoundary; exports.createStore = createStore; exports.isStoreProxy = isStoreProxy; exports.unwrapStore = unwrapStore; exports.FICT_SSR_SNAPSHOT_SCHEMA_VERSION = FICT_SSR_SNAPSHOT_SCHEMA_VERSION; exports.__fictEnableSSR = __fictEnableSSR; exports.__fictDisableSSR = __fictDisableSSR; exports.__fictEnableResumable = __fictEnableResumable; exports.__fictDisableResumable = __fictDisableResumable; exports.__fictIsResumable = __fictIsResumable; exports.__fictIsSSR = __fictIsSSR; exports.__fictEnterHydration = __fictEnterHydration; exports.__fictExitHydration = __fictExitHydration; exports.__fictIsHydrating = __fictIsHydrating; exports.__fictRegisterScope = __fictRegisterScope; exports.__fictGetScopeRegistry = __fictGetScopeRegistry; exports.__fictGetScopesForBoundary = __fictGetScopesForBoundary; exports.__fictSerializeSSRState = __fictSerializeSSRState; exports.__fictSerializeSSRStateForScopes = __fictSerializeSSRStateForScopes; exports.__fictSetSSRState = __fictSetSSRState; exports.__fictMergeSSRState = __fictMergeSSRState; exports.__fictGetSSRScope = __fictGetSSRScope; exports.__fictEnsureScope = __fictEnsureScope; exports.__fictUseLexicalScope = __fictUseLexicalScope; exports.__fictGetScopeProps = __fictGetScopeProps; exports.__fictQrl = __fictQrl; exports.__fictRegisterResume = __fictRegisterResume; exports.__fictGetResume = __fictGetResume; exports.serializeValue = serializeValue; exports.deserializeValue = deserializeValue;
2558
- //# sourceMappingURL=chunk-UBFDB6OL.cjs.map
2724
+ //# sourceMappingURL=chunk-EQ5E4WOV.cjs.map