@lvce-editor/settings-view 2.1.0 → 2.2.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.
@@ -54,6 +54,49 @@ class VError extends Error {
54
54
  }
55
55
  }
56
56
 
57
+ class AssertionError extends Error {
58
+ constructor(message) {
59
+ super(message);
60
+ this.name = 'AssertionError';
61
+ }
62
+ }
63
+ const Object$1 = 1;
64
+ const Number$2 = 2;
65
+ const Array$1 = 3;
66
+ const String$1 = 4;
67
+ const Boolean$2 = 5;
68
+ const Function = 6;
69
+ const Null = 7;
70
+ const Unknown = 8;
71
+ const getType = value => {
72
+ switch (typeof value) {
73
+ case 'number':
74
+ return Number$2;
75
+ case 'function':
76
+ return Function;
77
+ case 'string':
78
+ return String$1;
79
+ case 'object':
80
+ if (value === null) {
81
+ return Null;
82
+ }
83
+ if (Array.isArray(value)) {
84
+ return Array$1;
85
+ }
86
+ return Object$1;
87
+ case 'boolean':
88
+ return Boolean$2;
89
+ default:
90
+ return Unknown;
91
+ }
92
+ };
93
+ const number = value => {
94
+ const type = getType(value);
95
+ if (type !== Number$2) {
96
+ throw new AssertionError('expected value to be of type number');
97
+ }
98
+ };
99
+
57
100
  const isMessagePort = value => {
58
101
  return value && value instanceof MessagePort;
59
102
  };
@@ -182,8 +225,8 @@ const getModuleNotFoundError = stderr => {
182
225
  const messageIndex = lines.findIndex(isModuleNotFoundMessage);
183
226
  const message = lines[messageIndex];
184
227
  return {
185
- message,
186
- code: ERR_MODULE_NOT_FOUND
228
+ code: ERR_MODULE_NOT_FOUND,
229
+ message
187
230
  };
188
231
  };
189
232
  const isModuleNotFoundError = stderr => {
@@ -206,14 +249,14 @@ const isUnhelpfulNativeModuleError = stderr => {
206
249
  const getNativeModuleErrorMessage = stderr => {
207
250
  const message = getMessageCodeBlock(stderr);
208
251
  return {
209
- message: `Incompatible native node module: ${message}`,
210
- code: E_INCOMPATIBLE_NATIVE_MODULE
252
+ code: E_INCOMPATIBLE_NATIVE_MODULE,
253
+ message: `Incompatible native node module: ${message}`
211
254
  };
212
255
  };
213
256
  const getModuleSyntaxError = () => {
214
257
  return {
215
- message: `ES Modules are not supported in electron`,
216
- code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
258
+ code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
259
+ message: `ES Modules are not supported in electron`
217
260
  };
218
261
  };
219
262
  const getHelpfulChildProcessError = (stdout, stderr) => {
@@ -232,8 +275,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
232
275
  rest
233
276
  } = getDetails(lines);
234
277
  return {
235
- message: actualMessage,
236
278
  code: '',
279
+ message: actualMessage,
237
280
  stack: rest
238
281
  };
239
282
  };
@@ -243,8 +286,8 @@ class IpcError extends VError {
243
286
  if (stdout || stderr) {
244
287
  // @ts-ignore
245
288
  const {
246
- message,
247
289
  code,
290
+ message,
248
291
  stack
249
292
  } = getHelpfulChildProcessError(stdout, stderr);
250
293
  const cause = new Error(message);
@@ -305,8 +348,8 @@ const wrap$f = global => {
305
348
  };
306
349
  const waitForFirstMessage = async port => {
307
350
  const {
308
- resolve,
309
- promise
351
+ promise,
352
+ resolve
310
353
  } = Promise.withResolvers();
311
354
  port.addEventListener('message', resolve, {
312
355
  once: true
@@ -326,8 +369,8 @@ const listen$6 = async () => {
326
369
  const type = firstMessage.params[0];
327
370
  if (type === 'message-port') {
328
371
  parentIpc.send({
329
- jsonrpc: '2.0',
330
372
  id: firstMessage.id,
373
+ jsonrpc: '2.0',
331
374
  result: null
332
375
  });
333
376
  parentIpc.dispose();
@@ -889,10 +932,11 @@ const create$2 = () => {
889
932
  wrapCommand(fn) {
890
933
  const wrapped = async (uid, ...args) => {
891
934
  const {
935
+ oldState,
892
936
  newState
893
937
  } = states[uid];
894
938
  const newerState = await fn(newState, ...args);
895
- if (newState === newerState) {
939
+ if (oldState === newerState || newState === newerState) {
896
940
  return;
897
941
  }
898
942
  const latest = states[uid];
@@ -1016,7 +1060,7 @@ const getFilteredItems = (items, tabs, searchValue, modifiedSettings, preference
1016
1060
  };
1017
1061
 
1018
1062
  const User = 1;
1019
- const Script = 2;
1063
+ const Script$1 = 2;
1020
1064
 
1021
1065
  const FocusSettingsInput = 2199;
1022
1066
 
@@ -1047,8 +1091,8 @@ const clear$1 = state => {
1047
1091
  deltaY: 0,
1048
1092
  filteredItems,
1049
1093
  focus: FocusSettingsInput,
1050
- focusSource: Script,
1051
- inputSource: Script,
1094
+ focusSource: Script$1,
1095
+ inputSource: Script$1,
1052
1096
  maxLineY,
1053
1097
  minLineY,
1054
1098
  scrollBarThumbHeight: thumbHeight,
@@ -1176,7 +1220,7 @@ const AdditionalDetails = 'AdditionalDetails';
1176
1220
  const AdditionalDetailsEntry = 'AdditionalDetailsEntry';
1177
1221
  const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
1178
1222
  const Aside$1 = 'Aside';
1179
- const Badge$1 = 'Badge';
1223
+ const Badge = 'Badge';
1180
1224
  const Button$1 = 'Button';
1181
1225
  const ButtonPrimary = 'ButtonPrimary';
1182
1226
  const CallStackArrow = 'CallStackArrow';
@@ -1412,7 +1456,7 @@ const ClassNames = {
1412
1456
  AdditionalDetailsEntry,
1413
1457
  AdditionalDetailsTitle,
1414
1458
  Aside: Aside$1,
1415
- Badge: Badge$1,
1459
+ Badge,
1416
1460
  Button: Button$1,
1417
1461
  ButtonPrimary,
1418
1462
  CallStackArrow,
@@ -1658,9 +1702,6 @@ const Label$1 = 66;
1658
1702
  const UpArrow = 14;
1659
1703
  const DownArrow = 16;
1660
1704
 
1661
- const DebugWorker = 55;
1662
- const RendererWorker$1 = 1;
1663
-
1664
1705
  const mergeClassNames = (...classNames) => {
1665
1706
  return classNames.filter(Boolean).join(' ');
1666
1707
  };
@@ -2022,6 +2063,11 @@ const getModifiedSettings = preferences => {
2022
2063
  return modifiedSettings;
2023
2064
  };
2024
2065
 
2066
+ const Script = 2;
2067
+
2068
+ const DebugWorker = 55;
2069
+ const RendererWorker$1 = 1;
2070
+
2025
2071
  const rpcs = Object.create(null);
2026
2072
  const set$2 = (id, rpc) => {
2027
2073
  rpcs[id] = rpc;
@@ -2032,6 +2078,10 @@ const get = id => {
2032
2078
 
2033
2079
  const create = rpcId => {
2034
2080
  return {
2081
+ async dispose() {
2082
+ const rpc = get(rpcId);
2083
+ await rpc.dispose();
2084
+ },
2035
2085
  // @ts-ignore
2036
2086
  invoke(method, ...params) {
2037
2087
  const rpc = get(rpcId);
@@ -2046,19 +2096,15 @@ const create = rpcId => {
2046
2096
  },
2047
2097
  set(rpc) {
2048
2098
  set$2(rpcId, rpc);
2049
- },
2050
- async dispose() {
2051
- const rpc = get(rpcId);
2052
- await rpc.dispose();
2053
2099
  }
2054
2100
  };
2055
2101
  };
2056
2102
 
2057
2103
  const {
2104
+ dispose,
2058
2105
  invoke,
2059
2106
  invokeAndTransfer,
2060
- set: set$1,
2061
- dispose
2107
+ set: set$1
2062
2108
  } = create(RendererWorker$1);
2063
2109
  const searchFileHtml = async uri => {
2064
2110
  return invoke('ExtensionHost.searchFileWithHtml', uri);
@@ -2066,9 +2112,20 @@ const searchFileHtml = async uri => {
2066
2112
  const getFilePathElectron = async file => {
2067
2113
  return invoke('FileSystemHandle.getFilePathElectron', file);
2068
2114
  };
2115
+ /**
2116
+ * @deprecated
2117
+ */
2069
2118
  const showContextMenu = async (x, y, id, ...args) => {
2070
2119
  return invoke('ContextMenu.show', x, y, id, ...args);
2071
2120
  };
2121
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
2122
+ number(uid);
2123
+ number(menuId);
2124
+ number(x);
2125
+ number(y);
2126
+ // @ts-ignore
2127
+ await invoke('ContextMenu.show2', uid, menuId, x, y, args);
2128
+ };
2072
2129
  const getElectronVersion = async () => {
2073
2130
  return invoke('Process.getElectronVersion');
2074
2131
  };
@@ -2160,6 +2217,9 @@ const handleDebugChange = async params => {
2160
2217
  const getFolderIcon = async options => {
2161
2218
  return invoke('IconTheme.getFolderIcon', options);
2162
2219
  };
2220
+ const handleWorkspaceRefresh = async () => {
2221
+ return invoke('Layout.handleWorkspaceRefresh');
2222
+ };
2163
2223
  const closeWidget = async widgetId => {
2164
2224
  return invoke('Viewlet.closeWidget', widgetId);
2165
2225
  };
@@ -2184,6 +2244,9 @@ const getKeyBindings = async () => {
2184
2244
  const writeClipBoardText = async text => {
2185
2245
  await invoke('ClipBoard.writeText', /* text */text);
2186
2246
  };
2247
+ const readClipBoardText = async () => {
2248
+ return invoke('ClipBoard.readText');
2249
+ };
2187
2250
  const writeClipBoardImage = async blob => {
2188
2251
  // @ts-ignore
2189
2252
  await invoke('ClipBoard.writeImage', /* text */blob);
@@ -2208,8 +2271,8 @@ const getIcons = async requests => {
2208
2271
  const icons = await invoke('IconTheme.getIcons', requests);
2209
2272
  return icons;
2210
2273
  };
2211
- const activateByEvent = event => {
2212
- return invoke('ExtensionHostManagement.activateByEvent', event);
2274
+ const activateByEvent = (event, assetDir, platform) => {
2275
+ return invoke('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
2213
2276
  };
2214
2277
  const setAdditionalFocus = focusKey => {
2215
2278
  // @ts-ignore
@@ -2227,6 +2290,33 @@ const sendMessagePortToRendererProcess = async port => {
2227
2290
  // @ts-ignore
2228
2291
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
2229
2292
  };
2293
+ const sendMessagePortToTextMeasurementWorker = async port => {
2294
+ const command = 'TextMeasurement.handleMessagePort';
2295
+ // @ts-ignore
2296
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
2297
+ };
2298
+ const sendMessagePortToSourceControlWorker = async port => {
2299
+ const command = 'SourceControl.handleMessagePort';
2300
+ // @ts-ignore
2301
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
2302
+ };
2303
+ const sendMessagePortToSharedProcess = async port => {
2304
+ const command = 'HandleElectronMessagePort.handleElectronMessagePort';
2305
+ // @ts-ignore
2306
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, 0);
2307
+ };
2308
+ const sendMessagePortToFileSystemProcess = async (port, rpcId) => {
2309
+ const command = 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess';
2310
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, rpcId);
2311
+ };
2312
+ const sendMessagePortToIframeWorker = async (port, rpcId) => {
2313
+ const command = 'Iframes.handleMessagePort';
2314
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIframeWorker', port, command, rpcId);
2315
+ };
2316
+ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
2317
+ const command = 'Extensions.handleMessagePort';
2318
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
2319
+ };
2230
2320
  const getPreference = async key => {
2231
2321
  return await invoke('Preferences.get', key);
2232
2322
  };
@@ -2292,13 +2382,29 @@ const installExtension = async id => {
2292
2382
  // @ts-ignore
2293
2383
  return invoke('ExtensionManagement.install', id);
2294
2384
  };
2385
+ const minimizeWindow = async () => {
2386
+ // @ts-ignore
2387
+ return invoke('ElectronWindow.minimize');
2388
+ };
2389
+ const unmaximizeWindow = async () => {
2390
+ // @ts-ignore
2391
+ return invoke('ElectronWindow.unmaximize');
2392
+ };
2393
+ const maximizeWindow = async () => {
2394
+ // @ts-ignore
2395
+ return invoke('ElectronWindow.maximize');
2396
+ };
2397
+ const closeWindow = async () => {
2398
+ // @ts-ignore
2399
+ return invoke('ElectronWindow.close');
2400
+ };
2295
2401
  const openExtensionSearch = async () => {
2296
2402
  // @ts-ignore
2297
2403
  return invoke('SideBar.openViewlet', 'Extensions');
2298
2404
  };
2299
2405
  const setExtensionsSearchValue = async searchValue => {
2300
2406
  // @ts-ignore
2301
- return invoke('Extensions.handleInput', searchValue);
2407
+ return invoke('Extensions.handleInput', searchValue, Script);
2302
2408
  };
2303
2409
  const openExternal = async uri => {
2304
2410
  // @ts-ignore
@@ -2320,6 +2426,9 @@ const getLogsDir = async () => {
2320
2426
  // @ts-ignore
2321
2427
  return invoke('PlatformPaths.getLogsDir');
2322
2428
  };
2429
+ const measureTextBlockHeight = async (actualInput, fontFamily, fontSize, lineHeightPx, width) => {
2430
+ return invoke(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
2431
+ };
2323
2432
  const registerMockRpc = commandMap => {
2324
2433
  const mockRpc = createMockRpc({
2325
2434
  commandMap
@@ -2333,6 +2442,7 @@ const RendererWorker = {
2333
2442
  activateByEvent,
2334
2443
  applyBulkReplacement,
2335
2444
  closeWidget,
2445
+ closeWindow,
2336
2446
  confirm,
2337
2447
  disableExtension,
2338
2448
  dispose,
@@ -2366,15 +2476,20 @@ const RendererWorker = {
2366
2476
  handleDebugPaused,
2367
2477
  handleDebugResumed,
2368
2478
  handleDebugScriptParsed,
2479
+ handleWorkspaceRefresh,
2369
2480
  installExtension,
2370
2481
  invoke,
2371
2482
  invokeAndTransfer,
2483
+ maximizeWindow,
2484
+ measureTextBlockHeight,
2485
+ minimizeWindow,
2372
2486
  openExtensionSearch,
2373
2487
  openExternal,
2374
2488
  openNativeFolder,
2375
2489
  openUri,
2376
2490
  openUrl,
2377
2491
  openWidget,
2492
+ readClipBoardText,
2378
2493
  readFile,
2379
2494
  registerMockRpc,
2380
2495
  registerWebViewInterceptor,
@@ -2386,12 +2501,18 @@ const RendererWorker = {
2386
2501
  sendMessagePortToEditorWorker,
2387
2502
  sendMessagePortToErrorWorker,
2388
2503
  sendMessagePortToExtensionHostWorker,
2504
+ sendMessagePortToExtensionManagementWorker,
2505
+ sendMessagePortToFileSystemProcess,
2389
2506
  sendMessagePortToFileSystemWorker,
2390
2507
  sendMessagePortToIconThemeWorker,
2508
+ sendMessagePortToIframeWorker,
2391
2509
  sendMessagePortToMarkdownWorker,
2392
2510
  sendMessagePortToRendererProcess,
2393
2511
  sendMessagePortToSearchProcess,
2512
+ sendMessagePortToSharedProcess,
2513
+ sendMessagePortToSourceControlWorker,
2394
2514
  sendMessagePortToSyntaxHighlightingWorker,
2515
+ sendMessagePortToTextMeasurementWorker,
2395
2516
  set: set$1,
2396
2517
  setAdditionalFocus,
2397
2518
  setColorTheme,
@@ -2400,10 +2521,12 @@ const RendererWorker = {
2400
2521
  setWebViewPort,
2401
2522
  setWorkspacePath,
2402
2523
  showContextMenu,
2524
+ showContextMenu2,
2403
2525
  showErrorDialog,
2404
2526
  showMessageBox,
2405
2527
  showSaveFilePicker,
2406
2528
  uninstallExtension,
2529
+ unmaximizeWindow,
2407
2530
  unregisterWebViewInterceptor,
2408
2531
  writeClipBoardImage,
2409
2532
  writeClipBoardText
@@ -4645,7 +4768,7 @@ const loadContent = async (state, savedState) => {
4645
4768
  filteredItems,
4646
4769
  history,
4647
4770
  historyIndex,
4648
- inputSource: Script,
4771
+ inputSource: Script$1,
4649
4772
  items,
4650
4773
  maxLineY,
4651
4774
  minLineY,
@@ -4676,11 +4799,11 @@ const renderFocusContext = (oldState, newState) => {
4676
4799
  const {
4677
4800
  Viewlet
4678
4801
  } = ClassNames;
4679
- const Badge = 'Badge';
4680
4802
  const CheckBox = 'CheckBox';
4681
4803
  const ErrorMessage = 'ErrorMessage';
4682
4804
  const InputBox = 'InputBox';
4683
4805
  const InputBoxError = 'InputBoxError';
4806
+ const InputBadge = 'InputBadge';
4684
4807
  const Label = 'Label';
4685
4808
  const MaskIcon = 'MaskIcon';
4686
4809
  const MaskIconClearAll = 'MaskIconClearAll';
@@ -4715,7 +4838,7 @@ const getSettingsInputBadgeDom = (filteredSettingsCount, hasSearchValue) => {
4715
4838
  const badgeText = matchingSettings(filteredSettingsCount);
4716
4839
  return [{
4717
4840
  childCount: 1,
4718
- className: Badge,
4841
+ className: InputBadge,
4719
4842
  type: Div
4720
4843
  }, text(badgeText)];
4721
4844
  };
@@ -5355,7 +5478,7 @@ const useNextSearchValue = state => {
5355
5478
  ...state,
5356
5479
  filteredItems,
5357
5480
  historyIndex: newHistoryIndex,
5358
- inputSource: Script,
5481
+ inputSource: Script$1,
5359
5482
  searchValue: newSearchValue
5360
5483
  };
5361
5484
  };
@@ -5379,7 +5502,7 @@ const usePreviousSearchValue = state => {
5379
5502
  ...state,
5380
5503
  filteredItems,
5381
5504
  historyIndex: newHistoryIndex,
5382
- inputSource: Script,
5505
+ inputSource: Script$1,
5383
5506
  searchValue: newSearchValue
5384
5507
  };
5385
5508
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",