@arcgis/coding-components 4.31.0-next.10 → 4.31.0-next.11
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/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-da9431ba.js → p-21306a37.js} +2 -2
- package/dist/arcgis-coding-components/{p-f452d4b8.entry.js → p-29b05690.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-2db85972.js +6 -0
- package/dist/arcgis-coding-components/{p-8196fa73.js → p-2f2288de.js} +2 -2
- package/dist/arcgis-coding-components/{p-923858b5.js → p-4050b5db.js} +2 -2
- package/dist/arcgis-coding-components/{p-960aa9dc.js → p-44052160.js} +2 -2
- package/dist/arcgis-coding-components/{p-767b17ee.entry.js → p-47bb2fdc.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-4fcb5bf0.js +6 -0
- package/dist/arcgis-coding-components/{p-ad75160d.js → p-79e7d01c.js} +3 -3
- package/dist/arcgis-coding-components/{p-02cae55d.js → p-aedf8504.js} +3 -3
- package/dist/arcgis-coding-components/{p-790067b1.js → p-af7ed920.js} +12 -12
- package/dist/arcgis-coding-components/{p-6e28fd70.js → p-c28eef63.js} +2 -2
- package/dist/arcgis-coding-components/{p-22253750.js → p-ca85726f.js} +1 -1
- package/dist/arcgis-coding-components/{p-193ac44f.js → p-cdc11558.js} +1 -1
- package/dist/arcgis-coding-components/{p-8cf09bcc.js → p-decda64c.js} +1 -1
- package/dist/arcgis-coding-components/p-e6442988.js +6 -0
- package/dist/arcgis-coding-components/{p-4fc79a07.entry.js → p-eb99e7e7.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-ab78d6c4.js → p-ef0c4126.js} +3 -3
- package/dist/arcgis-coding-components/{p-025fda85.js → p-fa824326.js} +2 -2
- package/dist/cjs/{app-globals-bade840e.js → app-globals-d8d56a70.js} +1 -1
- package/dist/cjs/arcade-defaults-b1300c3f.js +349 -0
- package/dist/cjs/{arcade-language-features-747fb1da.js → arcade-language-features-5c4510c9.js} +2 -2
- package/dist/cjs/{arcade-mode-dce44622.js → arcade-mode-185370a7.js} +3 -4
- package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +6 -6
- package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
- package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
- package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
- package/dist/cjs/{css-077ba0c5.js → css-0d91050a.js} +1 -1
- package/dist/cjs/{cssMode-7f2030db.js → cssMode-e8786e83.js} +2 -3
- package/dist/cjs/{html-e3a243e9.js → html-adbae3fd.js} +2 -3
- package/dist/cjs/{htmlMode-c273d6dc.js → htmlMode-608f8da7.js} +2 -3
- package/dist/cjs/{index-37a86ff4.js → index-1cf75f2d.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-7a33cca7.js → javascript-c8733e40.js} +3 -4
- package/dist/cjs/{jsonMode-6b4e0850.js → jsonMode-98ec5315.js} +2 -3
- package/dist/cjs/{language-defaults-base-b32cb091.js → language-defaults-base-2b2f9d3e.js} +800 -1024
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{sql-expr-defaults-8a5834f3.js → sql-expr-defaults-a1d5380d.js} +55 -4
- package/dist/cjs/{sql-expr-mode-a72a1f92.js → sql-expr-mode-19618e11.js} +5 -5
- package/dist/cjs/{tsMode-c2edcd57.js → tsMode-ed34ec8f.js} +2 -3
- package/dist/cjs/{typescript-c50c5516.js → typescript-c3d83864.js} +2 -3
- package/dist/components/arcade-defaults.js +238 -4
- package/dist/components/arcade-language-features.js +1 -1
- package/dist/components/arcade-mode.js +1 -1
- package/dist/components/arcade-results.js +2 -2
- package/dist/components/arcade-suggestions.js +1 -1
- package/dist/components/arcade-variables.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +1 -1
- package/dist/components/arcgis-arcade-results.js +1 -1
- package/dist/components/arcgis-arcade-suggestions.js +1 -1
- package/dist/components/arcgis-arcade-variables.js +1 -1
- package/dist/components/arcgis-assets.d.ts +1 -1
- package/dist/components/arcgis-assets.js +1 -1
- package/dist/components/arcgis-code-editor.js +1 -1
- package/dist/components/arcgis-language-api-panel.js +1 -1
- package/dist/components/arcgis-sql-expression-editor.js +1 -1
- package/dist/components/arcgis-sql-expression-fields.js +1 -1
- package/dist/components/chunk-3IUJHIAA.js +1 -1
- package/dist/components/code-editor.js +1 -1
- package/dist/components/fields.js +4 -4
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/language-api-panel.js +1 -1
- package/dist/components/language-defaults-base.js +47 -273
- package/dist/components/markdown.js +1 -1
- package/dist/components/sql-expr-defaults.js +55 -4
- package/dist/components/sql-expr-mode.js +1 -1
- package/dist/components/sql-expression-fields.js +1 -1
- package/dist/components/useT9n.js +1 -1
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{app-globals-ed47e16d.js → app-globals-a48930ca.js} +1 -1
- package/dist/esm/arcade-defaults-3ea67051.js +344 -0
- package/dist/esm/{arcade-language-features-8edb3527.js → arcade-language-features-8274cdc7.js} +2 -2
- package/dist/esm/{arcade-mode-ad036f46.js → arcade-mode-c48c3fc6.js} +3 -4
- package/dist/esm/arcgis-arcade-editor_6.entry.js +6 -6
- package/dist/esm/arcgis-coding-components.js +4 -4
- package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
- package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
- package/dist/esm/{css-810518f1.js → css-4f85f426.js} +1 -1
- package/dist/esm/{cssMode-a7208024.js → cssMode-d655f1b9.js} +2 -3
- package/dist/esm/{html-e187d7d8.js → html-dd1552df.js} +2 -3
- package/dist/esm/{htmlMode-06b7bae2.js → htmlMode-0b7c2367.js} +2 -3
- package/dist/esm/{index-3743d31f.js → index-38d652b8.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-04a3f866.js → javascript-ef70f152.js} +3 -4
- package/dist/esm/{jsonMode-ee8bb2ea.js → jsonMode-a6ed58a5.js} +2 -3
- package/dist/esm/{language-defaults-base-52a397f5.js → language-defaults-base-77487def.js} +797 -1024
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{sql-expr-defaults-f7c2d5ef.js → sql-expr-defaults-54db53a8.js} +55 -4
- package/dist/esm/{sql-expr-mode-433b4a39.js → sql-expr-mode-5c1d43ea.js} +5 -5
- package/dist/esm/{tsMode-c80c462e.js → tsMode-fce6766b.js} +2 -3
- package/dist/esm/{typescript-a9b8caa7.js → typescript-aed3d402.js} +2 -3
- package/dist/loader/cdn.js +1 -1
- package/dist/loader/index.cjs.js +1 -1
- package/dist/loader/index.es2017.js +1 -1
- package/dist/loader/index.js +1 -1
- package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
- package/dist/types/utils/fields.d.ts +2 -2
- package/dist/types/utils/profile/editor-profile.d.ts +7 -6
- package/dist/types/utils/profile/types.d.ts +3 -0
- package/dist/types/utils/profile/utils.d.ts +4 -0
- package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +9 -0
- package/package.json +10 -10
- package/dist/arcgis-coding-components/p-50484a4f.js +0 -6
- package/dist/arcgis-coding-components/p-7164c348.js +0 -6
- package/dist/arcgis-coding-components/p-9956a574.js +0 -6
- package/dist/cjs/arcade-defaults-8b8d6c07.js +0 -116
- package/dist/esm/arcade-defaults-562fe19b.js +0 -111
- package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
- package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
9
|
+
const index = require('./index-1cf75f2d.js');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the arcade diagnostic service.
|
|
13
|
+
* Example:
|
|
14
|
+
* ```ts
|
|
15
|
+
* const diagnosticService = await getArcadeDiagnosticService();
|
|
16
|
+
* diagnosticService.onDidChangeDiagnostics(({uri, diaganostics }) => {
|
|
17
|
+
* // Filter the diagnostics for the uri of interest
|
|
18
|
+
* // Do something with the diagnostics
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
async function getArcadeDiagnosticService() {
|
|
23
|
+
const mode = await getMode();
|
|
24
|
+
return mode.getArcadeDiagnosticService();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the arcade worker for the model.
|
|
28
|
+
* Example:
|
|
29
|
+
* ```ts
|
|
30
|
+
* const arcadeWorker = await getArcadeWorker(model.uri);
|
|
31
|
+
* ```
|
|
32
|
+
* @returns arcade worker
|
|
33
|
+
*/
|
|
34
|
+
async function getArcadeWorker(uri) {
|
|
35
|
+
const mode = await getMode();
|
|
36
|
+
return await mode.getArcadeWorker(uri);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Request the arcade mode
|
|
40
|
+
* @returns arcade mode module
|
|
41
|
+
*/
|
|
42
|
+
async function getMode() {
|
|
43
|
+
return await Promise.resolve().then(function () { return require('./arcade-mode-185370a7.js'); });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// #region convert editor profile to apiProfile
|
|
47
|
+
/**
|
|
48
|
+
* Converts an editor profile to an api profile.
|
|
49
|
+
* The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
|
|
50
|
+
*/
|
|
51
|
+
async function arcadeEditorToApiProfile(editorProfile) {
|
|
52
|
+
const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
|
|
53
|
+
const variables = await variablesToLSVariable(editorProfile.dictionaryVariables);
|
|
54
|
+
return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
|
|
55
|
+
}
|
|
56
|
+
async function variablesToLSVariable(editorVariables, kind = languageDefaultsBase.main.exports.CompletionItemKind.Variable) {
|
|
57
|
+
return await Promise.all(editorVariables.map(async (editorVariable) => {
|
|
58
|
+
switch (editorVariable.type) {
|
|
59
|
+
case "dictionary":
|
|
60
|
+
return await dictionaryToLSDictionary(editorVariable, kind);
|
|
61
|
+
case "feature":
|
|
62
|
+
return await featureToLSFeature(editorVariable, kind);
|
|
63
|
+
default:
|
|
64
|
+
return variableToLSVariable(editorVariable, kind);
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
function variableToLSVariable(editorVariable, kind) {
|
|
69
|
+
const { name, type } = editorVariable;
|
|
70
|
+
const description = editorVariable.getDescription();
|
|
71
|
+
return {
|
|
72
|
+
name,
|
|
73
|
+
description,
|
|
74
|
+
type,
|
|
75
|
+
completion: {
|
|
76
|
+
label: name,
|
|
77
|
+
detail: name,
|
|
78
|
+
insertText: name,
|
|
79
|
+
insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
|
|
80
|
+
insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
|
|
81
|
+
kind,
|
|
82
|
+
documentation: { kind: "markdown", value: description },
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function featureToLSFeature(editorFeature, kind) {
|
|
87
|
+
// Get the source for the definition
|
|
88
|
+
const source = await editorFeature.loadSource();
|
|
89
|
+
const { name } = editorFeature;
|
|
90
|
+
const description = editorFeature.getDescription();
|
|
91
|
+
const resultCompletion = {
|
|
92
|
+
label: name,
|
|
93
|
+
detail: name,
|
|
94
|
+
insertText: name,
|
|
95
|
+
insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
|
|
96
|
+
insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
|
|
97
|
+
kind,
|
|
98
|
+
};
|
|
99
|
+
const result = {
|
|
100
|
+
name,
|
|
101
|
+
description,
|
|
102
|
+
type: "dictionary",
|
|
103
|
+
properties: [],
|
|
104
|
+
completion: resultCompletion,
|
|
105
|
+
};
|
|
106
|
+
// No source definition, then it will be a feature without any known fields
|
|
107
|
+
if (!source) {
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
// Create properties for the fields and the aliases
|
|
111
|
+
// Also improve the feature completion documentation
|
|
112
|
+
const [properties, featureCompletionDescription] = languageDefaultsBase.fieldsToProfileValues(source.fields, description, true);
|
|
113
|
+
result.properties = properties;
|
|
114
|
+
resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
118
|
+
const { name, dictionaryVariables: variables } = editorDictionary;
|
|
119
|
+
const description = editorDictionary.getDescription();
|
|
120
|
+
const completionDescription = variables.reduce((previous, p) => {
|
|
121
|
+
if (previous !== "") {
|
|
122
|
+
previous += " \n \n";
|
|
123
|
+
}
|
|
124
|
+
previous += `**${p.name}** \n${p.type}`;
|
|
125
|
+
const description = p.getDescription();
|
|
126
|
+
if (description) {
|
|
127
|
+
previous += ` \n${description}`;
|
|
128
|
+
}
|
|
129
|
+
return previous;
|
|
130
|
+
}, description);
|
|
131
|
+
return {
|
|
132
|
+
name,
|
|
133
|
+
description,
|
|
134
|
+
type: "dictionary",
|
|
135
|
+
properties: await variablesToLSVariable(variables, languageDefaultsBase.main.exports.CompletionItemKind.Field),
|
|
136
|
+
completion: {
|
|
137
|
+
label: name,
|
|
138
|
+
detail: name,
|
|
139
|
+
insertText: name,
|
|
140
|
+
insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
|
|
141
|
+
insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
|
|
142
|
+
kind,
|
|
143
|
+
documentation: { kind: "markdown", value: completionDescription },
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// #endregion
|
|
148
|
+
// #region predefined profile to editor profile definition
|
|
149
|
+
/**
|
|
150
|
+
* Get a PredefinedProfile for a locale. If not already loaded then fetch it.
|
|
151
|
+
* If the locale doesn't exist or the locale profile file doesn't exist then returns
|
|
152
|
+
* the english version of the profile.
|
|
153
|
+
*/
|
|
154
|
+
async function getSdkPredefinedProfiles(locale = "en") {
|
|
155
|
+
const profiles = sdkPredefinedProfilesMap.get(locale);
|
|
156
|
+
if (profiles) {
|
|
157
|
+
return profiles;
|
|
158
|
+
}
|
|
159
|
+
if (!languageDefaultsBase.supportedLocales.has(locale)) {
|
|
160
|
+
return await getSdkPredefinedProfiles("en");
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const response = await fetch(index.getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
|
|
164
|
+
if (response.ok) {
|
|
165
|
+
return cacheSdkPredefinedProfiles(locale, (await response.json()));
|
|
166
|
+
}
|
|
167
|
+
if (locale === "en") {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return await getSdkPredefinedProfiles("en");
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const sdkPredefinedProfilesMap = new Map();
|
|
177
|
+
/**
|
|
178
|
+
* Convert a stored profile into a PredefinedProfile and add it to the in-memory
|
|
179
|
+
* Map of profiles per locale.
|
|
180
|
+
*/
|
|
181
|
+
function cacheSdkPredefinedProfiles(locale, profiles) {
|
|
182
|
+
const map = new Map();
|
|
183
|
+
profiles.forEach((profile) => {
|
|
184
|
+
map.set(profile.id, profile);
|
|
185
|
+
});
|
|
186
|
+
sdkPredefinedProfilesMap.set(locale, map);
|
|
187
|
+
return map;
|
|
188
|
+
}
|
|
189
|
+
async function getSdkPredefinedProfile(id, locale = "en") {
|
|
190
|
+
const profiles = await getSdkPredefinedProfiles(locale);
|
|
191
|
+
return profiles?.get(id) ?? null;
|
|
192
|
+
}
|
|
193
|
+
function isExtendedPredefinedProfileDefinition(item) {
|
|
194
|
+
return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
|
|
195
|
+
}
|
|
196
|
+
function convertApiVariables(variables) {
|
|
197
|
+
return variables?.map(convertApiVariable);
|
|
198
|
+
}
|
|
199
|
+
function convertApiVariable(variable) {
|
|
200
|
+
switch (variable.type) {
|
|
201
|
+
case "dictionary":
|
|
202
|
+
return {
|
|
203
|
+
...variable,
|
|
204
|
+
type: variable.type,
|
|
205
|
+
properties: convertApiVariables(variable.properties),
|
|
206
|
+
};
|
|
207
|
+
case "array": {
|
|
208
|
+
return {
|
|
209
|
+
...variable,
|
|
210
|
+
type: variable.type,
|
|
211
|
+
elementType: { type: "number", name: "number" },
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
default:
|
|
215
|
+
return { ...variable, type: variable.type };
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
|
|
219
|
+
if (!languageDefaultsBase.isPredefinedProfile(predefinedProfile)) {
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
|
|
223
|
+
if (!sdkPredefinedProfile) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const editorProfile = {
|
|
227
|
+
bundles: [...sdkPredefinedProfile.bundles],
|
|
228
|
+
variables: [],
|
|
229
|
+
hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
|
|
230
|
+
};
|
|
231
|
+
// Merge the SDK variables' definitions/properties with the predefined profile definitions.
|
|
232
|
+
sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
|
|
233
|
+
// Don't include disabled variables
|
|
234
|
+
if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// Try to get a definition from the predefined profile, for the variable that needs one.
|
|
238
|
+
const definition = predefinedProfile.definitions[predefinedVariable.name];
|
|
239
|
+
// Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
|
|
240
|
+
// despite the type checking from the switch statement.
|
|
241
|
+
switch (predefinedVariable.type) {
|
|
242
|
+
case "dictionary": {
|
|
243
|
+
// For dictionary, we support properties overrride
|
|
244
|
+
return editorProfile.variables.push(convertApiVariable({
|
|
245
|
+
...predefinedVariable,
|
|
246
|
+
type: predefinedVariable.type,
|
|
247
|
+
properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
|
|
248
|
+
}));
|
|
249
|
+
}
|
|
250
|
+
case "feature":
|
|
251
|
+
// If the definition is not valid, then we don't include it.
|
|
252
|
+
if (!languageDefaultsBase.isFeatureDefinition(definition)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
256
|
+
case "featureSet":
|
|
257
|
+
// If the definition is not valid, then we don't include it.
|
|
258
|
+
if (!languageDefaultsBase.isFeatureSetDefinition(definition)) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
262
|
+
case "featureSetCollection":
|
|
263
|
+
// If the definition is not valid, then we don't include it.
|
|
264
|
+
if (!languageDefaultsBase.isFeatureSetCollectionDefinition(definition)) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
268
|
+
default:
|
|
269
|
+
return editorProfile.variables.push(convertApiVariable(predefinedVariable));
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
|
|
273
|
+
editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
|
|
274
|
+
}
|
|
275
|
+
return editorProfile;
|
|
276
|
+
}
|
|
277
|
+
// #endregion
|
|
278
|
+
|
|
279
|
+
const arcadeLanguageId = "arcade";
|
|
280
|
+
class ArcadeLanguageServiceDefaults extends languageDefaultsBase.LanguageDefaultsBase {
|
|
281
|
+
constructor() {
|
|
282
|
+
super(...arguments);
|
|
283
|
+
this._languageId = arcadeLanguageId;
|
|
284
|
+
this._languageOptions = {};
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Create an EditorProfile for the given model id using the given definition and locale.
|
|
288
|
+
* The EditorProfile is used by the the Arcade Language service as well by the cosing components.
|
|
289
|
+
* The definition can be a pre-defined profile or an editor profile definition.
|
|
290
|
+
* If the locale is not provided then the 'en' locale is used.
|
|
291
|
+
* @param modelId The model id for which to create the context.
|
|
292
|
+
* @param definition The definition to use for the model context.
|
|
293
|
+
* @param locale The locale to use for the model context.
|
|
294
|
+
* @returns The EditorProfile for the model.
|
|
295
|
+
*/
|
|
296
|
+
async setProfileForModel(modelId, definition, apiContext = { locale: "en" }) {
|
|
297
|
+
// Convert pre-defined profile to a runtime profile
|
|
298
|
+
if (languageDefaultsBase.isPredefinedProfile(definition)) {
|
|
299
|
+
definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
|
|
300
|
+
}
|
|
301
|
+
const profileStrings = await languageDefaultsBase.fetchT9nStringsBundle(apiContext.locale, index.getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
|
|
302
|
+
if (!profileStrings) {
|
|
303
|
+
throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
|
|
304
|
+
}
|
|
305
|
+
this.disposeForModel(modelId);
|
|
306
|
+
const key = this._getApiKey(modelId);
|
|
307
|
+
const editorProfile = new languageDefaultsBase.EditorProfile(definition, profileStrings);
|
|
308
|
+
this._profileMap.set(key, editorProfile);
|
|
309
|
+
const apiProfile = await arcadeEditorToApiProfile(editorProfile);
|
|
310
|
+
this.updateApiContextForModel(modelId, {
|
|
311
|
+
locale: apiContext.locale,
|
|
312
|
+
profile: apiProfile,
|
|
313
|
+
snippets: apiContext.snippets,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Set or update the Arcade language service options.
|
|
318
|
+
* @param languageOptions The language options to set.
|
|
319
|
+
*/
|
|
320
|
+
setLanguageOptions(languageOptions = {}) {
|
|
321
|
+
// Check if options have actually changed.
|
|
322
|
+
// Avoid restarting the worker when no updates.
|
|
323
|
+
// Today we only have the 'assetsPath' as a property
|
|
324
|
+
if (this._languageOptions.assetsPath === languageOptions.assetsPath) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
this._languageOptions = { ...this._languageOptions, ...languageOptions };
|
|
328
|
+
this._onDidChange.fire(this);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Gets the API library for the given model id.
|
|
332
|
+
* @param modelId The model id for which to get the API library.
|
|
333
|
+
* @returns The API library for the model.
|
|
334
|
+
*/
|
|
335
|
+
async getApiLibrary(modelId) {
|
|
336
|
+
const uri = languageDefaultsBase.Uri.parse(modelId);
|
|
337
|
+
const worker = await getArcadeWorker(uri);
|
|
338
|
+
return await worker.getApiLibrary(this.getApiContextForModel(uri));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const arcadeDefaults = new ArcadeLanguageServiceDefaults();
|
|
342
|
+
const arcade = {
|
|
343
|
+
setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults),
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
exports.arcade = arcade;
|
|
347
|
+
exports.arcadeDefaults = arcadeDefaults;
|
|
348
|
+
exports.getArcadeDiagnosticService = getArcadeDiagnosticService;
|
|
349
|
+
exports.getMode = getMode;
|
package/dist/cjs/{arcade-language-features-747fb1da.js → arcade-language-features-5c4510c9.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
9
9
|
|
|
10
10
|
//#region Diagnostic
|
|
11
11
|
class DiagnosticsAdapter {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
const arcadeLanguageFeatures = require('./arcade-language-features-
|
|
10
|
-
require('./index-37a86ff4.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
9
|
+
const arcadeLanguageFeatures = require('./arcade-language-features-5c4510c9.js');
|
|
11
10
|
|
|
12
11
|
var V={False:"false",Null:"null",True:"true"},f={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Ee=["++","--"],Je=["-","+","!","~"],Qe=["=","/=","*=","%=","+=","-="],Ze=["||","&&"],Lt=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"];var U=[[],[],[]];Ee.forEach(t=>U[t.length-1]?.push(t));Je.forEach(t=>U[t.length-1]?.push(t));Ze.forEach(t=>U[t.length-1]?.push(t));Qe.forEach(t=>U[t.length-1]?.push(t));Lt.forEach(t=>U[t.length-1]?.push(t));var ft=Object.values(f),gt=Object.values(V);gt.map(t=>({label:t,kind:languageDefaultsBase.main.exports.CompletionItemKind.Constant}));ft.map(t=>({label:t,kind:languageDefaultsBase.main.exports.CompletionItemKind.Keyword}));
|
|
13
12
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
12
|
-
const sqlExprDefaults = require('./sql-expr-defaults-
|
|
13
|
-
const arcadeDefaults = require('./arcade-defaults-
|
|
10
|
+
const index = require('./index-1cf75f2d.js');
|
|
11
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
12
|
+
const sqlExprDefaults = require('./sql-expr-defaults-a1d5380d.js');
|
|
13
|
+
const arcadeDefaults = require('./arcade-defaults-b1300c3f.js');
|
|
14
14
|
|
|
15
15
|
const DevelopersWebSitePath = "https://developers.arcgis.com/arcade/";
|
|
16
16
|
const MaxArrayItems = 100;
|
|
@@ -4193,7 +4193,7 @@ languageDefaultsBase.languages.onLanguage(arcadeDefaults.arcadeDefaults.language
|
|
|
4193
4193
|
* @returns sql-expression mode module
|
|
4194
4194
|
*/
|
|
4195
4195
|
async function getMode() {
|
|
4196
|
-
return await Promise.resolve().then(function () { return require('./sql-expr-mode-
|
|
4196
|
+
return await Promise.resolve().then(function () { return require('./sql-expr-mode-19618e11.js'); });
|
|
4197
4197
|
}
|
|
4198
4198
|
// Register the language in Monaco
|
|
4199
4199
|
languageDefaultsBase.languages.register({
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const appGlobals = require('./app-globals-
|
|
10
|
+
const index = require('./index-1cf75f2d.js');
|
|
11
|
+
const appGlobals = require('./app-globals-d8d56a70.js');
|
|
12
12
|
|
|
13
13
|
/*
|
|
14
14
|
Stencil Client Patch Browser v4.17.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const sqlExprDefaults = require('./sql-expr-defaults-
|
|
12
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
10
|
+
const index = require('./index-1cf75f2d.js');
|
|
11
|
+
const sqlExprDefaults = require('./sql-expr-defaults-a1d5380d.js');
|
|
12
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
13
13
|
|
|
14
14
|
const sqlExpressionEditorCss = "arcgis-sql-expression-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:1px solid var(--calcite-color-border-3);box-sizing:border-box;background-color:var(--calcite-color-foreground-1);height:100%}arcgis-sql-expression-editor .flex-adjustable{flex:1 1 auto;overflow:hidden}arcgis-sql-expression-editor .flex-panel{flex:1 0 auto}arcgis-sql-expression-editor .position-relative{position:relative}arcgis-sql-expression-editor .flex-row{display:flex;flex-direction:row;overflow:hidden}arcgis-sql-expression-editor .flex-column{display:flex;flex-direction:column;overflow:hidden}arcgis-sql-expression-editor .border-inline-start{border-inline-start:1px solid var(--calcite-color-border-3);box-sizing:border-box}arcgis-sql-expression-editor .border-inline-end{border-inline-end:1px solid var(--calcite-color-border-3);box-sizing:border-box}arcgis-sql-expression-editor .side-action-bar{max-width:25%}arcgis-sql-expression-editor .side-panel{max-width:45%;width:600px}arcgis-sql-expression-editor .side-panel calcite-flow{height:100%}";
|
|
15
15
|
const ArcgisSqlExpressionEditorStyle0 = sqlExpressionEditorCss;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const sqlExprDefaults = require('./sql-expr-defaults-
|
|
12
|
-
require('./language-defaults-base-
|
|
10
|
+
const index = require('./index-1cf75f2d.js');
|
|
11
|
+
const sqlExprDefaults = require('./sql-expr-defaults-a1d5380d.js');
|
|
12
|
+
require('./language-defaults-base-2b2f9d3e.js');
|
|
13
13
|
|
|
14
14
|
const sqlExpressionFieldsCss = ":host calcite-flow{height:100%}:host calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}";
|
|
15
15
|
const ArcgisSqlExpressionFieldsStyle0 = sqlExpressionFieldsCss;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
require('./index-37a86ff4.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
10
9
|
|
|
11
10
|
/*!-----------------------------------------------------------------------------
|
|
12
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
require('./index-37a86ff4.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
10
9
|
|
|
11
10
|
/*!-----------------------------------------------------------------------------
|
|
12
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
require('./index-37a86ff4.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
10
9
|
|
|
11
10
|
/*!-----------------------------------------------------------------------------
|
|
12
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const arcadeDefaults = require('./arcade-defaults-
|
|
11
|
-
require('./language-defaults-base-
|
|
12
|
-
require('./index-
|
|
10
|
+
const arcadeDefaults = require('./arcade-defaults-b1300c3f.js');
|
|
11
|
+
require('./language-defaults-base-2b2f9d3e.js');
|
|
12
|
+
require('./index-1cf75f2d.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const typescript = require('./typescript-
|
|
9
|
-
require('./language-defaults-base-
|
|
10
|
-
require('./index-37a86ff4.js');
|
|
8
|
+
const typescript = require('./typescript-c3d83864.js');
|
|
9
|
+
require('./language-defaults-base-2b2f9d3e.js');
|
|
11
10
|
|
|
12
11
|
/*!-----------------------------------------------------------------------------
|
|
13
12
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.11
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
require('./index-37a86ff4.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
|
|
10
9
|
|
|
11
10
|
/*!-----------------------------------------------------------------------------
|
|
12
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|