@lvce-editor/renderer-process 10.6.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,7 +1698,18 @@ const set$5 = setComponentUid;
1695
1698
  const get$6 = getComponentUid;
1696
1699
  const fromEvent = getComponentUidFromEvent;
1697
1700
 
1698
- const setBounds$7 = ($Element, x, y, width, height) => {
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
+
1712
+ const setBounds$8 = ($Element, x, y, width, height) => {
1699
1713
  $Element.style.top = `${y}px`;
1700
1714
  $Element.style.left = `${x}px`;
1701
1715
  $Element.style.width = `${width}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');
@@ -2346,11 +2350,11 @@ const handleError$8 = (state, error) => {
2346
2350
  } = state;
2347
2351
  $Viewlet.textContent = `${error}`;
2348
2352
  };
2349
- const setBounds$6 = (state, x, y, width, height) => {
2353
+ const setBounds$7 = (state, x, y, width, height) => {
2350
2354
  const {
2351
2355
  $Viewlet
2352
2356
  } = state;
2353
- setBounds$7($Viewlet, x, y, width, height);
2357
+ setBounds$8($Viewlet, x, y, width, height);
2354
2358
  };
2355
2359
 
2356
2360
  const ViewletEditorCompletion = {
@@ -2359,7 +2363,7 @@ const ViewletEditorCompletion = {
2359
2363
  create: create$J,
2360
2364
  dispose: dispose$k,
2361
2365
  handleError: handleError$8,
2362
- setBounds: setBounds$6,
2366
+ setBounds: setBounds$7,
2363
2367
  setContentHeight,
2364
2368
  setDom: setDom$a,
2365
2369
  setNegativeMargin,
@@ -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 = () => {
@@ -2408,11 +2412,11 @@ const appendWidget$1 = state => {
2408
2412
  const dispose$j = state => {
2409
2413
  remove$2(state.$Viewlet);
2410
2414
  };
2411
- const setBounds$5 = (state, x, y, width, height) => {
2415
+ const setBounds$6 = (state, x, y, width, height) => {
2412
2416
  const {
2413
2417
  $Viewlet
2414
2418
  } = state;
2415
- setBounds$7($Viewlet, x, y, width, height);
2419
+ setBounds$8($Viewlet, x, y, width, height);
2416
2420
  };
2417
2421
 
2418
2422
  const ViewletEditorCompletionDetails = {
@@ -2422,7 +2426,7 @@ const ViewletEditorCompletionDetails = {
2422
2426
  attachEvents: attachEvents$a,
2423
2427
  create: create$I,
2424
2428
  dispose: dispose$j,
2425
- setBounds: setBounds$5,
2429
+ setBounds: setBounds$6,
2426
2430
  setDom: setDom$9
2427
2431
  };
2428
2432
 
@@ -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 {
@@ -2534,12 +2535,21 @@ const setDom$8 = (state, dom) => {
2534
2535
  } = state;
2535
2536
  rememberFocus($Viewlet, dom, ViewletFindWidgetEvents, 0);
2536
2537
  };
2538
+ const setBounds$5 = (state, x, y, width, height) => {
2539
+ const {
2540
+ $Viewlet
2541
+ } = state;
2542
+ setBounds$8($Viewlet, x, y, width, height);
2543
+ };
2544
+ const Events$c = ViewletFindWidgetEvents;
2537
2545
 
2538
2546
  const ViewletFindWidget = {
2539
2547
  __proto__: null,
2548
+ Events: Events$c,
2540
2549
  appendWidget,
2541
2550
  create: create$H,
2542
2551
  focus: focus$i,
2552
+ setBounds: setBounds$5,
2543
2553
  setDom: setDom$8,
2544
2554
  setValue: setValue$4
2545
2555
  };
@@ -5756,7 +5766,7 @@ const isSpecial = id => {
5756
5766
  const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
5757
5767
  const $PlaceHolder = document.createElement('div');
5758
5768
  $PlaceHolder.className = `Viewlet ${viewletId}`;
5759
- setBounds$7($PlaceHolder, left, top, width, height);
5769
+ setBounds$8($PlaceHolder, left, top, width, height);
5760
5770
  if (isSpecial(viewletId)) {
5761
5771
  $PlaceHolder.id = viewletId;
5762
5772
  }
@@ -5793,8 +5803,18 @@ const setDom2 = (viewletId, dom) => {
5793
5803
  const {
5794
5804
  $Viewlet
5795
5805
  } = instance.state;
5806
+ let uid;
5807
+ if ($Viewlet) {
5808
+ try {
5809
+ uid = get$6($Viewlet);
5810
+ } catch {}
5811
+ }
5796
5812
  // TODO optimize rendering with virtual dom diffing
5797
5813
  const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
5814
+ if (uid) {
5815
+ // @ts-ignore
5816
+ set$5($NewViewlet, uid);
5817
+ }
5798
5818
  instance.state.$Viewlet = $NewViewlet;
5799
5819
  };
5800
5820
 
@@ -6067,7 +6087,7 @@ const setBounds$4 = (id, left, top, width, height) => {
6067
6087
  return;
6068
6088
  }
6069
6089
  const $Viewlet = instance.state.$Viewlet;
6070
- setBounds$7($Viewlet, left, top, width, height);
6090
+ setBounds$8($Viewlet, left, top, width, height);
6071
6091
  };
6072
6092
 
6073
6093
  const name$8 = 'Viewlet';
@@ -6815,7 +6835,7 @@ const setBounds$3 = (state, x, y, width, height) => {
6815
6835
  const {
6816
6836
  $Viewlet
6817
6837
  } = state;
6818
- setBounds$7($Viewlet, x, y, width, height);
6838
+ setBounds$8($Viewlet, x, y, width, height);
6819
6839
  };
6820
6840
 
6821
6841
  const ViewletEditorError = {
@@ -7656,7 +7676,7 @@ const setBounds$1 = (state, x, y, width, height) => {
7656
7676
  const {
7657
7677
  $Viewlet
7658
7678
  } = state;
7659
- setBounds$7($Viewlet, x, y, width, height);
7679
+ setBounds$8($Viewlet, x, y, width, height);
7660
7680
  };
7661
7681
 
7662
7682
  const ViewletEditorWidgetError = {
@@ -8998,9 +9018,9 @@ const setSashes = (state, sashSideBar, sashPanel) => {
8998
9018
  $SashSideBar,
8999
9019
  $SashPanel
9000
9020
  } = state;
9001
- setBounds$7($SashSideBar, sashSideBar.x, sashSideBar.y, sashSideBar.width, sashSideBar.height);
9021
+ setBounds$8($SashSideBar, sashSideBar.x, sashSideBar.y, sashSideBar.width, sashSideBar.height);
9002
9022
  $SashSideBar.classList.toggle('SashActive', sashSideBar.active);
9003
- setBounds$7($SashPanel, sashPanel.x, sashPanel.y, sashPanel.width, sashPanel.height);
9023
+ setBounds$8($SashPanel, sashPanel.x, sashPanel.y, sashPanel.width, sashPanel.height);
9004
9024
  $SashPanel.classList.toggle('SashActive', sashPanel.active);
9005
9025
  };
9006
9026
 
@@ -9113,7 +9133,7 @@ const setDragOverlay = (state, visible, x, y, width, height) => {
9113
9133
  const {
9114
9134
  $DragOverlay
9115
9135
  } = state;
9116
- setBounds$7($DragOverlay, x, y, width, height);
9136
+ setBounds$8($DragOverlay, x, y, width, height);
9117
9137
  if (!hasOverlay) {
9118
9138
  document.body.append($DragOverlay);
9119
9139
  }
@@ -11056,7 +11076,7 @@ const setMenus = (state, changes, uid) => {
11056
11076
  level,
11057
11077
  focusedIndex
11058
11078
  } = menu;
11059
- setBounds$7($Menu, x, y, width, height);
11079
+ setBounds$8($Menu, x, y, width, height);
11060
11080
  renderInto($Menu, dom);
11061
11081
  $Menu.id = `Menu-${level}`;
11062
11082
  append$1($Menu);
@@ -11082,7 +11102,7 @@ const setMenus = (state, changes, uid) => {
11082
11102
  focusedIndex
11083
11103
  } = menu;
11084
11104
  const $Menu = $$Menus[level];
11085
- setBounds$7($Menu, x, y, width, height);
11105
+ setBounds$8($Menu, x, y, width, height);
11086
11106
  renderInto($Menu, dom);
11087
11107
  if (level === newLength - 1) {
11088
11108
  if (focusedIndex === -1) {
@@ -11531,7 +11551,7 @@ const setPort = (state, portId, origin) => {
11531
11551
  };
11532
11552
  const setPosition = (state, id, x, y, width, height) => {
11533
11553
  const $Iframe = get(id);
11534
- setBounds$7($Iframe, x, y, width, height);
11554
+ setBounds$8($Iframe, x, y, width, height);
11535
11555
  };
11536
11556
 
11537
11557
  const ViewletWebView = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "10.6.0",
3
+ "version": "10.8.0",
4
4
  "description": "",
5
5
  "main": "dist/rendererProcessMain.js",
6
6
  "type": "module",