@lvce-editor/renderer-process 30.46.5 → 30.48.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.
@@ -1247,11 +1247,14 @@ const retainItems = dataTransfer => {
1247
1247
  }
1248
1248
  return items;
1249
1249
  };
1250
- const add$2 = dataTransfer => {
1250
+ const addItems = items => {
1251
1251
  const id = create$1();
1252
- state$3[id] = retainItems(dataTransfer);
1252
+ state$3[id] = items;
1253
1253
  return id;
1254
1254
  };
1255
+ const add$2 = dataTransfer => {
1256
+ return addItems(retainItems(dataTransfer));
1257
+ };
1255
1258
 
1256
1259
  const state$2 = Object.create(null);
1257
1260
  const add$1 = promise => {
@@ -1308,15 +1311,6 @@ const unwrapItem = item => {
1308
1311
  return unknownItem;
1309
1312
  }
1310
1313
  };
1311
- const handleDataTransferFiles = event => {
1312
- if (!event.dataTransfer) {
1313
- return [];
1314
- }
1315
- const items = [...event.dataTransfer.items];
1316
- const promises = items.map(unwrapItem);
1317
- const ids = promises.map(promise => add$1(promise));
1318
- return ids;
1319
- };
1320
1314
  const handleClipboardDataFiles = event => {
1321
1315
  if (!event.clipboardData) {
1322
1316
  return [];
@@ -1387,8 +1381,6 @@ const getEventListenerArg = (param, event) => {
1387
1381
  return event.data;
1388
1382
  case 'event.dataTransfer.files':
1389
1383
  return event.dataTransfer.files;
1390
- case 'event.dataTransfer.files2':
1391
- return handleDataTransferFiles(event);
1392
1384
  case 'event.defaultPrevented':
1393
1385
  return event.defaultPrevented;
1394
1386
  case 'event.deltaMode':
@@ -2315,17 +2307,16 @@ const NavigateParent = 8;
2315
2307
  const RemoveChild = 9;
2316
2308
  const NavigateSibling = 10;
2317
2309
  const SetReferenceNodeUid = 11;
2310
+ const MultiNavigation = 18;
2318
2311
 
2319
- const handleNavigateChild = (state, patches, patchIndex) => {
2320
- const patch = patches[patchIndex];
2312
+ const handleNavigateChild = (state, index, nextPatchType) => {
2321
2313
  const $Children = state.current.childNodes;
2322
- const $Child = $Children[patch.index];
2314
+ const $Child = $Children[index];
2323
2315
  if ($Child) {
2324
2316
  state.current = $Child;
2325
2317
  return true;
2326
2318
  }
2327
- const nextPatch = patches[patchIndex + 1];
2328
- if (nextPatch && (nextPatch.type === Replace || nextPatch.type === SetReferenceNodeUid) && patch.index === $Children.length) {
2319
+ if ((nextPatchType === Replace || nextPatchType === SetReferenceNodeUid) && index === $Children.length) {
2329
2320
  const $Placeholder = document.createComment('virtual-dom-placeholder');
2330
2321
  state.current.append($Placeholder);
2331
2322
  state.current = $Placeholder;
@@ -2333,7 +2324,7 @@ const handleNavigateChild = (state, patches, patchIndex) => {
2333
2324
  }
2334
2325
  console.error('Cannot navigate to child: child not found at index', {
2335
2326
  $Current: state.current,
2336
- index: patch.index,
2327
+ index,
2337
2328
  childCount: $Children.length
2338
2329
  });
2339
2330
  return false;
@@ -2349,7 +2340,7 @@ const handleNavigateParent = state => {
2349
2340
  state.current = $Parent;
2350
2341
  return true;
2351
2342
  };
2352
- const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
2343
+ const handleNavigateSibling = (state, index, $Element, patchIndex) => {
2353
2344
  const $Parent = state.current.parentNode;
2354
2345
  if (!$Parent) {
2355
2346
  console.error('Cannot navigate to sibling: current node has no parent', {
@@ -2357,14 +2348,14 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
2357
2348
  });
2358
2349
  return false;
2359
2350
  }
2360
- let $Sibling = $Parent.childNodes[patch.index];
2351
+ let $Sibling = $Parent.childNodes[index];
2361
2352
  if (!$Sibling && !state.hasAppliedMutation && state.current !== $Element) {
2362
- $Sibling = $Element.childNodes[patch.index];
2353
+ $Sibling = $Element.childNodes[index];
2363
2354
  }
2364
2355
  if (!$Sibling) {
2365
2356
  console.error('Cannot navigate to sibling: sibling not found at index', {
2366
2357
  $Parent,
2367
- index: patch.index,
2358
+ index,
2368
2359
  childCount: $Parent.childNodes.length
2369
2360
  });
2370
2361
  return false;
@@ -2372,6 +2363,32 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
2372
2363
  state.current = $Sibling;
2373
2364
  return true;
2374
2365
  };
2366
+ const handleSingleNavigation = (state, type, index, nextPatchType, $Element, patchIndex) => {
2367
+ switch (type) {
2368
+ case NavigateChild:
2369
+ return handleNavigateChild(state, index, nextPatchType);
2370
+ case NavigateParent:
2371
+ return handleNavigateParent(state);
2372
+ case NavigateSibling:
2373
+ return handleNavigateSibling(state, index, $Element, patchIndex);
2374
+ default:
2375
+ console.error('Unknown navigation type', {
2376
+ type
2377
+ });
2378
+ return false;
2379
+ }
2380
+ };
2381
+ const handleMultiNavigation = (state, navigations, nextPatchType, $Element, patchIndex) => {
2382
+ for (let i = 0; i < navigations.length; i += 2) {
2383
+ const type = navigations[i];
2384
+ const index = navigations[i + 1];
2385
+ const nextType = navigations[i + 2] ?? nextPatchType;
2386
+ if (!handleSingleNavigation(state, type, index, nextType, $Element, patchIndex)) {
2387
+ return false;
2388
+ }
2389
+ }
2390
+ return true;
2391
+ };
2375
2392
  const handleSetReferenceNodeUid = (state, patch) => {
2376
2393
  const instance = get$2(patch.uid);
2377
2394
  if (!instance || !instance.state) {
@@ -2389,12 +2406,14 @@ const handleSetReferenceNodeUid = (state, patch) => {
2389
2406
  };
2390
2407
  const handleNavigationPatch = (state, patch, patches, patchIndex, $Element) => {
2391
2408
  switch (patch.type) {
2409
+ case MultiNavigation:
2410
+ return handleMultiNavigation(state, patch.navigations, patches[patchIndex + 1]?.type, $Element, patchIndex);
2392
2411
  case NavigateChild:
2393
- return handleNavigateChild(state, patches, patchIndex);
2412
+ return handleNavigateChild(state, patch.index, patches[patchIndex + 1]?.type);
2394
2413
  case NavigateParent:
2395
2414
  return handleNavigateParent(state);
2396
2415
  case NavigateSibling:
2397
- return handleNavigateSibling(state, patch, $Element, patchIndex);
2416
+ return handleNavigateSibling(state, patch.index, $Element, patchIndex);
2398
2417
  default:
2399
2418
  return true;
2400
2419
  }
@@ -380,11 +380,14 @@ const retainItems = dataTransfer => {
380
380
  }
381
381
  return items;
382
382
  };
383
- const add$2 = dataTransfer => {
383
+ const addItems = items => {
384
384
  const id = create$J();
385
- state$e[id] = retainItems(dataTransfer);
385
+ state$e[id] = items;
386
386
  return id;
387
387
  };
388
+ const add$2 = dataTransfer => {
389
+ return addItems(retainItems(dataTransfer));
390
+ };
388
391
  const acquire$2 = id => {
389
392
  const items = state$e[id];
390
393
  if (!items) {
@@ -463,15 +466,6 @@ const unwrapItem = item => {
463
466
  return unknownItem;
464
467
  }
465
468
  };
466
- const handleDataTransferFiles = event => {
467
- if (!event.dataTransfer) {
468
- return [];
469
- }
470
- const items = [...event.dataTransfer.items];
471
- const promises = items.map(unwrapItem);
472
- const ids = promises.map(promise => add$1(promise));
473
- return ids;
474
- };
475
469
  const handleClipboardDataFiles = event => {
476
470
  if (!event.clipboardData) {
477
471
  return [];
@@ -542,8 +536,6 @@ const getEventListenerArg = (param, event) => {
542
536
  return event.data;
543
537
  case 'event.dataTransfer.files':
544
538
  return event.dataTransfer.files;
545
- case 'event.dataTransfer.files2':
546
- return handleDataTransferFiles(event);
547
539
  case 'event.defaultPrevented':
548
540
  return event.defaultPrevented;
549
541
  case 'event.deltaMode':
@@ -1751,17 +1743,16 @@ const NavigateParent = 8;
1751
1743
  const RemoveChild = 9;
1752
1744
  const NavigateSibling = 10;
1753
1745
  const SetReferenceNodeUid = 11;
1746
+ const MultiNavigation = 18;
1754
1747
 
1755
- const handleNavigateChild = (state, patches, patchIndex) => {
1756
- const patch = patches[patchIndex];
1748
+ const handleNavigateChild = (state, index, nextPatchType) => {
1757
1749
  const $Children = state.current.childNodes;
1758
- const $Child = $Children[patch.index];
1750
+ const $Child = $Children[index];
1759
1751
  if ($Child) {
1760
1752
  state.current = $Child;
1761
1753
  return true;
1762
1754
  }
1763
- const nextPatch = patches[patchIndex + 1];
1764
- if (nextPatch && (nextPatch.type === Replace || nextPatch.type === SetReferenceNodeUid) && patch.index === $Children.length) {
1755
+ if ((nextPatchType === Replace || nextPatchType === SetReferenceNodeUid) && index === $Children.length) {
1765
1756
  const $Placeholder = document.createComment('virtual-dom-placeholder');
1766
1757
  state.current.append($Placeholder);
1767
1758
  state.current = $Placeholder;
@@ -1769,7 +1760,7 @@ const handleNavigateChild = (state, patches, patchIndex) => {
1769
1760
  }
1770
1761
  console.error('Cannot navigate to child: child not found at index', {
1771
1762
  $Current: state.current,
1772
- index: patch.index,
1763
+ index,
1773
1764
  childCount: $Children.length
1774
1765
  });
1775
1766
  return false;
@@ -1785,7 +1776,7 @@ const handleNavigateParent = state => {
1785
1776
  state.current = $Parent;
1786
1777
  return true;
1787
1778
  };
1788
- const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
1779
+ const handleNavigateSibling = (state, index, $Element, patchIndex) => {
1789
1780
  const $Parent = state.current.parentNode;
1790
1781
  if (!$Parent) {
1791
1782
  console.error('Cannot navigate to sibling: current node has no parent', {
@@ -1793,14 +1784,14 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
1793
1784
  });
1794
1785
  return false;
1795
1786
  }
1796
- let $Sibling = $Parent.childNodes[patch.index];
1787
+ let $Sibling = $Parent.childNodes[index];
1797
1788
  if (!$Sibling && !state.hasAppliedMutation && state.current !== $Element) {
1798
- $Sibling = $Element.childNodes[patch.index];
1789
+ $Sibling = $Element.childNodes[index];
1799
1790
  }
1800
1791
  if (!$Sibling) {
1801
1792
  console.error('Cannot navigate to sibling: sibling not found at index', {
1802
1793
  $Parent,
1803
- index: patch.index,
1794
+ index,
1804
1795
  childCount: $Parent.childNodes.length
1805
1796
  });
1806
1797
  return false;
@@ -1808,6 +1799,32 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
1808
1799
  state.current = $Sibling;
1809
1800
  return true;
1810
1801
  };
1802
+ const handleSingleNavigation = (state, type, index, nextPatchType, $Element, patchIndex) => {
1803
+ switch (type) {
1804
+ case NavigateChild:
1805
+ return handleNavigateChild(state, index, nextPatchType);
1806
+ case NavigateParent:
1807
+ return handleNavigateParent(state);
1808
+ case NavigateSibling:
1809
+ return handleNavigateSibling(state, index, $Element, patchIndex);
1810
+ default:
1811
+ console.error('Unknown navigation type', {
1812
+ type
1813
+ });
1814
+ return false;
1815
+ }
1816
+ };
1817
+ const handleMultiNavigation = (state, navigations, nextPatchType, $Element, patchIndex) => {
1818
+ for (let i = 0; i < navigations.length; i += 2) {
1819
+ const type = navigations[i];
1820
+ const index = navigations[i + 1];
1821
+ const nextType = navigations[i + 2] ?? nextPatchType;
1822
+ if (!handleSingleNavigation(state, type, index, nextType, $Element, patchIndex)) {
1823
+ return false;
1824
+ }
1825
+ }
1826
+ return true;
1827
+ };
1811
1828
  const handleSetReferenceNodeUid = (state, patch) => {
1812
1829
  const instance = get$a(patch.uid);
1813
1830
  if (!instance || !instance.state) {
@@ -1825,12 +1842,14 @@ const handleSetReferenceNodeUid = (state, patch) => {
1825
1842
  };
1826
1843
  const handleNavigationPatch = (state, patch, patches, patchIndex, $Element) => {
1827
1844
  switch (patch.type) {
1845
+ case MultiNavigation:
1846
+ return handleMultiNavigation(state, patch.navigations, patches[patchIndex + 1]?.type, $Element, patchIndex);
1828
1847
  case NavigateChild:
1829
- return handleNavigateChild(state, patches, patchIndex);
1848
+ return handleNavigateChild(state, patch.index, patches[patchIndex + 1]?.type);
1830
1849
  case NavigateParent:
1831
1850
  return handleNavigateParent(state);
1832
1851
  case NavigateSibling:
1833
- return handleNavigateSibling(state, patch, $Element, patchIndex);
1852
+ return handleNavigateSibling(state, patch.index, $Element, patchIndex);
1834
1853
  default:
1835
1854
  return true;
1836
1855
  }
@@ -5460,6 +5479,27 @@ const SingleElementConditions = {
5460
5479
  toHaveValue
5461
5480
  };
5462
5481
 
5482
+ const retainItem = (item, index) => {
5483
+ if (item.kind === 'string') {
5484
+ return {
5485
+ index,
5486
+ kind: 'string',
5487
+ type: item.type,
5488
+ value: Promise.resolve(item.value)
5489
+ };
5490
+ }
5491
+ return {
5492
+ file: item.file ?? null,
5493
+ fileSystemHandle: Promise.resolve(item.fileSystemHandle),
5494
+ index,
5495
+ kind: 'file',
5496
+ type: item.type
5497
+ };
5498
+ };
5499
+ const createDropSession = items => {
5500
+ return addItems(items.map(retainItem));
5501
+ };
5502
+
5463
5503
  const conditionTimeout = 2000;
5464
5504
  const mutationTimeout = 100;
5465
5505
  const waitForMutation = maxDelay => {
@@ -10509,6 +10549,7 @@ const commandMap = {
10509
10549
  'TestFrameWork.checkConditionError': checkConditionError,
10510
10550
  'TestFrameWork.checkMultiElementCondition': checkMultiElementCondition,
10511
10551
  'TestFrameWork.checkSingleElementCondition': checkSingleElementCondition,
10552
+ 'TestFrameWork.createDropSession': createDropSession,
10512
10553
  'TestFrameWork.performAction': performAction,
10513
10554
  'TestFrameWork.performAction2': performAction2,
10514
10555
  'TestFrameWork.performKeyBoardAction': performKeyboardAction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.46.5",
3
+ "version": "30.48.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"