@lvce-editor/settings-view 2.2.0 → 2.3.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.
@@ -1146,6 +1146,8 @@ const create$1 = (id, uri, x, y, width, height) => {
1146
1146
  scrollBarThumbTop: 0,
1147
1147
  scrollOffset: 0,
1148
1148
  searchValue: '',
1149
+ sideBarMinWidth: 100,
1150
+ sideBarWidth: 0,
1149
1151
  tabs: [],
1150
1152
  uri,
1151
1153
  visibleItems: [],
@@ -1156,6 +1158,10 @@ const create$1 = (id, uri, x, y, width, height) => {
1156
1158
  set$3(id, state, state);
1157
1159
  };
1158
1160
 
1161
+ const isEqual$5 = (oldState, newState) => {
1162
+ return oldState.sideBarWidth === newState.sideBarWidth;
1163
+ };
1164
+
1159
1165
  const isEqual$4 = (oldState, newState) => {
1160
1166
  return oldState.focus === newState.focus;
1161
1167
  };
@@ -1178,13 +1184,14 @@ const RenderValue = 3;
1178
1184
  const RenderSettingValues = 10;
1179
1185
  const RenderScrollOffset = 11;
1180
1186
  const RenderFocusContext = 12;
1187
+ const RenderCss = 13;
1181
1188
 
1182
1189
  const isEqual = (oldState, newState) => {
1183
1190
  return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1184
1191
  };
1185
1192
 
1186
- const modules = [isEqual$3, isEqual, isEqual$1, isEqual$2, isEqual$4, isEqual$4];
1187
- const numbers = [RenderItems, RenderValue, RenderSettingValues, RenderScrollOffset, RenderFocus, RenderFocusContext];
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];
1188
1195
 
1189
1196
  const diff = (oldState, newState) => {
1190
1197
  const diffResult = [];
@@ -1916,6 +1923,25 @@ const handleInputFocus = state => {
1916
1923
  };
1917
1924
  };
1918
1925
 
1926
+ const handleResizerPointerDown = (state, eventX, eventY) => {
1927
+ return state;
1928
+ };
1929
+
1930
+ const handleResizerPointerMove = (state, eventX, eventY) => {
1931
+ const {
1932
+ sideBarMinWidth
1933
+ } = state;
1934
+ const newWidth = Math.max(eventX, sideBarMinWidth);
1935
+ return {
1936
+ ...state,
1937
+ sideBarWidth: newWidth
1938
+ };
1939
+ };
1940
+
1941
+ const handleResizerPointerUp = (state, eventX, eventY) => {
1942
+ return state;
1943
+ };
1944
+
1919
1945
  const handleScroll = (state, scrollTop, inputSource = User) => {
1920
1946
  return {
1921
1947
  ...state,
@@ -2063,11 +2089,19 @@ const getModifiedSettings = preferences => {
2063
2089
  return modifiedSettings;
2064
2090
  };
2065
2091
 
2092
+ const ClientX = 'event.clientX';
2093
+ const ClientY = 'event.clientY';
2094
+ const DeltaY = 'event.deltaY';
2095
+ const TargetName = 'event.target.name';
2096
+ const TargetValue = 'event.target.value';
2097
+
2066
2098
  const Script = 2;
2067
2099
 
2068
2100
  const DebugWorker = 55;
2069
2101
  const RendererWorker$1 = 1;
2070
2102
 
2103
+ const SetCss = 'Viewlet.setCss';
2104
+
2071
2105
  const rpcs = Object.create(null);
2072
2106
  const set$2 = (id, rpc) => {
2073
2107
  rpcs[id] = rpc;
@@ -4778,11 +4812,32 @@ const loadContent = async (state, savedState) => {
4778
4812
  scrollBarThumbTop: thumbTop,
4779
4813
  scrollOffset,
4780
4814
  searchValue,
4815
+ sideBarWidth: 200,
4781
4816
  tabs: newTabs,
4782
4817
  visibleItems
4783
4818
  };
4784
4819
  };
4785
4820
 
4821
+ const getCss = sideBarWidth => {
4822
+ return `
4823
+ .Settings {
4824
+ --SettingsSideBarWidth: ${sideBarWidth}px;
4825
+ }
4826
+ .SettingsResizer {
4827
+ color: yellow;
4828
+ }
4829
+ `;
4830
+ };
4831
+
4832
+ const renderCss = (oldState, newState) => {
4833
+ const {
4834
+ id,
4835
+ sideBarWidth
4836
+ } = newState;
4837
+ const css = getCss(sideBarWidth);
4838
+ return [SetCss, id, css];
4839
+ };
4840
+
4786
4841
  const renderFocus = (oldState, newState) => {
4787
4842
  const {
4788
4843
  id
@@ -4808,6 +4863,8 @@ const Label = 'Label';
4808
4863
  const MaskIcon = 'MaskIcon';
4809
4864
  const MaskIconClearAll = 'MaskIconClearAll';
4810
4865
  const ModifiedIndicator = 'ModifiedIndicator';
4866
+ const Resizer = 'Resizer';
4867
+ const ResizerHighlight = 'ResizerHighlight';
4811
4868
  const SearchFieldButton = 'SearchFieldButton';
4812
4869
  const Select = 'Select';
4813
4870
  const Settings = 'Settings';
@@ -4852,6 +4909,9 @@ const HandleSettingChecked = 'handleSettingChecked';
4852
4909
  const HandleWheel = 'handleWheel';
4853
4910
  const HandleSettingSelect = 'handleSettingSelect';
4854
4911
  const HandleInputFocus = 'handleInputFocus';
4912
+ const HandleResizerPointerDown = 'handleResizerPointerDown';
4913
+ const HandleResizerPointerMove = 'handleResizerPointerMove';
4914
+ const HandleResizerPointerUp = 'handleResizerPointerUp';
4855
4915
 
4856
4916
  const enabledClass = SearchFieldButton;
4857
4917
  const disabledClass = mergeClassNames(enabledClass, 'SearchFieldButtonDisabled');
@@ -4912,6 +4972,19 @@ const getSettingsHeaderDom = (filteredSettingsCount, hasSearchValue) => {
4912
4972
  }, ...getSettingsInputDom(), ...getSettingsInputBadgeDom(filteredSettingsCount, hasSearchValue), ...getSettingsInputButtonsDom(hasSearchValue)];
4913
4973
  };
4914
4974
 
4975
+ const getResizerVirtualDom = () => {
4976
+ return [{
4977
+ childCount: 1,
4978
+ className: mergeClassNames(Resizer, 'SettingsResizer'),
4979
+ onPointerDown: HandleResizerPointerDown,
4980
+ type: Div
4981
+ }, {
4982
+ childCount: 0,
4983
+ className: ResizerHighlight,
4984
+ type: Div
4985
+ }];
4986
+ };
4987
+
4915
4988
  const getContentHeadingDom = headerText => {
4916
4989
  return [{
4917
4990
  childCount: 1,
@@ -5293,10 +5366,10 @@ const getSettingsSideBarDom = tabs => {
5293
5366
 
5294
5367
  const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, thumbHeight, thumbTop) => {
5295
5368
  return [{
5296
- childCount: 2,
5369
+ childCount: 3,
5297
5370
  className: SettingsMain,
5298
5371
  type: Div
5299
- }, ...getSettingsSideBarDom(tabs), ...getSettingsContentDom(visibleItems, tabs, searchValue, thumbHeight, thumbTop)];
5372
+ }, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, thumbHeight, thumbTop)];
5300
5373
  };
5301
5374
 
5302
5375
  const parentNode = {
@@ -5361,6 +5434,8 @@ const renderValue = (oldState, newState) => {
5361
5434
 
5362
5435
  const getRenderer = diffType => {
5363
5436
  switch (diffType) {
5437
+ case RenderCss:
5438
+ return renderCss;
5364
5439
  case RenderFocus:
5365
5440
  return renderFocus;
5366
5441
  case RenderFocusContext:
@@ -5404,19 +5479,19 @@ const renderActions = () => {
5404
5479
  const renderEventListeners = () => {
5405
5480
  return [{
5406
5481
  name: HandleClickTab,
5407
- params: ['handleClickTab', 'event.target.name']
5482
+ params: ['handleClickTab', TargetName]
5408
5483
  }, {
5409
5484
  name: HandleInput,
5410
- params: ['handleInput', 'event.target.value']
5485
+ params: ['handleInput', TargetValue]
5411
5486
  }, {
5412
5487
  name: HandleClickClear,
5413
5488
  params: ['clear']
5414
5489
  }, {
5415
5490
  name: HandleSettingInput,
5416
- params: ['handleSettingInput', 'event.target.name', 'event.target.value']
5491
+ params: ['handleSettingInput', TargetName, TargetValue]
5417
5492
  }, {
5418
5493
  name: HandleSettingChecked,
5419
- params: ['handleSettingChecked', 'event.target.name', 'event.target.value']
5494
+ params: ['handleSettingChecked', TargetName, TargetValue]
5420
5495
  },
5421
5496
  // {
5422
5497
  // name: DomEventListenerFunctions.HandleScroll,
@@ -5425,14 +5500,25 @@ const renderEventListeners = () => {
5425
5500
  // },
5426
5501
  {
5427
5502
  name: HandleWheel,
5428
- params: ['handleWheel', 'event.deltaY'],
5503
+ params: ['handleWheel', DeltaY],
5429
5504
  passive: true
5430
5505
  }, {
5431
5506
  name: HandleSettingSelect,
5432
- params: ['handleSettingSelect', 'event.target.name', 'event.target.value']
5507
+ params: ['handleSettingSelect', TargetName, TargetValue]
5433
5508
  }, {
5434
5509
  name: HandleInputFocus,
5435
5510
  params: ['handleInputFocus']
5511
+ }, {
5512
+ name: HandleResizerPointerDown,
5513
+ params: ['handleResizerPointerDown', ClientX, ClientY],
5514
+ // @ts-ignore
5515
+ trackPointerEvents: [HandleResizerPointerMove, HandleResizerPointerUp]
5516
+ }, {
5517
+ name: HandleResizerPointerMove,
5518
+ params: ['handleResizerPointerMove', ClientX, ClientY]
5519
+ }, {
5520
+ name: HandleResizerPointerUp,
5521
+ params: ['handleResizerPointerUp', ClientX, ClientY]
5436
5522
  }];
5437
5523
  };
5438
5524
 
@@ -5520,6 +5606,9 @@ const commandMap = {
5520
5606
  'Settings.handleInput': wrapCommand(handleInput),
5521
5607
  'Settings.handleInputBlur': wrapCommand(handleInputBlur),
5522
5608
  'Settings.handleInputFocus': wrapCommand(handleInputFocus),
5609
+ 'Settings.handleResizerPointerDown': wrapCommand(handleResizerPointerDown),
5610
+ 'Settings.handleResizerPointerMove': wrapCommand(handleResizerPointerMove),
5611
+ 'Settings.handleResizerPointerUp': wrapCommand(handleResizerPointerUp),
5523
5612
  'Settings.handleScroll': wrapCommand(handleScroll),
5524
5613
  'Settings.handleSettingChecked': wrapCommand(handleSettingChecked),
5525
5614
  'Settings.handleSettingInput': wrapCommand(handleSettingInput),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,5 +9,8 @@
9
9
  "license": "MIT",
10
10
  "author": "Lvce Editor",
11
11
  "type": "module",
12
- "main": "dist/settingsViewWorkerMain.js"
12
+ "main": "dist/settingsViewWorkerMain.js",
13
+ "dependencies": {
14
+ "@lvce-editor/constants": "^2.3.0"
15
+ }
13
16
  }