@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 (!hook?.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
+ hook?.disposeRoot?.(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
+ hook?.rootSuspend?.(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,6 +289,7 @@ 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
295
  const parent = options2?.inherit ? currentRoot : void 0;
@@ -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
  }
@@ -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) {
@@ -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 = {
@@ -1047,6 +1102,7 @@ function computed(getter, options2) {
1047
1102
  if (options2?.equals !== void 0) c.equals = options2.equals;
1048
1103
  if (options2?.name !== void 0) c.name = options2.name;
1049
1104
  if (options2?.devToolsSource !== void 0) c.devToolsSource = options2.devToolsSource;
1105
+ if (options2?.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
+ ...options2?.name !== void 0 ? { name: options2.name } : {},
1165
+ ...options2?.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
+ ...options2?.name !== void 0 ? { name: options2.name } : {},
1207
+ ...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
1148
1208
  __id: void 0
1149
1209
  };
1150
1210
  const resolvedRoot = 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
  };
1366
+ var batchStartDevtools = () => {
1367
+ };
1368
+ var batchEndDevtools = () => {
1369
+ };
1370
+ var flushStartDevtools = () => {
1371
+ };
1372
+ var flushEndDevtools = () => {
1373
+ };
1374
+ var clearDevtoolsSignalSetters = () => {
1375
+ };
1289
1376
  if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.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
+ getSignalSetterMap()?.set(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
+ hook?.disposeSignal?.(id);
1418
+ getExistingSignalSetterMap()?.delete(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,20 +1439,55 @@ 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
+ hook?.disposeComputed?.(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) => {
1463
+ const hook = getDevtoolsHook();
1464
+ if (!hook) return;
1465
+ const id = node.__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) => {
1340
1479
  const hook = getDevtoolsHook();
1341
1480
  if (!hook) return;
1342
1481
  const id = node.__id;
1343
- if (id) hook.effectRun(id);
1482
+ if (id) hook.effectCleanup?.(id);
1483
+ };
1484
+ disposeEffectDevtools = (node) => {
1485
+ const identifiable = node;
1486
+ const id = identifiable.__id;
1487
+ if (!id) return;
1488
+ const hook = getDevtoolsHook();
1489
+ hook?.disposeEffect?.(id);
1490
+ delete identifiable.__id;
1344
1491
  };
1345
1492
  trackDependencyDevtools = (dep, sub) => {
1346
1493
  const hook = getDevtoolsHook();
@@ -1356,6 +1503,25 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
1356
1503
  const subId = sub.__id;
1357
1504
  if (depId && subId) hook.untrackDependency(subId, depId);
1358
1505
  };
1506
+ batchStartDevtools = () => {
1507
+ const hook = getDevtoolsHook();
1508
+ hook?.batchStart?.();
1509
+ };
1510
+ batchEndDevtools = () => {
1511
+ const hook = getDevtoolsHook();
1512
+ hook?.batchEnd?.();
1513
+ };
1514
+ flushStartDevtools = () => {
1515
+ const hook = getDevtoolsHook();
1516
+ hook?.flushStart?.();
1517
+ };
1518
+ flushEndDevtools = () => {
1519
+ const hook = getDevtoolsHook();
1520
+ hook?.flushEnd?.();
1521
+ };
1522
+ clearDevtoolsSignalSetters = () => {
1523
+ getExistingSignalSetterMap()?.clear();
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();
@@ -2555,4 +2721,4 @@ export {
2555
2721
  serializeValue,
2556
2722
  deserializeValue
2557
2723
  };
2558
- //# sourceMappingURL=chunk-DXG3TARY.js.map
2724
+ //# sourceMappingURL=chunk-F4RVNXOL.js.map