@lvce-editor/renderer-process 10.7.0 → 10.9.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.
@@ -1226,6 +1226,9 @@ var getUidTarget = $Element => {
1226
1226
  };
1227
1227
  var getComponentUid = $Element => {
1228
1228
  const $Target = getUidTarget($Element);
1229
+ if (!$Target) {
1230
+ return 0;
1231
+ }
1229
1232
  return $Target[uidSymbol];
1230
1233
  };
1231
1234
  var getComponentUidFromEvent = event => {
@@ -1695,6 +1698,17 @@ const set$5 = setComponentUid;
1695
1698
  const get$6 = getComponentUid;
1696
1699
  const fromEvent = getComponentUidFromEvent;
1697
1700
 
1701
+ const applyUidWorkaround = element => {
1702
+ // TODO editor widget uids are not available in renderer worker
1703
+ // TODO send editor events directly to editor worker
1704
+ const editor = document.querySelector('.Viewlet.Editor');
1705
+ if (!editor) {
1706
+ throw new Error('no editor found');
1707
+ }
1708
+ const editorUid = get$6(editor);
1709
+ set$5(element, editorUid);
1710
+ };
1711
+
1698
1712
  const setBounds$8 = ($Element, x, y, width, height) => {
1699
1713
  $Element.style.top = `${y}px`;
1700
1714
  $Element.style.left = `${x}px`;
@@ -1888,12 +1902,12 @@ const handlePointerDown$7 = event => {
1888
1902
  }
1889
1903
  return [];
1890
1904
  };
1891
- const returnValue$a = true;
1905
+ const returnValue$b = true;
1892
1906
 
1893
1907
  const ViewletColorPickerEvents = {
1894
1908
  __proto__: null,
1895
1909
  handlePointerDown: handlePointerDown$7,
1896
- returnValue: returnValue$a
1910
+ returnValue: returnValue$b
1897
1911
  };
1898
1912
 
1899
1913
  const setColor = (state, color) => {
@@ -1910,16 +1924,6 @@ const setOffsetX = (state, offsetX) => {
1910
1924
  setXAndYTransform($ColorPickerSliderThumb, offsetX, 0);
1911
1925
  applyUidWorkaround($Viewlet);
1912
1926
  };
1913
- const applyUidWorkaround = element => {
1914
- // TODO editor widget uids are not available in renderer worker
1915
- // TODO send editor events directly to editor worker
1916
- const editor = document.querySelector('.Viewlet.Editor');
1917
- if (!editor) {
1918
- throw new Error('no editor found');
1919
- }
1920
- const editorUid = get$6(editor);
1921
- set$5(element, editorUid);
1922
- };
1923
1927
  const appendWidget$2 = state => {
1924
1928
  const {
1925
1929
  $Viewlet
@@ -2076,7 +2080,7 @@ const forwardViewletCommand = name => {
2076
2080
  };
2077
2081
 
2078
2082
  forwardViewletCommand('clearFilter');
2079
- const close$1 = forwardViewletCommand('close');
2083
+ forwardViewletCommand('close');
2080
2084
  forwardViewletCommand('closeEditor');
2081
2085
  const closeMenu$1 = forwardViewletCommand('closeMenu');
2082
2086
  forwardViewletCommand('compositionEnd');
@@ -2085,14 +2089,14 @@ forwardViewletCommand('compositionUpdate');
2085
2089
  forwardViewletCommand('cut');
2086
2090
  forwardViewletCommand('focus');
2087
2091
  forwardViewletCommand('focusIndex');
2088
- const focusNext = forwardViewletCommand('focusNext');
2089
- const focusPrevious$1 = forwardViewletCommand('focusPrevious');
2092
+ forwardViewletCommand('focusNext');
2093
+ forwardViewletCommand('focusPrevious');
2090
2094
  const handleAudioError$1 = forwardViewletCommand('handleAudioError');
2091
2095
  const handleBeforeInput$2 = forwardViewletCommand('handleBeforeInput');
2092
2096
  forwardViewletCommand('handleBeforeInputFromContentEditable');
2093
2097
  const handleBlur$a = forwardViewletCommand('handleBlur');
2094
2098
  const handleButtonClick = forwardViewletCommand('handleButtonClick');
2095
- const handleClick$9 = forwardViewletCommand('handleClick');
2099
+ const handleClick$8 = forwardViewletCommand('handleClick');
2096
2100
  const handleClickAction$2 = forwardViewletCommand('handleClickAction');
2097
2101
  forwardViewletCommand('handleClickAdd');
2098
2102
  const handleClickAt$3 = forwardViewletCommand('handleClickAt');
@@ -2166,7 +2170,7 @@ forwardViewletCommand('setDelta');
2166
2170
  forwardViewletCommand('toggleMatchCase');
2167
2171
  forwardViewletCommand('toggleMatchWholeWord');
2168
2172
  const toggleMaximize = forwardViewletCommand('toggleMaximize');
2169
- const toggleReplace = forwardViewletCommand('toggleReplace');
2173
+ forwardViewletCommand('toggleReplace');
2170
2174
  forwardViewletCommand('toggleUseRegularExpression');
2171
2175
  forwardViewletCommand('type');
2172
2176
  forwardViewletCommand('typeWithAutoClosing');
@@ -2371,12 +2375,12 @@ const ViewletEditorCompletion = {
2371
2375
  const handleClose = () => {
2372
2376
  return ['closeDetails'];
2373
2377
  };
2374
- const returnValue$9 = true;
2378
+ const returnValue$a = true;
2375
2379
 
2376
2380
  const ViewletEditorCompletionDetailsEvents = {
2377
2381
  __proto__: null,
2378
2382
  handleClose,
2379
- returnValue: returnValue$9
2383
+ returnValue: returnValue$a
2380
2384
  };
2381
2385
 
2382
2386
  const create$I = () => {
@@ -2435,63 +2439,60 @@ const handleInput$7 = event => {
2435
2439
  const {
2436
2440
  value
2437
2441
  } = target;
2438
- const uid = fromEvent(event);
2439
- handleInput$8(uid, value);
2442
+ return ['FindWidget.handleInput', value];
2440
2443
  };
2441
- const handleClickClose$2 = (uid, event) => {
2444
+ const handleClickClose$2 = event => {
2442
2445
  preventDefault(event);
2443
- close$1(uid);
2446
+ return ['FindWidget.close'];
2444
2447
  };
2445
- const handleClickPreviousMatch = (uid, event) => {
2448
+ const handleClickPreviousMatch = event => {
2446
2449
  preventDefault(event);
2447
- focusPrevious$1(uid);
2450
+ return ['FindWidget.focusPrevious'];
2448
2451
  };
2449
- const handleClickNextMatch = (uid, event) => {
2452
+ const handleClickNextMatch = event => {
2450
2453
  preventDefault(event);
2451
- focusNext(uid);
2454
+ return ['FindWidget.focusNext'];
2452
2455
  };
2453
- const handleClickToggleReplace = (uid, event) => {
2456
+ const handleClickReplace = event => {
2454
2457
  preventDefault(event);
2455
- toggleReplace(uid);
2458
+ return ['FindWidget.replace'];
2456
2459
  };
2457
- const handleClick$8 = event => {
2458
- const {
2459
- target
2460
- } = event;
2461
- const {
2462
- title
2463
- } = target;
2464
- const uid = fromEvent(event);
2465
- switch (title) {
2466
- case 'Close':
2467
- handleClickClose$2(uid, event);
2468
- break;
2469
- case 'Previous Match':
2470
- handleClickPreviousMatch(uid, event);
2471
- break;
2472
- case 'Next Match':
2473
- handleClickNextMatch(uid, event);
2474
- break;
2475
- case 'Toggle Replace':
2476
- handleClickToggleReplace(uid, event);
2477
- break;
2478
- }
2460
+ const handleClickReplaceAll = event => {
2461
+ preventDefault(event);
2462
+ return ['FindWidget.replaceAll'];
2463
+ };
2464
+ const handleClickToggleReplace = event => {
2465
+ preventDefault(event);
2466
+ return ['FindWidget.toggleReplace'];
2479
2467
  };
2480
2468
  const handleInputBlur = event => {
2481
- const uid = fromEvent(event);
2482
- handleBlur$a(uid);
2469
+ return ['FindWidget.handleBlur'];
2470
+ };
2471
+ const handleReplaceInput$1 = event => {
2472
+ return ['FindWidget.handleReplaceInput'];
2473
+ };
2474
+ const handleReplaceFocus = event => {
2475
+ return ['FindWidget.handleReplaceFocus'];
2483
2476
  };
2484
2477
  const handleFocus$b = event => {
2485
- const uid = fromEvent(event);
2486
- handleFocus$c(uid);
2478
+ return ['FindWidget.handleFocus'];
2487
2479
  };
2480
+ const returnValue$9 = true;
2488
2481
 
2489
2482
  const ViewletFindWidgetEvents = {
2490
2483
  __proto__: null,
2491
- handleClick: handleClick$8,
2484
+ handleClickClose: handleClickClose$2,
2485
+ handleClickNextMatch,
2486
+ handleClickPreviousMatch,
2487
+ handleClickReplace,
2488
+ handleClickReplaceAll,
2489
+ handleClickToggleReplace,
2492
2490
  handleFocus: handleFocus$b,
2493
2491
  handleInput: handleInput$7,
2494
- handleInputBlur
2492
+ handleInputBlur,
2493
+ handleReplaceFocus,
2494
+ handleReplaceInput: handleReplaceInput$1,
2495
+ returnValue: returnValue$9
2495
2496
  };
2496
2497
 
2497
2498
  const create$H = () => {
@@ -2511,6 +2512,7 @@ const focus$i = state => {
2511
2512
  return;
2512
2513
  }
2513
2514
  $InputBox.focus();
2515
+ applyUidWorkaround($Viewlet);
2514
2516
  };
2515
2517
  const setValue$4 = (state, value) => {
2516
2518
  const {
@@ -5802,8 +5804,18 @@ const setDom2 = (viewletId, dom) => {
5802
5804
  const {
5803
5805
  $Viewlet
5804
5806
  } = instance.state;
5807
+ let uid;
5808
+ if ($Viewlet) {
5809
+ try {
5810
+ uid = get$6($Viewlet);
5811
+ } catch {}
5812
+ }
5805
5813
  // TODO optimize rendering with virtual dom diffing
5806
5814
  const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
5815
+ if (uid) {
5816
+ // @ts-ignore
5817
+ set$5($NewViewlet, uid);
5818
+ }
5807
5819
  instance.state.$Viewlet = $NewViewlet;
5808
5820
  };
5809
5821
 
@@ -8080,7 +8092,7 @@ const handlePointerDown$3 = event => {
8080
8092
  }
8081
8093
  const $Extension = target.closest('.ExtensionListItem');
8082
8094
  const index = getNodeIndex($Extension);
8083
- handleClick$9(uid, index);
8095
+ handleClick$8(uid, index);
8084
8096
  };
8085
8097
  const handleInput$5 = event => {
8086
8098
  const $Target = event.target;
@@ -8370,7 +8382,7 @@ const handleTableClick = event => {
8370
8382
  clientY
8371
8383
  } = event;
8372
8384
  const uid = fromEvent(event);
8373
- handleClick$9(uid, clientX, clientY);
8385
+ handleClick$8(uid, clientX, clientY);
8374
8386
  };
8375
8387
  const handleTableDoubleClick = event => {
8376
8388
  const {
@@ -10335,7 +10347,7 @@ const handleClick$3 = event => {
10335
10347
  if (index === -1) {
10336
10348
  return;
10337
10349
  }
10338
- handleClick$9(uid, index);
10350
+ handleClick$8(uid, index);
10339
10351
  };
10340
10352
  const handleMouseOver = event => {
10341
10353
  const {
@@ -10407,7 +10419,7 @@ const handleClick$2 = event => {
10407
10419
  clientX,
10408
10420
  clientY
10409
10421
  } = event;
10410
- handleClick$9(uid, clientX, clientY);
10422
+ handleClick$8(uid, clientX, clientY);
10411
10423
  };
10412
10424
 
10413
10425
  const ViewletStatusBarEvents = {
@@ -10451,7 +10463,7 @@ const ViewletStatusBar = {
10451
10463
 
10452
10464
  const handleClick$1 = event => {
10453
10465
  const uid = fromEvent(event);
10454
- handleClick$9(uid);
10466
+ handleClick$8(uid);
10455
10467
  };
10456
10468
 
10457
10469
  const ViewletStorageEvents = {
@@ -10834,7 +10846,7 @@ const handleClick = event => {
10834
10846
  } = event;
10835
10847
  const index = getIndex(target);
10836
10848
  const uid = fromEvent(event);
10837
- handleClick$9(uid, button, index);
10849
+ handleClick$8(uid, button, index);
10838
10850
  };
10839
10851
  const getLevelAndIndex = event => {
10840
10852
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "10.7.0",
3
+ "version": "10.9.0",
4
4
  "description": "",
5
5
  "main": "dist/rendererProcessMain.js",
6
6
  "type": "module",