@lvce-editor/settings-view 1.16.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,8 +1037,8 @@ 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 = [];
@@ -1065,8 +1065,69 @@ const diff2 = uid => {
1065
1065
  return diffResult;
1066
1066
  };
1067
1067
 
1068
- const getKeyBindings = () => {
1069
- 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
+ }];
1070
1131
  };
1071
1132
 
1072
1133
  const getName = () => {
@@ -1103,10 +1164,10 @@ const handleClickTab = (state, name) => {
1103
1164
  items,
1104
1165
  tabs,
1105
1166
  searchValue,
1106
- preferences
1167
+ modifiedSettings
1107
1168
  } = state;
1108
1169
  const updatedTabs = getUpdatedTabs(tabs, name);
1109
- const filteredItems = getFilteredItems(items, updatedTabs, searchValue, preferences);
1170
+ const filteredItems = getFilteredItems(items, updatedTabs, searchValue, modifiedSettings);
1110
1171
  return {
1111
1172
  ...state,
1112
1173
  tabs: updatedTabs,
@@ -1117,12 +1178,57 @@ const handleClickTab = (state, name) => {
1117
1178
  const addToHistory = (history, value) => {
1118
1179
  let newHistory = history;
1119
1180
  let newHistoryIndex = -1;
1120
- if (value && value.trim() && !history.includes(value)) {
1121
- 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];
1122
1231
  newHistoryIndex = newHistory.length - 1;
1123
- } else if (value && value.trim()) {
1124
- // If value already exists in history, find its index
1125
- newHistoryIndex = history.indexOf(value);
1126
1232
  }
1127
1233
  return {
1128
1234
  newHistory,
@@ -1134,10 +1240,10 @@ const handleInput = (state, value, inputSource = User) => {
1134
1240
  const {
1135
1241
  items,
1136
1242
  tabs,
1137
- preferences,
1138
- history
1243
+ history,
1244
+ modifiedSettings
1139
1245
  } = state;
1140
- const filteredItems = getFilteredItems(items, tabs, value, preferences);
1246
+ const filteredItems = getFilteredItems(items, tabs, value, modifiedSettings);
1141
1247
  const {
1142
1248
  newHistory,
1143
1249
  newHistoryIndex
@@ -1152,8 +1258,16 @@ const handleInput = (state, value, inputSource = User) => {
1152
1258
  };
1153
1259
  };
1154
1260
 
1261
+ const None = 0;
1155
1262
  const SearchInput = 1;
1156
1263
 
1264
+ const handleInputBlur = state => {
1265
+ return {
1266
+ ...state,
1267
+ focus: None
1268
+ };
1269
+ };
1270
+
1157
1271
  const handleInputFocus = state => {
1158
1272
  return {
1159
1273
  ...state,
@@ -1225,8 +1339,378 @@ const initialize = async () => {
1225
1339
  // TODO
1226
1340
  };
1227
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
+
1228
1708
  const getPreferences = async () => {
1229
- return {};
1709
+ try {
1710
+ return await RendererWorker.getAllPreferences();
1711
+ } catch {
1712
+ return {};
1713
+ }
1230
1714
  };
1231
1715
 
1232
1716
  const ApplicationsTab = 'applications';
@@ -3290,42 +3774,70 @@ const getTabs = () => {
3290
3774
  return tabs;
3291
3775
  };
3292
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
+
3293
3806
  const getSavedMinLineY = savedState => {
3294
3807
  if (savedState && typeof savedState === 'object' && 'minLineY' in savedState && typeof savedState.minLineY === 'number') {
3295
3808
  return savedState.minLineY;
3296
3809
  }
3297
3810
  return 0;
3298
3811
  };
3299
- const getSavedSearchValue = savedState => {
3300
- if (savedState && typeof savedState === 'object' && 'searchValue' in savedState && typeof savedState.searchValue === 'string') {
3301
- return savedState.searchValue;
3302
- }
3303
- return '';
3304
- };
3305
- const getSavedDeltaY = savedState => {
3306
- if (savedState && typeof savedState === 'object' && 'deltaY' in savedState && typeof savedState.deltaY === 'number') {
3307
- 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;
3308
3816
  }
3309
3817
  return 0;
3310
3818
  };
3311
- const getSavedWorkspacePath = savedState => {
3312
- if (savedState && typeof savedState === 'object' && 'workspacePath' in savedState && typeof savedState.workspacePath === 'string') {
3313
- 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;
3314
3823
  }
3315
3824
  return '';
3316
3825
  };
3826
+
3317
3827
  const getSavedTabId = savedState => {
3318
3828
  if (savedState && typeof savedState === 'object' && 'selectedTab' in savedState && typeof savedState.selectedTab === 'string') {
3319
3829
  return savedState.selectedTab;
3320
3830
  }
3321
3831
  return '';
3322
3832
  };
3323
- const getSavedScrollOffset = savedState => {
3324
- if (savedState && typeof savedState === 'object' && 'scrollOffset' in savedState && typeof savedState.scrollOffset === 'number') {
3325
- 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;
3326
3837
  }
3327
- return 0;
3838
+ return '';
3328
3839
  };
3840
+
3329
3841
  const restoreState = savedState => {
3330
3842
  if (!savedState) {
3331
3843
  return {
@@ -3334,7 +3846,9 @@ const restoreState = savedState => {
3334
3846
  deltaY: 0,
3335
3847
  tabId: '',
3336
3848
  searchValue: '',
3337
- scrollOffset: 0
3849
+ scrollOffset: 0,
3850
+ history: [],
3851
+ historyIndex: -1
3338
3852
  };
3339
3853
  }
3340
3854
  const root = getSavedWorkspacePath(savedState);
@@ -3343,35 +3857,34 @@ const restoreState = savedState => {
3343
3857
  const tabId = getSavedTabId(savedState);
3344
3858
  const searchValue = getSavedSearchValue(savedState);
3345
3859
  const scrollOffset = getSavedScrollOffset(savedState);
3860
+ const history = getSavedHistory(savedState);
3861
+ const historyIndex = getSavedHistoryIndex(savedState, history);
3346
3862
  return {
3347
3863
  root,
3348
3864
  minLineY,
3349
3865
  deltaY,
3350
3866
  tabId,
3351
3867
  searchValue,
3352
- scrollOffset
3868
+ scrollOffset,
3869
+ history,
3870
+ historyIndex
3353
3871
  };
3354
3872
  };
3355
3873
 
3356
- const getModifiedSettings = preferences => {
3357
- const modifiedSettings = Object.create(null);
3358
- for (const key of Object.keys(preferences)) {
3359
- modifiedSettings[key] = true;
3360
- }
3361
- return modifiedSettings;
3362
- };
3363
3874
  const loadContent = async (state, savedState) => {
3364
3875
  const {
3365
3876
  searchValue,
3366
3877
  tabId,
3367
- scrollOffset
3878
+ scrollOffset,
3879
+ history,
3880
+ historyIndex
3368
3881
  } = restoreState(savedState);
3369
3882
  const tabs = getTabs();
3370
3883
  const newTabs = getUpdatedTabs(tabs, tabId);
3371
3884
  const items = await getSettingItems();
3372
3885
  const preferences = await getPreferences();
3373
3886
  const modifiedSettings = getModifiedSettings(preferences);
3374
- const filteredItems = getFilteredItems(items, newTabs, searchValue, preferences);
3887
+ const filteredItems = getFilteredItems(items, newTabs, searchValue, modifiedSettings);
3375
3888
  return {
3376
3889
  ...state,
3377
3890
  filteredItems,
@@ -3381,7 +3894,9 @@ const loadContent = async (state, savedState) => {
3381
3894
  preferences,
3382
3895
  scrollOffset,
3383
3896
  searchValue,
3384
- tabs: newTabs
3897
+ tabs: newTabs,
3898
+ history,
3899
+ historyIndex
3385
3900
  };
3386
3901
  };
3387
3902
 
@@ -3398,52 +3913,6 @@ const renderFocusContext = (oldState, newState) => {
3398
3913
  return ['Viewlet.setFocusContext', focusKey];
3399
3914
  };
3400
3915
 
3401
- const Tab$1 = 'tab';
3402
- const TabList = 'tablist';
3403
- const AriaRoles = {
3404
- __proto__: null,
3405
- Tab: Tab$1,
3406
- TabList};
3407
- const Viewlet$1 = 'Viewlet';
3408
- const ClassNames = {
3409
- __proto__: null,
3410
- Viewlet: Viewlet$1};
3411
- const mergeClassNames = (...classNames) => {
3412
- return classNames.filter(Boolean).join(' ');
3413
- };
3414
- const Button$1 = 1;
3415
- const Div = 4;
3416
- const H1 = 5;
3417
- const Input = 6;
3418
- const Text = 12;
3419
- const H3 = 23;
3420
- const Aside = 28;
3421
- const P = 50;
3422
- const Ul = 60;
3423
- const Select$1 = 63;
3424
- const Option = 64;
3425
- const Label = 66;
3426
- const VirtualDomElements = {
3427
- __proto__: null,
3428
- Aside,
3429
- Button: Button$1,
3430
- Div,
3431
- H1,
3432
- H3,
3433
- Input,
3434
- Label,
3435
- Option,
3436
- P,
3437
- Select: Select$1,
3438
- Ul};
3439
- const text = data => {
3440
- return {
3441
- type: Text,
3442
- text: data,
3443
- childCount: 0
3444
- };
3445
- };
3446
-
3447
3916
  const {
3448
3917
  Viewlet
3449
3918
  } = ClassNames;
@@ -3455,6 +3924,7 @@ const InputBox = 'InputBox';
3455
3924
  const InputButton = 'InputButton';
3456
3925
  const MaskIcon = 'MaskIcon';
3457
3926
  const MaskIconClearAll = 'MaskIconClearAll';
3927
+ const ModifiedIndicator = 'ModifiedIndicator';
3458
3928
  const SearchFieldButton = 'SearchFieldButton';
3459
3929
  const Select = 'Select';
3460
3930
  const Settings = 'Settings';
@@ -3635,6 +4105,17 @@ const getItemColorVirtualDom = item => {
3635
4105
  }, ...getItemLabelDom(domId, description)];
3636
4106
  };
3637
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
+
3638
4119
  const getItemNumberVirtualDom = item => {
3639
4120
  const {
3640
4121
  heading,
@@ -3644,13 +4125,14 @@ const getItemNumberVirtualDom = item => {
3644
4125
  } = item;
3645
4126
  const domId = getInputId(id);
3646
4127
  const isModified = modified || false;
4128
+ const modifiedChildCount = isModified ? 1 : 0;
3647
4129
  return [{
3648
4130
  type: VirtualDomElements.Div,
3649
4131
  className: SettingsItem,
3650
- childCount: 3,
4132
+ childCount: 3 + modifiedChildCount,
3651
4133
  role: 'group',
3652
4134
  'data-modified': isModified
3653
- }, ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
4135
+ }, ...getSettingsModifiedIndicatorDom(isModified), ...getItemHeadingDom(heading), ...getItemLabelDom(domId, description), {
3654
4136
  type: VirtualDomElements.Input,
3655
4137
  className: InputBox,
3656
4138
  inputType: 'number',
@@ -3992,7 +4474,9 @@ const saveState = state => {
3992
4474
  tabs,
3993
4475
  searchValue,
3994
4476
  scrollOffset,
3995
- focus
4477
+ focus,
4478
+ history,
4479
+ historyIndex
3996
4480
  } = state;
3997
4481
  const selectedTab = getSelectedTabId(tabs);
3998
4482
  return {
@@ -4004,7 +4488,9 @@ const saveState = state => {
4004
4488
  searchValue,
4005
4489
  selectedTab,
4006
4490
  scrollOffset,
4007
- focus
4491
+ focus,
4492
+ history,
4493
+ historyIndex
4008
4494
  };
4009
4495
  };
4010
4496
 
@@ -4014,14 +4500,14 @@ const useNextSearchValue = state => {
4014
4500
  historyIndex,
4015
4501
  items,
4016
4502
  tabs,
4017
- preferences
4503
+ modifiedSettings
4018
4504
  } = state;
4019
4505
  if (history.length === 0 || historyIndex >= history.length - 1) {
4020
4506
  return state;
4021
4507
  }
4022
4508
  const newHistoryIndex = historyIndex + 1;
4023
4509
  const newSearchValue = history[newHistoryIndex];
4024
- const filteredItems = getFilteredItems(items, tabs, newSearchValue, preferences);
4510
+ const filteredItems = getFilteredItems(items, tabs, newSearchValue, modifiedSettings);
4025
4511
  return {
4026
4512
  ...state,
4027
4513
  searchValue: newSearchValue,
@@ -4037,14 +4523,14 @@ const usePreviousSearchValue = state => {
4037
4523
  historyIndex,
4038
4524
  items,
4039
4525
  tabs,
4040
- preferences
4526
+ modifiedSettings
4041
4527
  } = state;
4042
4528
  if (history.length === 0 || historyIndex <= 0) {
4043
4529
  return state;
4044
4530
  }
4045
4531
  const newHistoryIndex = historyIndex - 1;
4046
4532
  const newSearchValue = history[newHistoryIndex];
4047
- const filteredItems = getFilteredItems(items, tabs, newSearchValue, preferences);
4533
+ const filteredItems = getFilteredItems(items, tabs, newSearchValue, modifiedSettings);
4048
4534
  return {
4049
4535
  ...state,
4050
4536
  searchValue: newSearchValue,
@@ -4063,6 +4549,7 @@ const commandMap = {
4063
4549
  'Settings.getName': getName,
4064
4550
  'Settings.getCommandIds': getCommandIds,
4065
4551
  'Settings.handleClickTab': wrapCommand(handleClickTab),
4552
+ 'Settings.handleInputBlur': wrapCommand(handleInputBlur),
4066
4553
  'Settings.handleInput': wrapCommand(handleInput),
4067
4554
  'Settings.handleScroll': wrapCommand(handleScroll),
4068
4555
  'Settings.handleSettingChecked': wrapCommand(handleSettingChecked),
@@ -4078,49 +4565,9 @@ const commandMap = {
4078
4565
  'Settings.terminate': terminate,
4079
4566
  'Settings.useNextSearchValue': wrapCommand(useNextSearchValue),
4080
4567
  'Settings.usePreviousSearchValue': wrapCommand(usePreviousSearchValue),
4081
- 'Settings.getKeyBindings': getKeyBindings
4082
- };
4083
-
4084
- const rpcs = Object.create(null);
4085
- const set$g = (id, rpc) => {
4086
- rpcs[id] = rpc;
4087
- };
4088
- const get = id => {
4089
- return rpcs[id];
4568
+ 'Settings.getKeyBindings': getKeyBindings$1
4090
4569
  };
4091
4570
 
4092
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
4093
-
4094
- const create = rpcId => {
4095
- return {
4096
- // @ts-ignore
4097
- invoke(method, ...params) {
4098
- const rpc = get(rpcId);
4099
- // @ts-ignore
4100
- return rpc.invoke(method, ...params);
4101
- },
4102
- // @ts-ignore
4103
- invokeAndTransfer(method, ...params) {
4104
- const rpc = get(rpcId);
4105
- // @ts-ignore
4106
- return rpc.invokeAndTransfer(method, ...params);
4107
- },
4108
- set(rpc) {
4109
- set$g(rpcId, rpc);
4110
- },
4111
- async dispose() {
4112
- const rpc = get(rpcId);
4113
- await rpc.dispose();
4114
- }
4115
- };
4116
- };
4117
- const RendererWorker$1 = 1;
4118
- const {
4119
- set: set$3} = create(RendererWorker$1);
4120
- const RendererWorker = {
4121
- __proto__: null,
4122
- set: set$3};
4123
-
4124
4571
  const {
4125
4572
  set
4126
4573
  } = RendererWorker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",