@tanstack/redact 0.0.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/core/index.d.ts +2 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +7 -0
- package/dist/core/internal.d.ts +76 -0
- package/dist/core/internal.js +59 -0
- package/dist/core/internal.js.map +7 -0
- package/dist/core/types.d.ts +21 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +7 -0
- package/dist/dom/_all.d.ts +17 -0
- package/dist/dom/_all.js +51 -0
- package/dist/dom/_all.js.map +7 -0
- package/dist/dom/client.d.ts +3 -0
- package/dist/dom/client.js +8 -0
- package/dist/dom/client.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +20 -0
- package/dist/dom/dispatcher.js +267 -0
- package/dist/dom/dispatcher.js.map +7 -0
- package/dist/dom/dom.d.ts +10 -0
- package/dist/dom/dom.js +262 -0
- package/dist/dom/dom.js.map +7 -0
- package/dist/dom/event-replay.d.ts +13 -0
- package/dist/dom/event-replay.js +46 -0
- package/dist/dom/event-replay.js.map +7 -0
- package/dist/dom/features/class/full.d.ts +1 -0
- package/dist/dom/features/class/full.js +91 -0
- package/dist/dom/features/class/full.js.map +7 -0
- package/dist/dom/features/class/index.d.ts +1 -0
- package/dist/dom/features/class/index.js +3 -0
- package/dist/dom/features/class/index.js.map +7 -0
- package/dist/dom/features/class/stub.d.ts +1 -0
- package/dist/dom/features/class/stub.js +50 -0
- package/dist/dom/features/class/stub.js.map +7 -0
- package/dist/dom/features/context/full.d.ts +1 -0
- package/dist/dom/features/context/full.js +49 -0
- package/dist/dom/features/context/full.js.map +7 -0
- package/dist/dom/features/context/index.d.ts +1 -0
- package/dist/dom/features/context/index.js +3 -0
- package/dist/dom/features/context/index.js.map +7 -0
- package/dist/dom/features/context/stub.d.ts +1 -0
- package/dist/dom/features/context/stub.js +22 -0
- package/dist/dom/features/context/stub.js.map +7 -0
- package/dist/dom/features/forward-ref/full.d.ts +1 -0
- package/dist/dom/features/forward-ref/full.js +51 -0
- package/dist/dom/features/forward-ref/full.js.map +7 -0
- package/dist/dom/features/forward-ref/index.d.ts +1 -0
- package/dist/dom/features/forward-ref/index.js +3 -0
- package/dist/dom/features/forward-ref/index.js.map +7 -0
- package/dist/dom/features/forward-ref/stub.d.ts +1 -0
- package/dist/dom/features/forward-ref/stub.js +22 -0
- package/dist/dom/features/forward-ref/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +61 -0
- package/dist/dom/features/hydration/full.js +264 -0
- package/dist/dom/features/hydration/full.js.map +7 -0
- package/dist/dom/features/hydration/index.d.ts +1 -0
- package/dist/dom/features/hydration/index.js +3 -0
- package/dist/dom/features/hydration/index.js.map +7 -0
- package/dist/dom/features/hydration/stub.d.ts +28 -0
- package/dist/dom/features/hydration/stub.js +66 -0
- package/dist/dom/features/hydration/stub.js.map +7 -0
- package/dist/dom/features/index.d.ts +7 -0
- package/dist/dom/features/index.js +9 -0
- package/dist/dom/features/index.js.map +7 -0
- package/dist/dom/features/lazy/full.d.ts +1 -0
- package/dist/dom/features/lazy/full.js +78 -0
- package/dist/dom/features/lazy/full.js.map +7 -0
- package/dist/dom/features/lazy/index.d.ts +1 -0
- package/dist/dom/features/lazy/index.js +3 -0
- package/dist/dom/features/lazy/index.js.map +7 -0
- package/dist/dom/features/lazy/stub.d.ts +1 -0
- package/dist/dom/features/lazy/stub.js +36 -0
- package/dist/dom/features/lazy/stub.js.map +7 -0
- package/dist/dom/features/memo/full.d.ts +1 -0
- package/dist/dom/features/memo/full.js +59 -0
- package/dist/dom/features/memo/full.js.map +7 -0
- package/dist/dom/features/memo/index.d.ts +1 -0
- package/dist/dom/features/memo/index.js +3 -0
- package/dist/dom/features/memo/index.js.map +7 -0
- package/dist/dom/features/memo/stub.d.ts +1 -0
- package/dist/dom/features/memo/stub.js +36 -0
- package/dist/dom/features/memo/stub.js.map +7 -0
- package/dist/dom/features/portal/full.d.ts +1 -0
- package/dist/dom/features/portal/full.js +19 -0
- package/dist/dom/features/portal/full.js.map +7 -0
- package/dist/dom/features/portal/index.d.ts +1 -0
- package/dist/dom/features/portal/index.js +3 -0
- package/dist/dom/features/portal/index.js.map +7 -0
- package/dist/dom/features/portal/stub.d.ts +1 -0
- package/dist/dom/features/portal/stub.js +7 -0
- package/dist/dom/features/portal/stub.js.map +7 -0
- package/dist/dom/features/suspense/full.d.ts +1 -0
- package/dist/dom/features/suspense/full.js +146 -0
- package/dist/dom/features/suspense/full.js.map +7 -0
- package/dist/dom/features/suspense/index.d.ts +1 -0
- package/dist/dom/features/suspense/index.js +3 -0
- package/dist/dom/features/suspense/index.js.map +7 -0
- package/dist/dom/features/suspense/stub.d.ts +1 -0
- package/dist/dom/features/suspense/stub.js +6 -0
- package/dist/dom/features/suspense/stub.js.map +7 -0
- package/dist/dom/index.d.ts +25 -0
- package/dist/dom/index.js +45 -0
- package/dist/dom/index.js.map +7 -0
- package/dist/dom/portal.d.ts +2 -0
- package/dist/dom/portal.js +15 -0
- package/dist/dom/portal.js.map +7 -0
- package/dist/dom/reconcile.d.ts +40 -0
- package/dist/dom/reconcile.js +795 -0
- package/dist/dom/reconcile.js.map +7 -0
- package/dist/dom/root.d.ts +15 -0
- package/dist/dom/root.js +85 -0
- package/dist/dom/root.js.map +7 -0
- package/dist/dom/test-utils.d.ts +1 -0
- package/dist/dom/test-utils.js +10 -0
- package/dist/dom/test-utils.js.map +7 -0
- package/dist/react/children.d.ts +8 -0
- package/dist/react/children.js +75 -0
- package/dist/react/children.js.map +7 -0
- package/dist/react/class.d.ts +31 -0
- package/dist/react/class.js +40 -0
- package/dist/react/class.js.map +7 -0
- package/dist/react/context.d.ts +27 -0
- package/dist/react/context.js +31 -0
- package/dist/react/context.js.map +7 -0
- package/dist/react/element.d.ts +10 -0
- package/dist/react/element.js +64 -0
- package/dist/react/element.js.map +7 -0
- package/dist/react/hooks.d.ts +37 -0
- package/dist/react/hooks.js +146 -0
- package/dist/react/hooks.js.map +7 -0
- package/dist/react/index.d.ts +76 -0
- package/dist/react/index.js +187 -0
- package/dist/react/index.js.map +7 -0
- package/dist/react/jsx-runtime.d.ts +5 -0
- package/dist/react/jsx-runtime.js +21 -0
- package/dist/react/jsx-runtime.js.map +7 -0
- package/dist/react/memo.d.ts +29 -0
- package/dist/react/memo.js +47 -0
- package/dist/react/memo.js.map +7 -0
- package/dist/react/portal.d.ts +1 -0
- package/dist/react/portal.js +6 -0
- package/dist/react/portal.js.map +7 -0
- package/dist/react/shared-internals.d.ts +33 -0
- package/dist/react/shared-internals.js +29 -0
- package/dist/react/shared-internals.js.map +7 -0
- package/dist/react/suspense.d.ts +15 -0
- package/dist/react/suspense.js +16 -0
- package/dist/react/suspense.js.map +7 -0
- package/dist/scheduler/index.d.ts +44 -0
- package/dist/scheduler/index.js +109 -0
- package/dist/scheduler/index.js.map +7 -0
- package/dist/server/bootstrap-script.d.ts +22 -0
- package/dist/server/bootstrap-script.js +16 -0
- package/dist/server/bootstrap-script.js.map +7 -0
- package/dist/server/dispatcher.d.ts +37 -0
- package/dist/server/dispatcher.js +140 -0
- package/dist/server/dispatcher.js.map +7 -0
- package/dist/server/escape.d.ts +7 -0
- package/dist/server/escape.js +159 -0
- package/dist/server/escape.js.map +7 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +26 -0
- package/dist/server/index.js.map +7 -0
- package/dist/server/renderToString.d.ts +7 -0
- package/dist/server/renderToString.js +29 -0
- package/dist/server/renderToString.js.map +7 -0
- package/dist/server/stream.d.ts +40 -0
- package/dist/server/stream.js +200 -0
- package/dist/server/stream.js.map +7 -0
- package/dist/server/walk.d.ts +33 -0
- package/dist/server/walk.js +298 -0
- package/dist/server/walk.js.map +7 -0
- package/dist/vite/index.d.ts +96 -0
- package/dist/vite/index.js +217 -0
- package/dist/vite/index.js.map +7 -0
- package/package.json +83 -0
- package/src/core/index.ts +2 -0
- package/src/core/internal.ts +107 -0
- package/src/core/types.ts +36 -0
- package/src/dom/_all.ts +54 -0
- package/src/dom/client.ts +4 -0
- package/src/dom/dispatcher.ts +318 -0
- package/src/dom/dom.ts +316 -0
- package/src/dom/event-replay.ts +55 -0
- package/src/dom/features/class/full.ts +104 -0
- package/src/dom/features/class/index.ts +1 -0
- package/src/dom/features/class/stub.ts +65 -0
- package/src/dom/features/context/full.ts +57 -0
- package/src/dom/features/context/index.ts +1 -0
- package/src/dom/features/context/stub.ts +32 -0
- package/src/dom/features/forward-ref/full.ts +54 -0
- package/src/dom/features/forward-ref/index.ts +1 -0
- package/src/dom/features/forward-ref/stub.ts +28 -0
- package/src/dom/features/hydration/full.ts +345 -0
- package/src/dom/features/hydration/index.ts +1 -0
- package/src/dom/features/hydration/stub.ts +72 -0
- package/src/dom/features/index.ts +11 -0
- package/src/dom/features/lazy/full.ts +98 -0
- package/src/dom/features/lazy/index.ts +1 -0
- package/src/dom/features/lazy/stub.ts +45 -0
- package/src/dom/features/memo/full.ts +74 -0
- package/src/dom/features/memo/index.ts +1 -0
- package/src/dom/features/memo/stub.ts +42 -0
- package/src/dom/features/portal/full.ts +22 -0
- package/src/dom/features/portal/index.ts +1 -0
- package/src/dom/features/portal/stub.ts +11 -0
- package/src/dom/features/suspense/full.ts +191 -0
- package/src/dom/features/suspense/index.ts +1 -0
- package/src/dom/features/suspense/stub.ts +12 -0
- package/src/dom/index.ts +33 -0
- package/src/dom/portal.ts +16 -0
- package/src/dom/reconcile.ts +1169 -0
- package/src/dom/root.ts +107 -0
- package/src/dom/test-utils.ts +6 -0
- package/src/react/children.ts +85 -0
- package/src/react/class.ts +56 -0
- package/src/react/context.ts +50 -0
- package/src/react/element.ts +80 -0
- package/src/react/hooks.ts +190 -0
- package/src/react/index.ts +132 -0
- package/src/react/jsx-runtime.ts +16 -0
- package/src/react/memo.ts +45 -0
- package/src/react/portal.ts +1 -0
- package/src/react/shared-internals.ts +79 -0
- package/src/react/suspense.ts +18 -0
- package/src/scheduler/index.ts +124 -0
- package/src/server/bootstrap-script.ts +52 -0
- package/src/server/dispatcher.ts +158 -0
- package/src/server/escape.ts +187 -0
- package/src/server/index.ts +26 -0
- package/src/server/renderToString.ts +33 -0
- package/src/server/stream.ts +302 -0
- package/src/server/walk.ts +448 -0
- package/src/vite/index.ts +401 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode, Ref } from './types';
|
|
2
|
+
export declare const enum FiberTag {
|
|
3
|
+
Host = 0,
|
|
4
|
+
Text = 1,
|
|
5
|
+
Function = 2,
|
|
6
|
+
Class = 3,
|
|
7
|
+
Fragment = 4,
|
|
8
|
+
Portal = 5,
|
|
9
|
+
Provider = 6,
|
|
10
|
+
Consumer = 7,
|
|
11
|
+
ForwardRef = 8,
|
|
12
|
+
Memo = 9,
|
|
13
|
+
Lazy = 10,
|
|
14
|
+
Suspense = 11,
|
|
15
|
+
Root = 12
|
|
16
|
+
}
|
|
17
|
+
export declare const enum FiberFlag {
|
|
18
|
+
None = 0,
|
|
19
|
+
Placement = 1,
|
|
20
|
+
Update = 2,
|
|
21
|
+
Deletion = 4,
|
|
22
|
+
Ref = 8,
|
|
23
|
+
Effect = 16,
|
|
24
|
+
LayoutEffect = 32,
|
|
25
|
+
ContentReset = 64,
|
|
26
|
+
DidCapture = 128
|
|
27
|
+
}
|
|
28
|
+
export interface Hook {
|
|
29
|
+
state: any;
|
|
30
|
+
queue: any;
|
|
31
|
+
deps: any;
|
|
32
|
+
cleanup: any;
|
|
33
|
+
next: Hook | null;
|
|
34
|
+
}
|
|
35
|
+
export interface Effect {
|
|
36
|
+
tag: 'effect' | 'layout' | 'insertion';
|
|
37
|
+
create: () => any;
|
|
38
|
+
destroy: (() => void) | void;
|
|
39
|
+
deps: ReadonlyArray<unknown> | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface Fiber {
|
|
42
|
+
tag: FiberTag;
|
|
43
|
+
type: any;
|
|
44
|
+
key: string | null;
|
|
45
|
+
ref: Ref<any> | null;
|
|
46
|
+
pendingProps: any;
|
|
47
|
+
memoizedProps: any;
|
|
48
|
+
memoizedState: any;
|
|
49
|
+
stateNode: any;
|
|
50
|
+
dom: Node | null;
|
|
51
|
+
parent: Fiber | null;
|
|
52
|
+
child: Fiber | null;
|
|
53
|
+
sibling: Fiber | null;
|
|
54
|
+
hooks: Hook | null;
|
|
55
|
+
effects: Effect[] | null;
|
|
56
|
+
layoutEffects: Effect[] | null;
|
|
57
|
+
cleanups: Array<() => void> | null;
|
|
58
|
+
flags: FiberFlag;
|
|
59
|
+
dirty: boolean;
|
|
60
|
+
unmounted: boolean;
|
|
61
|
+
root: FiberRoot | null;
|
|
62
|
+
}
|
|
63
|
+
export interface FiberRoot {
|
|
64
|
+
container: Element | DocumentFragment;
|
|
65
|
+
current: Fiber;
|
|
66
|
+
pending: Set<Fiber>;
|
|
67
|
+
scheduled: boolean;
|
|
68
|
+
onRecoverableError?: (err: unknown) => void;
|
|
69
|
+
onCaughtError?: (err: unknown) => void;
|
|
70
|
+
onUncaughtError?: (err: unknown) => void;
|
|
71
|
+
identifierPrefix: string;
|
|
72
|
+
hydrating: boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare function createFiber(tag: FiberTag, type: any, key: string | null): Fiber;
|
|
75
|
+
export type ChildNode = ReactElement | string | number | boolean | null | undefined | ChildNode[];
|
|
76
|
+
export type { ReactElement, ReactNode };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// packages/redact/src/core/internal.ts
|
|
2
|
+
var FiberTag = /* @__PURE__ */ ((FiberTag2) => {
|
|
3
|
+
FiberTag2[FiberTag2["Host"] = 0] = "Host";
|
|
4
|
+
FiberTag2[FiberTag2["Text"] = 1] = "Text";
|
|
5
|
+
FiberTag2[FiberTag2["Function"] = 2] = "Function";
|
|
6
|
+
FiberTag2[FiberTag2["Class"] = 3] = "Class";
|
|
7
|
+
FiberTag2[FiberTag2["Fragment"] = 4] = "Fragment";
|
|
8
|
+
FiberTag2[FiberTag2["Portal"] = 5] = "Portal";
|
|
9
|
+
FiberTag2[FiberTag2["Provider"] = 6] = "Provider";
|
|
10
|
+
FiberTag2[FiberTag2["Consumer"] = 7] = "Consumer";
|
|
11
|
+
FiberTag2[FiberTag2["ForwardRef"] = 8] = "ForwardRef";
|
|
12
|
+
FiberTag2[FiberTag2["Memo"] = 9] = "Memo";
|
|
13
|
+
FiberTag2[FiberTag2["Lazy"] = 10] = "Lazy";
|
|
14
|
+
FiberTag2[FiberTag2["Suspense"] = 11] = "Suspense";
|
|
15
|
+
FiberTag2[FiberTag2["Root"] = 12] = "Root";
|
|
16
|
+
return FiberTag2;
|
|
17
|
+
})(FiberTag || {});
|
|
18
|
+
var FiberFlag = /* @__PURE__ */ ((FiberFlag2) => {
|
|
19
|
+
FiberFlag2[FiberFlag2["None"] = 0] = "None";
|
|
20
|
+
FiberFlag2[FiberFlag2["Placement"] = 1] = "Placement";
|
|
21
|
+
FiberFlag2[FiberFlag2["Update"] = 2] = "Update";
|
|
22
|
+
FiberFlag2[FiberFlag2["Deletion"] = 4] = "Deletion";
|
|
23
|
+
FiberFlag2[FiberFlag2["Ref"] = 8] = "Ref";
|
|
24
|
+
FiberFlag2[FiberFlag2["Effect"] = 16] = "Effect";
|
|
25
|
+
FiberFlag2[FiberFlag2["LayoutEffect"] = 32] = "LayoutEffect";
|
|
26
|
+
FiberFlag2[FiberFlag2["ContentReset"] = 64] = "ContentReset";
|
|
27
|
+
FiberFlag2[FiberFlag2["DidCapture"] = 128] = "DidCapture";
|
|
28
|
+
return FiberFlag2;
|
|
29
|
+
})(FiberFlag || {});
|
|
30
|
+
function createFiber(tag, type, key) {
|
|
31
|
+
return {
|
|
32
|
+
tag,
|
|
33
|
+
type,
|
|
34
|
+
key,
|
|
35
|
+
ref: null,
|
|
36
|
+
pendingProps: null,
|
|
37
|
+
memoizedProps: null,
|
|
38
|
+
memoizedState: null,
|
|
39
|
+
stateNode: null,
|
|
40
|
+
dom: null,
|
|
41
|
+
parent: null,
|
|
42
|
+
child: null,
|
|
43
|
+
sibling: null,
|
|
44
|
+
hooks: null,
|
|
45
|
+
effects: null,
|
|
46
|
+
layoutEffects: null,
|
|
47
|
+
cleanups: null,
|
|
48
|
+
flags: 0 /* None */,
|
|
49
|
+
dirty: false,
|
|
50
|
+
unmounted: false,
|
|
51
|
+
root: null
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
FiberFlag,
|
|
56
|
+
FiberTag,
|
|
57
|
+
createFiber
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/internal.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ReactElement, ReactNode, Ref } from './types'\n\nexport const enum FiberTag {\n Host = 0,\n Text = 1,\n Function = 2,\n Class = 3,\n Fragment = 4,\n Portal = 5,\n Provider = 6,\n Consumer = 7,\n ForwardRef = 8,\n Memo = 9,\n Lazy = 10,\n Suspense = 11,\n Root = 12,\n}\n\nexport const enum FiberFlag {\n None = 0,\n Placement = 1 << 0,\n Update = 1 << 1,\n Deletion = 1 << 2,\n Ref = 1 << 3,\n Effect = 1 << 4,\n LayoutEffect = 1 << 5,\n ContentReset = 1 << 6,\n DidCapture = 1 << 7,\n}\n\nexport interface Hook {\n state: any\n queue: any\n deps: any\n cleanup: any\n next: Hook | null\n}\n\nexport interface Effect {\n tag: 'effect' | 'layout' | 'insertion'\n create: () => any\n destroy: (() => void) | void\n deps: ReadonlyArray<unknown> | undefined\n}\n\nexport interface Fiber {\n tag: FiberTag\n type: any\n key: string | null\n ref: Ref<any> | null\n pendingProps: any\n memoizedProps: any\n memoizedState: any\n stateNode: any\n dom: Node | null\n parent: Fiber | null\n child: Fiber | null\n sibling: Fiber | null\n hooks: Hook | null\n effects: Effect[] | null\n layoutEffects: Effect[] | null\n cleanups: Array<() => void> | null\n flags: FiberFlag\n dirty: boolean\n unmounted: boolean\n root: FiberRoot | null\n}\n\nexport interface FiberRoot {\n container: Element | DocumentFragment\n current: Fiber\n pending: Set<Fiber>\n scheduled: boolean\n onRecoverableError?: (err: unknown) => void\n onCaughtError?: (err: unknown) => void\n onUncaughtError?: (err: unknown) => void\n identifierPrefix: string\n hydrating: boolean\n}\n\nexport function createFiber(tag: FiberTag, type: any, key: string | null): Fiber {\n return {\n tag,\n type,\n key,\n ref: null,\n pendingProps: null,\n memoizedProps: null,\n memoizedState: null,\n stateNode: null,\n dom: null,\n parent: null,\n child: null,\n sibling: null,\n hooks: null,\n effects: null,\n layoutEffects: null,\n cleanups: null,\n flags: FiberFlag.None,\n dirty: false,\n unmounted: false,\n root: null,\n }\n}\n\nexport type ChildNode = ReactElement | string | number | boolean | null | undefined | ChildNode[]\nexport type { ReactElement, ReactNode }\n"],
|
|
5
|
+
"mappings": ";AAEO,IAAW,WAAX,kBAAWA,cAAX;AACL,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,cAAW,KAAX;AACA,EAAAA,oBAAA,WAAQ,KAAR;AACA,EAAAA,oBAAA,cAAW,KAAX;AACA,EAAAA,oBAAA,YAAS,KAAT;AACA,EAAAA,oBAAA,cAAW,KAAX;AACA,EAAAA,oBAAA,cAAW,KAAX;AACA,EAAAA,oBAAA,gBAAa,KAAb;AACA,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,UAAO,MAAP;AACA,EAAAA,oBAAA,cAAW,MAAX;AACA,EAAAA,oBAAA,UAAO,MAAP;AAbgB,SAAAA;AAAA,GAAA;AAgBX,IAAW,YAAX,kBAAWC,eAAX;AACL,EAAAA,sBAAA,UAAO,KAAP;AACA,EAAAA,sBAAA,eAAY,KAAZ;AACA,EAAAA,sBAAA,YAAS,KAAT;AACA,EAAAA,sBAAA,cAAW,KAAX;AACA,EAAAA,sBAAA,SAAM,KAAN;AACA,EAAAA,sBAAA,YAAS,MAAT;AACA,EAAAA,sBAAA,kBAAe,MAAf;AACA,EAAAA,sBAAA,kBAAe,MAAf;AACA,EAAAA,sBAAA,gBAAa,OAAb;AATgB,SAAAA;AAAA,GAAA;AA8DX,SAAS,YAAY,KAAe,MAAW,KAA2B;AAC/E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL,cAAc;AAAA,IACd,eAAe;AAAA,IACf,eAAe;AAAA,IACf,WAAW;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,IACT,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": ["FiberTag", "FiberFlag"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const REACT_ELEMENT_TYPE: unique symbol;
|
|
2
|
+
export declare const REACT_LEGACY_ELEMENT_TYPE: unique symbol;
|
|
3
|
+
export declare const REACT_FRAGMENT_TYPE: unique symbol;
|
|
4
|
+
export type Key = string | number | null | undefined;
|
|
5
|
+
export interface ReactElement<P = any, T = any> {
|
|
6
|
+
$$typeof: typeof REACT_ELEMENT_TYPE;
|
|
7
|
+
type: T;
|
|
8
|
+
key: string | null;
|
|
9
|
+
ref: any;
|
|
10
|
+
props: P;
|
|
11
|
+
}
|
|
12
|
+
export type ReactNode = ReactElement | string | number | boolean | null | undefined | Iterable<ReactNode>;
|
|
13
|
+
export type RefObject<T> = {
|
|
14
|
+
current: T | null;
|
|
15
|
+
};
|
|
16
|
+
export type RefCallback<T> = (instance: T | null) => void | (() => void);
|
|
17
|
+
export type Ref<T> = RefObject<T> | RefCallback<T> | null;
|
|
18
|
+
export type Dispatch<A> = (value: A) => void;
|
|
19
|
+
export type SetStateAction<S> = S | ((prev: S) => S);
|
|
20
|
+
export type EffectCallback = () => void | (() => void);
|
|
21
|
+
export type DependencyList = ReadonlyArray<unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// packages/redact/src/core/types.ts
|
|
2
|
+
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
3
|
+
var REACT_LEGACY_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
|
|
4
|
+
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
5
|
+
export {
|
|
6
|
+
REACT_ELEMENT_TYPE,
|
|
7
|
+
REACT_FRAGMENT_TYPE,
|
|
8
|
+
REACT_LEGACY_ELEMENT_TYPE
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/types.ts"],
|
|
4
|
+
"sourcesContent": ["// React 19+ uses the transitional element symbol. When our shim's elements\n// are passed to react-dom (e.g. Start routing through real react-dom/server\n// somewhere), they must carry the symbol that React's isValidElement checks.\nexport const REACT_ELEMENT_TYPE = Symbol.for('react.transitional.element')\nexport const REACT_LEGACY_ELEMENT_TYPE = Symbol.for('react.element')\nexport const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment')\n\nexport type Key = string | number | null | undefined\n\nexport interface ReactElement<P = any, T = any> {\n $$typeof: typeof REACT_ELEMENT_TYPE\n type: T\n key: string | null\n ref: any\n props: P\n}\n\nexport type ReactNode =\n | ReactElement\n | string\n | number\n | boolean\n | null\n | undefined\n | Iterable<ReactNode>\n\nexport type RefObject<T> = { current: T | null }\nexport type RefCallback<T> = (instance: T | null) => void | (() => void)\nexport type Ref<T> = RefObject<T> | RefCallback<T> | null\n\nexport type Dispatch<A> = (value: A) => void\nexport type SetStateAction<S> = S | ((prev: S) => S)\n\nexport type EffectCallback = () => void | (() => void)\nexport type DependencyList = ReadonlyArray<unknown>\n\n"],
|
|
5
|
+
"mappings": ";AAGO,IAAM,qBAAqB,uBAAO,IAAI,4BAA4B;AAClE,IAAM,4BAA4B,uBAAO,IAAI,eAAe;AAC5D,IAAM,sBAAsB,uBAAO,IAAI,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './features';
|
|
2
|
+
export { flushSync, batchedUpdates as unstable_batchedUpdates } from './root';
|
|
3
|
+
export { createRoot, hydrateRoot } from './root';
|
|
4
|
+
export type { Root, RootOptions } from './root';
|
|
5
|
+
export { createPortal } from './portal';
|
|
6
|
+
export { act } from './test-utils';
|
|
7
|
+
export declare function preconnect(_href: string, _opts?: any): void;
|
|
8
|
+
export declare function prefetchDNS(_href: string): void;
|
|
9
|
+
export declare function preload(_href: string, _opts?: any): void;
|
|
10
|
+
export declare function preinit(_href: string, _opts?: any): void;
|
|
11
|
+
export declare function preloadModule(_href: string, _opts?: any): void;
|
|
12
|
+
export declare function preinitModule(_href: string, _opts?: any): void;
|
|
13
|
+
export declare const version = "19.2.3";
|
|
14
|
+
export { registerRenderer, registerTypeMatcher, registerElementMarker, installCapability, reconcileChildren, childrenToArray, } from './reconcile';
|
|
15
|
+
export type { RenderFn, TypeMatcher, Capabilities, } from './reconcile';
|
|
16
|
+
export { FiberTag } from '../core';
|
|
17
|
+
export type { Fiber, FiberRoot, ReactNode, ReactElement } from '../core';
|
package/dist/dom/_all.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// packages/redact/src/dom/_all.ts
|
|
2
|
+
import "./features";
|
|
3
|
+
import { flushSync, batchedUpdates } from "./root";
|
|
4
|
+
import { createRoot, hydrateRoot } from "./root";
|
|
5
|
+
import { createPortal } from "./portal";
|
|
6
|
+
import { act } from "./test-utils";
|
|
7
|
+
import {
|
|
8
|
+
registerRenderer,
|
|
9
|
+
registerTypeMatcher,
|
|
10
|
+
registerElementMarker,
|
|
11
|
+
installCapability,
|
|
12
|
+
reconcileChildren,
|
|
13
|
+
childrenToArray
|
|
14
|
+
} from "./reconcile";
|
|
15
|
+
import { FiberTag } from "../core";
|
|
16
|
+
function preconnect(_href, _opts) {
|
|
17
|
+
}
|
|
18
|
+
function prefetchDNS(_href) {
|
|
19
|
+
}
|
|
20
|
+
function preload(_href, _opts) {
|
|
21
|
+
}
|
|
22
|
+
function preinit(_href, _opts) {
|
|
23
|
+
}
|
|
24
|
+
function preloadModule(_href, _opts) {
|
|
25
|
+
}
|
|
26
|
+
function preinitModule(_href, _opts) {
|
|
27
|
+
}
|
|
28
|
+
var version = "19.2.3";
|
|
29
|
+
export {
|
|
30
|
+
FiberTag,
|
|
31
|
+
act,
|
|
32
|
+
childrenToArray,
|
|
33
|
+
createPortal,
|
|
34
|
+
createRoot,
|
|
35
|
+
flushSync,
|
|
36
|
+
hydrateRoot,
|
|
37
|
+
installCapability,
|
|
38
|
+
preconnect,
|
|
39
|
+
prefetchDNS,
|
|
40
|
+
preinit,
|
|
41
|
+
preinitModule,
|
|
42
|
+
preload,
|
|
43
|
+
preloadModule,
|
|
44
|
+
reconcileChildren,
|
|
45
|
+
registerElementMarker,
|
|
46
|
+
registerRenderer,
|
|
47
|
+
registerTypeMatcher,
|
|
48
|
+
batchedUpdates as unstable_batchedUpdates,
|
|
49
|
+
version
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=_all.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/_all.ts"],
|
|
4
|
+
"sourcesContent": ["// Unified entry exposing both top-level public API (createRoot, hydrateRoot,\n// createPortal, \u2026) and the registration primitives that custom features and\n// custom bundler plugins need to hook into the reconciler. Reachable as\n// `@tanstack/redact/_all` via the package's subpath exports. Single-instance\n// state for things like the hydration CLAIMED WeakSet, scheduler queue,\n// dispatcher H slot, etc. is preserved because every public entry funnels\n// through this module.\n\n// Side-effect import: registers all opt-in features (renderers, type matchers,\n// element markers) with the reconciler. A vite plugin may alias individual\n// feature modules to ./features/<name>/stub to strip them from the bundle.\nimport './features'\n\n// Top-level public API (mirrors the surface of /, /dom, /dom-client).\nexport { flushSync, batchedUpdates as unstable_batchedUpdates } from './root'\nexport { createRoot, hydrateRoot } from './root'\nexport type { Root, RootOptions } from './root'\nexport { createPortal } from './portal'\nexport { act } from './test-utils'\n\n// Resource hints \u2014 stubs\nexport function preconnect(_href: string, _opts?: any): void {}\nexport function prefetchDNS(_href: string): void {}\nexport function preload(_href: string, _opts?: any): void {}\nexport function preinit(_href: string, _opts?: any): void {}\nexport function preloadModule(_href: string, _opts?: any): void {}\nexport function preinitModule(_href: string, _opts?: any): void {}\n\nexport const version = '19.2.3'\n\n// Registration primitives \u2014 needed by custom features\n// (`registerRenderer`, `registerTypeMatcher`, `registerElementMarker`) and by\n// anything that wants to override a cross-cutting concern like Suspense's\n// `handleSuspended` or Context's `readContext` (`installCapability`). The\n// built-in features in `./features/*/{full,stub}.ts` use these via relative\n// imports; external authors reach them through this entry. Order-of-\n// registration matters: later calls overwrite earlier ones.\nexport {\n registerRenderer,\n registerTypeMatcher,\n registerElementMarker,\n installCapability,\n reconcileChildren,\n childrenToArray,\n} from './reconcile'\nexport type {\n RenderFn,\n TypeMatcher,\n Capabilities,\n} from './reconcile'\n\n// Core types most custom features need.\nexport { FiberTag } from '../core'\nexport type { Fiber, FiberRoot, ReactNode, ReactElement } from '../core'\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AAGP,SAAS,WAA6B,sBAA+B;AACrE,SAAS,YAAY,mBAAmB;AAExC,SAAS,oBAAoB;AAC7B,SAAS,WAAW;AAmBpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP,SAAS,gBAAgB;AA/BlB,SAAS,WAAW,OAAe,OAAmB;AAAC;AACvD,SAAS,YAAY,OAAqB;AAAC;AAC3C,SAAS,QAAQ,OAAe,OAAmB;AAAC;AACpD,SAAS,QAAQ,OAAe,OAAmB;AAAC;AACpD,SAAS,cAAc,OAAe,OAAmB;AAAC;AAC1D,SAAS,cAAc,OAAe,OAAmB;AAAC;AAE1D,IAAM,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/client.ts"],
|
|
4
|
+
"sourcesContent": ["import './features'\n\nexport { createRoot, hydrateRoot } from './root'\nexport type { Root, RootOptions } from './root'\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO;AAEP,SAAS,YAAY,mBAAmB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function makeDispatcher(): {
|
|
2
|
+
useState<S>(initial: S | (() => S)): any;
|
|
3
|
+
useReducer<S, A>(reducer: (s: S, a: A) => S, initialArg: any, init?: (a: any) => S): [S, (a: A) => void];
|
|
4
|
+
useEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
5
|
+
useLayoutEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
6
|
+
useInsertionEffect(create: () => any, deps?: ReadonlyArray<unknown>): any;
|
|
7
|
+
useRef<T>(initial: T): {
|
|
8
|
+
current: T;
|
|
9
|
+
};
|
|
10
|
+
useMemo<T>(factory: () => T, deps?: ReadonlyArray<unknown>): T;
|
|
11
|
+
useCallback<T extends Function>(fn: T, deps?: ReadonlyArray<unknown>): T;
|
|
12
|
+
useContext<T>(ctx: any): T;
|
|
13
|
+
useImperativeHandle<T>(ref: any, factory: () => T, deps?: ReadonlyArray<unknown>): void;
|
|
14
|
+
useDebugValue<T>(_value: T, _formatter?: (v: T) => any): void;
|
|
15
|
+
useId(): string;
|
|
16
|
+
useTransition(): [boolean, (fn: () => void) => void];
|
|
17
|
+
useDeferredValue<T>(v: T): T;
|
|
18
|
+
useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
|
|
19
|
+
use<T>(resource: any): T;
|
|
20
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// packages/redact/src/dom/dispatcher.ts
|
|
2
|
+
import { ReactSharedInternals, REACT_CONTEXT_TYPE } from "../react";
|
|
3
|
+
import { scheduleUpdate, enqueueEffect, readContext } from "./reconcile";
|
|
4
|
+
function getCurrentFiber() {
|
|
5
|
+
const f = ReactSharedInternals.currentFiber;
|
|
6
|
+
if (!f) throw new Error("Hook called outside a function component render.");
|
|
7
|
+
return f;
|
|
8
|
+
}
|
|
9
|
+
function nextHook() {
|
|
10
|
+
const fiber = getCurrentFiber();
|
|
11
|
+
const idx = ReactSharedInternals.hookIndex++;
|
|
12
|
+
let prev = ReactSharedInternals.currentHook;
|
|
13
|
+
if (idx === 0) {
|
|
14
|
+
if (fiber.hooks) {
|
|
15
|
+
ReactSharedInternals.currentHook = fiber.hooks;
|
|
16
|
+
return fiber.hooks;
|
|
17
|
+
}
|
|
18
|
+
const h2 = { state: void 0, queue: void 0, deps: void 0, cleanup: void 0, next: null };
|
|
19
|
+
fiber.hooks = h2;
|
|
20
|
+
ReactSharedInternals.currentHook = h2;
|
|
21
|
+
return h2;
|
|
22
|
+
}
|
|
23
|
+
if (prev && prev.next) {
|
|
24
|
+
ReactSharedInternals.currentHook = prev.next;
|
|
25
|
+
return prev.next;
|
|
26
|
+
}
|
|
27
|
+
const h = { state: void 0, queue: void 0, deps: void 0, cleanup: void 0, next: null };
|
|
28
|
+
if (prev) prev.next = h;
|
|
29
|
+
else fiber.hooks = h;
|
|
30
|
+
ReactSharedInternals.currentHook = h;
|
|
31
|
+
return h;
|
|
32
|
+
}
|
|
33
|
+
function depsEqual(a, b) {
|
|
34
|
+
if (a === b) return true;
|
|
35
|
+
if (!a || !b) return false;
|
|
36
|
+
if (a.length !== b.length) return false;
|
|
37
|
+
for (let i = 0; i < a.length; i++) {
|
|
38
|
+
if (!Object.is(a[i], b[i])) return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
function makeDispatcher() {
|
|
43
|
+
return {
|
|
44
|
+
useState(initial) {
|
|
45
|
+
return this.useReducer(
|
|
46
|
+
basicReducer,
|
|
47
|
+
typeof initial === "function" ? initial() : initial
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
useReducer(reducer, initialArg, init) {
|
|
51
|
+
const hook = nextHook();
|
|
52
|
+
const fiber = getCurrentFiber();
|
|
53
|
+
if (hook.queue === void 0) {
|
|
54
|
+
hook.state = init ? init(initialArg) : initialArg;
|
|
55
|
+
const queue = { reducer };
|
|
56
|
+
const dispatch = (action) => {
|
|
57
|
+
const currentState = hook.state;
|
|
58
|
+
const next = queue.reducer(currentState, action);
|
|
59
|
+
if (!Object.is(next, currentState)) {
|
|
60
|
+
hook.state = next;
|
|
61
|
+
scheduleUpdate(fiber);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
queue.dispatch = dispatch;
|
|
65
|
+
hook.queue = queue;
|
|
66
|
+
} else {
|
|
67
|
+
hook.queue.reducer = reducer;
|
|
68
|
+
}
|
|
69
|
+
return [hook.state, hook.queue.dispatch];
|
|
70
|
+
},
|
|
71
|
+
useEffect(create, deps) {
|
|
72
|
+
const hook = nextHook();
|
|
73
|
+
const fiber = getCurrentFiber();
|
|
74
|
+
const prevDeps = hook.deps;
|
|
75
|
+
if (prevDeps !== void 0 && depsEqual(prevDeps, deps)) return;
|
|
76
|
+
hook.deps = deps;
|
|
77
|
+
const effect = {
|
|
78
|
+
tag: "effect",
|
|
79
|
+
create: () => {
|
|
80
|
+
if (hook.cleanup) {
|
|
81
|
+
try {
|
|
82
|
+
hook.cleanup();
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
if (fiber.cleanups) {
|
|
86
|
+
const i = fiber.cleanups.indexOf(hook.cleanup);
|
|
87
|
+
if (i >= 0) fiber.cleanups.splice(i, 1);
|
|
88
|
+
}
|
|
89
|
+
hook.cleanup = null;
|
|
90
|
+
}
|
|
91
|
+
const c = create();
|
|
92
|
+
hook.cleanup = typeof c === "function" ? c : null;
|
|
93
|
+
return hook.cleanup;
|
|
94
|
+
},
|
|
95
|
+
destroy: void 0,
|
|
96
|
+
deps
|
|
97
|
+
};
|
|
98
|
+
enqueueEffect(fiber, effect);
|
|
99
|
+
},
|
|
100
|
+
useLayoutEffect(create, deps) {
|
|
101
|
+
const hook = nextHook();
|
|
102
|
+
const fiber = getCurrentFiber();
|
|
103
|
+
const prevDeps = hook.deps;
|
|
104
|
+
if (prevDeps !== void 0 && depsEqual(prevDeps, deps)) return;
|
|
105
|
+
hook.deps = deps;
|
|
106
|
+
const effect = {
|
|
107
|
+
tag: "layout",
|
|
108
|
+
create: () => {
|
|
109
|
+
if (hook.cleanup) {
|
|
110
|
+
try {
|
|
111
|
+
hook.cleanup();
|
|
112
|
+
} catch {
|
|
113
|
+
}
|
|
114
|
+
if (fiber.cleanups) {
|
|
115
|
+
const i = fiber.cleanups.indexOf(hook.cleanup);
|
|
116
|
+
if (i >= 0) fiber.cleanups.splice(i, 1);
|
|
117
|
+
}
|
|
118
|
+
hook.cleanup = null;
|
|
119
|
+
}
|
|
120
|
+
const c = create();
|
|
121
|
+
hook.cleanup = typeof c === "function" ? c : null;
|
|
122
|
+
return hook.cleanup;
|
|
123
|
+
},
|
|
124
|
+
destroy: void 0,
|
|
125
|
+
deps
|
|
126
|
+
};
|
|
127
|
+
enqueueEffect(fiber, effect);
|
|
128
|
+
},
|
|
129
|
+
useInsertionEffect(create, deps) {
|
|
130
|
+
return this.useLayoutEffect(create, deps);
|
|
131
|
+
},
|
|
132
|
+
useRef(initial) {
|
|
133
|
+
const hook = nextHook();
|
|
134
|
+
if (hook.state === void 0) hook.state = { current: initial };
|
|
135
|
+
return hook.state;
|
|
136
|
+
},
|
|
137
|
+
useMemo(factory, deps) {
|
|
138
|
+
const hook = nextHook();
|
|
139
|
+
if (hook.deps !== void 0 && depsEqual(hook.deps, deps)) {
|
|
140
|
+
return hook.state;
|
|
141
|
+
}
|
|
142
|
+
const value = factory();
|
|
143
|
+
hook.state = value;
|
|
144
|
+
hook.deps = deps;
|
|
145
|
+
return value;
|
|
146
|
+
},
|
|
147
|
+
useCallback(fn, deps) {
|
|
148
|
+
return this.useMemo(() => fn, deps);
|
|
149
|
+
},
|
|
150
|
+
useContext(ctx) {
|
|
151
|
+
const fiber = getCurrentFiber();
|
|
152
|
+
return readContext(fiber, ctx);
|
|
153
|
+
},
|
|
154
|
+
useImperativeHandle(ref, factory, deps) {
|
|
155
|
+
const hook = nextHook();
|
|
156
|
+
if (hook.deps !== void 0 && depsEqual(hook.deps, deps)) return;
|
|
157
|
+
hook.deps = deps;
|
|
158
|
+
const value = factory();
|
|
159
|
+
if (ref) {
|
|
160
|
+
if (typeof ref === "function") ref(value);
|
|
161
|
+
else ref.current = value;
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
useDebugValue(_value, _formatter) {
|
|
165
|
+
},
|
|
166
|
+
useId() {
|
|
167
|
+
const hook = nextHook();
|
|
168
|
+
if (hook.state === void 0) {
|
|
169
|
+
const fiber = getCurrentFiber();
|
|
170
|
+
const root = findRootFromFiber(fiber);
|
|
171
|
+
hook.state = (root?.identifierPrefix ?? ":r") + (idCounter++).toString(36);
|
|
172
|
+
}
|
|
173
|
+
return hook.state;
|
|
174
|
+
},
|
|
175
|
+
useTransition() {
|
|
176
|
+
return [false, (fn) => fn()];
|
|
177
|
+
},
|
|
178
|
+
useDeferredValue(v) {
|
|
179
|
+
return v;
|
|
180
|
+
},
|
|
181
|
+
useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
182
|
+
const fiber = getCurrentFiber();
|
|
183
|
+
const hook = nextHook();
|
|
184
|
+
const root = fiber.root ?? findRootFromFiber(fiber);
|
|
185
|
+
const isHydrating = Boolean(root?.hydrating);
|
|
186
|
+
const value = isHydrating && getServerSnapshot ? getServerSnapshot() : getSnapshot();
|
|
187
|
+
hook.state = value;
|
|
188
|
+
if (hook.cleanup == null) {
|
|
189
|
+
const forceUpdate = () => {
|
|
190
|
+
let next;
|
|
191
|
+
try {
|
|
192
|
+
next = getSnapshot();
|
|
193
|
+
} catch {
|
|
194
|
+
scheduleUpdate(fiber);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (!Object.is(hook.state, next)) {
|
|
198
|
+
hook.state = next;
|
|
199
|
+
scheduleUpdate(fiber);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const unsubscribe = subscribe(forceUpdate);
|
|
203
|
+
hook.cleanup = unsubscribe;
|
|
204
|
+
if (typeof unsubscribe === "function") {
|
|
205
|
+
fiber.cleanups ||= [];
|
|
206
|
+
fiber.cleanups.push(unsubscribe);
|
|
207
|
+
}
|
|
208
|
+
if (isHydrating && getServerSnapshot) {
|
|
209
|
+
queueMicrotask(() => queueMicrotask(forceUpdate));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return value;
|
|
213
|
+
},
|
|
214
|
+
use(resource) {
|
|
215
|
+
if (resource == null) throw new Error("use() received null or undefined");
|
|
216
|
+
if (resource.$$typeof === REACT_CONTEXT_TYPE) {
|
|
217
|
+
return readContext(getCurrentFiber(), resource);
|
|
218
|
+
}
|
|
219
|
+
if (typeof resource.then === "function") {
|
|
220
|
+
const thenable = resource;
|
|
221
|
+
switch (thenable.status) {
|
|
222
|
+
case "fulfilled":
|
|
223
|
+
return thenable.value;
|
|
224
|
+
case "rejected":
|
|
225
|
+
throw thenable.reason;
|
|
226
|
+
default: {
|
|
227
|
+
if (thenable.status === void 0) {
|
|
228
|
+
thenable.status = "pending";
|
|
229
|
+
thenable.then(
|
|
230
|
+
(v) => {
|
|
231
|
+
if (thenable.status === "pending") {
|
|
232
|
+
thenable.status = "fulfilled";
|
|
233
|
+
thenable.value = v;
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
(e) => {
|
|
237
|
+
if (thenable.status === "pending") {
|
|
238
|
+
thenable.status = "rejected";
|
|
239
|
+
thenable.reason = e;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
throw thenable;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
throw new Error("use() expected a Promise or Context");
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function basicReducer(state, action) {
|
|
253
|
+
return typeof action === "function" ? action(state) : action;
|
|
254
|
+
}
|
|
255
|
+
var idCounter = 0;
|
|
256
|
+
function findRootFromFiber(fiber) {
|
|
257
|
+
let f = fiber;
|
|
258
|
+
while (f) {
|
|
259
|
+
if (f.root) return f.root;
|
|
260
|
+
f = f.parent;
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
export {
|
|
265
|
+
makeDispatcher
|
|
266
|
+
};
|
|
267
|
+
//# sourceMappingURL=dispatcher.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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.currentFiber\n if (!f) throw new Error('Hook called outside a function component render.')\n return f\n}\n\nfunction nextHook(): Hook {\n const fiber = getCurrentFiber()\n const idx = ReactSharedInternals.hookIndex++\n\n let prev = ReactSharedInternals.currentHook\n\n if (idx === 0) {\n if (fiber.hooks) {\n ReactSharedInternals.currentHook = fiber.hooks\n return fiber.hooks\n }\n const h: Hook = { state: undefined, queue: undefined, deps: undefined, cleanup: undefined, next: null }\n fiber.hooks = h\n ReactSharedInternals.currentHook = h\n return h\n }\n\n if (prev && prev.next) {\n ReactSharedInternals.currentHook = prev.next\n return prev.next\n }\n\n const h: Hook = { state: undefined, queue: undefined, deps: undefined, cleanup: undefined, next: null }\n if (prev) prev.next = h\n else fiber.hooks = h\n ReactSharedInternals.currentHook = 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\nexport function makeDispatcher() {\n return {\n useState<S>(initial: S | (() => S)) {\n return this.useReducer<S, S | ((p: S) => S)>(\n basicReducer as any,\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.queue === undefined) {\n hook.state = init ? init(initialArg) : initialArg\n const queue: any = { reducer }\n const dispatch = (action: A) => {\n const currentState = hook.state as S\n const next = queue.reducer(currentState, action)\n if (!Object.is(next, currentState)) {\n hook.state = next\n scheduleUpdate(fiber)\n }\n }\n queue.dispatch = dispatch\n hook.queue = queue\n } else {\n hook.queue.reducer = reducer\n }\n return [hook.state, hook.queue.dispatch] 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.deps\n if (prevDeps !== undefined && depsEqual(prevDeps, deps)) return\n hook.deps = deps\n const effect: Effect = {\n tag: 'effect',\n create: () => {\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 effects B + C both run fresh,\n // leaving two side-effects (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.cleanup) {\n try { hook.cleanup() } catch {}\n // The prior cleanup was also pushed onto fiber.cleanups; remove\n // it so unmount doesn't double-call it.\n if (fiber.cleanups) {\n const i = fiber.cleanups.indexOf(hook.cleanup)\n if (i >= 0) fiber.cleanups.splice(i, 1)\n }\n hook.cleanup = null\n }\n const c = create()\n hook.cleanup = typeof c === 'function' ? c : null\n return hook.cleanup\n },\n destroy: undefined,\n deps,\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.deps\n if (prevDeps !== undefined && depsEqual(prevDeps, deps)) return\n hook.deps = deps\n const effect: Effect = {\n tag: 'layout',\n create: () => {\n // Mirror useEffect: tear down the prior cleanup at run time so\n // coalesced renders don't leak side-effects.\n if (hook.cleanup) {\n try { hook.cleanup() } catch {}\n if (fiber.cleanups) {\n const i = fiber.cleanups.indexOf(hook.cleanup)\n if (i >= 0) fiber.cleanups.splice(i, 1)\n }\n hook.cleanup = null\n }\n const c = create()\n hook.cleanup = typeof c === 'function' ? c : null\n return hook.cleanup\n },\n destroy: undefined,\n deps,\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.state === undefined) hook.state = { current: initial }\n return hook.state as { current: T }\n },\n\n useMemo<T>(factory: () => T, deps?: ReadonlyArray<unknown>) {\n const hook = nextHook()\n if (hook.deps !== undefined && depsEqual(hook.deps, deps)) {\n return hook.state as T\n }\n const value = factory()\n hook.state = value\n hook.deps = 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.deps !== undefined && depsEqual(hook.deps, deps)) return\n hook.deps = 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.state === undefined) {\n const fiber = getCurrentFiber()\n const root = findRootFromFiber(fiber)\n hook.state = (root?.identifierPrefix ?? ':r') + (idCounter++).toString(36)\n }\n return hook.state 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\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?.hydrating)\n const value =\n isHydrating && getServerSnapshot ? getServerSnapshot() : getSnapshot()\n hook.state = value\n\n if (hook.cleanup == null) {\n const forceUpdate = () => {\n let next: T\n try {\n next = getSnapshot()\n } catch {\n scheduleUpdate(fiber)\n return\n }\n if (!Object.is(hook.state, next)) {\n hook.state = next\n scheduleUpdate(fiber)\n }\n }\n const unsubscribe = subscribe(forceUpdate)\n hook.cleanup = unsubscribe\n // Register with fiber so unmountFiber runs it. Without this, the store\n // keeps holding forceUpdate and every store update schedules an already-\n // unmounted fiber \u2014 its rerender walks stale .parent pointers and mounts\n // zombie DOM into the old parent.\n if (typeof unsubscribe === 'function') {\n fiber.cleanups ||= []\n fiber.cleanups.push(unsubscribe)\n }\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 && getServerSnapshot) {\n queueMicrotask(() => queueMicrotask(forceUpdate))\n }\n }\n return value\n },\n\n use<T>(resource: any): T {\n if (resource == null) throw new Error('use() received null or undefined')\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 throw new Error('use() expected a Promise or Context')\n },\n }\n}\n\nfunction basicReducer<S>(state: S, action: S | ((p: S) => 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,0BAA0B;AACzD,SAAS,gBAAgB,eAAe,mBAAmB;AAE3D,SAAS,kBAAyB;AAChC,QAAM,IAAI,qBAAqB;AAC/B,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,kDAAkD;AAC1E,SAAO;AACT;AAEA,SAAS,WAAiB;AACxB,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,MAAM,qBAAqB;AAEjC,MAAI,OAAO,qBAAqB;AAEhC,MAAI,QAAQ,GAAG;AACb,QAAI,MAAM,OAAO;AACf,2BAAqB,cAAc,MAAM;AACzC,aAAO,MAAM;AAAA,IACf;AACA,UAAMA,KAAU,EAAE,OAAO,QAAW,OAAO,QAAW,M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AoB;AAC5C,eAAO,YAAY,gBAAgB,GAAG,QAAQ;AAAA,MAChD;AACA,UAAI,OAAO,SAAS,SAAS,YAAY;AACvC,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,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AAAA,EACF;AACF;AAEA,SAAS,aAAgB,OAAU,QAA8B;AAC/D,SAAO,OAAO,WAAW,aAAc,OAAuB,KAAK,IAAI;AACzE;AAEA,IAAI,YAAY;AAEhB,SAAS,kBAAkB,OAAgC;AACzD,MAAI,IAAkB;AACtB,SAAO,GAAG;AACR,QAAI,EAAE,KAAM,QAAO,EAAE;AACrB,QAAI,EAAE;AAAA,EACR;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["h"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function createHostNode(type: string, isSvg: boolean): Element;
|
|
2
|
+
export declare function isSvgElement(el: Element): boolean;
|
|
3
|
+
export declare function setProp(el: Element, name: string, next: any, prev: any, isSvg: boolean): void;
|
|
4
|
+
export interface SyntheticEvent extends Event {
|
|
5
|
+
nativeEvent: Event;
|
|
6
|
+
isDefaultPrevented(): boolean;
|
|
7
|
+
isPropagationStopped(): boolean;
|
|
8
|
+
persist(): void;
|
|
9
|
+
currentTarget: EventTarget & Element;
|
|
10
|
+
}
|