@fictjs/runtime 0.0.15 → 0.2.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 +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-GJTYOFMO.cjs → chunk-527QSKFM.cjs} +16 -16
- package/dist/{chunk-GJTYOFMO.cjs.map → chunk-527QSKFM.cjs.map} +1 -1
- package/dist/{chunk-RY4WDS6R.js → chunk-5KXEEQUO.js} +115 -20
- package/dist/chunk-5KXEEQUO.js.map +1 -0
- package/dist/{chunk-624QY53A.cjs → chunk-BSUMPMKX.cjs} +7 -7
- package/dist/chunk-BSUMPMKX.cjs.map +1 -0
- package/dist/{chunk-IUZXKAAY.js → chunk-FG3M7EBL.js} +2 -2
- package/dist/{chunk-PMF6MWEV.cjs → chunk-J74L7UYP.cjs} +128 -33
- package/dist/chunk-J74L7UYP.cjs.map +1 -0
- package/dist/{chunk-F3AIYQB7.js → chunk-QV5GOCR5.js} +3 -3
- package/dist/chunk-QV5GOCR5.js.map +1 -0
- 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 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.dev.js +96 -28
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +10 -13
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +44 -35
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +9 -4
- package/dist/internal.d.ts +9 -4
- package/dist/internal.js +12 -3
- package/dist/internal.js.map +1 -1
- package/dist/jsx-runtime.d.cts +671 -0
- package/dist/jsx-runtime.d.ts +671 -0
- package/dist/{props-ES0Ag_Wd.d.ts → props-CBwuh35e.d.cts} +13 -6
- package/dist/{props-CrOMYbLv.d.cts → props-DAyeRPwH.d.ts} +13 -6
- 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 +62 -8
- package/src/constants.ts +2 -3
- package/src/dev-entry.ts +22 -0
- package/src/effect.ts +9 -2
- package/src/lifecycle.ts +24 -6
- package/src/list-helpers.ts +14 -3
- package/src/props.ts +29 -3
- package/src/scope.ts +1 -1
- package/src/signal.ts +43 -4
- package/src/suspense.ts +17 -13
- package/dist/chunk-624QY53A.cjs.map +0 -1
- package/dist/chunk-F3AIYQB7.js.map +0 -1
- package/dist/chunk-PMF6MWEV.cjs.map +0 -1
- package/dist/chunk-RY4WDS6R.js.map +0 -1
- /package/dist/{chunk-IUZXKAAY.js.map → chunk-FG3M7EBL.js.map} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkJ74L7UYPcjs = require('./chunk-J74L7UYP.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 } = _chunkJ74L7UYPcjs.createRoot.call(void 0, fn, { inherit: true });
|
|
21
21
|
dispose = rootDispose;
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
_chunkJ74L7UYPcjs.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 = () => _chunkJ74L7UYPcjs.isReactive.call(void 0, flag) ? flag() : !!flag;
|
|
30
|
+
_chunkJ74L7UYPcjs.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
|
+
_chunkJ74L7UYPcjs.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-BSUMPMKX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fict/fict/packages/runtime/dist/chunk-BSUMPMKX.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-BSUMPMKX.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"]}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
pushRoot,
|
|
11
11
|
removeNodes,
|
|
12
12
|
toNodeArray
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5KXEEQUO.js";
|
|
14
14
|
|
|
15
15
|
// src/context.ts
|
|
16
16
|
var contextStorage = /* @__PURE__ */ new WeakMap();
|
|
@@ -106,4 +106,4 @@ export {
|
|
|
106
106
|
useContext,
|
|
107
107
|
hasContext
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-FG3M7EBL.js.map
|
|
@@ -213,8 +213,7 @@ function getPropAlias(prop2, tagName) {
|
|
|
213
213
|
return a;
|
|
214
214
|
}
|
|
215
215
|
var $$EVENTS = "_$FICT_DELEGATE";
|
|
216
|
-
var
|
|
217
|
-
var DelegatedEvents = new Set(delegatedEvents);
|
|
216
|
+
var DelegatedEvents = new Set(DelegatedEventNames);
|
|
218
217
|
var svgElements = isDev ? [
|
|
219
218
|
"altGlyph",
|
|
220
219
|
"altGlyphDef",
|
|
@@ -512,8 +511,8 @@ var currentRoot;
|
|
|
512
511
|
var currentEffectCleanups;
|
|
513
512
|
var globalErrorHandlers = /* @__PURE__ */ new WeakMap();
|
|
514
513
|
var globalSuspenseHandlers = /* @__PURE__ */ new WeakMap();
|
|
515
|
-
function createRootContext(parent
|
|
516
|
-
return { parent, cleanups: [], destroyCallbacks: [] };
|
|
514
|
+
function createRootContext(parent) {
|
|
515
|
+
return { parent, cleanups: [], destroyCallbacks: [], suspended: false };
|
|
517
516
|
}
|
|
518
517
|
function pushRoot(root) {
|
|
519
518
|
if (!enterRootGuard(root)) {
|
|
@@ -588,8 +587,9 @@ function destroyRoot(root) {
|
|
|
588
587
|
globalSuspenseHandlers.delete(root);
|
|
589
588
|
}
|
|
590
589
|
}
|
|
591
|
-
function createRoot(fn) {
|
|
592
|
-
const
|
|
590
|
+
function createRoot(fn, options) {
|
|
591
|
+
const parent = _optionalChain([options, 'optionalAccess', _10 => _10.inherit]) ? currentRoot : void 0;
|
|
592
|
+
const root = createRootContext(parent);
|
|
593
593
|
const prev = pushRoot(root);
|
|
594
594
|
let value;
|
|
595
595
|
try {
|
|
@@ -714,13 +714,17 @@ function handleError(err, info, startRoot) {
|
|
|
714
714
|
}
|
|
715
715
|
function handleSuspend(token, startRoot) {
|
|
716
716
|
let root = _nullishCoalesce(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,14 +734,17 @@ 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;
|
|
737
744
|
}
|
|
738
745
|
|
|
739
746
|
// src/signal.ts
|
|
740
|
-
var isDev4 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access',
|
|
747
|
+
var isDev4 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access', _11 => _11.env, 'optionalAccess', _12 => _12.NODE_ENV]) !== "production";
|
|
741
748
|
var Mutable = 1;
|
|
742
749
|
var Watching = 2;
|
|
743
750
|
var Running = 4;
|
|
@@ -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 = _nullishCoalesce(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();
|
|
@@ -1621,7 +1672,7 @@ function insertNodesBefore(parent, nodes, anchor) {
|
|
|
1621
1672
|
}
|
|
1622
1673
|
function removeNodes(nodes) {
|
|
1623
1674
|
for (const node of nodes) {
|
|
1624
|
-
_optionalChain([node, 'access',
|
|
1675
|
+
_optionalChain([node, 'access', _13 => _13.parentNode, 'optionalAccess', _14 => _14.removeChild, 'call', _15 => _15(node)]);
|
|
1625
1676
|
}
|
|
1626
1677
|
}
|
|
1627
1678
|
|
|
@@ -1672,9 +1723,12 @@ function untrack2(fn) {
|
|
|
1672
1723
|
}
|
|
1673
1724
|
|
|
1674
1725
|
// src/binding.ts
|
|
1675
|
-
var isDev5 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access',
|
|
1726
|
+
var isDev5 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access', _16 => _16.env, 'optionalAccess', _17 => _17.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;
|
|
@@ -2020,7 +2094,7 @@ function insert(parent, getValue, markerOrCreateElement, createElementFn) {
|
|
|
2020
2094
|
}
|
|
2021
2095
|
clearCurrentNodes();
|
|
2022
2096
|
if (ownsMarker) {
|
|
2023
|
-
_optionalChain([marker, 'access',
|
|
2097
|
+
_optionalChain([marker, 'access', _18 => _18.parentNode, 'optionalAccess', _19 => _19.removeChild, 'call', _20 => _20(marker)]);
|
|
2024
2098
|
}
|
|
2025
2099
|
};
|
|
2026
2100
|
}
|
|
@@ -2071,7 +2145,7 @@ function createChildBinding(parent, getValue, createElementFn) {
|
|
|
2071
2145
|
marker,
|
|
2072
2146
|
dispose: () => {
|
|
2073
2147
|
dispose();
|
|
2074
|
-
_optionalChain([marker, 'access',
|
|
2148
|
+
_optionalChain([marker, 'access', _21 => _21.parentNode, 'optionalAccess', _22 => _22.removeChild, 'call', _23 => _23(marker)]);
|
|
2075
2149
|
}
|
|
2076
2150
|
};
|
|
2077
2151
|
}
|
|
@@ -2205,7 +2279,8 @@ function bindEvent(el, eventName, handler, options) {
|
|
|
2205
2279
|
if (handler == null) return () => {
|
|
2206
2280
|
};
|
|
2207
2281
|
const rootRef = getCurrentRoot();
|
|
2208
|
-
|
|
2282
|
+
const shouldDelegate = options == null && DelegatedEvents.has(eventName);
|
|
2283
|
+
if (shouldDelegate) {
|
|
2209
2284
|
const key = `$$${eventName}`;
|
|
2210
2285
|
delegateEvents([eventName]);
|
|
2211
2286
|
const resolveHandler = isReactive(handler) ? handler : () => handler;
|
|
@@ -2352,7 +2427,7 @@ function assignProp(node, prop2, value, prev, isSVG, skipRef, props) {
|
|
|
2352
2427
|
}
|
|
2353
2428
|
if (prop2.slice(0, 2) === "on") {
|
|
2354
2429
|
const eventName = prop2.slice(2).toLowerCase();
|
|
2355
|
-
const shouldDelegate =
|
|
2430
|
+
const shouldDelegate = DelegatedEvents.has(eventName);
|
|
2356
2431
|
if (!shouldDelegate && prev) {
|
|
2357
2432
|
const handler = Array.isArray(prev) ? prev[0] : prev;
|
|
2358
2433
|
node.removeEventListener(eventName, handler);
|
|
@@ -2502,8 +2577,8 @@ function createConditional(condition, renderTrue, createElementFn, renderFalse)
|
|
|
2502
2577
|
}
|
|
2503
2578
|
removeNodes(currentNodes);
|
|
2504
2579
|
currentNodes = [];
|
|
2505
|
-
_optionalChain([startMarker, 'access',
|
|
2506
|
-
_optionalChain([endMarker, 'access',
|
|
2580
|
+
_optionalChain([startMarker, 'access', _24 => _24.parentNode, 'optionalAccess', _25 => _25.removeChild, 'call', _26 => _26(startMarker)]);
|
|
2581
|
+
_optionalChain([endMarker, 'access', _27 => _27.parentNode, 'optionalAccess', _28 => _28.removeChild, 'call', _29 => _29(endMarker)]);
|
|
2507
2582
|
}
|
|
2508
2583
|
};
|
|
2509
2584
|
}
|
|
@@ -2573,7 +2648,7 @@ function createPortal(container, render2, createElementFn) {
|
|
|
2573
2648
|
if (currentNodes.length > 0) {
|
|
2574
2649
|
removeNodes(currentNodes);
|
|
2575
2650
|
}
|
|
2576
|
-
_optionalChain([marker, 'access',
|
|
2651
|
+
_optionalChain([marker, 'access', _30 => _30.parentNode, 'optionalAccess', _31 => _31.removeChild, 'call', _32 => _32(marker)]);
|
|
2577
2652
|
};
|
|
2578
2653
|
if (parentRoot) {
|
|
2579
2654
|
parentRoot.destroyCallbacks.push(portalDispose);
|
|
@@ -2590,7 +2665,7 @@ function createMemo(fn) {
|
|
|
2590
2665
|
}
|
|
2591
2666
|
|
|
2592
2667
|
// src/hooks.ts
|
|
2593
|
-
var isDev6 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access',
|
|
2668
|
+
var isDev6 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access', _33 => _33.env, 'optionalAccess', _34 => _34.NODE_ENV]) !== "production";
|
|
2594
2669
|
var ctxStack = [];
|
|
2595
2670
|
function assertRenderContext(ctx, hookName) {
|
|
2596
2671
|
if (!ctx.rendering) {
|
|
@@ -2656,17 +2731,27 @@ function __fictRender(ctx, fn) {
|
|
|
2656
2731
|
}
|
|
2657
2732
|
|
|
2658
2733
|
// src/props.ts
|
|
2734
|
+
var PROP_GETTER_MARKER = Symbol.for("fict:prop-getter");
|
|
2659
2735
|
var propGetters = /* @__PURE__ */ new WeakSet();
|
|
2660
2736
|
var rawToProxy = /* @__PURE__ */ new WeakMap();
|
|
2661
2737
|
var proxyToRaw = /* @__PURE__ */ new WeakMap();
|
|
2662
2738
|
function __fictProp(getter) {
|
|
2663
2739
|
if (typeof getter === "function" && getter.length === 0) {
|
|
2664
2740
|
propGetters.add(getter);
|
|
2741
|
+
if (Object.isExtensible(getter)) {
|
|
2742
|
+
try {
|
|
2743
|
+
;
|
|
2744
|
+
getter[PROP_GETTER_MARKER] = true;
|
|
2745
|
+
} catch (e11) {
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2665
2748
|
}
|
|
2666
2749
|
return getter;
|
|
2667
2750
|
}
|
|
2668
2751
|
function isPropGetter(value) {
|
|
2669
|
-
|
|
2752
|
+
if (typeof value !== "function") return false;
|
|
2753
|
+
const fn = value;
|
|
2754
|
+
return propGetters.has(fn) || fn[PROP_GETTER_MARKER] === true;
|
|
2670
2755
|
}
|
|
2671
2756
|
function createPropsProxy(props) {
|
|
2672
2757
|
if (!props || typeof props !== "object") {
|
|
@@ -2790,17 +2875,27 @@ function mergeProps(...sources) {
|
|
|
2790
2875
|
}
|
|
2791
2876
|
});
|
|
2792
2877
|
}
|
|
2793
|
-
function prop(getter) {
|
|
2878
|
+
function prop(getter, options) {
|
|
2794
2879
|
if (isPropGetter(getter)) {
|
|
2795
2880
|
return getter;
|
|
2796
2881
|
}
|
|
2797
|
-
|
|
2882
|
+
const fn = getter;
|
|
2883
|
+
const unwrap2 = _optionalChain([options, 'optionalAccess', _35 => _35.unwrap]) !== false;
|
|
2884
|
+
return __fictProp(
|
|
2885
|
+
createMemo(() => {
|
|
2886
|
+
const value = fn();
|
|
2887
|
+
if (unwrap2 && isPropGetter(value)) {
|
|
2888
|
+
return value();
|
|
2889
|
+
}
|
|
2890
|
+
return value;
|
|
2891
|
+
})
|
|
2892
|
+
);
|
|
2798
2893
|
}
|
|
2799
2894
|
|
|
2800
2895
|
// src/dom.ts
|
|
2801
2896
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
2802
2897
|
var MATHML_NS = "http://www.w3.org/1998/Math/MathML";
|
|
2803
|
-
var isDev7 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access',
|
|
2898
|
+
var isDev7 = true ? false : typeof process === "undefined" || _optionalChain([process, 'access', _36 => _36.env, 'optionalAccess', _37 => _37.NODE_ENV]) !== "production";
|
|
2804
2899
|
function render(view, container) {
|
|
2805
2900
|
const root = createRootContext();
|
|
2806
2901
|
const prev = pushRoot(root);
|
|
@@ -2909,7 +3004,7 @@ function createElementWithContext(node, namespace) {
|
|
|
2909
3004
|
}
|
|
2910
3005
|
if (vnode.type === Fragment) {
|
|
2911
3006
|
const frag = document.createDocumentFragment();
|
|
2912
|
-
const children = _optionalChain([vnode, 'access',
|
|
3007
|
+
const children = _optionalChain([vnode, 'access', _38 => _38.props, 'optionalAccess', _39 => _39.children]);
|
|
2913
3008
|
appendChildren(frag, children, namespace);
|
|
2914
3009
|
return frag;
|
|
2915
3010
|
}
|
|
@@ -2919,7 +3014,7 @@ function createElementWithContext(node, namespace) {
|
|
|
2919
3014
|
applyProps(el, _nullishCoalesce(vnode.props, () => ( {})), resolvedNamespace === "svg");
|
|
2920
3015
|
appendChildren(
|
|
2921
3016
|
el,
|
|
2922
|
-
_optionalChain([vnode, 'access',
|
|
3017
|
+
_optionalChain([vnode, 'access', _40 => _40.props, 'optionalAccess', _41 => _41.children]),
|
|
2923
3018
|
tagName === "foreignObject" ? null : resolvedNamespace
|
|
2924
3019
|
);
|
|
2925
3020
|
return el;
|
|
@@ -2950,7 +3045,7 @@ function appendChildNode(parent, child, namespace) {
|
|
|
2950
3045
|
}
|
|
2951
3046
|
if (isBindingHandle(child)) {
|
|
2952
3047
|
appendChildNode(parent, child.marker, namespace);
|
|
2953
|
-
_optionalChain([child, 'access',
|
|
3048
|
+
_optionalChain([child, 'access', _42 => _42.flush, 'optionalCall', _43 => _43()]);
|
|
2954
3049
|
return;
|
|
2955
3050
|
}
|
|
2956
3051
|
if (typeof child === "function" && child.length === 0) {
|
|
@@ -3298,4 +3393,4 @@ function eventNameFromProp(key) {
|
|
|
3298
3393
|
|
|
3299
3394
|
|
|
3300
3395
|
exports.BooleanAttributes = BooleanAttributes; exports.Properties = Properties; exports.ChildProperties = ChildProperties; exports.Aliases = Aliases; exports.getPropAlias = getPropAlias; exports.DelegatedEvents = DelegatedEvents; exports.SVGElements = SVGElements; exports.SVGNamespace = SVGNamespace; exports.UnitlessStyles = UnitlessStyles; 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.flush = flush; exports.signal = signal; exports.effectScope = effectScope; exports.batch = batch; exports.setActiveSub = setActiveSub; exports.untrack = untrack; exports.createSelector = createSelector; exports.createEffect = createEffect; exports.createRenderEffect = createRenderEffect; exports.Fragment = Fragment; exports.toNodeArray = toNodeArray; exports.insertNodesBefore = insertNodesBefore; exports.removeNodes = removeNodes; exports.startTransition = startTransition; exports.useTransition = useTransition; exports.useDeferredValue = useDeferredValue; exports.batch2 = batch2; exports.untrack2 = untrack2; exports.isReactive = isReactive; exports.unwrap = unwrap; exports.callEventHandler = callEventHandler; exports.createTextBinding = createTextBinding; exports.bindText = bindText; exports.createAttributeBinding = createAttributeBinding; exports.bindAttribute = bindAttribute; exports.bindProperty = bindProperty; exports.createStyleBinding = createStyleBinding; exports.bindStyle = bindStyle; exports.createClassBinding = createClassBinding; exports.bindClass = bindClass; exports.classList = classList; exports.insert = insert; exports.createChildBinding = createChildBinding; exports.delegateEvents = delegateEvents; exports.clearDelegatedEvents = clearDelegatedEvents; exports.addEventListener = addEventListener; exports.bindEvent = bindEvent; exports.bindRef = bindRef; exports.spread = spread; exports.assign = assign; exports.createConditional = createConditional; exports.createShow = createShow; exports.createPortal = createPortal; exports.createMemo = createMemo; exports.__fictUseContext = __fictUseContext; exports.__fictPushContext = __fictPushContext; exports.__fictPopContext = __fictPopContext; exports.__fictResetContext = __fictResetContext; exports.__fictUseSignal = __fictUseSignal; exports.__fictUseMemo = __fictUseMemo; exports.__fictUseEffect = __fictUseEffect; exports.__fictRender = __fictRender; exports.__fictProp = __fictProp; exports.createPropsProxy = createPropsProxy; exports.__fictPropsRest = __fictPropsRest; exports.mergeProps = mergeProps; exports.prop = prop; exports.render = render; exports.createElement = createElement; exports.template = template;
|
|
3301
|
-
//# sourceMappingURL=chunk-
|
|
3396
|
+
//# sourceMappingURL=chunk-J74L7UYP.cjs.map
|