@finos/legend-application 10.1.1 → 10.2.1
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/lib/components/ActionAlert.d.ts +0 -1
- package/lib/components/ActionAlert.d.ts.map +1 -1
- package/lib/components/BlockingAlert.d.ts +0 -1
- package/lib/components/BlockingAlert.d.ts.map +1 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.d.ts.map +1 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js +2 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +1 -1
- package/lib/components/NotificationManager.d.ts +0 -1
- package/lib/components/NotificationManager.d.ts.map +1 -1
- package/lib/components/VirtualAssistant.d.ts +0 -1
- package/lib/components/VirtualAssistant.d.ts.map +1 -1
- package/lib/components/shared/TabManager.d.ts +0 -1
- package/lib/components/shared/TabManager.d.ts.map +1 -1
- package/lib/components/shared/TabManager.js +1 -1
- package/lib/components/shared/TabManager.js.map +1 -1
- package/lib/components/shared/TextSearchAdvancedConfigMenu.d.ts +0 -1
- package/lib/components/shared/TextSearchAdvancedConfigMenu.d.ts.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/stores/PureLanguageSupport.d.ts +21 -0
- package/lib/stores/PureLanguageSupport.d.ts.map +1 -1
- package/lib/stores/PureLanguageSupport.js +190 -75
- package/lib/stores/PureLanguageSupport.js.map +1 -1
- package/lib/stores/PureLanguageTextEditorSupport.d.ts +70 -0
- package/lib/stores/PureLanguageTextEditorSupport.d.ts.map +1 -0
- package/lib/stores/PureLanguageTextEditorSupport.js +231 -0
- package/lib/stores/PureLanguageTextEditorSupport.js.map +1 -0
- package/lib/stores/shared/TabManagerState.d.ts +5 -2
- package/lib/stores/shared/TabManagerState.d.ts.map +1 -1
- package/lib/stores/shared/TabManagerState.js +39 -1
- package/lib/stores/shared/TabManagerState.js.map +1 -1
- package/package.json +10 -10
- package/src/components/LegendApplicationComponentFrameworkProvider.tsx +1 -0
- package/src/components/shared/TabManager.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/stores/PureLanguageSupport.ts +199 -76
- package/src/stores/PureLanguageTextEditorSupport.ts +327 -0
- package/src/stores/shared/TabManagerState.ts +50 -3
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { PARSER_SECTION_MARKER, PURE_PARSER } from '@finos/legend-graph';
|
|
17
|
+
import { getNullableFirstElement, guaranteeNonNullable, hasWhiteSpace, } from '@finos/legend-shared';
|
|
18
|
+
import { languages as monacoLanguagesAPI, } from 'monaco-editor';
|
|
19
|
+
export const getParserKeywordSuggestions = (position, model, suggestions) => {
|
|
20
|
+
const results = [];
|
|
21
|
+
const currentWord = model.getWordUntilPosition(position);
|
|
22
|
+
// suggestions for parser keyword
|
|
23
|
+
const lineTextIncludingWordRange = {
|
|
24
|
+
startLineNumber: position.lineNumber,
|
|
25
|
+
startColumn: 1,
|
|
26
|
+
endLineNumber: position.lineNumber,
|
|
27
|
+
endColumn: currentWord.endColumn,
|
|
28
|
+
};
|
|
29
|
+
const lineTextIncludingWord = model.getValueInRange(lineTextIncludingWordRange);
|
|
30
|
+
// NOTE: make sure parser keyword suggestions only show up when the current word is the
|
|
31
|
+
// the first word of the line since parser section header must not be preceded by anything
|
|
32
|
+
if (!hasWhiteSpace(lineTextIncludingWord.trim())) {
|
|
33
|
+
suggestions.forEach((suggestion) => {
|
|
34
|
+
results.push({
|
|
35
|
+
label: {
|
|
36
|
+
label: `${PARSER_SECTION_MARKER}${suggestion.text}`,
|
|
37
|
+
description: suggestion.description,
|
|
38
|
+
},
|
|
39
|
+
kind: monacoLanguagesAPI.CompletionItemKind.Keyword,
|
|
40
|
+
insertText: `${PARSER_SECTION_MARKER}${suggestion.insertText}\n`,
|
|
41
|
+
range: lineTextIncludingWordRange,
|
|
42
|
+
documentation: suggestion.documentation
|
|
43
|
+
? suggestion.documentation.markdownText
|
|
44
|
+
? {
|
|
45
|
+
value: suggestion.documentation.markdownText.value,
|
|
46
|
+
}
|
|
47
|
+
: suggestion.documentation.text
|
|
48
|
+
: undefined,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
53
|
+
};
|
|
54
|
+
export const getSectionParserNameFromLineText = (lineText) => {
|
|
55
|
+
if (lineText.startsWith(PARSER_SECTION_MARKER)) {
|
|
56
|
+
return lineText.substring(PARSER_SECTION_MARKER.length).split(' ')[0];
|
|
57
|
+
}
|
|
58
|
+
// NOTE: since leading whitespace to parser name is considered invalid, we will return `undefined`
|
|
59
|
+
return undefined;
|
|
60
|
+
};
|
|
61
|
+
export const getParserElementSnippetSuggestions = (position, model, suggestionsGetter) => {
|
|
62
|
+
const results = [];
|
|
63
|
+
const currentWord = model.getWordUntilPosition(position);
|
|
64
|
+
// suggestions for parser element snippets
|
|
65
|
+
const textUntilPosition = model.getValueInRange({
|
|
66
|
+
startLineNumber: 1,
|
|
67
|
+
startColumn: 1,
|
|
68
|
+
endLineNumber: position.lineNumber,
|
|
69
|
+
endColumn: position.column,
|
|
70
|
+
});
|
|
71
|
+
const allParserSectionHeaders =
|
|
72
|
+
// NOTE: since `###Pure` is implicitly considered as the first section, we prepend it to the text
|
|
73
|
+
`${PARSER_SECTION_MARKER}${PURE_PARSER.PURE}\n${textUntilPosition}`
|
|
74
|
+
.split('\n')
|
|
75
|
+
.filter((line) => line.startsWith(PARSER_SECTION_MARKER));
|
|
76
|
+
const currentParserName = getSectionParserNameFromLineText(allParserSectionHeaders[allParserSectionHeaders.length - 1] ?? '');
|
|
77
|
+
if (currentParserName) {
|
|
78
|
+
suggestionsGetter(currentParserName).forEach((snippetSuggestion) => {
|
|
79
|
+
results.push({
|
|
80
|
+
label: {
|
|
81
|
+
label: snippetSuggestion.text,
|
|
82
|
+
description: snippetSuggestion.description,
|
|
83
|
+
},
|
|
84
|
+
kind: monacoLanguagesAPI.CompletionItemKind.Snippet,
|
|
85
|
+
insertTextRules: monacoLanguagesAPI.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
86
|
+
insertText: `${snippetSuggestion.insertText}\n`,
|
|
87
|
+
range: {
|
|
88
|
+
startLineNumber: position.lineNumber,
|
|
89
|
+
startColumn: currentWord.startColumn,
|
|
90
|
+
endLineNumber: position.lineNumber,
|
|
91
|
+
endColumn: currentWord.endColumn,
|
|
92
|
+
},
|
|
93
|
+
documentation: snippetSuggestion.documentation
|
|
94
|
+
? snippetSuggestion.documentation.markdownText
|
|
95
|
+
? {
|
|
96
|
+
value: snippetSuggestion.documentation.markdownText.value,
|
|
97
|
+
}
|
|
98
|
+
: snippetSuggestion.documentation.text
|
|
99
|
+
: undefined,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return results;
|
|
104
|
+
};
|
|
105
|
+
export const getInlineSnippetSuggestions = (position, model, extraSnippetSuggestions = []) => {
|
|
106
|
+
const currentWord = model.getWordUntilPosition(position);
|
|
107
|
+
return [
|
|
108
|
+
{
|
|
109
|
+
text: 'let',
|
|
110
|
+
description: 'new variable',
|
|
111
|
+
insertText: `let \${1:} = \${2:};`,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
text: 'let',
|
|
115
|
+
description: 'new collection',
|
|
116
|
+
insertText: `let \${1:} = [\${2:}];`,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
text: 'cast',
|
|
120
|
+
description: 'type casting',
|
|
121
|
+
insertText: `cast(@\${1:model::SomeClass})`,
|
|
122
|
+
},
|
|
123
|
+
// conditionals
|
|
124
|
+
{
|
|
125
|
+
text: 'if',
|
|
126
|
+
description: '(conditional)',
|
|
127
|
+
insertText: `if(\${1:'true'}, | \${2:/* if true do this */}, | \${3:/* if false do this */})`,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
text: 'case',
|
|
131
|
+
description: '(conditional)',
|
|
132
|
+
insertText: `case(\${1:}, \${2:'true'}, \${3:'false'})`,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
text: 'match',
|
|
136
|
+
description: '(conditional)',
|
|
137
|
+
insertText: `match([x:\${1:String[1]}, \${2:''}])`,
|
|
138
|
+
},
|
|
139
|
+
// collection
|
|
140
|
+
{
|
|
141
|
+
text: 'map',
|
|
142
|
+
description: '(collection)',
|
|
143
|
+
insertText: `map(x|\${1:})`,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
text: 'filter',
|
|
147
|
+
description: '(collection)',
|
|
148
|
+
insertText: `filter(x|\${1:})`,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
text: 'fold',
|
|
152
|
+
description: '(collection)',
|
|
153
|
+
insertText: `fold({a, b| \${1:$a + $b}}, \${2:0})`,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
text: 'filter',
|
|
157
|
+
description: '(collection)',
|
|
158
|
+
insertText: `filter(x|\${1:})`,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
text: 'sort',
|
|
162
|
+
description: '(collection)',
|
|
163
|
+
insertText: `sort()`,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
text: 'in',
|
|
167
|
+
description: '(collection)',
|
|
168
|
+
insertText: `in()`,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
text: 'slice',
|
|
172
|
+
description: '(collection)',
|
|
173
|
+
insertText: `slice(\${1:1},$\{2:2})`,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
text: 'removeDuplicates',
|
|
177
|
+
description: '(collection)',
|
|
178
|
+
insertText: `removeDuplicates()`,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
text: 'toOne',
|
|
182
|
+
description: '(collection)',
|
|
183
|
+
insertText: `toOne(\${1:})`,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
text: 'toOneMany',
|
|
187
|
+
description: '(collection)',
|
|
188
|
+
insertText: `toOneMany(\${1:})`,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
text: 'isEmpty',
|
|
192
|
+
description: '(collection)',
|
|
193
|
+
insertText: `isEmpty()`,
|
|
194
|
+
},
|
|
195
|
+
// string
|
|
196
|
+
{
|
|
197
|
+
text: 'endsWith',
|
|
198
|
+
description: '(string)',
|
|
199
|
+
insertText: `endsWith()`,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
text: 'startsWith',
|
|
203
|
+
description: '(string)',
|
|
204
|
+
insertText: `startsWith()`,
|
|
205
|
+
},
|
|
206
|
+
...extraSnippetSuggestions,
|
|
207
|
+
].map((snippetSuggestion) => ({
|
|
208
|
+
label: {
|
|
209
|
+
label: snippetSuggestion.text,
|
|
210
|
+
description: snippetSuggestion.description,
|
|
211
|
+
},
|
|
212
|
+
kind: monacoLanguagesAPI.CompletionItemKind.Snippet,
|
|
213
|
+
insertTextRules: monacoLanguagesAPI.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
214
|
+
insertText: snippetSuggestion.insertText,
|
|
215
|
+
range: {
|
|
216
|
+
startLineNumber: position.lineNumber,
|
|
217
|
+
startColumn: currentWord.startColumn,
|
|
218
|
+
endLineNumber: position.lineNumber,
|
|
219
|
+
endColumn: currentWord.endColumn,
|
|
220
|
+
},
|
|
221
|
+
documentation: snippetSuggestion.documentation
|
|
222
|
+
? snippetSuggestion.documentation.markdownText
|
|
223
|
+
? {
|
|
224
|
+
value: snippetSuggestion.documentation.markdownText.value,
|
|
225
|
+
}
|
|
226
|
+
: snippetSuggestion.documentation.text
|
|
227
|
+
: undefined,
|
|
228
|
+
}));
|
|
229
|
+
};
|
|
230
|
+
export const getBaseTokenType = (token) => guaranteeNonNullable(getNullableFirstElement(token.split('.')));
|
|
231
|
+
//# sourceMappingURL=PureLanguageTextEditorSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PureLanguageTextEditorSupport.js","sourceRoot":"","sources":["../../src/stores/PureLanguageTextEditorSupport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,SAAS,IAAI,kBAAkB,GAEhC,MAAM,eAAe,CAAC;AAoDvB,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,QAAmB,EACnB,KAAiC,EACjC,WAAwC,EACH,EAAE;IACvC,MAAM,OAAO,GAAwC,EAAE,CAAC;IACxD,MAAM,WAAW,GAAG,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEzD,iCAAiC;IACjC,MAAM,0BAA0B,GAAG;QACjC,eAAe,EAAE,QAAQ,CAAC,UAAU;QACpC,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,QAAQ,CAAC,UAAU;QAClC,SAAS,EAAE,WAAW,CAAC,SAAS;KACjC,CAAC;IACF,MAAM,qBAAqB,GAAG,KAAK,CAAC,eAAe,CACjD,0BAA0B,CAC3B,CAAC;IAEF,uFAAuF;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e,EAAE,QAAQ,CAAC,UAAU;YACpC,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,aAAa,EAAE,QAAQ,CAAC,UAAU;YAClC,SAAS,EAAE,WAAW,CAAC,SAAS;SACjC;QACD,aAAa,EAAE,iBAAiB,CAAC,aAAa;YAC5C,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY;gBAC5C,CAAC,CAAC;oBACE,KAAK,EAAE,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK;iBAC1D;gBACH,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,IAAI;YACxC,CAAC,CAAC,SAAS;KACwB,CAAA,CAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE,CACxD,oBAAoB,CAAC,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -17,6 +17,9 @@ export declare abstract class TabState {
|
|
|
17
17
|
readonly uuid: string;
|
|
18
18
|
abstract get label(): string;
|
|
19
19
|
get description(): string | undefined;
|
|
20
|
+
match(tab: TabState): boolean;
|
|
21
|
+
onOpen(): void;
|
|
22
|
+
onClose(): void;
|
|
20
23
|
}
|
|
21
24
|
export declare abstract class TabManagerState {
|
|
22
25
|
currentTab?: TabState | undefined;
|
|
@@ -31,7 +34,7 @@ export declare abstract class TabManagerState {
|
|
|
31
34
|
* See https://react-dnd.github.io/react-dnd/docs/overview#items-and-types
|
|
32
35
|
*/
|
|
33
36
|
abstract get dndType(): string;
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
openTab(tab: TabState): void;
|
|
38
|
+
closeTab(tab: TabState): void;
|
|
36
39
|
}
|
|
37
40
|
//# sourceMappingURL=TabManagerState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabManagerState.d.ts","sourceRoot":"","sources":["../../../src/stores/shared/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"TabManagerState.d.ts","sourceRoot":"","sources":["../../../src/stores/shared/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,8BAAsB,QAAQ;IAC5B,QAAQ,CAAC,IAAI,SAAU;IAEvB,QAAQ,KAAK,KAAK,IAAI,MAAM,CAAC;IAE7B,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO;IAI7B,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;CAGhB;AAED,8BAAsB,eAAe;IACnC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,QAAQ,EAAE,CAAM;;IAetB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI;IAI9C,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAStC,YAAY,IAAI,IAAI;IAKpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAI9C;;;OAGG;IACH,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC;IAE/B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAe5B,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;CAiB9B"}
|
|
@@ -13,13 +13,22 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { assertNonNullable, swapEntry, uuid } from '@finos/legend-shared';
|
|
16
|
+
import { assertNonNullable, assertTrue, swapEntry, uuid, } from '@finos/legend-shared';
|
|
17
17
|
import { action, makeObservable, observable } from 'mobx';
|
|
18
18
|
export class TabState {
|
|
19
19
|
uuid = uuid();
|
|
20
20
|
get description() {
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
|
+
match(tab) {
|
|
24
|
+
return this === tab;
|
|
25
|
+
}
|
|
26
|
+
onOpen() {
|
|
27
|
+
// do nothing
|
|
28
|
+
}
|
|
29
|
+
onClose() {
|
|
30
|
+
// do nothing
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
export class TabManagerState {
|
|
25
34
|
currentTab;
|
|
@@ -51,5 +60,34 @@ export class TabManagerState {
|
|
|
51
60
|
swapTabs(tab1, tab2) {
|
|
52
61
|
swapEntry(this.tabs, tab1, tab2);
|
|
53
62
|
}
|
|
63
|
+
openTab(tab) {
|
|
64
|
+
const existingTab = this.tabs.find((t) => t.match(tab));
|
|
65
|
+
if (!existingTab) {
|
|
66
|
+
if (this.currentTab) {
|
|
67
|
+
const currIndex = this.tabs.findIndex((e) => e === this.currentTab);
|
|
68
|
+
this.tabs.splice(currIndex + 1, 0, tab);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.tabs.push(tab);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this.setCurrentTab(tab);
|
|
75
|
+
tab.onOpen();
|
|
76
|
+
}
|
|
77
|
+
closeTab(tab) {
|
|
78
|
+
const tabIndex = this.tabs.findIndex((t) => t.match(tab));
|
|
79
|
+
assertTrue(tabIndex !== -1, `Can't close a tab which is not opened`);
|
|
80
|
+
this.tabs.splice(tabIndex, 1);
|
|
81
|
+
if (this.currentTab === tab) {
|
|
82
|
+
if (this.tabs.length) {
|
|
83
|
+
const openIndex = tabIndex - 1;
|
|
84
|
+
this.setCurrentTab(openIndex >= 0 ? this.tabs[openIndex] : this.tabs[0]);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.setCurrentTab(undefined);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
tab.onClose();
|
|
91
|
+
}
|
|
54
92
|
}
|
|
55
93
|
//# sourceMappingURL=TabManagerState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabManagerState.js","sourceRoot":"","sources":["../../../src/stores/shared/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"TabManagerState.js","sourceRoot":"","sources":["../../../src/stores/shared/TabManagerState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,MAAM,OAAgB,QAAQ;IACnB,IAAI,GAAG,IAAI,EAAE,CAAC;IAIvB,IAAI,WAAW;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,GAAa;QACjB,OAAO,IAAI,KAAK,GAAG,CAAC;IACtB,CAAC;IAED,MAAM;QACJ,aAAa;IACf,CAAC;IAED,OAAO;QACL,aAAa;IACf,CAAC;CACF;AAED,MAAM,OAAgB,eAAe;IACnC,UAAU,CAAwB;IAClC,IAAI,GAAe,EAAE,CAAC;IAEtB;QACE,cAAc,CAAC,IAAI,EAAE;YACnB,UAAU,EAAE,UAAU;YACtB,IAAI,EAAE,UAAU;YAChB,aAAa,EAAE,MAAM;YACrB,QAAQ,EAAE,MAAM;YAChB,YAAY,EAAE,MAAM;YACpB,iBAAiB,EAAE,MAAM;YACzB,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,GAAyB;QACrC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,GAAa;QAC7B,iBAAiB,CACf,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,EAChC,0CAA0C,CAC3C,C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AI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,EAAE;YAC3B,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBACpB,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAC,CAAC;gBAC/B,IAAI,CAAC,aAAa,CAChB,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACrD,CAAC;aACH;iBAAM;gBACL,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;aAC/B;SACF;QAED,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.1",
|
|
4
4
|
"description": "Legend application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"test:watch": "jest --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@finos/legend-art": "5.0.
|
|
47
|
-
"@finos/legend-graph": "
|
|
48
|
-
"@finos/legend-shared": "6.2.
|
|
46
|
+
"@finos/legend-art": "5.0.14",
|
|
47
|
+
"@finos/legend-graph": "22.0.1",
|
|
48
|
+
"@finos/legend-shared": "6.2.9",
|
|
49
49
|
"@types/css-font-loading-module": "0.0.7",
|
|
50
|
-
"@types/react": "18.0.
|
|
50
|
+
"@types/react": "18.0.26",
|
|
51
51
|
"@types/react-dom": "18.0.9",
|
|
52
52
|
"@types/react-router-dom": "5.3.3",
|
|
53
53
|
"history": "5.3.0",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
"react-draggable": "4.4.5",
|
|
62
62
|
"react-router": "5.3.4",
|
|
63
63
|
"react-router-dom": "5.3.4",
|
|
64
|
-
"serializr": "3.0.
|
|
64
|
+
"serializr": "3.0.2",
|
|
65
65
|
"sql-formatter": "12.0.3"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@finos/legend-dev-utils": "2.0.
|
|
68
|
+
"@finos/legend-dev-utils": "2.0.32",
|
|
69
69
|
"@jest/globals": "29.3.1",
|
|
70
70
|
"cross-env": "7.0.3",
|
|
71
|
-
"eslint": "8.
|
|
71
|
+
"eslint": "8.29.0",
|
|
72
72
|
"jest": "29.3.1",
|
|
73
73
|
"npm-run-all": "4.1.5",
|
|
74
74
|
"rimraf": "3.0.2",
|
|
75
|
-
"sass": "1.56.
|
|
76
|
-
"typescript": "4.9.
|
|
75
|
+
"sass": "1.56.2",
|
|
76
|
+
"typescript": "4.9.4"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0"
|
|
@@ -45,7 +45,7 @@ const horizontalToVerticalScroll: React.WheelEventHandler = (event) => {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
event.stopPropagation();
|
|
48
|
-
let deltaX
|
|
48
|
+
let deltaX;
|
|
49
49
|
// NOTE: only convert horizontal to vertical scroll when the scroll causes more horizontal than vertical displacement
|
|
50
50
|
// let the direction of `deltaY` be the direction of the scroll, i.e.
|
|
51
51
|
// - if we scroll upward, that translate to a left scroll
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,8 @@ export * from './stores/LegendApplicationDocumentation.js';
|
|
|
44
44
|
|
|
45
45
|
export * from './stores/ApplicationStoreTestUtils.js';
|
|
46
46
|
export * from './stores/WebApplicationRouter.js';
|
|
47
|
+
export { PURE_GRAMMAR_TOKEN } from './stores/PureLanguageSupport.js';
|
|
48
|
+
export * from './stores/PureLanguageTextEditorSupport.js';
|
|
47
49
|
|
|
48
50
|
// ------------------------------------------- Shared components -------------------------------------------
|
|
49
51
|
|