@fictjs/runtime 0.9.0 → 0.11.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.
- package/dist/advanced.cjs +9 -9
- package/dist/advanced.d.cts +4 -4
- package/dist/advanced.d.ts +4 -4
- package/dist/advanced.js +4 -4
- package/dist/{binding-BWchH3Kp.d.cts → binding-DcnhUSQK.d.ts} +5 -3
- package/dist/{binding-BWchH3Kp.d.ts → binding-FRyTeLDn.d.cts} +5 -3
- package/dist/{chunk-FVX77557.js → chunk-2UR2UWE2.js} +3 -3
- package/dist/{chunk-LBE6DC3V.cjs → chunk-44EQF3AR.cjs} +63 -52
- package/dist/chunk-44EQF3AR.cjs.map +1 -0
- package/dist/{chunk-OAM7HABA.cjs → chunk-4QGEN5SJ.cjs} +340 -263
- package/dist/chunk-4QGEN5SJ.cjs.map +1 -0
- package/dist/{chunk-PD6IQY2Y.cjs → chunk-C5IE4WUG.cjs} +8 -8
- package/dist/{chunk-PD6IQY2Y.cjs.map → chunk-C5IE4WUG.cjs.map} +1 -1
- package/dist/{chunk-DXG3TARY.js → chunk-DIK33H5U.js} +202 -30
- package/dist/chunk-DIK33H5U.js.map +1 -0
- package/dist/{chunk-JVYH76ZX.js → chunk-FESAXMHT.js} +7 -6
- package/dist/{chunk-JVYH76ZX.js.map → chunk-FESAXMHT.js.map} +1 -1
- package/dist/chunk-FHQZCAAK.cjs +112 -0
- package/dist/chunk-FHQZCAAK.cjs.map +1 -0
- package/dist/{chunk-UBFDB6OL.cjs → chunk-QNMYVXRL.cjs} +222 -50
- package/dist/chunk-QNMYVXRL.cjs.map +1 -0
- package/dist/{chunk-N6ODUM2Y.js → chunk-S63VBIWN.js} +27 -16
- package/dist/chunk-S63VBIWN.js.map +1 -0
- package/dist/{chunk-T2LNV5Q5.js → chunk-WIHNVN6L.js} +153 -76
- package/dist/chunk-WIHNVN6L.js.map +1 -0
- package/dist/{devtools-BDp76luf.d.ts → devtools-BtIkN77t.d.cts} +14 -2
- package/dist/{devtools-5AipK9CX.d.cts → devtools-D2z4llpA.d.ts} +14 -2
- package/dist/index.cjs +60 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.dev.js +300 -74
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/internal-list.cjs +4 -4
- package/dist/internal-list.d.cts +2 -2
- package/dist/internal-list.d.ts +2 -2
- package/dist/internal-list.js +3 -3
- package/dist/internal.cjs +5 -5
- package/dist/internal.d.cts +6 -6
- package/dist/internal.d.ts +6 -6
- package/dist/internal.js +4 -4
- package/dist/jsx-dev-runtime.d.cts +671 -0
- package/dist/jsx-dev-runtime.d.ts +671 -0
- package/dist/jsx-runtime.d.cts +671 -0
- package/dist/jsx-runtime.d.ts +671 -0
- package/dist/{list-DL5DOFcO.d.ts → list-BKM6YOPq.d.ts} +2 -2
- package/dist/{list-hP7hQ9Vk.d.cts → list-Bi8dDF8Q.d.cts} +2 -2
- package/dist/loader.cjs +34 -28
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.cts +2 -2
- package/dist/loader.d.ts +2 -2
- package/dist/loader.js +17 -11
- package/dist/loader.js.map +1 -1
- package/dist/{props-BpZz0AOq.d.cts → props-9chMyBGb.d.cts} +2 -2
- package/dist/{props-CjLH0JE-.d.ts → props-D1nj2p_3.d.ts} +2 -2
- package/dist/{resume-BJ4oHLi_.d.cts → resume-C5IKAIdh.d.ts} +2 -2
- package/dist/{resume-CuyJWXP_.d.ts → resume-DPZxmA95.d.cts} +2 -2
- package/dist/{scope-jPt5DHRT.d.ts → scope-BSkhJr0a.d.ts} +1 -1
- package/dist/{scope-BJCtq8hJ.d.cts → scope-Bn3sxem5.d.cts} +1 -1
- package/dist/{signal-C4ISF17w.d.cts → signal-Z4KkDk9h.d.cts} +12 -1
- package/dist/{signal-C4ISF17w.d.ts → signal-Z4KkDk9h.d.ts} +12 -1
- package/package.json +2 -2
- package/src/binding.ts +59 -29
- package/src/context.ts +4 -3
- package/src/devtools.ts +19 -2
- package/src/dom.ts +122 -42
- package/src/effect.ts +5 -5
- package/src/error-boundary.ts +5 -5
- package/src/hooks.ts +13 -5
- package/src/lifecycle.ts +48 -3
- package/src/list-helpers.ts +30 -13
- package/src/loader.ts +20 -12
- package/src/node-ops.ts +8 -5
- package/src/signal.ts +191 -18
- package/src/suspense.ts +5 -4
- package/src/transition.ts +9 -3
- package/dist/chunk-DXG3TARY.js.map +0 -1
- package/dist/chunk-LBE6DC3V.cjs.map +0 -1
- package/dist/chunk-N6ODUM2Y.js.map +0 -1
- package/dist/chunk-OAM7HABA.cjs.map +0 -1
- package/dist/chunk-PG4QX2I2.cjs +0 -111
- package/dist/chunk-PG4QX2I2.cjs.map +0 -1
- package/dist/chunk-T2LNV5Q5.js.map +0 -1
- package/dist/chunk-UBFDB6OL.cjs.map +0 -1
- /package/dist/{chunk-FVX77557.js.map → chunk-2UR2UWE2.js.map} +0 -0
|
@@ -181,8 +181,41 @@ 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
|
-
|
|
210
|
+
const root = {
|
|
211
|
+
parent,
|
|
212
|
+
ownerDocument: parent?.ownerDocument,
|
|
213
|
+
cleanups: [],
|
|
214
|
+
destroyCallbacks: [],
|
|
215
|
+
suspended: false
|
|
216
|
+
};
|
|
217
|
+
registerRootDevtools(root);
|
|
218
|
+
return root;
|
|
186
219
|
}
|
|
187
220
|
function pushRoot(root) {
|
|
188
221
|
if (!enterRootGuard(root)) {
|
|
@@ -262,6 +295,7 @@ function destroyRoot(root) {
|
|
|
262
295
|
if (globalSuspenseHandlers.has(root)) {
|
|
263
296
|
globalSuspenseHandlers.delete(root);
|
|
264
297
|
}
|
|
298
|
+
disposeRootDevtools(root);
|
|
265
299
|
}
|
|
266
300
|
function createRoot(fn, options2) {
|
|
267
301
|
const parent = options2?.inherit ? currentRoot : void 0;
|
|
@@ -398,7 +432,10 @@ function handleSuspend(token, startRoot) {
|
|
|
398
432
|
const handler = handlers[i];
|
|
399
433
|
const handled = handler(token);
|
|
400
434
|
if (handled !== false) {
|
|
401
|
-
if (originRoot)
|
|
435
|
+
if (originRoot) {
|
|
436
|
+
originRoot.suspended = true;
|
|
437
|
+
setRootSuspendDevtools(originRoot, true);
|
|
438
|
+
}
|
|
402
439
|
return true;
|
|
403
440
|
}
|
|
404
441
|
}
|
|
@@ -411,7 +448,10 @@ function handleSuspend(token, startRoot) {
|
|
|
411
448
|
const handler = globalForRoot[i];
|
|
412
449
|
const handled = handler(token);
|
|
413
450
|
if (handled !== false) {
|
|
414
|
-
if (originRoot)
|
|
451
|
+
if (originRoot) {
|
|
452
|
+
originRoot.suspended = true;
|
|
453
|
+
setRootSuspendDevtools(originRoot, true);
|
|
454
|
+
}
|
|
415
455
|
return true;
|
|
416
456
|
}
|
|
417
457
|
}
|
|
@@ -489,18 +529,20 @@ function __fictUseMemo(ctx, fn, optionsOrSlot, slot) {
|
|
|
489
529
|
}
|
|
490
530
|
return ctx.slots[index];
|
|
491
531
|
}
|
|
492
|
-
function __fictUseEffect(ctx, fn, slot) {
|
|
493
|
-
|
|
494
|
-
|
|
532
|
+
function __fictUseEffect(ctx, fn, optionsOrSlot, slot) {
|
|
533
|
+
const options2 = typeof optionsOrSlot === "number" ? void 0 : optionsOrSlot;
|
|
534
|
+
const resolvedSlot = typeof optionsOrSlot === "number" ? optionsOrSlot : slot;
|
|
535
|
+
if (resolvedSlot !== void 0) {
|
|
536
|
+
if (ctx.slots[resolvedSlot]) {
|
|
495
537
|
return;
|
|
496
538
|
}
|
|
497
|
-
ctx.slots[
|
|
539
|
+
ctx.slots[resolvedSlot] = createEffect(fn, options2);
|
|
498
540
|
return;
|
|
499
541
|
}
|
|
500
542
|
assertRenderContext(ctx, "__fictUseEffect");
|
|
501
543
|
const index = ctx.cursor++;
|
|
502
544
|
if (!ctx.slots[index]) {
|
|
503
|
-
ctx.slots[index] = createEffect(fn);
|
|
545
|
+
ctx.slots[index] = createEffect(fn, options2);
|
|
504
546
|
}
|
|
505
547
|
}
|
|
506
548
|
function __fictRender(ctx, fn) {
|
|
@@ -763,6 +805,15 @@ function purgeDeps(sub) {
|
|
|
763
805
|
while (dep !== void 0) dep = unlink(dep, sub);
|
|
764
806
|
}
|
|
765
807
|
function disposeNode(node) {
|
|
808
|
+
if (isDev4) {
|
|
809
|
+
if ("fn" in node && typeof node.fn === "function") {
|
|
810
|
+
disposeEffectDevtools(node);
|
|
811
|
+
} else if ("getter" in node && typeof node.getter === "function") {
|
|
812
|
+
disposeComputedDevtools(node);
|
|
813
|
+
} else if ("currentValue" in node) {
|
|
814
|
+
disposeSignalDevtools(node);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
766
817
|
node.depsTail = void 0;
|
|
767
818
|
node.flags = 0;
|
|
768
819
|
purgeDeps(node);
|
|
@@ -816,6 +867,7 @@ function runEffect(e) {
|
|
|
816
867
|
const flags = e.flags;
|
|
817
868
|
const runCleanup = () => {
|
|
818
869
|
if (!e.runCleanup) return;
|
|
870
|
+
if (isDev4) effectCleanupDevtools(e);
|
|
819
871
|
inCleanup = true;
|
|
820
872
|
activeCleanupFlushId = currentFlushId;
|
|
821
873
|
try {
|
|
@@ -828,7 +880,6 @@ function runEffect(e) {
|
|
|
828
880
|
if (flags & Dirty) {
|
|
829
881
|
runCleanup();
|
|
830
882
|
++cycle;
|
|
831
|
-
if (isDev4) effectRunDevtools(e);
|
|
832
883
|
e.depsTail = void 0;
|
|
833
884
|
e.flags = WatchingRunning;
|
|
834
885
|
const prevSub = activeSub;
|
|
@@ -866,7 +917,6 @@ function runEffect(e) {
|
|
|
866
917
|
if (isDirty) {
|
|
867
918
|
runCleanup();
|
|
868
919
|
++cycle;
|
|
869
|
-
if (isDev4) effectRunDevtools(e);
|
|
870
920
|
e.depsTail = void 0;
|
|
871
921
|
e.flags = WatchingRunning;
|
|
872
922
|
const prevSub = activeSub;
|
|
@@ -900,19 +950,30 @@ function scheduleFlush() {
|
|
|
900
950
|
}
|
|
901
951
|
function flush() {
|
|
902
952
|
beginFlushGuard();
|
|
953
|
+
let flushReported = false;
|
|
954
|
+
const finishFlush = () => {
|
|
955
|
+
if (flushReported && isDev4) {
|
|
956
|
+
flushEndDevtools();
|
|
957
|
+
}
|
|
958
|
+
endFlushGuard();
|
|
959
|
+
};
|
|
903
960
|
if (batchDepth > 0) {
|
|
904
961
|
scheduleFlush();
|
|
905
|
-
|
|
962
|
+
finishFlush();
|
|
906
963
|
return;
|
|
907
964
|
}
|
|
908
965
|
const hasWork = highPriorityQueue.length > 0 || lowPriorityQueue.length > 0;
|
|
909
966
|
if (!hasWork) {
|
|
910
967
|
flushScheduled = false;
|
|
911
|
-
|
|
968
|
+
finishFlush();
|
|
912
969
|
return;
|
|
913
970
|
}
|
|
914
971
|
currentFlushId++;
|
|
915
972
|
flushScheduled = false;
|
|
973
|
+
if (isDev4) {
|
|
974
|
+
flushStartDevtools();
|
|
975
|
+
flushReported = true;
|
|
976
|
+
}
|
|
916
977
|
let highIndex = 0;
|
|
917
978
|
while (highIndex < highPriorityQueue.length) {
|
|
918
979
|
const e = highPriorityQueue[highIndex];
|
|
@@ -932,7 +993,7 @@ function flush() {
|
|
|
932
993
|
highPriorityQueue.length = 0;
|
|
933
994
|
lowPriorityQueue.length = 0;
|
|
934
995
|
flushScheduled = false;
|
|
935
|
-
|
|
996
|
+
finishFlush();
|
|
936
997
|
return;
|
|
937
998
|
}
|
|
938
999
|
highIndex++;
|
|
@@ -947,7 +1008,7 @@ function flush() {
|
|
|
947
1008
|
lowPriorityQueue.length -= lowIndex;
|
|
948
1009
|
}
|
|
949
1010
|
scheduleFlush();
|
|
950
|
-
|
|
1011
|
+
finishFlush();
|
|
951
1012
|
return;
|
|
952
1013
|
}
|
|
953
1014
|
const e = lowPriorityQueue[lowIndex];
|
|
@@ -967,14 +1028,14 @@ function flush() {
|
|
|
967
1028
|
highPriorityQueue.length = 0;
|
|
968
1029
|
lowPriorityQueue.length = 0;
|
|
969
1030
|
flushScheduled = false;
|
|
970
|
-
|
|
1031
|
+
finishFlush();
|
|
971
1032
|
return;
|
|
972
1033
|
}
|
|
973
1034
|
lowIndex++;
|
|
974
1035
|
runEffect(e);
|
|
975
1036
|
}
|
|
976
1037
|
lowPriorityQueue.length = 0;
|
|
977
|
-
|
|
1038
|
+
finishFlush();
|
|
978
1039
|
}
|
|
979
1040
|
function signal(initialValue, options2) {
|
|
980
1041
|
const s = {
|
|
@@ -1047,6 +1108,7 @@ function computed(getter, options2) {
|
|
|
1047
1108
|
if (options2?.equals !== void 0) c.equals = options2.equals;
|
|
1048
1109
|
if (options2?.name !== void 0) c.name = options2.name;
|
|
1049
1110
|
if (options2?.devToolsSource !== void 0) c.devToolsSource = options2.devToolsSource;
|
|
1111
|
+
if (options2?.internal === true) c.devToolsInternal = true;
|
|
1050
1112
|
if (isDev4) registerComputedDevtools(c);
|
|
1051
1113
|
const bound = computedOper.bind(
|
|
1052
1114
|
c
|
|
@@ -1097,7 +1159,7 @@ function computedOper() {
|
|
|
1097
1159
|
if (activeSub !== void 0) link(this, activeSub, cycle);
|
|
1098
1160
|
return this.value;
|
|
1099
1161
|
}
|
|
1100
|
-
function effect(fn) {
|
|
1162
|
+
function effect(fn, options2) {
|
|
1101
1163
|
const e = {
|
|
1102
1164
|
fn,
|
|
1103
1165
|
subs: void 0,
|
|
@@ -1105,6 +1167,8 @@ function effect(fn) {
|
|
|
1105
1167
|
deps: void 0,
|
|
1106
1168
|
depsTail: void 0,
|
|
1107
1169
|
flags: WatchingRunning,
|
|
1170
|
+
...options2?.name !== void 0 ? { name: options2.name } : {},
|
|
1171
|
+
...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
|
|
1108
1172
|
__id: void 0
|
|
1109
1173
|
};
|
|
1110
1174
|
const root = getCurrentRoot();
|
|
@@ -1112,14 +1176,14 @@ function effect(fn) {
|
|
|
1112
1176
|
e.root = root;
|
|
1113
1177
|
}
|
|
1114
1178
|
if (isDev4) registerEffectDevtools(e);
|
|
1179
|
+
e.fn = wrapEffectFnWithDevtoolsTiming(e, fn);
|
|
1115
1180
|
const prevSub = activeSub;
|
|
1116
1181
|
if (prevSub !== void 0) link(e, prevSub, 0);
|
|
1117
1182
|
activeSub = e;
|
|
1118
1183
|
let didThrow = false;
|
|
1119
1184
|
let thrown;
|
|
1120
1185
|
try {
|
|
1121
|
-
|
|
1122
|
-
fn();
|
|
1186
|
+
e.fn();
|
|
1123
1187
|
} catch (err) {
|
|
1124
1188
|
didThrow = true;
|
|
1125
1189
|
thrown = err;
|
|
@@ -1136,7 +1200,7 @@ function effect(fn) {
|
|
|
1136
1200
|
disposer[EFFECT_MARKER] = true;
|
|
1137
1201
|
return disposer;
|
|
1138
1202
|
}
|
|
1139
|
-
function effectWithCleanup(fn, cleanupRunner, root) {
|
|
1203
|
+
function effectWithCleanup(fn, cleanupRunner, root, options2) {
|
|
1140
1204
|
const e = {
|
|
1141
1205
|
fn,
|
|
1142
1206
|
subs: void 0,
|
|
@@ -1145,6 +1209,8 @@ function effectWithCleanup(fn, cleanupRunner, root) {
|
|
|
1145
1209
|
depsTail: void 0,
|
|
1146
1210
|
flags: WatchingRunning,
|
|
1147
1211
|
runCleanup: cleanupRunner,
|
|
1212
|
+
...options2?.name !== void 0 ? { name: options2.name } : {},
|
|
1213
|
+
...options2?.devToolsSource !== void 0 ? { devToolsSource: options2.devToolsSource } : {},
|
|
1148
1214
|
__id: void 0
|
|
1149
1215
|
};
|
|
1150
1216
|
const resolvedRoot = root ?? getCurrentRoot();
|
|
@@ -1152,14 +1218,14 @@ function effectWithCleanup(fn, cleanupRunner, root) {
|
|
|
1152
1218
|
e.root = resolvedRoot;
|
|
1153
1219
|
}
|
|
1154
1220
|
if (isDev4) registerEffectDevtools(e);
|
|
1221
|
+
e.fn = wrapEffectFnWithDevtoolsTiming(e, fn);
|
|
1155
1222
|
const prevSub = activeSub;
|
|
1156
1223
|
if (prevSub !== void 0) link(e, prevSub, 0);
|
|
1157
1224
|
activeSub = e;
|
|
1158
1225
|
let didThrow = false;
|
|
1159
1226
|
let thrown;
|
|
1160
1227
|
try {
|
|
1161
|
-
|
|
1162
|
-
fn();
|
|
1228
|
+
e.fn();
|
|
1163
1229
|
} catch (err) {
|
|
1164
1230
|
didThrow = true;
|
|
1165
1231
|
thrown = err;
|
|
@@ -1206,7 +1272,11 @@ function effectScopeOper() {
|
|
|
1206
1272
|
disposeNode(this);
|
|
1207
1273
|
}
|
|
1208
1274
|
function batch(fn) {
|
|
1275
|
+
const enteringOuterBatch = batchDepth === 0;
|
|
1209
1276
|
++batchDepth;
|
|
1277
|
+
if (enteringOuterBatch && isDev4) {
|
|
1278
|
+
batchStartDevtools();
|
|
1279
|
+
}
|
|
1210
1280
|
let result;
|
|
1211
1281
|
let error;
|
|
1212
1282
|
try {
|
|
@@ -1216,6 +1286,9 @@ function batch(fn) {
|
|
|
1216
1286
|
} finally {
|
|
1217
1287
|
--batchDepth;
|
|
1218
1288
|
if (batchDepth === 0) {
|
|
1289
|
+
if (isDev4) {
|
|
1290
|
+
batchEndDevtools();
|
|
1291
|
+
}
|
|
1219
1292
|
try {
|
|
1220
1293
|
flush();
|
|
1221
1294
|
} catch (flushErr) {
|
|
@@ -1246,6 +1319,7 @@ function __resetReactiveState() {
|
|
|
1246
1319
|
cycle = 0;
|
|
1247
1320
|
currentFlushId = 0;
|
|
1248
1321
|
activeCleanupFlushId = 0;
|
|
1322
|
+
clearDevtoolsSignalSetters();
|
|
1249
1323
|
}
|
|
1250
1324
|
function untrack(fn) {
|
|
1251
1325
|
const prev = activeSub;
|
|
@@ -1276,18 +1350,49 @@ function setTransitionContext(value) {
|
|
|
1276
1350
|
var registerSignalDevtools = () => void 0;
|
|
1277
1351
|
var updateSignalDevtools = () => {
|
|
1278
1352
|
};
|
|
1353
|
+
var disposeSignalDevtools = () => {
|
|
1354
|
+
};
|
|
1279
1355
|
var registerComputedDevtools = () => void 0;
|
|
1280
1356
|
var updateComputedDevtools = () => {
|
|
1281
1357
|
};
|
|
1358
|
+
var disposeComputedDevtools = () => {
|
|
1359
|
+
};
|
|
1282
1360
|
var registerEffectDevtools = () => void 0;
|
|
1283
1361
|
var effectRunDevtools = () => {
|
|
1284
1362
|
};
|
|
1363
|
+
var wrapEffectFnWithDevtoolsTiming = (_node, fn) => fn;
|
|
1364
|
+
var effectCleanupDevtools = () => {
|
|
1365
|
+
};
|
|
1366
|
+
var disposeEffectDevtools = () => {
|
|
1367
|
+
};
|
|
1285
1368
|
var trackDependencyDevtools = () => {
|
|
1286
1369
|
};
|
|
1287
1370
|
var untrackDependencyDevtools = () => {
|
|
1288
1371
|
};
|
|
1372
|
+
var batchStartDevtools = () => {
|
|
1373
|
+
};
|
|
1374
|
+
var batchEndDevtools = () => {
|
|
1375
|
+
};
|
|
1376
|
+
var flushStartDevtools = () => {
|
|
1377
|
+
};
|
|
1378
|
+
var flushEndDevtools = () => {
|
|
1379
|
+
};
|
|
1380
|
+
var clearDevtoolsSignalSetters = () => {
|
|
1381
|
+
};
|
|
1289
1382
|
if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
|
|
1290
1383
|
let nextDevtoolsId = 0;
|
|
1384
|
+
const getSignalSetterMap = () => {
|
|
1385
|
+
if (typeof globalThis === "undefined") return void 0;
|
|
1386
|
+
const global = globalThis;
|
|
1387
|
+
if (!global.__FICT_DEVTOOLS_SIGNALS__) {
|
|
1388
|
+
global.__FICT_DEVTOOLS_SIGNALS__ = /* @__PURE__ */ new Map();
|
|
1389
|
+
}
|
|
1390
|
+
return global.__FICT_DEVTOOLS_SIGNALS__;
|
|
1391
|
+
};
|
|
1392
|
+
const getExistingSignalSetterMap = () => {
|
|
1393
|
+
if (typeof globalThis === "undefined") return void 0;
|
|
1394
|
+
return globalThis.__FICT_DEVTOOLS_SIGNALS__;
|
|
1395
|
+
};
|
|
1291
1396
|
registerSignalDevtools = (node) => {
|
|
1292
1397
|
const hook = getDevtoolsHook();
|
|
1293
1398
|
if (!hook) return void 0;
|
|
@@ -1299,6 +1404,9 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
|
|
|
1299
1404
|
if (ownerId !== void 0) options2.ownerId = ownerId;
|
|
1300
1405
|
hook.registerSignal(id, node.currentValue, options2);
|
|
1301
1406
|
node.__id = id;
|
|
1407
|
+
getSignalSetterMap()?.set(id, (value) => {
|
|
1408
|
+
signalOper.call(node, value);
|
|
1409
|
+
});
|
|
1302
1410
|
return id;
|
|
1303
1411
|
};
|
|
1304
1412
|
updateSignalDevtools = (node, value) => {
|
|
@@ -1307,9 +1415,19 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
|
|
|
1307
1415
|
const id = node.__id;
|
|
1308
1416
|
if (id) hook.updateSignal(id, value);
|
|
1309
1417
|
};
|
|
1418
|
+
disposeSignalDevtools = (node) => {
|
|
1419
|
+
const identifiable = node;
|
|
1420
|
+
const id = identifiable.__id;
|
|
1421
|
+
if (!id) return;
|
|
1422
|
+
const hook = getDevtoolsHook();
|
|
1423
|
+
hook?.disposeSignal?.(id);
|
|
1424
|
+
getExistingSignalSetterMap()?.delete(id);
|
|
1425
|
+
delete identifiable.__id;
|
|
1426
|
+
};
|
|
1310
1427
|
registerComputedDevtools = (node) => {
|
|
1311
1428
|
const hook = getDevtoolsHook();
|
|
1312
1429
|
if (!hook) return void 0;
|
|
1430
|
+
if (node.devToolsInternal) return void 0;
|
|
1313
1431
|
const id = ++nextDevtoolsId;
|
|
1314
1432
|
const options2 = {};
|
|
1315
1433
|
if (node.name !== void 0) options2.name = node.name;
|
|
@@ -1327,20 +1445,55 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
|
|
|
1327
1445
|
const id = node.__id;
|
|
1328
1446
|
if (id) hook.updateComputed(id, value);
|
|
1329
1447
|
};
|
|
1448
|
+
disposeComputedDevtools = (node) => {
|
|
1449
|
+
const identifiable = node;
|
|
1450
|
+
const id = identifiable.__id;
|
|
1451
|
+
if (!id) return;
|
|
1452
|
+
const hook = getDevtoolsHook();
|
|
1453
|
+
hook?.disposeComputed?.(id);
|
|
1454
|
+
delete identifiable.__id;
|
|
1455
|
+
};
|
|
1330
1456
|
registerEffectDevtools = (node) => {
|
|
1331
1457
|
const hook = getDevtoolsHook();
|
|
1332
1458
|
if (!hook) return void 0;
|
|
1333
1459
|
const id = ++nextDevtoolsId;
|
|
1460
|
+
const options2 = {};
|
|
1334
1461
|
const ownerId = __fictGetCurrentComponentId();
|
|
1335
|
-
|
|
1462
|
+
if (ownerId !== void 0) options2.ownerId = ownerId;
|
|
1463
|
+
if (node.devToolsSource !== void 0) options2.source = node.devToolsSource;
|
|
1464
|
+
hook.registerEffect(id, Object.keys(options2).length > 0 ? options2 : void 0);
|
|
1336
1465
|
node.__id = id;
|
|
1337
1466
|
return id;
|
|
1338
1467
|
};
|
|
1339
|
-
effectRunDevtools = (node) => {
|
|
1468
|
+
effectRunDevtools = (node, duration) => {
|
|
1469
|
+
const hook = getDevtoolsHook();
|
|
1470
|
+
if (!hook) return;
|
|
1471
|
+
const id = node.__id;
|
|
1472
|
+
if (id) hook.effectRun(id, duration);
|
|
1473
|
+
};
|
|
1474
|
+
wrapEffectFnWithDevtoolsTiming = (node, fn) => {
|
|
1475
|
+
return () => {
|
|
1476
|
+
const startedAt = performance.now();
|
|
1477
|
+
try {
|
|
1478
|
+
fn();
|
|
1479
|
+
} finally {
|
|
1480
|
+
effectRunDevtools(node, performance.now() - startedAt);
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
};
|
|
1484
|
+
effectCleanupDevtools = (node) => {
|
|
1340
1485
|
const hook = getDevtoolsHook();
|
|
1341
1486
|
if (!hook) return;
|
|
1342
1487
|
const id = node.__id;
|
|
1343
|
-
if (id) hook.
|
|
1488
|
+
if (id) hook.effectCleanup?.(id);
|
|
1489
|
+
};
|
|
1490
|
+
disposeEffectDevtools = (node) => {
|
|
1491
|
+
const identifiable = node;
|
|
1492
|
+
const id = identifiable.__id;
|
|
1493
|
+
if (!id) return;
|
|
1494
|
+
const hook = getDevtoolsHook();
|
|
1495
|
+
hook?.disposeEffect?.(id);
|
|
1496
|
+
delete identifiable.__id;
|
|
1344
1497
|
};
|
|
1345
1498
|
trackDependencyDevtools = (dep, sub) => {
|
|
1346
1499
|
const hook = getDevtoolsHook();
|
|
@@ -1356,6 +1509,25 @@ if (typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" &&
|
|
|
1356
1509
|
const subId = sub.__id;
|
|
1357
1510
|
if (depId && subId) hook.untrackDependency(subId, depId);
|
|
1358
1511
|
};
|
|
1512
|
+
batchStartDevtools = () => {
|
|
1513
|
+
const hook = getDevtoolsHook();
|
|
1514
|
+
hook?.batchStart?.();
|
|
1515
|
+
};
|
|
1516
|
+
batchEndDevtools = () => {
|
|
1517
|
+
const hook = getDevtoolsHook();
|
|
1518
|
+
hook?.batchEnd?.();
|
|
1519
|
+
};
|
|
1520
|
+
flushStartDevtools = () => {
|
|
1521
|
+
const hook = getDevtoolsHook();
|
|
1522
|
+
hook?.flushStart?.();
|
|
1523
|
+
};
|
|
1524
|
+
flushEndDevtools = () => {
|
|
1525
|
+
const hook = getDevtoolsHook();
|
|
1526
|
+
hook?.flushEnd?.();
|
|
1527
|
+
};
|
|
1528
|
+
clearDevtoolsSignalSetters = () => {
|
|
1529
|
+
getExistingSignalSetterMap()?.clear();
|
|
1530
|
+
};
|
|
1359
1531
|
}
|
|
1360
1532
|
function createSelector(source, equalityFn = (a, b) => a === b) {
|
|
1361
1533
|
let current = source();
|
|
@@ -1385,7 +1557,7 @@ function createSelector(source, equalityFn = (a, b) => a === b) {
|
|
|
1385
1557
|
}
|
|
1386
1558
|
|
|
1387
1559
|
// src/effect.ts
|
|
1388
|
-
function createEffect(fn) {
|
|
1560
|
+
function createEffect(fn, options2) {
|
|
1389
1561
|
let cleanups = [];
|
|
1390
1562
|
const rootForError = getCurrentRoot();
|
|
1391
1563
|
const doCleanup = () => {
|
|
@@ -1412,7 +1584,7 @@ function createEffect(fn) {
|
|
|
1412
1584
|
});
|
|
1413
1585
|
cleanups = bucket;
|
|
1414
1586
|
};
|
|
1415
|
-
const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
|
|
1587
|
+
const disposeEffect = effectWithCleanup(run, doCleanup, rootForError, options2);
|
|
1416
1588
|
const teardown = () => {
|
|
1417
1589
|
runCleanupList(cleanups);
|
|
1418
1590
|
disposeEffect();
|
|
@@ -1420,7 +1592,7 @@ function createEffect(fn) {
|
|
|
1420
1592
|
registerRootCleanup(teardown);
|
|
1421
1593
|
return teardown;
|
|
1422
1594
|
}
|
|
1423
|
-
function createRenderEffect(fn) {
|
|
1595
|
+
function createRenderEffect(fn, options2) {
|
|
1424
1596
|
let cleanup;
|
|
1425
1597
|
const rootForError = getCurrentRoot();
|
|
1426
1598
|
const doCleanup = () => {
|
|
@@ -1446,7 +1618,7 @@ function createRenderEffect(fn) {
|
|
|
1446
1618
|
throw err;
|
|
1447
1619
|
}
|
|
1448
1620
|
};
|
|
1449
|
-
const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
|
|
1621
|
+
const disposeEffect = effectWithCleanup(run, doCleanup, rootForError, options2);
|
|
1450
1622
|
const teardown = () => {
|
|
1451
1623
|
if (cleanup) {
|
|
1452
1624
|
cleanup();
|
|
@@ -2555,4 +2727,4 @@ export {
|
|
|
2555
2727
|
serializeValue,
|
|
2556
2728
|
deserializeValue
|
|
2557
2729
|
};
|
|
2558
|
-
//# sourceMappingURL=chunk-
|
|
2730
|
+
//# sourceMappingURL=chunk-DIK33H5U.js.map
|