@lvce-editor/settings-view 1.18.0 → 1.19.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.
@@ -1085,7 +1085,7 @@ const KeyCode = {
1085
1085
  const mergeClassNames = (...classNames) => {
1086
1086
  return classNames.filter(Boolean).join(' ');
1087
1087
  };
1088
- const Button$1 = 1;
1088
+ const Button = 1;
1089
1089
  const Div = 4;
1090
1090
  const H1 = 5;
1091
1091
  const Input = 6;
@@ -1100,7 +1100,7 @@ const Label = 66;
1100
1100
  const VirtualDomElements = {
1101
1101
  __proto__: null,
1102
1102
  Aside,
1103
- Button: Button$1,
1103
+ Button,
1104
1104
  Div,
1105
1105
  H1,
1106
1106
  H3,
@@ -1327,7 +1327,24 @@ const handleSettingChecked = (state, name, value, source = User) => {
1327
1327
  return handleSettingUpdate(state, name, value, source);
1328
1328
  };
1329
1329
 
1330
+ const Enum = 1;
1331
+ const String = 2;
1332
+ const Boolean$1 = 3;
1333
+ const Number$1 = 5;
1334
+ const Color = 6;
1335
+ const Url = 7;
1336
+
1330
1337
  const handleSettingInput = (state, name, value, inputSource = User) => {
1338
+ const {
1339
+ items
1340
+ } = state;
1341
+
1342
+ // TODO maybe have separate input functions for number and string inputs
1343
+ const settingItem = items.find(item => item.id === name);
1344
+ if (settingItem && settingItem.type === Number$1) {
1345
+ const numberValue = value === '' ? '' : Number(value);
1346
+ return handleSettingUpdate(state, name, numberValue, inputSource);
1347
+ }
1331
1348
  return handleSettingUpdate(state, name, value, inputSource);
1332
1349
  };
1333
1350
 
@@ -1723,13 +1740,6 @@ const TextEditorTab = 'text-editor';
1723
1740
  const WindowTab = 'window';
1724
1741
  const WorkbenchTab = 'workbench';
1725
1742
 
1726
- const Enum = 1;
1727
- const String = 2;
1728
- const Boolean$1 = 3;
1729
- const Number$1 = 5;
1730
- const Color = 6;
1731
- const Url = 7;
1732
-
1733
1743
  const emptyObject = {};
1734
1744
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1735
1745
  const i18nString = (key, placeholders = emptyObject) => {
@@ -3931,11 +3941,8 @@ const {
3931
3941
  Viewlet
3932
3942
  } = ClassNames;
3933
3943
  const Badge = 'Badge';
3934
- const Button = 'Button';
3935
3944
  const CheckBox = 'CheckBox';
3936
- const Disabled = 'Disabled';
3937
3945
  const InputBox = 'InputBox';
3938
- const InputButton = 'InputButton';
3939
3946
  const MaskIcon = 'MaskIcon';
3940
3947
  const MaskIconClearAll = 'MaskIconClearAll';
3941
3948
  const ModifiedIndicator = 'ModifiedIndicator';
@@ -3979,15 +3986,20 @@ const HandleScroll = 'handleScroll';
3979
3986
  const HandleSettingSelect = 'handleSettingSelect';
3980
3987
  const HandleInputFocus = 'handleInputFocus';
3981
3988
 
3982
- const enabledClass = mergeClassNames(Button, InputButton, SearchFieldButton);
3983
- const disabledClass = mergeClassNames(enabledClass, Disabled);
3989
+ const enabledClass = SearchFieldButton;
3990
+ const disabledClass = mergeClassNames(enabledClass, 'SearchFieldButtonDisabled');
3984
3991
  const getClearButtonClassName = hasSearchValue => {
3985
3992
  if (hasSearchValue) {
3986
- return disabledClass;
3993
+ return enabledClass;
3987
3994
  }
3988
- return enabledClass;
3995
+ return disabledClass;
3989
3996
  };
3990
3997
 
3998
+ const icon = {
3999
+ type: VirtualDomElements.Div,
4000
+ className: mergeClassNames(MaskIcon, MaskIconClearAll),
4001
+ childCount: 0
4002
+ };
3991
4003
  const getSettingsInputButtonsDom = hasSearchValue => {
3992
4004
  return [{
3993
4005
  type: VirtualDomElements.Button,
@@ -3997,18 +4009,14 @@ const getSettingsInputButtonsDom = hasSearchValue => {
3997
4009
  name: Clear$1,
3998
4010
  disabled: !hasSearchValue,
3999
4011
  onClick: HandleClickClear
4000
- }, {
4001
- type: VirtualDomElements.Div,
4002
- className: mergeClassNames(MaskIcon, MaskIconClearAll),
4003
- childCount: 0
4004
- }];
4012
+ }, icon];
4005
4013
  };
4006
4014
 
4007
4015
  const getSettingsInputDom = () => {
4008
4016
  const placeholder = searchSettings();
4009
4017
  return [{
4010
4018
  type: VirtualDomElements.Input,
4011
- className: mergeClassNames(InputBox, SettingsSearchInput),
4019
+ className: mergeClassNames(InputBox, SettingsSearchInput, 'MultilineInputBox'),
4012
4020
  placeholder,
4013
4021
  childCount: 0,
4014
4022
  name: SettingsSearch,
@@ -4021,7 +4029,6 @@ const getChildCount = hasSearchValue => {
4021
4029
  return hasSearchValue ? 3 : 2;
4022
4030
  };
4023
4031
  const getSettingsHeaderDom = (filteredSettingsCount, hasSearchValue) => {
4024
- const badgeDom = getSettingsInputBadgeDom(filteredSettingsCount, hasSearchValue);
4025
4032
  const childCount = getChildCount(hasSearchValue);
4026
4033
  return [{
4027
4034
  type: VirtualDomElements.Div,
@@ -4029,9 +4036,9 @@ const getSettingsHeaderDom = (filteredSettingsCount, hasSearchValue) => {
4029
4036
  childCount: 1
4030
4037
  }, {
4031
4038
  type: VirtualDomElements.Div,
4032
- className: SettingsInputWrapper,
4039
+ className: mergeClassNames(SettingsInputWrapper, 'SearchField'),
4033
4040
  childCount
4034
- }, ...getSettingsInputDom(), ...getSettingsInputButtonsDom(hasSearchValue), ...badgeDom];
4041
+ }, ...getSettingsInputDom(), ...getSettingsInputBadgeDom(filteredSettingsCount, hasSearchValue), ...getSettingsInputButtonsDom(hasSearchValue)];
4035
4042
  };
4036
4043
 
4037
4044
  const getInputId = id => {
@@ -4398,13 +4405,17 @@ const enabledTypes = [Number$1, String, Color];
4398
4405
  const renderSettingValues = (oldState, newState) => {
4399
4406
  const {
4400
4407
  filteredItems,
4401
- id
4408
+ id,
4409
+ preferences
4402
4410
  } = newState;
4403
- const numericSettings = filteredItems.filter(item => enabledTypes.includes(item.type));
4404
- const inputValues = numericSettings.map(item => ({
4405
- name: item.id,
4406
- value: item.value
4407
- }));
4411
+ const enabledSettings = filteredItems.filter(item => enabledTypes.includes(item.type));
4412
+ const inputValues = enabledSettings.map(item => {
4413
+ const value = preferences[item.id] || item.value;
4414
+ return {
4415
+ name: item.id,
4416
+ value
4417
+ };
4418
+ });
4408
4419
  return ['Viewlet.setInputValues', id, inputValues];
4409
4420
  };
4410
4421
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",