@lvce-editor/panel-worker 2.13.5 → 2.14.0
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/panelWorkerMain.js +158 -199
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -657,6 +657,9 @@ const restoreExistingError = (error, currentStack) => {
|
|
|
657
657
|
};
|
|
658
658
|
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
659
659
|
const restoredError = new JsonRpcError(error.message);
|
|
660
|
+
Object.assign(restoredError, {
|
|
661
|
+
code: error.code
|
|
662
|
+
});
|
|
660
663
|
const parentStack = getParentStack(error);
|
|
661
664
|
setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
|
|
662
665
|
return restoredError;
|
|
@@ -676,9 +679,13 @@ const applyDataProperties = (restoredError, error) => {
|
|
|
676
679
|
// @ts-ignore
|
|
677
680
|
restoredError.codeFrame = error.data.codeFrame;
|
|
678
681
|
}
|
|
679
|
-
if (error.data.code) {
|
|
682
|
+
if (typeof error.data.code === 'string' || typeof error.data.code === 'number') {
|
|
680
683
|
// @ts-ignore
|
|
681
|
-
restoredError
|
|
684
|
+
Object.defineProperty(restoredError, 'code', {
|
|
685
|
+
configurable: true,
|
|
686
|
+
value: error.data.code,
|
|
687
|
+
writable: true
|
|
688
|
+
});
|
|
682
689
|
}
|
|
683
690
|
if (error.data.type) {
|
|
684
691
|
// @ts-ignore
|
|
@@ -699,7 +706,14 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
699
706
|
}
|
|
700
707
|
};
|
|
701
708
|
const restoreMessageError = (error, _currentStack) => {
|
|
702
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
709
|
+
const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
|
|
710
|
+
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
711
|
+
Object.defineProperty(restoredError, 'code', {
|
|
712
|
+
configurable: true,
|
|
713
|
+
value: error.code,
|
|
714
|
+
writable: true
|
|
715
|
+
});
|
|
716
|
+
}
|
|
703
717
|
if (error.data) {
|
|
704
718
|
applyDataProperties(restoredError, error);
|
|
705
719
|
} else {
|
|
@@ -707,6 +721,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
707
721
|
}
|
|
708
722
|
return restoredError;
|
|
709
723
|
};
|
|
724
|
+
const getFallbackMessage = error => {
|
|
725
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
726
|
+
return error.message;
|
|
727
|
+
}
|
|
728
|
+
if (error && error.data) {
|
|
729
|
+
return getFallbackMessage(error.data);
|
|
730
|
+
}
|
|
731
|
+
const stringified = String(error);
|
|
732
|
+
if (stringified !== '[object Object]') {
|
|
733
|
+
return stringified;
|
|
734
|
+
}
|
|
735
|
+
try {
|
|
736
|
+
return JSON.stringify(error);
|
|
737
|
+
} catch {
|
|
738
|
+
return stringified;
|
|
739
|
+
}
|
|
740
|
+
};
|
|
710
741
|
const restoreJsonRpcError = error => {
|
|
711
742
|
const currentStack = getCurrentStack();
|
|
712
743
|
if (error && error instanceof Error) {
|
|
@@ -715,13 +746,13 @@ const restoreJsonRpcError = error => {
|
|
|
715
746
|
if (error && error.code && error.code === MethodNotFound) {
|
|
716
747
|
return restoreMethodNotFoundError(error, currentStack);
|
|
717
748
|
}
|
|
749
|
+
if (error && error.error) {
|
|
750
|
+
return restoreJsonRpcError(error.error);
|
|
751
|
+
}
|
|
718
752
|
if (error && error.message) {
|
|
719
753
|
return restoreMessageError(error);
|
|
720
754
|
}
|
|
721
|
-
|
|
722
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
723
|
-
}
|
|
724
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
755
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
725
756
|
};
|
|
726
757
|
const unwrapJsonRpcResult = responseMessage => {
|
|
727
758
|
if ('error' in responseMessage) {
|
|
@@ -778,9 +809,9 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
778
809
|
return {
|
|
779
810
|
code: Custom,
|
|
780
811
|
data: {
|
|
781
|
-
code: prettyError.code,
|
|
812
|
+
code: prettyError.code ?? error?.code,
|
|
782
813
|
codeFrame: prettyError.codeFrame,
|
|
783
|
-
name: prettyError.name,
|
|
814
|
+
name: prettyError.name ?? error?.name,
|
|
784
815
|
stack: getStack(prettyError),
|
|
785
816
|
type: getErrorType(prettyError)
|
|
786
817
|
},
|
|
@@ -815,7 +846,12 @@ const getErrorResponseSimple = (id, error) => {
|
|
|
815
846
|
return {
|
|
816
847
|
error: {
|
|
817
848
|
code: Custom,
|
|
818
|
-
data: error
|
|
849
|
+
data: error instanceof Error ? {
|
|
850
|
+
...error,
|
|
851
|
+
code: 'code' in error ? error.code : undefined,
|
|
852
|
+
stack: error.stack,
|
|
853
|
+
type: error.name
|
|
854
|
+
} : error,
|
|
819
855
|
// @ts-ignore
|
|
820
856
|
message: error.message
|
|
821
857
|
},
|
|
@@ -997,6 +1033,9 @@ const logError = () => {
|
|
|
997
1033
|
// handled by renderer worker
|
|
998
1034
|
};
|
|
999
1035
|
const handleMessage = event => {
|
|
1036
|
+
if (event.data === 'ready') {
|
|
1037
|
+
return Promise.resolve();
|
|
1038
|
+
}
|
|
1000
1039
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1001
1040
|
const actualExecute = event?.target?.execute || execute;
|
|
1002
1041
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
@@ -1121,175 +1160,11 @@ const Tab$1 = 'tab';
|
|
|
1121
1160
|
const TabList = 'tablist';
|
|
1122
1161
|
const ToolBar = 'toolbar';
|
|
1123
1162
|
|
|
1124
|
-
const Audio = 0;
|
|
1125
1163
|
const Button$1 = 1;
|
|
1126
|
-
const Col = 2;
|
|
1127
|
-
const ColGroup = 3;
|
|
1128
1164
|
const Div = 4;
|
|
1129
|
-
const H1 = 5;
|
|
1130
|
-
const Input = 6;
|
|
1131
|
-
const Kbd = 7;
|
|
1132
|
-
const Span = 8;
|
|
1133
|
-
const Table = 9;
|
|
1134
|
-
const TBody = 10;
|
|
1135
|
-
const Td = 11;
|
|
1136
1165
|
const Text = 12;
|
|
1137
|
-
const Th = 13;
|
|
1138
|
-
const THead = 14;
|
|
1139
|
-
const Tr = 15;
|
|
1140
|
-
const I = 16;
|
|
1141
|
-
const Img = 17;
|
|
1142
|
-
const Root = 0;
|
|
1143
|
-
const Ins = 20;
|
|
1144
|
-
const Del = 21;
|
|
1145
|
-
const H2 = 22;
|
|
1146
|
-
const H3 = 23;
|
|
1147
|
-
const H4 = 24;
|
|
1148
|
-
const H5 = 25;
|
|
1149
|
-
const H6 = 26;
|
|
1150
|
-
const Article = 27;
|
|
1151
|
-
const Aside = 28;
|
|
1152
|
-
const Footer = 29;
|
|
1153
|
-
const Header = 30;
|
|
1154
|
-
const Nav = 40;
|
|
1155
|
-
const Section = 41;
|
|
1156
|
-
const Search = 42;
|
|
1157
|
-
const Dd = 43;
|
|
1158
|
-
const Dl = 44;
|
|
1159
|
-
const Figcaption = 45;
|
|
1160
|
-
const Figure = 46;
|
|
1161
|
-
const Hr = 47;
|
|
1162
|
-
const Li = 48;
|
|
1163
|
-
const Ol = 49;
|
|
1164
|
-
const P = 50;
|
|
1165
|
-
const Pre = 51;
|
|
1166
|
-
const A = 53;
|
|
1167
|
-
const Abbr = 54;
|
|
1168
|
-
const Br = 55;
|
|
1169
|
-
const Cite = 56;
|
|
1170
|
-
const Data = 57;
|
|
1171
|
-
const Time = 58;
|
|
1172
|
-
const Tfoot = 59;
|
|
1173
|
-
const Ul = 60;
|
|
1174
|
-
const Video = 61;
|
|
1175
|
-
const TextArea = 62;
|
|
1176
|
-
const Select = 63;
|
|
1177
|
-
const Option = 64;
|
|
1178
|
-
const Code = 65;
|
|
1179
|
-
const Label = 66;
|
|
1180
|
-
const Dt = 67;
|
|
1181
|
-
const Iframe = 68;
|
|
1182
|
-
const Main = 69;
|
|
1183
|
-
const Strong = 70;
|
|
1184
|
-
const Em = 71;
|
|
1185
|
-
const Style = 72;
|
|
1186
|
-
const Html = 73;
|
|
1187
|
-
const Head = 74;
|
|
1188
|
-
const Title = 75;
|
|
1189
|
-
const Meta = 76;
|
|
1190
|
-
const Canvas = 77;
|
|
1191
|
-
const Form = 78;
|
|
1192
|
-
const BlockQuote = 79;
|
|
1193
|
-
const Quote = 80;
|
|
1194
|
-
const Circle = 81;
|
|
1195
|
-
const Defs = 82;
|
|
1196
|
-
const Ellipse = 83;
|
|
1197
|
-
const G = 84;
|
|
1198
|
-
const Line = 85;
|
|
1199
|
-
const Path = 86;
|
|
1200
|
-
const Polygon = 87;
|
|
1201
|
-
const Polyline = 88;
|
|
1202
|
-
const Rect = 89;
|
|
1203
|
-
const Svg = 90;
|
|
1204
|
-
const Use = 91;
|
|
1205
1166
|
const Reference = 100;
|
|
1206
1167
|
|
|
1207
|
-
const VirtualDomElements = {
|
|
1208
|
-
__proto__: null,
|
|
1209
|
-
A,
|
|
1210
|
-
Abbr,
|
|
1211
|
-
Article,
|
|
1212
|
-
Aside,
|
|
1213
|
-
Audio,
|
|
1214
|
-
BlockQuote,
|
|
1215
|
-
Br,
|
|
1216
|
-
Button: Button$1,
|
|
1217
|
-
Canvas,
|
|
1218
|
-
Circle,
|
|
1219
|
-
Cite,
|
|
1220
|
-
Code,
|
|
1221
|
-
Col,
|
|
1222
|
-
ColGroup,
|
|
1223
|
-
Data,
|
|
1224
|
-
Dd,
|
|
1225
|
-
Defs,
|
|
1226
|
-
Del,
|
|
1227
|
-
Div,
|
|
1228
|
-
Dl,
|
|
1229
|
-
Dt,
|
|
1230
|
-
Ellipse,
|
|
1231
|
-
Em,
|
|
1232
|
-
Figcaption,
|
|
1233
|
-
Figure,
|
|
1234
|
-
Footer,
|
|
1235
|
-
Form,
|
|
1236
|
-
G,
|
|
1237
|
-
H1,
|
|
1238
|
-
H2,
|
|
1239
|
-
H3,
|
|
1240
|
-
H4,
|
|
1241
|
-
H5,
|
|
1242
|
-
H6,
|
|
1243
|
-
Head,
|
|
1244
|
-
Header,
|
|
1245
|
-
Hr,
|
|
1246
|
-
Html,
|
|
1247
|
-
I,
|
|
1248
|
-
Iframe,
|
|
1249
|
-
Img,
|
|
1250
|
-
Input,
|
|
1251
|
-
Ins,
|
|
1252
|
-
Kbd,
|
|
1253
|
-
Label,
|
|
1254
|
-
Li,
|
|
1255
|
-
Line,
|
|
1256
|
-
Main,
|
|
1257
|
-
Meta,
|
|
1258
|
-
Nav,
|
|
1259
|
-
Ol,
|
|
1260
|
-
Option,
|
|
1261
|
-
P,
|
|
1262
|
-
Path,
|
|
1263
|
-
Polygon,
|
|
1264
|
-
Polyline,
|
|
1265
|
-
Pre,
|
|
1266
|
-
Quote,
|
|
1267
|
-
Rect,
|
|
1268
|
-
Reference,
|
|
1269
|
-
Root,
|
|
1270
|
-
Search,
|
|
1271
|
-
Section,
|
|
1272
|
-
Select,
|
|
1273
|
-
Span,
|
|
1274
|
-
Strong,
|
|
1275
|
-
Style,
|
|
1276
|
-
Svg,
|
|
1277
|
-
TBody,
|
|
1278
|
-
THead,
|
|
1279
|
-
Table,
|
|
1280
|
-
Td,
|
|
1281
|
-
Text,
|
|
1282
|
-
TextArea,
|
|
1283
|
-
Tfoot,
|
|
1284
|
-
Th,
|
|
1285
|
-
Time,
|
|
1286
|
-
Title,
|
|
1287
|
-
Tr,
|
|
1288
|
-
Ul,
|
|
1289
|
-
Use,
|
|
1290
|
-
Video
|
|
1291
|
-
};
|
|
1292
|
-
|
|
1293
1168
|
const Button = 'event.button';
|
|
1294
1169
|
const ClientX = 'event.clientX';
|
|
1295
1170
|
const ClientY = 'event.clientY';
|
|
@@ -1332,7 +1207,8 @@ const create$1 = () => {
|
|
|
1332
1207
|
const commandQueues = new Map();
|
|
1333
1208
|
const generations = Object.create(null);
|
|
1334
1209
|
const states = Object.create(null);
|
|
1335
|
-
const commandMapRef =
|
|
1210
|
+
const commandMapRef = Object.create(null);
|
|
1211
|
+
const commandsById = Object.create(null);
|
|
1336
1212
|
const getGeneration = uid => generations[uid] || 0;
|
|
1337
1213
|
const isCurrentGeneration = (uid, generation) => {
|
|
1338
1214
|
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
@@ -1394,6 +1270,18 @@ const create$1 = () => {
|
|
|
1394
1270
|
delete states[key];
|
|
1395
1271
|
}
|
|
1396
1272
|
},
|
|
1273
|
+
createDirectEventCommandMap(requestRender) {
|
|
1274
|
+
return {
|
|
1275
|
+
async 'Viewlet.executeViewletCommand'(uid, command, ...args) {
|
|
1276
|
+
const fn = commandsById[command];
|
|
1277
|
+
if (!fn) {
|
|
1278
|
+
throw new Error(`Viewlet command not found: ${command}`);
|
|
1279
|
+
}
|
|
1280
|
+
await fn(uid, ...args);
|
|
1281
|
+
await requestRender(uid);
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
},
|
|
1397
1285
|
diff(uid, modules, numbers) {
|
|
1398
1286
|
const {
|
|
1399
1287
|
oldState,
|
|
@@ -1425,6 +1313,9 @@ const create$1 = () => {
|
|
|
1425
1313
|
},
|
|
1426
1314
|
registerCommands(commandMap) {
|
|
1427
1315
|
Object.assign(commandMapRef, commandMap);
|
|
1316
|
+
for (const [key, fn] of Object.entries(commandMap)) {
|
|
1317
|
+
commandsById[toCommandId(key)] = fn;
|
|
1318
|
+
}
|
|
1428
1319
|
},
|
|
1429
1320
|
set(uid, oldState, newState, scheduledState) {
|
|
1430
1321
|
const current = states[uid];
|
|
@@ -2035,8 +1926,6 @@ const text = data => {
|
|
|
2035
1926
|
};
|
|
2036
1927
|
};
|
|
2037
1928
|
|
|
2038
|
-
new Set(Object.values(VirtualDomElements));
|
|
2039
|
-
|
|
2040
1929
|
const SetText = 1;
|
|
2041
1930
|
const Replace = 2;
|
|
2042
1931
|
const SetAttribute = 3;
|
|
@@ -2047,6 +1936,7 @@ const NavigateParent = 8;
|
|
|
2047
1936
|
const RemoveChild = 9;
|
|
2048
1937
|
const NavigateSibling = 10;
|
|
2049
1938
|
const SetReferenceNodeUid = 11;
|
|
1939
|
+
const MultiNavigation = 18;
|
|
2050
1940
|
|
|
2051
1941
|
const isKey = key => {
|
|
2052
1942
|
return key !== 'type' && key !== 'childCount';
|
|
@@ -2107,6 +1997,55 @@ const getChildrenWithCount = (nodes, startIndex, childCount) => {
|
|
|
2107
1997
|
};
|
|
2108
1998
|
};
|
|
2109
1999
|
|
|
2000
|
+
const isNavigationPatch = patch => {
|
|
2001
|
+
switch (patch.type) {
|
|
2002
|
+
case NavigateChild:
|
|
2003
|
+
case NavigateParent:
|
|
2004
|
+
case NavigateSibling:
|
|
2005
|
+
return true;
|
|
2006
|
+
default:
|
|
2007
|
+
return false;
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
const getNavigationIndex = patch => {
|
|
2011
|
+
switch (patch.type) {
|
|
2012
|
+
case NavigateChild:
|
|
2013
|
+
case NavigateSibling:
|
|
2014
|
+
return patch.index;
|
|
2015
|
+
default:
|
|
2016
|
+
return 0;
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
const appendNavigationPatch = (patches, type, index) => {
|
|
2020
|
+
const previousPatch = patches.at(-1);
|
|
2021
|
+
if (!previousPatch) {
|
|
2022
|
+
patches.push(type === NavigateParent ? {
|
|
2023
|
+
type
|
|
2024
|
+
} : {
|
|
2025
|
+
index,
|
|
2026
|
+
type
|
|
2027
|
+
});
|
|
2028
|
+
return;
|
|
2029
|
+
}
|
|
2030
|
+
if (previousPatch.type === MultiNavigation) {
|
|
2031
|
+
previousPatch.navigations.push(type, index);
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
2034
|
+
if (isNavigationPatch(previousPatch)) {
|
|
2035
|
+
patches[patches.length - 1] = {
|
|
2036
|
+
navigations: [previousPatch.type, getNavigationIndex(previousPatch), type, index],
|
|
2037
|
+
type: MultiNavigation
|
|
2038
|
+
};
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
patches.push(type === NavigateParent ? {
|
|
2042
|
+
type
|
|
2043
|
+
} : {
|
|
2044
|
+
index,
|
|
2045
|
+
type
|
|
2046
|
+
});
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2110
2049
|
const compareNodes = (oldNode, newNode) => {
|
|
2111
2050
|
// Check if node type changed - return null to signal incompatible nodes
|
|
2112
2051
|
// (caller should handle this with a Replace operation)
|
|
@@ -2157,34 +2096,31 @@ const compareNodes = (oldNode, newNode) => {
|
|
|
2157
2096
|
};
|
|
2158
2097
|
|
|
2159
2098
|
const treeToArray = node => {
|
|
2160
|
-
const result = [
|
|
2161
|
-
|
|
2162
|
-
|
|
2099
|
+
const result = [];
|
|
2100
|
+
const stack = [node];
|
|
2101
|
+
while (stack.length > 0) {
|
|
2102
|
+
const current = stack.pop();
|
|
2103
|
+
result.push(current.node);
|
|
2104
|
+
for (let i = current.children.length - 1; i >= 0; i--) {
|
|
2105
|
+
stack.push(current.children[i]);
|
|
2106
|
+
}
|
|
2163
2107
|
}
|
|
2164
2108
|
return result;
|
|
2165
2109
|
};
|
|
2166
2110
|
|
|
2167
2111
|
const navigateToChild = (patches, currentChildIndex, index) => {
|
|
2168
2112
|
if (currentChildIndex === -1) {
|
|
2169
|
-
patches
|
|
2170
|
-
type: NavigateChild,
|
|
2171
|
-
index
|
|
2172
|
-
});
|
|
2113
|
+
appendNavigationPatch(patches, NavigateChild, index);
|
|
2173
2114
|
return index;
|
|
2174
2115
|
}
|
|
2175
2116
|
if (currentChildIndex !== index) {
|
|
2176
|
-
patches
|
|
2177
|
-
type: NavigateSibling,
|
|
2178
|
-
index
|
|
2179
|
-
});
|
|
2117
|
+
appendNavigationPatch(patches, NavigateSibling, index);
|
|
2180
2118
|
}
|
|
2181
2119
|
return index;
|
|
2182
2120
|
};
|
|
2183
2121
|
const navigateToParent = (patches, currentChildIndex) => {
|
|
2184
2122
|
if (currentChildIndex >= 0) {
|
|
2185
|
-
patches
|
|
2186
|
-
type: NavigateParent
|
|
2187
|
-
});
|
|
2123
|
+
appendNavigationPatch(patches, NavigateParent, 0);
|
|
2188
2124
|
}
|
|
2189
2125
|
return -1;
|
|
2190
2126
|
};
|
|
@@ -2200,6 +2136,29 @@ const replaceTree = (newNode, patches) => {
|
|
|
2200
2136
|
nodes: treeToArray(newNode)
|
|
2201
2137
|
});
|
|
2202
2138
|
};
|
|
2139
|
+
const appendPatch = (patches, patch) => {
|
|
2140
|
+
switch (patch.type) {
|
|
2141
|
+
case MultiNavigation:
|
|
2142
|
+
for (let i = 0; i < patch.navigations.length; i += 2) {
|
|
2143
|
+
appendNavigationPatch(patches, patch.navigations[i], patch.navigations[i + 1]);
|
|
2144
|
+
}
|
|
2145
|
+
return;
|
|
2146
|
+
case NavigateChild:
|
|
2147
|
+
case NavigateSibling:
|
|
2148
|
+
appendNavigationPatch(patches, patch.type, patch.index);
|
|
2149
|
+
return;
|
|
2150
|
+
case NavigateParent:
|
|
2151
|
+
appendNavigationPatch(patches, patch.type, 0);
|
|
2152
|
+
return;
|
|
2153
|
+
default:
|
|
2154
|
+
patches.push(patch);
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
const appendPatches = (patches, newPatches) => {
|
|
2158
|
+
for (const patch of newPatches) {
|
|
2159
|
+
appendPatch(patches, patch);
|
|
2160
|
+
}
|
|
2161
|
+
};
|
|
2203
2162
|
const diffExistingChild = (oldNode, newNode, patches, currentChildIndex, index) => {
|
|
2204
2163
|
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
2205
2164
|
if (nodePatches === null) {
|
|
@@ -2208,16 +2167,16 @@ const diffExistingChild = (oldNode, newNode, patches, currentChildIndex, index)
|
|
|
2208
2167
|
return nextChildIndex;
|
|
2209
2168
|
}
|
|
2210
2169
|
const hasChildrenToCompare = oldNode.children.length > 0 || newNode.children.length > 0;
|
|
2211
|
-
|
|
2170
|
+
const childPatches = [];
|
|
2171
|
+
if (hasChildrenToCompare) {
|
|
2172
|
+
diffChildren(oldNode.children, newNode.children, childPatches);
|
|
2173
|
+
}
|
|
2174
|
+
if (nodePatches.length === 0 && childPatches.length === 0) {
|
|
2212
2175
|
return currentChildIndex;
|
|
2213
2176
|
}
|
|
2214
2177
|
const nextChildIndex = navigateToChild(patches, currentChildIndex, index);
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
}
|
|
2218
|
-
if (hasChildrenToCompare) {
|
|
2219
|
-
diffChildren(oldNode.children, newNode.children, patches);
|
|
2220
|
-
}
|
|
2178
|
+
patches.push(...nodePatches);
|
|
2179
|
+
appendPatches(patches, childPatches);
|
|
2221
2180
|
return nextChildIndex;
|
|
2222
2181
|
};
|
|
2223
2182
|
const diffRootNode = (oldNode, newNode, patches) => {
|
|
@@ -2273,7 +2232,7 @@ const diffTrees = (oldTree, newTree, patches, path) => {
|
|
|
2273
2232
|
const removeTrailingNavigationPatches = patches => {
|
|
2274
2233
|
while (patches.length > 0) {
|
|
2275
2234
|
const patch = patches.at(-1);
|
|
2276
|
-
if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling) {
|
|
2235
|
+
if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling && patch.type !== MultiNavigation) {
|
|
2277
2236
|
break;
|
|
2278
2237
|
}
|
|
2279
2238
|
patches.pop();
|