@fictjs/runtime 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.cjs +8 -8
- package/dist/advanced.d.cts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +3 -3
- package/dist/{chunk-YQ4IB7NC.cjs → chunk-7EAEROZ5.cjs} +7 -7
- package/dist/{chunk-YQ4IB7NC.cjs.map → chunk-7EAEROZ5.cjs.map} +1 -1
- package/dist/{chunk-CF3OHML2.js → chunk-7TPCESQS.js} +2 -2
- package/dist/{chunk-BWZFJXUI.js → chunk-FOLRR3NZ.js} +84 -10
- package/dist/chunk-FOLRR3NZ.js.map +1 -0
- package/dist/{chunk-7WAGAQLT.cjs → chunk-MWI3USXB.cjs} +84 -10
- package/dist/chunk-MWI3USXB.cjs.map +1 -0
- package/dist/{chunk-V62XZLDU.js → chunk-VVNMIER7.js} +2 -2
- package/dist/{chunk-V62XZLDU.js.map → chunk-VVNMIER7.js.map} +1 -1
- package/dist/{chunk-Q4EN6BXV.cjs → chunk-Z5WRKD7Y.cjs} +16 -16
- package/dist/{chunk-Q4EN6BXV.cjs.map → chunk-Z5WRKD7Y.cjs.map} +1 -1
- package/dist/{context-B7UYnfzM.d.ts → context-4woHo7-L.d.ts} +1 -1
- package/dist/{context-UXySaqI_.d.cts → context-9gFXOdJl.d.cts} +1 -1
- package/dist/{effect-Auji1rz9.d.cts → effect-ClARNUCc.d.cts} +23 -2
- package/dist/{effect-Auji1rz9.d.ts → effect-ClARNUCc.d.ts} +23 -2
- package/dist/index.cjs +51 -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 +71 -28
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +15 -22
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +64 -42
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +4 -4
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +32 -10
- package/dist/internal.js.map +1 -1
- package/dist/{props-BfmSLuyp.d.cts → props-CBwuh35e.d.cts} +4 -4
- package/dist/{props-BBi8Tkks.d.ts → props-DAyeRPwH.d.ts} +4 -4
- package/dist/{scope-S6eAzBJZ.d.ts → scope-DvgMquEy.d.ts} +1 -1
- package/dist/{scope-DKYzWfTn.d.cts → scope-xmdo6lVU.d.cts} +1 -1
- package/package.json +1 -1
- package/src/binding.ts +58 -5
- package/src/context.ts +1 -1
- package/src/effect.ts +9 -2
- package/src/error-boundary.ts +9 -9
- package/src/lifecycle.ts +13 -3
- package/src/signal.ts +44 -4
- package/src/store.ts +42 -20
- package/src/suspense.ts +14 -15
- package/dist/chunk-7WAGAQLT.cjs.map +0 -1
- package/dist/chunk-BWZFJXUI.js.map +0 -1
- /package/dist/{chunk-CF3OHML2.js.map → chunk-7TPCESQS.js.map} +0 -0
package/dist/advanced.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkZ5WRKD7Ycjs = require('./chunk-Z5WRKD7Y.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk7EAEROZ5cjs = require('./chunk-7EAEROZ5.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -23,13 +23,13 @@ var _chunkYQ4IB7NCcjs = require('./chunk-YQ4IB7NC.cjs');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkMWI3USXBcjs = require('./chunk-MWI3USXB.cjs');
|
|
27
27
|
|
|
28
28
|
// src/versioned-signal.ts
|
|
29
29
|
function createVersionedSignal(initialValue, options) {
|
|
30
30
|
const equals = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.equals]), () => ( Object.is));
|
|
31
|
-
const value =
|
|
32
|
-
const version =
|
|
31
|
+
const value = _chunkMWI3USXBcjs.signal.call(void 0, initialValue);
|
|
32
|
+
const version = _chunkMWI3USXBcjs.signal.call(void 0, 0);
|
|
33
33
|
const bumpVersion = () => {
|
|
34
34
|
const next = version() + 1;
|
|
35
35
|
version(next);
|
|
@@ -50,8 +50,8 @@ function createVersionedSignal(initialValue, options) {
|
|
|
50
50
|
force: () => {
|
|
51
51
|
bumpVersion();
|
|
52
52
|
},
|
|
53
|
-
peekVersion: () =>
|
|
54
|
-
peekValue: () =>
|
|
53
|
+
peekVersion: () => _chunkMWI3USXBcjs.untrack.call(void 0, () => version()),
|
|
54
|
+
peekValue: () => _chunkMWI3USXBcjs.untrack.call(void 0, () => value())
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -75,5 +75,5 @@ function createVersionedSignal(initialValue, options) {
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
exports.createAttributeBinding =
|
|
78
|
+
exports.createAttributeBinding = _chunkMWI3USXBcjs.createAttributeBinding; exports.createChildBinding = _chunkMWI3USXBcjs.createChildBinding; exports.createClassBinding = _chunkMWI3USXBcjs.createClassBinding; exports.createContext = _chunkZ5WRKD7Ycjs.createContext; exports.createRenderEffect = _chunkMWI3USXBcjs.createRenderEffect; exports.createScope = _chunk7EAEROZ5cjs.createScope; exports.createSelector = _chunkMWI3USXBcjs.createSelector; exports.createShow = _chunkMWI3USXBcjs.createShow; exports.createSignal = _chunkMWI3USXBcjs.signal; exports.createStyleBinding = _chunkMWI3USXBcjs.createStyleBinding; exports.createTextBinding = _chunkMWI3USXBcjs.createTextBinding; exports.createVersionedSignal = createVersionedSignal; exports.effectScope = _chunkMWI3USXBcjs.effectScope; exports.getDevtoolsHook = _chunkMWI3USXBcjs.getDevtoolsHook; exports.hasContext = _chunkZ5WRKD7Ycjs.hasContext; exports.isReactive = _chunkMWI3USXBcjs.isReactive; exports.runInScope = _chunk7EAEROZ5cjs.runInScope; exports.setCycleProtectionOptions = _chunkMWI3USXBcjs.setCycleProtectionOptions; exports.unwrap = _chunkMWI3USXBcjs.unwrap; exports.useContext = _chunkZ5WRKD7Ycjs.useContext;
|
|
79
79
|
//# sourceMappingURL=advanced.cjs.map
|
package/dist/advanced.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-
|
|
2
|
-
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-
|
|
3
|
-
export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-
|
|
1
|
+
export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-xmdo6lVU.cjs';
|
|
2
|
+
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-ClARNUCc.cjs';
|
|
3
|
+
export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-9gFXOdJl.cjs';
|
|
4
4
|
|
|
5
5
|
interface VersionedSignalOptions<T> {
|
|
6
6
|
equals?: (prev: T, next: T) => boolean;
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-
|
|
2
|
-
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-
|
|
3
|
-
export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-
|
|
1
|
+
export { R as ReactiveScope, S as Signal, c as createScope, a as createSelector, s as createSignal, e as effectScope, r as runInScope } from './scope-DvgMquEy.js';
|
|
2
|
+
export { b as createAttributeBinding, a as createChildBinding, e as createClassBinding, g as createRenderEffect, f as createShow, d as createStyleBinding, c as createTextBinding, i as isReactive, u as unwrap } from './effect-ClARNUCc.js';
|
|
3
|
+
export { C as Context, P as ProviderProps, c as createContext, h as hasContext, u as useContext } from './context-4woHo7-L.js';
|
|
4
4
|
|
|
5
5
|
interface VersionedSignalOptions<T> {
|
|
6
6
|
equals?: (prev: T, next: T) => boolean;
|
package/dist/advanced.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createContext,
|
|
3
3
|
hasContext,
|
|
4
4
|
useContext
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VVNMIER7.js";
|
|
6
6
|
import {
|
|
7
7
|
createScope,
|
|
8
8
|
runInScope
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7TPCESQS.js";
|
|
10
10
|
import {
|
|
11
11
|
createAttributeBinding,
|
|
12
12
|
createChildBinding,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
signal,
|
|
24
24
|
untrack,
|
|
25
25
|
unwrap
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FOLRR3NZ.js";
|
|
27
27
|
|
|
28
28
|
// src/versioned-signal.ts
|
|
29
29
|
function createVersionedSignal(initialValue, options) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkMWI3USXBcjs = require('./chunk-MWI3USXB.cjs');
|
|
8
8
|
|
|
9
9
|
// src/scope.ts
|
|
10
10
|
function createScope() {
|
|
@@ -17,17 +17,17 @@ function createScope() {
|
|
|
17
17
|
};
|
|
18
18
|
const run = (fn) => {
|
|
19
19
|
stop();
|
|
20
|
-
const { dispose: rootDispose, value } =
|
|
20
|
+
const { dispose: rootDispose, value } = _chunkMWI3USXBcjs.createRoot.call(void 0, fn, { inherit: true });
|
|
21
21
|
dispose = rootDispose;
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
_chunkMWI3USXBcjs.registerRootCleanup.call(void 0, stop);
|
|
25
25
|
return { run, stop };
|
|
26
26
|
}
|
|
27
27
|
function runInScope(flag, fn) {
|
|
28
28
|
const scope = createScope();
|
|
29
|
-
const evaluate = () =>
|
|
30
|
-
|
|
29
|
+
const evaluate = () => _chunkMWI3USXBcjs.isReactive.call(void 0, flag) ? flag() : !!flag;
|
|
30
|
+
_chunkMWI3USXBcjs.createEffect.call(void 0, () => {
|
|
31
31
|
const enabled = evaluate();
|
|
32
32
|
if (enabled) {
|
|
33
33
|
scope.run(fn);
|
|
@@ -35,11 +35,11 @@ function runInScope(flag, fn) {
|
|
|
35
35
|
scope.stop();
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
_chunkMWI3USXBcjs.onCleanup.call(void 0, scope.stop);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
exports.createScope = createScope; exports.runInScope = runInScope;
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-7EAEROZ5.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-7EAEROZ5.cjs","../src/scope.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACOO,SAAS,WAAA,CAAA,EAA6B;AAC3C,EAAA,IAAI,QAAA,EAA+B,IAAA;AAEnC,EAAA,MAAM,KAAA,EAAO,CAAA,EAAA,GAAM;AACjB,IAAA,GAAA,CAAI,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,CAAA;AACR,MAAA,QAAA,EAAU,IAAA;AAAA,IACZ;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,IAAA,EAAM,CAAI,EAAA,EAAA,GAAmB;AACjC,IAAA,IAAA,CAAK,CAAA;AACL,IAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAa,MAAM,EAAA,EAAI,0CAAA,EAAW,EAAI,EAAE,OAAA,EAAS,KAAK,CAAC,CAAA;AACxE,IAAA,QAAA,EAAU,WAAA;AACV,IAAA,OAAO,KAAA;AAAA,EACT,CAAA;AAEA,EAAA,mDAAA,IAAwB,CAAA;AACxB,EAAA,OAAO,EAAE,GAAA,EAAK,KAAK,CAAA;AACrB;AAMO,SAAS,UAAA,CAAW,IAAA,EAA8B,EAAA,EAAsB;AAC7E,EAAA,MAAM,MAAA,EAAQ,WAAA,CAAY,CAAA;AAC1B,EAAA,MAAM,SAAA,EAAW,CAAA,EAAA,GAAO,0CAAA,IAAe,EAAA,EAAK,IAAA,CAAuB,EAAA,EAAI,CAAC,CAAC,IAAA;AAEzE,EAAA,4CAAA,CAAa,EAAA,GAAM;AACjB,IAAA,MAAM,QAAA,EAAU,QAAA,CAAS,CAAA;AACzB,IAAA,GAAA,CAAI,OAAA,EAAS;AACX,MAAA,KAAA,CAAM,GAAA,CAAI,EAAE,CAAA;AAAA,IACd,EAAA,KAAO;AACL,MAAA,KAAA,CAAM,IAAA,CAAK,CAAA;AAAA,IACb;AAAA,EACF,CAAC,CAAA;AAED,EAAA,yCAAA,KAAU,CAAM,IAAI,CAAA;AACtB;ADfA;AACA;AACE;AACA;AACF,mEAAC","file":"/home/runner/work/fict/fict/packages/runtime/dist/chunk-7EAEROZ5.cjs","sourcesContent":[null,"import { isReactive, type MaybeReactive } from './binding'\nimport { createEffect } from './effect'\nimport { createRoot, onCleanup, registerRootCleanup } from './lifecycle'\n\nexport { effectScope } from './signal'\n\nexport interface ReactiveScope {\n run<T>(fn: () => T): T\n stop(): void\n}\n\n/**\n * Create an explicit reactive scope that can contain effects/memos and be stopped manually.\n * The scope registers with the current root for cleanup.\n */\nexport function createScope(): ReactiveScope {\n let dispose: (() => void) | null = null\n\n const stop = () => {\n if (dispose) {\n dispose()\n dispose = null\n }\n }\n\n const run = <T>(fn: () => T): T => {\n stop()\n const { dispose: rootDispose, value } = createRoot(fn, { inherit: true })\n dispose = rootDispose\n return value\n }\n\n registerRootCleanup(stop)\n return { run, stop }\n}\n\n/**\n * Run a block of reactive code inside a managed scope that follows a boolean flag.\n * When the flag turns false, the scope is disposed and all contained effects/memos are cleaned up.\n */\nexport function runInScope(flag: MaybeReactive<boolean>, fn: () => void): void {\n const scope = createScope()\n const evaluate = () => (isReactive(flag) ? (flag as () => boolean)() : !!flag)\n\n createEffect(() => {\n const enabled = evaluate()\n if (enabled) {\n scope.run(fn)\n } else {\n scope.stop()\n }\n })\n\n onCleanup(scope.stop)\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isReactive,
|
|
5
5
|
onCleanup,
|
|
6
6
|
registerRootCleanup
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FOLRR3NZ.js";
|
|
8
8
|
|
|
9
9
|
// src/scope.ts
|
|
10
10
|
function createScope() {
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
createScope,
|
|
43
43
|
runInScope
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
45
|
+
//# sourceMappingURL=chunk-7TPCESQS.js.map
|
|
@@ -512,7 +512,7 @@ var currentEffectCleanups;
|
|
|
512
512
|
var globalErrorHandlers = /* @__PURE__ */ new WeakMap();
|
|
513
513
|
var globalSuspenseHandlers = /* @__PURE__ */ new WeakMap();
|
|
514
514
|
function createRootContext(parent) {
|
|
515
|
-
return { parent, cleanups: [], destroyCallbacks: [] };
|
|
515
|
+
return { parent, cleanups: [], destroyCallbacks: [], suspended: false };
|
|
516
516
|
}
|
|
517
517
|
function pushRoot(root) {
|
|
518
518
|
if (!enterRootGuard(root)) {
|
|
@@ -714,13 +714,17 @@ function handleError(err, info, startRoot) {
|
|
|
714
714
|
}
|
|
715
715
|
function handleSuspend(token, startRoot) {
|
|
716
716
|
let root = startRoot ?? currentRoot;
|
|
717
|
+
const originRoot = root;
|
|
717
718
|
while (root) {
|
|
718
719
|
const handlers = root.suspenseHandlers;
|
|
719
720
|
if (handlers && handlers.length) {
|
|
720
721
|
for (let i = handlers.length - 1; i >= 0; i--) {
|
|
721
722
|
const handler = handlers[i];
|
|
722
723
|
const handled = handler(token);
|
|
723
|
-
if (handled !== false)
|
|
724
|
+
if (handled !== false) {
|
|
725
|
+
if (originRoot) originRoot.suspended = true;
|
|
726
|
+
return true;
|
|
727
|
+
}
|
|
724
728
|
}
|
|
725
729
|
}
|
|
726
730
|
root = root.parent;
|
|
@@ -730,7 +734,10 @@ function handleSuspend(token, startRoot) {
|
|
|
730
734
|
for (let i = globalForRoot.length - 1; i >= 0; i--) {
|
|
731
735
|
const handler = globalForRoot[i];
|
|
732
736
|
const handled = handler(token);
|
|
733
|
-
if (handled !== false)
|
|
737
|
+
if (handled !== false) {
|
|
738
|
+
if (originRoot) originRoot.suspended = true;
|
|
739
|
+
return true;
|
|
740
|
+
}
|
|
734
741
|
}
|
|
735
742
|
}
|
|
736
743
|
return false;
|
|
@@ -1054,7 +1061,25 @@ function runEffect(e) {
|
|
|
1054
1061
|
inCleanup = false;
|
|
1055
1062
|
}
|
|
1056
1063
|
}
|
|
1057
|
-
|
|
1064
|
+
let isDirty = false;
|
|
1065
|
+
try {
|
|
1066
|
+
isDirty = checkDirty(e.deps, e);
|
|
1067
|
+
} catch (err) {
|
|
1068
|
+
if (handleSuspend(err, e.root)) {
|
|
1069
|
+
if (e.flags !== 0) {
|
|
1070
|
+
e.flags = Watching;
|
|
1071
|
+
}
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
if (handleError(err, { source: "effect" }, e.root)) {
|
|
1075
|
+
if (e.flags !== 0) {
|
|
1076
|
+
e.flags = Watching;
|
|
1077
|
+
}
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
throw err;
|
|
1081
|
+
}
|
|
1082
|
+
if (isDirty) {
|
|
1058
1083
|
++cycle;
|
|
1059
1084
|
effectRunDevtools(e);
|
|
1060
1085
|
e.depsTail = void 0;
|
|
@@ -1241,6 +1266,10 @@ function effect(fn) {
|
|
|
1241
1266
|
flags: WatchingRunning,
|
|
1242
1267
|
__id: void 0
|
|
1243
1268
|
};
|
|
1269
|
+
const root = getCurrentRoot();
|
|
1270
|
+
if (root) {
|
|
1271
|
+
e.root = root;
|
|
1272
|
+
}
|
|
1244
1273
|
registerEffectDevtools(e);
|
|
1245
1274
|
const prevSub = activeSub;
|
|
1246
1275
|
if (prevSub !== void 0) link(e, prevSub, 0);
|
|
@@ -1256,7 +1285,7 @@ function effect(fn) {
|
|
|
1256
1285
|
disposer[EFFECT_MARKER] = true;
|
|
1257
1286
|
return disposer;
|
|
1258
1287
|
}
|
|
1259
|
-
function effectWithCleanup(fn, cleanupRunner) {
|
|
1288
|
+
function effectWithCleanup(fn, cleanupRunner, root) {
|
|
1260
1289
|
const e = {
|
|
1261
1290
|
fn,
|
|
1262
1291
|
subs: void 0,
|
|
@@ -1267,6 +1296,10 @@ function effectWithCleanup(fn, cleanupRunner) {
|
|
|
1267
1296
|
runCleanup: cleanupRunner,
|
|
1268
1297
|
__id: void 0
|
|
1269
1298
|
};
|
|
1299
|
+
const resolvedRoot = root ?? getCurrentRoot();
|
|
1300
|
+
if (resolvedRoot) {
|
|
1301
|
+
e.root = resolvedRoot;
|
|
1302
|
+
}
|
|
1270
1303
|
registerEffectDevtools(e);
|
|
1271
1304
|
const prevSub = activeSub;
|
|
1272
1305
|
if (prevSub !== void 0) link(e, prevSub, 0);
|
|
@@ -1341,6 +1374,18 @@ function untrack(fn) {
|
|
|
1341
1374
|
activeSub = prev;
|
|
1342
1375
|
}
|
|
1343
1376
|
}
|
|
1377
|
+
function isSignal(fn) {
|
|
1378
|
+
return typeof fn === "function" && fn[SIGNAL_MARKER] === true;
|
|
1379
|
+
}
|
|
1380
|
+
function isComputed(fn) {
|
|
1381
|
+
return typeof fn === "function" && fn[COMPUTED_MARKER] === true;
|
|
1382
|
+
}
|
|
1383
|
+
function isEffect(fn) {
|
|
1384
|
+
return typeof fn === "function" && fn[EFFECT_MARKER] === true;
|
|
1385
|
+
}
|
|
1386
|
+
function isEffectScope(fn) {
|
|
1387
|
+
return typeof fn === "function" && fn[EFFECT_SCOPE_MARKER] === true;
|
|
1388
|
+
}
|
|
1344
1389
|
function setTransitionContext(value) {
|
|
1345
1390
|
const prev = isInTransition;
|
|
1346
1391
|
isInTransition = value;
|
|
@@ -1428,6 +1473,9 @@ function createEffect(fn) {
|
|
|
1428
1473
|
bucket.push(maybeCleanup);
|
|
1429
1474
|
}
|
|
1430
1475
|
} catch (err) {
|
|
1476
|
+
if (handleSuspend(err, rootForError)) {
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1431
1479
|
if (handleError(err, { source: "effect" }, rootForError)) {
|
|
1432
1480
|
return;
|
|
1433
1481
|
}
|
|
@@ -1436,7 +1484,7 @@ function createEffect(fn) {
|
|
|
1436
1484
|
});
|
|
1437
1485
|
cleanups = bucket;
|
|
1438
1486
|
};
|
|
1439
|
-
const disposeEffect = effectWithCleanup(run, doCleanup);
|
|
1487
|
+
const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
|
|
1440
1488
|
const teardown = () => {
|
|
1441
1489
|
runCleanupList(cleanups);
|
|
1442
1490
|
disposeEffect();
|
|
@@ -1460,6 +1508,9 @@ function createRenderEffect(fn) {
|
|
|
1460
1508
|
cleanup = maybeCleanup;
|
|
1461
1509
|
}
|
|
1462
1510
|
} catch (err) {
|
|
1511
|
+
if (handleSuspend(err, rootForError)) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1463
1514
|
const handled = handleError(err, { source: "effect" }, rootForError);
|
|
1464
1515
|
if (handled) {
|
|
1465
1516
|
return;
|
|
@@ -1467,7 +1518,7 @@ function createRenderEffect(fn) {
|
|
|
1467
1518
|
throw err;
|
|
1468
1519
|
}
|
|
1469
1520
|
};
|
|
1470
|
-
const disposeEffect = effectWithCleanup(run, doCleanup);
|
|
1521
|
+
const disposeEffect = effectWithCleanup(run, doCleanup, rootForError);
|
|
1471
1522
|
const teardown = () => {
|
|
1472
1523
|
if (cleanup) {
|
|
1473
1524
|
cleanup();
|
|
@@ -1674,7 +1725,10 @@ function untrack2(fn) {
|
|
|
1674
1725
|
// src/binding.ts
|
|
1675
1726
|
var isDev5 = true ? false : typeof process === "undefined" || process.env?.NODE_ENV !== "production";
|
|
1676
1727
|
function isReactive(value) {
|
|
1677
|
-
|
|
1728
|
+
if (typeof value !== "function") return false;
|
|
1729
|
+
if (isSignal(value) || isComputed(value)) return true;
|
|
1730
|
+
if (isEffect(value) || isEffectScope(value)) return false;
|
|
1731
|
+
return value.length === 0;
|
|
1678
1732
|
}
|
|
1679
1733
|
function unwrap(value) {
|
|
1680
1734
|
return isReactive(value) ? value() : value;
|
|
@@ -1980,6 +2034,7 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
|
|
|
1980
2034
|
const root = createRootContext(hostRoot);
|
|
1981
2035
|
const prev = pushRoot(root);
|
|
1982
2036
|
let nodes = [];
|
|
2037
|
+
let handledError = false;
|
|
1983
2038
|
try {
|
|
1984
2039
|
let newNode;
|
|
1985
2040
|
if (value instanceof Node) {
|
|
@@ -2002,12 +2057,31 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
|
|
|
2002
2057
|
newNode = createFn ? createFn(value) : document.createTextNode(String(value));
|
|
2003
2058
|
}
|
|
2004
2059
|
nodes = toNodeArray(newNode);
|
|
2060
|
+
if (root.suspended) {
|
|
2061
|
+
handledError = true;
|
|
2062
|
+
destroyRoot(root);
|
|
2063
|
+
return;
|
|
2064
|
+
}
|
|
2005
2065
|
if (parentNode) {
|
|
2006
2066
|
insertNodesBefore(parentNode, nodes, marker);
|
|
2007
2067
|
}
|
|
2068
|
+
} catch (err) {
|
|
2069
|
+
if (handleSuspend(err, root)) {
|
|
2070
|
+
handledError = true;
|
|
2071
|
+
destroyRoot(root);
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
if (handleError(err, { source: "renderChild" }, root)) {
|
|
2075
|
+
handledError = true;
|
|
2076
|
+
destroyRoot(root);
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
throw err;
|
|
2008
2080
|
} finally {
|
|
2009
2081
|
popRoot(prev);
|
|
2010
|
-
|
|
2082
|
+
if (!handledError) {
|
|
2083
|
+
flushOnMount(root);
|
|
2084
|
+
}
|
|
2011
2085
|
}
|
|
2012
2086
|
currentRoot2 = root;
|
|
2013
2087
|
currentNodes = nodes;
|
|
@@ -3319,4 +3393,4 @@ export {
|
|
|
3319
3393
|
createElement,
|
|
3320
3394
|
template
|
|
3321
3395
|
};
|
|
3322
|
-
//# sourceMappingURL=chunk-
|
|
3396
|
+
//# sourceMappingURL=chunk-FOLRR3NZ.js.map
|