@reckona/mreact-compat 0.0.186 → 0.0.188
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/class-component.js.map +1 -1
- package/dist/dom-props.d.ts.map +1 -1
- package/dist/element.d.ts +1 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js.map +1 -1
- package/dist/event-replay.js.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/fiber-commit.js.map +1 -1
- package/dist/fiber-work-loop.js.map +1 -1
- package/dist/fiber.js.map +1 -1
- package/dist/flight-parser.js.map +1 -1
- package/dist/flight-protocol.d.ts.map +1 -1
- package/dist/flight.js.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/host-reconciler.d.ts.map +1 -1
- package/dist/host-reconciler.js +41 -12
- package/dist/host-reconciler.js.map +1 -1
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +2 -0
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/react-default.d.ts.map +1 -1
- package/dist/reconciler.js.map +1 -1
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/server-render.d.ts.map +1 -1
- package/dist/server-render.js.map +1 -1
- package/package.json +4 -4
- package/src/element.ts +1 -0
- package/src/host-reconciler.ts +45 -12
- package/src/index.ts +4 -0
- package/src/jsx-runtime.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-reconciler.d.ts","sourceRoot":"","sources":["../src/host-reconciler.ts"],"names":[],"mappings":"AAAA,OAAO,EAqBL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAmBtB,OAAO,EAOL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAqC,KAAK,KAAK,EAAE,KA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wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,KAAK,EACnB,OAAO,GAAE,aAAkB,GAC1B,IAAI,CA4DN;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,KAAK,EACnB,KAAK,EAAE,cAAc,EACrB,OAAO,GAAE,qBAA0B,GAClC,IAAI,CA2BN;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,CAiBxE;AAED,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,KAAK,GAAG,SAAS,EACxB,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,GAC3B,IAAI,CASN"}
|
package/dist/host-reconciler.js
CHANGED
|
@@ -12,8 +12,10 @@ import { isThenable } from "./thenable.js";
|
|
|
12
12
|
import { hasDirtyClassUpdate, isClassComponentType, recoverClassComponentError, renderClassComponentWithRuntime, } from "./class-component.js";
|
|
13
13
|
import { areMemoPropsEqual, getPendingProps, shallowEqual } from "./prop-comparison.js";
|
|
14
14
|
import { reportElementTextMismatch, reportExtraHydrationNodes, reportHydrationNodeTypeMismatch, reportMissingHydrationNode, reportReactSuspenseServerError, reportRecoverable, withHydrationComponentStack, } from "./hydration.js";
|
|
15
|
+
import { withBatchedDelegatedRootReleases } from "@reckona/mreact-reactive-dom";
|
|
15
16
|
const committedPortalContainers = new Set();
|
|
16
17
|
const pendingHostRefUpdates = [];
|
|
18
|
+
const pendingReactiveDomBlockAfterCommits = [];
|
|
17
19
|
const emptyInstanceKeys = [];
|
|
18
20
|
const SKIP_COMMIT_PATH = "\0";
|
|
19
21
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -106,25 +108,30 @@ export function commitHostFiberRoot(root, finishedWork, options = {}) {
|
|
|
106
108
|
try {
|
|
107
109
|
committedPortalContainers.clear();
|
|
108
110
|
pendingHostRefUpdates.length = 0;
|
|
111
|
+
pendingReactiveDomBlockAfterCommits.length = 0;
|
|
109
112
|
const commitPath = getRootCommitPath(options);
|
|
110
113
|
if (!hasChildListMutation(finishedWork)) {
|
|
111
114
|
commitHostDirtyChildrenOf(finishedWork, finishedWork.child, root.container, root.container, commitPath, options);
|
|
115
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
112
116
|
committed = true;
|
|
113
117
|
return;
|
|
114
118
|
}
|
|
115
119
|
if (finishedWork.childListChanged &&
|
|
116
120
|
commitHostKeyedChildListMutationFiber(finishedWork, root.container, root.container, commitPath, options)) {
|
|
121
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
117
122
|
committed = true;
|
|
118
123
|
return;
|
|
119
124
|
}
|
|
120
125
|
if (!finishedWork.childListChanged &&
|
|
121
126
|
finishedWork.subtreeChildListChanged &&
|
|
122
127
|
commitHostKeyedChildListMutation(finishedWork.child, root.container, root.container, commitPath, options)) {
|
|
128
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
123
129
|
committed = true;
|
|
124
130
|
return;
|
|
125
131
|
}
|
|
126
132
|
const nodes = commitHostChildren(finishedWork.child, root.container, root.container, commitPath, options);
|
|
127
133
|
syncChildNodes(root.container, nodes);
|
|
134
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
128
135
|
committed = true;
|
|
129
136
|
}
|
|
130
137
|
finally {
|
|
@@ -144,9 +151,11 @@ export function commitHydratingHostFiberRoot(root, finishedWork, scope, options
|
|
|
144
151
|
try {
|
|
145
152
|
committedPortalContainers.clear();
|
|
146
153
|
pendingHostRefUpdates.length = 0;
|
|
154
|
+
pendingReactiveDomBlockAfterCommits.length = 0;
|
|
147
155
|
const eventRoot = root.container;
|
|
148
156
|
const nodes = commitHostChildren(finishedWork.child, scope.parent, eventRoot, "", options);
|
|
149
157
|
syncScopedChildNodes(scope.parent, scope.before, scope.after, nodes);
|
|
158
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
150
159
|
committed = true;
|
|
151
160
|
}
|
|
152
161
|
finally {
|
|
@@ -155,6 +164,7 @@ export function commitHydratingHostFiberRoot(root, finishedWork, scope, options
|
|
|
155
164
|
}
|
|
156
165
|
else {
|
|
157
166
|
pendingHostRefUpdates.length = 0;
|
|
167
|
+
pendingReactiveDomBlockAfterCommits.length = 0;
|
|
158
168
|
}
|
|
159
169
|
committedPortalContainers.clear();
|
|
160
170
|
}
|
|
@@ -168,23 +178,27 @@ export function disposeHostFiberResources(fiber) {
|
|
|
168
178
|
if (fiber === undefined || fiber.hasDisposableResources !== true) {
|
|
169
179
|
return;
|
|
170
180
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
withBatchedDelegatedRootReleases(() => {
|
|
182
|
+
// Dispose this fiber and its SUBTREE only — not its siblings. This is called
|
|
183
|
+
// once per deleted fiber, and deleted siblings are disposed by their own
|
|
184
|
+
// calls; walking siblings here re-walked the whole deleted list per deletion
|
|
185
|
+
// (O(n^2) on a cleared 1k-row reactive list). The dedupe set is allocated
|
|
186
|
+
// once for the subtree walk.
|
|
187
|
+
const seen = new Set();
|
|
188
|
+
if (fiber.tag === "reactive-dom-block") {
|
|
189
|
+
disposeReactiveDomBlockState(fiber.stateNode, seen);
|
|
190
|
+
}
|
|
191
|
+
disposeHostFiberChildResources(fiber.child, seen);
|
|
192
|
+
});
|
|
181
193
|
}
|
|
182
194
|
export function disposeUnretainedHostFiberResources(fiber, retained) {
|
|
183
195
|
if (fiber === undefined || fiber.hasDisposableResources !== true || retained.has(fiber)) {
|
|
184
196
|
return;
|
|
185
197
|
}
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
withBatchedDelegatedRootReleases(() => {
|
|
199
|
+
const seen = new Set();
|
|
200
|
+
disposeUnretainedHostFiberSubtreeResources(fiber, seen, retained);
|
|
201
|
+
});
|
|
188
202
|
}
|
|
189
203
|
function disposeHostFiberChildResources(fiber, seen) {
|
|
190
204
|
let cursor = fiber;
|
|
@@ -1868,6 +1882,7 @@ function commitHostDirtyFiber(fiber, parent, eventRoot, path, options = {}) {
|
|
|
1868
1882
|
if (!(isDomElement && childNodes.length === 0 && committedPortalContainers.has(element)) &&
|
|
1869
1883
|
!(isDomElement && shouldPreserveContentEditableChildren(element, props, childNodes))) {
|
|
1870
1884
|
syncChildNodes(element, childNodes);
|
|
1885
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
1871
1886
|
}
|
|
1872
1887
|
}
|
|
1873
1888
|
else if (fiber.subtreeFlags !== NoFlags) {
|
|
@@ -2158,6 +2173,7 @@ function commitHostFiber(fiber, parent, eventRoot, path, options = {}) {
|
|
|
2158
2173
|
}
|
|
2159
2174
|
if (fiber.tag === "reactive-dom-block") {
|
|
2160
2175
|
const node = getReactiveDomBlockNode(fiber.stateNode);
|
|
2176
|
+
enqueueReactiveDomBlockAfterCommit(fiber.stateNode);
|
|
2161
2177
|
fiber.memoizedProps = fiber.pendingProps;
|
|
2162
2178
|
finishCommittedFiber(fiber);
|
|
2163
2179
|
return node === undefined ? [] : [node];
|
|
@@ -2217,6 +2233,7 @@ function commitHostFiber(fiber, parent, eventRoot, path, options = {}) {
|
|
|
2217
2233
|
if (!(isDomElement && childNodes.length === 0 && committedPortalContainers.has(element)) &&
|
|
2218
2234
|
!(isDomElement && shouldPreserveContentEditableChildren(element, props, childNodes))) {
|
|
2219
2235
|
syncChildNodes(element, childNodes);
|
|
2236
|
+
flushPendingReactiveDomBlockAfterCommits();
|
|
2220
2237
|
}
|
|
2221
2238
|
}
|
|
2222
2239
|
else if (fiber.subtreeFlags !== NoFlags) {
|
|
@@ -2344,6 +2361,18 @@ function getReactiveDomBlockNode(state) {
|
|
|
2344
2361
|
}
|
|
2345
2362
|
return undefined;
|
|
2346
2363
|
}
|
|
2364
|
+
function enqueueReactiveDomBlockAfterCommit(state) {
|
|
2365
|
+
const afterCommit = state?.afterCommit;
|
|
2366
|
+
if (typeof afterCommit === "function") {
|
|
2367
|
+
pendingReactiveDomBlockAfterCommits.push(afterCommit);
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
function flushPendingReactiveDomBlockAfterCommits() {
|
|
2371
|
+
const pending = pendingReactiveDomBlockAfterCommits.splice(0);
|
|
2372
|
+
for (const afterCommit of pending) {
|
|
2373
|
+
afterCommit();
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2347
2376
|
function disposeReactiveDomBlockState(state, seen) {
|
|
2348
2377
|
if (typeof state !== "object" || state === null || seen.has(state)) {
|
|
2349
2378
|
return;
|