@lvce-editor/settings-view 1.6.0 → 1.8.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.
- package/dist/settingsViewWorkerMain.js +273 -92
- package/package.json +1 -1
|
@@ -914,10 +914,34 @@ const terminate = () => {
|
|
|
914
914
|
globalThis.close();
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
+
const getFilteredItems = (items, tabs, searchValue = '') => {
|
|
918
|
+
const selectedTab = tabs.find(tab => tab.selected);
|
|
919
|
+
if (!selectedTab) {
|
|
920
|
+
return items;
|
|
921
|
+
}
|
|
922
|
+
const tabFilteredItems = items.filter(item => item.category === selectedTab.id);
|
|
923
|
+
if (!searchValue.trim()) {
|
|
924
|
+
return tabFilteredItems;
|
|
925
|
+
}
|
|
926
|
+
const normalizedSearchValue = searchValue.toLowerCase().trim();
|
|
927
|
+
return tabFilteredItems.filter(item => item.heading.toLowerCase().includes(normalizedSearchValue));
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
const User = 1;
|
|
931
|
+
const Script = 2;
|
|
932
|
+
|
|
917
933
|
const clear$1 = state => {
|
|
934
|
+
const {
|
|
935
|
+
items,
|
|
936
|
+
tabs
|
|
937
|
+
} = state;
|
|
938
|
+
const newSearchValue = '';
|
|
939
|
+
const filteredItems = getFilteredItems(items, tabs, newSearchValue);
|
|
918
940
|
return {
|
|
919
941
|
...state,
|
|
920
|
-
searchValue:
|
|
942
|
+
searchValue: newSearchValue,
|
|
943
|
+
inputSource: Script,
|
|
944
|
+
filteredItems
|
|
921
945
|
};
|
|
922
946
|
};
|
|
923
947
|
|
|
@@ -945,24 +969,32 @@ const create$1 = (id, uri, x, y, width, height) => {
|
|
|
945
969
|
items: [],
|
|
946
970
|
searchValue: '',
|
|
947
971
|
filteredItems: [],
|
|
948
|
-
preferences: {}
|
|
972
|
+
preferences: {},
|
|
973
|
+
inputSource: 0,
|
|
974
|
+
scrollOffset: 0,
|
|
975
|
+
filteredItemsCount: 0
|
|
949
976
|
};
|
|
950
977
|
set$1(id, state, state);
|
|
951
978
|
};
|
|
952
979
|
|
|
953
|
-
const isEqual$
|
|
980
|
+
const isEqual$2 = (oldState, newState) => {
|
|
954
981
|
return oldState.focus === newState.focus;
|
|
955
982
|
};
|
|
956
983
|
|
|
957
|
-
const isEqual = (oldState, newState) => {
|
|
984
|
+
const isEqual$1 = (oldState, newState) => {
|
|
958
985
|
return oldState === newState;
|
|
959
986
|
};
|
|
960
987
|
|
|
961
988
|
const RenderItems = 1;
|
|
962
989
|
const RenderFocus = 2;
|
|
990
|
+
const RenderValue = 3;
|
|
991
|
+
|
|
992
|
+
const isEqual = (oldState, newState) => {
|
|
993
|
+
return newState.inputSource === User || oldState.searchValue === newState.searchValue;
|
|
994
|
+
};
|
|
963
995
|
|
|
964
|
-
const modules = [isEqual$1, isEqual];
|
|
965
|
-
const numbers = [RenderFocus, RenderItems];
|
|
996
|
+
const modules = [isEqual$2, isEqual$1, isEqual];
|
|
997
|
+
const numbers = [RenderFocus, RenderItems, RenderValue];
|
|
966
998
|
|
|
967
999
|
const diff = (oldState, newState) => {
|
|
968
1000
|
const diffResult = [];
|
|
@@ -984,19 +1016,6 @@ const diff2 = uid => {
|
|
|
984
1016
|
return diffResult;
|
|
985
1017
|
};
|
|
986
1018
|
|
|
987
|
-
const getFilteredItems = (items, tabs, searchValue = '') => {
|
|
988
|
-
const selectedTab = tabs.find(tab => tab.selected);
|
|
989
|
-
if (!selectedTab) {
|
|
990
|
-
return items;
|
|
991
|
-
}
|
|
992
|
-
const tabFilteredItems = items.filter(item => item.category === selectedTab.id);
|
|
993
|
-
if (!searchValue.trim()) {
|
|
994
|
-
return tabFilteredItems;
|
|
995
|
-
}
|
|
996
|
-
const normalizedSearchValue = searchValue.toLowerCase().trim();
|
|
997
|
-
return tabFilteredItems.filter(item => item.heading.toLowerCase().includes(normalizedSearchValue));
|
|
998
|
-
};
|
|
999
|
-
|
|
1000
1019
|
const getSelectedTabId = tabs => {
|
|
1001
1020
|
for (const tab of tabs) {
|
|
1002
1021
|
if (tab.selected) {
|
|
@@ -1045,7 +1064,8 @@ const handleInput = (state, value) => {
|
|
|
1045
1064
|
return {
|
|
1046
1065
|
...state,
|
|
1047
1066
|
searchValue: value,
|
|
1048
|
-
filteredItems
|
|
1067
|
+
filteredItems,
|
|
1068
|
+
inputSource: User
|
|
1049
1069
|
};
|
|
1050
1070
|
};
|
|
1051
1071
|
|
|
@@ -1067,6 +1087,7 @@ const TextEditorTab = 'text-editor';
|
|
|
1067
1087
|
const WindowTab = 'window';
|
|
1068
1088
|
const WorkbenchTab = 'workbench';
|
|
1069
1089
|
|
|
1090
|
+
const Enum = 1;
|
|
1070
1091
|
const String = 2;
|
|
1071
1092
|
const Boolean$1 = 3;
|
|
1072
1093
|
const Number$1 = 5;
|
|
@@ -1103,7 +1124,6 @@ const FormatOnSaveDescription = 'Format code when saving';
|
|
|
1103
1124
|
const NumberValue = 'number value';
|
|
1104
1125
|
const SearchSettings = 'Search Settings';
|
|
1105
1126
|
const SettingsContent = 'Settings Content';
|
|
1106
|
-
const SettingsSideBar = 'Settings SideBar';
|
|
1107
1127
|
const SidebarPosition = 'Sidebar Position';
|
|
1108
1128
|
const SidebarPositionDescription = 'The position of the sidebar';
|
|
1109
1129
|
const Telemetry = 'Telemetry';
|
|
@@ -1410,9 +1430,6 @@ const searchSettings = () => {
|
|
|
1410
1430
|
const settingsContent = () => {
|
|
1411
1431
|
return i18nString(SettingsContent);
|
|
1412
1432
|
};
|
|
1413
|
-
const settingsSideBar = () => {
|
|
1414
|
-
return i18nString(SettingsSideBar);
|
|
1415
|
-
};
|
|
1416
1433
|
const sidebarPosition = () => {
|
|
1417
1434
|
return i18nString(SidebarPosition);
|
|
1418
1435
|
};
|
|
@@ -2164,16 +2181,30 @@ const getSettingItems = async () => {
|
|
|
2164
2181
|
id: 'wordWrap',
|
|
2165
2182
|
heading: wordWrap(),
|
|
2166
2183
|
description: wordWrapDescription(),
|
|
2167
|
-
type:
|
|
2184
|
+
type: Enum,
|
|
2168
2185
|
value: 'off',
|
|
2169
|
-
category: TextEditorTab
|
|
2186
|
+
category: TextEditorTab,
|
|
2187
|
+
options: [{
|
|
2188
|
+
id: 'on',
|
|
2189
|
+
label: 'On' // i18n
|
|
2190
|
+
}, {
|
|
2191
|
+
id: 'off',
|
|
2192
|
+
label: 'off' // i18n
|
|
2193
|
+
}]
|
|
2170
2194
|
}, {
|
|
2171
2195
|
id: 'lineNumbers',
|
|
2172
2196
|
heading: lineNumbers(),
|
|
2173
2197
|
description: lineNumbersDescription(),
|
|
2174
|
-
type:
|
|
2198
|
+
type: Enum,
|
|
2175
2199
|
value: 'on',
|
|
2176
|
-
category: TextEditorTab
|
|
2200
|
+
category: TextEditorTab,
|
|
2201
|
+
options: [{
|
|
2202
|
+
id: 'on',
|
|
2203
|
+
label: 'On' // i18n
|
|
2204
|
+
}, {
|
|
2205
|
+
id: 'off',
|
|
2206
|
+
label: 'off' // i18n
|
|
2207
|
+
}]
|
|
2177
2208
|
}, {
|
|
2178
2209
|
id: 'minimap',
|
|
2179
2210
|
heading: minimap(),
|
|
@@ -3080,20 +3111,78 @@ const getTabs = () => {
|
|
|
3080
3111
|
return tabs;
|
|
3081
3112
|
};
|
|
3082
3113
|
|
|
3114
|
+
const getSavedMinLineY = savedState => {
|
|
3115
|
+
if (savedState && typeof savedState === 'object' && 'minLineY' in savedState && typeof savedState.minLineY === 'number') {
|
|
3116
|
+
return savedState.minLineY;
|
|
3117
|
+
}
|
|
3118
|
+
return 0;
|
|
3119
|
+
};
|
|
3120
|
+
const getSavedSearchValue = savedState => {
|
|
3121
|
+
if (savedState && typeof savedState === 'object' && 'searchValue' in savedState && typeof savedState.searchValue === 'string') {
|
|
3122
|
+
return savedState.searchValue;
|
|
3123
|
+
}
|
|
3124
|
+
return '';
|
|
3125
|
+
};
|
|
3126
|
+
const getSavedDeltaY = savedState => {
|
|
3127
|
+
if (savedState && typeof savedState === 'object' && 'deltaY' in savedState && typeof savedState.deltaY === 'number') {
|
|
3128
|
+
return savedState.deltaY;
|
|
3129
|
+
}
|
|
3130
|
+
return 0;
|
|
3131
|
+
};
|
|
3132
|
+
const getSavedWorkspacePath = savedState => {
|
|
3133
|
+
if (savedState && typeof savedState === 'object' && 'workspacePath' in savedState && typeof savedState.workspacePath === 'string') {
|
|
3134
|
+
return savedState.workspacePath;
|
|
3135
|
+
}
|
|
3136
|
+
return '';
|
|
3137
|
+
};
|
|
3138
|
+
const getSavedTabId = savedState => {
|
|
3139
|
+
if (savedState && typeof savedState === 'object' && 'selectedTab' in savedState && typeof savedState.selectedTab === 'string') {
|
|
3140
|
+
return savedState.selectedTab;
|
|
3141
|
+
}
|
|
3142
|
+
return '';
|
|
3143
|
+
};
|
|
3144
|
+
const restoreState = savedState => {
|
|
3145
|
+
if (!savedState) {
|
|
3146
|
+
return {
|
|
3147
|
+
root: '',
|
|
3148
|
+
minLineY: 0,
|
|
3149
|
+
deltaY: 0,
|
|
3150
|
+
tabId: '',
|
|
3151
|
+
searchValue: ''
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
const root = getSavedWorkspacePath(savedState);
|
|
3155
|
+
const minLineY = getSavedMinLineY(savedState);
|
|
3156
|
+
const deltaY = getSavedDeltaY(savedState);
|
|
3157
|
+
const tabId = getSavedTabId(savedState);
|
|
3158
|
+
const searchValue = getSavedSearchValue(savedState);
|
|
3159
|
+
return {
|
|
3160
|
+
root,
|
|
3161
|
+
minLineY,
|
|
3162
|
+
deltaY,
|
|
3163
|
+
tabId,
|
|
3164
|
+
searchValue
|
|
3165
|
+
};
|
|
3166
|
+
};
|
|
3167
|
+
|
|
3083
3168
|
const loadContent = async (state, savedState) => {
|
|
3084
3169
|
const {
|
|
3085
|
-
searchValue
|
|
3086
|
-
|
|
3170
|
+
searchValue,
|
|
3171
|
+
tabId
|
|
3172
|
+
} = restoreState(savedState);
|
|
3087
3173
|
const tabs = getTabs();
|
|
3174
|
+
const newTabs = getUpdatedTabs(tabs, tabId);
|
|
3088
3175
|
const items = await getSettingItems();
|
|
3089
|
-
const filteredItems = getFilteredItems(items,
|
|
3176
|
+
const filteredItems = getFilteredItems(items, newTabs, searchValue);
|
|
3090
3177
|
const preferences = await getPreferences();
|
|
3091
3178
|
return {
|
|
3092
3179
|
...state,
|
|
3093
|
-
tabs,
|
|
3180
|
+
tabs: newTabs,
|
|
3094
3181
|
items,
|
|
3095
3182
|
filteredItems,
|
|
3096
|
-
preferences
|
|
3183
|
+
preferences,
|
|
3184
|
+
inputSource: Script,
|
|
3185
|
+
searchValue
|
|
3097
3186
|
};
|
|
3098
3187
|
};
|
|
3099
3188
|
|
|
@@ -3115,21 +3204,25 @@ const Div = 4;
|
|
|
3115
3204
|
const H1 = 5;
|
|
3116
3205
|
const Input = 6;
|
|
3117
3206
|
const Text = 12;
|
|
3118
|
-
const H2 = 22;
|
|
3119
3207
|
const H3 = 23;
|
|
3120
3208
|
const Aside = 28;
|
|
3121
3209
|
const P = 50;
|
|
3122
3210
|
const Ul = 60;
|
|
3211
|
+
const Select = 63;
|
|
3212
|
+
const Option = 64;
|
|
3213
|
+
const Label = 66;
|
|
3123
3214
|
const VirtualDomElements = {
|
|
3124
3215
|
__proto__: null,
|
|
3125
3216
|
Aside,
|
|
3126
3217
|
Button,
|
|
3127
3218
|
Div,
|
|
3128
3219
|
H1,
|
|
3129
|
-
H2,
|
|
3130
3220
|
H3,
|
|
3131
3221
|
Input,
|
|
3222
|
+
Label,
|
|
3223
|
+
Option,
|
|
3132
3224
|
P,
|
|
3225
|
+
Select,
|
|
3133
3226
|
Ul};
|
|
3134
3227
|
const text = data => {
|
|
3135
3228
|
return {
|
|
@@ -3164,13 +3257,17 @@ const getSettingsInputDom = () => {
|
|
|
3164
3257
|
onInput: HandleInput
|
|
3165
3258
|
}, {
|
|
3166
3259
|
type: VirtualDomElements.Button,
|
|
3167
|
-
className: 'Button InputButton',
|
|
3260
|
+
className: 'Button InputButton SearchFieldButton',
|
|
3168
3261
|
childCount: 1,
|
|
3169
3262
|
ariaLabel: clear(),
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3263
|
+
name: Clear$1,
|
|
3264
|
+
// TODO add click event listener
|
|
3265
|
+
onClick: HandleClickClear
|
|
3266
|
+
}, {
|
|
3267
|
+
type: VirtualDomElements.Div,
|
|
3268
|
+
className: 'MaskIcon MaskIconClearAll',
|
|
3269
|
+
childCount: 0
|
|
3270
|
+
}];
|
|
3174
3271
|
};
|
|
3175
3272
|
|
|
3176
3273
|
const getSettingsHeaderDom = () => {
|
|
@@ -3181,6 +3278,41 @@ const getSettingsHeaderDom = () => {
|
|
|
3181
3278
|
}, ...getSettingsInputDom()];
|
|
3182
3279
|
};
|
|
3183
3280
|
|
|
3281
|
+
const getInputId = id => {
|
|
3282
|
+
return id.replaceAll('.', '\\.');
|
|
3283
|
+
};
|
|
3284
|
+
|
|
3285
|
+
const getItemCheckBoxVirtualDom = item => {
|
|
3286
|
+
const {
|
|
3287
|
+
heading,
|
|
3288
|
+
description,
|
|
3289
|
+
id
|
|
3290
|
+
} = item;
|
|
3291
|
+
const domId = getInputId(id);
|
|
3292
|
+
return [{
|
|
3293
|
+
type: VirtualDomElements.Div,
|
|
3294
|
+
className: 'SettingsItem',
|
|
3295
|
+
childCount: 3
|
|
3296
|
+
}, {
|
|
3297
|
+
type: VirtualDomElements.H3,
|
|
3298
|
+
childCount: 1
|
|
3299
|
+
}, text(heading), {
|
|
3300
|
+
type: VirtualDomElements.Div,
|
|
3301
|
+
className: 'SettingsItemCheckBox',
|
|
3302
|
+
childCount: 2
|
|
3303
|
+
}, {
|
|
3304
|
+
type: VirtualDomElements.Input,
|
|
3305
|
+
className: 'CheckBox',
|
|
3306
|
+
inputType: 'checkbox',
|
|
3307
|
+
childCount: 0,
|
|
3308
|
+
id: domId
|
|
3309
|
+
}, {
|
|
3310
|
+
type: VirtualDomElements.Label,
|
|
3311
|
+
childCount: 1,
|
|
3312
|
+
htmlFor: domId
|
|
3313
|
+
}, text(description)];
|
|
3314
|
+
};
|
|
3315
|
+
|
|
3184
3316
|
const getItemNumberVirtualDom = item => {
|
|
3185
3317
|
const {
|
|
3186
3318
|
heading,
|
|
@@ -3205,23 +3337,103 @@ const getItemNumberVirtualDom = item => {
|
|
|
3205
3337
|
}];
|
|
3206
3338
|
};
|
|
3207
3339
|
|
|
3340
|
+
const getOptionDom = option => {
|
|
3341
|
+
const {
|
|
3342
|
+
id,
|
|
3343
|
+
label
|
|
3344
|
+
} = option;
|
|
3345
|
+
return [{
|
|
3346
|
+
type: VirtualDomElements.Option,
|
|
3347
|
+
childCount: 1,
|
|
3348
|
+
value: id
|
|
3349
|
+
}, text(label)];
|
|
3350
|
+
};
|
|
3351
|
+
|
|
3352
|
+
const getItemSelectVirtualDom = item => {
|
|
3353
|
+
const {
|
|
3354
|
+
heading,
|
|
3355
|
+
description
|
|
3356
|
+
} = item;
|
|
3357
|
+
const options = item.options || [];
|
|
3358
|
+
return [{
|
|
3359
|
+
type: VirtualDomElements.Div,
|
|
3360
|
+
className: 'SettingsItem',
|
|
3361
|
+
childCount: 3
|
|
3362
|
+
}, {
|
|
3363
|
+
type: VirtualDomElements.H3,
|
|
3364
|
+
childCount: 1
|
|
3365
|
+
}, text(heading), {
|
|
3366
|
+
type: VirtualDomElements.P,
|
|
3367
|
+
childCount: 1
|
|
3368
|
+
}, text(description), {
|
|
3369
|
+
type: VirtualDomElements.Select,
|
|
3370
|
+
className: 'Select',
|
|
3371
|
+
childCount: options.length
|
|
3372
|
+
}, ...options.flatMap(getOptionDom)];
|
|
3373
|
+
};
|
|
3374
|
+
|
|
3375
|
+
const getItemStringVirtualDom = item => {
|
|
3376
|
+
const {
|
|
3377
|
+
heading,
|
|
3378
|
+
description
|
|
3379
|
+
} = item;
|
|
3380
|
+
return [{
|
|
3381
|
+
type: VirtualDomElements.Div,
|
|
3382
|
+
className: 'SettingsItem',
|
|
3383
|
+
childCount: 3
|
|
3384
|
+
}, {
|
|
3385
|
+
type: VirtualDomElements.H3,
|
|
3386
|
+
childCount: 1
|
|
3387
|
+
}, text(heading), {
|
|
3388
|
+
type: VirtualDomElements.P,
|
|
3389
|
+
childCount: 1
|
|
3390
|
+
}, text(description), {
|
|
3391
|
+
type: VirtualDomElements.Input,
|
|
3392
|
+
className: 'InputBox',
|
|
3393
|
+
inputType: 'text',
|
|
3394
|
+
placeholder: numberValue(),
|
|
3395
|
+
childCount: 0
|
|
3396
|
+
}];
|
|
3397
|
+
};
|
|
3398
|
+
|
|
3399
|
+
const getItemVirtualDom = item => {
|
|
3400
|
+
if (item.type === Number$1) {
|
|
3401
|
+
return getItemNumberVirtualDom(item);
|
|
3402
|
+
}
|
|
3403
|
+
if (item.type === Boolean$1) {
|
|
3404
|
+
return getItemCheckBoxVirtualDom(item);
|
|
3405
|
+
}
|
|
3406
|
+
if (item.type === String) {
|
|
3407
|
+
return getItemStringVirtualDom(item);
|
|
3408
|
+
}
|
|
3409
|
+
if (item.type === Enum) {
|
|
3410
|
+
return getItemSelectVirtualDom(item);
|
|
3411
|
+
}
|
|
3412
|
+
// TODO
|
|
3413
|
+
return [text('unknown setting type')];
|
|
3414
|
+
};
|
|
3415
|
+
|
|
3416
|
+
const getSettingsNoResultsDom = searchValue => {
|
|
3417
|
+
return [{
|
|
3418
|
+
type: VirtualDomElements.Div,
|
|
3419
|
+
className: 'SettingsItems',
|
|
3420
|
+
childCount: 1
|
|
3421
|
+
}, {
|
|
3422
|
+
type: VirtualDomElements.Div,
|
|
3423
|
+
className: 'SettingsNoResults',
|
|
3424
|
+
childCount: 1
|
|
3425
|
+
}, text(noSettingsMatching(searchValue))];
|
|
3426
|
+
};
|
|
3427
|
+
|
|
3208
3428
|
const getSettingsItemsDom = (items, searchValue) => {
|
|
3209
3429
|
if (items.length === 0 && searchValue.trim()) {
|
|
3210
|
-
return
|
|
3211
|
-
type: VirtualDomElements.Div,
|
|
3212
|
-
className: 'SettingsItems',
|
|
3213
|
-
childCount: 1
|
|
3214
|
-
}, {
|
|
3215
|
-
type: VirtualDomElements.Div,
|
|
3216
|
-
className: 'SettingsNoResults',
|
|
3217
|
-
childCount: 1
|
|
3218
|
-
}, text(noSettingsMatching(searchValue))];
|
|
3430
|
+
return getSettingsNoResultsDom(searchValue);
|
|
3219
3431
|
}
|
|
3220
3432
|
return [{
|
|
3221
3433
|
type: VirtualDomElements.Div,
|
|
3222
3434
|
className: 'SettingsItems',
|
|
3223
3435
|
childCount: items.length
|
|
3224
|
-
}, ...items.flatMap(
|
|
3436
|
+
}, ...items.flatMap(getItemVirtualDom)];
|
|
3225
3437
|
};
|
|
3226
3438
|
|
|
3227
3439
|
const getSettingsContentDom = (items, tabs, searchValue) => {
|
|
@@ -3266,16 +3478,11 @@ const getSettingsTabsDom = tabs => {
|
|
|
3266
3478
|
};
|
|
3267
3479
|
|
|
3268
3480
|
const getSettingsSideBarDom = tabs => {
|
|
3269
|
-
const sideBarHeading = settingsSideBar();
|
|
3270
3481
|
return [{
|
|
3271
3482
|
type: VirtualDomElements.Aside,
|
|
3272
3483
|
className: 'SettingsSideBar',
|
|
3273
|
-
childCount: 2
|
|
3274
|
-
}, {
|
|
3275
|
-
type: VirtualDomElements.H2,
|
|
3276
|
-
className: 'SettingsSideBarHeading',
|
|
3277
3484
|
childCount: 1
|
|
3278
|
-
},
|
|
3485
|
+
}, ...getSettingsTabsDom(tabs)];
|
|
3279
3486
|
};
|
|
3280
3487
|
|
|
3281
3488
|
const getSettingsMainDom = (tabs, items, searchValue) => {
|
|
@@ -3304,10 +3511,20 @@ const renderItems = (oldState, newState) => {
|
|
|
3304
3511
|
return ['Viewlet.setDom2', newState.id, dom];
|
|
3305
3512
|
};
|
|
3306
3513
|
|
|
3514
|
+
const renderValue = (oldState, newState) => {
|
|
3515
|
+
const {
|
|
3516
|
+
id,
|
|
3517
|
+
searchValue
|
|
3518
|
+
} = newState;
|
|
3519
|
+
return ['Viewlet.setValueByName', id, SettingsSearch, searchValue];
|
|
3520
|
+
};
|
|
3521
|
+
|
|
3307
3522
|
const getRenderer = diffType => {
|
|
3308
3523
|
switch (diffType) {
|
|
3309
3524
|
case RenderItems:
|
|
3310
3525
|
return renderItems;
|
|
3526
|
+
case RenderValue:
|
|
3527
|
+
return renderValue;
|
|
3311
3528
|
default:
|
|
3312
3529
|
throw new Error('unknown renderer');
|
|
3313
3530
|
}
|
|
@@ -3349,42 +3566,6 @@ const renderEventListeners = () => {
|
|
|
3349
3566
|
}];
|
|
3350
3567
|
};
|
|
3351
3568
|
|
|
3352
|
-
const getSavedMinLineY = savedState => {
|
|
3353
|
-
if (savedState && typeof savedState === 'object' && 'minLineY' in savedState && typeof savedState.minLineY === 'number') {
|
|
3354
|
-
return savedState.minLineY;
|
|
3355
|
-
}
|
|
3356
|
-
return 0;
|
|
3357
|
-
};
|
|
3358
|
-
const getSavedDeltaY = savedState => {
|
|
3359
|
-
if (savedState && typeof savedState === 'object' && 'deltaY' in savedState && typeof savedState.deltaY === 'number') {
|
|
3360
|
-
return savedState.deltaY;
|
|
3361
|
-
}
|
|
3362
|
-
return 0;
|
|
3363
|
-
};
|
|
3364
|
-
const getSavedWorkspacePath = savedState => {
|
|
3365
|
-
if (savedState && typeof savedState === 'object' && 'workspacePath' in savedState && typeof savedState.workspacePath === 'string') {
|
|
3366
|
-
return savedState.workspacePath;
|
|
3367
|
-
}
|
|
3368
|
-
return '';
|
|
3369
|
-
};
|
|
3370
|
-
const restoreState = savedState => {
|
|
3371
|
-
if (!savedState) {
|
|
3372
|
-
return {
|
|
3373
|
-
root: '',
|
|
3374
|
-
minLineY: 0,
|
|
3375
|
-
deltaY: 0
|
|
3376
|
-
};
|
|
3377
|
-
}
|
|
3378
|
-
const root = getSavedWorkspacePath(savedState);
|
|
3379
|
-
const minLineY = getSavedMinLineY(savedState);
|
|
3380
|
-
const deltaY = getSavedDeltaY(savedState);
|
|
3381
|
-
return {
|
|
3382
|
-
root,
|
|
3383
|
-
minLineY,
|
|
3384
|
-
deltaY
|
|
3385
|
-
};
|
|
3386
|
-
};
|
|
3387
|
-
|
|
3388
3569
|
const saveState = state => {
|
|
3389
3570
|
const {
|
|
3390
3571
|
tabs,
|