@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
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { containerSym } from '../../types';
|
|
2
|
+
import { isEmptyContainer, isSingleChildContainer, isAutoContainer, } from '../compact';
|
|
3
|
+
import { asElement, getFiberDomNodes, getFirstContainerElement, } from './helpers';
|
|
4
|
+
import { nullthrowsForFiber, ReactError, } from '../reconciliation/errors/ReactError';
|
|
5
|
+
import { isFiberDead } from '../reconciliation/fibers';
|
|
4
6
|
/**
|
|
5
7
|
* Handles fiber tree layout updates when children have been modified. This
|
|
6
8
|
* action is triggered when:
|
|
@@ -18,9 +20,11 @@ import { nullthrows } from '../../utils';
|
|
|
18
20
|
* must be completed before this action runs.
|
|
19
21
|
*/
|
|
20
22
|
export function relayoutAction(fiber, { before, after }) {
|
|
21
|
-
if (
|
|
22
|
-
//
|
|
23
|
-
|
|
23
|
+
if (isSingleChildContainer(fiber)) {
|
|
24
|
+
// Fiber couldn't come here remaing a true single-child container:
|
|
25
|
+
// - Its only child is removed
|
|
26
|
+
// - … or now has a neighbor
|
|
27
|
+
fiber.element = containerSym;
|
|
24
28
|
}
|
|
25
29
|
if (after.size > 0) {
|
|
26
30
|
// Determine what can be used as a starting point for inserting new children.
|
|
@@ -46,38 +50,29 @@ export function relayoutAction(fiber, { before, after }) {
|
|
|
46
50
|
// Skip any nodes whose keys exist in `before`, since those are either
|
|
47
51
|
// unchanged or already updated (their `after` entries served only as
|
|
48
52
|
// references for the update process).
|
|
49
|
-
fiber.children = [...after.keys()].map((key) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* If the given fiber (a container) is in the compact mode we might need to
|
|
55
|
-
* unwrap it.
|
|
56
|
-
*/
|
|
57
|
-
const expandFiberWhenNeeded = (fiber, after) => {
|
|
58
|
-
if (isCompactNone(fiber)) {
|
|
59
|
-
// Case 1: it's <!--empty-->. It can't have children, so fix it.
|
|
60
|
-
unwrapCompactFiber(fiber);
|
|
53
|
+
fiber.children = [...after.keys()].map((key) => nullthrowsForFiber(fiber, before.get(key) ?? after.get(key)).fiber);
|
|
54
|
+
if (after.size > 0 && isEmptyContainer(fiber)) {
|
|
55
|
+
// Convert !-- to auto-container, 'cause now it has children.
|
|
56
|
+
fiber.element.remove();
|
|
57
|
+
fiber.element = containerSym;
|
|
61
58
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// Case 2: It's in "single child" mode. Fix it to support multiple children.
|
|
65
|
-
unwrapCompactFiber(fiber);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
throw new Error(`Invalid state: "remove" action didn't unwrap the parent container node during deletion of the only child`);
|
|
69
|
-
}
|
|
59
|
+
if (fiber.type !== 'tag') {
|
|
60
|
+
tryFixContainerType(fiber);
|
|
70
61
|
}
|
|
71
|
-
}
|
|
62
|
+
}
|
|
72
63
|
/**
|
|
73
64
|
* Puts the given `child` DOM nodes into the `parent`'s DOM area at the anchor
|
|
74
65
|
* position (`container` + `prev`). Updates the `child`'s parent node.
|
|
75
66
|
*/
|
|
76
67
|
const insertNewFiber = (parent, container, prev, child) => {
|
|
77
|
-
const
|
|
68
|
+
const parentElement = child.parent.element;
|
|
69
|
+
if (!(parentElement instanceof Element)) {
|
|
70
|
+
throw new ReactError(child.parent, `Wrong temporary container`);
|
|
71
|
+
}
|
|
72
|
+
const newChildren = [...parentElement.childNodes];
|
|
78
73
|
if (!prev) {
|
|
79
74
|
container.prepend(...newChildren);
|
|
80
|
-
prev =
|
|
75
|
+
prev = nullthrowsForFiber(parent, newChildren.at(-1));
|
|
81
76
|
}
|
|
82
77
|
else {
|
|
83
78
|
for (const n of newChildren) {
|
|
@@ -108,6 +103,100 @@ const repositionFiberWhenNeeded = (fiber, container, prev) => {
|
|
|
108
103
|
prev = n;
|
|
109
104
|
}
|
|
110
105
|
}
|
|
111
|
-
return
|
|
106
|
+
return nodes.at(-1);
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Finds the anchor DOM node for attaching other nodes. There are two scenarios:
|
|
110
|
+
* 1) [element, null] - the new node should be added to the beginning of the
|
|
111
|
+
* element;
|
|
112
|
+
* 2) [element, child] - the new node should be added right after `child`.
|
|
113
|
+
*/
|
|
114
|
+
const getAnchor = (fiber) => {
|
|
115
|
+
if (fiber.type === 'tag') {
|
|
116
|
+
return [
|
|
117
|
+
asElement(fiber.data instanceof HTMLElement
|
|
118
|
+
? fiber.data // Portal's `element` is !--r:portal
|
|
119
|
+
: fiber.element),
|
|
120
|
+
null,
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
if (fiber.type === 'component' || fiber.type === 'fragment') {
|
|
124
|
+
if (isEmptyContainer(fiber)) {
|
|
125
|
+
// Put other nodes right after !--empty. The !--empty will be removed
|
|
126
|
+
// afterwards, but for now it'll be anchor.
|
|
127
|
+
return [fiber.element.parentElement, fiber.element];
|
|
128
|
+
}
|
|
129
|
+
if (isSingleChildContainer(fiber)) {
|
|
130
|
+
// The node has only one node. This node was not removed in this render
|
|
131
|
+
// (otherwise `fiber` would be converted into !--empty). Put other nodes
|
|
132
|
+
// right after this one. It can temporarily violate the right order, but
|
|
133
|
+
// it'll be automatically healed in the same for-cycle.
|
|
134
|
+
return [fiber.element.parentElement, fiber.element];
|
|
135
|
+
}
|
|
136
|
+
if (isAutoContainer(fiber)) {
|
|
137
|
+
// Find any child fiber that wasn't removed in this render. Use it's as an
|
|
138
|
+
// anchor. It's not necessarily the 1st node, but relyout will recover the
|
|
139
|
+
// right order anyway.
|
|
140
|
+
const survivedChild = nullthrowsForFiber(fiber, fiber.children.find((f) => !isFiberDead(f)));
|
|
141
|
+
const element = getFirstContainerElement(fiber, [survivedChild]);
|
|
142
|
+
return [element.parentElement, element];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// "text" & "null" types cannot contain children.
|
|
146
|
+
throw new ReactError(fiber, `Unsupported anchor type: ${fiber.type}`);
|
|
147
|
+
};
|
|
148
|
+
export const tryFixContainerType = (fiber) => {
|
|
149
|
+
// Handle the node itself.
|
|
150
|
+
switch (fiber.children.length) {
|
|
151
|
+
case 0: {
|
|
152
|
+
if (!isEmptyContainer(fiber)) {
|
|
153
|
+
throw new ReactError(fiber, `Can't recover !--empty fiber container`);
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 1: {
|
|
158
|
+
if (isEmptyContainer(fiber)) {
|
|
159
|
+
throw new ReactError(fiber, `!--empty fibers can't have child nodes`);
|
|
160
|
+
}
|
|
161
|
+
if (isAutoContainer(fiber) && !isAutoContainer(fiber.children[0])) {
|
|
162
|
+
fiber.element = getFirstContainerElement(fiber);
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
default: {
|
|
167
|
+
if (isEmptyContainer(fiber)) {
|
|
168
|
+
throw new ReactError(fiber, `Incorrect !--empty fiber`);
|
|
169
|
+
}
|
|
170
|
+
if (isSingleChildContainer(fiber)) {
|
|
171
|
+
fiber.element = containerSym;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (fiber.parent.type === 'tag') {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
// Handle its parent.
|
|
179
|
+
switch (fiber.parent.children.length) {
|
|
180
|
+
case 0: {
|
|
181
|
+
throw new ReactError(fiber.parent, 'This fiber cannot be empty');
|
|
182
|
+
}
|
|
183
|
+
case 1: {
|
|
184
|
+
if (fiber.parent.element !== fiber.element) {
|
|
185
|
+
// Two scenarios:
|
|
186
|
+
// 1. fiber is a single-child node or a !--empty node. In such a case
|
|
187
|
+
// its parent should refer to the same DOM node.
|
|
188
|
+
// 2. fiber is an auto-container. Then the parent node must be an auto-
|
|
189
|
+
// container too.
|
|
190
|
+
tryFixContainerType(fiber.parent);
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
default: {
|
|
195
|
+
if (!isAutoContainer(fiber.parent)) {
|
|
196
|
+
// Only auto-containers may contain 2+ nodes.
|
|
197
|
+
tryFixContainerType(fiber.parent);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
112
201
|
};
|
|
113
202
|
//# sourceMappingURL=relayout.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayout.action.js","sourceRoot":"","sources":["../../../src/core/actions/relayout.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"relayout.action.js","sourceRoot":"","sources":["../../../src/core/actions/relayout.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAElE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAgB,EAChB,EAAE,MAAM,EAAE,KAAK,EAAkB,EACjC;IACA,IAAI,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,kEAAkE;QAClE,8BAA8B;QAC9B,8BAA4B;QAC3B,KAAmB,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9C,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACnB,6EAA6E;QAC7E,mEAAmE;QACnE,mDAAmD;QACnD,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAEzC,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAE1B,IAAI,CAAC,CAAC,EAAE,CAAC;gBACP,8DAA8D;gBAC9D,mEAAmE;gBACnE,IAAI,GAAG,cA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AU,CAAC,KAAK,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;QACnE,CAAC;QAED,KAAK,CAAC,EAAE,CAAC;YACP,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC3C,iBAAiB;gBACjB,qEAAqE;gBACrE,mDAAmD;gBACnD,uEAAuE;gBACvE,oBAAoB;gBACpB,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC;YACD,MAAM;QACR,CAAC;QAED,SAAS,CAAC;YACR,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBACnC,6CAA6C;gBAC7C,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FiberNode } from '../../types';
|
|
2
2
|
import type { RemoveAction } from '../../types/actions';
|
|
3
3
|
/**
|
|
4
4
|
* This action can be called directly (<div/> -> []), or indirectly (<div/> ->
|
|
5
5
|
* false) from the replace action. `replaced` is `true` in the 2nd scenario.
|
|
6
6
|
*/
|
|
7
|
-
export declare function removeAction(fiber: FiberNode, { immediate }
|
|
7
|
+
export declare function removeAction(fiber: FiberNode, { immediate, last }?: Pick<RemoveAction, 'immediate' | 'last'>): void;
|
|
8
8
|
//# sourceMappingURL=remove.action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/remove.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"remove.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/remove.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI/D;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,EAAE,SAAS,EAAE,IAAI,EAAE,GAAE,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,MAAM,CAAM,QA0CnE"}
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { emptyFiberNode, unsetRef } from './helpers';
|
|
2
|
+
import { ReactError } from '../reconciliation/errors/ReactError';
|
|
3
|
+
import { buildComment } from '../reconciliation/comments';
|
|
4
4
|
/**
|
|
5
5
|
* This action can be called directly (<div/> -> []), or indirectly (<div/> ->
|
|
6
6
|
* false) from the replace action. `replaced` is `true` in the 2nd scenario.
|
|
7
7
|
*/
|
|
8
|
-
export function removeAction(fiber, { immediate }) {
|
|
9
|
-
for (const child of fiber.children) {
|
|
8
|
+
export function removeAction(fiber, { immediate, last } = {}) {
|
|
9
|
+
for (const [idx, child] of fiber.children.entries()) {
|
|
10
10
|
// Recursively remove all children before removing the parent node. This is
|
|
11
11
|
// critical for components with effects - we must run cleanup effects
|
|
12
12
|
// before removing their parent nodes.
|
|
13
|
-
|
|
13
|
+
removeAction(child, { immediate, last: idx === fiber.children.length - 1 });
|
|
14
14
|
}
|
|
15
15
|
if (fiber.type === 'component') {
|
|
16
16
|
destroyHooks(fiber);
|
|
17
17
|
}
|
|
18
18
|
else if (fiber.role === 'context' && fiber.data.consumers.size > 0) {
|
|
19
|
-
throw new
|
|
19
|
+
throw new ReactError(fiber, `One of the context consumers wasn't unmounted`);
|
|
20
20
|
}
|
|
21
21
|
else if (fiber.type === 'tag' && fiber.role !== 'portal') {
|
|
22
22
|
unlistenTagEvents(fiber);
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
24
|
+
if (last && fiber.parent.type !== 'tag') {
|
|
25
|
+
// At this point if `fiber` is a component or a fragment its element is a
|
|
26
|
+
// !--empty comment. It was converted to !--empty on the last child removal.
|
|
27
|
+
const anchor = fiber.element;
|
|
28
|
+
// Do the same for the parent fragment|component fiber node:
|
|
29
|
+
const empty = buildComment('empty', fiber.parent.id);
|
|
30
|
+
anchor.parentElement.insertBefore(empty, anchor);
|
|
31
|
+
fiber.parent.element = empty;
|
|
28
32
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
throw new Error(`Remove: Node is not empty`);
|
|
32
|
-
}
|
|
33
|
-
n.remove();
|
|
33
|
+
if (!(fiber.element instanceof Node)) {
|
|
34
|
+
throw new ReactError(fiber, `Couldn't remove a fiber without DOM element`);
|
|
34
35
|
}
|
|
36
|
+
// Text, tag, !--null or !--empty
|
|
37
|
+
fiber.element.remove();
|
|
35
38
|
if (fiber.ref) {
|
|
36
39
|
unsetRef(fiber, !!immediate);
|
|
37
40
|
}
|
|
@@ -46,7 +49,7 @@ export function removeAction(fiber, { immediate }) {
|
|
|
46
49
|
const unlistenTagEvents = (fiber) => {
|
|
47
50
|
for (const record of Object.values(fiber.data.events)) {
|
|
48
51
|
if (record?.wrapper) {
|
|
49
|
-
fiber.element.removeEventListener(record.name, record.wrapper);
|
|
52
|
+
fiber.element.removeEventListener(record.name, record.wrapper, { capture: record.capture });
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.action.js","sourceRoot":"","sources":["../../../src/core/actions/remove.action.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"remove.action.js","sourceRoot":"","sources":["../../../src/core/actions/remove.action.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D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{"version":3,"file":"replace.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/replace.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAMhE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,EAAE,aAAa,QAgB1E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFiberDomNodes } from './helpers';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { removeAction } from './remove.action';
|
|
3
|
+
import { nullthrowsForFiber } from '../reconciliation/errors/ReactError';
|
|
4
|
+
import { updateValueStore } from './dom/value';
|
|
5
5
|
/**
|
|
6
6
|
* Handles fiber replacement when a component with the same key renders a
|
|
7
7
|
* completely different node. This happens when the `type`, `tag`, or
|
|
@@ -18,21 +18,15 @@ import { applyAction } from './applyAction';
|
|
|
18
18
|
*/
|
|
19
19
|
export function replaceAction(fiber, { newFiber }) {
|
|
20
20
|
const { parent } = fiber;
|
|
21
|
-
if (isCompactSingleChild(parent)) {
|
|
22
|
-
// The node we're replacing is the only child of its parent, so the parent
|
|
23
|
-
// is in compact mode. We should unwrap it before removing this node,
|
|
24
|
-
// otherwise it will be disconnected from the DOM tree.
|
|
25
|
-
unwrapCompactFiber(parent);
|
|
26
|
-
}
|
|
27
21
|
// Add new nodes right after the previous nodes.
|
|
28
22
|
const nodesBefore = getFiberDomNodes(fiber);
|
|
29
|
-
let prev =
|
|
23
|
+
let prev = nullthrowsForFiber(fiber, nodesBefore.at(-1));
|
|
30
24
|
const nodesAfter = getFiberDomNodes(newFiber);
|
|
31
25
|
for (const n of nodesAfter) {
|
|
32
26
|
prev.parentElement.insertBefore(n, prev.nextSibling);
|
|
33
27
|
prev = n;
|
|
34
28
|
}
|
|
35
|
-
|
|
29
|
+
removeAction(fiber);
|
|
36
30
|
fiber.parent = parent; // undo `parent = null` (done in "Remove").
|
|
37
31
|
displaceFiber(fiber, newFiber);
|
|
38
32
|
}
|
|
@@ -54,22 +48,39 @@ const displaceFiber = (before, after) => {
|
|
|
54
48
|
before.props = after.props;
|
|
55
49
|
before.ref = after.ref;
|
|
56
50
|
if (after.type === 'component') {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
moveHooks(before, after);
|
|
52
|
+
}
|
|
53
|
+
else if (after.role === 'context') {
|
|
54
|
+
updateContext(before, after);
|
|
55
|
+
}
|
|
56
|
+
else if (after.type === 'tag') {
|
|
57
|
+
updateValueStore(before);
|
|
58
|
+
}
|
|
59
|
+
// For debug purposes mark dead nodes with a negative number.
|
|
60
|
+
after.id = -after.id;
|
|
61
|
+
};
|
|
62
|
+
const moveHooks = (before, after) => {
|
|
63
|
+
for (const hook of after.data.hooks) {
|
|
64
|
+
if ('move' in hook) {
|
|
65
|
+
// Update internal fiber links
|
|
66
|
+
hook.move(before);
|
|
67
|
+
// TODO: add a test ^.
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* ContextFiberNode's `data.consumers` is a Set of components whose `useContext`
|
|
73
|
+
* target the given `data.ctx`. At the same time the `useContext` state
|
|
74
|
+
* preserves a link to the closest parent context provider of the given context
|
|
75
|
+
* type. That means once we `displace` the context provider we must update the
|
|
76
|
+
* hook states.
|
|
77
|
+
*/
|
|
78
|
+
const updateContext = (before, after) => {
|
|
79
|
+
for (const consumer of after.data.consumers) {
|
|
80
|
+
const useConextItems = consumer.data.hooks.filter((hook) => hook.type === 'context' && hook.ctx === after.data.ctx);
|
|
81
|
+
for (const hook of useConextItems) {
|
|
69
82
|
hook.providerFiber = before;
|
|
70
83
|
}
|
|
71
84
|
}
|
|
72
|
-
// For debug purposes mark dead nodes with a negative number.
|
|
73
|
-
after.id = -after.id;
|
|
74
85
|
};
|
|
75
86
|
//# sourceMappingURL=replace.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.action.js","sourceRoot":"","sources":["../../../src/core/actions/replace.action.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"replace.action.js","sourceRoot":"","sources":["../../../src/core/actions/replace.action.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB,EAAE,EAAE,QAAQ,EAAiB,EAAE;IAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,gDAAgD;IAChD,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9C,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,aAAc,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,GAAG,CAAC,CAAC;IACX,CAAC;IAED,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,2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AC,KAAK,CAAC,EAAE,CAAC;AAAA,CACtB,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAiB,EAAE,KAAyB,EAAQ,EAAE,CAAC;IACxE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAM,EAAE,CAAC;QACrC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,8BAA8B;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClB,sBAAsB;QACxB,CAAC;IACH,CAAC;AAAA,CACF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,MAAiB,EAAE,KAAuB,EAAE,EAAE,CAAC;IACpE,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QAC5C,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAM,CAAC,MAAM,CAChD,CAAC,IAAI,EAA0B,EAAE,CAC/B,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CACzD,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;YAClC,IAAI,CAAC,aAAa,GAAG,MAA0B,CAAC;QAClD,CAAC;IACH,CAAC;AAAA,CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FiberNode } from '../../types';
|
|
2
|
+
import type { ScheduleEffectAction } from '../../types/actions';
|
|
3
|
+
/**
|
|
4
|
+
* Adds the given effect to the appropriate effect queue.
|
|
5
|
+
*/
|
|
6
|
+
export declare function scheduleEffectAction(fiber: FiberNode, { fn, mode }: Pick<ScheduleEffectAction, 'fn' | 'mode'>): void;
|
|
7
|
+
//# sourceMappingURL=scheduleEffect.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleEffect.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/scheduleEffect.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC,QAGxD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { scheduleEffect } from '../reconciliation/effects';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the given effect to the appropriate effect queue.
|
|
4
|
+
*/
|
|
5
|
+
export function scheduleEffectAction(fiber, { fn, mode }) {
|
|
6
|
+
scheduleEffect(fiber, fn, mode);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=scheduleEffect.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleEffect.action.js","sourceRoot":"","sources":["../../../src/core/actions/scheduleEffect.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAgB,EAChB,EAAE,EAAE,EAAE,IAAI,EAA6C,EACvD;IACA,cAAc,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAAA,CACjC"}
|
|
@@ -5,5 +5,5 @@ import type { SetAttrAction } from '../../types/actions';
|
|
|
5
5
|
* - Removing, adding or updating an attribute
|
|
6
6
|
* - Removing, adding or replacing an event handler
|
|
7
7
|
*/
|
|
8
|
-
export declare function setAttrAction(fiber: FiberNode, { name, value }: SetAttrAction): void;
|
|
8
|
+
export declare function setAttrAction(fiber: FiberNode, { name, value, creation }: Pick<SetAttrAction, 'name' | 'value' | 'creation'>): void;
|
|
9
9
|
//# sourceMappingURL=setAttr.action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setAttr.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setAttr.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"setAttr.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setAttr.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAahE;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,EAChB,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,QA+C9E"}
|
|
@@ -1,28 +1,49 @@
|
|
|
1
|
-
import { nullthrows } from '../../utils';
|
|
2
1
|
import { isEventName } from './helpers';
|
|
3
2
|
import { setSvgAttribute } from './dom/svg';
|
|
4
3
|
import { setTagStyles } from './dom/css';
|
|
5
4
|
import { setEventHandler } from './dom/events';
|
|
6
5
|
import { setHtmlAttribute } from './dom/attributes';
|
|
6
|
+
import { changeControlValue, setValueAttr } from './dom/value';
|
|
7
|
+
import { nullthrowsForFiber, ReactError, } from '../reconciliation/errors/ReactError';
|
|
8
|
+
import { isSetHtml } from '../reconciliation/typeGuards';
|
|
7
9
|
/**
|
|
8
10
|
* Applicable only to DOM tag nodes and handles the following scenarios:
|
|
9
11
|
* - Removing, adding or updating an attribute
|
|
10
12
|
* - Removing, adding or replacing an event handler
|
|
11
13
|
*/
|
|
12
|
-
export function setAttrAction(fiber, { name, value }) {
|
|
14
|
+
export function setAttrAction(fiber, { name, value, creation }) {
|
|
13
15
|
if (fiber.type !== 'tag') {
|
|
14
|
-
throw new
|
|
16
|
+
throw new ReactError(fiber, `Can't apply SetAttr to a ${fiber.type} node`);
|
|
15
17
|
}
|
|
16
18
|
if (fiber.role === 'portal') {
|
|
17
|
-
throw new
|
|
19
|
+
throw new ReactError(fiber, `Can't apply SetAttr to a portal node`);
|
|
18
20
|
}
|
|
19
|
-
const element =
|
|
20
|
-
if (
|
|
21
|
+
const element = nullthrowsForFiber(fiber, fiber.element);
|
|
22
|
+
if (isControllableAttrValue(fiber.element, name)) {
|
|
23
|
+
setValueAttr(fiber, name, value);
|
|
24
|
+
}
|
|
25
|
+
else if (name === 'defaultChecked' && element instanceof HTMLInputElement) {
|
|
26
|
+
if (creation) {
|
|
27
|
+
changeControlValue(fiber, element, 'checked', value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (name === 'defaultValue' &&
|
|
31
|
+
(element instanceof HTMLInputElement ||
|
|
32
|
+
element instanceof HTMLTextAreaElement ||
|
|
33
|
+
element instanceof HTMLSelectElement)) {
|
|
34
|
+
if (creation) {
|
|
35
|
+
changeControlValue(fiber, element, 'value', value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (isEventName(name) || name in fiber.data.events) {
|
|
21
39
|
setEventHandler(fiber, element, name, value);
|
|
22
40
|
}
|
|
23
41
|
else if (name === 'style') {
|
|
24
42
|
setTagStyles(fiber, value);
|
|
25
43
|
}
|
|
44
|
+
else if (name === 'dangerouslySetInnerHTML' && isSetHtml(value)) {
|
|
45
|
+
element.innerHTML = value.__html;
|
|
46
|
+
}
|
|
26
47
|
else if (value == null) {
|
|
27
48
|
element.removeAttribute(name);
|
|
28
49
|
}
|
|
@@ -40,4 +61,24 @@ export function setAttrAction(fiber, { name, value }) {
|
|
|
40
61
|
}
|
|
41
62
|
}
|
|
42
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns true if the given attribute is the controllable (by React) value of
|
|
66
|
+
* the given HTML control. E.g.:
|
|
67
|
+
* - for input[type=text] the value attributes is "value"
|
|
68
|
+
* - but for input[type="radio"] it's "checked", whereas "value" is just a
|
|
69
|
+
* optional string attribute.
|
|
70
|
+
*/
|
|
71
|
+
const isControllableAttrValue = (element, name) => {
|
|
72
|
+
if (element instanceof HTMLInputElement) {
|
|
73
|
+
const { type } = element;
|
|
74
|
+
return type === 'radio' || type === 'checkbox'
|
|
75
|
+
? name === 'checked'
|
|
76
|
+
: name === 'value';
|
|
77
|
+
}
|
|
78
|
+
if (element instanceof HTMLTextAreaElement ||
|
|
79
|
+
element instanceof HTMLSelectElement) {
|
|
80
|
+
return name === 'value';
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
};
|
|
43
84
|
//# sourceMappingURL=setAttr.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setAttr.action.js","sourceRoot":"","sources":["../../../src/core/actions/setAttr.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"setAttr.action.js","sourceRoot":"","sources":["../../../src/core/actions/setAttr.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgB,EAChB,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAsD,EAC7E;IACA,I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../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"setProps.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,cAAc,QAYzE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactError } from '../reconciliation/errors/ReactError';
|
|
1
2
|
/**
|
|
2
3
|
* Updates the set of props for the given fiber node. This doesn't make any
|
|
3
4
|
* DOM changes or run components.
|
|
@@ -6,7 +7,7 @@ export function setPropsAction(fiber, { props }) {
|
|
|
6
7
|
if (fiber.type !== 'component' &&
|
|
7
8
|
fiber.type !== 'tag' &&
|
|
8
9
|
fiber.role !== 'context') {
|
|
9
|
-
throw new
|
|
10
|
+
throw new ReactError(fiber, `setProps action is not applicable to this fiber node`);
|
|
10
11
|
}
|
|
11
12
|
fiber.props = props;
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setProps.action.js","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setProps.action.js","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgB,EAAE,EAAE,KAAK,EAAkB,EAAE;IAC1E,IACE,KAAK,CAAC,IAAI,KAAK,WAAW;QAC1B,KAAK,CAAC,IAAI,KAAK,KAAK;QACpB,KAAK,CAAC,IAAI,KAAK,SAAS,EACxB,CAAC;QACD,MAAM,IAAI,UAAU,CAClB,KAAK,EACL,sDAAsD,CACvD,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AAAA,CACrB"}
|
|
@@ -7,5 +7,5 @@ import type { SetRefAction } from '../../types/actions';
|
|
|
7
7
|
*
|
|
8
8
|
* Removing nodes with ref handlers is handled in remove and replace actions.
|
|
9
9
|
*/
|
|
10
|
-
export declare function setRefAction(fiber: FiberNode, { ref, dontUnsetRef }: SetRefAction): void;
|
|
10
|
+
export declare function setRefAction(fiber: FiberNode, { ref, dontUnsetRef }: Pick<SetRefAction, 'ref' | 'dontUnsetRef'>): void;
|
|
11
11
|
//# sourceMappingURL=setRef.action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setRef.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setRef.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"setRef.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setRef.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAQ/D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,cAAc,CAAC,QAmClE"}
|