@lvce-editor/renderer-process 10.7.0 → 10.8.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,8 +2089,8 @@ 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');
@@ -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,24 +2439,23 @@ 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 handleClickToggleReplace = event => {
2454
2457
  preventDefault(event);
2455
- toggleReplace(uid);
2458
+ return ['FindWidget.toggleReplace'];
2456
2459
  };
2457
2460
  const handleClick$8 = event => {
2458
2461
  const {
@@ -2461,37 +2464,34 @@ const handleClick$8 = event => {
2461
2464
  const {
2462
2465
  title
2463
2466
  } = target;
2464
- const uid = fromEvent(event);
2465
2467
  switch (title) {
2466
2468
  case 'Close':
2467
- handleClickClose$2(uid, event);
2468
- break;
2469
+ return handleClickClose$2(event);
2469
2470
  case 'Previous Match':
2470
- handleClickPreviousMatch(uid, event);
2471
- break;
2471
+ return handleClickPreviousMatch(event);
2472
2472
  case 'Next Match':
2473
- handleClickNextMatch(uid, event);
2474
- break;
2473
+ return handleClickNextMatch(event);
2475
2474
  case 'Toggle Replace':
2476
- handleClickToggleReplace(uid, event);
2477
- break;
2475
+ return handleClickToggleReplace(event);
2476
+ default:
2477
+ return [];
2478
2478
  }
2479
2479
  };
2480
2480
  const handleInputBlur = event => {
2481
- const uid = fromEvent(event);
2482
- handleBlur$a(uid);
2481
+ return ['FindWidget.handleBlur'];
2483
2482
  };
2484
2483
  const handleFocus$b = event => {
2485
- const uid = fromEvent(event);
2486
- handleFocus$c(uid);
2484
+ return ['FindWidget.handleFocus'];
2487
2485
  };
2486
+ const returnValue$9 = true;
2488
2487
 
2489
2488
  const ViewletFindWidgetEvents = {
2490
2489
  __proto__: null,
2491
2490
  handleClick: handleClick$8,
2492
2491
  handleFocus: handleFocus$b,
2493
2492
  handleInput: handleInput$7,
2494
- handleInputBlur
2493
+ handleInputBlur,
2494
+ returnValue: returnValue$9
2495
2495
  };
2496
2496
 
2497
2497
  const create$H = () => {
@@ -2511,6 +2511,7 @@ const focus$i = state => {
2511
2511
  return;
2512
2512
  }
2513
2513
  $InputBox.focus();
2514
+ applyUidWorkaround($Viewlet);
2514
2515
  };
2515
2516
  const setValue$4 = (state, value) => {
2516
2517
  const {
@@ -5802,8 +5803,18 @@ const setDom2 = (viewletId, dom) => {
5802
5803
  const {
5803
5804
  $Viewlet
5804
5805
  } = instance.state;
5806
+ let uid;
5807
+ if ($Viewlet) {
5808
+ try {
5809
+ uid = get$6($Viewlet);
5810
+ } catch {}
5811
+ }
5805
5812
  // TODO optimize rendering with virtual dom diffing
5806
5813
  const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
5814
+ if (uid) {
5815
+ // @ts-ignore
5816
+ set$5($NewViewlet, uid);
5817
+ }
5807
5818
  instance.state.$Viewlet = $NewViewlet;
5808
5819
  };
5809
5820
 
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.8.0",
4
4
  "description": "",
5
5
  "main": "dist/rendererProcessMain.js",
6
6
  "type": "module",