@faiwer/react 0.8.4 → 19.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/README.md +43 -21
- package/dist/core/actions/applyAction.d.ts.map +1 -1
- package/dist/core/actions/applyAction.js +6 -0
- package/dist/core/actions/applyAction.js.map +1 -1
- package/dist/core/actions/catchError.action.d.ts +10 -0
- package/dist/core/actions/catchError.action.d.ts.map +1 -0
- package/dist/core/actions/catchError.action.js +51 -0
- package/dist/core/actions/catchError.action.js.map +1 -0
- package/dist/core/actions/createComment.action.d.ts +2 -2
- package/dist/core/actions/createComment.action.d.ts.map +1 -1
- package/dist/core/actions/createComment.action.js +1 -8
- package/dist/core/actions/createComment.action.js.map +1 -1
- package/dist/core/actions/createContainer.action.d.ts +7 -0
- package/dist/core/actions/createContainer.action.d.ts.map +1 -0
- package/dist/core/actions/createContainer.action.js +28 -0
- package/dist/core/actions/createContainer.action.js.map +1 -0
- package/dist/core/actions/createTag.action.d.ts +2 -1
- package/dist/core/actions/createTag.action.d.ts.map +1 -1
- package/dist/core/actions/createTag.action.js +22 -4
- package/dist/core/actions/createTag.action.js.map +1 -1
- package/dist/core/actions/createText.action.d.ts.map +1 -1
- package/dist/core/actions/createText.action.js +2 -5
- package/dist/core/actions/createText.action.js.map +1 -1
- package/dist/core/actions/dom/attributes.d.ts.map +1 -1
- package/dist/core/actions/dom/attributes.js +4 -1
- package/dist/core/actions/dom/attributes.js.map +1 -1
- package/dist/core/actions/dom/css.d.ts.map +1 -1
- package/dist/core/actions/dom/css.js +2 -1
- package/dist/core/actions/dom/css.js.map +1 -1
- package/dist/core/actions/dom/events.d.ts.map +1 -1
- package/dist/core/actions/dom/events.js +15 -3
- package/dist/core/actions/dom/events.js.map +1 -1
- package/dist/core/actions/dom/value.d.ts +18 -0
- package/dist/core/actions/dom/value.d.ts.map +1 -0
- package/dist/core/actions/dom/value.js +211 -0
- package/dist/core/actions/dom/value.js.map +1 -0
- package/dist/core/actions/helpers.d.ts +17 -10
- package/dist/core/actions/helpers.d.ts.map +1 -1
- package/dist/core/actions/helpers.js +64 -70
- package/dist/core/actions/helpers.js.map +1 -1
- package/dist/core/actions/relayout.action.d.ts +2 -1
- package/dist/core/actions/relayout.action.d.ts.map +1 -1
- package/dist/core/actions/relayout.action.js +119 -30
- package/dist/core/actions/relayout.action.js.map +1 -1
- package/dist/core/actions/remove.action.d.ts +2 -2
- package/dist/core/actions/remove.action.d.ts.map +1 -1
- package/dist/core/actions/remove.action.js +20 -17
- package/dist/core/actions/remove.action.js.map +1 -1
- package/dist/core/actions/replace.action.d.ts +1 -1
- package/dist/core/actions/replace.action.d.ts.map +1 -1
- package/dist/core/actions/replace.action.js +34 -23
- package/dist/core/actions/replace.action.js.map +1 -1
- package/dist/core/actions/scheduleEffect.action.d.ts +7 -0
- package/dist/core/actions/scheduleEffect.action.d.ts.map +1 -0
- package/dist/core/actions/scheduleEffect.action.js +8 -0
- package/dist/core/actions/scheduleEffect.action.js.map +1 -0
- package/dist/core/actions/setAttr.action.d.ts +1 -1
- package/dist/core/actions/setAttr.action.d.ts.map +1 -1
- package/dist/core/actions/setAttr.action.js +47 -6
- package/dist/core/actions/setAttr.action.js.map +1 -1
- package/dist/core/actions/setProps.action.d.ts.map +1 -1
- package/dist/core/actions/setProps.action.js +2 -1
- package/dist/core/actions/setProps.action.js.map +1 -1
- package/dist/core/actions/setRef.action.d.ts +1 -1
- package/dist/core/actions/setRef.action.d.ts.map +1 -1
- package/dist/core/actions/setRef.action.js +5 -6
- package/dist/core/actions/setRef.action.js.map +1 -1
- package/dist/core/actions/setText.action.d.ts.map +1 -1
- package/dist/core/actions/setText.action.js +3 -3
- package/dist/core/actions/setText.action.js.map +1 -1
- package/dist/core/classComponent.d.ts +2 -1
- package/dist/core/classComponent.d.ts.map +1 -1
- package/dist/core/classComponent.js +20 -12
- package/dist/core/classComponent.js.map +1 -1
- package/dist/core/compact.d.ts +10 -29
- package/dist/core/compact.d.ts.map +1 -1
- package/dist/core/compact.js +12 -100
- package/dist/core/compact.js.map +1 -1
- package/dist/core/components.d.ts +6 -4
- package/dist/core/components.d.ts.map +1 -1
- package/dist/core/components.js +26 -8
- package/dist/core/components.js.map +1 -1
- package/dist/core/createElement.d.ts +2 -8
- package/dist/core/createElement.d.ts.map +1 -1
- package/dist/core/createElement.js +3 -1
- package/dist/core/createElement.js.map +1 -1
- package/dist/core/reactNodeToFiberNode.d.ts +3 -1
- package/dist/core/reactNodeToFiberNode.d.ts.map +1 -1
- package/dist/core/reactNodeToFiberNode.js +80 -17
- package/dist/core/reactNodeToFiberNode.js.map +1 -1
- package/dist/core/reconciliation/app.js +3 -3
- package/dist/core/reconciliation/app.js.map +1 -1
- package/dist/core/reconciliation/collect/fromApp.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromApp.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromApp.js +7 -26
- package/dist/core/reconciliation/collect/fromApp.js.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromChildrenPair.js +37 -10
- package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.d.ts +3 -2
- package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromComponent.js +27 -9
- package/dist/core/reconciliation/collect/fromComponent.js.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts +2 -1
- package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromFiberPair.js +8 -5
- package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -1
- package/dist/core/reconciliation/collect/fromNewFiber.d.ts.map +1 -1
- package/dist/core/reconciliation/collect/fromNewFiber.js +7 -15
- package/dist/core/reconciliation/collect/fromNewFiber.js.map +1 -1
- package/dist/core/reconciliation/effects.d.ts +2 -2
- package/dist/core/reconciliation/effects.d.ts.map +1 -1
- package/dist/core/reconciliation/effects.js +52 -4
- package/dist/core/reconciliation/effects.js.map +1 -1
- package/dist/core/reconciliation/errors/ReactError.d.ts +15 -0
- package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -0
- package/dist/core/reconciliation/errors/ReactError.js +56 -0
- package/dist/core/reconciliation/errors/ReactError.js.map +1 -0
- package/dist/core/reconciliation/errors/stack.d.ts +8 -2
- package/dist/core/reconciliation/errors/stack.d.ts.map +1 -1
- package/dist/core/reconciliation/errors/stack.js +65 -8
- package/dist/core/reconciliation/errors/stack.js.map +1 -1
- package/dist/core/reconciliation/fibers.d.ts +1 -0
- package/dist/core/reconciliation/fibers.d.ts.map +1 -1
- package/dist/core/reconciliation/fibers.js +3 -2
- package/dist/core/reconciliation/fibers.js.map +1 -1
- package/dist/core/reconciliation/heap.d.ts +18 -0
- package/dist/core/reconciliation/heap.d.ts.map +1 -0
- package/dist/core/reconciliation/heap.js +81 -0
- package/dist/core/reconciliation/heap.js.map +1 -0
- package/dist/core/reconciliation/invalidateFiber.d.ts.map +1 -1
- package/dist/core/reconciliation/invalidateFiber.js +6 -5
- package/dist/core/reconciliation/invalidateFiber.js.map +1 -1
- package/dist/core/reconciliation/mount.d.ts.map +1 -1
- package/dist/core/reconciliation/mount.js +24 -6
- package/dist/core/reconciliation/mount.js.map +1 -1
- package/dist/core/reconciliation/postCommit.d.ts +1 -1
- package/dist/core/reconciliation/postCommit.d.ts.map +1 -1
- package/dist/core/reconciliation/postCommit.js +17 -4
- package/dist/core/reconciliation/postCommit.js.map +1 -1
- package/dist/core/reconciliation/queue.d.ts +21 -0
- package/dist/core/reconciliation/queue.d.ts.map +1 -0
- package/dist/core/reconciliation/queue.js +55 -0
- package/dist/core/reconciliation/queue.js.map +1 -0
- package/dist/core/reconciliation/render.d.ts.map +1 -1
- package/dist/core/reconciliation/render.js +9 -3
- package/dist/core/reconciliation/render.js.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts +3 -1
- package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -1
- package/dist/core/reconciliation/runFiberComponents.js +33 -5
- package/dist/core/reconciliation/runFiberComponents.js.map +1 -1
- package/dist/core/reconciliation/typeGuards.d.ts +3 -0
- package/dist/core/reconciliation/typeGuards.d.ts.map +1 -1
- package/dist/core/reconciliation/typeGuards.js +13 -0
- package/dist/core/reconciliation/typeGuards.js.map +1 -1
- package/dist/core/reconciliation/validateApp.d.ts +1 -1
- package/dist/core/reconciliation/validateApp.d.ts.map +1 -1
- package/dist/core/reconciliation/validateApp.js +28 -21
- package/dist/core/reconciliation/validateApp.js.map +1 -1
- package/dist/hooks/helpers.d.ts +3 -3
- package/dist/hooks/helpers.d.ts.map +1 -1
- package/dist/hooks/helpers.js +3 -2
- package/dist/hooks/helpers.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useContext.d.ts.map +1 -1
- package/dist/hooks/useContext.js +6 -6
- package/dist/hooks/useContext.js.map +1 -1
- package/dist/hooks/useEffect.d.ts +2 -1
- package/dist/hooks/useEffect.d.ts.map +1 -1
- package/dist/hooks/useEffect.js +21 -7
- package/dist/hooks/useEffect.js.map +1 -1
- package/dist/hooks/useError.d.ts +5 -0
- package/dist/hooks/useError.d.ts.map +1 -0
- package/dist/hooks/useError.js +19 -0
- package/dist/hooks/useError.js.map +1 -0
- package/dist/hooks/useReducer.d.ts +7 -0
- package/dist/hooks/useReducer.d.ts.map +1 -0
- package/dist/hooks/useReducer.js +10 -0
- package/dist/hooks/useReducer.js.map +1 -0
- package/dist/hooks/useRef.d.ts +8 -3
- package/dist/hooks/useRef.d.ts.map +1 -1
- package/dist/hooks/useRef.js +27 -0
- package/dist/hooks/useRef.js.map +1 -1
- package/dist/hooks/useState.d.ts +1 -1
- package/dist/hooks/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +3 -6
- package/dist/hooks/useState.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +159 -44
- package/dist/mocks.d.ts +0 -7
- package/dist/mocks.d.ts.map +1 -1
- package/dist/mocks.js +0 -6
- package/dist/mocks.js.map +1 -1
- package/dist/react.d.ts +46 -0
- package/dist/types/actions.d.ts +23 -5
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/app.d.ts +17 -3
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/attributes.d.ts +42 -0
- package/dist/types/attributes.d.ts.map +1 -0
- package/dist/types/attributes.js +2 -0
- package/dist/types/attributes.js.map +1 -0
- package/dist/types/common.d.ts +10 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/component.d.ts +11 -2
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/context.d.ts +3 -2
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/core.d.ts +17 -13
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/dom.d.ts +23 -22
- package/dist/types/dom.d.ts.map +1 -1
- package/dist/types/events.d.ts +18 -11
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/fiber.d.ts +30 -12
- package/dist/types/fiber.d.ts.map +1 -1
- package/dist/types/fiber.js +5 -1
- package/dist/types/fiber.js.map +1 -1
- package/dist/types/hooks.d.ts +16 -6
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/react.d.ts +31 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/react.js +2 -0
- package/dist/types/react.js.map +1 -0
- package/dist/types/refs.d.ts +5 -8
- package/dist/types/refs.d.ts.map +1 -1
- package/package.json +11 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { runComponent } from './components';
|
|
2
2
|
import { createFiberNode, FRAGMENT_TAG, toFiberChildren, } from './reconciliation/fibers';
|
|
3
3
|
import { isContextProvider } from './reconciliation/typeGuards';
|
|
4
|
+
import { ReactError } from './reconciliation/errors/ReactError';
|
|
5
|
+
import { isErrorBoundary } from '../hooks/useError';
|
|
4
6
|
/**
|
|
5
7
|
* Converts any possible JSX.Element to a FiberNode, that is used by the engine
|
|
6
8
|
* everywhere. We don't use JSX.Elements outside of this function.
|
|
@@ -19,6 +21,7 @@ unwrapComponents) => {
|
|
|
19
21
|
props: {},
|
|
20
22
|
key: null,
|
|
21
23
|
children: jsxElement,
|
|
24
|
+
source: null,
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
// Any null-like value, i.e. it doesn't render a tag or a text node.
|
|
@@ -29,7 +32,7 @@ unwrapComponents) => {
|
|
|
29
32
|
parent,
|
|
30
33
|
props: null,
|
|
31
34
|
};
|
|
32
|
-
return nullFiber;
|
|
35
|
+
return [nullFiber, NO_ACTIONS];
|
|
33
36
|
}
|
|
34
37
|
// A text node (string, number or boolean).
|
|
35
38
|
if (typeof jsxElement !== 'object') {
|
|
@@ -39,7 +42,7 @@ unwrapComponents) => {
|
|
|
39
42
|
parent,
|
|
40
43
|
props: { text: String(jsxElement) },
|
|
41
44
|
};
|
|
42
|
-
return textFiber;
|
|
45
|
+
return [textFiber, NO_ACTIONS];
|
|
43
46
|
}
|
|
44
47
|
const { key = null } = jsxElement;
|
|
45
48
|
const { ref = null, ...props } = jsxElement.props;
|
|
@@ -53,8 +56,13 @@ unwrapComponents) => {
|
|
|
53
56
|
role: 'portal',
|
|
54
57
|
data: jsxElement.type,
|
|
55
58
|
};
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const childrenX = childrenToNodes(portalFiber, jsxElement.children, unwrapComponents);
|
|
60
|
+
// Portals cannot be error boundaries. Pass through.
|
|
61
|
+
if (childrenX instanceof ReactError)
|
|
62
|
+
return childrenX;
|
|
63
|
+
const [children, childrenActions] = childrenX;
|
|
64
|
+
portalFiber.children = children;
|
|
65
|
+
return [portalFiber, childrenActions];
|
|
58
66
|
}
|
|
59
67
|
// <ctx.Provider value=?/>
|
|
60
68
|
if (isContextProvider(jsxElement.type)) {
|
|
@@ -66,9 +74,15 @@ unwrapComponents) => {
|
|
|
66
74
|
role: 'context',
|
|
67
75
|
props,
|
|
68
76
|
data: { ctx: jsxElement.type.__ctx, consumers: new Set() },
|
|
77
|
+
source: jsxElement.source,
|
|
69
78
|
};
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
const childrenX = childrenToNodes(contextFiber, jsxElement.children, unwrapComponents);
|
|
80
|
+
// Context providers cannot be error boundaries. Pass through.
|
|
81
|
+
if (childrenX instanceof ReactError)
|
|
82
|
+
return childrenX;
|
|
83
|
+
const [children, childrenActions] = childrenX;
|
|
84
|
+
contextFiber.children = children;
|
|
85
|
+
return [contextFiber, childrenActions];
|
|
72
86
|
}
|
|
73
87
|
// [], </> or <Fragment/>.
|
|
74
88
|
if (jsxElement.type === FRAGMENT_TAG) {
|
|
@@ -76,26 +90,56 @@ unwrapComponents) => {
|
|
|
76
90
|
...createFiberNode(parent),
|
|
77
91
|
type: 'fragment',
|
|
78
92
|
key,
|
|
93
|
+
source: jsxElement.source,
|
|
79
94
|
};
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
const childrenX = childrenToNodes(fragmentFiber, jsxElement.children, unwrapComponents);
|
|
96
|
+
// Fragments cannot be error boundaries. Pass through.
|
|
97
|
+
if (childrenX instanceof ReactError)
|
|
98
|
+
return childrenX;
|
|
99
|
+
const [children, childrenActions] = childrenX;
|
|
100
|
+
fragmentFiber.children = children;
|
|
101
|
+
return [fragmentFiber, childrenActions];
|
|
82
102
|
}
|
|
83
103
|
// A component node (<Message/>):
|
|
84
104
|
if (typeof jsxElement.type === 'function') {
|
|
105
|
+
const actions = [];
|
|
85
106
|
const fiber = {
|
|
86
107
|
...createFiberNode(parent),
|
|
87
108
|
type: 'component',
|
|
88
109
|
component: jsxElement.type,
|
|
89
110
|
key,
|
|
90
|
-
props,
|
|
91
|
-
data: { hooks: null },
|
|
111
|
+
props: jsxElement.props,
|
|
112
|
+
data: { hooks: null, actions: [], isErrorBoundary: false },
|
|
113
|
+
source: jsxElement.source,
|
|
92
114
|
};
|
|
93
115
|
if (unwrapComponents) {
|
|
94
|
-
const
|
|
95
|
-
|
|
116
|
+
const compX = runComponent(fiber, null);
|
|
117
|
+
// Component can't be its own error boundary, thus pass it through.
|
|
118
|
+
if (compX instanceof ReactError)
|
|
119
|
+
return compX;
|
|
120
|
+
const [content, compActions] = compX;
|
|
121
|
+
let childrenX = jsxElementToFiberNode(content, fiber, unwrapComponents);
|
|
122
|
+
if (childrenX instanceof ReactError) {
|
|
123
|
+
if (isErrorBoundary(fiber)) {
|
|
124
|
+
// Since it's a brand new fiber we don't have any DOM nodes yet. But
|
|
125
|
+
// it must have one. Create a new null nodes to make it an anchor for
|
|
126
|
+
// the error boundary.
|
|
127
|
+
const nullFiber = {
|
|
128
|
+
...createFiberNode(fiber),
|
|
129
|
+
type: 'null',
|
|
130
|
+
parent: fiber,
|
|
131
|
+
props: null,
|
|
132
|
+
};
|
|
133
|
+
childrenX = [nullFiber, [childrenX.genCatchAction()]];
|
|
134
|
+
}
|
|
135
|
+
else
|
|
136
|
+
return childrenX;
|
|
137
|
+
}
|
|
138
|
+
const [child, childrenActions] = childrenX;
|
|
96
139
|
fiber.children = toFiberChildren(child);
|
|
140
|
+
actions.push(...compActions, ...childrenActions);
|
|
97
141
|
}
|
|
98
|
-
return fiber;
|
|
142
|
+
return [fiber, actions];
|
|
99
143
|
}
|
|
100
144
|
if (typeof jsxElement.type === 'string') {
|
|
101
145
|
validateRef(ref);
|
|
@@ -107,14 +151,32 @@ unwrapComponents) => {
|
|
|
107
151
|
tag: jsxElement.type,
|
|
108
152
|
ref,
|
|
109
153
|
data: { events: {}, styles: null },
|
|
154
|
+
source: jsxElement.source,
|
|
110
155
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
156
|
+
const childrenX = childrenToNodes(tagFiber, jsxElement.children, unwrapComponents);
|
|
157
|
+
// Tags cannot be error boundaries. Pass through.
|
|
158
|
+
if (childrenX instanceof ReactError)
|
|
159
|
+
return childrenX;
|
|
160
|
+
const [children, childrenActions] = childrenX;
|
|
161
|
+
tagFiber.children = children;
|
|
162
|
+
return [tagFiber, childrenActions];
|
|
115
163
|
}
|
|
116
164
|
throw new Error(`Unknown format of JSX.Element (${jsxElement.type})`);
|
|
117
165
|
};
|
|
166
|
+
const childrenToNodes = (fiber, elements, unwrapComponents) => {
|
|
167
|
+
const children = [];
|
|
168
|
+
const actions = [];
|
|
169
|
+
for (const childEl of elements) {
|
|
170
|
+
const childX = jsxElementToFiberNode(childEl, fiber, unwrapComponents);
|
|
171
|
+
// `fiber` can't be a component here, thus it can't be an error boundary.
|
|
172
|
+
if (childX instanceof ReactError)
|
|
173
|
+
return childX;
|
|
174
|
+
const [node, childrenActions] = childX;
|
|
175
|
+
children.push(node);
|
|
176
|
+
actions.push(...childrenActions);
|
|
177
|
+
}
|
|
178
|
+
return [children, actions];
|
|
179
|
+
};
|
|
118
180
|
function validateContextProviderProps(props) {
|
|
119
181
|
if (!('value' in props)) {
|
|
120
182
|
throw new Error(`Context provider value is not provided`);
|
|
@@ -129,4 +191,5 @@ function validateRef(src) {
|
|
|
129
191
|
}
|
|
130
192
|
throw new Error(`Unsupported format of a ref or a ref handler`);
|
|
131
193
|
}
|
|
194
|
+
const NO_ACTIONS = [];
|
|
132
195
|
//# sourceMappingURL=reactNodeToFiberNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNodeToFiberNode.js","sourceRoot":"","sources":["../../src/core/reactNodeToFiberNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactNodeToFiberNode.js","sourceRoot":"","sources":["../../src/core/reactNodeToFiberNode.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,eAAe,EACf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K,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;AAAA,CACF;AAED,SAAS,WAAW,CAClB,GAAY,EACqD;IACjE,IACE,GAAG,KAAK,IAAI;QACZ,0DAA0D;QAC1D,OAAO,GAAG,KAAK,UAAU;QACzB,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,SAAS,IAAI,GAAG,CAAC,EACtD,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAAA,CACjE;AAED,MAAM,UAAU,GAAa,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nullthrowsForFiber } from './errors/ReactError';
|
|
2
2
|
const apps = [];
|
|
3
3
|
export const getAppByFiber = (fiber) => {
|
|
4
|
-
return
|
|
4
|
+
return nullthrowsForFiber(fiber, apps[fiber.appId]);
|
|
5
5
|
};
|
|
6
6
|
export const registerApp = (fn) => {
|
|
7
7
|
apps.push(fn(apps.length));
|
|
@@ -14,7 +14,7 @@ export const removeApp = (id) => {
|
|
|
14
14
|
// Help with garbage collection.
|
|
15
15
|
app.root = app.tempContext = null;
|
|
16
16
|
app.effects = { normal: [] };
|
|
17
|
-
app.invalidatedComponents = {
|
|
17
|
+
app.invalidatedComponents = { isEmpty: () => true };
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/core/reconciliation/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/core/reconciliation/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,IAAI,GAAsB,EAAE,CAAC;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAgB,EAAO,EAAE,CAAC;IACtD,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAuB,EAAO,EAAE,CAAC;IAC3D,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;AAAA,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAU,EAAQ,EAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAA4B,CAAC;IAChD,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QAChB,gCAAgC;QAChC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QAClC,GAAG,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAC7B,GAAG,CAAC,qBAAqB,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { App } from '../../../types';
|
|
2
2
|
import type { Action } from '../../../types/actions';
|
|
3
|
+
import { ReactError } from '../errors/ReactError';
|
|
3
4
|
/**
|
|
4
5
|
* Goes through the list of invalidated components, runs them, finds the diff,
|
|
5
6
|
* and returns the list of actions to convert the previous fiber tree to the new
|
|
6
7
|
* one.
|
|
7
8
|
*/
|
|
8
|
-
export declare const collectActionsFromApp: (app: App) => Action[];
|
|
9
|
+
export declare const collectActionsFromApp: (app: App) => Action[] | ReactError;
|
|
9
10
|
//# sourceMappingURL=fromApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromApp.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fromApp.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,qCAajC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectActionsFromComponent } from './fromComponent';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactError } from '../errors/ReactError';
|
|
3
3
|
/**
|
|
4
4
|
* Goes through the list of invalidated components, runs them, finds the diff,
|
|
5
5
|
* and returns the list of actions to convert the previous fiber tree to the new
|
|
@@ -7,32 +7,13 @@ import { getFiberLevel } from '../fibers';
|
|
|
7
7
|
*/
|
|
8
8
|
export const collectActionsFromApp = (app) => {
|
|
9
9
|
const actions = [];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (const { fiber } of sorted) {
|
|
16
|
-
// Redo the check because some components can be indirectly removed in between.
|
|
17
|
-
if (app.invalidatedComponents.has(fiber)) {
|
|
18
|
-
actions.push(...collectActionsFromComponent(app, fiber, null));
|
|
10
|
+
while (!app.invalidatedComponents.isEmpty()) {
|
|
11
|
+
const [fiber, props] = app.invalidatedComponents.poll();
|
|
12
|
+
const actionsX = collectActionsFromComponent(fiber, props);
|
|
13
|
+
if (actionsX instanceof ReactError) {
|
|
14
|
+
return actionsX.catchActionArrOrPassThru();
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
if (app.invalidatedComponents.size > 0) {
|
|
22
|
-
// The only reason why a component might be kept in `invalidatedComponents`
|
|
23
|
-
// after the first run is that this component was "trapped" inside a
|
|
24
|
-
// non-invalidated component. We don't traverse through the whole fiber
|
|
25
|
-
// tree, so we need to run the rest of the queue again.
|
|
26
|
-
if (app.testMode) {
|
|
27
|
-
// A sanity check
|
|
28
|
-
for (const fiber of app.invalidatedComponents) {
|
|
29
|
-
if (fiber.type !== 'component' ||
|
|
30
|
-
!fiber.data.hooks?.some((h) => h.type === 'context')) {
|
|
31
|
-
throw new Error(`Fiber node is stuck`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
actions.push(...collectActionsFromApp(app));
|
|
16
|
+
actions.push(...actionsX);
|
|
36
17
|
}
|
|
37
18
|
return actions;
|
|
38
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromApp.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fromApp.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAyB,EAAE,CAAC;IACxE,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5C,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QACxD,MAAM,QAAQ,GAAG,2BAA2B,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3D,IAAI,QAAQ,YAAY,UAAU,EAAE,CAAC;YACnC,OAAO,QAAQ,CAAC,wBAAwB,EAAE,CAAC;QAC7C,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC;AAAA,CAChB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { FiberNode } from '../../../types';
|
|
2
2
|
import type { Action } from '../../../types/actions';
|
|
3
|
+
import { ReactError } from '../errors/ReactError';
|
|
3
4
|
/**
|
|
4
5
|
* Returns a list of actions needed to convert `before` to `after`, where
|
|
5
6
|
* `before` is a list of children from the last render, and `after` is the list
|
|
6
7
|
* of children of the same node from the current render.
|
|
7
8
|
*/
|
|
8
|
-
export declare const collectActionsFromChildrenPair: (fiber: FiberNode, after: FiberNode[]) => Action[];
|
|
9
|
+
export declare const collectActionsFromChildrenPair: (fiber: FiberNode, after: FiberNode[]) => Action[] | ReactError;
|
|
9
10
|
//# sourceMappingURL=fromChildrenPair.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromChildrenPair.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromChildrenPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fromChildrenPair.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromChildrenPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAQzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,iEA8E1C,CAAC"}
|
|
@@ -5,6 +5,8 @@ import { collectActionsFromNewFiber } from '../../../core/reconciliation/collect
|
|
|
5
5
|
import { createFiberNode, FAKE_CONTAINER_TAG } from '../fibers';
|
|
6
6
|
import { areFiberNodesEq } from '../compare/areFiberNodesEq';
|
|
7
7
|
import { isContainerFiber } from '../typeGuards';
|
|
8
|
+
import { ReactError } from '../errors/ReactError';
|
|
9
|
+
import { isErrorBoundary } from '../../../hooks/useError';
|
|
8
10
|
/**
|
|
9
11
|
* Returns a list of actions needed to convert `before` to `after`, where
|
|
10
12
|
* `before` is a list of children from the last render, and `after` is the list
|
|
@@ -25,12 +27,20 @@ after) => {
|
|
|
25
27
|
const actions = [];
|
|
26
28
|
// Search for nodes that were in the past render but don't exist in the
|
|
27
29
|
// current render. Then remove them.
|
|
30
|
+
let survived = left.size;
|
|
28
31
|
for (const [key, l] of left.entries()) {
|
|
29
32
|
if (!right.has(key)) {
|
|
33
|
+
--survived;
|
|
30
34
|
// Don't run components from the removing node even if they were invalidated
|
|
31
35
|
uninvalidateFiberSubTree(app, l.fiber);
|
|
32
|
-
actions.push({
|
|
33
|
-
|
|
36
|
+
actions.push({
|
|
37
|
+
type: 'Remove',
|
|
38
|
+
fiber: l.fiber,
|
|
39
|
+
// Set to true if it's the last child of `fiber` and we remove them all.
|
|
40
|
+
// It's needed to convert the fiber to !--empty.
|
|
41
|
+
last: survived === 0,
|
|
42
|
+
});
|
|
43
|
+
relayoutNeeded = true; // to correct the container's .element
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
for (const [key, r] of right.entries()) {
|
|
@@ -39,7 +49,11 @@ after) => {
|
|
|
39
49
|
// 1. There was no node with this key before. Create a new one.
|
|
40
50
|
// 2. There was one, but it was very different. Replace it.
|
|
41
51
|
relayoutNeeded = true;
|
|
42
|
-
|
|
52
|
+
const createActionsX = createFiberActions(app, r.fiber, fiber);
|
|
53
|
+
// If `fiber` is a component than `fromComponent` (a caller) will handled it.
|
|
54
|
+
if (createActionsX instanceof ReactError)
|
|
55
|
+
return createActionsX;
|
|
56
|
+
actions.push(...createActionsX);
|
|
43
57
|
if (l) {
|
|
44
58
|
// Don't run components from the removing node even if they were invalidated
|
|
45
59
|
uninvalidateFiberSubTree(app, l.fiber);
|
|
@@ -48,9 +62,13 @@ after) => {
|
|
|
48
62
|
continue;
|
|
49
63
|
}
|
|
50
64
|
else {
|
|
65
|
+
const diffActionsX = collectActionsFromFiberPair(app, l.fiber, r.fiber);
|
|
66
|
+
// If `fiber` is a component than `fromComponent` (a caller) will handle it.
|
|
67
|
+
if (diffActionsX instanceof ReactError)
|
|
68
|
+
return diffActionsX;
|
|
51
69
|
// No need to recreate the existing node, but we might need to update it
|
|
52
70
|
// or one of its children.
|
|
53
|
-
actions.push(...
|
|
71
|
+
actions.push(...diffActionsX);
|
|
54
72
|
}
|
|
55
73
|
// Handle the case when the node changed its position. It's possible for
|
|
56
74
|
// nodes with manual keys.
|
|
@@ -60,7 +78,7 @@ after) => {
|
|
|
60
78
|
// It'll:
|
|
61
79
|
// - update node positions when needed
|
|
62
80
|
// - move new nodes from a temporary container to the existing l-container
|
|
63
|
-
// -
|
|
81
|
+
// - updates component's .element accordingly
|
|
64
82
|
actions.push({ type: 'Relayout', fiber, before: left, after: right });
|
|
65
83
|
}
|
|
66
84
|
return actions;
|
|
@@ -89,12 +107,24 @@ const createFiberActions = (app, fiber, parent) => {
|
|
|
89
107
|
// The Relayout action will move them into the real node and then reassign the
|
|
90
108
|
// parent.
|
|
91
109
|
fiber.parent = fakeParent;
|
|
110
|
+
const actions = [];
|
|
92
111
|
if (isContainerFiber(fiber)) {
|
|
112
|
+
const compActionsX = runFiberComponents(app, fiber);
|
|
113
|
+
if (compActionsX instanceof ReactError) {
|
|
114
|
+
if (isErrorBoundary(fiber)) {
|
|
115
|
+
// It should never happen, because this case is specially treated in
|
|
116
|
+
// `runFiberComponents`. So get here a ['CatchError'] action list.
|
|
117
|
+
throw new ReactError(fiber, `Unknown react error`);
|
|
118
|
+
}
|
|
119
|
+
else
|
|
120
|
+
return compActionsX;
|
|
121
|
+
}
|
|
93
122
|
// Since all inner components are also new we need to run them.
|
|
94
|
-
|
|
123
|
+
actions.push(...compActionsX);
|
|
95
124
|
}
|
|
96
125
|
// Reuse the same tooling we use for mounting the app.
|
|
97
|
-
|
|
126
|
+
actions.push(...collectActionsFromNewFiber(fiber));
|
|
127
|
+
return actions;
|
|
98
128
|
};
|
|
99
129
|
/**
|
|
100
130
|
* Create an <x-container/> DOM node that is not mounted to the real DOM tree.
|
|
@@ -102,9 +132,6 @@ const createFiberActions = (app, fiber, parent) => {
|
|
|
102
132
|
* them into their real parent.
|
|
103
133
|
*/
|
|
104
134
|
const createFakeFiberContainer = (parentFiber) => {
|
|
105
|
-
if (!parentFiber.element) {
|
|
106
|
-
throw 1;
|
|
107
|
-
}
|
|
108
135
|
return {
|
|
109
136
|
...createFiberNode(parentFiber),
|
|
110
137
|
type: 'tag',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromChildrenPair.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromChildrenPair.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"fromChildrenPair.js","sourceRoot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AAK,EAAE,GAAG,EAAE,KAAK,EAAE;SACb,CAAC;IAAA,CACZ,CAAC,CACH,CAAC;AAAA,CACH,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FiberNode, UnknownProps } from '../../../types';
|
|
2
2
|
import type { Action } from '../../../types/actions';
|
|
3
|
+
import { ReactError } from '../errors/ReactError';
|
|
3
4
|
/**
|
|
4
5
|
* 1. Runs a component
|
|
5
6
|
* 2. Collects and returns a list of actions needed to actualize it
|
|
6
7
|
*
|
|
7
8
|
* Throws when the given component is not invalidated.
|
|
8
9
|
*/
|
|
9
|
-
export declare const collectActionsFromComponent: (
|
|
10
|
+
export declare const collectActionsFromComponent: (fiber: FiberNode, props: UnknownProps | null) => Action[] | ReactError;
|
|
10
11
|
//# sourceMappingURL=fromComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromComponent.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"fromComponent.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAKzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,yEAoCvC,CAAC"}
|
|
@@ -2,21 +2,39 @@ import { runComponent } from '../../components';
|
|
|
2
2
|
import { jsxElementToFiberNode } from '../../reactNodeToFiberNode';
|
|
3
3
|
import { collectActionsFromChildrenPair } from './fromChildrenPair';
|
|
4
4
|
import { toFiberChildren } from '../fibers';
|
|
5
|
+
import { ReactError } from '../errors/ReactError';
|
|
6
|
+
import { isErrorBoundary } from '../../../hooks/useError';
|
|
5
7
|
/**
|
|
6
8
|
* 1. Runs a component
|
|
7
9
|
* 2. Collects and returns a list of actions needed to actualize it
|
|
8
10
|
*
|
|
9
11
|
* Throws when the given component is not invalidated.
|
|
10
12
|
*/
|
|
11
|
-
export const collectActionsFromComponent = (
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export const collectActionsFromComponent = (fiber,
|
|
14
|
+
/** Custom props (when `fiber.props` are stale). */
|
|
15
|
+
props) => {
|
|
16
|
+
const compActionsX = runComponent(fiber, props);
|
|
17
|
+
// Component cannot be its own error boundary. Pass it through.
|
|
18
|
+
if (compActionsX instanceof ReactError)
|
|
19
|
+
return compActionsX;
|
|
20
|
+
const [newReactChildren, compActions] = compActionsX;
|
|
21
|
+
const childrenX = jsxElementToFiberNode(newReactChildren, fiber, false);
|
|
22
|
+
if (childrenX instanceof ReactError) {
|
|
23
|
+
// It should never happen, because `childrenX` could be a `ReactError` only
|
|
24
|
+
// if ran some component that threw an error. But we don't unwrap components
|
|
25
|
+
// here.
|
|
26
|
+
throw new ReactError(fiber, `Unknown fiber error`);
|
|
16
27
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
let [newFiber, childrenActions] = childrenX;
|
|
29
|
+
let diffActionsX = collectActionsFromChildrenPair(fiber, toFiberChildren(newFiber));
|
|
30
|
+
if (diffActionsX instanceof ReactError) {
|
|
31
|
+
if (isErrorBoundary(fiber)) {
|
|
32
|
+
childrenActions = [];
|
|
33
|
+
diffActionsX = [diffActionsX.genCatchAction()];
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
return diffActionsX;
|
|
37
|
+
}
|
|
38
|
+
return [...compActions, ...childrenActions, ...diffActionsX];
|
|
21
39
|
};
|
|
22
40
|
//# sourceMappingURL=fromComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromComponent.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromComponent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"fromComponent.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromComponent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,KAAgB;AAChB,mDAAmD;AACnD,KAA0B,EACH,EAAE,CAAC;IAC1B,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChD,+DAA+D;IAC/D,IAAI,YAAY,YAAY,UAAU;QAAE,OAAO,YAAY,CAAC;IAE5D,MAAM,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,YAAY,CAAC;IACrD,MAAM,SAAS,GAAG,qBAAqB,CACrC,gBAAgB,EAChB,KAAK,EACL,KAAK,CACN,CAAC;IACF,IAAI,SAAS,YAAY,UAAU,EAAE,CAAC;QACpC,2EAA2E;QAC3E,4EAA4E;QAC5E,QAAQ;QACR,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,GAAG,SAAS,CAAC;IAC5C,IAAI,YAAY,GAAG,8BAA8B,CAC/C,KAAK,EACL,eAAe,CAAC,QAAQ,CAAC,CAC1B,CAAC;IAEF,IAAI,YAAY,YAAY,UAAU,EAAE,CAAC;QACvC,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,eAAe,GAAG,EAAE,CAAC;YACrB,YAAY,GAAG,CAAC,YAAY,CAAC,cAAc,EAAG,CAAC,CAAC;QAClD,CAAC;;YAAM,OAAO,YAAY,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,eAAe,EAAE,GAAG,YAAY,CAAC,CAAC;AAAA,CAC9D,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { App, FiberNode } from '../../../types';
|
|
2
2
|
import type { Action } from '../../../types/actions';
|
|
3
|
+
import { ReactError } from '../errors/ReactError';
|
|
3
4
|
/**
|
|
4
5
|
* `l` and `r` are the same node, but `r` may have some updates. This method
|
|
5
6
|
* collects a list of actions that must be applied to convert `l` to `r`.
|
|
6
7
|
* This doesn't include removing or replacing the existing `l` node.
|
|
7
8
|
*/
|
|
8
|
-
export declare const collectActionsFromFiberPair: (app: App, l: FiberNode, r: FiberNode) => Action[];
|
|
9
|
+
export declare const collectActionsFromFiberPair: (app: App, l: FiberNode, r: FiberNode) => Action[] | ReactError;
|
|
9
10
|
//# sourceMappingURL=fromFiberPair.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromFiberPair.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromFiberPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EAEH,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fromFiberPair.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromFiberPair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EAEH,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAIvE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,iEAkFvC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { collectActionsFromChildrenPair } from './fromChildrenPair';
|
|
2
|
-
import { collectActionsFromComponent } from './fromComponent';
|
|
3
2
|
import { areFiberPropsEq } from '../compare/areFiberPropsEq';
|
|
4
3
|
import { isFiberDead } from '../fibers';
|
|
4
|
+
import { ReactError } from '../errors/ReactError';
|
|
5
5
|
/**
|
|
6
6
|
* `l` and `r` are the same node, but `r` may have some updates. This method
|
|
7
7
|
* collects a list of actions that must be applied to convert `l` to `r`.
|
|
@@ -18,7 +18,11 @@ export const collectActionsFromFiberPair = (app, l, r) => {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
if (l.type === 'tag' || l.type === 'fragment') {
|
|
21
|
-
|
|
21
|
+
const childrenActionsX = collectActionsFromChildrenPair(l, r.children);
|
|
22
|
+
// Tags & fragments cannot be error boundaries. Pass it through.
|
|
23
|
+
if (childrenActionsX instanceof ReactError)
|
|
24
|
+
return childrenActionsX;
|
|
25
|
+
actions.push(...childrenActionsX);
|
|
22
26
|
}
|
|
23
27
|
if (eqProps &&
|
|
24
28
|
// Component may have the same props, but changed internal state
|
|
@@ -44,7 +48,7 @@ export const collectActionsFromFiberPair = (app, l, r) => {
|
|
|
44
48
|
break;
|
|
45
49
|
case 'component':
|
|
46
50
|
// One of the l-component props was updated -> run the component.
|
|
47
|
-
app.invalidatedComponents.add(l);
|
|
51
|
+
app.invalidatedComponents.add(l, r.props);
|
|
48
52
|
if (!eqProps) {
|
|
49
53
|
actions.push({
|
|
50
54
|
type: 'SetProps', // just l.props = r.props
|
|
@@ -52,7 +56,6 @@ export const collectActionsFromFiberPair = (app, l, r) => {
|
|
|
52
56
|
props: r.props,
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
|
-
actions.push(...collectActionsFromComponent(app, l, r));
|
|
56
59
|
break;
|
|
57
60
|
case 'fragment': {
|
|
58
61
|
if (r.role === 'context') {
|
|
@@ -123,7 +126,7 @@ const invalidateContextValue = (app, l, r) => {
|
|
|
123
126
|
if (isFiberDead(childCompFiber)) {
|
|
124
127
|
throw new Error(`Can't invalidate a dead context consumer`);
|
|
125
128
|
}
|
|
126
|
-
app.invalidatedComponents.add(childCompFiber);
|
|
129
|
+
app.invalidatedComponents.add(childCompFiber, null);
|
|
127
130
|
}
|
|
128
131
|
};
|
|
129
132
|
//# sourceMappingURL=fromFiberPair.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromFiberPair.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromFiberPair.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fromFiberPair.js","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromFiberPair.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,GAAQ,EACR,CAAY,EACZ,CAAY,EACW,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,EAA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,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromNewFiber.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromNewFiber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"fromNewFiber.d.ts","sourceRoot":"","sources":["../../../../src/core/reconciliation/collect/fromNewFiber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAGnE;;GAEG;AACH,eAAO,MAAM,0BAA0B,gCAoCtC,CAAC"}
|