@tanstack/redact 0.0.13 → 0.0.15
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/internal.d.ts +23 -39
- package/dist/core/internal.js +7 -23
- package/dist/core/internal.js.map +3 -3
- package/dist/dom/dispatcher.d.ts +3 -1
- package/dist/dom/dispatcher.js +104 -97
- package/dist/dom/dispatcher.js.map +2 -2
- package/dist/dom/dom.js +1 -1
- package/dist/dom/dom.js.map +2 -2
- package/dist/dom/event-replay.js +7 -29
- package/dist/dom/event-replay.js.map +2 -2
- package/dist/dom/features/class/full.js +16 -16
- package/dist/dom/features/class/full.js.map +2 -2
- package/dist/dom/features/class/stub.js +7 -7
- package/dist/dom/features/class/stub.js.map +2 -2
- package/dist/dom/features/context/full.js +7 -7
- package/dist/dom/features/context/full.js.map +2 -2
- package/dist/dom/features/context/stub.js +3 -3
- package/dist/dom/features/context/stub.js.map +2 -2
- package/dist/dom/features/forward-ref/full.js +11 -11
- package/dist/dom/features/forward-ref/full.js.map +2 -2
- package/dist/dom/features/hydration/full.d.ts +26 -14
- package/dist/dom/features/hydration/full.js +412 -92
- package/dist/dom/features/hydration/full.js.map +2 -2
- package/dist/dom/features/hydration/stub.d.ts +13 -12
- package/dist/dom/features/hydration/stub.js +23 -8
- package/dist/dom/features/hydration/stub.js.map +2 -2
- package/dist/dom/features/lazy/full.js +3 -43
- package/dist/dom/features/lazy/full.js.map +2 -2
- package/dist/dom/features/lazy/stub.js +1 -1
- package/dist/dom/features/lazy/stub.js.map +2 -2
- package/dist/dom/features/memo/full.js +3 -3
- package/dist/dom/features/memo/full.js.map +2 -2
- package/dist/dom/features/memo/stub.js +1 -1
- package/dist/dom/features/memo/stub.js.map +2 -2
- package/dist/dom/features/portal/full.js +2 -2
- package/dist/dom/features/portal/full.js.map +2 -2
- package/dist/dom/features/suspense/full.js +151 -109
- package/dist/dom/features/suspense/full.js.map +2 -2
- package/dist/dom/reconcile.d.ts +3 -1
- package/dist/dom/reconcile.js +141 -129
- package/dist/dom/reconcile.js.map +2 -2
- package/dist/dom/root-internal.d.ts +9 -0
- package/dist/dom/root-internal.js +31 -0
- package/dist/dom/root-internal.js.map +7 -0
- package/dist/dom/root.d.ts +1 -1
- package/dist/dom/root.js +4 -136
- package/dist/dom/root.js.map +2 -2
- package/dist/dom/test-utils.js +1 -1
- package/dist/dom/test-utils.js.map +2 -2
- package/dist/react/children.js +4 -1
- package/dist/react/children.js.map +2 -2
- package/dist/react/class.js +8 -2
- package/dist/react/class.js.map +2 -2
- package/dist/react/context.js +4 -1
- package/dist/react/context.js.map +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +2 -2
- package/dist/react/shared-internals.d.ts +4 -7
- package/dist/react/shared-internals.js +4 -7
- package/dist/react/shared-internals.js.map +2 -2
- package/dist/server/stream.d.ts +5 -1
- package/dist/server/stream.js.map +2 -2
- package/dist/vite/index.js +19 -3
- package/dist/vite/index.js.map +2 -2
- package/package.json +1 -1
- package/src/core/internal.ts +30 -50
- package/src/dom/dispatcher.ts +114 -105
- package/src/dom/dom.ts +1 -1
- package/src/dom/event-replay.ts +14 -30
- package/src/dom/features/class/full.ts +16 -16
- package/src/dom/features/class/stub.ts +7 -7
- package/src/dom/features/context/full.ts +7 -7
- package/src/dom/features/context/stub.ts +3 -3
- package/src/dom/features/forward-ref/full.ts +11 -11
- package/src/dom/features/hydration/full.ts +516 -104
- package/src/dom/features/hydration/stub.ts +28 -14
- package/src/dom/features/lazy/full.ts +3 -56
- package/src/dom/features/lazy/stub.ts +1 -1
- package/src/dom/features/memo/full.ts +3 -3
- package/src/dom/features/memo/stub.ts +1 -1
- package/src/dom/features/portal/full.ts +2 -2
- package/src/dom/features/suspense/full.ts +176 -129
- package/src/dom/reconcile.ts +164 -170
- package/src/dom/root-internal.ts +40 -0
- package/src/dom/root.ts +5 -165
- package/src/dom/test-utils.ts +1 -1
- package/src/react/children.ts +4 -1
- package/src/react/class.ts +8 -2
- package/src/react/context.ts +4 -1
- package/src/react/index.ts +1 -1
- package/src/react/shared-internals.ts +8 -14
- package/src/server/stream.ts +9 -4
- package/src/vite/index.ts +34 -3
|
@@ -23,24 +23,24 @@ import {
|
|
|
23
23
|
// still work, and save ~400 B min / ~200 B gz.
|
|
24
24
|
function renderClassStub(fiber: Fiber, domParent: Node, anchor: Node | null): void {
|
|
25
25
|
const Ctor = fiber.type as any
|
|
26
|
-
let instance = fiber.
|
|
27
|
-
const props = fiber.
|
|
26
|
+
let instance = fiber.sn
|
|
27
|
+
const props = fiber.pp ?? {}
|
|
28
28
|
|
|
29
29
|
if (!instance) {
|
|
30
30
|
instance = new Ctor(props, undefined)
|
|
31
31
|
instance.props = props
|
|
32
32
|
instance._fiber = fiber
|
|
33
33
|
instance._enqueueUpdate = (updater: any, cb?: () => void) => {
|
|
34
|
-
const next = typeof updater
|
|
34
|
+
const next = typeof updater == 'function' ? updater(instance.state, instance.props) : updater
|
|
35
35
|
if (next != null) instance.state = { ...instance.state, ...next }
|
|
36
36
|
if (cb) {
|
|
37
|
-
fiber.
|
|
38
|
-
fiber.
|
|
37
|
+
fiber.cu ||= []
|
|
38
|
+
fiber.cu.push(cb)
|
|
39
39
|
}
|
|
40
40
|
scheduleUpdate(fiber)
|
|
41
41
|
}
|
|
42
42
|
instance._forceUpdate = instance._enqueueUpdate
|
|
43
|
-
fiber.
|
|
43
|
+
fiber.sn = instance
|
|
44
44
|
} else {
|
|
45
45
|
instance.props = props
|
|
46
46
|
}
|
|
@@ -59,7 +59,7 @@ function renderClassStub(fiber: Fiber, domParent: Node, anchor: Node | null): vo
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
reconcileChildren(fiber, childrenToArray(rendered), domParent, anchor)
|
|
62
|
-
fiber.
|
|
62
|
+
fiber.mp = props
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
registerRenderer(FiberTag.Class, renderClassStub)
|
|
@@ -12,7 +12,7 @@ function realReadContext(fiber: Fiber, ctx: any): any {
|
|
|
12
12
|
let p: Fiber | null = fiber.parent
|
|
13
13
|
while (p) {
|
|
14
14
|
if (p.tag === FiberTag.Provider && (p.type as any)._context === ctx) {
|
|
15
|
-
return (p.
|
|
15
|
+
return (p.pp ?? p.mp)?.value
|
|
16
16
|
}
|
|
17
17
|
p = p.parent
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ function realReadContext(fiber: Fiber, ctx: any): any {
|
|
|
21
21
|
|
|
22
22
|
function renderProvider(fiber: Fiber, domParent: Node, anchor: Node | null): void {
|
|
23
23
|
const ctx = (fiber.type as any)._context
|
|
24
|
-
const props = fiber.
|
|
24
|
+
const props = fiber.pp ?? {}
|
|
25
25
|
const prevValue = ctx._currentValue
|
|
26
26
|
ctx._currentValue = props.value
|
|
27
27
|
try {
|
|
@@ -31,18 +31,18 @@ function renderProvider(fiber: Fiber, domParent: Node, anchor: Node | null): voi
|
|
|
31
31
|
}
|
|
32
32
|
// Also store the value on the fiber so descendants rendering later (via updates)
|
|
33
33
|
// can read through by walking up.
|
|
34
|
-
fiber.
|
|
35
|
-
fiber.
|
|
34
|
+
fiber.ms = props.value
|
|
35
|
+
fiber.mp = props
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function renderConsumer(fiber: Fiber, domParent: Node, anchor: Node | null): void {
|
|
39
39
|
const ctx = (fiber.type as any)._context
|
|
40
|
-
const props = fiber.
|
|
40
|
+
const props = fiber.pp ?? {}
|
|
41
41
|
const children = props.children
|
|
42
42
|
const value = realReadContext(fiber, ctx)
|
|
43
|
-
const rendered = typeof children
|
|
43
|
+
const rendered = typeof children == 'function' ? children(value) : null
|
|
44
44
|
reconcileChildren(fiber, childrenToArray(rendered), domParent, anchor)
|
|
45
|
-
fiber.
|
|
45
|
+
fiber.mp = props
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
registerTypeMatcher((_type, marker) =>
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
// walking, which matches the no-Provider-fibers-in-tree reality.
|
|
16
16
|
function renderConsumerStub(fiber: Fiber, domParent: Node, anchor: Node | null): void {
|
|
17
17
|
const ctx = (fiber.type as any)._context
|
|
18
|
-
const props = fiber.
|
|
18
|
+
const props = fiber.pp ?? {}
|
|
19
19
|
const value = ctx._currentValue
|
|
20
|
-
const rendered = typeof props.children
|
|
20
|
+
const rendered = typeof props.children == 'function' ? props.children(value) : null
|
|
21
21
|
reconcileChildren(fiber, childrenToArray(rendered), domParent, anchor)
|
|
22
|
-
fiber.
|
|
22
|
+
fiber.mp = props
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
registerTypeMatcher((_type, marker) =>
|
|
@@ -12,18 +12,18 @@ import {
|
|
|
12
12
|
import { makeDispatcher } from '../../dispatcher'
|
|
13
13
|
|
|
14
14
|
function renderForwardRef(fiber: Fiber, domParent: Node, anchor: Node | null): void {
|
|
15
|
-
const props = fiber.
|
|
15
|
+
const props = fiber.pp ?? {}
|
|
16
16
|
const render = (fiber.type as any).render
|
|
17
17
|
const ref = fiber.ref ?? (props.ref ?? null)
|
|
18
18
|
|
|
19
19
|
const prevDispatcher = ReactSharedInternals.H
|
|
20
|
-
const prevFiber = ReactSharedInternals.
|
|
21
|
-
const prevHook = ReactSharedInternals.
|
|
22
|
-
const prevIndex = ReactSharedInternals.
|
|
20
|
+
const prevFiber = ReactSharedInternals.F
|
|
21
|
+
const prevHook = ReactSharedInternals.K
|
|
22
|
+
const prevIndex = ReactSharedInternals.I
|
|
23
23
|
ReactSharedInternals.H = makeDispatcher()
|
|
24
|
-
ReactSharedInternals.
|
|
25
|
-
ReactSharedInternals.
|
|
26
|
-
ReactSharedInternals.
|
|
24
|
+
ReactSharedInternals.F = fiber
|
|
25
|
+
ReactSharedInternals.K = null
|
|
26
|
+
ReactSharedInternals.I = 0
|
|
27
27
|
|
|
28
28
|
let rendered: ReactNode
|
|
29
29
|
try {
|
|
@@ -39,13 +39,13 @@ function renderForwardRef(fiber: Fiber, domParent: Node, anchor: Node | null): v
|
|
|
39
39
|
}
|
|
40
40
|
} finally {
|
|
41
41
|
ReactSharedInternals.H = prevDispatcher
|
|
42
|
-
ReactSharedInternals.
|
|
43
|
-
ReactSharedInternals.
|
|
44
|
-
ReactSharedInternals.
|
|
42
|
+
ReactSharedInternals.F = prevFiber
|
|
43
|
+
ReactSharedInternals.K = prevHook
|
|
44
|
+
ReactSharedInternals.I = prevIndex
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
reconcileChildren(fiber, childrenToArray(rendered), domParent, anchor)
|
|
48
|
-
fiber.
|
|
48
|
+
fiber.mp = props
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
registerTypeMatcher((_type, marker) =>
|