@lvce-editor/settings-view 1.1.0 → 1.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.
- package/dist/settingsViewWorkerMain.js +265 -11
- package/package.json +1 -1
|
@@ -932,7 +932,8 @@ const create$1 = (id, uri, x, y, width, height) => {
|
|
|
932
932
|
x,
|
|
933
933
|
y,
|
|
934
934
|
width,
|
|
935
|
-
height
|
|
935
|
+
height,
|
|
936
|
+
tabs: []
|
|
936
937
|
};
|
|
937
938
|
set$1(id, state, state);
|
|
938
939
|
};
|
|
@@ -975,19 +976,45 @@ const initialize = async () => {
|
|
|
975
976
|
// TODO
|
|
976
977
|
};
|
|
977
978
|
|
|
979
|
+
const getTabs = () => {
|
|
980
|
+
const tabs = ['Text Editor', 'Workbench', 'Window', 'Features', 'Applications', 'Security', 'Extensions'];
|
|
981
|
+
return tabs;
|
|
982
|
+
};
|
|
983
|
+
|
|
978
984
|
const loadContent = async (state, savedState) => {
|
|
985
|
+
const tabs = getTabs();
|
|
979
986
|
return {
|
|
980
|
-
...state
|
|
987
|
+
...state,
|
|
988
|
+
tabs
|
|
981
989
|
};
|
|
982
990
|
};
|
|
983
991
|
|
|
992
|
+
const Tab$1 = 'tab';
|
|
993
|
+
const TabList = 'tablist';
|
|
994
|
+
const AriaRoles = {
|
|
995
|
+
__proto__: null,
|
|
996
|
+
Tab: Tab$1,
|
|
997
|
+
TabList};
|
|
998
|
+
const Viewlet$1 = 'Viewlet';
|
|
999
|
+
const ClassNames = {
|
|
1000
|
+
__proto__: null,
|
|
1001
|
+
Viewlet: Viewlet$1};
|
|
1002
|
+
const mergeClassNames = (...classNames) => {
|
|
1003
|
+
return classNames.filter(Boolean).join(' ');
|
|
1004
|
+
};
|
|
984
1005
|
const Div = 4;
|
|
985
|
-
const
|
|
1006
|
+
const Input = 6;
|
|
986
1007
|
const Text = 12;
|
|
1008
|
+
const H2 = 22;
|
|
1009
|
+
const Aside = 28;
|
|
1010
|
+
const Ul = 60;
|
|
987
1011
|
const VirtualDomElements = {
|
|
988
1012
|
__proto__: null,
|
|
1013
|
+
Aside,
|
|
989
1014
|
Div,
|
|
990
|
-
|
|
1015
|
+
H2,
|
|
1016
|
+
Input,
|
|
1017
|
+
Ul};
|
|
991
1018
|
const text = data => {
|
|
992
1019
|
return {
|
|
993
1020
|
type: Text,
|
|
@@ -996,18 +1023,91 @@ const text = data => {
|
|
|
996
1023
|
};
|
|
997
1024
|
};
|
|
998
1025
|
|
|
999
|
-
const
|
|
1026
|
+
const {
|
|
1027
|
+
Viewlet} = ClassNames;
|
|
1028
|
+
const Settings = 'Settings';
|
|
1029
|
+
|
|
1030
|
+
const getSettingsInputDom = () => {
|
|
1031
|
+
const placeholder = 'Search Settings';
|
|
1000
1032
|
return [{
|
|
1001
1033
|
type: VirtualDomElements.Div,
|
|
1034
|
+
className: 'SettingsInputWrapper',
|
|
1002
1035
|
childCount: 1
|
|
1003
1036
|
}, {
|
|
1004
|
-
type: VirtualDomElements.
|
|
1037
|
+
type: VirtualDomElements.Input,
|
|
1038
|
+
className: 'InputBox SettingsSearchInput',
|
|
1039
|
+
placeholder
|
|
1040
|
+
}];
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
const getSettingsHeaderDom = () => {
|
|
1044
|
+
return [{
|
|
1045
|
+
type: VirtualDomElements.Div,
|
|
1046
|
+
className: 'SettingsHeader',
|
|
1047
|
+
childCount: 1
|
|
1048
|
+
}, ...getSettingsInputDom()];
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
const getSettingsContentDom = () => {
|
|
1052
|
+
return [{
|
|
1053
|
+
type: VirtualDomElements.Div,
|
|
1054
|
+
className: 'SettingsContent',
|
|
1005
1055
|
childCount: 1
|
|
1006
|
-
}, text('Settings
|
|
1056
|
+
}, text('Settings Content')];
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
const getTabVirtualDom = tab => {
|
|
1060
|
+
return [{
|
|
1061
|
+
type: VirtualDomElements.Div,
|
|
1062
|
+
className: 'Tab',
|
|
1063
|
+
childCount: 1,
|
|
1064
|
+
role: AriaRoles.Tab
|
|
1065
|
+
}, text(tab)];
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
const getSettingsTabsDom = tabs => {
|
|
1069
|
+
return [{
|
|
1070
|
+
type: VirtualDomElements.Ul,
|
|
1071
|
+
className: 'SettingsTabs',
|
|
1072
|
+
role: AriaRoles.TabList,
|
|
1073
|
+
childCount: tabs.length
|
|
1074
|
+
}, ...tabs.flatMap(getTabVirtualDom)];
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
const getSettingsSideBarDom = tabs => {
|
|
1078
|
+
const sideBarHeading = 'Settings SideBar';
|
|
1079
|
+
return [{
|
|
1080
|
+
type: VirtualDomElements.Aside,
|
|
1081
|
+
className: 'SettingsSideBar',
|
|
1082
|
+
childCount: 2
|
|
1083
|
+
}, {
|
|
1084
|
+
type: VirtualDomElements.H2,
|
|
1085
|
+
className: 'SettingsSideBarHeading',
|
|
1086
|
+
childCount: 1
|
|
1087
|
+
}, text(sideBarHeading), ...getSettingsTabsDom(tabs)];
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
const getSettingsMainDom = tabs => {
|
|
1091
|
+
return [{
|
|
1092
|
+
type: VirtualDomElements.Div,
|
|
1093
|
+
className: 'SettingsMain',
|
|
1094
|
+
childCount: 2
|
|
1095
|
+
}, ...getSettingsSideBarDom(tabs), ...getSettingsContentDom()];
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
const getSettingsDom = state => {
|
|
1099
|
+
const {
|
|
1100
|
+
tabs
|
|
1101
|
+
} = state;
|
|
1102
|
+
return [{
|
|
1103
|
+
type: VirtualDomElements.Div,
|
|
1104
|
+
childCount: 2,
|
|
1105
|
+
className: mergeClassNames(Viewlet, Settings)
|
|
1106
|
+
}, ...getSettingsHeaderDom(), ...getSettingsMainDom(tabs)];
|
|
1007
1107
|
};
|
|
1008
1108
|
|
|
1009
1109
|
const renderItems = (oldState, newState) => {
|
|
1010
|
-
const dom = getSettingsDom();
|
|
1110
|
+
const dom = getSettingsDom(newState);
|
|
1011
1111
|
return ['Viewlet.setDom2', newState.id, dom];
|
|
1012
1112
|
};
|
|
1013
1113
|
|
|
@@ -1043,15 +1143,169 @@ const renderActions = () => {
|
|
|
1043
1143
|
return [];
|
|
1044
1144
|
};
|
|
1045
1145
|
|
|
1146
|
+
const HandleClickCallStackItem = 'handleClickCallStackItem';
|
|
1147
|
+
const HandleClickWatchExpression = 'handleClickWatchExpression';
|
|
1148
|
+
const HandleClickWatchExpressionDelete = 'handleClickWatchExpressionDelete';
|
|
1149
|
+
const HandleClickCheckBox = 'handleClickCheckBox';
|
|
1150
|
+
const HandleClickContinue = 'handleClickContinue';
|
|
1151
|
+
const HandleClickDebugButton = 'handleClickDebugButton';
|
|
1152
|
+
const HandleClickPause = 'handleClickPause';
|
|
1153
|
+
const HandleClickScopeValue = 'handleClickScopeValue';
|
|
1154
|
+
const HandleClickSectionBreakPoints = 'handleClickSectionBreakPoints';
|
|
1155
|
+
const HandleClickSectionCallstack = 'handleClickSectionCallstack';
|
|
1156
|
+
const HandleClickSectionHeading = 'handleClickSectionHeading';
|
|
1157
|
+
const HandleClickSectionScope = 'handleClickSectionScope';
|
|
1158
|
+
const HandleClickSectionWatch = 'handleClickSectionWatch';
|
|
1159
|
+
const HandleClickStepInto = 'handleClickStepInto';
|
|
1160
|
+
const HandleClickStepOut = 'handleClickStepOut';
|
|
1161
|
+
const HandleClickStepOver = 'handleClickStepOver';
|
|
1162
|
+
const HandleDebugInput = 'handleDebugInput';
|
|
1163
|
+
const HandleClickSectionAction = 'handleClickSectionAction';
|
|
1164
|
+
const HandleInputFieldChange = 'handleInputFieldChange';
|
|
1165
|
+
const HandleInputBlur = 'handleInputBlur';
|
|
1166
|
+
const HandleSectionHeaderContextMenu = 'handleSectionHeaderContextMenu';
|
|
1167
|
+
const HandleWatchExpressionContextMenu = 'handleWatchExpressionContextMenu';
|
|
1168
|
+
|
|
1169
|
+
// TODo use numeric ids
|
|
1170
|
+
|
|
1171
|
+
const renderEventListeners = () => {
|
|
1172
|
+
return [{
|
|
1173
|
+
name: HandleClickContinue,
|
|
1174
|
+
params: ['handleClickContinue']
|
|
1175
|
+
}, {
|
|
1176
|
+
name: HandleClickDebugButton,
|
|
1177
|
+
params: ['handleClickDebugButton', 'event.target.name']
|
|
1178
|
+
}, {
|
|
1179
|
+
name: HandleClickPause,
|
|
1180
|
+
params: ['handleClickPause']
|
|
1181
|
+
}, {
|
|
1182
|
+
name: HandleClickStepOver,
|
|
1183
|
+
params: ['handleClickStepOver']
|
|
1184
|
+
}, {
|
|
1185
|
+
name: HandleClickStepInto,
|
|
1186
|
+
params: ['handleClickStepInto']
|
|
1187
|
+
}, {
|
|
1188
|
+
name: HandleClickStepOut,
|
|
1189
|
+
params: ['handleClickStepOut']
|
|
1190
|
+
}, {
|
|
1191
|
+
name: HandleClickSectionWatch,
|
|
1192
|
+
params: ['HandleClickSectionWatch']
|
|
1193
|
+
}, {
|
|
1194
|
+
name: HandleClickSectionBreakPoints,
|
|
1195
|
+
params: ['handleClickSectionBreakpoints']
|
|
1196
|
+
}, {
|
|
1197
|
+
name: HandleClickSectionScope,
|
|
1198
|
+
params: ['handleClickSectionScope']
|
|
1199
|
+
}, {
|
|
1200
|
+
name: HandleClickSectionCallstack,
|
|
1201
|
+
params: ['handleClickSectionCallstack']
|
|
1202
|
+
}, {
|
|
1203
|
+
name: HandleClickSectionBreakPoints,
|
|
1204
|
+
params: ['handleClickSectionBreakPoints']
|
|
1205
|
+
}, {
|
|
1206
|
+
name: HandleDebugInput,
|
|
1207
|
+
params: ['handleDebugInput', 'event.target.value']
|
|
1208
|
+
}, {
|
|
1209
|
+
name: HandleClickSectionHeading,
|
|
1210
|
+
params: ['handleClickSectionHeading', 'event.target.dataset.name', 'event.button'],
|
|
1211
|
+
preventDefault: true
|
|
1212
|
+
}, {
|
|
1213
|
+
name: HandleClickCheckBox,
|
|
1214
|
+
params: ['handleClickCheckBox', 'event.target.name']
|
|
1215
|
+
}, {
|
|
1216
|
+
name: HandleClickDebugButton,
|
|
1217
|
+
params: ['handleClickDebugButton', 'event.target.name']
|
|
1218
|
+
}, {
|
|
1219
|
+
name: HandleClickCallStackItem,
|
|
1220
|
+
params: ['handleClickCallStackItem', 'event.target.dataset.index']
|
|
1221
|
+
}, {
|
|
1222
|
+
name: HandleClickWatchExpression,
|
|
1223
|
+
params: ['handleClickWatchExpression', 'event.target.dataset.index', 'event.defaultPrevented']
|
|
1224
|
+
}, {
|
|
1225
|
+
name: HandleClickWatchExpressionDelete,
|
|
1226
|
+
params: ['handleClickWatchExpressionDelete', 'event.target.dataset.index'],
|
|
1227
|
+
preventDefault: true
|
|
1228
|
+
}, {
|
|
1229
|
+
name: HandleClickScopeValue,
|
|
1230
|
+
params: ['handleClickScopeValue', 'event.target.dataset.index', 'event.button']
|
|
1231
|
+
}, {
|
|
1232
|
+
name: HandleInputFieldChange,
|
|
1233
|
+
params: ['handleInputFieldChange', 'event.target.name', 'event.target.value']
|
|
1234
|
+
}, {
|
|
1235
|
+
name: HandleClickSectionAction,
|
|
1236
|
+
params: ['handleClickSectionAction', 'event.target.name']
|
|
1237
|
+
}, {
|
|
1238
|
+
name: HandleInputBlur,
|
|
1239
|
+
params: ['handleInputBlur']
|
|
1240
|
+
}, {
|
|
1241
|
+
name: HandleSectionHeaderContextMenu,
|
|
1242
|
+
params: ['handleSectionHeaderContextMenu', 'event.clientX', 'event.clientY', 'event.target.dataset.name'],
|
|
1243
|
+
preventDefault: true
|
|
1244
|
+
}, {
|
|
1245
|
+
name: HandleWatchExpressionContextMenu,
|
|
1246
|
+
params: ['handleWatchExpressionContextMenu', 'event.clientX', 'event.clientY', 'event.target.dataset.index'],
|
|
1247
|
+
preventDefault: true
|
|
1248
|
+
}];
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
const getSavedMinLineY = savedState => {
|
|
1252
|
+
if (savedState && typeof savedState === 'object' && 'minLineY' in savedState && typeof savedState.minLineY === 'number') {
|
|
1253
|
+
return savedState.minLineY;
|
|
1254
|
+
}
|
|
1255
|
+
return 0;
|
|
1256
|
+
};
|
|
1257
|
+
const getSavedDeltaY = savedState => {
|
|
1258
|
+
if (savedState && typeof savedState === 'object' && 'deltaY' in savedState && typeof savedState.deltaY === 'number') {
|
|
1259
|
+
return savedState.deltaY;
|
|
1260
|
+
}
|
|
1261
|
+
return 0;
|
|
1262
|
+
};
|
|
1263
|
+
const getSavedWorkspacePath = savedState => {
|
|
1264
|
+
if (savedState && typeof savedState === 'object' && 'workspacePath' in savedState && typeof savedState.workspacePath === 'string') {
|
|
1265
|
+
return savedState.workspacePath;
|
|
1266
|
+
}
|
|
1267
|
+
return '';
|
|
1268
|
+
};
|
|
1269
|
+
const restoreState = savedState => {
|
|
1270
|
+
if (!savedState) {
|
|
1271
|
+
return {
|
|
1272
|
+
root: '',
|
|
1273
|
+
minLineY: 0,
|
|
1274
|
+
deltaY: 0
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
const root = getSavedWorkspacePath(savedState);
|
|
1278
|
+
const minLineY = getSavedMinLineY(savedState);
|
|
1279
|
+
const deltaY = getSavedDeltaY(savedState);
|
|
1280
|
+
return {
|
|
1281
|
+
root,
|
|
1282
|
+
minLineY,
|
|
1283
|
+
deltaY
|
|
1284
|
+
};
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
const saveState = uid => {
|
|
1288
|
+
return {
|
|
1289
|
+
expandedPaths: [],
|
|
1290
|
+
root: '',
|
|
1291
|
+
minLineY: 0,
|
|
1292
|
+
maxLineY: 0,
|
|
1293
|
+
deltaY: 0
|
|
1294
|
+
};
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1046
1297
|
const commandMap = {
|
|
1047
1298
|
'Initialize.initialize': initialize,
|
|
1048
1299
|
'Settings.create': create$1,
|
|
1049
|
-
'Settings.getCommandIds': getCommandIds,
|
|
1050
|
-
'Settings.terminate': terminate,
|
|
1051
1300
|
'Settings.diff2': diff2,
|
|
1301
|
+
'Settings.getCommandIds': getCommandIds,
|
|
1052
1302
|
'Settings.loadContent': wrapCommand(loadContent),
|
|
1303
|
+
'Settings.render2': render2,
|
|
1053
1304
|
'Settings.renderActions': renderActions,
|
|
1054
|
-
'Settings.
|
|
1305
|
+
'Settings.renderEventListeners': renderEventListeners,
|
|
1306
|
+
'Settings.restoreState': restoreState,
|
|
1307
|
+
'Settings.saveState': saveState,
|
|
1308
|
+
'Settings.terminate': terminate
|
|
1055
1309
|
};
|
|
1056
1310
|
|
|
1057
1311
|
const rpcs = Object.create(null);
|