@lvce-editor/settings-view 1.15.0 → 1.17.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.
@@ -937,7 +937,7 @@ const filterBySearch = (items, searchValue) => {
937
937
  const normalizedSearchValue = searchValue.toLowerCase().trim();
938
938
  return items.filter(item => item.heading.toLowerCase().includes(normalizedSearchValue));
939
939
  };
940
- const getFilteredItems = (items, tabs, searchValue = '', preferences = {}) => {
940
+ const getFilteredItems = (items, tabs, searchValue = '', preferences) => {
941
941
  const tabFilteredItems = filterByTab(items, tabs);
942
942
  const itemsWithModifiedProperty = addModifiedProperty(tabFilteredItems, preferences);
943
943
  return filterBySearch(itemsWithModifiedProperty, searchValue);
@@ -952,10 +952,10 @@ const clear$1 = state => {
952
952
  const {
953
953
  items,
954
954
  tabs,
955
- preferences
955
+ modifiedSettings
956
956
  } = state;
957
957
  const newSearchValue = '';
958
- const filteredItems = getFilteredItems(items, tabs, newSearchValue, preferences);
958
+ const filteredItems = getFilteredItems(items, tabs, newSearchValue, modifiedSettings);
959
959
  return {
960
960
  ...state,
961
961
  filteredItems,
@@ -1037,13 +1037,18 @@ const isEqual = (oldState, newState) => {
1037
1037
  return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1038
1038
  };
1039
1039
 
1040
- const modules = [isEqual$4, isEqual$3, isEqual, isEqual$1, isEqual$2];
1041
- const numbers = [RenderFocus, RenderItems, RenderValue, RenderSettingValues, RenderScrollOffset];
1040
+ const modules = [isEqual$3, isEqual, isEqual$1, isEqual$2, isEqual$4, isEqual$4];
1041
+ const numbers = [RenderItems, RenderValue, RenderSettingValues, RenderScrollOffset, RenderFocus, RenderFocusContext];
1042
1042
 
1043
1043
  const diff = (oldState, newState) => {
1044
1044
  const diffResult = [];
1045
1045
  for (let i = 0; i < modules.length; i++) {
1046
1046
  const fn = modules[i];
1047
+
1048
+ // TODO enable this
1049
+ if (numbers[i] === RenderScrollOffset) {
1050
+ continue;
1051
+ }
1047
1052
  if (!fn(oldState, newState)) {
1048
1053
  diffResult.push(numbers[i]);
1049
1054
  }
@@ -1060,8 +1065,69 @@ const diff2 = uid => {
1060
1065
  return diffResult;
1061
1066
  };
1062
1067
 
1063
- const getKeyBindings = () => {
1064
- return [];
1068
+ const Tab$1 = 'tab';
1069
+ const TabList = 'tablist';
1070
+ const AriaRoles = {
1071
+ __proto__: null,
1072
+ Tab: Tab$1,
1073
+ TabList};
1074
+ const Viewlet$1 = 'Viewlet';
1075
+ const ClassNames = {
1076
+ __proto__: null,
1077
+ Viewlet: Viewlet$1};
1078
+ const UpArrow = 14;
1079
+ const DownArrow = 16;
1080
+ const KeyCode = {
1081
+ __proto__: null,
1082
+ DownArrow,
1083
+ UpArrow
1084
+ };
1085
+ const mergeClassNames = (...classNames) => {
1086
+ return classNames.filter(Boolean).join(' ');
1087
+ };
1088
+ const Button$1 = 1;
1089
+ const Div = 4;
1090
+ const H1 = 5;
1091
+ const Input = 6;
1092
+ const Text = 12;
1093
+ const H3 = 23;
1094
+ const Aside = 28;
1095
+ const P = 50;
1096
+ const Ul = 60;
1097
+ const Select$1 = 63;
1098
+ const Option = 64;
1099
+ const Label = 66;
1100
+ const VirtualDomElements = {
1101
+ __proto__: null,
1102
+ Aside,
1103
+ Button: Button$1,
1104
+ Div,
1105
+ H1,
1106
+ H3,
1107
+ Input,
1108
+ Label,
1109
+ Option,
1110
+ P,
1111
+ Select: Select$1,
1112
+ Ul};
1113
+ const text = data => {
1114
+ return {
1115
+ type: Text,
1116
+ text: data,
1117
+ childCount: 0
1118
+ };
1119
+ };
1120
+
1121
+ const getKeyBindings$1 = () => {
1122
+ return [{
1123
+ key: KeyCode.UpArrow,
1124
+ command: 'Settings.usePreviousSearchValue',
1125
+ when: FocusSettingsInput
1126
+ }, {
1127
+ key: KeyCode.DownArrow,
1128
+ command: 'Settings.useNextSearchValue',
1129
+ when: FocusSettingsInput
1130
+ }];
1065
1131
  };
1066
1132
 
1067
1133
  const getName = () => {
@@ -1098,10 +1164,10 @@ const handleClickTab = (state, name) => {
1098
1164
  items,
1099
1165
  tabs,
1100
1166
  searchValue,
1101
- preferences
1167
+ modifiedSettings
1102
1168
  } = state;
1103
1169
  const updatedTabs = getUpdatedTabs(tabs, name);
1104
- const filteredItems = getFilteredItems(items, updatedTabs, searchValue, preferences);
1170
+ const filteredItems = getFilteredItems(items, updatedTabs, searchValue, modifiedSettings);
1105
1171
  return {
1106
1172
  ...state,
1107
1173
  tabs: updatedTabs,
@@ -1112,12 +1178,57 @@ const handleClickTab = (state, name) => {
1112
1178
  const addToHistory = (history, value) => {
1113
1179
  let newHistory = history;
1114
1180
  let newHistoryIndex = -1;
1115
- if (value && value.trim() && !history.includes(value)) {
1116
- newHistory = [...history, value];
1181
+ if (!value || !value.trim()) {
1182
+ return {
1183
+ newHistory,
1184
+ newHistoryIndex
1185
+ };
1186
+ }
1187
+ const trimmedValue = value.trim();
1188
+
1189
+ // Check if this value is already in history
1190
+ const existingIndex = history.indexOf(trimmedValue);
1191
+ if (existingIndex !== -1) {
1192
+ newHistoryIndex = existingIndex;
1193
+ return {
1194
+ newHistory,
1195
+ newHistoryIndex
1196
+ };
1197
+ }
1198
+
1199
+ // Check if this value is a prefix of any existing history item
1200
+ // If it is, don't add it to history yet (it's still being typed)
1201
+ const isPrefixOfExisting = history.some(historyItem => historyItem.startsWith(trimmedValue) && historyItem !== trimmedValue);
1202
+ if (isPrefixOfExisting) {
1203
+ // Don't add to history, but find the closest match for index
1204
+ const closestMatch = history.find(historyItem => historyItem.startsWith(trimmedValue));
1205
+ if (closestMatch) {
1206
+ newHistoryIndex = history.indexOf(closestMatch);
1207
+ }
1208
+ return {
1209
+ newHistory,
1210
+ newHistoryIndex
1211
+ };
1212
+ }
1213
+
1214
+ // Check if any existing history items are prefixes of this value
1215
+ // If so, remove all prefix items and add the complete value at the first prefix position
1216
+ const prefixItems = history.filter(historyItem => trimmedValue.startsWith(historyItem) && historyItem !== trimmedValue);
1217
+ if (prefixItems.length > 0) {
1218
+ // Find the position of the first prefix item
1219
+ const firstPrefixIndex = history.findIndex(historyItem => trimmedValue.startsWith(historyItem) && historyItem !== trimmedValue);
1220
+
1221
+ // Remove all prefix items and add the complete value at the first prefix position
1222
+
1223
+ // Insert the new value at the position where the first prefix was
1224
+ const beforePrefix = history.slice(0, firstPrefixIndex);
1225
+ const afterPrefix = history.slice(firstPrefixIndex).filter(historyItem => !trimmedValue.startsWith(historyItem) || historyItem === trimmedValue);
1226
+ newHistory = [...beforePrefix, trimmedValue, ...afterPrefix];
1227
+ newHistoryIndex = firstPrefixIndex;
1228
+ } else {
1229
+ // Add as new item
1230
+ newHistory = [...history, trimmedValue];
1117
1231
  newHistoryIndex = newHistory.length - 1;
1118
- } else if (value && value.trim()) {
1119
- // If value already exists in history, find its index
1120
- newHistoryIndex = history.indexOf(value);
1121
1232
  }
1122
1233
  return {
1123
1234
  newHistory,
@@ -1129,10 +1240,10 @@ const handleInput = (state, value, inputSource = User) => {
1129
1240
  const {
1130
1241
  items,
1131
1242
  tabs,
1132
- preferences,
1133
- history
1243
+ history,
1244
+ modifiedSettings
1134
1245
  } = state;
1135
- const filteredItems = getFilteredItems(items, tabs, value, preferences);
1246
+ const filteredItems = getFilteredItems(items, tabs, value, modifiedSettings);
1136
1247
  const {
1137
1248
  newHistory,
1138
1249
  newHistoryIndex
@@ -1147,8 +1258,16 @@ const handleInput = (state, value, inputSource = User) => {
1147
1258
  };
1148
1259
  };
1149
1260
 
1261
+ const None = 0;
1150
1262
  const SearchInput = 1;
1151
1263
 
1264
+ const handleInputBlur = state => {
1265
+ return {
1266
+ ...state,
1267
+ focus: None
1268
+ };
1269
+ };
1270
+
1152
1271
  const handleInputFocus = state => {
1153
1272
  return {
1154
1273
  ...state,
@@ -1220,8 +1339,378 @@ const initialize = async () => {
1220
1339
  // TODO
1221
1340
  };
1222
1341
 
1342
+ const getModifiedSettings = preferences => {
1343
+ const modifiedSettings = Object.create(null);
1344
+ for (const key of Object.keys(preferences)) {
1345
+ modifiedSettings[key] = true;
1346
+ }
1347
+ return modifiedSettings;
1348
+ };
1349
+
1350
+ const rpcs = Object.create(null);
1351
+ const set$g = (id, rpc) => {
1352
+ rpcs[id] = rpc;
1353
+ };
1354
+ const get = id => {
1355
+ return rpcs[id];
1356
+ };
1357
+
1358
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
1359
+
1360
+ const create = rpcId => {
1361
+ return {
1362
+ // @ts-ignore
1363
+ invoke(method, ...params) {
1364
+ const rpc = get(rpcId);
1365
+ // @ts-ignore
1366
+ return rpc.invoke(method, ...params);
1367
+ },
1368
+ // @ts-ignore
1369
+ invokeAndTransfer(method, ...params) {
1370
+ const rpc = get(rpcId);
1371
+ // @ts-ignore
1372
+ return rpc.invokeAndTransfer(method, ...params);
1373
+ },
1374
+ set(rpc) {
1375
+ set$g(rpcId, rpc);
1376
+ },
1377
+ async dispose() {
1378
+ const rpc = get(rpcId);
1379
+ await rpc.dispose();
1380
+ }
1381
+ };
1382
+ };
1383
+ const DebugWorker$1 = 55;
1384
+ const RendererWorker$1 = 1;
1385
+ const {
1386
+ invoke: invoke$3,
1387
+ invokeAndTransfer: invokeAndTransfer$3,
1388
+ set: set$3,
1389
+ dispose: dispose$3
1390
+ } = create(RendererWorker$1);
1391
+ const searchFileHtml = async uri => {
1392
+ return invoke$3('ExtensionHost.searchFileWithHtml', uri);
1393
+ };
1394
+ const getFilePathElectron = async file => {
1395
+ return invoke$3('FileSystemHandle.getFilePathElectron', file);
1396
+ };
1397
+ const showContextMenu = async (x, y, id, ...args) => {
1398
+ return invoke$3('ContextMenu.show', x, y, id, ...args);
1399
+ };
1400
+ const getElectronVersion = async () => {
1401
+ return invoke$3('Process.getElectronVersion');
1402
+ };
1403
+ const applyBulkReplacement = async bulkEdits => {
1404
+ await invoke$3('BulkReplacement.applyBulkReplacement', bulkEdits);
1405
+ };
1406
+ const setColorTheme = async id => {
1407
+ // @ts-ignore
1408
+ return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1409
+ };
1410
+ const getNodeVersion = async () => {
1411
+ return invoke$3('Process.getNodeVersion');
1412
+ };
1413
+ const getChromeVersion = async () => {
1414
+ return invoke$3('Process.getChromeVersion');
1415
+ };
1416
+ const getV8Version = async () => {
1417
+ return invoke$3('Process.getV8Version');
1418
+ };
1419
+ const getFileHandles = async fileIds => {
1420
+ const files = await invoke$3('FileSystemHandle.getFileHandles', fileIds);
1421
+ return files;
1422
+ };
1423
+ const setWorkspacePath = async path => {
1424
+ await invoke$3('Workspace.setPath', path);
1425
+ };
1426
+ const registerWebViewInterceptor = async (id, port) => {
1427
+ await invokeAndTransfer$3('WebView.registerInterceptor', id, port);
1428
+ };
1429
+ const unregisterWebViewInterceptor = async id => {
1430
+ await invoke$3('WebView.unregisterInterceptor', id);
1431
+ };
1432
+ const sendMessagePortToEditorWorker = async (port, rpcId) => {
1433
+ const command = 'HandleMessagePort.handleMessagePort';
1434
+ // @ts-ignore
1435
+ await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1436
+ };
1437
+ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1438
+ const command = 'Markdown.handleMessagePort';
1439
+ // @ts-ignore
1440
+ await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1441
+ };
1442
+ const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1443
+ const command = 'FileSystem.handleMessagePort';
1444
+ // @ts-ignore
1445
+ await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1446
+ };
1447
+ const readFile = async uri => {
1448
+ return invoke$3('FileSystem.readFile', uri);
1449
+ };
1450
+ const getWebViewSecret = async key => {
1451
+ // @ts-ignore
1452
+ return invoke$3('WebView.getSecret', key);
1453
+ };
1454
+ const setWebViewPort = async (uid, port, origin, portType) => {
1455
+ return invokeAndTransfer$3('WebView.setPort', uid, port, origin, portType);
1456
+ };
1457
+ const setFocus = key => {
1458
+ return invoke$3('Focus.setFocus', key);
1459
+ };
1460
+ const getFileIcon = async options => {
1461
+ return invoke$3('IconTheme.getFileIcon', options);
1462
+ };
1463
+ const getColorThemeNames = async () => {
1464
+ return invoke$3('ColorTheme.getColorThemeNames');
1465
+ };
1466
+ const disableExtension = async id => {
1467
+ return invoke$3('ExtensionManagement.disable', id);
1468
+ };
1469
+ const enableExtension = async id => {
1470
+ // @ts-ignore
1471
+ return invoke$3('ExtensionManagement.enable', id);
1472
+ };
1473
+ const handleDebugChange = async params => {
1474
+ // @ts-ignore
1475
+ return invoke$3('Run And Debug.handleChange', params);
1476
+ };
1477
+ const getFolderIcon = async options => {
1478
+ return invoke$3('IconTheme.getFolderIcon', options);
1479
+ };
1480
+ const closeWidget = async widgetId => {
1481
+ return invoke$3('Viewlet.closeWidget', widgetId);
1482
+ };
1483
+ const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1484
+ const command = 'HandleMessagePort.handleMessagePort2';
1485
+ await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1486
+ };
1487
+ const sendMessagePortToSearchProcess = async port => {
1488
+ await invokeAndTransfer$3('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1489
+ };
1490
+ const confirm = async (message, options) => {
1491
+ // @ts-ignore
1492
+ const result = await invoke$3('Confirmprompt.prompt', message, options);
1493
+ return result;
1494
+ };
1495
+ const getRecentlyOpened = async () => {
1496
+ return invoke$3(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1497
+ };
1498
+ const getKeyBindings = async () => {
1499
+ return invoke$3('KeyBindingsInitial.getKeyBindings');
1500
+ };
1501
+ const writeClipBoardText = async text => {
1502
+ await invoke$3('ClipBoard.writeText', /* text */text);
1503
+ };
1504
+ const writeClipBoardImage = async blob => {
1505
+ // @ts-ignore
1506
+ await invoke$3('ClipBoard.writeImage', /* text */blob);
1507
+ };
1508
+ const searchFileMemory = async uri => {
1509
+ // @ts-ignore
1510
+ return invoke$3('ExtensionHost.searchFileWithMemory', uri);
1511
+ };
1512
+ const searchFileFetch = async uri => {
1513
+ return invoke$3('ExtensionHost.searchFileWithFetch', uri);
1514
+ };
1515
+ const showMessageBox = async options => {
1516
+ return invoke$3('ElectronDialog.showMessageBox', options);
1517
+ };
1518
+ const handleDebugResumed = async params => {
1519
+ await invoke$3('Run And Debug.handleResumed', params);
1520
+ };
1521
+ const openWidget = async name => {
1522
+ await invoke$3('Viewlet.openWidget', name);
1523
+ };
1524
+ const getIcons = async requests => {
1525
+ const icons = await invoke$3('IconTheme.getIcons', requests);
1526
+ return icons;
1527
+ };
1528
+ const activateByEvent = event => {
1529
+ return invoke$3('ExtensionHostManagement.activateByEvent', event);
1530
+ };
1531
+ const setAdditionalFocus = focusKey => {
1532
+ // @ts-ignore
1533
+ return invoke$3('Focus.setAdditionalFocus', focusKey);
1534
+ };
1535
+ const getActiveEditorId = () => {
1536
+ // @ts-ignore
1537
+ return invoke$3('GetActiveEditor.getActiveEditorId');
1538
+ };
1539
+ const getWorkspacePath = () => {
1540
+ return invoke$3('Workspace.getPath');
1541
+ };
1542
+ const sendMessagePortToRendererProcess = async port => {
1543
+ const command = 'HandleMessagePort.handleMessagePort';
1544
+ // @ts-ignore
1545
+ await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker$1);
1546
+ };
1547
+ const getPreference = async key => {
1548
+ return await invoke$3('Preferences.get', key);
1549
+ };
1550
+ const getAllExtensions = async () => {
1551
+ return invoke$3('ExtensionManagement.getAllExtensions');
1552
+ };
1553
+ const rerenderEditor = async key => {
1554
+ // @ts-ignore
1555
+ return invoke$3('Editor.rerender', key);
1556
+ };
1557
+ const handleDebugPaused = async params => {
1558
+ await invoke$3('Run And Debug.handlePaused', params);
1559
+ };
1560
+ const openUri = async (uri, focus, options) => {
1561
+ await invoke$3('Main.openUri', uri, focus, options);
1562
+ };
1563
+ const sendMessagePortToSyntaxHighlightingWorker = async port => {
1564
+ await invokeAndTransfer$3(
1565
+ // @ts-ignore
1566
+ 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1567
+ };
1568
+ const handleDebugScriptParsed = async script => {
1569
+ await invoke$3('Run And Debug.handleScriptParsed', script);
1570
+ };
1571
+ const getWindowId = async () => {
1572
+ return invoke$3('GetWindowId.getWindowId');
1573
+ };
1574
+ const getBlob = async uri => {
1575
+ // @ts-ignore
1576
+ return invoke$3('FileSystem.getBlob', uri);
1577
+ };
1578
+ const getExtensionCommands = async () => {
1579
+ return invoke$3('ExtensionHost.getCommands');
1580
+ };
1581
+ const showErrorDialog = async errorInfo => {
1582
+ // @ts-ignore
1583
+ await invoke$3('ErrorHandling.showErrorDialog', errorInfo);
1584
+ };
1585
+ const getFolderSize = async uri => {
1586
+ // @ts-ignore
1587
+ return await invoke$3('FileSystem.getFolderSize', uri);
1588
+ };
1589
+ const getExtension = async id => {
1590
+ // @ts-ignore
1591
+ return invoke$3('ExtensionManagement.getExtension', id);
1592
+ };
1593
+ const getMarkdownDom = async html => {
1594
+ // @ts-ignore
1595
+ return invoke$3('Markdown.getVirtualDom', html);
1596
+ };
1597
+ const renderMarkdown = async (markdown, options) => {
1598
+ // @ts-ignore
1599
+ return invoke$3('Markdown.renderMarkdown', markdown, options);
1600
+ };
1601
+ const openNativeFolder = async uri => {
1602
+ // @ts-ignore
1603
+ await invoke$3('OpenNativeFolder.openNativeFolder', uri);
1604
+ };
1605
+ const uninstallExtension = async id => {
1606
+ return invoke$3('ExtensionManagement.uninstall', id);
1607
+ };
1608
+ const installExtension = async id => {
1609
+ // @ts-ignore
1610
+ return invoke$3('ExtensionManagement.install', id);
1611
+ };
1612
+ const openExtensionSearch = async () => {
1613
+ // @ts-ignore
1614
+ return invoke$3('SideBar.openViewlet', 'Extensions');
1615
+ };
1616
+ const setExtensionsSearchValue = async searchValue => {
1617
+ // @ts-ignore
1618
+ return invoke$3('Extensions.handleInput', searchValue);
1619
+ };
1620
+ const openExternal = async uri => {
1621
+ // @ts-ignore
1622
+ await invoke$3('Open.openExternal', uri);
1623
+ };
1624
+ const openUrl = async uri => {
1625
+ // @ts-ignore
1626
+ await invoke$3('Open.openUrl', uri);
1627
+ };
1628
+ const getAllPreferences = async () => {
1629
+ // @ts-ignore
1630
+ return invoke$3('Preferences.getAll');
1631
+ };
1632
+ const RendererWorker = {
1633
+ __proto__: null,
1634
+ activateByEvent,
1635
+ applyBulkReplacement,
1636
+ closeWidget,
1637
+ confirm,
1638
+ disableExtension,
1639
+ dispose: dispose$3,
1640
+ enableExtension,
1641
+ getActiveEditorId,
1642
+ getAllExtensions,
1643
+ getAllPreferences,
1644
+ getBlob,
1645
+ getChromeVersion,
1646
+ getColorThemeNames,
1647
+ getElectronVersion,
1648
+ getExtension,
1649
+ getExtensionCommands,
1650
+ getFileHandles,
1651
+ getFileIcon,
1652
+ getFilePathElectron,
1653
+ getFolderIcon,
1654
+ getFolderSize,
1655
+ getIcons,
1656
+ getKeyBindings,
1657
+ getMarkdownDom,
1658
+ getNodeVersion,
1659
+ getPreference,
1660
+ getRecentlyOpened,
1661
+ getV8Version,
1662
+ getWebViewSecret,
1663
+ getWindowId,
1664
+ getWorkspacePath,
1665
+ handleDebugChange,
1666
+ handleDebugPaused,
1667
+ handleDebugResumed,
1668
+ handleDebugScriptParsed,
1669
+ installExtension,
1670
+ invoke: invoke$3,
1671
+ invokeAndTransfer: invokeAndTransfer$3,
1672
+ openExtensionSearch,
1673
+ openExternal,
1674
+ openNativeFolder,
1675
+ openUri,
1676
+ openUrl,
1677
+ openWidget,
1678
+ readFile,
1679
+ registerWebViewInterceptor,
1680
+ renderMarkdown,
1681
+ rerenderEditor,
1682
+ searchFileFetch,
1683
+ searchFileHtml,
1684
+ searchFileMemory,
1685
+ sendMessagePortToEditorWorker,
1686
+ sendMessagePortToExtensionHostWorker,
1687
+ sendMessagePortToFileSystemWorker,
1688
+ sendMessagePortToMarkdownWorker,
1689
+ sendMessagePortToRendererProcess,
1690
+ sendMessagePortToSearchProcess,
1691
+ sendMessagePortToSyntaxHighlightingWorker,
1692
+ set: set$3,
1693
+ setAdditionalFocus,
1694
+ setColorTheme,
1695
+ setExtensionsSearchValue,
1696
+ setFocus,
1697
+ setWebViewPort,
1698
+ setWorkspacePath,
1699
+ showContextMenu,
1700
+ showErrorDialog,
1701
+ showMessageBox,
1702
+ uninstallExtension,
1703
+ unregisterWebViewInterceptor,
1704
+ writeClipBoardImage,
1705
+ writeClipBoardText
1706
+ };
1707
+
1223
1708
  const getPreferences = async () => {
1224
- return {};
1709
+ try {
1710
+ return await RendererWorker.getAllPreferences();
1711
+ } catch {
1712
+ return {};
1713
+ }
1225
1714
  };
1226
1715
 
1227
1716
  const ApplicationsTab = 'applications';
@@ -1239,6 +1728,7 @@ const String = 2;
1239
1728
  const Boolean$1 = 3;
1240
1729
  const Number$1 = 5;
1241
1730
  const Color = 6;
1731
+ const Url = 7;
1242
1732
 
1243
1733
  const emptyObject = {};
1244
1734
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
@@ -3284,42 +3774,70 @@ const getTabs = () => {
3284
3774
  return tabs;
3285
3775
  };
3286
3776
 
3777
+ const getSavedDeltaY = savedState => {
3778
+ if (savedState && typeof savedState === 'object' && 'deltaY' in savedState && typeof savedState.deltaY === 'number') {
3779
+ return savedState.deltaY;
3780
+ }
3781
+ return 0;
3782
+ };
3783
+
3784
+ const getSavedHistory = savedState => {
3785
+ if (savedState && typeof savedState === 'object' && 'history' in savedState && Array.isArray(savedState.history)) {
3786
+ // Validate that all items are strings and limit to last 10 items
3787
+ const validHistory = savedState.history.filter(item => typeof item === 'string').slice(-10); // Keep only the last 10 items
3788
+ return validHistory;
3789
+ }
3790
+ return [];
3791
+ };
3792
+
3793
+ const getSavedHistoryIndex = (savedState, history) => {
3794
+ if (savedState && typeof savedState === 'object' && 'historyIndex' in savedState && typeof savedState.historyIndex === 'number') {
3795
+ const {
3796
+ historyIndex
3797
+ } = savedState;
3798
+ // Ensure historyIndex is within valid bounds
3799
+ if (historyIndex >= 0 && historyIndex < history.length) {
3800
+ return historyIndex;
3801
+ }
3802
+ }
3803
+ return -1;
3804
+ };
3805
+
3287
3806
  const getSavedMinLineY = savedState => {
3288
3807
  if (savedState && typeof savedState === 'object' && 'minLineY' in savedState && typeof savedState.minLineY === 'number') {
3289
3808
  return savedState.minLineY;
3290
3809
  }
3291
3810
  return 0;
3292
3811
  };
3293
- const getSavedSearchValue = savedState => {
3294
- if (savedState && typeof savedState === 'object' && 'searchValue' in savedState && typeof savedState.searchValue === 'string') {
3295
- return savedState.searchValue;
3296
- }
3297
- return '';
3298
- };
3299
- const getSavedDeltaY = savedState => {
3300
- if (savedState && typeof savedState === 'object' && 'deltaY' in savedState && typeof savedState.deltaY === 'number') {
3301
- return savedState.deltaY;
3812
+
3813
+ const getSavedScrollOffset = savedState => {
3814
+ if (savedState && typeof savedState === 'object' && 'scrollOffset' in savedState && typeof savedState.scrollOffset === 'number') {
3815
+ return savedState.scrollOffset;
3302
3816
  }
3303
3817
  return 0;
3304
3818
  };
3305
- const getSavedWorkspacePath = savedState => {
3306
- if (savedState && typeof savedState === 'object' && 'workspacePath' in savedState && typeof savedState.workspacePath === 'string') {
3307
- return savedState.workspacePath;
3819
+
3820
+ const getSavedSearchValue = savedState => {
3821
+ if (savedState && typeof savedState === 'object' && 'searchValue' in savedState && typeof savedState.searchValue === 'string') {
3822
+ return savedState.searchValue;
3308
3823
  }
3309
3824
  return '';
3310
3825
  };
3826
+
3311
3827
  const getSavedTabId = savedState => {
3312
3828
  if (savedState && typeof savedState === 'object' && 'selectedTab' in savedState && typeof savedState.selectedTab === 'string') {
3313
3829
  return savedState.selectedTab;
3314
3830
  }
3315
3831
  return '';
3316
3832
  };
3317
- const getSavedScrollOffset = savedState => {
3318
- if (savedState && typeof savedState === 'object' && 'scrollOffset' in savedState && typeof savedState.scrollOffset === 'number') {
3319
- return savedState.scrollOffset;
3833
+
3834
+ const getSavedWorkspacePath = savedState => {
3835
+ if (savedState && typeof savedState === 'object' && 'workspacePath' in savedState && typeof savedState.workspacePath === 'string') {
3836
+ return savedState.workspacePath;
3320
3837
  }
3321
- return 0;
3838
+ return '';
3322
3839
  };
3840
+
3323
3841
  const restoreState = savedState => {
3324
3842
  if (!savedState) {
3325
3843
  return {
@@ -3328,7 +3846,9 @@ const restoreState = savedState => {
3328
3846
  deltaY: 0,
3329
3847
  tabId: '',
3330
3848
  searchValue: '',
3331
- scrollOffset: 0
3849
+ scrollOffset: 0,
3850
+ history: [],
3851
+ historyIndex: -1
3332
3852
  };
3333
3853
  }
3334
3854
  const root = getSavedWorkspacePath(savedState);
@@ -3337,35 +3857,34 @@ const restoreState = savedState => {
3337
3857
  const tabId = getSavedTabId(savedState);
3338
3858
  const searchValue = getSavedSearchValue(savedState);
3339
3859
  const scrollOffset = getSavedScrollOffset(savedState);
3860
+ const history = getSavedHistory(savedState);
3861
+ const historyIndex = getSavedHistoryIndex(savedState, history);
3340
3862
  return {
3341
3863
  root,
3342
3864
  minLineY,
3343
3865
  deltaY,
3344
3866
  tabId,
3345
3867
  searchValue,
3346
- scrollOffset
3868
+ scrollOffset,
3869
+ history,
3870
+ historyIndex
3347
3871
  };
3348
3872
  };
3349
3873
 
3350
- const getModifiedSettings = preferences => {
3351
- const modifiedSettings = Object.create(null);
3352
- for (const key of Object.keys(preferences)) {
3353
- modifiedSettings[key] = true;
3354
- }
3355
- return modifiedSettings;
3356
- };
3357
3874
  const loadContent = async (state, savedState) => {
3358
3875
  const {
3359
3876
  searchValue,
3360
3877
  tabId,
3361
- scrollOffset
3878
+ scrollOffset,
3879
+ history,
3880
+ historyIndex
3362
3881
  } = restoreState(savedState);
3363
3882
  const tabs = getTabs();
3364
3883
  const newTabs = getUpdatedTabs(tabs, tabId);
3365
3884
  const items = await getSettingItems();
3366
3885
  const preferences = await getPreferences();
3367
3886
  const modifiedSettings = getModifiedSettings(preferences);
3368
- const filteredItems = getFilteredItems(items, newTabs, searchValue, preferences);
3887
+ const filteredItems = getFilteredItems(items, newTabs, searchValue, modifiedSettings);
3369
3888
  return {
3370
3889
  ...state,
3371
3890
  filteredItems,
@@ -3375,7 +3894,9 @@ const loadContent = async (state, savedState) => {
3375
3894
  preferences,
3376
3895
  scrollOffset,
3377
3896
  searchValue,
3378
- tabs: newTabs
3897
+ tabs: newTabs,
3898
+ history,
3899
+ historyIndex
3379
3900
  };
3380
3901
  };
3381
3902
 
@@ -3392,52 +3913,6 @@ const renderFocusContext = (oldState, newState) => {
3392
3913
  return ['Viewlet.setFocusContext', focusKey];
3393
3914
  };
3394
3915
 
3395
- const Tab$1 = 'tab';
3396
- const TabList = 'tablist';
3397
- const AriaRoles = {
3398
- __proto__: null,
3399
- Tab: Tab$1,
3400
- TabList};
3401
- const Viewlet$1 = 'Viewlet';
3402
- const ClassNames = {
3403
- __proto__: null,
3404
- Viewlet: Viewlet$1};
3405
- const mergeClassNames = (...classNames) => {
3406
- return classNames.filter(Boolean).join(' ');
3407
- };
3408
- const Button$1 = 1;
3409
- const Div = 4;
3410
- const H1 = 5;
3411
- const Input = 6;
3412
- const Text = 12;
3413
- const H3 = 23;
3414
- const Aside = 28;
3415
- const P = 50;
3416
- const Ul = 60;
3417
- const Select$1 = 63;
3418
- const Option = 64;
3419
- const Label = 66;
3420
- const VirtualDomElements = {
3421
- __proto__: null,
3422
- Aside,
3423
- Button: Button$1,
3424
- Div,
3425
- H1,
3426
- H3,
3427
- Input,
3428
- Label,
3429
- Option,
3430
- P,
3431
- Select: Select$1,
3432
- Ul};
3433
- const text = data => {
3434
- return {
3435
- type: Text,
3436
- text: data,
3437
- childCount: 0
3438
- };
3439
- };
3440
-
3441
3916
  const {
3442
3917
  Viewlet
3443
3918
  } = ClassNames;
@@ -3449,6 +3924,7 @@ const InputBox = 'InputBox';
3449
3924
  const InputButton = 'InputButton';
3450
3925
  const MaskIcon = 'MaskIcon';
3451
3926
  const MaskIconClearAll = 'MaskIconClearAll';
3927
+ const ModifiedIndicator = 'ModifiedIndicator';
3452
3928
  const SearchFieldButton = 'SearchFieldButton';
3453
3929
  const Select = 'Select';
3454
3930
  const Settings = 'Settings';
@@ -3629,6 +4105,17 @@ const getItemColorVirtualDom = item => {
3629
4105
  }, ...getItemLabelDom(domId, description)];
3630
4106
  };
3631
4107
 
4108
+ const getSettingsModifiedIndicatorDom = isModified => {
4109
+ if (!isModified) {
4110
+ return [];
4111
+ }
4112
+ return [{
4113
+ type: VirtualDomElements.Div,
4114
+ className: ModifiedIndicator,
4115
+ childCount: 0
4116
+ }];
4117
+ };
4118
+
3632
4119
  const getItemNumberVirtualDom = item => {
3633
4120
  const {
3634
4121
  heading,
@@ -3638,13 +4125,14 @@ const getItemNumberVirtualDom = item => {
3638
4125
  } = item;
3639
4126
  const domId = getInputId(id);
3640
4127
  const isModified = modified || false;
4128
+ const modifiedChildCount = isModified ? 1 : 0;
3641
4129
  return [{
3642
4130
  type: VirtualDomElements.Div,
3643
4131
  className: SettingsItem,
3644
- childCount: 3,
4132
+ childCount: 3 + modifiedChildCount,
3645
4133
  role: 'group',
3646
4134
  'data-modified': isModified
3647
- }, ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
4135
+ }, ...getSettingsModifiedIndicatorDom(isModified), ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
3648
4136
  type: VirtualDomElements.Input,
3649
4137
  className: InputBox,
3650
4138
  inputType: 'number',
@@ -3728,6 +4216,33 @@ const getItemUnknownVirtualDom = () => {
3728
4216
  }, text(unknownSettingType())];
3729
4217
  };
3730
4218
 
4219
+ const getItemUrlVirtualDom = item => {
4220
+ const {
4221
+ heading,
4222
+ description,
4223
+ id,
4224
+ modified
4225
+ } = item;
4226
+ const domId = getInputId(id);
4227
+ const isModified = modified || false;
4228
+ return [{
4229
+ type: VirtualDomElements.Div,
4230
+ className: SettingsItem,
4231
+ childCount: 3,
4232
+ role: 'group',
4233
+ 'data-modified': isModified
4234
+ }, ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
4235
+ type: VirtualDomElements.Input,
4236
+ className: InputBox,
4237
+ inputType: 'url',
4238
+ placeholder: numberValue(),
4239
+ childCount: 0,
4240
+ id: domId,
4241
+ name: id,
4242
+ onInput: HandleSettingInput
4243
+ }];
4244
+ };
4245
+
3731
4246
  const getItemVirtualDom = item => {
3732
4247
  if (item.type === Number$1) {
3733
4248
  return getItemNumberVirtualDom(item);
@@ -3744,6 +4259,9 @@ const getItemVirtualDom = item => {
3744
4259
  if (item.type === Color) {
3745
4260
  return getItemColorVirtualDom(item);
3746
4261
  }
4262
+ if (item.type === Url) {
4263
+ return getItemUrlVirtualDom(item);
4264
+ }
3747
4265
  return getItemUnknownVirtualDom();
3748
4266
  };
3749
4267
 
@@ -3956,7 +4474,9 @@ const saveState = state => {
3956
4474
  tabs,
3957
4475
  searchValue,
3958
4476
  scrollOffset,
3959
- focus
4477
+ focus,
4478
+ history,
4479
+ historyIndex
3960
4480
  } = state;
3961
4481
  const selectedTab = getSelectedTabId(tabs);
3962
4482
  return {
@@ -3968,7 +4488,9 @@ const saveState = state => {
3968
4488
  searchValue,
3969
4489
  selectedTab,
3970
4490
  scrollOffset,
3971
- focus
4491
+ focus,
4492
+ history,
4493
+ historyIndex
3972
4494
  };
3973
4495
  };
3974
4496
 
@@ -3978,14 +4500,14 @@ const useNextSearchValue = state => {
3978
4500
  historyIndex,
3979
4501
  items,
3980
4502
  tabs,
3981
- preferences
4503
+ modifiedSettings
3982
4504
  } = state;
3983
4505
  if (history.length === 0 || historyIndex >= history.length - 1) {
3984
4506
  return state;
3985
4507
  }
3986
4508
  const newHistoryIndex = historyIndex + 1;
3987
4509
  const newSearchValue = history[newHistoryIndex];
3988
- const filteredItems = getFilteredItems(items, tabs, newSearchValue, preferences);
4510
+ const filteredItems = getFilteredItems(items, tabs, newSearchValue, modifiedSettings);
3989
4511
  return {
3990
4512
  ...state,
3991
4513
  searchValue: newSearchValue,
@@ -4001,14 +4523,14 @@ const usePreviousSearchValue = state => {
4001
4523
  historyIndex,
4002
4524
  items,
4003
4525
  tabs,
4004
- preferences
4526
+ modifiedSettings
4005
4527
  } = state;
4006
4528
  if (history.length === 0 || historyIndex <= 0) {
4007
4529
  return state;
4008
4530
  }
4009
4531
  const newHistoryIndex = historyIndex - 1;
4010
4532
  const newSearchValue = history[newHistoryIndex];
4011
- const filteredItems = getFilteredItems(items, tabs, newSearchValue, preferences);
4533
+ const filteredItems = getFilteredItems(items, tabs, newSearchValue, modifiedSettings);
4012
4534
  return {
4013
4535
  ...state,
4014
4536
  searchValue: newSearchValue,
@@ -4027,6 +4549,7 @@ const commandMap = {
4027
4549
  'Settings.getName': getName,
4028
4550
  'Settings.getCommandIds': getCommandIds,
4029
4551
  'Settings.handleClickTab': wrapCommand(handleClickTab),
4552
+ 'Settings.handleInputBlur': wrapCommand(handleInputBlur),
4030
4553
  'Settings.handleInput': wrapCommand(handleInput),
4031
4554
  'Settings.handleScroll': wrapCommand(handleScroll),
4032
4555
  'Settings.handleSettingChecked': wrapCommand(handleSettingChecked),
@@ -4042,48 +4565,8 @@ const commandMap = {
4042
4565
  'Settings.terminate': terminate,
4043
4566
  'Settings.useNextSearchValue': wrapCommand(useNextSearchValue),
4044
4567
  'Settings.usePreviousSearchValue': wrapCommand(usePreviousSearchValue),
4045
- 'Settings.getKeyBindings': getKeyBindings
4046
- };
4047
-
4048
- const rpcs = Object.create(null);
4049
- const set$g = (id, rpc) => {
4050
- rpcs[id] = rpc;
4051
- };
4052
- const get = id => {
4053
- return rpcs[id];
4054
- };
4055
-
4056
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
4057
-
4058
- const create = rpcId => {
4059
- return {
4060
- // @ts-ignore
4061
- invoke(method, ...params) {
4062
- const rpc = get(rpcId);
4063
- // @ts-ignore
4064
- return rpc.invoke(method, ...params);
4065
- },
4066
- // @ts-ignore
4067
- invokeAndTransfer(method, ...params) {
4068
- const rpc = get(rpcId);
4069
- // @ts-ignore
4070
- return rpc.invokeAndTransfer(method, ...params);
4071
- },
4072
- set(rpc) {
4073
- set$g(rpcId, rpc);
4074
- },
4075
- async dispose() {
4076
- const rpc = get(rpcId);
4077
- await rpc.dispose();
4078
- }
4079
- };
4568
+ 'Settings.getKeyBindings': getKeyBindings$1
4080
4569
  };
4081
- const RendererWorker$1 = 1;
4082
- const {
4083
- set: set$3} = create(RendererWorker$1);
4084
- const RendererWorker = {
4085
- __proto__: null,
4086
- set: set$3};
4087
4570
 
4088
4571
  const {
4089
4572
  set
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "1.15.0",
3
+ "version": "1.17.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",