@lvce-editor/editor-worker 19.1.0 → 19.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/README.md +144 -1
- package/dist/editorWorkerMain.js +234 -242
- package/dist/editorWorkerMain.min.js +1 -1
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1538,12 +1538,12 @@ const launchColorPickerWorker = async () => {
|
|
|
1538
1538
|
return launchWorker(name, url);
|
|
1539
1539
|
};
|
|
1540
1540
|
|
|
1541
|
-
const state$
|
|
1541
|
+
const state$d = {};
|
|
1542
1542
|
const getOrCreate$3 = () => {
|
|
1543
|
-
if (!state$
|
|
1544
|
-
state$
|
|
1543
|
+
if (!state$d.workerPromise) {
|
|
1544
|
+
state$d.workerPromise = launchColorPickerWorker();
|
|
1545
1545
|
}
|
|
1546
|
-
return state$
|
|
1546
|
+
return state$d.workerPromise;
|
|
1547
1547
|
};
|
|
1548
1548
|
const invoke$9 = async (method, ...params) => {
|
|
1549
1549
|
const worker = await getOrCreate$3();
|
|
@@ -1626,6 +1626,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1626
1626
|
fontWeight: 0,
|
|
1627
1627
|
handleOffset: 0,
|
|
1628
1628
|
handleOffsetX: 0,
|
|
1629
|
+
hasListener: false,
|
|
1629
1630
|
height,
|
|
1630
1631
|
highlightedLine: -1,
|
|
1631
1632
|
id,
|
|
@@ -1637,6 +1638,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1637
1638
|
isAutoClosingTagsEnabled: false,
|
|
1638
1639
|
isMonospaceFont: false,
|
|
1639
1640
|
isQuickSuggestionsEnabled: false,
|
|
1641
|
+
isSelecting: false,
|
|
1640
1642
|
itemHeight: 20,
|
|
1641
1643
|
languageId: '',
|
|
1642
1644
|
letterSpacing: 0,
|
|
@@ -1657,6 +1659,14 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1657
1659
|
savedSelections: [],
|
|
1658
1660
|
scrollBarHeight: 0,
|
|
1659
1661
|
scrollBarWidth: 0,
|
|
1662
|
+
selectionAnchorPosition: {
|
|
1663
|
+
columnIndex: 0,
|
|
1664
|
+
rowIndex: 0
|
|
1665
|
+
},
|
|
1666
|
+
selectionAutoMovePosition: {
|
|
1667
|
+
columnIndex: 0,
|
|
1668
|
+
rowIndex: 0
|
|
1669
|
+
},
|
|
1660
1670
|
selectionInfos: [],
|
|
1661
1671
|
selections: new Uint32Array(),
|
|
1662
1672
|
tabSize: 0,
|
|
@@ -1847,7 +1857,7 @@ const getInitialLineState = initialLineState => {
|
|
|
1847
1857
|
return deepCopy(initialLineState);
|
|
1848
1858
|
};
|
|
1849
1859
|
|
|
1850
|
-
const state$
|
|
1860
|
+
const state$c = {
|
|
1851
1861
|
warned: []
|
|
1852
1862
|
};
|
|
1853
1863
|
const flattenTokensArray = tokens => {
|
|
@@ -1859,10 +1869,10 @@ const flattenTokensArray = tokens => {
|
|
|
1859
1869
|
return flattened;
|
|
1860
1870
|
};
|
|
1861
1871
|
const warnDeprecatedArrayReturn = (languageId, fn) => {
|
|
1862
|
-
if (state$
|
|
1872
|
+
if (state$c.warned.includes(fn)) {
|
|
1863
1873
|
return;
|
|
1864
1874
|
}
|
|
1865
|
-
state$
|
|
1875
|
+
state$c.warned.push(fn);
|
|
1866
1876
|
console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${languageId})`);
|
|
1867
1877
|
};
|
|
1868
1878
|
const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasArrayReturn) => {
|
|
@@ -1923,14 +1933,14 @@ const TokenizePlainText = {
|
|
|
1923
1933
|
tokenizeLine
|
|
1924
1934
|
};
|
|
1925
1935
|
|
|
1926
|
-
const state$
|
|
1936
|
+
const state$b = {
|
|
1927
1937
|
enabled: false
|
|
1928
1938
|
};
|
|
1929
1939
|
const setEnabled$1 = value => {
|
|
1930
|
-
state$
|
|
1940
|
+
state$b.enabled = value;
|
|
1931
1941
|
};
|
|
1932
1942
|
const getEnabled$1 = () => {
|
|
1933
|
-
return state$
|
|
1943
|
+
return state$b.enabled;
|
|
1934
1944
|
};
|
|
1935
1945
|
|
|
1936
1946
|
const {
|
|
@@ -1938,25 +1948,25 @@ const {
|
|
|
1938
1948
|
set: set$6
|
|
1939
1949
|
} = SyntaxHighlightingWorker;
|
|
1940
1950
|
|
|
1941
|
-
const state$
|
|
1951
|
+
const state$a = {
|
|
1942
1952
|
pending: Object.create(null),
|
|
1943
1953
|
tokenizePaths: Object.create(null),
|
|
1944
1954
|
tokenizers: Object.create(null)
|
|
1945
1955
|
};
|
|
1946
1956
|
const has = languageId => {
|
|
1947
|
-
return Object.hasOwn(state$
|
|
1957
|
+
return Object.hasOwn(state$a.tokenizers, languageId);
|
|
1948
1958
|
};
|
|
1949
1959
|
const set$5 = (languageId, tokenizer) => {
|
|
1950
|
-
state$
|
|
1960
|
+
state$a.tokenizers[languageId] = tokenizer;
|
|
1951
1961
|
};
|
|
1952
1962
|
const get$5 = languageId => {
|
|
1953
|
-
return state$
|
|
1963
|
+
return state$a.tokenizers[languageId];
|
|
1954
1964
|
};
|
|
1955
1965
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
1956
|
-
state$
|
|
1966
|
+
state$a.tokenizePaths[languageId] = tokenizePath;
|
|
1957
1967
|
};
|
|
1958
1968
|
const getTokenizePath$1 = languageId => {
|
|
1959
|
-
return state$
|
|
1969
|
+
return state$a.tokenizePaths[languageId] || '';
|
|
1960
1970
|
};
|
|
1961
1971
|
const setTokenizePaths = languages => {
|
|
1962
1972
|
for (const language of languages) {
|
|
@@ -1966,7 +1976,7 @@ const setTokenizePaths = languages => {
|
|
|
1966
1976
|
}
|
|
1967
1977
|
};
|
|
1968
1978
|
const isPending = languageId => {
|
|
1969
|
-
return Object.hasOwn(state$
|
|
1979
|
+
return Object.hasOwn(state$a.pending, languageId);
|
|
1970
1980
|
};
|
|
1971
1981
|
|
|
1972
1982
|
const tokenMaps = Object.create(null);
|
|
@@ -2809,14 +2819,14 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
|
|
|
2809
2819
|
};
|
|
2810
2820
|
};
|
|
2811
2821
|
|
|
2812
|
-
const state$
|
|
2822
|
+
const state$9 = {
|
|
2813
2823
|
enabled: false
|
|
2814
2824
|
};
|
|
2815
2825
|
const setEnabled = value => {
|
|
2816
|
-
state$
|
|
2826
|
+
state$9.enabled = value;
|
|
2817
2827
|
};
|
|
2818
2828
|
const getEnabled = () => {
|
|
2819
|
-
return state$
|
|
2829
|
+
return state$9.enabled;
|
|
2820
2830
|
};
|
|
2821
2831
|
|
|
2822
2832
|
// TODO this should be in a separate scrolling module
|
|
@@ -2996,7 +3006,7 @@ const getUrlAtOffset = (editor, offset) => {
|
|
|
2996
3006
|
|
|
2997
3007
|
const EditorChange = 1;
|
|
2998
3008
|
|
|
2999
|
-
const state$
|
|
3009
|
+
const state$8 = Object.create(null);
|
|
3000
3010
|
|
|
3001
3011
|
/**
|
|
3002
3012
|
* Register a listener for a specific event type
|
|
@@ -3006,13 +3016,13 @@ const state$a = Object.create(null);
|
|
|
3006
3016
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
3007
3017
|
number(listenerType);
|
|
3008
3018
|
number(rpcId);
|
|
3009
|
-
if (!Object.hasOwn(state$
|
|
3010
|
-
state$
|
|
3019
|
+
if (!Object.hasOwn(state$8, listenerType)) {
|
|
3020
|
+
state$8[listenerType] = [];
|
|
3011
3021
|
}
|
|
3012
3022
|
|
|
3013
3023
|
// Avoid duplicate registrations
|
|
3014
|
-
if (!state$
|
|
3015
|
-
state$
|
|
3024
|
+
if (!state$8[listenerType].includes(rpcId)) {
|
|
3025
|
+
state$8[listenerType].push(rpcId);
|
|
3016
3026
|
}
|
|
3017
3027
|
};
|
|
3018
3028
|
|
|
@@ -3024,10 +3034,10 @@ const registerListener$1 = (listenerType, rpcId) => {
|
|
|
3024
3034
|
const unregisterListener$1 = (listenerType, rpcId) => {
|
|
3025
3035
|
number(listenerType);
|
|
3026
3036
|
number(rpcId);
|
|
3027
|
-
if (Object.hasOwn(state$
|
|
3028
|
-
const index = state$
|
|
3037
|
+
if (Object.hasOwn(state$8, listenerType)) {
|
|
3038
|
+
const index = state$8[listenerType].indexOf(rpcId);
|
|
3029
3039
|
if (index !== -1) {
|
|
3030
|
-
state$
|
|
3040
|
+
state$8[listenerType].splice(index, 1);
|
|
3031
3041
|
}
|
|
3032
3042
|
}
|
|
3033
3043
|
};
|
|
@@ -3039,7 +3049,7 @@ const unregisterListener$1 = (listenerType, rpcId) => {
|
|
|
3039
3049
|
*/
|
|
3040
3050
|
const getListeners = listenerType => {
|
|
3041
3051
|
number(listenerType);
|
|
3042
|
-
return state$
|
|
3052
|
+
return state$8[listenerType] || [];
|
|
3043
3053
|
};
|
|
3044
3054
|
|
|
3045
3055
|
/**
|
|
@@ -3693,9 +3703,11 @@ const emptyEditor = {
|
|
|
3693
3703
|
differences: [],
|
|
3694
3704
|
embeds: [],
|
|
3695
3705
|
focused: false,
|
|
3706
|
+
hasListener: false,
|
|
3696
3707
|
height: 0,
|
|
3697
3708
|
highlightedLine: -1,
|
|
3698
3709
|
incrementalEdits: emptyIncrementalEdits,
|
|
3710
|
+
isSelecting: false,
|
|
3699
3711
|
languageId: '',
|
|
3700
3712
|
// TODO use numeric language id?
|
|
3701
3713
|
lineCache: [],
|
|
@@ -3705,6 +3717,14 @@ const emptyEditor = {
|
|
|
3705
3717
|
minLineY: 0,
|
|
3706
3718
|
redoStack: [],
|
|
3707
3719
|
scrollBarHeight: 0,
|
|
3720
|
+
selectionAnchorPosition: {
|
|
3721
|
+
columnIndex: 0,
|
|
3722
|
+
rowIndex: 0
|
|
3723
|
+
},
|
|
3724
|
+
selectionAutoMovePosition: {
|
|
3725
|
+
columnIndex: 0,
|
|
3726
|
+
rowIndex: 0
|
|
3727
|
+
},
|
|
3708
3728
|
selectionInfos: [],
|
|
3709
3729
|
selections: new Uint32Array(),
|
|
3710
3730
|
textInfos: [],
|
|
@@ -4027,6 +4047,7 @@ const createEditor = async ({
|
|
|
4027
4047
|
fontWeight,
|
|
4028
4048
|
handleOffset: 0,
|
|
4029
4049
|
handleOffsetX: 0,
|
|
4050
|
+
hasListener: false,
|
|
4030
4051
|
height,
|
|
4031
4052
|
id,
|
|
4032
4053
|
incrementalEdits: emptyIncrementalEdits,
|
|
@@ -4036,6 +4057,7 @@ const createEditor = async ({
|
|
|
4036
4057
|
isAutoClosingTagsEnabled,
|
|
4037
4058
|
isMonospaceFont,
|
|
4038
4059
|
isQuickSuggestionsEnabled,
|
|
4060
|
+
isSelecting: false,
|
|
4039
4061
|
itemHeight: 20,
|
|
4040
4062
|
languageId: computedlanguageId,
|
|
4041
4063
|
letterSpacing,
|
|
@@ -4056,6 +4078,14 @@ const createEditor = async ({
|
|
|
4056
4078
|
savedSelections,
|
|
4057
4079
|
scrollBarHeight: 0,
|
|
4058
4080
|
scrollBarWidth: 0,
|
|
4081
|
+
selectionAnchorPosition: {
|
|
4082
|
+
columnIndex: 0,
|
|
4083
|
+
rowIndex: 0
|
|
4084
|
+
},
|
|
4085
|
+
selectionAutoMovePosition: {
|
|
4086
|
+
columnIndex: 0,
|
|
4087
|
+
rowIndex: 0
|
|
4088
|
+
},
|
|
4059
4089
|
selectionInfos: [],
|
|
4060
4090
|
selections: new Uint32Array(),
|
|
4061
4091
|
tabSize,
|
|
@@ -4122,7 +4152,7 @@ const createEditor = async ({
|
|
|
4122
4152
|
};
|
|
4123
4153
|
|
|
4124
4154
|
const isEqual$2 = (oldState, newState) => {
|
|
4125
|
-
return oldState.rowHeight === newState.rowHeight && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
4155
|
+
return oldState.rowHeight === newState.rowHeight && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
4126
4156
|
};
|
|
4127
4157
|
|
|
4128
4158
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -4133,7 +4163,7 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
4133
4163
|
};
|
|
4134
4164
|
|
|
4135
4165
|
const isEqual = (oldState, newState) => {
|
|
4136
|
-
return oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.
|
|
4166
|
+
return oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos;
|
|
4137
4167
|
};
|
|
4138
4168
|
|
|
4139
4169
|
const RenderFocus = 6;
|
|
@@ -4521,7 +4551,7 @@ const y = (editor, rowIndex) => {
|
|
|
4521
4551
|
return offsetY;
|
|
4522
4552
|
};
|
|
4523
4553
|
|
|
4524
|
-
const state$
|
|
4554
|
+
const state$7 = {
|
|
4525
4555
|
timeout: -1
|
|
4526
4556
|
};
|
|
4527
4557
|
|
|
@@ -4552,7 +4582,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
4552
4582
|
|
|
4553
4583
|
// TODO use wrapper timing module instead of this
|
|
4554
4584
|
// @ts-ignore
|
|
4555
|
-
state$
|
|
4585
|
+
state$7.timeout = setTimeout(handleTimeout, 3000);
|
|
4556
4586
|
}
|
|
4557
4587
|
return editor;
|
|
4558
4588
|
};
|
|
@@ -4572,8 +4602,8 @@ const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
|
|
|
4572
4602
|
|
|
4573
4603
|
// @ts-ignore
|
|
4574
4604
|
const editorHideMessage = async editor => {
|
|
4575
|
-
clearTimeout(state$
|
|
4576
|
-
state$
|
|
4605
|
+
clearTimeout(state$7.timeout);
|
|
4606
|
+
state$7.timeout = -1;
|
|
4577
4607
|
// await RendererProcess.invoke(/* Viewlet.send */ 'Viewlet.send', /* id */ editor.uid, /* method */ 'hideOverlayMessage')
|
|
4578
4608
|
return editor;
|
|
4579
4609
|
};
|
|
@@ -4689,12 +4719,12 @@ const launchRenameWorker = async () => {
|
|
|
4689
4719
|
return rpc;
|
|
4690
4720
|
};
|
|
4691
4721
|
|
|
4692
|
-
const state$
|
|
4722
|
+
const state$6 = {};
|
|
4693
4723
|
const getOrCreate$2 = () => {
|
|
4694
|
-
if (!state$
|
|
4695
|
-
state$
|
|
4724
|
+
if (!state$6.workerPromise) {
|
|
4725
|
+
state$6.workerPromise = launchRenameWorker();
|
|
4696
4726
|
}
|
|
4697
|
-
return state$
|
|
4727
|
+
return state$6.workerPromise;
|
|
4698
4728
|
};
|
|
4699
4729
|
const invoke$5 = async (method, ...params) => {
|
|
4700
4730
|
const worker = await getOrCreate$2();
|
|
@@ -4814,12 +4844,12 @@ const openColorPicker = async editor => {
|
|
|
4814
4844
|
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$6);
|
|
4815
4845
|
};
|
|
4816
4846
|
|
|
4817
|
-
const state$
|
|
4847
|
+
const state$5 = {
|
|
4818
4848
|
compositionText: '',
|
|
4819
4849
|
isComposing: false
|
|
4820
4850
|
};
|
|
4821
4851
|
const compositionStart = (editor, event) => {
|
|
4822
|
-
state$
|
|
4852
|
+
state$5.isComposing = true;
|
|
4823
4853
|
return editor;
|
|
4824
4854
|
};
|
|
4825
4855
|
const getCompositionChanges = (selections, data) => {
|
|
@@ -4829,9 +4859,9 @@ const getCompositionChanges = (selections, data) => {
|
|
|
4829
4859
|
const selectionStartColumn = selections[i + 1];
|
|
4830
4860
|
const selectionEndRow = selections[i + 2];
|
|
4831
4861
|
const selectionEndColumn = selections[i + 3];
|
|
4832
|
-
const startColumnIndex = selectionStartColumn - state$
|
|
4862
|
+
const startColumnIndex = selectionStartColumn - state$5.compositionText.length;
|
|
4833
4863
|
changes.push({
|
|
4834
|
-
deleted: [state$
|
|
4864
|
+
deleted: [state$5.compositionText],
|
|
4835
4865
|
end: {
|
|
4836
4866
|
columnIndex: selectionEndColumn,
|
|
4837
4867
|
rowIndex: selectionEndRow
|
|
@@ -4851,7 +4881,7 @@ const compositionUpdate = (editor, data) => {
|
|
|
4851
4881
|
selections
|
|
4852
4882
|
} = editor;
|
|
4853
4883
|
const changes = getCompositionChanges(selections, data);
|
|
4854
|
-
state$
|
|
4884
|
+
state$5.compositionText = data;
|
|
4855
4885
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
4856
4886
|
};
|
|
4857
4887
|
const compositionEnd = (editor, data) => {
|
|
@@ -4859,8 +4889,8 @@ const compositionEnd = (editor, data) => {
|
|
|
4859
4889
|
selections
|
|
4860
4890
|
} = editor;
|
|
4861
4891
|
const changes = getCompositionChanges(selections, data);
|
|
4862
|
-
state$
|
|
4863
|
-
state$
|
|
4892
|
+
state$5.isComposing = false;
|
|
4893
|
+
state$5.compositionText = '';
|
|
4864
4894
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
4865
4895
|
};
|
|
4866
4896
|
|
|
@@ -5960,21 +5990,6 @@ const closeWidgetsMaybe = widgets => {
|
|
|
5960
5990
|
return widgets.filter(isPersistentWidget);
|
|
5961
5991
|
};
|
|
5962
5992
|
|
|
5963
|
-
const state$6 = {
|
|
5964
|
-
position: {
|
|
5965
|
-
columnIndex: 0,
|
|
5966
|
-
rowIndex: 0
|
|
5967
|
-
}
|
|
5968
|
-
};
|
|
5969
|
-
const getPosition$1 = () => {
|
|
5970
|
-
return state$6.position;
|
|
5971
|
-
};
|
|
5972
|
-
|
|
5973
|
-
// @ts-ignore
|
|
5974
|
-
const setPosition$1 = position => {
|
|
5975
|
-
state$6.position = position;
|
|
5976
|
-
};
|
|
5977
|
-
|
|
5978
5993
|
const openExternal = async (url, platform) => {
|
|
5979
5994
|
await openUrl(url, platform);
|
|
5980
5995
|
};
|
|
@@ -6038,12 +6053,11 @@ const Ctrl = 1;
|
|
|
6038
6053
|
const Alt = 2;
|
|
6039
6054
|
|
|
6040
6055
|
const handleSingleClickDefault = (editor, position) => {
|
|
6041
|
-
// TODO avoid global variables, add them to editor state
|
|
6042
|
-
setPosition$1(position);
|
|
6043
6056
|
const widgets = closeWidgetsMaybe(editor.widgets);
|
|
6044
6057
|
return {
|
|
6045
6058
|
...editor,
|
|
6046
6059
|
focused: true,
|
|
6060
|
+
selectionAnchorPosition: position,
|
|
6047
6061
|
selections: new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]),
|
|
6048
6062
|
widgets
|
|
6049
6063
|
};
|
|
@@ -6132,6 +6146,16 @@ const Single = 1;
|
|
|
6132
6146
|
const Double = 2;
|
|
6133
6147
|
const Triple = 3;
|
|
6134
6148
|
|
|
6149
|
+
const getModifier = (altKey, ctrlKey) => {
|
|
6150
|
+
if (altKey) {
|
|
6151
|
+
return Alt;
|
|
6152
|
+
}
|
|
6153
|
+
if (ctrlKey) {
|
|
6154
|
+
return Ctrl;
|
|
6155
|
+
}
|
|
6156
|
+
return 0;
|
|
6157
|
+
};
|
|
6158
|
+
|
|
6135
6159
|
const handleSingleClick = async (editor, modifier, x, y) => {
|
|
6136
6160
|
object(editor);
|
|
6137
6161
|
number(modifier);
|
|
@@ -6169,43 +6193,42 @@ const handleTripleClick = (editor, modifier, x, y) => {
|
|
|
6169
6193
|
return selectLine(editor);
|
|
6170
6194
|
};
|
|
6171
6195
|
|
|
6172
|
-
const
|
|
6173
|
-
if (altKey) {
|
|
6174
|
-
return Alt;
|
|
6175
|
-
}
|
|
6176
|
-
if (ctrlKey) {
|
|
6177
|
-
return Ctrl;
|
|
6178
|
-
}
|
|
6179
|
-
return 0;
|
|
6180
|
-
};
|
|
6181
|
-
const handleMouseDown = (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6196
|
+
const handleMouseDown = async (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6182
6197
|
const modifier = getModifier(altKey, ctrlKey);
|
|
6198
|
+
let newState;
|
|
6183
6199
|
switch (detail) {
|
|
6184
6200
|
case Double:
|
|
6185
|
-
|
|
6201
|
+
newState = await handleDoubleClick(state, modifier, x, y);
|
|
6202
|
+
break;
|
|
6186
6203
|
case Single:
|
|
6187
|
-
|
|
6204
|
+
newState = await handleSingleClick(state, modifier, x, y);
|
|
6205
|
+
break;
|
|
6188
6206
|
case Triple:
|
|
6189
|
-
|
|
6207
|
+
newState = handleTripleClick(state, modifier, x, y);
|
|
6208
|
+
break;
|
|
6190
6209
|
default:
|
|
6191
6210
|
return state;
|
|
6192
6211
|
}
|
|
6212
|
+
return {
|
|
6213
|
+
...newState,
|
|
6214
|
+
isSelecting: true
|
|
6215
|
+
};
|
|
6193
6216
|
};
|
|
6194
6217
|
|
|
6195
|
-
const state$
|
|
6218
|
+
const state$4 = {
|
|
6196
6219
|
editor: undefined,
|
|
6197
6220
|
timeout: -1,
|
|
6198
6221
|
x: 0,
|
|
6199
6222
|
y: 0
|
|
6200
6223
|
};
|
|
6201
6224
|
const get$1 = () => {
|
|
6202
|
-
return state$
|
|
6225
|
+
return state$4;
|
|
6203
6226
|
};
|
|
6204
6227
|
const set$1 = (editor, timeout, x, y) => {
|
|
6205
|
-
state$
|
|
6206
|
-
state$
|
|
6207
|
-
state$
|
|
6208
|
-
state$
|
|
6228
|
+
state$4.editor = editor;
|
|
6229
|
+
state$4.timeout = timeout;
|
|
6230
|
+
state$4.x = x;
|
|
6231
|
+
state$4.y = y;
|
|
6209
6232
|
};
|
|
6210
6233
|
|
|
6211
6234
|
const showHover$1 = async (editor, position) => {
|
|
@@ -6346,59 +6369,21 @@ const editorHandleNativeSelectionChange = (editor, range) => {
|
|
|
6346
6369
|
return scheduleSelections(editor, selections);
|
|
6347
6370
|
};
|
|
6348
6371
|
|
|
6349
|
-
const state$4 = {
|
|
6350
|
-
/**
|
|
6351
|
-
* @type {any}
|
|
6352
|
-
*/
|
|
6353
|
-
currentEditor: undefined,
|
|
6354
|
-
hasListener: false,
|
|
6355
|
-
isSelecting: false,
|
|
6356
|
-
position: {
|
|
6357
|
-
columnIndex: 0,
|
|
6358
|
-
rowIndex: 0
|
|
6359
|
-
}
|
|
6360
|
-
};
|
|
6361
|
-
|
|
6362
|
-
// @ts-ignore
|
|
6363
|
-
const setEditor = editor => {
|
|
6364
|
-
state$4.currentEditor = editor;
|
|
6365
|
-
state$4.hasListener = true;
|
|
6366
|
-
};
|
|
6367
|
-
const clearEditor = () => {
|
|
6368
|
-
state$4.currentEditor = undefined;
|
|
6369
|
-
state$4.hasListener = false;
|
|
6370
|
-
state$4.isSelecting = false;
|
|
6371
|
-
};
|
|
6372
|
-
const startSelecting = () => {
|
|
6373
|
-
state$4.isSelecting = true;
|
|
6374
|
-
};
|
|
6375
|
-
const isSelecting = () => {
|
|
6376
|
-
return state$4.isSelecting;
|
|
6377
|
-
};
|
|
6378
|
-
|
|
6379
|
-
// @ts-ignore
|
|
6380
|
-
const setPosition = position => {
|
|
6381
|
-
state$4.position = position;
|
|
6382
|
-
};
|
|
6383
|
-
const getEditor$1 = () => {
|
|
6384
|
-
return state$4.currentEditor;
|
|
6385
|
-
};
|
|
6386
|
-
const getPosition = () => {
|
|
6387
|
-
return state$4.position;
|
|
6388
|
-
};
|
|
6389
|
-
const hasListener = () => {
|
|
6390
|
-
return state$4.hasListener;
|
|
6391
|
-
};
|
|
6392
|
-
|
|
6393
6372
|
// @ts-ignore
|
|
6394
6373
|
const handlePointerCaptureLost = editor => {
|
|
6395
|
-
|
|
6396
|
-
|
|
6374
|
+
return {
|
|
6375
|
+
...editor,
|
|
6376
|
+
hasListener: false,
|
|
6377
|
+
isSelecting: false,
|
|
6378
|
+
selectionAutoMovePosition: {
|
|
6379
|
+
columnIndex: 0,
|
|
6380
|
+
rowIndex: 0
|
|
6381
|
+
}
|
|
6382
|
+
};
|
|
6397
6383
|
};
|
|
6398
6384
|
|
|
6399
|
-
const handlePointerDown$1 = (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6400
|
-
|
|
6401
|
-
return handleMouseDown(state, button, altKey, ctrlKey, x, y, detail);
|
|
6385
|
+
const handlePointerDown$1 = async (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6386
|
+
return state;
|
|
6402
6387
|
};
|
|
6403
6388
|
|
|
6404
6389
|
const moveRectangleSelection = (editor, position) => {
|
|
@@ -6437,6 +6422,43 @@ const requestAnimationFrame = fn => {
|
|
|
6437
6422
|
globalThis.requestAnimationFrame(fn);
|
|
6438
6423
|
};
|
|
6439
6424
|
|
|
6425
|
+
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
6426
|
+
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
6427
|
+
};
|
|
6428
|
+
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
6429
|
+
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
6430
|
+
return false;
|
|
6431
|
+
}
|
|
6432
|
+
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.debugEnabled !== newState.debugEnabled;
|
|
6433
|
+
};
|
|
6434
|
+
const updateDerivedState = async (oldState, newState) => {
|
|
6435
|
+
let finalState = newState;
|
|
6436
|
+
if (shouldUpdateVisibleTextData(oldState, newState)) {
|
|
6437
|
+
const syncIncremental = getEnabled();
|
|
6438
|
+
const {
|
|
6439
|
+
differences,
|
|
6440
|
+
textInfos
|
|
6441
|
+
} = await getVisible$1(newState, syncIncremental);
|
|
6442
|
+
finalState = {
|
|
6443
|
+
...newState,
|
|
6444
|
+
differences,
|
|
6445
|
+
textInfos
|
|
6446
|
+
};
|
|
6447
|
+
}
|
|
6448
|
+
if (!shouldUpdateSelectionData(oldState, newState)) {
|
|
6449
|
+
return finalState;
|
|
6450
|
+
}
|
|
6451
|
+
const {
|
|
6452
|
+
cursorInfos,
|
|
6453
|
+
selectionInfos
|
|
6454
|
+
} = await getVisible(finalState);
|
|
6455
|
+
return {
|
|
6456
|
+
...finalState,
|
|
6457
|
+
cursorInfos,
|
|
6458
|
+
selectionInfos
|
|
6459
|
+
};
|
|
6460
|
+
};
|
|
6461
|
+
|
|
6440
6462
|
const LessThan = -1;
|
|
6441
6463
|
const Equal = 0;
|
|
6442
6464
|
const GreaterThan = 1;
|
|
@@ -6491,7 +6513,7 @@ const getNewSelections$5 = (anchor, position) => {
|
|
|
6491
6513
|
|
|
6492
6514
|
// @ts-ignore
|
|
6493
6515
|
const editorMoveSelection = (editor, position) => {
|
|
6494
|
-
const anchor =
|
|
6516
|
+
const anchor = editor.selectionAnchorPosition;
|
|
6495
6517
|
const newSelections = getNewSelections$5(anchor, position);
|
|
6496
6518
|
// TODO if selection equals previous selection -> do nothing
|
|
6497
6519
|
return scheduleSelections(editor, newSelections);
|
|
@@ -6509,7 +6531,7 @@ const getNewEditor$1 = (editor, position) => {
|
|
|
6509
6531
|
const newMinLineY = position.rowIndex;
|
|
6510
6532
|
const newMaxLineY = position.rowIndex + diff;
|
|
6511
6533
|
const newDeltaY = position.rowIndex * rowHeight;
|
|
6512
|
-
const anchor =
|
|
6534
|
+
const anchor = editor.selectionAnchorPosition;
|
|
6513
6535
|
const newSelections = new Uint32Array([position.rowIndex - 1, position.columnIndex, anchor.rowIndex, anchor.columnIndex]);
|
|
6514
6536
|
return {
|
|
6515
6537
|
...editor,
|
|
@@ -6524,7 +6546,7 @@ const getNewEditor$1 = (editor, position) => {
|
|
|
6524
6546
|
const newMinLineY = position.rowIndex - diff;
|
|
6525
6547
|
const newMaxLineY = position.rowIndex;
|
|
6526
6548
|
const newDeltaY = newMinLineY * rowHeight;
|
|
6527
|
-
const anchor =
|
|
6549
|
+
const anchor = editor.selectionAnchorPosition;
|
|
6528
6550
|
const newSelections = new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex + 1, position.columnIndex]);
|
|
6529
6551
|
return {
|
|
6530
6552
|
...editor,
|
|
@@ -6536,12 +6558,13 @@ const getNewEditor$1 = (editor, position) => {
|
|
|
6536
6558
|
}
|
|
6537
6559
|
return editor;
|
|
6538
6560
|
};
|
|
6539
|
-
const continueScrollingAndMovingSelection = async
|
|
6540
|
-
const
|
|
6541
|
-
|
|
6561
|
+
const continueScrollingAndMovingSelection = async editorUid => {
|
|
6562
|
+
const editorState = get$7(editorUid);
|
|
6563
|
+
const editor = editorState?.newState;
|
|
6564
|
+
if (!editor || !editor.hasListener || !editor.isSelecting) {
|
|
6542
6565
|
return;
|
|
6543
6566
|
}
|
|
6544
|
-
const position =
|
|
6567
|
+
const position = editor.selectionAutoMovePosition;
|
|
6545
6568
|
if (position.rowIndex === 0) {
|
|
6546
6569
|
return;
|
|
6547
6570
|
}
|
|
@@ -6549,19 +6572,18 @@ const continueScrollingAndMovingSelection = async () => {
|
|
|
6549
6572
|
if (editor === newEditor) {
|
|
6550
6573
|
return;
|
|
6551
6574
|
}
|
|
6552
|
-
// await Viewlet.setState(ViewletModuleId.EditorText, newEditor)
|
|
6553
|
-
setEditor(newEditor);
|
|
6554
6575
|
// @ts-ignore
|
|
6555
6576
|
const delta = position.rowIndex < editor.minLineY ? -1 : 1;
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6577
|
+
const nextEditor = {
|
|
6578
|
+
...newEditor,
|
|
6579
|
+
selectionAutoMovePosition: {
|
|
6580
|
+
columnIndex: position.columnIndex,
|
|
6581
|
+
rowIndex: position.rowIndex + delta
|
|
6582
|
+
}
|
|
6583
|
+
};
|
|
6584
|
+
const newEditorWithDerivedState = await updateDerivedState(editor, nextEditor);
|
|
6585
|
+
set$8(editor.uid, editor, newEditorWithDerivedState);
|
|
6586
|
+
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
6565
6587
|
};
|
|
6566
6588
|
|
|
6567
6589
|
// @ts-ignore
|
|
@@ -6570,16 +6592,20 @@ const moveSelectionPx = async (editor, x, y) => {
|
|
|
6570
6592
|
number(x);
|
|
6571
6593
|
number(y);
|
|
6572
6594
|
const position = await at(editor, x, y);
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6595
|
+
const newEditor = editorMoveSelection(editor, position);
|
|
6596
|
+
if (!editor.hasListener && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
6597
|
+
requestAnimationFrame(() => continueScrollingAndMovingSelection(editor.uid));
|
|
6598
|
+
return {
|
|
6599
|
+
...newEditor,
|
|
6600
|
+
hasListener: true,
|
|
6601
|
+
selectionAutoMovePosition: position
|
|
6602
|
+
};
|
|
6577
6603
|
}
|
|
6578
|
-
return
|
|
6604
|
+
return newEditor;
|
|
6579
6605
|
};
|
|
6580
6606
|
|
|
6581
6607
|
const handlePointerMove = async (editor, x, y, altKey) => {
|
|
6582
|
-
if (!isSelecting
|
|
6608
|
+
if (!editor.isSelecting) {
|
|
6583
6609
|
return editor;
|
|
6584
6610
|
}
|
|
6585
6611
|
if (altKey) {
|
|
@@ -6589,8 +6615,15 @@ const handlePointerMove = async (editor, x, y, altKey) => {
|
|
|
6589
6615
|
};
|
|
6590
6616
|
|
|
6591
6617
|
const handlePointerUp = editor => {
|
|
6592
|
-
|
|
6593
|
-
|
|
6618
|
+
return {
|
|
6619
|
+
...editor,
|
|
6620
|
+
hasListener: false,
|
|
6621
|
+
isSelecting: false,
|
|
6622
|
+
selectionAutoMovePosition: {
|
|
6623
|
+
columnIndex: 0,
|
|
6624
|
+
rowIndex: 0
|
|
6625
|
+
}
|
|
6626
|
+
};
|
|
6594
6627
|
};
|
|
6595
6628
|
|
|
6596
6629
|
// @ts-ignore
|
|
@@ -9991,43 +10024,6 @@ const unsetAdditionalFocus = async focusKey => {
|
|
|
9991
10024
|
await invoke$b('Focus.removeAdditionalFocus', focusKey);
|
|
9992
10025
|
};
|
|
9993
10026
|
|
|
9994
|
-
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
9995
|
-
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
9996
|
-
};
|
|
9997
|
-
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
9998
|
-
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
9999
|
-
return false;
|
|
10000
|
-
}
|
|
10001
|
-
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.debugEnabled !== newState.debugEnabled;
|
|
10002
|
-
};
|
|
10003
|
-
const updateDerivedState = async (oldState, newState) => {
|
|
10004
|
-
let finalState = newState;
|
|
10005
|
-
if (shouldUpdateVisibleTextData(oldState, newState)) {
|
|
10006
|
-
const syncIncremental = getEnabled();
|
|
10007
|
-
const {
|
|
10008
|
-
differences,
|
|
10009
|
-
textInfos
|
|
10010
|
-
} = await getVisible$1(newState, syncIncremental);
|
|
10011
|
-
finalState = {
|
|
10012
|
-
...newState,
|
|
10013
|
-
differences,
|
|
10014
|
-
textInfos
|
|
10015
|
-
};
|
|
10016
|
-
}
|
|
10017
|
-
if (!shouldUpdateSelectionData(oldState, newState)) {
|
|
10018
|
-
return finalState;
|
|
10019
|
-
}
|
|
10020
|
-
const {
|
|
10021
|
-
cursorInfos,
|
|
10022
|
-
selectionInfos
|
|
10023
|
-
} = await getVisible(finalState);
|
|
10024
|
-
return {
|
|
10025
|
-
...finalState,
|
|
10026
|
-
cursorInfos,
|
|
10027
|
-
selectionInfos
|
|
10028
|
-
};
|
|
10029
|
-
};
|
|
10030
|
-
|
|
10031
10027
|
const FocusEditor = 12;
|
|
10032
10028
|
const FocusEditorCompletions = 9;
|
|
10033
10029
|
const FocusEditorRename = 11;
|
|
@@ -11111,11 +11107,13 @@ const registerListener = (listenerType, rpcId) => {
|
|
|
11111
11107
|
registerListener$1(listenerType, rpcId);
|
|
11112
11108
|
};
|
|
11113
11109
|
|
|
11114
|
-
const getCss = (rowHeight, scrollBarHeight, scrollBarTop) => {
|
|
11110
|
+
const getCss = (rowHeight, scrollBarHeight, scrollBarTop, scrollBarWidth, scrollBarLeft) => {
|
|
11115
11111
|
return `.Editor {
|
|
11116
11112
|
--EditorRowHeight: ${rowHeight}px;
|
|
11117
11113
|
--ScrollBarHeight: ${scrollBarHeight}px;
|
|
11118
11114
|
--ScrollBarTop: ${scrollBarTop}px;
|
|
11115
|
+
--ScrollBarWidth: ${scrollBarWidth}px;
|
|
11116
|
+
--ScrollBarLeft: ${scrollBarLeft}px;
|
|
11119
11117
|
}
|
|
11120
11118
|
.Editor .EditorRow {
|
|
11121
11119
|
height: var(--EditorRowHeight);
|
|
@@ -11125,25 +11123,42 @@ const getCss = (rowHeight, scrollBarHeight, scrollBarTop) => {
|
|
|
11125
11123
|
height: var(--ScrollBarHeight);
|
|
11126
11124
|
translate: 0px var(--ScrollBarTop);
|
|
11127
11125
|
}
|
|
11126
|
+
.Editor .ScrollBarThumbHorizontal {
|
|
11127
|
+
width: var(--ScrollBarWidth);
|
|
11128
|
+
translate: var(--ScrollBarLeft) 0px;
|
|
11129
|
+
}
|
|
11128
11130
|
`;
|
|
11129
11131
|
};
|
|
11130
11132
|
|
|
11131
|
-
const
|
|
11133
|
+
const getScrollBarLeft = (deltaX, longestLineWidth, width) => {
|
|
11134
|
+
const scrollBarLeft = deltaX / longestLineWidth * width;
|
|
11135
|
+
if (!Number.isFinite(scrollBarLeft)) {
|
|
11136
|
+
return 0;
|
|
11137
|
+
}
|
|
11138
|
+
return scrollBarLeft;
|
|
11139
|
+
};
|
|
11140
|
+
const renderCss$1 = (oldState, newState) => {
|
|
11132
11141
|
const {
|
|
11142
|
+
deltaX,
|
|
11133
11143
|
deltaY,
|
|
11134
11144
|
finalDeltaY,
|
|
11135
11145
|
height,
|
|
11146
|
+
longestLineWidth,
|
|
11147
|
+
minimumSliderSize,
|
|
11136
11148
|
rowHeight,
|
|
11137
11149
|
scrollBarHeight,
|
|
11138
|
-
uid
|
|
11150
|
+
uid,
|
|
11151
|
+
width
|
|
11139
11152
|
} = newState;
|
|
11140
11153
|
const scrollBarTop = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
|
|
11141
|
-
const
|
|
11154
|
+
const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
|
|
11155
|
+
const scrollBarLeft = getScrollBarLeft(deltaX, longestLineWidth, width);
|
|
11156
|
+
const css = getCss(rowHeight, scrollBarHeight, scrollBarTop, scrollBarWidth, scrollBarLeft);
|
|
11142
11157
|
return [SetCss$1, uid, css];
|
|
11143
11158
|
};
|
|
11144
11159
|
|
|
11145
11160
|
const renderFocus$2 = (oldState, newState) => {
|
|
11146
|
-
const selector = '.EditorInput';
|
|
11161
|
+
const selector = '.EditorInput textarea';
|
|
11147
11162
|
return [FocusSelector, newState.uid, selector];
|
|
11148
11163
|
};
|
|
11149
11164
|
|
|
@@ -11414,6 +11429,10 @@ const diffTree = (oldNodes, newNodes) => {
|
|
|
11414
11429
|
|
|
11415
11430
|
const getEditorInputVirtualDom = () => {
|
|
11416
11431
|
return [{
|
|
11432
|
+
childCount: 1,
|
|
11433
|
+
className: 'EditorInput',
|
|
11434
|
+
type: Div
|
|
11435
|
+
}, {
|
|
11417
11436
|
ariaAutoComplete: 'list',
|
|
11418
11437
|
ariaMultiLine: 'true',
|
|
11419
11438
|
ariaRoleDescription: 'editor',
|
|
@@ -11421,7 +11440,6 @@ const getEditorInputVirtualDom = () => {
|
|
|
11421
11440
|
autocomplete: 'off',
|
|
11422
11441
|
autocorrect: 'off',
|
|
11423
11442
|
childCount: 0,
|
|
11424
|
-
className: 'EditorInput',
|
|
11425
11443
|
name: 'editor',
|
|
11426
11444
|
onBeforeInput: HandleBeforeInput,
|
|
11427
11445
|
onBlur: HandleBlur,
|
|
@@ -11595,8 +11613,7 @@ const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
|
11595
11613
|
}, ...getDiagnosticsVirtualDom([...scrollBarDiagnostics])];
|
|
11596
11614
|
};
|
|
11597
11615
|
|
|
11598
|
-
const getScrollBarVirtualDom = (
|
|
11599
|
-
const scrollBarY = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
|
|
11616
|
+
const getScrollBarVirtualDom = () => {
|
|
11600
11617
|
return [{
|
|
11601
11618
|
childCount: 1,
|
|
11602
11619
|
className: 'ScrollBar ScrollBarVertical',
|
|
@@ -11606,8 +11623,6 @@ const getScrollBarVirtualDom = (deltaY, finalDeltaY, height, scrollBarHeight) =>
|
|
|
11606
11623
|
}, {
|
|
11607
11624
|
childCount: 0,
|
|
11608
11625
|
className: 'ScrollBarThumb ScrollBarThumbVertical',
|
|
11609
|
-
style: `height:${scrollBarHeight}px;`,
|
|
11610
|
-
translate: `0 ${scrollBarY}px`,
|
|
11611
11626
|
type: Div
|
|
11612
11627
|
}, {
|
|
11613
11628
|
childCount: 1,
|
|
@@ -11623,15 +11638,11 @@ const getScrollBarVirtualDom = (deltaY, finalDeltaY, height, scrollBarHeight) =>
|
|
|
11623
11638
|
|
|
11624
11639
|
const getEditorContentVirtualDom = ({
|
|
11625
11640
|
cursorInfos = [],
|
|
11626
|
-
deltaY = 0,
|
|
11627
11641
|
diagnostics = [],
|
|
11628
11642
|
differences,
|
|
11629
|
-
finalDeltaY = 0,
|
|
11630
|
-
height = 0,
|
|
11631
11643
|
highlightedLine = -1,
|
|
11632
11644
|
lineNumbers = true,
|
|
11633
11645
|
scrollBarDiagnostics = [],
|
|
11634
|
-
scrollBarHeight = 0,
|
|
11635
11646
|
selectionInfos = [],
|
|
11636
11647
|
textInfos
|
|
11637
11648
|
}) => {
|
|
@@ -11640,7 +11651,7 @@ const getEditorContentVirtualDom = ({
|
|
|
11640
11651
|
className: 'EditorContent',
|
|
11641
11652
|
onMouseMove: HandleMouseMove,
|
|
11642
11653
|
type: Div
|
|
11643
|
-
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(
|
|
11654
|
+
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
11644
11655
|
};
|
|
11645
11656
|
|
|
11646
11657
|
const getGutterInfoVirtualDom = gutterInfo => {
|
|
@@ -11666,36 +11677,29 @@ const getEditorGutterVirtualDom = gutterInfos => {
|
|
|
11666
11677
|
|
|
11667
11678
|
const getEditorVirtualDom = ({
|
|
11668
11679
|
cursorInfos = [],
|
|
11669
|
-
deltaY = 0,
|
|
11670
11680
|
diagnostics = [],
|
|
11671
11681
|
differences,
|
|
11672
|
-
finalDeltaY = 0,
|
|
11673
11682
|
gutterInfos = [],
|
|
11674
|
-
height = 0,
|
|
11675
11683
|
highlightedLine = -1,
|
|
11676
11684
|
lineNumbers = true,
|
|
11677
11685
|
scrollBarDiagnostics = [],
|
|
11678
|
-
scrollBarHeight = 0,
|
|
11679
11686
|
selectionInfos = [],
|
|
11680
11687
|
textInfos
|
|
11681
11688
|
}) => {
|
|
11689
|
+
const gutterDom = lineNumbers ? getEditorGutterVirtualDom(gutterInfos) : [];
|
|
11682
11690
|
return [{
|
|
11683
|
-
childCount: 2,
|
|
11691
|
+
childCount: lineNumbers ? 2 : 1,
|
|
11684
11692
|
className: 'Viewlet Editor',
|
|
11685
11693
|
onContextMenu: HandleContextMenu,
|
|
11686
11694
|
role: 'code',
|
|
11687
11695
|
type: Div
|
|
11688
|
-
}, ...
|
|
11696
|
+
}, ...gutterDom, ...getEditorContentVirtualDom({
|
|
11689
11697
|
cursorInfos,
|
|
11690
|
-
deltaY,
|
|
11691
11698
|
diagnostics,
|
|
11692
11699
|
differences,
|
|
11693
|
-
finalDeltaY,
|
|
11694
|
-
height,
|
|
11695
11700
|
highlightedLine,
|
|
11696
11701
|
lineNumbers,
|
|
11697
11702
|
scrollBarDiagnostics,
|
|
11698
|
-
scrollBarHeight,
|
|
11699
11703
|
selectionInfos,
|
|
11700
11704
|
textInfos
|
|
11701
11705
|
})];
|
|
@@ -11743,7 +11747,7 @@ const renderIncremental = (oldState, newState) => {
|
|
|
11743
11747
|
const getRenderer = diffType => {
|
|
11744
11748
|
switch (diffType) {
|
|
11745
11749
|
case RenderCss:
|
|
11746
|
-
return renderCss;
|
|
11750
|
+
return renderCss$1;
|
|
11747
11751
|
case RenderFocus:
|
|
11748
11752
|
return renderFocus$2;
|
|
11749
11753
|
case RenderFocusContext:
|
|
@@ -11834,22 +11838,9 @@ const renderSelections = {
|
|
|
11834
11838
|
},
|
|
11835
11839
|
isEqual: (oldState, newState) => oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos
|
|
11836
11840
|
};
|
|
11837
|
-
const
|
|
11838
|
-
apply
|
|
11839
|
-
|
|
11840
|
-
const translate = `0 ${scrollBarY}px`;
|
|
11841
|
-
const heightPx = `${newState.scrollBarHeight}px`;
|
|
11842
|
-
return [/* method */'setScrollBar', translate, heightPx];
|
|
11843
|
-
},
|
|
11844
|
-
isEqual: (oldState, newState) => oldState.deltaY === newState.deltaY && oldState.scrollBarHeight === newState.scrollBarHeight
|
|
11845
|
-
};
|
|
11846
|
-
const renderScrollBarX = {
|
|
11847
|
-
apply(oldState, newState) {
|
|
11848
|
-
const scrollBarWidth = getScrollBarSize(newState.width, newState.longestLineWidth, newState.minimumSliderSize);
|
|
11849
|
-
const scrollBarX = newState.deltaX / newState.longestLineWidth * newState.width;
|
|
11850
|
-
return [/* method */'setScrollBarHorizontal', /* scrollBarX */scrollBarX, /* scrollBarWidth */scrollBarWidth, /* deltaX */newState.deltaX];
|
|
11851
|
-
},
|
|
11852
|
-
isEqual: (oldState, newState) => oldState.longestLineWidth === newState.longestLineWidth && oldState.deltaX === newState.deltaX
|
|
11841
|
+
const renderCss = {
|
|
11842
|
+
apply: renderCss$1,
|
|
11843
|
+
isEqual: isEqual$2
|
|
11853
11844
|
};
|
|
11854
11845
|
const renderFocus$1 = {
|
|
11855
11846
|
apply: (oldState, newState) => [/* method */'setFocused', newState.focused],
|
|
@@ -11882,16 +11873,17 @@ const renderGutterInfo = {
|
|
|
11882
11873
|
maxLineY,
|
|
11883
11874
|
minLineY
|
|
11884
11875
|
} = newState;
|
|
11876
|
+
if (!lineNumbers) {
|
|
11877
|
+
return [];
|
|
11878
|
+
}
|
|
11885
11879
|
const gutterInfos = [];
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
gutterInfos.push(i + 1);
|
|
11889
|
-
}
|
|
11880
|
+
for (let i = minLineY; i < maxLineY; i++) {
|
|
11881
|
+
gutterInfos.push(i + 1);
|
|
11890
11882
|
}
|
|
11891
11883
|
const dom = getEditorGutterVirtualDom$1(gutterInfos);
|
|
11892
11884
|
return ['renderGutter', dom];
|
|
11893
11885
|
},
|
|
11894
|
-
isEqual: (oldState, newState) => oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
11886
|
+
isEqual: (oldState, newState) => oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
11895
11887
|
};
|
|
11896
11888
|
const renderWidgets = {
|
|
11897
11889
|
apply(oldState, newState) {
|
|
@@ -11948,7 +11940,7 @@ const renderWidgets = {
|
|
|
11948
11940
|
isEqual: (oldState, newState) => oldState.widgets === newState.widgets,
|
|
11949
11941
|
multiple: true
|
|
11950
11942
|
};
|
|
11951
|
-
const render$6 = [renderLines, renderSelections,
|
|
11943
|
+
const render$6 = [renderLines, renderSelections, renderCss, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
11952
11944
|
const renderEditor = async id => {
|
|
11953
11945
|
const instance = get$7(id);
|
|
11954
11946
|
if (!instance) {
|