@reckona/mreact-compat 0.0.160 → 0.0.162
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.d.ts +5 -0
- package/dist/class-component.d.ts.map +1 -1
- package/dist/class-component.js +36 -11
- package/dist/class-component.js.map +1 -1
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +4 -0
- package/dist/context.js.map +1 -1
- package/dist/element.d.ts +28 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +21 -1
- package/dist/element.js.map +1 -1
- package/dist/event-priority.d.ts +1 -0
- package/dist/event-priority.d.ts.map +1 -1
- package/dist/event-priority.js +1 -0
- package/dist/event-priority.js.map +1 -1
- package/dist/event-replay.d.ts +6 -0
- package/dist/event-replay.d.ts.map +1 -1
- package/dist/event-replay.js +4 -0
- package/dist/event-replay.js.map +1 -1
- package/dist/flight-decoder.d.ts +1 -0
- package/dist/flight-decoder.d.ts.map +1 -1
- package/dist/flight-decoder.js.map +1 -1
- package/dist/flight-protocol.d.ts +2 -0
- package/dist/flight-protocol.d.ts.map +1 -1
- package/dist/flight-protocol.js +1 -0
- package/dist/flight-protocol.js.map +1 -1
- package/dist/flight-types.d.ts +21 -0
- package/dist/flight-types.d.ts.map +1 -1
- package/dist/flight-types.js.map +1 -1
- package/dist/flight.d.ts +7 -0
- package/dist/flight.d.ts.map +1 -1
- package/dist/flight.js +5 -0
- package/dist/flight.js.map +1 -1
- package/dist/hooks-entry.d.ts +2 -0
- package/dist/hooks-entry.d.ts.map +1 -1
- package/dist/hooks-entry.js +1 -0
- package/dist/hooks-entry.js.map +1 -1
- package/dist/hooks.d.ts +36 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +42 -10
- package/dist/hooks.js.map +1 -1
- package/dist/host-reconciler.js +30 -30
- package/dist/host-reconciler.js.map +1 -1
- package/dist/hydration.d.ts +2 -0
- package/dist/hydration.d.ts.map +1 -1
- package/dist/hydration.js +1 -0
- package/dist/hydration.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/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +5 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -1
- package/dist/jsx-dev-runtime.js +3 -0
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +13 -0
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +4 -0
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/react-default.d.ts +2 -0
- package/dist/react-default.d.ts.map +1 -1
- package/dist/react-default.js +2 -0
- package/dist/react-default.js.map +1 -1
- package/dist/root.d.ts +13 -0
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +6 -0
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts +23 -0
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +19 -0
- package/dist/scheduler.js.map +1 -1
- package/dist/server-render.d.ts +1 -0
- package/dist/server-render.d.ts.map +1 -1
- package/dist/server-render.js +1 -0
- package/dist/server-render.js.map +1 -1
- package/package.json +3 -3
- package/src/class-component.ts +47 -11
- package/src/context.ts +4 -0
- package/src/element.ts +33 -6
- package/src/event-priority.ts +1 -0
- package/src/event-replay.ts +6 -0
- package/src/flight-decoder.ts +1 -0
- package/src/flight-protocol.ts +2 -0
- package/src/flight-types.ts +21 -0
- package/src/flight.ts +7 -0
- package/src/hooks-entry.ts +2 -0
- package/src/hooks.ts +55 -15
- package/src/host-reconciler.ts +39 -38
- package/src/hydration.ts +2 -0
- package/src/index.ts +3 -0
- package/src/internal.ts +1 -0
- package/src/jsx-dev-runtime.ts +5 -0
- package/src/jsx-runtime.ts +13 -0
- package/src/react-default.ts +2 -0
- package/src/root.ts +13 -0
- package/src/scheduler.ts +23 -0
- package/src/server-render.ts +1 -0
package/dist/host-reconciler.js
CHANGED
|
@@ -734,7 +734,7 @@ function createHostFiberImpl(parent, current, node, key, runtime, path, options
|
|
|
734
734
|
!hasUnflushedMountEffectInstance(runtime, previousMemoState.instanceKeys) &&
|
|
735
735
|
areMemoPropsEqual(memoType, previousMemoState.props, node.props)) {
|
|
736
736
|
markActiveInstanceKeys(runtime, previousMemoState.instanceKeys);
|
|
737
|
-
fiber.child = current
|
|
737
|
+
fiber.child = getSkippedChild(current);
|
|
738
738
|
fiber.memoizedState = previousMemoState;
|
|
739
739
|
return { fiber, consumed: options.previousNodes?.length ?? 0 };
|
|
740
740
|
}
|
|
@@ -815,15 +815,17 @@ function createHostFiberImpl(parent, current, node, key, runtime, path, options
|
|
|
815
815
|
const currentClassInstance = current?.tag === "class-component" && current.type === classType
|
|
816
816
|
? current.stateNode
|
|
817
817
|
: undefined;
|
|
818
|
+
const hasCurrentClassFiber = current?.tag === "class-component" && current.type === classType;
|
|
818
819
|
const rendered = renderClassComponentWithRuntime(classType, node.props, runtime, path, {
|
|
819
820
|
...(currentClassInstance === undefined
|
|
820
821
|
? {}
|
|
821
822
|
: { currentInstance: currentClassInstance }),
|
|
822
823
|
hasDirtyDescendant: hasDirtyInstance(runtime, previousClassChildKeys, `${path}.class`),
|
|
824
|
+
allowSkip: hasCurrentClassFiber,
|
|
823
825
|
});
|
|
824
826
|
applyRef(node.ref, rendered.kind === "skip" ? current?.stateNode : rendered.instance);
|
|
825
827
|
if (rendered.kind === "skip") {
|
|
826
|
-
fiber.child = current
|
|
828
|
+
fiber.child = getSkippedChild(current);
|
|
827
829
|
return { fiber, consumed: options.previousNodes?.length ?? 0 };
|
|
828
830
|
}
|
|
829
831
|
const childOptions = withHydrationComponentStack(options, getComponentName(classType));
|
|
@@ -867,7 +869,7 @@ function createHostFiberImpl(parent, current, node, key, runtime, path, options
|
|
|
867
869
|
!hasUnflushedMountEffectInstance(runtime, previousFunctionState.instanceKeys) &&
|
|
868
870
|
!hasPendingAsyncChild(current?.child)) {
|
|
869
871
|
markActiveInstanceKeys(runtime, previousFunctionState.instanceKeys);
|
|
870
|
-
fiber.child = current
|
|
872
|
+
fiber.child = getSkippedChild(current);
|
|
871
873
|
fiber.memoizedState = current?.memoizedState;
|
|
872
874
|
fiber.stateNode = previousFunctionState;
|
|
873
875
|
return { fiber, consumed: options.previousNodes?.length ?? 0 };
|
|
@@ -1026,6 +1028,15 @@ function commitHostDirtyFiber(fiber, parent, eventRoot, path, options = {}) {
|
|
|
1026
1028
|
const text = syncDirectHostTextChild(element, directTextChild);
|
|
1027
1029
|
subscribeReactiveHostTextBinding(props, text);
|
|
1028
1030
|
}
|
|
1031
|
+
else if (fiber.hostChildListChanged ||
|
|
1032
|
+
fiber.childListChanged ||
|
|
1033
|
+
fiber.subtreeChildListChanged) {
|
|
1034
|
+
const childNodes = commitHostChildren(fiber.child, element, eventRoot, `${path}.c`, options);
|
|
1035
|
+
if (!(childNodes.length === 0 && committedPortalContainers.has(element)) &&
|
|
1036
|
+
!shouldPreserveContentEditableChildren(element, props, childNodes)) {
|
|
1037
|
+
syncChildNodes(element, childNodes);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1029
1040
|
else if (fiber.subtreeFlags !== NoFlags) {
|
|
1030
1041
|
commitHostDirtyChildren(fiber.child, element, eventRoot, `${path}.c`, options);
|
|
1031
1042
|
}
|
|
@@ -1119,7 +1130,7 @@ function commitHostKeyedChildListMutationFiber(fiber, parent, eventRoot, path, o
|
|
|
1119
1130
|
return true;
|
|
1120
1131
|
}
|
|
1121
1132
|
function commitHostAppendSuffix(fiber, parent, eventRoot, path, options) {
|
|
1122
|
-
const append =
|
|
1133
|
+
const append = getAppendSuffix(fiber.alternate?.child, fiber.child);
|
|
1123
1134
|
if (append === undefined) {
|
|
1124
1135
|
return false;
|
|
1125
1136
|
}
|
|
@@ -1134,31 +1145,6 @@ function commitHostAppendSuffix(fiber, parent, eventRoot, path, options) {
|
|
|
1134
1145
|
}
|
|
1135
1146
|
return true;
|
|
1136
1147
|
}
|
|
1137
|
-
function getPlacementAppendSuffix(next) {
|
|
1138
|
-
let nextCursor = next;
|
|
1139
|
-
let index = 0;
|
|
1140
|
-
while (nextCursor !== undefined) {
|
|
1141
|
-
if ((nextCursor.flags & Placement) !== NoFlags) {
|
|
1142
|
-
if (index === 0) {
|
|
1143
|
-
return undefined;
|
|
1144
|
-
}
|
|
1145
|
-
let appendCursor = nextCursor;
|
|
1146
|
-
while (appendCursor !== undefined) {
|
|
1147
|
-
if ((appendCursor.flags & Placement) === NoFlags) {
|
|
1148
|
-
return undefined;
|
|
1149
|
-
}
|
|
1150
|
-
appendCursor = appendCursor.sibling;
|
|
1151
|
-
}
|
|
1152
|
-
return { fiber: nextCursor, index };
|
|
1153
|
-
}
|
|
1154
|
-
if (hasHostCommitWork(nextCursor)) {
|
|
1155
|
-
return undefined;
|
|
1156
|
-
}
|
|
1157
|
-
nextCursor = nextCursor.sibling;
|
|
1158
|
-
index += 1;
|
|
1159
|
-
}
|
|
1160
|
-
return undefined;
|
|
1161
|
-
}
|
|
1162
1148
|
function commitHostSingleRemoval(fiber, parent) {
|
|
1163
1149
|
const removed = getSingleRemovedFiber(fiber.alternate?.child, fiber.child);
|
|
1164
1150
|
if (removed === undefined) {
|
|
@@ -1237,6 +1223,17 @@ function collectCommittedHostNodes(fiber) {
|
|
|
1237
1223
|
}
|
|
1238
1224
|
return nodes;
|
|
1239
1225
|
}
|
|
1226
|
+
function getSkippedChild(current) {
|
|
1227
|
+
const child = current?.child;
|
|
1228
|
+
const alternateChild = current?.alternate?.child;
|
|
1229
|
+
if (child !== undefined &&
|
|
1230
|
+
alternateChild !== undefined &&
|
|
1231
|
+
collectCommittedHostNodes(child).length === 0 &&
|
|
1232
|
+
collectCommittedHostNodes(alternateChild).length > 0) {
|
|
1233
|
+
return alternateChild;
|
|
1234
|
+
}
|
|
1235
|
+
return child;
|
|
1236
|
+
}
|
|
1240
1237
|
function finishHostPassthroughFiber(fiber) {
|
|
1241
1238
|
fiber.memoizedProps = fiber.pendingProps;
|
|
1242
1239
|
finishCommittedFiber(fiber);
|
|
@@ -1265,7 +1262,9 @@ function commitHostFiber(fiber, parent, eventRoot, path, options = {}) {
|
|
|
1265
1262
|
if (fiber.hydrateExisting !== true &&
|
|
1266
1263
|
fiber.flags === NoFlags &&
|
|
1267
1264
|
fiber.subtreeFlags === NoFlags &&
|
|
1268
|
-
fiber.hostChildListChanged !== true
|
|
1265
|
+
fiber.hostChildListChanged !== true &&
|
|
1266
|
+
fiber.childListChanged !== true &&
|
|
1267
|
+
fiber.subtreeChildListChanged !== true) {
|
|
1269
1268
|
fiber.memoizedProps = fiber.pendingProps;
|
|
1270
1269
|
return [element];
|
|
1271
1270
|
}
|
|
@@ -1302,6 +1301,7 @@ function commitHostFiber(fiber, parent, eventRoot, path, options = {}) {
|
|
|
1302
1301
|
}
|
|
1303
1302
|
else if (fiber.hostChildListChanged ||
|
|
1304
1303
|
fiber.childListChanged ||
|
|
1304
|
+
fiber.subtreeChildListChanged ||
|
|
1305
1305
|
fiber.hydrateExisting === true ||
|
|
1306
1306
|
(fiber.subtreeFlags & Placement) !== NoFlags) {
|
|
1307
1307
|
const childNodes = commitHostChildren(fiber.child, element, eventRoot, `${path}.c`, options);
|