@tanstack/redact 0.0.21 → 0.1.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/core/attributes.js +2 -1
- package/dist/core/attributes.js.map +2 -2
- package/dist/core/browser.d.ts +9 -0
- package/dist/core/browser.js +35 -0
- package/dist/core/browser.js.map +7 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +3 -3
- package/dist/core/internal.d.ts +31 -8
- package/dist/core/internal.js +3 -1
- package/dist/core/internal.js.map +2 -2
- package/dist/core/resource-hints.d.ts +7 -0
- package/dist/core/resource-hints.js +19 -0
- package/dist/core/resource-hints.js.map +7 -0
- package/dist/core/types.js +1 -1
- package/dist/dom/_all.d.ts +11 -16
- package/dist/dom/_all.js +9 -20
- package/dist/dom/_all.js.map +2 -2
- package/dist/dom/client.d.ts +4 -4
- package/dist/dom/client.js +4 -4
- package/dist/dom/commit.d.ts +23 -0
- package/dist/dom/commit.js +191 -0
- package/dist/dom/commit.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +4 -22
- package/dist/dom/dispatcher.js +184 -126
- package/dist/dom/dispatcher.js.map +3 -3
- package/dist/dom/dom.d.ts +2 -0
- package/dist/dom/dom.js +72 -52
- package/dist/dom/dom.js.map +2 -2
- package/dist/dom/error-info.d.ts +2 -0
- package/dist/dom/error-info.js +16 -0
- package/dist/dom/error-info.js.map +7 -0
- package/dist/dom/event-replay.js +1 -1
- package/dist/dom/features/activity/full.d.ts +1 -0
- package/dist/dom/features/activity/full.js +162 -0
- package/dist/dom/features/activity/full.js.map +7 -0
- package/dist/dom/features/activity/index.d.ts +1 -0
- package/dist/dom/features/activity/index.js +3 -0
- package/dist/dom/features/activity/index.js.map +7 -0
- package/dist/dom/features/activity/stub.d.ts +1 -0
- package/dist/dom/features/activity/stub.js +12 -0
- package/dist/dom/features/activity/stub.js.map +7 -0
- package/dist/dom/features/class/full.js +87 -27
- package/dist/dom/features/class/full.js.map +2 -2
- package/dist/dom/features/class/index.d.ts +1 -1
- package/dist/dom/features/class/index.js +2 -2
- package/dist/dom/features/class/stub.js +3 -3
- package/dist/dom/features/context/full.d.ts +4 -1
- package/dist/dom/features/context/full.js +69 -9
- package/dist/dom/features/context/full.js.map +2 -2
- package/dist/dom/features/context/index.d.ts +1 -1
- package/dist/dom/features/context/index.js +2 -2
- package/dist/dom/features/context/stub.d.ts +4 -1
- package/dist/dom/features/context/stub.js +15 -4
- package/dist/dom/features/context/stub.js.map +2 -2
- package/dist/dom/features/forward-ref/full.js +12 -21
- package/dist/dom/features/forward-ref/full.js.map +2 -2
- package/dist/dom/features/forward-ref/index.d.ts +1 -1
- package/dist/dom/features/forward-ref/index.js +2 -2
- package/dist/dom/features/forward-ref/stub.js +4 -4
- package/dist/dom/features/fragment-refs/index.d.ts +1 -0
- package/dist/dom/features/fragment-refs/index.js +8 -0
- package/dist/dom/features/fragment-refs/index.js.map +7 -0
- package/dist/dom/features/fragment-refs/stub.d.ts +3 -0
- package/dist/dom/features/fragment-refs/stub.js +14 -0
- package/dist/dom/features/fragment-refs/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +11 -6
- package/dist/dom/features/hydration/full.js +76 -77
- package/dist/dom/features/hydration/full.js.map +2 -2
- package/dist/dom/features/hydration/index.d.ts +1 -1
- package/dist/dom/features/hydration/index.js +2 -2
- package/dist/dom/features/hydration/stub.d.ts +7 -2
- package/dist/dom/features/hydration/stub.js +1 -1
- package/dist/dom/features/hydration/stub.js.map +1 -1
- package/dist/dom/features/index.d.ts +8 -7
- package/dist/dom/features/index.js +9 -8
- package/dist/dom/features/index.js.map +2 -2
- package/dist/dom/features/lazy/full.js +4 -4
- package/dist/dom/features/lazy/index.d.ts +1 -1
- package/dist/dom/features/lazy/index.js +2 -2
- package/dist/dom/features/lazy/stub.js +4 -4
- package/dist/dom/features/memo/full.js +8 -6
- package/dist/dom/features/memo/full.js.map +2 -2
- package/dist/dom/features/memo/index.d.ts +1 -1
- package/dist/dom/features/memo/index.js +2 -2
- package/dist/dom/features/memo/stub.js +4 -4
- package/dist/dom/features/portal/full.js +4 -4
- package/dist/dom/features/portal/index.d.ts +1 -1
- package/dist/dom/features/portal/index.js +2 -2
- package/dist/dom/features/portal/stub.js +4 -4
- package/dist/dom/features/suspense/full.js +197 -52
- package/dist/dom/features/suspense/full.js.map +2 -2
- package/dist/dom/features/suspense/index.d.ts +1 -1
- package/dist/dom/features/suspense/index.js +2 -2
- package/dist/dom/features/suspense/stub.js +4 -4
- package/dist/dom/features/view-transition/full.d.ts +6 -0
- package/dist/dom/features/view-transition/full.js +280 -0
- package/dist/dom/features/view-transition/full.js.map +7 -0
- package/dist/dom/features/view-transition/index.d.ts +1 -0
- package/dist/dom/features/view-transition/index.js +3 -0
- package/dist/dom/features/view-transition/index.js.map +7 -0
- package/dist/dom/features/view-transition/resources.d.ts +11 -0
- package/dist/dom/features/view-transition/resources.js +108 -0
- package/dist/dom/features/view-transition/resources.js.map +7 -0
- package/dist/dom/features/view-transition/stub.d.ts +6 -0
- package/dist/dom/features/view-transition/stub.js +22 -0
- package/dist/dom/features/view-transition/stub.js.map +7 -0
- package/dist/dom/features/view-transition/visual.d.ts +14 -0
- package/dist/dom/features/view-transition/visual.js +356 -0
- package/dist/dom/features/view-transition/visual.js.map +7 -0
- package/dist/dom/fragment-instance.d.ts +40 -0
- package/dist/dom/fragment-instance.js +324 -0
- package/dist/dom/fragment-instance.js.map +7 -0
- package/dist/dom/index.d.ts +11 -11
- package/dist/dom/index.js +11 -18
- package/dist/dom/index.js.map +3 -3
- package/dist/dom/portal.d.ts +2 -2
- package/dist/dom/portal.js +2 -2
- package/dist/dom/portal.js.map +1 -1
- package/dist/dom/reconcile.d.ts +32 -3
- package/dist/dom/reconcile.js +689 -221
- package/dist/dom/reconcile.js.map +2 -2
- package/dist/dom/resource-hints.d.ts +6 -0
- package/dist/dom/resource-hints.js +115 -0
- package/dist/dom/resource-hints.js.map +7 -0
- package/dist/dom/resource-store.d.ts +13 -0
- package/dist/dom/resource-store.js +43 -0
- package/dist/dom/resource-store.js.map +7 -0
- package/dist/dom/resources.d.ts +1 -0
- package/dist/dom/resources.js +44 -0
- package/dist/dom/resources.js.map +7 -0
- package/dist/dom/retained-effects.d.ts +6 -0
- package/dist/dom/retained-effects.js +49 -0
- package/dist/dom/retained-effects.js.map +7 -0
- package/dist/dom/root-internal.d.ts +4 -4
- package/dist/dom/root-internal.js +2 -2
- package/dist/dom/root-internal.js.map +2 -2
- package/dist/dom/root.d.ts +5 -5
- package/dist/dom/root.js +11 -11
- package/dist/dom/root.js.map +2 -2
- package/dist/dom/test-utils.js +1 -1
- package/dist/react/activity.d.ts +7 -0
- package/dist/react/activity.js +8 -0
- package/dist/react/activity.js.map +7 -0
- package/dist/react/children.d.ts +1 -1
- package/dist/react/children.js +3 -3
- package/dist/react/children.js.map +1 -1
- package/dist/react/class.d.ts +1 -1
- package/dist/react/class.js +3 -3
- package/dist/react/class.js.map +1 -1
- package/dist/react/compiler-runtime.js +2 -2
- package/dist/react/context.d.ts +1 -1
- package/dist/react/context.js +3 -3
- package/dist/react/context.js.map +1 -1
- package/dist/react/element.d.ts +6 -3
- package/dist/react/element.js +2 -2
- package/dist/react/element.js.map +2 -2
- package/dist/react/hooks.d.ts +26 -7
- package/dist/react/hooks.js +13 -3
- package/dist/react/hooks.js.map +2 -2
- package/dist/react/index.d.ts +39 -24
- package/dist/react/index.js +39 -19
- package/dist/react/index.js.map +3 -3
- package/dist/react/jsx-runtime.d.ts +2 -2
- package/dist/react/jsx-runtime.js +3 -3
- package/dist/react/memo.d.ts +1 -1
- package/dist/react/memo.js +1 -1
- package/dist/react/portal.js +1 -1
- package/dist/react/shared-internals.d.ts +15 -5
- package/dist/react/shared-internals.js +2 -3
- package/dist/react/shared-internals.js.map +2 -2
- package/dist/react/suspense.js +1 -1
- package/dist/react/view-transition.d.ts +32 -0
- package/dist/react/view-transition.js +13 -0
- package/dist/react/view-transition.js.map +7 -0
- package/dist/scheduler/index.js +1 -1
- package/dist/server/bootstrap-script.d.ts +1 -23
- package/dist/server/bootstrap-script.js +7 -6
- package/dist/server/bootstrap-script.js.map +2 -2
- package/dist/server/dispatcher.d.ts +28 -6
- package/dist/server/dispatcher.js +33 -15
- package/dist/server/dispatcher.js.map +2 -2
- package/dist/server/escape.js +16 -15
- package/dist/server/escape.js.map +2 -2
- package/dist/server/index.d.ts +6 -6
- package/dist/server/index.js +7 -7
- package/dist/server/renderToString.d.ts +1 -1
- package/dist/server/renderToString.js +12 -8
- package/dist/server/renderToString.js.map +2 -2
- package/dist/server/resource-hints.d.ts +22 -0
- package/dist/server/resource-hints.js +148 -0
- package/dist/server/resource-hints.js.map +7 -0
- package/dist/server/stream.d.ts +15 -2
- package/dist/server/stream.js +155 -63
- package/dist/server/stream.js.map +2 -2
- package/dist/server/walk.d.ts +15 -2
- package/dist/server/walk.js +143 -96
- package/dist/server/walk.js.map +2 -2
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.js +22 -6
- package/dist/vite/index.js.map +2 -2
- package/package.json +1 -1
- package/src/core/attributes.ts +1 -0
- package/src/core/browser.ts +33 -0
- package/src/core/internal.ts +24 -6
- package/src/core/resource-hints.ts +36 -0
- package/src/dom/_all.ts +1 -7
- package/src/dom/commit.ts +186 -0
- package/src/dom/dispatcher.ts +190 -134
- package/src/dom/dom.ts +70 -54
- package/src/dom/error-info.ts +15 -0
- package/src/dom/features/activity/full.ts +166 -0
- package/src/dom/features/activity/index.ts +1 -0
- package/src/dom/features/activity/stub.ts +14 -0
- package/src/dom/features/class/full.ts +72 -28
- package/src/dom/features/context/full.ts +66 -4
- package/src/dom/features/context/stub.ts +6 -0
- package/src/dom/features/forward-ref/full.ts +9 -19
- package/src/dom/features/fragment-refs/index.ts +1 -0
- package/src/dom/features/fragment-refs/stub.ts +3 -0
- package/src/dom/features/hydration/full.ts +84 -85
- package/src/dom/features/hydration/stub.ts +1 -1
- package/src/dom/features/index.ts +1 -0
- package/src/dom/features/memo/full.ts +4 -3
- package/src/dom/features/suspense/full.ts +192 -55
- package/src/dom/features/view-transition/full.ts +288 -0
- package/src/dom/features/view-transition/index.ts +1 -0
- package/src/dom/features/view-transition/resources.ts +107 -0
- package/src/dom/features/view-transition/stub.ts +7 -0
- package/src/dom/features/view-transition/visual.ts +406 -0
- package/src/dom/fragment-instance.ts +337 -0
- package/src/dom/index.ts +6 -7
- package/src/dom/portal.ts +1 -1
- package/src/dom/reconcile.ts +695 -242
- package/src/dom/resource-hints.ts +115 -0
- package/src/dom/resource-store.ts +52 -0
- package/src/dom/resources.ts +39 -0
- package/src/dom/retained-effects.ts +38 -0
- package/src/dom/root-internal.ts +4 -4
- package/src/dom/root.ts +12 -14
- package/src/react/activity.ts +10 -0
- package/src/react/element.ts +6 -2
- package/src/react/hooks.ts +12 -3
- package/src/react/index.ts +18 -0
- package/src/react/shared-internals.ts +3 -3
- package/src/react/view-transition.ts +41 -0
- package/src/server/bootstrap-script.ts +36 -5
- package/src/server/dispatcher.ts +35 -13
- package/src/server/escape.ts +15 -12
- package/src/server/renderToString.ts +7 -5
- package/src/server/resource-hints.ts +165 -0
- package/src/server/stream.ts +154 -62
- package/src/server/walk.ts +72 -11
- package/src/vite/index.ts +30 -13
package/dist/dom/dispatcher.d.ts
CHANGED
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
type
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
useEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
6
|
-
useLayoutEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
7
|
-
useInsertionEffect(create: () => any, deps?: ReadonlyArray<unknown>): any;
|
|
8
|
-
useRef<T>(initial: T): {
|
|
9
|
-
current: T;
|
|
10
|
-
};
|
|
11
|
-
useMemo<T>(factory: () => T, deps?: ReadonlyArray<unknown>): T;
|
|
12
|
-
useCallback<T extends Function>(fn: T, deps?: ReadonlyArray<unknown>): T;
|
|
13
|
-
useContext<T>(ctx: any): T;
|
|
14
|
-
useImperativeHandle<T>(ref: any, factory: () => T, deps?: ReadonlyArray<unknown>): void;
|
|
15
|
-
useDebugValue<T>(_value: T, _formatter?: (v: T) => any): void;
|
|
16
|
-
useId(): string;
|
|
17
|
-
useTransition(): [boolean, (fn: () => void) => void];
|
|
18
|
-
useDeferredValue<T>(v: T): T;
|
|
19
|
-
useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
|
|
20
|
-
use<T>(resource: any): T;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
1
|
+
import type { Hook, Fiber, ReactNode } from "../core/index.js";
|
|
2
|
+
export declare const HOOK_BAILOUT: unique symbol;
|
|
3
|
+
export declare function renderWithHooks(fiber: Fiber, render: (props: any, ref?: any) => ReactNode, props: any, ref?: any, canBail?: boolean): ReactNode | typeof HOOK_BAILOUT;
|
|
4
|
+
export declare function cleanupEffect(hook: Hook, fiber: Fiber): void;
|
package/dist/dom/dispatcher.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { ReactSharedInternals, REACT_CONTEXT_TYPE } from "../react";
|
|
3
|
-
import { scheduleUpdate, enqueueEffect, readContext } from "./reconcile";
|
|
1
|
+
// src/dom/dispatcher.ts
|
|
2
|
+
import { ReactSharedInternals, REACT_CONTEXT_TYPE, startTransition } from "../react/index.js";
|
|
3
|
+
import { scheduleUpdate, enqueueEffect, readContext, rememberActivityEffect, handleCommitError } from "./reconcile.js";
|
|
4
|
+
import { REACT_RECOVERABLE_TYPE } from "../core/browser.js";
|
|
5
|
+
import { queueCommitEffects } from "./commit.js";
|
|
6
|
+
import { deferTransitionPassive } from "./features/view-transition/index.js";
|
|
4
7
|
function getCurrentFiber() {
|
|
5
8
|
const f = ReactSharedInternals.F;
|
|
6
9
|
if (!f) {
|
|
7
|
-
if (
|
|
10
|
+
if (process.env.NODE_ENV !== "production") {
|
|
8
11
|
throw new Error("Hook called outside a function component render.");
|
|
9
12
|
}
|
|
10
13
|
throw new Error();
|
|
@@ -12,28 +15,9 @@ function getCurrentFiber() {
|
|
|
12
15
|
return f;
|
|
13
16
|
}
|
|
14
17
|
function nextHook() {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
if (idx === 0) {
|
|
19
|
-
if (fiber.hooks) {
|
|
20
|
-
ReactSharedInternals.K = fiber.hooks;
|
|
21
|
-
return fiber.hooks;
|
|
22
|
-
}
|
|
23
|
-
const h2 = { s: void 0, q: void 0, d: void 0, c: void 0, n: null };
|
|
24
|
-
fiber.hooks = h2;
|
|
25
|
-
ReactSharedInternals.K = h2;
|
|
26
|
-
return h2;
|
|
27
|
-
}
|
|
28
|
-
if (prev && prev.n) {
|
|
29
|
-
ReactSharedInternals.K = prev.n;
|
|
30
|
-
return prev.n;
|
|
31
|
-
}
|
|
32
|
-
const h = { s: void 0, q: void 0, d: void 0, c: void 0, n: null };
|
|
33
|
-
if (prev) prev.n = h;
|
|
34
|
-
else fiber.hooks = h;
|
|
35
|
-
ReactSharedInternals.K = h;
|
|
36
|
-
return h;
|
|
18
|
+
const hooks = getCurrentFiber().hooks ||= [];
|
|
19
|
+
const index = ReactSharedInternals.I++;
|
|
20
|
+
return hooks[index] ||= { s: void 0, q: void 0, d: void 0, c: void 0 };
|
|
37
21
|
}
|
|
38
22
|
function depsEqual(a, b) {
|
|
39
23
|
if (a === b) return true;
|
|
@@ -44,95 +28,165 @@ function depsEqual(a, b) {
|
|
|
44
28
|
}
|
|
45
29
|
return true;
|
|
46
30
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
function initializeReducer(hook, fiber, initialArg, init) {
|
|
32
|
+
hook.s = init ? init(initialArg) : initialArg;
|
|
33
|
+
hook.c = null;
|
|
34
|
+
hook.q = (action) => {
|
|
35
|
+
if (fiber.um || fiber.pd) return;
|
|
36
|
+
(hook.c ||= []).push(action);
|
|
37
|
+
scheduleUpdate(fiber);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function reducePending(hook, reducer, previous = hook.s) {
|
|
41
|
+
const actions = hook.c;
|
|
42
|
+
if (actions == null) return;
|
|
43
|
+
hook.c = null;
|
|
44
|
+
let state = hook.s;
|
|
45
|
+
if (actions) for (const action of actions) state = reducer(state, action);
|
|
46
|
+
hookFlags |= Object.is(state, previous) ? 2 : 3;
|
|
47
|
+
hook.s = state;
|
|
48
|
+
}
|
|
49
|
+
var hookEffects;
|
|
50
|
+
var hookFlags = 0;
|
|
51
|
+
var HOOK_BAILOUT = /* @__PURE__ */ Symbol();
|
|
52
|
+
function resetHookEffects(effects) {
|
|
53
|
+
for (let index = 0; index < effects.length; index += 4) effects[index].d = effects[index + 1];
|
|
54
|
+
}
|
|
55
|
+
function renderWithHooks(fiber, render, props, ref, canBail = false) {
|
|
56
|
+
const previousDispatcher = ReactSharedInternals.H, previousFiber = ReactSharedInternals.F, previousIndex = ReactSharedInternals.I;
|
|
57
|
+
const previousEffects = hookEffects, previousFlags = hookFlags;
|
|
58
|
+
hookEffects = void 0;
|
|
59
|
+
hookFlags = 0;
|
|
60
|
+
ReactSharedInternals.H = DISPATCHER;
|
|
61
|
+
ReactSharedInternals.F = fiber;
|
|
62
|
+
try {
|
|
63
|
+
let rendered, attempts = 0;
|
|
64
|
+
do {
|
|
65
|
+
if (++attempts > 25) throw new Error(process.env.NODE_ENV !== "production" ? "Too many re-renders." : "");
|
|
66
|
+
if (hookEffects) {
|
|
67
|
+
resetHookEffects(hookEffects);
|
|
68
|
+
hookEffects = void 0;
|
|
69
|
+
}
|
|
70
|
+
ReactSharedInternals.I = 0;
|
|
71
|
+
fiber.dy = false;
|
|
72
|
+
rendered = render(props, ref);
|
|
73
|
+
} while (fiber.dy);
|
|
74
|
+
if (canBail && hookFlags === 2) {
|
|
75
|
+
hookEffects = void 0;
|
|
76
|
+
return HOOK_BAILOUT;
|
|
77
|
+
}
|
|
78
|
+
if (hookEffects) {
|
|
79
|
+
const effects = hookEffects;
|
|
80
|
+
for (let index = 0; index < effects.length; index += 4) {
|
|
81
|
+
const hook = effects[index], effect = effects[index + 2];
|
|
82
|
+
rememberActivityEffect(fiber, hook, effect);
|
|
83
|
+
if (effects[index + 3]) enqueueEffect(fiber, effect);
|
|
84
|
+
}
|
|
85
|
+
hookEffects = void 0;
|
|
86
|
+
}
|
|
87
|
+
return rendered;
|
|
88
|
+
} finally {
|
|
89
|
+
if (hookEffects) resetHookEffects(hookEffects);
|
|
90
|
+
hookEffects = previousEffects;
|
|
91
|
+
hookFlags = previousFlags;
|
|
92
|
+
ReactSharedInternals.H = previousDispatcher;
|
|
93
|
+
ReactSharedInternals.F = previousFiber;
|
|
94
|
+
ReactSharedInternals.I = previousIndex;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function cleanupEffect(hook, fiber) {
|
|
98
|
+
if (!hook.c) return;
|
|
99
|
+
const cleanup = hook.c;
|
|
100
|
+
hook.c = null;
|
|
101
|
+
if (fiber.cu) {
|
|
102
|
+
const index = fiber.cu.indexOf(cleanup);
|
|
103
|
+
if (index >= 0) fiber.cu.splice(index, 1);
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
cleanup();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
handleCommitError(fiber, error);
|
|
109
|
+
}
|
|
50
110
|
}
|
|
111
|
+
function useEffectImpl(type, create, deps) {
|
|
112
|
+
const hook = nextHook();
|
|
113
|
+
const fiber = getCurrentFiber();
|
|
114
|
+
const changed = hook.d === void 0 || !depsEqual(hook.d, deps);
|
|
115
|
+
if (!changed && !fiber.root?.a && !(type === 1 && fiber.root?.sp)) return;
|
|
116
|
+
const previous = hook.d;
|
|
117
|
+
hook.d = deps;
|
|
118
|
+
const effect = {
|
|
119
|
+
t: type,
|
|
120
|
+
c: () => {
|
|
121
|
+
cleanupEffect(hook, fiber);
|
|
122
|
+
const cleanup = create();
|
|
123
|
+
hook.c = typeof cleanup === "function" ? () => {
|
|
124
|
+
if (type === 0) {
|
|
125
|
+
const dispose = () => {
|
|
126
|
+
try {
|
|
127
|
+
cleanup();
|
|
128
|
+
} catch (error) {
|
|
129
|
+
handleCommitError(fiber, error);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
if (!deferTransitionPassive(dispose)) queueCommitEffects(dispose);
|
|
133
|
+
} else cleanup();
|
|
134
|
+
} : null;
|
|
135
|
+
return hook.c;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
if (type === 1) effect.d = () => cleanupEffect(hook, fiber);
|
|
139
|
+
(hookEffects ||= []).push(hook, previous, effect, changed);
|
|
140
|
+
}
|
|
141
|
+
var DISPATCHER = makeDispatcherImpl();
|
|
51
142
|
function makeDispatcherImpl() {
|
|
52
143
|
return {
|
|
53
144
|
useState(initial) {
|
|
54
|
-
|
|
55
|
-
basicReducer,
|
|
56
|
-
typeof initial == "function" ? initial() : initial
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
useReducer(reducer, initialArg, init) {
|
|
60
|
-
const hook = nextHook();
|
|
61
|
-
const fiber = getCurrentFiber();
|
|
145
|
+
const hook = nextHook(), fiber = getCurrentFiber();
|
|
62
146
|
if (hook.q === void 0) {
|
|
63
|
-
hook.s =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
147
|
+
hook.s = hook.d = typeof initial === "function" ? initial() : initial;
|
|
148
|
+
hook.c = null;
|
|
149
|
+
hook.q = (action) => {
|
|
150
|
+
if (fiber.um || fiber.pd) return;
|
|
151
|
+
if (ReactSharedInternals.F !== fiber && !hook.c) {
|
|
152
|
+
let next;
|
|
153
|
+
try {
|
|
154
|
+
next = basicReducer(hook.s, action);
|
|
155
|
+
} catch {
|
|
156
|
+
hook.c = [action];
|
|
157
|
+
scheduleUpdate(fiber);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (Object.is(next, hook.s)) return;
|
|
69
161
|
hook.s = next;
|
|
162
|
+
hook.c = 0;
|
|
70
163
|
scheduleUpdate(fiber);
|
|
164
|
+
return;
|
|
71
165
|
}
|
|
166
|
+
;
|
|
167
|
+
(hook.c ||= []).push(action);
|
|
168
|
+
scheduleUpdate(fiber);
|
|
72
169
|
};
|
|
73
|
-
queue.d = dispatch;
|
|
74
|
-
hook.q = queue;
|
|
75
|
-
} else {
|
|
76
|
-
hook.q.r = reducer;
|
|
77
170
|
}
|
|
78
|
-
|
|
171
|
+
reducePending(hook, basicReducer, hook.d);
|
|
172
|
+
hook.d = hook.s;
|
|
173
|
+
return [hook.s, hook.q];
|
|
79
174
|
},
|
|
80
|
-
|
|
175
|
+
useReducer(reducer, initialArg, init) {
|
|
81
176
|
const hook = nextHook();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
hook.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (hook.c) {
|
|
90
|
-
try {
|
|
91
|
-
hook.c();
|
|
92
|
-
} catch {
|
|
93
|
-
}
|
|
94
|
-
if (fiber.cu) {
|
|
95
|
-
const i = fiber.cu.indexOf(hook.c);
|
|
96
|
-
if (i >= 0) fiber.cu.splice(i, 1);
|
|
97
|
-
}
|
|
98
|
-
hook.c = null;
|
|
99
|
-
}
|
|
100
|
-
const c = create();
|
|
101
|
-
hook.c = typeof c == "function" ? c : null;
|
|
102
|
-
return hook.c;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
enqueueEffect(fiber, effect);
|
|
177
|
+
if (hook.q === void 0) initializeReducer(hook, getCurrentFiber(), initialArg, init);
|
|
178
|
+
reducePending(hook, reducer);
|
|
179
|
+
hook.d = reducer;
|
|
180
|
+
return [hook.s, hook.q];
|
|
181
|
+
},
|
|
182
|
+
useEffect(create, deps) {
|
|
183
|
+
useEffectImpl(0, create, deps);
|
|
106
184
|
},
|
|
107
185
|
useLayoutEffect(create, deps) {
|
|
108
|
-
|
|
109
|
-
const fiber = getCurrentFiber();
|
|
110
|
-
const prevDeps = hook.d;
|
|
111
|
-
if (prevDeps !== void 0 && depsEqual(prevDeps, deps)) return;
|
|
112
|
-
hook.d = deps;
|
|
113
|
-
const effect = {
|
|
114
|
-
t: 1,
|
|
115
|
-
c: () => {
|
|
116
|
-
if (hook.c) {
|
|
117
|
-
try {
|
|
118
|
-
hook.c();
|
|
119
|
-
} catch {
|
|
120
|
-
}
|
|
121
|
-
if (fiber.cu) {
|
|
122
|
-
const i = fiber.cu.indexOf(hook.c);
|
|
123
|
-
if (i >= 0) fiber.cu.splice(i, 1);
|
|
124
|
-
}
|
|
125
|
-
hook.c = null;
|
|
126
|
-
}
|
|
127
|
-
const c = create();
|
|
128
|
-
hook.c = typeof c == "function" ? c : null;
|
|
129
|
-
return hook.c;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
enqueueEffect(fiber, effect);
|
|
186
|
+
useEffectImpl(1, create, deps);
|
|
133
187
|
},
|
|
134
188
|
useInsertionEffect(create, deps) {
|
|
135
|
-
|
|
189
|
+
useEffectImpl(2, create, deps);
|
|
136
190
|
},
|
|
137
191
|
useRef(initial) {
|
|
138
192
|
const hook = nextHook();
|
|
@@ -157,14 +211,18 @@ function makeDispatcherImpl() {
|
|
|
157
211
|
return readContext(fiber, ctx);
|
|
158
212
|
},
|
|
159
213
|
useImperativeHandle(ref, factory, deps) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
214
|
+
useEffectImpl(1, () => {
|
|
215
|
+
if (!ref) return;
|
|
216
|
+
const value = factory();
|
|
217
|
+
if (typeof ref === "function") {
|
|
218
|
+
const cleanup = ref(value);
|
|
219
|
+
return typeof cleanup === "function" ? cleanup : () => ref(null);
|
|
220
|
+
}
|
|
221
|
+
ref.current = value;
|
|
222
|
+
return () => {
|
|
223
|
+
ref.current = null;
|
|
224
|
+
};
|
|
225
|
+
}, deps == null ? void 0 : [...deps, ref]);
|
|
168
226
|
},
|
|
169
227
|
useDebugValue(_value, _formatter) {
|
|
170
228
|
},
|
|
@@ -180,11 +238,15 @@ function makeDispatcherImpl() {
|
|
|
180
238
|
return hook.s;
|
|
181
239
|
},
|
|
182
240
|
useTransition() {
|
|
183
|
-
return [false,
|
|
241
|
+
return [false, startTransition];
|
|
184
242
|
},
|
|
185
243
|
useDeferredValue(v) {
|
|
186
244
|
return v;
|
|
187
245
|
},
|
|
246
|
+
useCacheRefresh() {
|
|
247
|
+
return this.useCallback(() => {
|
|
248
|
+
}, []);
|
|
249
|
+
},
|
|
188
250
|
useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
189
251
|
const fiber = getCurrentFiber();
|
|
190
252
|
const hook = nextHook();
|
|
@@ -198,24 +260,18 @@ function makeDispatcherImpl() {
|
|
|
198
260
|
const root = fiber.root ?? findRootFromFiber(fiber);
|
|
199
261
|
const isHydrating = Boolean(root?.h);
|
|
200
262
|
const value = isHydrating && getServerSnapshot ? getServerSnapshot() : getSnapshot();
|
|
263
|
+
if (!Object.is(hook.s, value)) hookFlags |= 1;
|
|
201
264
|
hook.s = value;
|
|
202
265
|
const deps = [subscribe];
|
|
203
|
-
|
|
266
|
+
const changed = hook.d === void 0 || !depsEqual(hook.d, deps);
|
|
267
|
+
if (changed || fiber.root?.a) {
|
|
268
|
+
const previous = hook.d;
|
|
204
269
|
hook.d = deps;
|
|
205
270
|
const effect = {
|
|
206
271
|
t: 1,
|
|
272
|
+
s: true,
|
|
207
273
|
c: () => {
|
|
208
|
-
|
|
209
|
-
try {
|
|
210
|
-
hook.c();
|
|
211
|
-
} catch {
|
|
212
|
-
}
|
|
213
|
-
if (fiber.cu) {
|
|
214
|
-
const i = fiber.cu.indexOf(hook.c);
|
|
215
|
-
if (i >= 0) fiber.cu.splice(i, 1);
|
|
216
|
-
}
|
|
217
|
-
hook.c = null;
|
|
218
|
-
}
|
|
274
|
+
cleanupEffect(hook, fiber);
|
|
219
275
|
let unsubscribed = false;
|
|
220
276
|
const cleanup = () => {
|
|
221
277
|
unsubscribed = true;
|
|
@@ -235,7 +291,6 @@ function makeDispatcherImpl() {
|
|
|
235
291
|
return;
|
|
236
292
|
}
|
|
237
293
|
if (!Object.is(hook.s, next)) {
|
|
238
|
-
hook.s = next;
|
|
239
294
|
scheduleUpdate(fiber);
|
|
240
295
|
}
|
|
241
296
|
};
|
|
@@ -248,13 +303,14 @@ function makeDispatcherImpl() {
|
|
|
248
303
|
return cleanup;
|
|
249
304
|
}
|
|
250
305
|
};
|
|
251
|
-
|
|
306
|
+
(hookEffects ||= []).push(hook, previous, effect, changed);
|
|
252
307
|
}
|
|
253
308
|
return value;
|
|
254
309
|
},
|
|
255
310
|
use(resource) {
|
|
311
|
+
if (resource?.$$typeof === REACT_RECOVERABLE_TYPE) return void 0;
|
|
256
312
|
if (resource == null) {
|
|
257
|
-
if (
|
|
313
|
+
if (process.env.NODE_ENV !== "production") {
|
|
258
314
|
throw new Error("use() received null or undefined");
|
|
259
315
|
}
|
|
260
316
|
throw new Error();
|
|
@@ -291,7 +347,7 @@ function makeDispatcherImpl() {
|
|
|
291
347
|
}
|
|
292
348
|
}
|
|
293
349
|
}
|
|
294
|
-
if (
|
|
350
|
+
if (process.env.NODE_ENV !== "production") {
|
|
295
351
|
throw new Error("use() expected a Promise or Context");
|
|
296
352
|
}
|
|
297
353
|
throw new Error();
|
|
@@ -305,12 +361,14 @@ var idCounter = 0;
|
|
|
305
361
|
function findRootFromFiber(fiber) {
|
|
306
362
|
let f = fiber;
|
|
307
363
|
while (f) {
|
|
308
|
-
if (f.root) return f.root;
|
|
364
|
+
if (f.root) return fiber.root = f.root;
|
|
309
365
|
f = f.parent;
|
|
310
366
|
}
|
|
311
367
|
return null;
|
|
312
368
|
}
|
|
313
369
|
export {
|
|
314
|
-
|
|
370
|
+
HOOK_BAILOUT,
|
|
371
|
+
cleanupEffect,
|
|
372
|
+
renderWithHooks
|
|
315
373
|
};
|
|
316
374
|
//# sourceMappingURL=dispatcher.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/dispatcher.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Hook, Fiber, FiberRoot, Effect } from '../core'\nimport { ReactSharedInternals, REACT_CONTEXT_TYPE } from '../react'\nimport { scheduleUpdate, enqueueEffect, readContext } from './reconcile'\n\nfunction getCurrentFiber(): Fiber {\n const f = ReactSharedInternals.F\n if (!f) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Hook called outside a function component render.')\n }\n throw new Error()\n }\n return f\n}\n\nfunction nextHook(): Hook {\n const fiber = getCurrentFiber()\n const idx = ReactSharedInternals.I++\n\n let prev = ReactSharedInternals.K\n\n if (idx === 0) {\n if (fiber.hooks) {\n ReactSharedInternals.K = fiber.hooks\n return fiber.hooks\n }\n const h: Hook = { s: undefined, q: undefined, d: undefined, c: undefined, n: null }\n fiber.hooks = h\n ReactSharedInternals.K = h\n return h\n }\n\n if (prev && prev.n) {\n ReactSharedInternals.K = prev.n\n return prev.n\n }\n\n const h: Hook = { s: undefined, q: undefined, d: undefined, c: undefined, n: null }\n if (prev) prev.n = h\n else fiber.hooks = h\n ReactSharedInternals.K = h\n return h\n}\n\nfunction depsEqual(\n a: ReadonlyArray<unknown> | undefined,\n b: ReadonlyArray<unknown> | undefined,\n): boolean {\n if (a === b) return true\n if (!a || !b) return false\n if (a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return false\n }\n return true\n}\n\ntype BasicStateAction<S> = S | ((p: S) => S)\n\n// Singleton \u2014 every method reads render context via ReactSharedInternals,\n// and per-hook closures live on the hook itself, so nothing is render-local\n// to capture. Allocating a fresh wrapper + 17 method closures per function-\n// component render was pure GC pressure.\nconst DISPATCHER = makeDispatcherImpl()\n\nexport function makeDispatcher() {\n return DISPATCHER\n}\n\nfunction makeDispatcherImpl() {\n return {\n useState<S>(initial: S | (() => S)): [S, (a: BasicStateAction<S>) => void] {\n return this.useReducer(\n basicReducer as (state: S, action: BasicStateAction<S>) => S,\n typeof initial == 'function' ? (initial as () => S)() : initial,\n )\n },\n\n useReducer<S, A>(reducer: (s: S, a: A) => S, initialArg: any, init?: (a: any) => S) {\n const hook = nextHook()\n const fiber = getCurrentFiber()\n if (hook.q === undefined) {\n hook.s = init ? init(initialArg) : initialArg\n const queue: any = { r: reducer }\n const dispatch = (action: A) => {\n const currentState = hook.s as S\n const next = queue.r(currentState, action)\n if (!Object.is(next, currentState)) {\n hook.s = next\n scheduleUpdate(fiber)\n }\n }\n queue.d = dispatch\n hook.q = queue\n } else {\n hook.q.r = reducer\n }\n return [hook.s, hook.q.d] as [S, (a: A) => void]\n },\n\n useEffect(create: () => any, deps?: ReadonlyArray<unknown>) {\n const hook = nextHook()\n const fiber = getCurrentFiber()\n const prevDeps = hook.d\n if (prevDeps !== undefined && depsEqual(prevDeps, deps)) return\n hook.d = deps\n const effect: Effect = {\n t: 0,\n c: () => {\n // Run the prior cleanup INSIDE the effect run, not during the\n // dispatch/render phase. If render A \u2192 B \u2192 C all happen back-to-\n // back before the passive microtask drains, dispatch-time cleanup\n // only fires once (between A\u2192B) and fx B + C both run fresh,\n // leaving two side-fx (e.g. two plot SVGs) in the DOM. Doing\n // it here, at effect-run time, means every new create first tears\n // down whatever cleanup is currently live on the hook.\n if (hook.c) {\n try { hook.c() } catch {}\n // The prior cleanup was also pushed onto fiber.cu; remove\n // it so unmount doesn't double-call it.\n if (fiber.cu) {\n const i = fiber.cu.indexOf(hook.c)\n if (i >= 0) fiber.cu.splice(i, 1)\n }\n hook.c = null\n }\n const c = create()\n hook.c = typeof c == 'function' ? c : null\n return hook.c\n },\n }\n enqueueEffect(fiber, effect)\n },\n\n useLayoutEffect(create: () => any, deps?: ReadonlyArray<unknown>) {\n const hook = nextHook()\n const fiber = getCurrentFiber()\n const prevDeps = hook.d\n if (prevDeps !== undefined && depsEqual(prevDeps, deps)) return\n hook.d = deps\n const effect: Effect = {\n t: 1,\n c: () => {\n // Mirror useEffect: tear down the prior cleanup at run time so\n // coalesced renders don't leak side-fx.\n if (hook.c) {\n try { hook.c() } catch {}\n if (fiber.cu) {\n const i = fiber.cu.indexOf(hook.c)\n if (i >= 0) fiber.cu.splice(i, 1)\n }\n hook.c = null\n }\n const c = create()\n hook.c = typeof c == 'function' ? c : null\n return hook.c\n },\n }\n enqueueEffect(fiber, effect)\n },\n\n useInsertionEffect(create: () => any, deps?: ReadonlyArray<unknown>) {\n return this.useLayoutEffect(create, deps)\n },\n\n useRef<T>(initial: T) {\n const hook = nextHook()\n if (hook.s === undefined) hook.s = { current: initial }\n return hook.s as { current: T }\n },\n\n useMemo<T>(factory: () => T, deps?: ReadonlyArray<unknown>) {\n const hook = nextHook()\n if (hook.d !== undefined && depsEqual(hook.d, deps)) {\n return hook.s as T\n }\n const value = factory()\n hook.s = value\n hook.d = deps\n return value\n },\n\n useCallback<T extends Function>(fn: T, deps?: ReadonlyArray<unknown>): T {\n return this.useMemo(() => fn, deps) as T\n },\n\n useContext<T>(ctx: any): T {\n const fiber = getCurrentFiber()\n return readContext(fiber, ctx)\n },\n\n useImperativeHandle<T>(ref: any, factory: () => T, deps?: ReadonlyArray<unknown>) {\n const hook = nextHook()\n if (hook.d !== undefined && depsEqual(hook.d, deps)) return\n hook.d = deps\n const value = factory()\n if (ref) {\n if (typeof ref == 'function') ref(value)\n else ref.current = value\n }\n },\n\n useDebugValue<T>(_value: T, _formatter?: (v: T) => any): void {\n // noop\n },\n\n useId(): string {\n const hook = nextHook()\n if (hook.s === undefined) {\n const fiber = getCurrentFiber()\n const root = findRootFromFiber(fiber)\n const prefix = root?.i ?? (root?.h ? ':R' : ':r')\n const id = root?.h ? root.ic++ : idCounter++\n hook.s = prefix + id.toString(36)\n }\n return hook.s as string\n },\n\n useTransition(): [boolean, (fn: () => void) => void] {\n return [false, (fn: () => void) => fn()]\n },\n\n useDeferredValue<T>(v: T): T {\n return v\n },\n\n useSyncExternalStore<T>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T {\n const fiber = getCurrentFiber()\n const hook = nextHook()\n const store: {\n g: () => T\n s: (() => T) | undefined\n } = hook.q ?? {\n g: getSnapshot,\n s: getServerSnapshot,\n }\n hook.q = store\n store.g = getSnapshot\n store.s = getServerSnapshot\n\n // During hydration, use the server snapshot (if provided) so the tree\n // matches the SSR output. Components like TanStack Router's ClientOnly\n // rely on this: they render `false` on server, `true` on client \u2014 and\n // if we return `true` during hydration, client and server diverge and\n // the tree mounts fresh next to the SSR fallback DOM.\n const root = fiber.root ?? findRootFromFiber(fiber)\n const isHydrating = Boolean(root?.h)\n const value =\n isHydrating && getServerSnapshot ? getServerSnapshot() : getSnapshot()\n hook.s = value\n\n const deps = [subscribe]\n if (hook.d === undefined || !depsEqual(hook.d, deps)) {\n hook.d = deps\n const effect: Effect = {\n t: 1,\n c: () => {\n if (hook.c) {\n try {\n hook.c()\n } catch {\n // ignore cleanup failures\n }\n if (fiber.cu) {\n const i = fiber.cu.indexOf(hook.c)\n if (i >= 0) fiber.cu.splice(i, 1)\n }\n hook.c = null\n }\n\n let unsubscribed = false\n const cleanup = () => {\n unsubscribed = true\n if (typeof unsubscribe == 'function') {\n unsubscribe()\n }\n }\n const forceUpdate = () => {\n if (unsubscribed || fiber.um) {\n return\n }\n\n let next: T\n try {\n next = store.g()\n } catch {\n scheduleUpdate(fiber)\n return\n }\n\n if (!Object.is(hook.s, next)) {\n hook.s = next\n scheduleUpdate(fiber)\n }\n }\n const unsubscribe = subscribe(forceUpdate)\n\n // If we served the server snapshot, run a post-hydration check so\n // components like `useHydrated()` flip from false \u2192 true after the\n // initial render commits. Queued late so hydration finishes first.\n if (isHydrating && store.s) {\n queueMicrotask(() => queueMicrotask(forceUpdate))\n }\n\n forceUpdate()\n hook.c = cleanup\n return cleanup\n },\n }\n enqueueEffect(fiber, effect)\n }\n return value\n },\n\n use<T>(resource: any): T {\n if (resource == null) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('use() received null or undefined')\n }\n throw new Error()\n }\n if (resource.$$typeof === REACT_CONTEXT_TYPE) {\n return readContext(getCurrentFiber(), resource)\n }\n if (typeof resource.then == 'function') {\n const thenable = resource\n switch (thenable.status) {\n case 'fulfilled':\n return thenable.value\n case 'rejected':\n throw thenable.reason\n default: {\n if (thenable.status === undefined) {\n thenable.status = 'pending'\n thenable.then(\n (v: any) => {\n if (thenable.status === 'pending') {\n thenable.status = 'fulfilled'\n thenable.value = v\n }\n },\n (e: any) => {\n if (thenable.status === 'pending') {\n thenable.status = 'rejected'\n thenable.reason = e\n }\n },\n )\n }\n throw thenable\n }\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('use() expected a Promise or Context')\n }\n throw new Error()\n },\n }\n}\n\nfunction basicReducer<S>(state: S, action: BasicStateAction<S>): S {\n return typeof action == 'function' ? (action as (p: S) => S)(state) : action\n}\n\nlet idCounter = 0\n\nfunction findRootFromFiber(fiber: Fiber): FiberRoot | null {\n let f: Fiber | null = fiber\n while (f) {\n if (f.root) return f.root\n f = f.parent\n }\n return null\n}\n"],
|
|
5
|
-
"mappings": ";AACA,SAAS,sBAAsB,
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import type { Hook, Fiber, FiberRoot, Effect, ReactNode } from '../core'\nimport { ReactSharedInternals, REACT_CONTEXT_TYPE, startTransition } from '../react'\nimport { scheduleUpdate, enqueueEffect, readContext, rememberActivityEffect, handleCommitError } from './reconcile'\nimport { REACT_RECOVERABLE_TYPE } from '../core/browser'\nimport { queueCommitEffects } from './commit'\nimport { deferTransitionPassive } from './features/view-transition'\n\nfunction getCurrentFiber(): Fiber {\n const f = ReactSharedInternals.F\n if (!f) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Hook called outside a function component render.')\n }\n throw new Error()\n }\n return f\n}\n\nfunction nextHook(): Hook {\n const hooks = getCurrentFiber().hooks ||= []\n const index = ReactSharedInternals.I++\n return hooks[index] ||= { s: undefined, q: undefined, d: undefined, c: undefined }\n}\n\nfunction depsEqual(\n a: ReadonlyArray<unknown> | undefined,\n b: ReadonlyArray<unknown> | undefined,\n): boolean {\n if (a === b) return true\n if (!a || !b) return false\n if (a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return false\n }\n return true\n}\n\ntype BasicStateAction<S> = S | ((p: S) => S)\n\nfunction initializeReducer(hook: Hook, fiber: Fiber, initialArg: any, init?: (arg: any) => any): void {\n hook.s = init ? init(initialArg) : initialArg\n hook.c = null\n hook.q = (action: any) => {\n if (fiber.um || fiber.pd) return\n ;(hook.c ||= []).push(action)\n scheduleUpdate(fiber)\n }\n}\n\n// Reducer slots reuse the effect-cleanup field for pending actions. Zero marks\n// eager state work, null means no update. Replacing arrays lets retries restore\n// pending actions without copying or shifting them.\nfunction reducePending(hook: Hook, reducer: (state: any, action: any) => any, previous = hook.s): void {\n const actions = hook.c\n if (actions == null) return\n hook.c = null\n let state = hook.s\n if (actions) for (const action of actions) state = reducer(state, action)\n hookFlags |= Object.is(state, previous) ? 2 : 3\n hook.s = state\n}\n\nlet hookEffects: any[] | undefined\n// Bit 1 records a changed value; bit 2 records a processed reducer queue.\nlet hookFlags = 0\nexport const HOOK_BAILOUT = Symbol()\n\nfunction resetHookEffects(effects: any[]): void {\n for (let index = 0; index < effects.length; index += 4) effects[index].d = effects[index + 1]\n}\n\nexport function renderWithHooks(\n fiber: Fiber,\n render: (props: any, ref?: any) => ReactNode,\n props: any,\n ref?: any,\n canBail = false,\n): ReactNode | typeof HOOK_BAILOUT {\n const previousDispatcher = ReactSharedInternals.H, previousFiber = ReactSharedInternals.F, previousIndex = ReactSharedInternals.I\n const previousEffects = hookEffects, previousFlags = hookFlags\n hookEffects = undefined\n hookFlags = 0\n ReactSharedInternals.H = DISPATCHER\n ReactSharedInternals.F = fiber\n try {\n let rendered: ReactNode, attempts = 0\n do {\n if (++attempts > 25) throw new Error(process.env.NODE_ENV !== 'production' ? 'Too many re-renders.' : '')\n if (hookEffects) {\n resetHookEffects(hookEffects)\n hookEffects = undefined\n }\n ReactSharedInternals.I = 0\n fiber.dy = false\n rendered = render(props, ref)\n } while (fiber.dy)\n if (canBail && hookFlags === 2) {\n // React accepts the rendered dependencies on a reducer bailout, but\n // keeps the previous committed effect descriptions until real work.\n hookEffects = undefined\n return HOOK_BAILOUT\n }\n if (hookEffects) {\n const effects: any[] = hookEffects\n for (let index = 0; index < effects.length; index += 4) {\n const hook = effects[index], effect = effects[index + 2]\n rememberActivityEffect(fiber, hook, effect)\n if (effects[index + 3]) enqueueEffect(fiber, effect)\n }\n hookEffects = undefined\n }\n return rendered\n } finally {\n if (hookEffects) resetHookEffects(hookEffects)\n hookEffects = previousEffects\n hookFlags = previousFlags\n ReactSharedInternals.H = previousDispatcher\n ReactSharedInternals.F = previousFiber\n ReactSharedInternals.I = previousIndex\n }\n}\n\nexport function cleanupEffect(hook: Hook, fiber: Fiber): void {\n if (!hook.c) return\n const cleanup = hook.c\n hook.c = null\n if (fiber.cu) {\n const index = fiber.cu.indexOf(cleanup)\n if (index >= 0) fiber.cu.splice(index, 1)\n }\n try { cleanup() } catch (error) { handleCommitError(fiber, error) }\n}\n\nfunction useEffectImpl(type: Effect['t'], create: () => any, deps?: ReadonlyArray<unknown>): void {\n const hook = nextHook()\n const fiber = getCurrentFiber()\n const changed = hook.d === undefined || !depsEqual(hook.d, deps)\n if (!changed && !fiber.root?.a && !(type === 1 && fiber.root?.sp)) return\n const previous = hook.d\n hook.d = deps\n const effect: Effect = {\n t: type,\n c: () => {\n cleanupEffect(hook, fiber)\n const cleanup = create()\n // Each effect owns its cleanup even when hooks return the same function.\n hook.c = typeof cleanup === 'function' ? () => {\n if (type === 0) {\n const dispose = () => {\n try { cleanup() } catch (error) { handleCommitError(fiber, error) }\n }\n if (!deferTransitionPassive(dispose)) queueCommitEffects(dispose)\n } else cleanup()\n } : null\n return hook.c\n },\n }\n if (type === 1) effect.d = () => cleanupEffect(hook, fiber)\n ;(hookEffects ||= []).push(hook, previous, effect, changed)\n}\n\n// Singleton \u2014 every method reads render context via ReactSharedInternals,\n// and per-hook closures live on the hook itself, so nothing is render-local\n// to capture. Allocating a fresh wrapper + 17 method closures per function-\n// component render was pure GC pressure.\nconst DISPATCHER = makeDispatcherImpl()\n\nfunction makeDispatcherImpl() {\n return {\n useState<S>(initial: S | (() => S)): [S, (a: BasicStateAction<S>) => void] {\n const hook = nextHook(), fiber = getCurrentFiber()\n if (hook.q === undefined) {\n hook.s = hook.d = typeof initial === 'function' ? (initial as () => S)() : initial\n hook.c = null\n hook.q = (action: BasicStateAction<S>) => {\n if (fiber.um || fiber.pd) return\n if (ReactSharedInternals.F !== fiber && !hook.c) {\n let next: S\n try {\n next = basicReducer(hook.s, action)\n } catch {\n hook.c = [action]\n scheduleUpdate(fiber)\n return\n }\n if (Object.is(next, hook.s)) return\n hook.s = next\n hook.c = 0\n scheduleUpdate(fiber)\n return\n }\n ;(hook.c ||= []).push(action)\n scheduleUpdate(fiber)\n }\n }\n reducePending(hook, basicReducer, hook.d)\n hook.d = hook.s\n return [hook.s, hook.q]\n },\n\n useReducer<S, A>(reducer: (s: S, a: A) => S, initialArg: any, init?: (a: any) => S) {\n const hook = nextHook()\n if (hook.q === undefined) initializeReducer(hook, getCurrentFiber(), initialArg, init)\n reducePending(hook, reducer)\n hook.d = reducer\n return [hook.s, hook.q] as [S, (a: A) => void]\n },\n\n useEffect(create: () => any, deps?: ReadonlyArray<unknown>) {\n useEffectImpl(0, create, deps)\n },\n\n useLayoutEffect(create: () => any, deps?: ReadonlyArray<unknown>) {\n useEffectImpl(1, create, deps)\n },\n\n useInsertionEffect(create: () => any, deps?: ReadonlyArray<unknown>) {\n useEffectImpl(2, create, deps)\n },\n\n useRef<T>(initial: T) {\n const hook = nextHook()\n if (hook.s === undefined) hook.s = { current: initial }\n return hook.s as { current: T }\n },\n\n useMemo<T>(factory: () => T, deps?: ReadonlyArray<unknown>) {\n const hook = nextHook()\n if (hook.d !== undefined && depsEqual(hook.d, deps)) {\n return hook.s as T\n }\n const value = factory()\n hook.s = value\n hook.d = deps\n return value\n },\n\n useCallback<T extends Function>(fn: T, deps?: ReadonlyArray<unknown>): T {\n return this.useMemo(() => fn, deps) as T\n },\n\n useContext<T>(ctx: any): T {\n const fiber = getCurrentFiber()\n return readContext(fiber, ctx)\n },\n\n useImperativeHandle<T>(ref: any, factory: () => T, deps?: ReadonlyArray<unknown>) {\n useEffectImpl(1, () => {\n if (!ref) return\n const value = factory()\n if (typeof ref === 'function') {\n const cleanup = ref(value)\n return typeof cleanup === 'function' ? cleanup : () => ref(null)\n }\n ref.current = value\n return () => { ref.current = null }\n }, deps == null ? undefined : [...deps, ref])\n },\n\n useDebugValue<T>(_value: T, _formatter?: (v: T) => any): void {\n // noop\n },\n\n useId(): string {\n const hook = nextHook()\n if (hook.s === undefined) {\n const fiber = getCurrentFiber()\n const root = findRootFromFiber(fiber)\n const prefix = root?.i ?? (root?.h ? ':R' : ':r')\n const id = root?.h ? root.ic++ : idCounter++\n hook.s = prefix + id.toString(36)\n }\n return hook.s as string\n },\n\n useTransition(): [boolean, (fn: () => void) => void] {\n return [false, startTransition]\n },\n\n useDeferredValue<T>(v: T): T {\n return v\n },\n\n useCacheRefresh(): () => void {\n // There is no client cache to invalidate. Preserve hook identity and\n // leave state and scheduling alone, as with the uncached client cache().\n return this.useCallback(() => {}, [])\n },\n\n useSyncExternalStore<T>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T {\n const fiber = getCurrentFiber()\n const hook = nextHook()\n const store: {\n g: () => T\n s: (() => T) | undefined\n } = hook.q ?? {\n g: getSnapshot,\n s: getServerSnapshot,\n }\n hook.q = store\n store.g = getSnapshot\n store.s = getServerSnapshot\n\n // During hydration, use the server snapshot (if provided) so the tree\n // matches the SSR output. Components like TanStack Router's ClientOnly\n // rely on this: they render `false` on server, `true` on client \u2014 and\n // if we return `true` during hydration, client and server diverge and\n // the tree mounts fresh next to the SSR fallback DOM.\n const root = fiber.root ?? findRootFromFiber(fiber)\n const isHydrating = Boolean(root?.h)\n const value =\n isHydrating && getServerSnapshot ? getServerSnapshot() : getSnapshot()\n if (!Object.is(hook.s, value)) hookFlags |= 1\n hook.s = value\n\n const deps = [subscribe]\n const changed = hook.d === undefined || !depsEqual(hook.d, deps)\n if (changed || fiber.root?.a) {\n const previous = hook.d\n hook.d = deps\n const effect: Effect = {\n t: 1,\n s: true,\n c: () => {\n cleanupEffect(hook, fiber)\n\n let unsubscribed = false\n const cleanup = () => {\n unsubscribed = true\n if (typeof unsubscribe == 'function') {\n unsubscribe()\n }\n }\n const forceUpdate = () => {\n if (unsubscribed || fiber.um) {\n return\n }\n\n let next: T\n try {\n next = store.g()\n } catch {\n scheduleUpdate(fiber)\n return\n }\n\n if (!Object.is(hook.s, next)) {\n scheduleUpdate(fiber)\n }\n }\n const unsubscribe = subscribe(forceUpdate)\n\n // If we served the server snapshot, run a post-hydration check so\n // components like `useHydrated()` flip from false \u2192 true after the\n // initial render commits. Queued late so hydration finishes first.\n if (isHydrating && store.s) {\n queueMicrotask(() => queueMicrotask(forceUpdate))\n }\n\n forceUpdate()\n hook.c = cleanup\n return cleanup\n },\n }\n ;(hookEffects ||= []).push(hook, previous, effect, changed)\n }\n return value\n },\n\n use<T>(resource: any): T {\n if (resource?.$$typeof === REACT_RECOVERABLE_TYPE) return undefined as T\n if (resource == null) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('use() received null or undefined')\n }\n throw new Error()\n }\n if (resource.$$typeof === REACT_CONTEXT_TYPE) {\n return readContext(getCurrentFiber(), resource)\n }\n if (typeof resource.then == 'function') {\n const thenable = resource\n switch (thenable.status) {\n case 'fulfilled':\n return thenable.value\n case 'rejected':\n throw thenable.reason\n default: {\n if (thenable.status === undefined) {\n thenable.status = 'pending'\n thenable.then(\n (v: any) => {\n if (thenable.status === 'pending') {\n thenable.status = 'fulfilled'\n thenable.value = v\n }\n },\n (e: any) => {\n if (thenable.status === 'pending') {\n thenable.status = 'rejected'\n thenable.reason = e\n }\n },\n )\n }\n throw thenable\n }\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('use() expected a Promise or Context')\n }\n throw new Error()\n },\n }\n}\n\nfunction basicReducer<S>(state: S, action: BasicStateAction<S>): S {\n return typeof action == 'function' ? (action as (p: S) => S)(state) : action\n}\n\nlet idCounter = 0\n\nfunction findRootFromFiber(fiber: Fiber): FiberRoot | null {\n let f: Fiber | null = fiber\n while (f) {\n if (f.root) return fiber.root = f.root\n f = f.parent\n }\n return null\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,sBAAsB,oBAAoB,uBAAuB;AAC1E,SAAS,gBAAgB,eAAe,aAAa,wBAAwB,yBAAyB;AACtG,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AAEvC,SAAS,kBAAyB;AAChC,QAAM,IAAI,qBAAqB;AAC/B,MAAI,CAAC,GAAG;AACN,QAAI,yBAAyB,cAAc;AACzC,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AACA,UAAM,IAAI,MAAM;AAAA,EAClB;AACA,SAAO;AACT;AAEA,SAAS,WAAiB;AACxB,QAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC;AAC3C,QAAM,QAAQ,qBAAqB;AACnC,SAAO,MAAM,KAAK,MAAM,EAAE,GAAG,QAAW,GAAG,QAAW,GAAG,QAAW,GAAG,OAAU;AACnF;AAEA,SAAS,UACP,GACA,GACS;AACT,MAAI,MAAM,EAAG,QAAO;AACpB,MAAI,CAAC,KAAK,CAAC,EAAG,QAAO;AACrB,MAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,QAAI,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAG,QAAO;AA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AAO,YAAY,gBAAgB,GAAG,QAAQ;AAAA,MAChD;AACA,UAAI,OAAO,SAAS,QAAQ,YAAY;AACtC,cAAM,WAAW;AACjB,gBAAQ,SAAS,QAAQ;AAAA,UACvB,KAAK;AACH,mBAAO,SAAS;AAAA,UAClB,KAAK;AACH,kBAAM,SAAS;AAAA,UACjB,SAAS;AACP,gBAAI,SAAS,WAAW,QAAW;AACjC,uBAAS,SAAS;AAClB,uBAAS;AAAA,gBACP,CAAC,MAAW;AACV,sBAAI,SAAS,WAAW,WAAW;AACjC,6BAAS,SAAS;AAClB,6BAAS,QAAQ;AAAA,kBACnB;AAAA,gBACF;AAAA,gBACA,CAAC,MAAW;AACV,sBAAI,SAAS,WAAW,WAAW;AACjC,6BAAS,SAAS;AAClB,6BAAS,SAAS;AAAA,kBACpB;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AACA,kBAAM;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,UAAI,yBAAyB,cAAc;AACzC,cAAM,IAAI,MAAM,qCAAqC;AAAA,MACvD;AACA,YAAM,IAAI,MAAM;AAAA,IAClB;AAAA,EACF;AACF;AAEA,SAAS,aAAgB,OAAU,QAAgC;AACjE,SAAO,OAAO,UAAU,aAAc,OAAuB,KAAK,IAAI;AACxE;AAEA,IAAI,YAAY;AAEhB,SAAS,kBAAkB,OAAgC;AACzD,MAAI,IAAkB;AACtB,SAAO,GAAG;AACR,QAAI,EAAE,KAAM,QAAO,MAAM,OAAO,EAAE;AAClC,QAAI,EAAE;AAAA,EACR;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/dom/dom.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function createHostNode(type: string, isSvg: boolean): Element;
|
|
2
2
|
export declare function isSvgElement(el: Element): boolean;
|
|
3
|
+
export declare function syncInputValue(el: HTMLInputElement, props: any, prev?: any): void;
|
|
4
|
+
export declare function syncTextareaValue(el: HTMLTextAreaElement, props: any, mounting?: boolean): void;
|
|
3
5
|
export declare function setProp(el: Element, name: string, next: any, prev: any, isSvg: boolean): void;
|
|
4
6
|
export interface SyntheticEvent extends Event {
|
|
5
7
|
nativeEvent: Event;
|