@lvce-editor/renderer-process 1.1.0 → 2.1.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.
@@ -52,6 +52,7 @@ const KeyBindings$1 = 41;
52
52
  const PointerCapture = 42;
53
53
  const GetFilePathElectron = 43;
54
54
  const HandleMessagePort = 44;
55
+ const MeasureTextBlockHeight = 45;
55
56
 
56
57
  const getModuleId = commandId => {
57
58
  switch (commandId) {
@@ -122,6 +123,8 @@ const getModuleId = commandId => {
122
123
  return Location;
123
124
  case 'MeasureTextHeight.measureTextHeight':
124
125
  return MeasureTextHeight;
126
+ case 'MeasureTextBlockHeight.measureTextBlockHeight':
127
+ return MeasureTextBlockHeight;
125
128
  case 'Menu.focusIndex':
126
129
  case 'Menu.hide':
127
130
  case 'Menu.hideSubMenu':
@@ -423,6 +426,8 @@ const load$1 = moduleId => {
423
426
  return Promise.resolve().then(function () { return Location_ipc; });
424
427
  case MeasureTextHeight:
425
428
  return Promise.resolve().then(function () { return MeasureTextHeight_ipc; });
429
+ case MeasureTextBlockHeight:
430
+ return Promise.resolve().then(function () { return MeasureTextBlockHeight_ipc; });
426
431
  case Meta:
427
432
  return Promise.resolve().then(function () { return Meta_ipc; });
428
433
  case Notification:
@@ -1760,15 +1765,15 @@ const play = async src => {
1760
1765
  await audio.play();
1761
1766
  };
1762
1767
 
1763
- const name$x = 'Audio';
1764
- const Commands$y = {
1768
+ const name$y = 'Audio';
1769
+ const Commands$z = {
1765
1770
  play: play
1766
1771
  };
1767
1772
 
1768
1773
  const Audio_ipc = {
1769
1774
  __proto__: null,
1770
- Commands: Commands$y,
1771
- name: name$x
1775
+ Commands: Commands$z,
1776
+ name: name$y
1772
1777
  };
1773
1778
 
1774
1779
  const readText = async () => {
@@ -1789,8 +1794,8 @@ const execCopy = async () => {
1789
1794
  await writeText(text);
1790
1795
  };
1791
1796
 
1792
- const name$w = 'ClipBoard';
1793
- const Commands$x = {
1797
+ const name$x = 'ClipBoard';
1798
+ const Commands$y = {
1794
1799
  execCopy: execCopy,
1795
1800
  readText: readText,
1796
1801
  writeImage: writeImage,
@@ -1799,23 +1804,23 @@ const Commands$x = {
1799
1804
 
1800
1805
  const ClipBoard_ipc = {
1801
1806
  __proto__: null,
1802
- Commands: Commands$x,
1803
- name: name$w
1807
+ Commands: Commands$y,
1808
+ name: name$x
1804
1809
  };
1805
1810
 
1806
1811
  const prompt$1 = message => {
1807
1812
  return confirm(message);
1808
1813
  };
1809
1814
 
1810
- const name$v = 'ConfirmPrompt';
1811
- const Commands$w = {
1815
+ const name$w = 'ConfirmPrompt';
1816
+ const Commands$x = {
1812
1817
  prompt: prompt$1
1813
1818
  };
1814
1819
 
1815
1820
  const ConfirmPrompt_ipc = {
1816
1821
  __proto__: null,
1817
- Commands: Commands$w,
1818
- name: name$v
1822
+ Commands: Commands$x,
1823
+ name: name$w
1819
1824
  };
1820
1825
 
1821
1826
  const state$7 = {
@@ -1840,15 +1845,15 @@ const addCssStyleSheet = async (id, text) => {
1840
1845
  document.adoptedStyleSheets.push(sheet);
1841
1846
  };
1842
1847
 
1843
- const name$u = 'Css';
1844
- const Commands$v = {
1848
+ const name$v = 'Css';
1849
+ const Commands$w = {
1845
1850
  addCssStyleSheet: addCssStyleSheet
1846
1851
  };
1847
1852
 
1848
1853
  const Css_ipc = {
1849
1854
  __proto__: null,
1850
- Commands: Commands$v,
1851
- name: name$u
1855
+ Commands: Commands$w,
1856
+ name: name$v
1852
1857
  };
1853
1858
 
1854
1859
  const modules = ['ActivityBar', 'Ajax', 'Allocator', 'Callback', 'Command', 'Context', 'ContextMenu', 'Delay', 'Developer', 'DomPool', 'Editor', 'Exec', 'ExtensionHost', 'FileSystem', 'KeyBindings', 'Layout', 'Main', 'Notification', 'Panel', 'Parts', 'QuickPick', 'Renderer', 'RendererWorker', 'Search', 'SharedProcess', 'SideBar', 'StatusBar', 'TitleBar', 'Viewlet', 'ViewletController', 'ViewService', 'Vscode', 'Window', 'Workbench', 'Worker', 'Workspace'];
@@ -1868,15 +1873,15 @@ const showState = async () => {
1868
1873
  info(state);
1869
1874
  };
1870
1875
 
1871
- const name$t = 'Developer';
1872
- const Commands$u = {
1876
+ const name$u = 'Developer';
1877
+ const Commands$v = {
1873
1878
  showState: showState
1874
1879
  };
1875
1880
 
1876
1881
  const Developer_ipc = {
1877
1882
  __proto__: null,
1878
- Commands: Commands$u,
1879
- name: name$t
1883
+ Commands: Commands$v,
1884
+ name: name$u
1880
1885
  };
1881
1886
 
1882
1887
  const downloadFile = (fileName, url) => {
@@ -1886,15 +1891,15 @@ const downloadFile = (fileName, url) => {
1886
1891
  a.click();
1887
1892
  };
1888
1893
 
1889
- const name$s = 'Download';
1890
- const Commands$t = {
1894
+ const name$t = 'Download';
1895
+ const Commands$u = {
1891
1896
  downloadFile: downloadFile
1892
1897
  };
1893
1898
 
1894
1899
  const Download_ipc = {
1895
1900
  __proto__: null,
1896
- Commands: Commands$t,
1897
- name: name$s
1901
+ Commands: Commands$u,
1902
+ name: name$t
1898
1903
  };
1899
1904
 
1900
1905
  // based on https://github.com/microsoft/vscode/blob/5f87632829dc3ac80203e2377727935184399431/src/vs/base/browser/ui/aria/aria.ts (License MIT)
@@ -2061,15 +2066,15 @@ const create$I = (message, x, y) => {
2061
2066
  };
2062
2067
  };
2063
2068
 
2064
- const name$r = 'EditorError';
2065
- const Commands$s = {
2069
+ const name$s = 'EditorError';
2070
+ const Commands$t = {
2066
2071
  create: create$I
2067
2072
  };
2068
2073
 
2069
2074
  const EditorError_ipc = {
2070
2075
  __proto__: null,
2071
- Commands: Commands$s,
2072
- name: name$r
2076
+ Commands: Commands$t,
2077
+ name: name$s
2073
2078
  };
2074
2079
 
2075
2080
  const state$4 = {
@@ -2196,8 +2201,8 @@ const finish = state => {
2196
2201
  return value;
2197
2202
  };
2198
2203
 
2199
- const name$q = 'EditorRename';
2200
- const Commands$r = {
2204
+ const name$r = 'EditorRename';
2205
+ const Commands$s = {
2201
2206
  create: create$G,
2202
2207
  dispose: dispose$i,
2203
2208
  finish: finish
@@ -2205,8 +2210,8 @@ const Commands$r = {
2205
2210
 
2206
2211
  const EditorRename_ipc = {
2207
2212
  __proto__: null,
2208
- Commands: Commands$r,
2209
- name: name$q
2213
+ Commands: Commands$s,
2214
+ name: name$r
2210
2215
  };
2211
2216
 
2212
2217
  const showDirectoryPicker = options => {
@@ -2222,8 +2227,8 @@ const showSaveFilePicker = options => {
2222
2227
  return window.showSaveFilePicker(options);
2223
2228
  };
2224
2229
 
2225
- const name$p = 'FilePicker';
2226
- const Commands$q = {
2230
+ const name$q = 'FilePicker';
2231
+ const Commands$r = {
2227
2232
  showDirectoryPicker: showDirectoryPicker,
2228
2233
  showFilePicker: showFilePicker,
2229
2234
  showSaveFilePicker: showSaveFilePicker
@@ -2231,23 +2236,23 @@ const Commands$q = {
2231
2236
 
2232
2237
  const FilePicker_ipc = {
2233
2238
  __proto__: null,
2234
- Commands: Commands$q,
2235
- name: name$p
2239
+ Commands: Commands$r,
2240
+ name: name$q
2236
2241
  };
2237
2242
 
2238
2243
  const requestPermission = (handle, options) => {
2239
2244
  return handle.requestPermission(options);
2240
2245
  };
2241
2246
 
2242
- const name$o = 'FileSystemHandle';
2243
- const Commands$p = {
2247
+ const name$p = 'FileSystemHandle';
2248
+ const Commands$q = {
2244
2249
  requestPermission: requestPermission
2245
2250
  };
2246
2251
 
2247
2252
  const FileSystemHandle_ipc = {
2248
2253
  __proto__: null,
2249
- Commands: Commands$p,
2250
- name: name$o
2254
+ Commands: Commands$q,
2255
+ name: name$p
2251
2256
  };
2252
2257
 
2253
2258
  const handleImageLoad = event => {
@@ -2321,8 +2326,8 @@ const ImagePreview$1 = {
2321
2326
  update
2322
2327
  };
2323
2328
 
2324
- const name$n = 'ImagePreview';
2325
- const Commands$o = {
2329
+ const name$o = 'ImagePreview';
2330
+ const Commands$p = {
2326
2331
  create: create$F,
2327
2332
  dispose: dispose$h,
2328
2333
  showError: showError,
@@ -2331,8 +2336,8 @@ const Commands$o = {
2331
2336
 
2332
2337
  const ImagePreview_ipc = {
2333
2338
  __proto__: null,
2334
- Commands: Commands$o,
2335
- name: name$n
2339
+ Commands: Commands$p,
2340
+ name: name$o
2336
2341
  };
2337
2342
 
2338
2343
  const getOrigin = () => {
@@ -2388,41 +2393,41 @@ const getInitData = () => {
2388
2393
  return initData;
2389
2394
  };
2390
2395
 
2391
- const name$m = 'InitData';
2392
- const Commands$n = {
2396
+ const name$n = 'InitData';
2397
+ const Commands$o = {
2393
2398
  getInitData: getInitData
2394
2399
  };
2395
2400
 
2396
2401
  const InitData_ipc = {
2397
2402
  __proto__: null,
2398
- Commands: Commands$n,
2399
- name: name$m
2403
+ Commands: Commands$o,
2404
+ name: name$n
2400
2405
  };
2401
2406
 
2402
- const name$l = 'IpcParent';
2403
- const Commands$m = {
2407
+ const name$m = 'IpcParent';
2408
+ const Commands$n = {
2404
2409
  create: create$K
2405
2410
  };
2406
2411
 
2407
2412
  const IpcParent_ipc = {
2408
2413
  __proto__: null,
2409
- Commands: Commands$m,
2410
- name: name$l
2414
+ Commands: Commands$n,
2415
+ name: name$m
2411
2416
  };
2412
2417
 
2413
- const name$k = 'Layout';
2414
- const Commands$l = {
2418
+ const name$l = 'Layout';
2419
+ const Commands$m = {
2415
2420
  getBounds: getBounds
2416
2421
  };
2417
2422
 
2418
2423
  const Layout_ipc = {
2419
2424
  __proto__: null,
2420
- Commands: Commands$l,
2421
- name: name$k
2425
+ Commands: Commands$m,
2426
+ name: name$l
2422
2427
  };
2423
2428
 
2424
- const name$j = 'Location';
2425
- const Commands$k = {
2429
+ const name$k = 'Location';
2430
+ const Commands$l = {
2426
2431
  getHref: getHref,
2427
2432
  getPathName: getPathName,
2428
2433
  hydrate: hydrate,
@@ -2431,8 +2436,15 @@ const Commands$k = {
2431
2436
 
2432
2437
  const Location_ipc = {
2433
2438
  __proto__: null,
2434
- Commands: Commands$k,
2435
- name: name$j
2439
+ Commands: Commands$l,
2440
+ name: name$k
2441
+ };
2442
+
2443
+ const getElementHeight = $Element => {
2444
+ document.body.append($Element);
2445
+ const height = $Element.offsetHeight;
2446
+ $Element.remove();
2447
+ return height;
2436
2448
  };
2437
2449
 
2438
2450
  const measureTextHeight = (text, fontSize, fontFamily) => {
@@ -2440,22 +2452,45 @@ const measureTextHeight = (text, fontSize, fontFamily) => {
2440
2452
  string(fontSize);
2441
2453
  string(fontFamily);
2442
2454
  const $Measure = document.createElement('div');
2455
+ $Measure.style.contain = 'content';
2443
2456
  $Measure.style.position = 'absolute';
2444
2457
  $Measure.style.top = '-9999px';
2445
2458
  $Measure.style.left = '-9999px';
2446
2459
  $Measure.textContent = text;
2447
- document.body.append($Measure);
2448
- const height = $Measure.offsetHeight;
2449
- $Measure.remove();
2450
- return height;
2460
+ return getElementHeight($Measure);
2451
2461
  };
2452
2462
 
2453
- const name$i = 'MeasureTextHeight';
2454
- const Commands$j = {
2463
+ const name$j = 'MeasureTextHeight';
2464
+ const Commands$k = {
2455
2465
  measureTextHeight: measureTextHeight
2456
2466
  };
2457
2467
 
2458
2468
  const MeasureTextHeight_ipc = {
2469
+ __proto__: null,
2470
+ Commands: Commands$k,
2471
+ name: name$j
2472
+ };
2473
+
2474
+ const measureTextBlockHeight = (text, fontSize, fontFamily, width) => {
2475
+ string(text);
2476
+ string(fontSize);
2477
+ string(fontFamily);
2478
+ const $Measure = document.createElement('div');
2479
+ $Measure.style.width = `${width}px`;
2480
+ $Measure.style.contain = 'content';
2481
+ $Measure.style.position = 'absolute';
2482
+ $Measure.style.top = '-9999px';
2483
+ $Measure.style.left = '-9999px';
2484
+ $Measure.textContent = text;
2485
+ return getElementHeight($Measure);
2486
+ };
2487
+
2488
+ const name$i = 'MeasureTextBlockHeight';
2489
+ const Commands$j = {
2490
+ measureTextBlockHeight: measureTextBlockHeight
2491
+ };
2492
+
2493
+ const MeasureTextBlockHeight_ipc = {
2459
2494
  __proto__: null,
2460
2495
  Commands: Commands$j,
2461
2496
  name: name$i
@@ -3213,7 +3248,7 @@ const create$Menu$1 = () => {
3213
3248
  // })
3214
3249
  $Menu.onkeydown = handleKeyDown$5;
3215
3250
  $Menu.addEventListener(FocusOut, handleFocusOut$1);
3216
- $Menu.oncontextmenu = handleContextMenu$9;
3251
+ $Menu.oncontextmenu = handleContextMenu$a;
3217
3252
  // $ContextMenu.onfocus = handleFocus
3218
3253
  // $ContextMenu.onblur = handleBlur
3219
3254
  return $Menu;
@@ -3242,14 +3277,14 @@ const handleBackDropMouseDown = event => {
3242
3277
  stopPropagation(event);
3243
3278
  send( /* Menu.hide */'Menu.hide');
3244
3279
  };
3245
- const handleContextMenu$9 = event => {
3280
+ const handleContextMenu$a = event => {
3246
3281
  preventDefault(event);
3247
3282
  };
3248
3283
  const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mouseBlocking = false) => {
3249
3284
  if (mouseBlocking) {
3250
3285
  const $BackDrop = create$BackDrop();
3251
3286
  $BackDrop.onmousedown = handleBackDropMouseDown;
3252
- $BackDrop.oncontextmenu = handleContextMenu$9;
3287
+ $BackDrop.oncontextmenu = handleContextMenu$a;
3253
3288
  // @ts-expect-error
3254
3289
  state$2.$BackDrop = $BackDrop;
3255
3290
  append$1($BackDrop);
@@ -5665,7 +5700,7 @@ const handleFocus$c = () => {
5665
5700
 
5666
5701
  // TODO use context menu events function again
5667
5702
 
5668
- const handleContextMenu$8 = event => {
5703
+ const handleContextMenu$9 = event => {
5669
5704
  preventDefault(event);
5670
5705
  const {
5671
5706
  button,
@@ -5679,7 +5714,7 @@ const returnValue$5 = true;
5679
5714
  const ViewletActivityBarEvents = {
5680
5715
  __proto__: null,
5681
5716
  handleBlur: handleBlur$9,
5682
- handleContextMenu: handleContextMenu$8,
5717
+ handleContextMenu: handleContextMenu$9,
5683
5718
  handleFocus: handleFocus$c,
5684
5719
  handleMouseDown: handleMouseDown$3,
5685
5720
  returnValue: returnValue$5
@@ -5709,10 +5744,10 @@ forwardViewletCommand('clearFilter');
5709
5744
  const close = forwardViewletCommand('close');
5710
5745
  forwardViewletCommand('closeEditor');
5711
5746
  const closeMenu$1 = forwardViewletCommand('closeMenu');
5712
- const compositionEnd = forwardViewletCommand('compositionEnd');
5713
- const compositionStart = forwardViewletCommand('compositionStart');
5714
- const compositionUpdate = forwardViewletCommand('compositionUpdate');
5715
- const cut = forwardViewletCommand('cut');
5747
+ forwardViewletCommand('compositionEnd');
5748
+ forwardViewletCommand('compositionStart');
5749
+ forwardViewletCommand('compositionUpdate');
5750
+ forwardViewletCommand('cut');
5716
5751
  forwardViewletCommand('focus');
5717
5752
  forwardViewletCommand('focusIndex');
5718
5753
  const focusNext = forwardViewletCommand('focusNext');
@@ -5734,7 +5769,7 @@ forwardViewletCommand('handleClickOpenFile');
5734
5769
  forwardViewletCommand('handleClickRestore');
5735
5770
  const handleClickTab$2 = forwardViewletCommand('handleClickTab');
5736
5771
  forwardViewletCommand('handleClickToggleMaximize');
5737
- const handleContextMenu$7 = forwardViewletCommand('handleContextMenu');
5772
+ const handleContextMenu$8 = forwardViewletCommand('handleContextMenu');
5738
5773
  const handleDoubleClick = forwardViewletCommand('handleDoubleClick');
5739
5774
  const handleDragEnd$1 = forwardViewletCommand('handleDragEnd');
5740
5775
  const handleDragLeave$1 = forwardViewletCommand('handleDragLeave');
@@ -5754,10 +5789,10 @@ forwardViewletCommand('handleListFocus');
5754
5789
  const handleMenuClick$1 = forwardViewletCommand('handleMenuClick');
5755
5790
  const handleMenuMouseOver$1 = forwardViewletCommand('handleMenuMouseOver');
5756
5791
  const handleMouseDown$2 = forwardViewletCommand('handleMouseDown');
5757
- const handleMouseMove$1 = forwardViewletCommand('handleMouseMove');
5792
+ forwardViewletCommand('handleMouseMove');
5758
5793
  const handleMouseOut$1 = forwardViewletCommand('handleMouseOut');
5759
5794
  const handleMouseOver$1 = forwardViewletCommand('handleMouseOver');
5760
- const handlePointerCaptureLost$3 = forwardViewletCommand('handlePointerCaptureLost');
5795
+ forwardViewletCommand('handlePointerCaptureLost');
5761
5796
  const handlePointerDown$7 = forwardViewletCommand('handlePointerDown');
5762
5797
  const handlePointerMove$1 = forwardViewletCommand('handlePointerMove');
5763
5798
  forwardViewletCommand('handlePointerOver');
@@ -5768,12 +5803,12 @@ const handleResizerClick = forwardViewletCommand('handleResizerClick');
5768
5803
  const handleResizerMove = forwardViewletCommand('handleResizerMove');
5769
5804
  const handleScrollBarCaptureLost = forwardViewletCommand('handleScrollBarCaptureLost');
5770
5805
  const handleScrollBarClick = forwardViewletCommand('handleScrollBarClick');
5771
- const handleScrollBarHorizontalMove = forwardViewletCommand('handleScrollBarHorizontalMove');
5772
- const handleScrollBarHorizontalPointerDown$1 = forwardViewletCommand('handleScrollBarHorizontalPointerDown');
5806
+ forwardViewletCommand('handleScrollBarHorizontalMove');
5807
+ forwardViewletCommand('handleScrollBarHorizontalPointerDown');
5773
5808
  const handleScrollBarMove = forwardViewletCommand('handleScrollBarMove');
5774
5809
  const handleScrollBarThumbPointerMove$3 = forwardViewletCommand('handleScrollBarThumbPointerMove');
5775
- const handleScrollBarVerticalMove = forwardViewletCommand('handleScrollBarMove');
5776
- const handleScrollBarVerticalPointerDown$1 = forwardViewletCommand('handleScrollBarVerticalPointerDown');
5810
+ forwardViewletCommand('handleScrollBarMove');
5811
+ forwardViewletCommand('handleScrollBarVerticalPointerDown');
5777
5812
  forwardViewletCommand('handleSliderPointerDown');
5778
5813
  const handleSliderPointerMove$1 = forwardViewletCommand('handleSliderPointerMove');
5779
5814
  const handleTabClick = forwardViewletCommand('handleTabClick');
@@ -5786,19 +5821,19 @@ const handleTouchMove$1 = forwardViewletCommand('handleTouchMove');
5786
5821
  const handleTouchStart$1 = forwardViewletCommand('handleTouchStart');
5787
5822
  const handleWheel$4 = forwardViewletCommand('handleWheel');
5788
5823
  const hidePanel = forwardViewletCommand('hidePanel');
5789
- const moveRectangleSelectionPx = forwardViewletCommand('moveRectangleSelectionPx');
5790
- const moveSelectionPx = forwardViewletCommand('moveSelectionPx');
5791
- const paste = forwardViewletCommand('paste');
5824
+ forwardViewletCommand('moveRectangleSelectionPx');
5825
+ forwardViewletCommand('moveSelectionPx');
5826
+ forwardViewletCommand('paste');
5792
5827
  forwardViewletCommand('replaceAll');
5793
5828
  const selectIndex = forwardViewletCommand('selectIndex');
5794
- const setDelta = forwardViewletCommand('setDelta');
5829
+ forwardViewletCommand('setDelta');
5795
5830
  forwardViewletCommand('toggleMatchCase');
5796
5831
  forwardViewletCommand('toggleMatchWholeWord');
5797
5832
  const toggleMaximize = forwardViewletCommand('toggleMaximize');
5798
5833
  const toggleReplace = forwardViewletCommand('toggleReplace');
5799
5834
  forwardViewletCommand('toggleUseRegularExpression');
5800
5835
  forwardViewletCommand('type');
5801
- const typeWithAutoClosing = forwardViewletCommand('typeWithAutoClosing');
5836
+ forwardViewletCommand('typeWithAutoClosing');
5802
5837
  const updateEditingValue = forwardViewletCommand('updateEditingValue');
5803
5838
 
5804
5839
  const handleAudioError = event => {
@@ -6526,7 +6561,7 @@ const handleWheel$2 = event => {
6526
6561
  *
6527
6562
  * @param {MouseEvent} event
6528
6563
  */
6529
- const handleContextMenu$6 = event => {
6564
+ const handleContextMenu$7 = event => {
6530
6565
  preventDefault(event);
6531
6566
  const {
6532
6567
  button,
@@ -6534,7 +6569,7 @@ const handleContextMenu$6 = event => {
6534
6569
  clientY
6535
6570
  } = event;
6536
6571
  const uid = fromEvent(event);
6537
- handleContextMenu$7(uid, button, clientX, clientY);
6572
+ handleContextMenu$8(uid, button, clientX, clientY);
6538
6573
  };
6539
6574
  const handleError$5 = event => {
6540
6575
  const uid = fromEvent(event);
@@ -6559,7 +6594,7 @@ const attachEvents$a = state => {
6559
6594
  attachEvents$c($Viewlet, {
6560
6595
  [PointerDown]: handlePointerDown$5,
6561
6596
  [PointerUp]: handlePointerUp,
6562
- [ContextMenu]: handleContextMenu$6,
6597
+ [ContextMenu]: handleContextMenu$7,
6563
6598
  [FocusIn]: handleFocus$9
6564
6599
  });
6565
6600
  $Viewlet.addEventListener(Error$3, handleError$5, Capture);
@@ -6623,12 +6658,26 @@ const QuickInput = 'Quick Input';
6623
6658
  const SideBar = 'Side Bar';
6624
6659
  const StatusBar = 'Status Bar';
6625
6660
 
6661
+ const attachEventsFunctional = ($Node, eventMap) => {
6662
+ for (const [key] of Object.entries(eventMap)) {
6663
+ if (key === 'returnValue') {
6664
+ continue;
6665
+ }
6666
+ attachEvent($Node, eventMap, key, key);
6667
+ }
6668
+ };
6669
+
6626
6670
  const Text$1 = 'text';
6627
6671
 
6628
6672
  const getText = clipBoardData => {
6629
6673
  return clipBoardData.getData(Text$1);
6630
6674
  };
6631
6675
 
6676
+ const detachEvent = ($Node, key, listener) => {
6677
+ const wrapped = getWrappedListener(listener, true);
6678
+ $Node.removeEventListener(key, wrapped);
6679
+ };
6680
+
6632
6681
  const None = 0;
6633
6682
  const Ctrl = 1;
6634
6683
  const Alt$1 = 2;
@@ -6643,8 +6692,6 @@ const getModifierKey = event => {
6643
6692
  return None;
6644
6693
  };
6645
6694
 
6646
- const InsertText = 'insertText';
6647
-
6648
6695
  const toSimpleTouch = touch => {
6649
6696
  return {
6650
6697
  x: touch.clientX,
@@ -6668,17 +6715,6 @@ const toSimpleTouchEvent = event => {
6668
6715
  };
6669
6716
  };
6670
6717
 
6671
- const handleContextMenu$5 = event => {
6672
- preventDefault(event);
6673
- const {
6674
- button,
6675
- clientX,
6676
- clientY
6677
- } = event;
6678
- const uid = fromEvent(event);
6679
- handleContextMenu$7(uid, button, clientX, clientY);
6680
- };
6681
-
6682
6718
  // TODO so many things in this file
6683
6719
 
6684
6720
 
@@ -6687,23 +6723,20 @@ const handleContextMenu$5 = event => {
6687
6723
  // TODO tree shake out mobile support when targeting electron -> less code -> less event listeners -> less memory -> less cpu
6688
6724
 
6689
6725
  const handleFocus$8 = event => {
6690
- const uid = fromEvent(event);
6691
- handleFocus$b(uid);
6726
+ return ['handleFocus'];
6692
6727
  };
6693
6728
  const handleMouseMove = event => {
6694
- const uid = fromEvent(event);
6695
6729
  const {
6696
6730
  clientX,
6697
6731
  clientY,
6698
6732
  altKey
6699
6733
  } = event;
6700
- handleMouseMove$1(uid, clientX, clientY, altKey);
6734
+ return ['handleMouseMove', clientX, clientY, altKey];
6701
6735
  };
6702
6736
  const handleBlur$6 = event => {
6703
6737
  // needed for save on blur
6704
6738
  // also needed to close completions on blur
6705
- const uid = fromEvent(event);
6706
- handleBlur$8(uid);
6739
+ return ['handleBlur'];
6707
6740
  };
6708
6741
 
6709
6742
  /**
@@ -6712,19 +6745,11 @@ const handleBlur$6 = event => {
6712
6745
  */
6713
6746
  const handleBeforeInput$1 = event => {
6714
6747
  preventDefault(event);
6715
- const uid = fromEvent(event);
6716
6748
  const {
6717
6749
  inputType,
6718
6750
  data
6719
6751
  } = event;
6720
- switch (inputType) {
6721
- case InsertText:
6722
- typeWithAutoClosing(uid, data);
6723
- break;
6724
- }
6725
- // if (!event.data) {
6726
- // return
6727
- // }
6752
+ return ['handleBeforeInput', inputType, data];
6728
6753
  };
6729
6754
 
6730
6755
  // TODO composition should be better supported,
@@ -6735,36 +6760,31 @@ const handleBeforeInput$1 = event => {
6735
6760
  // - vscode does not draw a line, but displays characters during composition
6736
6761
 
6737
6762
  const handleCompositionStart = event => {
6738
- const uid = fromEvent(event);
6739
6763
  const {
6740
6764
  data
6741
6765
  } = event;
6742
- compositionStart(uid, data);
6766
+ return ['compositionStart', data];
6743
6767
  };
6744
6768
  const handleCompositionUpdate = event => {
6745
- const uid = fromEvent(event);
6746
6769
  const {
6747
6770
  data
6748
6771
  } = event;
6749
- compositionUpdate(uid, data);
6772
+ return ['compositionUpdate', data];
6750
6773
  };
6751
6774
  const handleCompositionEnd = event => {
6752
- const uid = fromEvent(event);
6753
6775
  const {
6754
6776
  data
6755
6777
  } = event;
6756
- compositionEnd(uid, data);
6778
+ return ['compositionEnd', data];
6757
6779
  };
6758
6780
  const handleCut = event => {
6759
6781
  preventDefault(event);
6760
- const uid = fromEvent(event);
6761
- cut(uid);
6782
+ return ['cut'];
6762
6783
  };
6763
6784
  const isRightClick = event => {
6764
6785
  return event.button === RightClick;
6765
6786
  };
6766
6787
  const handleEditorPointerMove = event => {
6767
- const uid = fromEvent(event);
6768
6788
  const {
6769
6789
  clientX,
6770
6790
  clientY,
@@ -6772,19 +6792,17 @@ const handleEditorPointerMove = event => {
6772
6792
  } = event;
6773
6793
  // TODO if/else should be in renderer worker
6774
6794
  if (altKey) {
6775
- moveRectangleSelectionPx(uid, clientX, clientY);
6776
- } else {
6777
- moveSelectionPx(uid, clientX, clientY);
6795
+ return ['moveRectangleSelectionPx', clientX, clientY];
6778
6796
  }
6797
+ return ['moveSelectionPx', clientX, clientY];
6779
6798
  };
6780
6799
  const handleEditorLostPointerCapture = event => {
6781
- const uid = fromEvent(event);
6782
6800
  const {
6783
6801
  target
6784
6802
  } = event;
6785
- target.removeEventListener(PointerMove, handleEditorPointerMove);
6786
- target.removeEventListener(LostPointerCapture, handleEditorLostPointerCapture);
6787
- handlePointerCaptureLost$3(uid);
6803
+ detachEvent(target, PointerMove, handleEditorPointerMove);
6804
+ detachEvent(target, LostPointerCapture, handleEditorLostPointerCapture);
6805
+ return ['handlePointerCaptureLost'];
6788
6806
  };
6789
6807
 
6790
6808
  /**
@@ -6797,14 +6815,17 @@ const handleEditorPointerDown = event => {
6797
6815
  pointerId
6798
6816
  } = event;
6799
6817
  target.setPointerCapture(pointerId);
6800
- target.addEventListener(PointerMove, handleEditorPointerMove, Active);
6801
- target.addEventListener(LostPointerCapture, handleEditorLostPointerCapture);
6818
+ attachEventsFunctional(target, {
6819
+ [PointerMove]: handleEditorPointerMove,
6820
+ [LostPointerCapture]: handleEditorLostPointerCapture,
6821
+ returnValue: true
6822
+ });
6823
+ return [];
6802
6824
  };
6803
6825
  const handleMouseDown$1 = event => {
6804
6826
  if (isRightClick(event)) {
6805
- return;
6827
+ return [];
6806
6828
  }
6807
- const uid = fromEvent(event);
6808
6829
  preventDefault(event);
6809
6830
  const {
6810
6831
  clientX,
@@ -6812,7 +6833,7 @@ const handleMouseDown$1 = event => {
6812
6833
  detail
6813
6834
  } = event;
6814
6835
  const modifier = getModifierKey(event);
6815
- handleMouseDown$2(uid, modifier, clientX, clientY, detail);
6836
+ return ['handleMouseDown', modifier, clientX, clientY, detail];
6816
6837
  };
6817
6838
 
6818
6839
  // TODO figure out whether it is possible to register hover provider without mousemove
@@ -6823,7 +6844,6 @@ const handleMouseDown$1 = event => {
6823
6844
  * @param {WheelEvent} event
6824
6845
  */
6825
6846
  const handleWheel$1 = event => {
6826
- const uid = fromEvent(event);
6827
6847
  const {
6828
6848
  deltaMode,
6829
6849
  deltaX,
@@ -6832,16 +6852,15 @@ const handleWheel$1 = event => {
6832
6852
  // event.preventDefault()
6833
6853
  // const state = EditorHelper.getStateFromEvent(event)
6834
6854
  // TODO send editor id
6835
- setDelta(uid, deltaMode, deltaX, deltaY);
6855
+ return ['setDelta', deltaMode, deltaX, deltaY];
6836
6856
  };
6837
6857
  const handlePaste = event => {
6838
6858
  preventDefault(event);
6839
- const uid = fromEvent(event);
6840
6859
  const {
6841
6860
  clipboardData
6842
6861
  } = event;
6843
6862
  const text = getText(clipboardData);
6844
- paste(uid, text);
6863
+ return ['paste', text];
6845
6864
  };
6846
6865
 
6847
6866
  /**
@@ -6849,11 +6868,10 @@ const handlePaste = event => {
6849
6868
  * @param {PointerEvent} event
6850
6869
  */
6851
6870
  const handleScrollBarThumbVerticalPointerMove = event => {
6852
- const uid = fromEvent(event);
6853
6871
  const {
6854
6872
  clientY
6855
6873
  } = event;
6856
- handleScrollBarVerticalMove(uid, clientY);
6874
+ return ['handleScrollBarVerticalMove', clientY];
6857
6875
  };
6858
6876
 
6859
6877
  /**
@@ -6866,6 +6884,7 @@ const handleScrollBarVerticalPointerUp = event => {
6866
6884
  pointerId
6867
6885
  } = event;
6868
6886
  stopTracking(target, pointerId, handleScrollBarThumbVerticalPointerMove, handleScrollBarVerticalPointerUp);
6887
+ return [];
6869
6888
  };
6870
6889
 
6871
6890
  /**
@@ -6873,14 +6892,13 @@ const handleScrollBarVerticalPointerUp = event => {
6873
6892
  * @param {PointerEvent} event
6874
6893
  */
6875
6894
  const handleScrollBarVerticalPointerDown = event => {
6876
- const uid = fromEvent(event);
6877
6895
  const {
6878
6896
  target,
6879
6897
  pointerId,
6880
6898
  clientY
6881
6899
  } = event;
6882
6900
  startTracking(target, pointerId, handleScrollBarThumbVerticalPointerMove, handleScrollBarVerticalPointerUp);
6883
- handleScrollBarVerticalPointerDown$1(uid, clientY);
6901
+ return ['handleScrollBarVerticalPointerDown', clientY];
6884
6902
  };
6885
6903
 
6886
6904
  /**
@@ -6891,8 +6909,7 @@ const handleScrollBarThumbHorizontalPointerMove = event => {
6891
6909
  const {
6892
6910
  clientX
6893
6911
  } = event;
6894
- const uid = fromEvent(event);
6895
- handleScrollBarHorizontalMove(uid, clientX);
6912
+ return ['handleScrollBarHorizontalMove', clientX];
6896
6913
  };
6897
6914
 
6898
6915
  /**
@@ -6905,6 +6922,7 @@ const handleScrollBarHorizontalPointerUp = event => {
6905
6922
  pointerId
6906
6923
  } = event;
6907
6924
  stopTracking(target, pointerId, handleScrollBarThumbHorizontalPointerMove, handleScrollBarHorizontalPointerUp);
6925
+ return [];
6908
6926
  };
6909
6927
 
6910
6928
  /**
@@ -6918,12 +6936,21 @@ const handleScrollBarHorizontalPointerDown = event => {
6918
6936
  clientX
6919
6937
  } = event;
6920
6938
  startTracking(target, pointerId, handleScrollBarThumbHorizontalPointerMove, handleScrollBarHorizontalPointerUp);
6921
- handleScrollBarHorizontalPointerDown$1(clientX);
6939
+ return ['handleScrollBarHorizontalPointerDown', clientX];
6922
6940
  };
6923
6941
  const handleScrollBarContextMenu = event => {
6924
6942
  preventDefault(event);
6925
6943
  stopPropagation(event);
6926
6944
  };
6945
+ const handleContextMenu$6 = event => {
6946
+ preventDefault(event);
6947
+ const {
6948
+ button,
6949
+ clientX,
6950
+ clientY
6951
+ } = event;
6952
+ return ['handleContextMenu', button, clientX, clientY];
6953
+ };
6927
6954
 
6928
6955
  const setCursors = (state, dom) => {
6929
6956
  object(state);
@@ -6996,7 +7023,7 @@ const create$n = () => {
6996
7023
  $EditorInput.setAttribute('spellcheck', False);
6997
7024
  $EditorInput.role = TextBox;
6998
7025
  // TODO where to best put listeners (side effects)
6999
- attachEvents$c($EditorInput, {
7026
+ attachEventsFunctional($EditorInput, {
7000
7027
  [BeforeInput]: handleBeforeInput$1,
7001
7028
  [CompositionStart]: handleCompositionStart,
7002
7029
  [CompositionUpdate]: handleCompositionUpdate,
@@ -7004,7 +7031,8 @@ const create$n = () => {
7004
7031
  [Focus]: handleFocus$8,
7005
7032
  [Blur]: handleBlur$6,
7006
7033
  [Cut]: handleCut,
7007
- [Paste]: handlePaste
7034
+ [Paste]: handlePaste,
7035
+ returnValue: true
7008
7036
  });
7009
7037
  $EditorInput.name = 'editor';
7010
7038
  const $LayerCursor = document.createElement('div');
@@ -7013,9 +7041,10 @@ const create$n = () => {
7013
7041
  $LayerText.className = 'EditorRows';
7014
7042
  const $LayerGutter = document.createElement('div');
7015
7043
  $LayerGutter.className = 'Gutter';
7016
- attachEvents$c($LayerText, {
7044
+ attachEventsFunctional($LayerText, {
7017
7045
  [MouseDown]: handleMouseDown$1,
7018
- [PointerDown]: handleEditorPointerDown
7046
+ [PointerDown]: handleEditorPointerDown,
7047
+ returnValue: true
7019
7048
  });
7020
7049
  const $ScrollBarThumbVertical = document.createElement('div');
7021
7050
  $ScrollBarThumbVertical.className = 'ScrollBarThumb ScrollBarThumbVertical';
@@ -7025,9 +7054,10 @@ const create$n = () => {
7025
7054
  $ScrollBarDiagnostics.className = 'EditorScrollBarDiagnostics';
7026
7055
  const $ScrollBarVertical = document.createElement('div');
7027
7056
  $ScrollBarVertical.className = 'ScrollBar ScrollBarVertical';
7028
- attachEvents$c($ScrollBarVertical, {
7057
+ attachEventsFunctional($ScrollBarVertical, {
7029
7058
  [PointerDown]: handleScrollBarVerticalPointerDown,
7030
- [ContextMenu]: handleScrollBarContextMenu
7059
+ [ContextMenu]: handleScrollBarContextMenu,
7060
+ returnValue: true
7031
7061
  });
7032
7062
  $ScrollBarVertical.append($ScrollBarThumbVertical);
7033
7063
  const $ScrollBarThumbHorizontal = document.createElement('div');
@@ -7035,8 +7065,9 @@ const create$n = () => {
7035
7065
  const $ScrollBarHorizontal = document.createElement('div');
7036
7066
  $ScrollBarHorizontal.className = 'ScrollBar ScrollBarHorizontal';
7037
7067
  $ScrollBarHorizontal.append($ScrollBarThumbHorizontal);
7038
- attachEvents$c($ScrollBarHorizontal, {
7039
- [PointerDown]: handleScrollBarHorizontalPointerDown
7068
+ attachEventsFunctional($ScrollBarHorizontal, {
7069
+ [PointerDown]: handleScrollBarHorizontalPointerDown,
7070
+ returnValue: true
7040
7071
  });
7041
7072
 
7042
7073
  // $EditorRows.addEventListener('mousemove', handleMouseMove, { passive: true })
@@ -7066,11 +7097,11 @@ const create$n = () => {
7066
7097
  $Editor.className = 'Viewlet Editor';
7067
7098
  $Editor.role = Code;
7068
7099
  $Editor.append($LayerGutter, $EditorContent);
7069
- attachEvents$c($Editor, {
7070
- [ContextMenu]: handleContextMenu$5
7100
+ attachEventsFunctional($Editor, {
7101
+ [ContextMenu]: handleContextMenu$6,
7102
+ [Wheel]: handleWheel$1,
7103
+ returnValue: true
7071
7104
  });
7072
- $Editor.addEventListener(Wheel, handleWheel$1, Passive);
7073
- // $Editor.addEventListener(DomEventType.MouseMove, EditorEvents.handlePointerMove, DomEventOptions.Passive)
7074
7105
  return {
7075
7106
  $LayerCursor,
7076
7107
  $LayerSelections,
@@ -7266,6 +7297,17 @@ const ViewletError = {
7266
7297
  setMessage: setMessage$1
7267
7298
  };
7268
7299
 
7300
+ const handleContextMenu$5 = event => {
7301
+ preventDefault(event);
7302
+ const {
7303
+ button,
7304
+ clientX,
7305
+ clientY
7306
+ } = event;
7307
+ const uid = fromEvent(event);
7308
+ handleContextMenu$8(uid, button, clientX, clientY);
7309
+ };
7310
+
7269
7311
  const CopyMove = 'copyMove';
7270
7312
 
7271
7313
  const Text = 'text';
@@ -8749,7 +8791,7 @@ const handleContextMenu$4 = event => {
8749
8791
  clientY
8750
8792
  } = event;
8751
8793
  const uid = fromEvent(event);
8752
- handleContextMenu$7(uid, clientX, clientY);
8794
+ handleContextMenu$8(uid, clientX, clientY);
8753
8795
  };
8754
8796
 
8755
8797
  // TODO Main should not be bound to Editor -> Lazy load Editor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "1.1.0",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "main": "dist/diffWorkerMain.js",
6
6
  "type": "module",
@@ -41,6 +41,7 @@
41
41
  "**/renderer-process/**",
42
42
  "**/extension-host-worker/**"
43
43
  ],
44
+ "ext": "ts,js",
44
45
  "exec": "node scripts/build.js"
45
46
  }
46
47
  }