@lvce-editor/editor-worker 3.20.0 → 3.22.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/editorWorkerMain.js +278 -207
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -128,141 +128,6 @@ const handleSliderPointerMove = (state, x, y) => {
|
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
const ColoredMaskIcon = 'ColoredMaskIcon';
|
|
132
|
-
const ColorPicker$2 = 'ColorPicker';
|
|
133
|
-
const ColorPickerBackgroundColor = 'ColorPickerBackgroundColor';
|
|
134
|
-
const ColorPickerDark = 'ColorPickerDark';
|
|
135
|
-
const ColorPickerLight = 'ColorPickerLight';
|
|
136
|
-
const ColorPickerRectangle = 'ColorPickerRectangle';
|
|
137
|
-
const ColorPickerSlider = 'ColorPickerSlider';
|
|
138
|
-
const ColorPickerSliderThumb = 'ColorPickerSliderThumb';
|
|
139
|
-
const CompletionDetailCloseButton = 'CompletionDetailCloseButton';
|
|
140
|
-
const IconButtonDisabled = 'IconButtonDisabled';
|
|
141
|
-
const IconButton = 'IconButton';
|
|
142
|
-
const CompletionDetailContent = 'CompletionDetailContent';
|
|
143
|
-
const Diagnostic = 'Diagnostic';
|
|
144
|
-
const FindWidgetReplace = 'FindWidgetReplace';
|
|
145
|
-
const FindWidgetFind = 'FindWidgetFind';
|
|
146
|
-
const FindWidgetMatchCount = 'FindWidgetMatchCount';
|
|
147
|
-
const FindWidgetRight = 'FindWidgetRight';
|
|
148
|
-
const EditorCompletionItem = 'EditorCompletionItem';
|
|
149
|
-
const EditorCompletionItemDeprecated = 'EditorCompletionItemDeprecated';
|
|
150
|
-
const EditorCompletionItemFocused = 'EditorCompletionItemFocused';
|
|
151
|
-
const EditorCompletionItemHighlight = 'EditorCompletionItemHighlight';
|
|
152
|
-
const EditorCursor = 'EditorCursor';
|
|
153
|
-
const EditorRow = 'EditorRow';
|
|
154
|
-
const EditorSelection = 'EditorSelection';
|
|
155
|
-
const FileIcon = 'FileIcon';
|
|
156
|
-
const HoverDisplayString = 'HoverDisplayString';
|
|
157
|
-
const HoverDocumentation = 'HoverDocumentation';
|
|
158
|
-
const SearchFieldButtons = 'SearchFieldButtons';
|
|
159
|
-
const HoverEditorRow = 'HoverEditorRow';
|
|
160
|
-
const MultilineInputBox = 'MultilineInputBox';
|
|
161
|
-
const SearchField = 'SearchField';
|
|
162
|
-
const HoverProblem = 'HoverProblem';
|
|
163
|
-
const HoverProblemDetail = 'HoverProblemDetail';
|
|
164
|
-
const HoverProblemMessage = 'HoverProblemMessage';
|
|
165
|
-
const IconClose = 'IconClose';
|
|
166
|
-
const Label = 'Label';
|
|
167
|
-
const MaskIcon = 'MaskIcon';
|
|
168
|
-
const Viewlet = 'Viewlet';
|
|
169
|
-
|
|
170
|
-
const HandlePointerDown = 'handlePointerDown';
|
|
171
|
-
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
172
|
-
const HandleClose = 'handleClose';
|
|
173
|
-
|
|
174
|
-
const mergeClassNames = (...classNames) => {
|
|
175
|
-
return classNames.filter(Boolean).join(' ');
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const Button = 1;
|
|
179
|
-
const Div = 4;
|
|
180
|
-
const Span = 8;
|
|
181
|
-
const Text = 12;
|
|
182
|
-
const Img = 17;
|
|
183
|
-
const TextArea = 62;
|
|
184
|
-
|
|
185
|
-
const getColorPickerVirtualDom = () => {
|
|
186
|
-
return [{
|
|
187
|
-
type: Div,
|
|
188
|
-
className: mergeClassNames(Viewlet, ColorPicker$2),
|
|
189
|
-
onPointerDown: HandlePointerDown,
|
|
190
|
-
childCount: 3
|
|
191
|
-
}, {
|
|
192
|
-
type: Div,
|
|
193
|
-
className: ColorPickerRectangle,
|
|
194
|
-
childCount: 3
|
|
195
|
-
}, {
|
|
196
|
-
type: Div,
|
|
197
|
-
className: ColorPickerBackgroundColor,
|
|
198
|
-
childCount: 0
|
|
199
|
-
}, {
|
|
200
|
-
type: Div,
|
|
201
|
-
className: ColorPickerLight,
|
|
202
|
-
childCount: 0
|
|
203
|
-
}, {
|
|
204
|
-
type: Div,
|
|
205
|
-
className: ColorPickerDark,
|
|
206
|
-
childCount: 0
|
|
207
|
-
}, {
|
|
208
|
-
type: Div,
|
|
209
|
-
className: ColorPickerSlider,
|
|
210
|
-
childCount: 0
|
|
211
|
-
}, {
|
|
212
|
-
type: Div,
|
|
213
|
-
className: ColorPickerSliderThumb,
|
|
214
|
-
childCount: 0
|
|
215
|
-
}];
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const SetBounds = 'setBounds';
|
|
219
|
-
const SetColor = 'setColor';
|
|
220
|
-
const SetContentHeight = 'setContentHeight';
|
|
221
|
-
const SetNegativeMargin = 'setNegativeMargin';
|
|
222
|
-
const SetOffsetX = 'setOffsetX';
|
|
223
|
-
const SetScrollBar = 'setScrollBar';
|
|
224
|
-
const SetValue = 'setValue';
|
|
225
|
-
|
|
226
|
-
const renderParts = (render, oldState, newState) => {
|
|
227
|
-
const commands = [];
|
|
228
|
-
for (const item of render) {
|
|
229
|
-
if (!item.isEqual(oldState, newState)) {
|
|
230
|
-
commands.push(item.apply(oldState, newState));
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return commands;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
const renderColor$1 = {
|
|
237
|
-
isEqual(oldState, newState) {
|
|
238
|
-
return oldState.color === newState.color;
|
|
239
|
-
},
|
|
240
|
-
apply(oldState, newState) {
|
|
241
|
-
return [/* method */SetColor, /* color */newState.color];
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
const renderOffsetX$1 = {
|
|
245
|
-
isEqual(oldState, newState) {
|
|
246
|
-
return oldState.offsetX === newState.offsetX;
|
|
247
|
-
},
|
|
248
|
-
apply(oldState, newState) {
|
|
249
|
-
return [/* method */SetOffsetX, /* offsetX */newState.offsetX];
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
const renderColorPickerDom = {
|
|
253
|
-
isEqual(oldState, newState) {
|
|
254
|
-
return oldState.min === newState.min && oldState.max === newState.max;
|
|
255
|
-
},
|
|
256
|
-
apply(oldState, newState) {
|
|
257
|
-
const dom = getColorPickerVirtualDom();
|
|
258
|
-
return ['Viewlet.setDom2', dom];
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
const render$b = [renderColorPickerDom, renderColor$1, renderOffsetX$1];
|
|
262
|
-
const renderColorPicker = async (oldState, newState) => {
|
|
263
|
-
return renderParts(render$b, oldState, newState);
|
|
264
|
-
};
|
|
265
|
-
|
|
266
131
|
// TODO use numeric enum
|
|
267
132
|
const CompositionUpdate = 'compositionUpdate';
|
|
268
133
|
const ContentEditableInput = 'contentEditableInput';
|
|
@@ -1213,7 +1078,7 @@ const set$6 = (id, fn) => {
|
|
|
1213
1078
|
const get$6 = id => {
|
|
1214
1079
|
return state$1$1.callbacks[id];
|
|
1215
1080
|
};
|
|
1216
|
-
const remove$
|
|
1081
|
+
const remove$6 = id => {
|
|
1217
1082
|
delete state$1$1.callbacks[id];
|
|
1218
1083
|
};
|
|
1219
1084
|
const state$9 = {
|
|
@@ -1259,7 +1124,7 @@ const resolve = (id, args) => {
|
|
|
1259
1124
|
return;
|
|
1260
1125
|
}
|
|
1261
1126
|
fn(args);
|
|
1262
|
-
remove$
|
|
1127
|
+
remove$6(id);
|
|
1263
1128
|
};
|
|
1264
1129
|
const create$2$1 = (method, params) => {
|
|
1265
1130
|
const {
|
|
@@ -2392,7 +2257,7 @@ const cancelSelection = editor => {
|
|
|
2392
2257
|
// TODO use numeric widget id
|
|
2393
2258
|
const Completion = 'completion';
|
|
2394
2259
|
const CompletionDetail$1 = 'completionDetail';
|
|
2395
|
-
const ColorPicker$
|
|
2260
|
+
const ColorPicker$2 = 'colorPicker';
|
|
2396
2261
|
const Find = 'find';
|
|
2397
2262
|
const Hover = 'hover';
|
|
2398
2263
|
const SourceAction = 'sourceAction';
|
|
@@ -2473,7 +2338,7 @@ const create$6 = () => {
|
|
|
2473
2338
|
const create$5 = () => {
|
|
2474
2339
|
const completionUid = create$6();
|
|
2475
2340
|
const widget = {
|
|
2476
|
-
id: ColorPicker$
|
|
2341
|
+
id: ColorPicker$2,
|
|
2477
2342
|
oldState: {
|
|
2478
2343
|
color: '',
|
|
2479
2344
|
offsetX: 0,
|
|
@@ -2500,7 +2365,7 @@ const create$5 = () => {
|
|
|
2500
2365
|
return widget;
|
|
2501
2366
|
};
|
|
2502
2367
|
|
|
2503
|
-
const ColorPicker = 41;
|
|
2368
|
+
const ColorPicker$1 = 41;
|
|
2504
2369
|
const FindWidget = 16;
|
|
2505
2370
|
const EditorCompletion = 9;
|
|
2506
2371
|
const CompletionDetail = 999;
|
|
@@ -2519,7 +2384,7 @@ const newStateGenerator$1 = state => {
|
|
|
2519
2384
|
return loadContent$3(state);
|
|
2520
2385
|
};
|
|
2521
2386
|
const openColorPicker = async editor => {
|
|
2522
|
-
return addWidgetToEditor(ColorPicker$
|
|
2387
|
+
return addWidgetToEditor(ColorPicker$2, ColorPicker$1, editor, create$5, newStateGenerator$1);
|
|
2523
2388
|
};
|
|
2524
2389
|
|
|
2525
2390
|
const state$6 = {
|
|
@@ -3433,11 +3298,8 @@ const noTypeDefinitionFound = () => {
|
|
|
3433
3298
|
const noResults$1 = () => {
|
|
3434
3299
|
return i18nString(UiStrings$1.NoResults);
|
|
3435
3300
|
};
|
|
3436
|
-
const
|
|
3437
|
-
return i18nString(UiStrings$1.
|
|
3438
|
-
};
|
|
3439
|
-
const sortImports = () => {
|
|
3440
|
-
return i18nString(UiStrings$1.SortImports);
|
|
3301
|
+
const sourceAction = () => {
|
|
3302
|
+
return i18nString(UiStrings$1.SourceAction);
|
|
3441
3303
|
};
|
|
3442
3304
|
|
|
3443
3305
|
// @ts-ignore
|
|
@@ -6671,14 +6533,9 @@ const showSourceActions$1 = async editor => {
|
|
|
6671
6533
|
return editor;
|
|
6672
6534
|
};
|
|
6673
6535
|
|
|
6536
|
+
// TODO maybe ask extension host worker instead
|
|
6674
6537
|
const getEditorSourceActions = async () => {
|
|
6675
|
-
const sourceActions =
|
|
6676
|
-
name: organizeImports$1(),
|
|
6677
|
-
command: 'Editor.organizeImports'
|
|
6678
|
-
}, {
|
|
6679
|
-
name: sortImports(),
|
|
6680
|
-
command: 'Editor.sortImports'
|
|
6681
|
-
}];
|
|
6538
|
+
const sourceActions = await invoke$3('GetEditorSourceActions.getEditorSourceActions');
|
|
6682
6539
|
return sourceActions;
|
|
6683
6540
|
};
|
|
6684
6541
|
|
|
@@ -7765,6 +7622,55 @@ const handleSashPointerUp = (state, eventX, eventY) => {
|
|
|
7765
7622
|
return state;
|
|
7766
7623
|
};
|
|
7767
7624
|
|
|
7625
|
+
const ColoredMaskIcon = 'ColoredMaskIcon';
|
|
7626
|
+
const ColorPicker = 'ColorPicker';
|
|
7627
|
+
const ColorPickerBackgroundColor = 'ColorPickerBackgroundColor';
|
|
7628
|
+
const ColorPickerDark = 'ColorPickerDark';
|
|
7629
|
+
const ColorPickerLight = 'ColorPickerLight';
|
|
7630
|
+
const ColorPickerRectangle = 'ColorPickerRectangle';
|
|
7631
|
+
const ColorPickerSlider = 'ColorPickerSlider';
|
|
7632
|
+
const ColorPickerSliderThumb = 'ColorPickerSliderThumb';
|
|
7633
|
+
const SourceActionItem = 'SourceActionItem';
|
|
7634
|
+
const SourceActionItemFocused = 'SourceActionItemFocused';
|
|
7635
|
+
const CompletionDetailCloseButton = 'CompletionDetailCloseButton';
|
|
7636
|
+
const IconButtonDisabled = 'IconButtonDisabled';
|
|
7637
|
+
const IconButton = 'IconButton';
|
|
7638
|
+
const SourceActionHeading = 'SourceActionHeading';
|
|
7639
|
+
const CompletionDetailContent = 'CompletionDetailContent';
|
|
7640
|
+
const Diagnostic = 'Diagnostic';
|
|
7641
|
+
const FindWidgetReplace = 'FindWidgetReplace';
|
|
7642
|
+
const FindWidgetFind = 'FindWidgetFind';
|
|
7643
|
+
const FindWidgetMatchCount = 'FindWidgetMatchCount';
|
|
7644
|
+
const FindWidgetRight = 'FindWidgetRight';
|
|
7645
|
+
const EditorCompletionItem = 'EditorCompletionItem';
|
|
7646
|
+
const EditorCompletionItemDeprecated = 'EditorCompletionItemDeprecated';
|
|
7647
|
+
const EditorCompletionItemFocused = 'EditorCompletionItemFocused';
|
|
7648
|
+
const EditorCompletionItemHighlight = 'EditorCompletionItemHighlight';
|
|
7649
|
+
const EditorCursor = 'EditorCursor';
|
|
7650
|
+
const EditorRow = 'EditorRow';
|
|
7651
|
+
const EditorSelection = 'EditorSelection';
|
|
7652
|
+
const FileIcon = 'FileIcon';
|
|
7653
|
+
const HoverDisplayString = 'HoverDisplayString';
|
|
7654
|
+
const HoverDocumentation = 'HoverDocumentation';
|
|
7655
|
+
const SearchFieldButtons = 'SearchFieldButtons';
|
|
7656
|
+
const HoverEditorRow = 'HoverEditorRow';
|
|
7657
|
+
const MultilineInputBox = 'MultilineInputBox';
|
|
7658
|
+
const SearchField = 'SearchField';
|
|
7659
|
+
const HoverProblem = 'HoverProblem';
|
|
7660
|
+
const HoverProblemDetail = 'HoverProblemDetail';
|
|
7661
|
+
const HoverProblemMessage = 'HoverProblemMessage';
|
|
7662
|
+
const IconClose = 'IconClose';
|
|
7663
|
+
const Label = 'Label';
|
|
7664
|
+
const MaskIcon = 'MaskIcon';
|
|
7665
|
+
const Viewlet = 'Viewlet';
|
|
7666
|
+
|
|
7667
|
+
const Button = 1;
|
|
7668
|
+
const Div = 4;
|
|
7669
|
+
const Span = 8;
|
|
7670
|
+
const Text = 12;
|
|
7671
|
+
const Img = 17;
|
|
7672
|
+
const TextArea = 62;
|
|
7673
|
+
|
|
7768
7674
|
const text = data => {
|
|
7769
7675
|
return {
|
|
7770
7676
|
type: Text,
|
|
@@ -7797,6 +7703,12 @@ const getLineInfosVirtualDom = lineInfos => {
|
|
|
7797
7703
|
return dom;
|
|
7798
7704
|
};
|
|
7799
7705
|
|
|
7706
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
7707
|
+
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
7708
|
+
const HandleClose = 'handleClose';
|
|
7709
|
+
const HandleFocusIn = 'handleFocusIn';
|
|
7710
|
+
const HandleClick = 'handleClick';
|
|
7711
|
+
|
|
7800
7712
|
const hoverProblemMessage = {
|
|
7801
7713
|
type: Span,
|
|
7802
7714
|
className: HoverProblemMessage,
|
|
@@ -7851,6 +7763,14 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
7851
7763
|
return dom;
|
|
7852
7764
|
};
|
|
7853
7765
|
|
|
7766
|
+
const SetBounds = 'setBounds';
|
|
7767
|
+
const SetColor = 'setColor';
|
|
7768
|
+
const SetContentHeight = 'setContentHeight';
|
|
7769
|
+
const SetNegativeMargin = 'setNegativeMargin';
|
|
7770
|
+
const SetOffsetX = 'setOffsetX';
|
|
7771
|
+
const SetScrollBar = 'setScrollBar';
|
|
7772
|
+
const SetValue = 'setValue';
|
|
7773
|
+
|
|
7854
7774
|
const renderHoverDom = {
|
|
7855
7775
|
isEqual(oldState, newState) {
|
|
7856
7776
|
return oldState.lineInfos === newState.lineInfos && oldState.documentation === newState.documentation && oldState.diagnostics === newState.diagnostics;
|
|
@@ -7860,7 +7780,7 @@ const renderHoverDom = {
|
|
|
7860
7780
|
return [/* method */'Viewlet.setDom2', dom];
|
|
7861
7781
|
}
|
|
7862
7782
|
};
|
|
7863
|
-
const renderBounds$
|
|
7783
|
+
const renderBounds$5 = {
|
|
7864
7784
|
isEqual(oldState, newState) {
|
|
7865
7785
|
return oldState.x === newState.x && oldState.y === newState.y;
|
|
7866
7786
|
},
|
|
@@ -7874,10 +7794,10 @@ const renderBounds$4 = {
|
|
|
7874
7794
|
return [SetBounds, x, y, renderWidth, height];
|
|
7875
7795
|
}
|
|
7876
7796
|
};
|
|
7877
|
-
const render$
|
|
7797
|
+
const render$c = [renderHoverDom, renderBounds$5];
|
|
7878
7798
|
const renderHover = (oldState, newState) => {
|
|
7879
7799
|
const commands = [];
|
|
7880
|
-
for (const item of render$
|
|
7800
|
+
for (const item of render$c) {
|
|
7881
7801
|
if (!item.isEqual(oldState, newState)) {
|
|
7882
7802
|
commands.push(item.apply(oldState, newState));
|
|
7883
7803
|
}
|
|
@@ -8835,7 +8755,7 @@ const renderWidgets = {
|
|
|
8835
8755
|
},
|
|
8836
8756
|
multiple: true
|
|
8837
8757
|
};
|
|
8838
|
-
const render$
|
|
8758
|
+
const render$b = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
|
|
8839
8759
|
const renderEditor = async id => {
|
|
8840
8760
|
const instance = get$7(id);
|
|
8841
8761
|
if (!instance) {
|
|
@@ -8847,7 +8767,7 @@ const renderEditor = async id => {
|
|
|
8847
8767
|
} = instance;
|
|
8848
8768
|
const commands = [];
|
|
8849
8769
|
set$7(id, newState, newState);
|
|
8850
|
-
for (const item of render$
|
|
8770
|
+
for (const item of render$b) {
|
|
8851
8771
|
if (!item.isEqual(oldState, newState)) {
|
|
8852
8772
|
const result = await item.apply(oldState, newState);
|
|
8853
8773
|
// @ts-ignore
|
|
@@ -8893,8 +8813,8 @@ const wrapWidgetCommand = (widgetId, fn) => {
|
|
|
8893
8813
|
};
|
|
8894
8814
|
|
|
8895
8815
|
const widgetCommands = {
|
|
8896
|
-
'ColorPicker.handleSliderPointerDown': ColorPicker$
|
|
8897
|
-
'ColorPicker.handleSliderPointerMove': ColorPicker$
|
|
8816
|
+
'ColorPicker.handleSliderPointerDown': ColorPicker$2,
|
|
8817
|
+
'ColorPicker.handleSliderPointerMove': ColorPicker$2,
|
|
8898
8818
|
// 'FindWidget.focusNext': WidgetId.Find,
|
|
8899
8819
|
// 'FindWidget.focusPrevious': WidgetId.Find,
|
|
8900
8820
|
'FindWidget.close': Find,
|
|
@@ -8945,7 +8865,6 @@ const commandMap = {
|
|
|
8945
8865
|
'ColorPicker.handleSliderPointerDown': handleSliderPointerDown,
|
|
8946
8866
|
'ColorPicker.handleSliderPointerMove': handleSliderPointerMove,
|
|
8947
8867
|
'ColorPicker.loadContent': loadContent$3,
|
|
8948
|
-
'ColorPicker.render': renderColorPicker,
|
|
8949
8868
|
'Editor.addCursorAbove': addCursorAbove,
|
|
8950
8869
|
'Editor.addCursorBelow': addCursorBelow,
|
|
8951
8870
|
'Editor.applyEdit': applyEdit,
|
|
@@ -9322,7 +9241,7 @@ const renderItems = {
|
|
|
9322
9241
|
return ['setDom', dom];
|
|
9323
9242
|
}
|
|
9324
9243
|
};
|
|
9325
|
-
const renderBounds$
|
|
9244
|
+
const renderBounds$4 = {
|
|
9326
9245
|
isEqual(oldState, newState) {
|
|
9327
9246
|
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.x === newState.x && oldState.y === newState.y;
|
|
9328
9247
|
},
|
|
@@ -9368,10 +9287,10 @@ const renderScrollBar = {
|
|
|
9368
9287
|
return [/* method */SetScrollBar, /* scrollBarY */scrollBarY, /* scrollBarHeight */scrollBarHeight];
|
|
9369
9288
|
}
|
|
9370
9289
|
};
|
|
9371
|
-
const render$
|
|
9290
|
+
const render$a = [renderItems, renderBounds$4, renderHeight, renderNegativeMargin, renderScrollBar];
|
|
9372
9291
|
const renderCompletion = (oldState, newState) => {
|
|
9373
9292
|
const commands = [];
|
|
9374
|
-
for (const item of render$
|
|
9293
|
+
for (const item of render$a) {
|
|
9375
9294
|
if (!item.isEqual(oldState, newState)) {
|
|
9376
9295
|
commands.push(item.apply(oldState, newState));
|
|
9377
9296
|
}
|
|
@@ -9384,7 +9303,7 @@ const removeWidget = widget => {
|
|
|
9384
9303
|
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
9385
9304
|
};
|
|
9386
9305
|
|
|
9387
|
-
const render$
|
|
9306
|
+
const render$9 = widget => {
|
|
9388
9307
|
const commands = renderCompletion(widget.oldState, widget.newState);
|
|
9389
9308
|
const wrappedCommands = [];
|
|
9390
9309
|
const uid = widget.newState.uid;
|
|
@@ -9393,8 +9312,8 @@ const render$7 = widget => {
|
|
|
9393
9312
|
}
|
|
9394
9313
|
return wrappedCommands;
|
|
9395
9314
|
};
|
|
9396
|
-
const add$
|
|
9397
|
-
const commands = render$
|
|
9315
|
+
const add$5 = widget => {
|
|
9316
|
+
const commands = render$9(widget);
|
|
9398
9317
|
const id = 'EditorCompletion';
|
|
9399
9318
|
// TODO how to generate a unique integer id
|
|
9400
9319
|
// that doesn't collide with ids created in renderer worker?
|
|
@@ -9404,7 +9323,7 @@ const add$4 = widget => {
|
|
|
9404
9323
|
allCommands.push(...commands);
|
|
9405
9324
|
return allCommands;
|
|
9406
9325
|
};
|
|
9407
|
-
const remove$
|
|
9326
|
+
const remove$5 = removeWidget;
|
|
9408
9327
|
const handleEditorType = (editor, state) => {
|
|
9409
9328
|
const {
|
|
9410
9329
|
unfilteredItems,
|
|
@@ -9469,11 +9388,11 @@ const handleEditorDeleteLeft = (editor, state) => {
|
|
|
9469
9388
|
|
|
9470
9389
|
const EditorCompletionWidget = {
|
|
9471
9390
|
__proto__: null,
|
|
9472
|
-
add: add$
|
|
9391
|
+
add: add$5,
|
|
9473
9392
|
handleEditorDeleteLeft,
|
|
9474
9393
|
handleEditorType,
|
|
9475
|
-
remove: remove$
|
|
9476
|
-
render: render$
|
|
9394
|
+
remove: remove$5,
|
|
9395
|
+
render: render$9
|
|
9477
9396
|
};
|
|
9478
9397
|
|
|
9479
9398
|
const MessagePort$1 = 1;
|
|
@@ -9985,6 +9904,43 @@ const addWidget = (widget, id, render) => {
|
|
|
9985
9904
|
return allCommands;
|
|
9986
9905
|
};
|
|
9987
9906
|
|
|
9907
|
+
const mergeClassNames = (...classNames) => {
|
|
9908
|
+
return classNames.filter(Boolean).join(' ');
|
|
9909
|
+
};
|
|
9910
|
+
|
|
9911
|
+
const getColorPickerVirtualDom = () => {
|
|
9912
|
+
return [{
|
|
9913
|
+
type: Div,
|
|
9914
|
+
className: mergeClassNames(Viewlet, ColorPicker),
|
|
9915
|
+
onPointerDown: HandlePointerDown,
|
|
9916
|
+
childCount: 3
|
|
9917
|
+
}, {
|
|
9918
|
+
type: Div,
|
|
9919
|
+
className: ColorPickerRectangle,
|
|
9920
|
+
childCount: 3
|
|
9921
|
+
}, {
|
|
9922
|
+
type: Div,
|
|
9923
|
+
className: ColorPickerBackgroundColor,
|
|
9924
|
+
childCount: 0
|
|
9925
|
+
}, {
|
|
9926
|
+
type: Div,
|
|
9927
|
+
className: ColorPickerLight,
|
|
9928
|
+
childCount: 0
|
|
9929
|
+
}, {
|
|
9930
|
+
type: Div,
|
|
9931
|
+
className: ColorPickerDark,
|
|
9932
|
+
childCount: 0
|
|
9933
|
+
}, {
|
|
9934
|
+
type: Div,
|
|
9935
|
+
className: ColorPickerSlider,
|
|
9936
|
+
childCount: 0
|
|
9937
|
+
}, {
|
|
9938
|
+
type: Div,
|
|
9939
|
+
className: ColorPickerSliderThumb,
|
|
9940
|
+
childCount: 0
|
|
9941
|
+
}];
|
|
9942
|
+
};
|
|
9943
|
+
|
|
9988
9944
|
const renderColor = {
|
|
9989
9945
|
isEqual(oldState, newState) {
|
|
9990
9946
|
return oldState.color === newState.color;
|
|
@@ -10010,7 +9966,7 @@ const renderContent$1 = {
|
|
|
10010
9966
|
return ['Viewlet.setDom2', newState.uid, dom];
|
|
10011
9967
|
}
|
|
10012
9968
|
};
|
|
10013
|
-
const renderBounds$
|
|
9969
|
+
const renderBounds$3 = {
|
|
10014
9970
|
isEqual(oldState, newState) {
|
|
10015
9971
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10016
9972
|
},
|
|
@@ -10024,10 +9980,10 @@ const renderBounds$2 = {
|
|
|
10024
9980
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10025
9981
|
}
|
|
10026
9982
|
};
|
|
10027
|
-
const render$
|
|
9983
|
+
const render$8 = [renderContent$1, renderBounds$3, renderColor, renderOffsetX];
|
|
10028
9984
|
const renderFull$1 = (oldState, newState) => {
|
|
10029
9985
|
const commands = [];
|
|
10030
|
-
for (const item of render$
|
|
9986
|
+
for (const item of render$8) {
|
|
10031
9987
|
if (!item.isEqual(oldState, newState)) {
|
|
10032
9988
|
commands.push(item.apply(oldState, newState));
|
|
10033
9989
|
}
|
|
@@ -10035,7 +9991,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
10035
9991
|
return commands;
|
|
10036
9992
|
};
|
|
10037
9993
|
|
|
10038
|
-
const render$
|
|
9994
|
+
const render$7 = widget => {
|
|
10039
9995
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
10040
9996
|
const wrappedCommands = [];
|
|
10041
9997
|
const uid = widget.newState.uid;
|
|
@@ -10048,10 +10004,10 @@ const render$5 = widget => {
|
|
|
10048
10004
|
}
|
|
10049
10005
|
return wrappedCommands;
|
|
10050
10006
|
};
|
|
10051
|
-
const add$
|
|
10052
|
-
return addWidget(widget, 'ColorPicker', render$
|
|
10007
|
+
const add$4 = widget => {
|
|
10008
|
+
return addWidget(widget, 'ColorPicker', render$7);
|
|
10053
10009
|
};
|
|
10054
|
-
const remove$
|
|
10010
|
+
const remove$4 = removeWidget;
|
|
10055
10011
|
const Commands$1 = {
|
|
10056
10012
|
'ColorPicker.handleSliderPointerDown': handleSliderPointerDown,
|
|
10057
10013
|
'ColorPicker.handleSliderPointerMove': handleSliderPointerMove
|
|
@@ -10060,9 +10016,9 @@ const Commands$1 = {
|
|
|
10060
10016
|
const EditorColorPickerWidget = {
|
|
10061
10017
|
__proto__: null,
|
|
10062
10018
|
Commands: Commands$1,
|
|
10063
|
-
add: add$
|
|
10064
|
-
remove: remove$
|
|
10065
|
-
render: render$
|
|
10019
|
+
add: add$4,
|
|
10020
|
+
remove: remove$4,
|
|
10021
|
+
render: render$7
|
|
10066
10022
|
};
|
|
10067
10023
|
|
|
10068
10024
|
const getCompletionDetailVirtualDom = content => {
|
|
@@ -10087,6 +10043,16 @@ const getCompletionDetailVirtualDom = content => {
|
|
|
10087
10043
|
return dom;
|
|
10088
10044
|
};
|
|
10089
10045
|
|
|
10046
|
+
const renderParts = (render, oldState, newState) => {
|
|
10047
|
+
const commands = [];
|
|
10048
|
+
for (const item of render) {
|
|
10049
|
+
if (!item.isEqual(oldState, newState)) {
|
|
10050
|
+
commands.push(item.apply(oldState, newState));
|
|
10051
|
+
}
|
|
10052
|
+
}
|
|
10053
|
+
return commands;
|
|
10054
|
+
};
|
|
10055
|
+
|
|
10090
10056
|
const renderContent = {
|
|
10091
10057
|
isEqual(oldState, newState) {
|
|
10092
10058
|
return oldState.content === newState.content;
|
|
@@ -10096,7 +10062,7 @@ const renderContent = {
|
|
|
10096
10062
|
return ['Viewlet.setDom2', newState.uid, dom];
|
|
10097
10063
|
}
|
|
10098
10064
|
};
|
|
10099
|
-
const renderBounds$
|
|
10065
|
+
const renderBounds$2 = {
|
|
10100
10066
|
isEqual(oldState, newState) {
|
|
10101
10067
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10102
10068
|
},
|
|
@@ -10110,12 +10076,12 @@ const renderBounds$1 = {
|
|
|
10110
10076
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10111
10077
|
}
|
|
10112
10078
|
};
|
|
10113
|
-
const render$
|
|
10079
|
+
const render$6 = [renderContent, renderBounds$2];
|
|
10114
10080
|
const renderFull = (oldState, newState) => {
|
|
10115
|
-
return renderParts(render$
|
|
10081
|
+
return renderParts(render$6, oldState, newState);
|
|
10116
10082
|
};
|
|
10117
10083
|
|
|
10118
|
-
const render$
|
|
10084
|
+
const render$5 = widget => {
|
|
10119
10085
|
const commands = renderFull(widget.oldState, widget.newState);
|
|
10120
10086
|
const wrappedCommands = [];
|
|
10121
10087
|
const uid = widget.newState.uid;
|
|
@@ -10128,16 +10094,16 @@ const render$3 = widget => {
|
|
|
10128
10094
|
}
|
|
10129
10095
|
return wrappedCommands;
|
|
10130
10096
|
};
|
|
10131
|
-
const add$
|
|
10132
|
-
return addWidget(widget, 'EditorCompletionDetails', render$
|
|
10097
|
+
const add$3 = widget => {
|
|
10098
|
+
return addWidget(widget, 'EditorCompletionDetails', render$5);
|
|
10133
10099
|
};
|
|
10134
|
-
const remove$
|
|
10100
|
+
const remove$3 = removeWidget;
|
|
10135
10101
|
|
|
10136
10102
|
const EditorCompletionDetailWidget = {
|
|
10137
10103
|
__proto__: null,
|
|
10138
|
-
add: add$
|
|
10139
|
-
remove: remove$
|
|
10140
|
-
render: render$
|
|
10104
|
+
add: add$3,
|
|
10105
|
+
remove: remove$3,
|
|
10106
|
+
render: render$5
|
|
10141
10107
|
};
|
|
10142
10108
|
|
|
10143
10109
|
/**
|
|
@@ -10440,7 +10406,7 @@ const renderDetails = {
|
|
|
10440
10406
|
return ['Viewlet.setDom2', dom];
|
|
10441
10407
|
}
|
|
10442
10408
|
};
|
|
10443
|
-
const renderBounds = {
|
|
10409
|
+
const renderBounds$1 = {
|
|
10444
10410
|
isEqual(oldState, newState) {
|
|
10445
10411
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10446
10412
|
},
|
|
@@ -10483,16 +10449,16 @@ const renderFocus = {
|
|
|
10483
10449
|
// },
|
|
10484
10450
|
// }
|
|
10485
10451
|
|
|
10486
|
-
const render$
|
|
10452
|
+
const render$4 = [renderDetails, renderBounds$1, renderValue, renderFocus];
|
|
10487
10453
|
const apply = (oldState, newState) => {
|
|
10488
10454
|
// TODO avoid side effect
|
|
10489
10455
|
if (oldState.focus !== newState.focus) {
|
|
10490
10456
|
setFocus(newState.focus);
|
|
10491
10457
|
}
|
|
10492
|
-
return renderParts(render$
|
|
10458
|
+
return renderParts(render$4, oldState, newState);
|
|
10493
10459
|
};
|
|
10494
10460
|
|
|
10495
|
-
const render$
|
|
10461
|
+
const render$3 = widget => {
|
|
10496
10462
|
const commands = apply(widget.oldState, widget.newState);
|
|
10497
10463
|
const wrappedCommands = [];
|
|
10498
10464
|
const uid = widget.newState.uid;
|
|
@@ -10505,10 +10471,10 @@ const render$1 = widget => {
|
|
|
10505
10471
|
}
|
|
10506
10472
|
return wrappedCommands;
|
|
10507
10473
|
};
|
|
10508
|
-
const add$
|
|
10509
|
-
return addWidget(widget, 'FindWidget', render$
|
|
10474
|
+
const add$2 = widget => {
|
|
10475
|
+
return addWidget(widget, 'FindWidget', render$3);
|
|
10510
10476
|
};
|
|
10511
|
-
const remove$
|
|
10477
|
+
const remove$2 = removeWidget;
|
|
10512
10478
|
const Commands = {
|
|
10513
10479
|
'FindWidget.close': close$1,
|
|
10514
10480
|
'FindWidget.focusNext': focusNext$1,
|
|
@@ -10523,22 +10489,127 @@ const Commands = {
|
|
|
10523
10489
|
const EditorFindWidget = {
|
|
10524
10490
|
__proto__: null,
|
|
10525
10491
|
Commands,
|
|
10492
|
+
add: add$2,
|
|
10493
|
+
remove: remove$2,
|
|
10494
|
+
render: render$3
|
|
10495
|
+
};
|
|
10496
|
+
|
|
10497
|
+
const render$2 = widget => {
|
|
10498
|
+
const commands = renderHover(widget.oldState, widget.newState);
|
|
10499
|
+
const wrappedCommands = [];
|
|
10500
|
+
const uid = widget.newState.uid;
|
|
10501
|
+
for (const command of commands) {
|
|
10502
|
+
if (command[0] === 'Viewlet.setDom2') {
|
|
10503
|
+
wrappedCommands.push([command[0], uid, ...command.slice(1)]);
|
|
10504
|
+
} else {
|
|
10505
|
+
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10506
|
+
}
|
|
10507
|
+
}
|
|
10508
|
+
return wrappedCommands;
|
|
10509
|
+
};
|
|
10510
|
+
const add$1 = widget => {
|
|
10511
|
+
return addWidget(widget, 'EditorHover', render$2);
|
|
10512
|
+
};
|
|
10513
|
+
const remove$1 = removeWidget;
|
|
10514
|
+
|
|
10515
|
+
const EditorHoverWidget = {
|
|
10516
|
+
__proto__: null,
|
|
10526
10517
|
add: add$1,
|
|
10527
10518
|
remove: remove$1,
|
|
10528
|
-
render: render$
|
|
10519
|
+
render: render$2
|
|
10520
|
+
};
|
|
10521
|
+
|
|
10522
|
+
const getActionClassName = isFocused => {
|
|
10523
|
+
if (isFocused) {
|
|
10524
|
+
return mergeClassNames(SourceActionItem, SourceActionItemFocused);
|
|
10525
|
+
}
|
|
10526
|
+
return SourceActionItem;
|
|
10527
|
+
};
|
|
10528
|
+
const getSourceActionListItemVirtualDom = sourceAction => {
|
|
10529
|
+
const {
|
|
10530
|
+
name,
|
|
10531
|
+
isFocused
|
|
10532
|
+
} = sourceAction;
|
|
10533
|
+
const actionClassName = getActionClassName(isFocused);
|
|
10534
|
+
return [{
|
|
10535
|
+
type: Div,
|
|
10536
|
+
className: actionClassName,
|
|
10537
|
+
childCount: 2
|
|
10538
|
+
}, {
|
|
10539
|
+
type: Div,
|
|
10540
|
+
className: 'SourceActionIcon MaskIcon MaskIconSymbolFile'
|
|
10541
|
+
}, text(name)];
|
|
10542
|
+
};
|
|
10543
|
+
|
|
10544
|
+
const getSourceActionsVirtualDom = sourceActions => {
|
|
10545
|
+
const dom = [{
|
|
10546
|
+
type: Div,
|
|
10547
|
+
className: 'Viewlet EditorSourceActions',
|
|
10548
|
+
tabIndex: -1,
|
|
10549
|
+
childCount: 2,
|
|
10550
|
+
onFocusIn: HandleFocusIn
|
|
10551
|
+
}, {
|
|
10552
|
+
type: Div,
|
|
10553
|
+
className: SourceActionHeading,
|
|
10554
|
+
childCount: 1
|
|
10555
|
+
}, text(sourceAction()), {
|
|
10556
|
+
type: Div,
|
|
10557
|
+
className: 'EditorSourceActionsList',
|
|
10558
|
+
childCount: sourceActions.length,
|
|
10559
|
+
onClick: HandleClick
|
|
10560
|
+
}, ...sourceActions.flatMap(getSourceActionListItemVirtualDom)];
|
|
10561
|
+
return dom;
|
|
10562
|
+
};
|
|
10563
|
+
|
|
10564
|
+
const getVisibleSourceActions = (sourceActions, focusedIndex) => {
|
|
10565
|
+
const visible = [];
|
|
10566
|
+
for (let i = 0; i < sourceActions.length; i++) {
|
|
10567
|
+
const isFocused = i === focusedIndex;
|
|
10568
|
+
const sourceAction = sourceActions[i];
|
|
10569
|
+
visible.push({
|
|
10570
|
+
...sourceAction,
|
|
10571
|
+
isFocused
|
|
10572
|
+
});
|
|
10573
|
+
}
|
|
10574
|
+
return visible;
|
|
10529
10575
|
};
|
|
10530
10576
|
|
|
10531
|
-
const
|
|
10532
|
-
|
|
10577
|
+
const renderSourceActions = {
|
|
10578
|
+
isEqual(oldState, newState) {
|
|
10579
|
+
return oldState.sourceActions === newState.sourceActions && oldState.focusedIndex === newState.focusedIndex;
|
|
10580
|
+
},
|
|
10581
|
+
apply(oldStatem, newState) {
|
|
10582
|
+
const visible = getVisibleSourceActions(newState.sourceActions, newState.focusedIndex);
|
|
10583
|
+
const dom = getSourceActionsVirtualDom(visible);
|
|
10584
|
+
return ['Viewlet.setDom2', newState.uid, dom];
|
|
10585
|
+
}
|
|
10586
|
+
};
|
|
10587
|
+
const renderBounds = {
|
|
10588
|
+
isEqual(oldState, newState) {
|
|
10589
|
+
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10590
|
+
},
|
|
10591
|
+
apply(oldState, newState) {
|
|
10592
|
+
return ['setBounds', newState.x, newState.y, newState.width, newState.height];
|
|
10593
|
+
}
|
|
10594
|
+
};
|
|
10595
|
+
const render$1 = [renderSourceActions, renderBounds];
|
|
10596
|
+
const doRender = (oldState, newState) => {
|
|
10597
|
+
const commands = [];
|
|
10598
|
+
for (const item of render$1) {
|
|
10599
|
+
if (!item.isEqual(oldState, newState)) {
|
|
10600
|
+
commands.push(item.apply(oldState, newState));
|
|
10601
|
+
}
|
|
10602
|
+
}
|
|
10603
|
+
return commands;
|
|
10533
10604
|
};
|
|
10534
10605
|
|
|
10535
10606
|
const render = widget => {
|
|
10536
|
-
const commands =
|
|
10607
|
+
const commands = doRender(widget.oldState, widget.newState);
|
|
10537
10608
|
const wrappedCommands = [];
|
|
10538
10609
|
const uid = widget.newState.uid;
|
|
10539
10610
|
for (const command of commands) {
|
|
10540
10611
|
if (command[0] === 'Viewlet.setDom2') {
|
|
10541
|
-
wrappedCommands.push(
|
|
10612
|
+
wrappedCommands.push(command);
|
|
10542
10613
|
} else {
|
|
10543
10614
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10544
10615
|
}
|
|
@@ -10546,11 +10617,11 @@ const render = widget => {
|
|
|
10546
10617
|
return wrappedCommands;
|
|
10547
10618
|
};
|
|
10548
10619
|
const add = widget => {
|
|
10549
|
-
return addWidget(widget, '
|
|
10620
|
+
return addWidget(widget, 'EditorSourceActions', render);
|
|
10550
10621
|
};
|
|
10551
10622
|
const remove = removeWidget;
|
|
10552
10623
|
|
|
10553
|
-
const
|
|
10624
|
+
const EditorSourceActionWidget = {
|
|
10554
10625
|
__proto__: null,
|
|
10555
10626
|
add,
|
|
10556
10627
|
remove,
|
|
@@ -10558,12 +10629,12 @@ const EditorHoverWidget = {
|
|
|
10558
10629
|
};
|
|
10559
10630
|
|
|
10560
10631
|
const registerWidgets = () => {
|
|
10561
|
-
set(ColorPicker$
|
|
10632
|
+
set(ColorPicker$2, EditorColorPickerWidget);
|
|
10562
10633
|
set(Completion, EditorCompletionWidget);
|
|
10563
10634
|
set(CompletionDetail$1, EditorCompletionDetailWidget);
|
|
10564
10635
|
set(Find, EditorFindWidget);
|
|
10565
10636
|
set(Hover, EditorHoverWidget);
|
|
10566
|
-
set(SourceAction,
|
|
10637
|
+
set(SourceAction, EditorSourceActionWidget);
|
|
10567
10638
|
};
|
|
10568
10639
|
|
|
10569
10640
|
const main = async () => {
|