@lvce-editor/renderer-process 2.0.0 → 2.1.1

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,49 @@ 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, lineHeight, width) => {
2475
+ string(text);
2476
+ number(fontSize);
2477
+ string(fontFamily);
2478
+ number(width);
2479
+ string(lineHeight);
2480
+ const $Measure = document.createElement('div');
2481
+ $Measure.style.width = `${width}px`;
2482
+ $Measure.style.contain = 'content';
2483
+ $Measure.style.position = 'absolute';
2484
+ $Measure.style.top = '-9999px';
2485
+ $Measure.style.left = '-9999px';
2486
+ $Measure.style.fontSize = `${fontSize}px`;
2487
+ $Measure.style.lineHeight = lineHeight;
2488
+ $Measure.textContent = text;
2489
+ return getElementHeight($Measure);
2490
+ };
2491
+
2492
+ const name$i = 'MeasureTextBlockHeight';
2493
+ const Commands$j = {
2494
+ measureTextBlockHeight: measureTextBlockHeight
2495
+ };
2496
+
2497
+ const MeasureTextBlockHeight_ipc = {
2459
2498
  __proto__: null,
2460
2499
  Commands: Commands$j,
2461
2500
  name: name$i
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "main": "dist/diffWorkerMain.js",
6
6
  "type": "module",