@fictjs/runtime 0.2.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.js +3 -3
- package/dist/{chunk-BSUMPMKX.cjs → chunk-7EAEROZ5.cjs} +7 -7
- package/dist/{chunk-BSUMPMKX.cjs.map → chunk-7EAEROZ5.cjs.map} +1 -1
- package/dist/{chunk-QV5GOCR5.js → chunk-7TPCESQS.js} +2 -2
- package/dist/{chunk-5KXEEQUO.js → chunk-FOLRR3NZ.js} +1 -1
- package/dist/chunk-FOLRR3NZ.js.map +1 -0
- package/dist/{chunk-J74L7UYP.cjs → chunk-MWI3USXB.cjs} +1 -1
- package/dist/chunk-MWI3USXB.cjs.map +1 -0
- package/dist/{chunk-FG3M7EBL.js → chunk-VVNMIER7.js} +2 -2
- package/dist/{chunk-FG3M7EBL.js.map → chunk-VVNMIER7.js.map} +1 -1
- package/dist/{chunk-527QSKFM.cjs → chunk-Z5WRKD7Y.cjs} +16 -16
- package/dist/{chunk-527QSKFM.cjs.map → chunk-Z5WRKD7Y.cjs.map} +1 -1
- package/dist/index.cjs +46 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.dev.js +8 -12
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +10 -14
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +64 -42
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +32 -10
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/src/context.ts +1 -1
- package/src/error-boundary.ts +9 -9
- package/src/signal.ts +2 -1
- package/src/store.ts +42 -20
- package/src/suspense.ts +0 -5
- package/dist/chunk-5KXEEQUO.js.map +0 -1
- package/dist/chunk-J74L7UYP.cjs.map +0 -1
- package/dist/jsx-runtime.d.cts +0 -671
- package/dist/jsx-runtime.d.ts +0 -671
- /package/dist/{chunk-QV5GOCR5.js.map → chunk-7TPCESQS.js.map} +0 -0
package/dist/index.dev.js
CHANGED
|
@@ -2630,14 +2630,15 @@ function ErrorBoundary(props) {
|
|
|
2630
2630
|
const fragment = document.createDocumentFragment();
|
|
2631
2631
|
const marker = document.createComment("fict:error-boundary");
|
|
2632
2632
|
fragment.appendChild(marker);
|
|
2633
|
-
const currentView = signal(props.children ?? null);
|
|
2634
2633
|
const hostRoot = getCurrentRoot();
|
|
2635
2634
|
let cleanup;
|
|
2636
2635
|
let activeNodes = [];
|
|
2637
2636
|
let renderingFallback = false;
|
|
2637
|
+
let reset = () => {
|
|
2638
|
+
};
|
|
2638
2639
|
const toView = (err) => {
|
|
2639
2640
|
if (err != null) {
|
|
2640
|
-
return typeof props.fallback === "function" ? props.fallback(err) : props.fallback;
|
|
2641
|
+
return typeof props.fallback === "function" ? props.fallback(err, reset) : props.fallback;
|
|
2641
2642
|
}
|
|
2642
2643
|
return props.children ?? null;
|
|
2643
2644
|
};
|
|
@@ -2665,7 +2666,6 @@ function ErrorBoundary(props) {
|
|
|
2665
2666
|
}
|
|
2666
2667
|
} catch (err) {
|
|
2667
2668
|
popRoot(prev);
|
|
2668
|
-
flushOnMount(root);
|
|
2669
2669
|
destroyRoot(root);
|
|
2670
2670
|
if (renderingFallback) {
|
|
2671
2671
|
throw err;
|
|
@@ -2689,10 +2689,11 @@ function ErrorBoundary(props) {
|
|
|
2689
2689
|
};
|
|
2690
2690
|
activeNodes = nodes;
|
|
2691
2691
|
};
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
renderValue(
|
|
2695
|
-
}
|
|
2692
|
+
reset = () => {
|
|
2693
|
+
renderingFallback = false;
|
|
2694
|
+
renderValue(toView(null));
|
|
2695
|
+
};
|
|
2696
|
+
renderValue(props.children ?? null);
|
|
2696
2697
|
registerErrorHandler((err) => {
|
|
2697
2698
|
renderValue(toView(err));
|
|
2698
2699
|
props.onError?.(err);
|
|
@@ -2731,7 +2732,6 @@ function createSuspenseToken() {
|
|
|
2731
2732
|
}
|
|
2732
2733
|
var isThenable = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
|
|
2733
2734
|
function Suspense(props) {
|
|
2734
|
-
const currentView = signal(props.children ?? null);
|
|
2735
2735
|
const pending = signal(0);
|
|
2736
2736
|
let resolvedOnce = false;
|
|
2737
2737
|
let epoch = 0;
|
|
@@ -2767,7 +2767,6 @@ function Suspense(props) {
|
|
|
2767
2767
|
}
|
|
2768
2768
|
} catch (err) {
|
|
2769
2769
|
popRoot(prev);
|
|
2770
|
-
flushOnMount(root);
|
|
2771
2770
|
destroyRoot(root);
|
|
2772
2771
|
if (!handleError(err, { source: "render" }, hostRoot)) {
|
|
2773
2772
|
throw err;
|
|
@@ -2796,7 +2795,6 @@ function Suspense(props) {
|
|
|
2796
2795
|
registerSuspenseHandler((token) => {
|
|
2797
2796
|
const tokenEpoch = epoch;
|
|
2798
2797
|
pending(pending() + 1);
|
|
2799
|
-
currentView(toFallback());
|
|
2800
2798
|
renderView(toFallback());
|
|
2801
2799
|
const thenable = token.then ? token : isThenable(token) ? token : null;
|
|
2802
2800
|
if (thenable) {
|
|
@@ -2808,7 +2806,6 @@ function Suspense(props) {
|
|
|
2808
2806
|
const newPending = Math.max(0, pending() - 1);
|
|
2809
2807
|
pending(newPending);
|
|
2810
2808
|
if (newPending === 0) {
|
|
2811
|
-
currentView(props.children ?? null);
|
|
2812
2809
|
renderView(props.children ?? null);
|
|
2813
2810
|
onResolveMaybe();
|
|
2814
2811
|
}
|
|
@@ -2840,7 +2837,6 @@ function Suspense(props) {
|
|
|
2840
2837
|
prev = next;
|
|
2841
2838
|
epoch++;
|
|
2842
2839
|
pending(0);
|
|
2843
|
-
currentView(props.children ?? null);
|
|
2844
2840
|
renderView(props.children ?? null);
|
|
2845
2841
|
}
|
|
2846
2842
|
});
|