@lvce-editor/settings-view 2.3.0 → 2.4.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.
@@ -1138,6 +1138,7 @@ const create$1 = (id, uri, x, y, width, height) => {
1138
1138
  itemHeight: 100,
1139
1139
  items: [],
1140
1140
  maxLineY: 0,
1141
+ minContentWidth: 300,
1141
1142
  minLineY: 0,
1142
1143
  modifiedSettings: {},
1143
1144
  preferences: {},
@@ -1158,20 +1159,16 @@ const create$1 = (id, uri, x, y, width, height) => {
1158
1159
  set$3(id, state, state);
1159
1160
  };
1160
1161
 
1161
- const isEqual$5 = (oldState, newState) => {
1162
- return oldState.sideBarWidth === newState.sideBarWidth;
1163
- };
1164
-
1165
1162
  const isEqual$4 = (oldState, newState) => {
1166
- return oldState.focus === newState.focus;
1163
+ return oldState.sideBarWidth === newState.sideBarWidth && oldState.scrollBarThumbHeight === newState.scrollBarThumbHeight && oldState.scrollBarThumbTop === newState.scrollBarThumbTop;
1167
1164
  };
1168
1165
 
1169
1166
  const isEqual$3 = (oldState, newState) => {
1170
- return oldState.filteredItems === newState.filteredItems && oldState.deltaY === newState.deltaY;
1167
+ return oldState.focus === newState.focus;
1171
1168
  };
1172
1169
 
1173
1170
  const isEqual$2 = (oldState, newState) => {
1174
- return true;
1171
+ return oldState.filteredItems === newState.filteredItems && oldState.deltaY === newState.deltaY;
1175
1172
  };
1176
1173
 
1177
1174
  const isEqual$1 = (oldState, newState) => {
@@ -1182,7 +1179,6 @@ const RenderItems = 1;
1182
1179
  const RenderFocus = 2;
1183
1180
  const RenderValue = 3;
1184
1181
  const RenderSettingValues = 10;
1185
- const RenderScrollOffset = 11;
1186
1182
  const RenderFocusContext = 12;
1187
1183
  const RenderCss = 13;
1188
1184
 
@@ -1190,18 +1186,13 @@ const isEqual = (oldState, newState) => {
1190
1186
  return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1191
1187
  };
1192
1188
 
1193
- const modules = [isEqual$3, isEqual, isEqual$1, isEqual$2, isEqual$4, isEqual$4, isEqual$5];
1194
- const numbers = [RenderItems, RenderValue, RenderSettingValues, RenderScrollOffset, RenderFocus, RenderFocusContext, RenderCss];
1189
+ const modules = [isEqual$2, isEqual, isEqual$1, isEqual$3, isEqual$3, isEqual$4];
1190
+ const numbers = [RenderItems, RenderValue, RenderSettingValues, RenderFocus, RenderFocusContext, RenderCss];
1195
1191
 
1196
1192
  const diff = (oldState, newState) => {
1197
1193
  const diffResult = [];
1198
1194
  for (let i = 0; i < modules.length; i++) {
1199
1195
  const fn = modules[i];
1200
-
1201
- // TODO enable this
1202
- if (numbers[i] === RenderScrollOffset) {
1203
- continue;
1204
- }
1205
1196
  if (!fn(oldState, newState)) {
1206
1197
  diffResult.push(numbers[i]);
1207
1198
  }
@@ -1320,7 +1311,7 @@ const Features = 'Features';
1320
1311
  const FeaturesList = 'FeaturesList';
1321
1312
  const FeatureWebView = 'FeatureWebView';
1322
1313
  const FileIcon = 'FileIcon';
1323
- const Filter = 'Filter';
1314
+ const Filter$1 = 'Filter';
1324
1315
  const FilterBadge = 'FilterBadge';
1325
1316
  const FindWidget = 'FindWidget';
1326
1317
  const FindWidgetFind = 'FindWidgetFind';
@@ -1556,7 +1547,7 @@ const ClassNames = {
1556
1547
  Features,
1557
1548
  FeaturesList,
1558
1549
  FileIcon,
1559
- Filter,
1550
+ Filter: Filter$1,
1560
1551
  FilterBadge,
1561
1552
  FindWidget,
1562
1553
  FindWidgetFind,
@@ -1738,6 +1729,10 @@ const getName = () => {
1738
1729
  return 'Settings';
1739
1730
  };
1740
1731
 
1732
+ const handleClickFilterButton = state => {
1733
+ return state;
1734
+ };
1735
+
1741
1736
  const getSelectedTabId = tabs => {
1742
1737
  for (const tab of tabs) {
1743
1738
  if (tab.selected) {
@@ -1929,9 +1924,12 @@ const handleResizerPointerDown = (state, eventX, eventY) => {
1929
1924
 
1930
1925
  const handleResizerPointerMove = (state, eventX, eventY) => {
1931
1926
  const {
1932
- sideBarMinWidth
1927
+ minContentWidth,
1928
+ sideBarMinWidth,
1929
+ width
1933
1930
  } = state;
1934
- const newWidth = Math.max(eventX, sideBarMinWidth);
1931
+ const maxSideBarWidth = width - minContentWidth;
1932
+ const newWidth = Math.max(sideBarMinWidth, Math.min(eventX, maxSideBarWidth));
1935
1933
  return {
1936
1934
  ...state,
1937
1935
  sideBarWidth: newWidth
@@ -2577,6 +2575,7 @@ const getPreferences = async () => {
2577
2575
  const ApplicationsTab = 'applications';
2578
2576
  const Clear$1 = 'Clear';
2579
2577
  const ExtensionsTab = 'extensions';
2578
+ const Filter = 'Filter';
2580
2579
  const FeaturesTab = 'features';
2581
2580
  const SecurityTab = 'security';
2582
2581
  const SettingsSearch = 'SettingsSearch';
@@ -2887,6 +2886,9 @@ const autoUpdatesDescription = () => {
2887
2886
  const clear = () => {
2888
2887
  return i18nString(Clear);
2889
2888
  };
2889
+ const filter = () => {
2890
+ return 'Filter';
2891
+ };
2890
2892
  const extensionRecommendations = () => {
2891
2893
  return i18nString(ExtensionRecommendations);
2892
2894
  };
@@ -4730,6 +4732,13 @@ const getSavedSearchValue = savedState => {
4730
4732
  return '';
4731
4733
  };
4732
4734
 
4735
+ const getSavedSideBarWidth = savedState => {
4736
+ if (savedState && typeof savedState === 'object' && 'sideBarWidth' in savedState && typeof savedState.sideBarWidth === 'number') {
4737
+ return savedState.sideBarWidth;
4738
+ }
4739
+ return 200;
4740
+ };
4741
+
4733
4742
  const getSavedTabId = savedState => {
4734
4743
  if (savedState && typeof savedState === 'object' && 'selectedTab' in savedState && typeof savedState.selectedTab === 'string') {
4735
4744
  return savedState.selectedTab;
@@ -4746,6 +4755,7 @@ const restoreState = savedState => {
4746
4755
  minLineY: 0,
4747
4756
  scrollOffset: 0,
4748
4757
  searchValue: '',
4758
+ sideBarWidth: 200,
4749
4759
  tabId: ''
4750
4760
  };
4751
4761
  }
@@ -4754,6 +4764,7 @@ const restoreState = savedState => {
4754
4764
  const tabId = getSavedTabId(savedState);
4755
4765
  const searchValue = getSavedSearchValue(savedState);
4756
4766
  const scrollOffset = getSavedScrollOffset(savedState);
4767
+ const sideBarWidth = getSavedSideBarWidth(savedState);
4757
4768
  const history = getSavedHistory(savedState);
4758
4769
  const historyIndex = getSavedHistoryIndex(savedState, history);
4759
4770
  return {
@@ -4763,6 +4774,7 @@ const restoreState = savedState => {
4763
4774
  minLineY,
4764
4775
  scrollOffset,
4765
4776
  searchValue,
4777
+ sideBarWidth,
4766
4778
  tabId
4767
4779
  };
4768
4780
  };
@@ -4773,6 +4785,7 @@ const loadContent = async (state, savedState) => {
4773
4785
  historyIndex,
4774
4786
  scrollOffset,
4775
4787
  searchValue,
4788
+ sideBarWidth,
4776
4789
  tabId
4777
4790
  } = restoreState(savedState);
4778
4791
  const tabs = getTabs();
@@ -4812,19 +4825,26 @@ const loadContent = async (state, savedState) => {
4812
4825
  scrollBarThumbTop: thumbTop,
4813
4826
  scrollOffset,
4814
4827
  searchValue,
4815
- sideBarWidth: 200,
4828
+ sideBarWidth,
4816
4829
  tabs: newTabs,
4817
4830
  visibleItems
4818
4831
  };
4819
4832
  };
4820
4833
 
4821
- const getCss = sideBarWidth => {
4834
+ const getCss = (sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop) => {
4835
+ const rounded = Math.round(sideBarWidth);
4822
4836
  return `
4823
4837
  .Settings {
4824
- --SettingsSideBarWidth: ${sideBarWidth}px;
4838
+ --SettingsSideBarWidth: ${rounded}px;
4839
+ --ScrollBarThumbHeight: ${scrollBarThumbHeight}px;
4840
+ --ScrollBarThumbTop: ${scrollBarThumbTop}px;
4825
4841
  }
4826
4842
  .SettingsResizer {
4827
- color: yellow;
4843
+ background: yellow;
4844
+ }
4845
+
4846
+ .SettingsSideBar{
4847
+ width: var(--SettingsSideBarWidth);
4828
4848
  }
4829
4849
  `;
4830
4850
  };
@@ -4832,9 +4852,11 @@ const getCss = sideBarWidth => {
4832
4852
  const renderCss = (oldState, newState) => {
4833
4853
  const {
4834
4854
  id,
4855
+ scrollBarThumbHeight,
4856
+ scrollBarThumbTop,
4835
4857
  sideBarWidth
4836
4858
  } = newState;
4837
- const css = getCss(sideBarWidth);
4859
+ const css = getCss(sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop);
4838
4860
  return [SetCss, id, css];
4839
4861
  };
4840
4862
 
@@ -4902,6 +4924,7 @@ const getSettingsInputBadgeDom = (filteredSettingsCount, hasSearchValue) => {
4902
4924
 
4903
4925
  // TODo use numeric ids
4904
4926
  const HandleClickClear = 'handleClickClear';
4927
+ const HandleClickFilterButton = 'handleClickFilterButton';
4905
4928
  const HandleClickTab = 'handleClickTab';
4906
4929
  const HandleInput = 'handleInput';
4907
4930
  const HandleSettingInput = 'handleSettingInput';
@@ -4936,6 +4959,14 @@ const getSettingsInputButtonsDom = hasSearchValue => {
4936
4959
  name: Clear$1,
4937
4960
  onClick: HandleClickClear,
4938
4961
  type: Button
4962
+ }, {
4963
+ ariaLabel: filter(),
4964
+ childCount: 1,
4965
+ className: SearchFieldButton,
4966
+ disabled: false,
4967
+ name: Filter,
4968
+ onClick: HandleClickFilterButton,
4969
+ type: Button
4939
4970
  }, icon];
4940
4971
  };
4941
4972
 
@@ -4998,12 +5029,10 @@ const parentNode$1 = {
4998
5029
  className: mergeClassNames(SettingsScrollBar, SettingsScrollBarSmall),
4999
5030
  type: Div
5000
5031
  };
5001
- const getScrollBarDom = (thumbHeight, thumbTop) => {
5032
+ const getScrollBarDom = () => {
5002
5033
  return [parentNode$1, {
5003
5034
  childCount: 0,
5004
5035
  className: SettingsScrollBarThumb,
5005
- height: `${thumbHeight}px`,
5006
- top: `${thumbTop}px`,
5007
5036
  type: Div
5008
5037
  }];
5009
5038
  };
@@ -5314,7 +5343,7 @@ const getSettingsItemsDom = (items, searchValue) => {
5314
5343
  }, ...items.flatMap(getItemVirtualDom)];
5315
5344
  };
5316
5345
 
5317
- const getSettingsContentDom = (visibleItems, tabs, searchValue, thumbHeight, thumbTop) => {
5346
+ const getSettingsContentDom = (visibleItems, tabs, searchValue) => {
5318
5347
  const selectedTab = tabs.find(tab => tab.selected);
5319
5348
  const headerText = selectedTab ? selectedTab.label : settingsContent();
5320
5349
  return [{
@@ -5326,7 +5355,7 @@ const getSettingsContentDom = (visibleItems, tabs, searchValue, thumbHeight, thu
5326
5355
  childCount: 2,
5327
5356
  className: SettingsItemWrapper,
5328
5357
  type: Div
5329
- }, ...getSettingsItemsDom(visibleItems, searchValue), ...getScrollBarDom(thumbHeight, thumbTop)];
5358
+ }, ...getSettingsItemsDom(visibleItems, searchValue), ...getScrollBarDom()];
5330
5359
  };
5331
5360
 
5332
5361
  const getTabClassName = tab => {
@@ -5364,12 +5393,12 @@ const getSettingsSideBarDom = tabs => {
5364
5393
  }, ...getSettingsTabsDom(tabs)];
5365
5394
  };
5366
5395
 
5367
- const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, thumbHeight, thumbTop) => {
5396
+ const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue) => {
5368
5397
  return [{
5369
5398
  childCount: 3,
5370
5399
  className: SettingsMain,
5371
5400
  type: Div
5372
- }, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, thumbHeight, thumbTop)];
5401
+ }, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue)];
5373
5402
  };
5374
5403
 
5375
5404
  const parentNode = {
@@ -5380,15 +5409,13 @@ const parentNode = {
5380
5409
  const getSettingsDom = state => {
5381
5410
  const {
5382
5411
  filteredItems,
5383
- scrollBarThumbHeight,
5384
- scrollBarThumbTop,
5385
5412
  searchValue,
5386
5413
  tabs,
5387
5414
  visibleItems
5388
5415
  } = state;
5389
5416
  const hasSearchValue = searchValue.trim().length > 0;
5390
5417
  const filteredItemsCount = filteredItems.length;
5391
- return [parentNode, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue, scrollBarThumbHeight, scrollBarThumbTop)];
5418
+ return [parentNode, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue)];
5392
5419
  };
5393
5420
 
5394
5421
  const renderItems = (oldState, newState) => {
@@ -5396,16 +5423,6 @@ const renderItems = (oldState, newState) => {
5396
5423
  return ['Viewlet.setDom2', newState.id, dom];
5397
5424
  };
5398
5425
 
5399
- const renderScrollOffset = (oldState, newState) => {
5400
- const {
5401
- id,
5402
- scrollOffset
5403
- } = newState;
5404
- const selector = '.SettingsContent';
5405
- const property = 'scrollTop';
5406
- return ['Viewlet.setProperty', id, selector, property, scrollOffset];
5407
- };
5408
-
5409
5426
  const enabledTypes = [Number$1, String, Color];
5410
5427
  const renderSettingValues = (oldState, newState) => {
5411
5428
  const {
@@ -5442,8 +5459,6 @@ const getRenderer = diffType => {
5442
5459
  return renderFocusContext;
5443
5460
  case RenderItems:
5444
5461
  return renderItems;
5445
- case RenderScrollOffset:
5446
- return renderScrollOffset;
5447
5462
  case RenderSettingValues:
5448
5463
  return renderSettingValues;
5449
5464
  case RenderValue:
@@ -5486,6 +5501,9 @@ const renderEventListeners = () => {
5486
5501
  }, {
5487
5502
  name: HandleClickClear,
5488
5503
  params: ['clear']
5504
+ }, {
5505
+ name: HandleClickFilterButton,
5506
+ params: ['handleClickFilterButton']
5489
5507
  }, {
5490
5508
  name: HandleSettingInput,
5491
5509
  params: ['handleSettingInput', TargetName, TargetValue]
@@ -5529,6 +5547,7 @@ const saveState = state => {
5529
5547
  historyIndex,
5530
5548
  scrollOffset,
5531
5549
  searchValue,
5550
+ sideBarWidth,
5532
5551
  tabs
5533
5552
  } = state;
5534
5553
  const selectedTab = getSelectedTabId(tabs);
@@ -5541,7 +5560,8 @@ const saveState = state => {
5541
5560
  minLineY: 0,
5542
5561
  scrollOffset,
5543
5562
  searchValue,
5544
- selectedTab
5563
+ selectedTab,
5564
+ sideBarWidth
5545
5565
  };
5546
5566
  };
5547
5567
 
@@ -5602,6 +5622,7 @@ const commandMap = {
5602
5622
  'Settings.getCommandIds': getCommandIds,
5603
5623
  'Settings.getKeyBindings': getKeyBindings$1,
5604
5624
  'Settings.getName': getName,
5625
+ 'Settings.handleClickFilterButton': wrapCommand(handleClickFilterButton),
5605
5626
  'Settings.handleClickTab': wrapCommand(handleClickTab),
5606
5627
  'Settings.handleInput': wrapCommand(handleInput),
5607
5628
  'Settings.handleInputBlur': wrapCommand(handleInputBlur),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,6 +11,6 @@
11
11
  "type": "module",
12
12
  "main": "dist/settingsViewWorkerMain.js",
13
13
  "dependencies": {
14
- "@lvce-editor/constants": "^2.3.0"
14
+ "@lvce-editor/constants": "^2.4.0"
15
15
  }
16
16
  }