@arcgis/coding-components 5.2.0-next.32 → 5.2.0-next.33
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/cdn/3EOAL7MF.js +6 -0
- package/dist/cdn/{YYX73IRV.js → DLHM6CVW.js} +1 -1
- package/dist/cdn/{L7T34NYP.js → N55NA6XU.js} +1 -1
- package/dist/cdn/{XSXVHUIH.js → OHGKRQIT.js} +1 -1
- package/dist/cdn/{JF5ISPMG.js → QL6XH6JU.js} +1 -1
- package/dist/cdn/{35PM76LN.js → RAQ6HDUB.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +2 -2
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/arcade-defaults.js +87 -81
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/46DUY6LF.js +0 -6
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { g as v, f as
|
|
3
|
-
import { i as h, a as L, b as k, c as E, d as I, e as C, f as
|
|
2
|
+
import { g as v, f as A, m as F, L as M, E as S } from "./language-defaults-base.js";
|
|
3
|
+
import { i as h, a as L, b as k, c as E, d as I, e as C, f as T } from "./utils.js";
|
|
4
4
|
import { supportedLocales as j, fetchT9nStringsBundle as $ } from "@arcgis/toolkit/intl";
|
|
5
|
-
import { g as
|
|
6
|
-
import { CompletionItemKind as w, InsertTextFormat as
|
|
7
|
-
import { getDeclaredPixelMembers as
|
|
5
|
+
import { g as P } from "./runtime.js";
|
|
6
|
+
import { CompletionItemKind as w, InsertTextFormat as u, InsertTextMode as f } from "vscode-languageserver-types";
|
|
7
|
+
import { getDeclaredPixelMembers as U } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
|
|
8
8
|
import "@arcgis/toolkit/type";
|
|
9
|
-
async function
|
|
10
|
-
const { apiVersion:
|
|
11
|
-
return { apiVersion:
|
|
9
|
+
async function q(e) {
|
|
10
|
+
const { apiVersion: r, bundles: t, hiddenApiItems: s } = e.toEditorProfileDefinition(), o = await b(e.dictionaryVariables.filter(T));
|
|
11
|
+
return { apiVersion: r, bundles: t, variables: o, hiddenApiItems: s?.map((a) => a.toLowerCase()) };
|
|
12
12
|
}
|
|
13
|
-
async function b(e,
|
|
13
|
+
async function b(e, r = w.Variable) {
|
|
14
14
|
return await Promise.all(
|
|
15
15
|
e.map(async (t) => {
|
|
16
16
|
switch (t.type) {
|
|
17
17
|
case "dictionary":
|
|
18
|
-
return await
|
|
18
|
+
return await z(t, r);
|
|
19
19
|
case "pixel":
|
|
20
|
-
return await
|
|
20
|
+
return await _(t, r);
|
|
21
21
|
// Voxel is equivalent to features in regards to the languageservice.
|
|
22
22
|
// They both have equivalent fields, but some voxel fields are different types (arrays)
|
|
23
23
|
// than what is reported in .fields, so in the sidebar we treat a bit differently.
|
|
24
24
|
// In autocomplete we don't differentiate types, so we can use the same logic as features.
|
|
25
25
|
case "voxel":
|
|
26
26
|
case "feature":
|
|
27
|
-
return await
|
|
27
|
+
return await K(t, r);
|
|
28
28
|
default:
|
|
29
|
-
return
|
|
29
|
+
return B(t, r);
|
|
30
30
|
}
|
|
31
31
|
})
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const { name: t, type: s } = e, o = e.getDescription(), a =
|
|
34
|
+
function B(e, r) {
|
|
35
|
+
const { name: t, type: s } = e, o = e.getDescription(), a = r === w.Field ? v(t, !1) : t;
|
|
36
36
|
return {
|
|
37
37
|
name: t,
|
|
38
38
|
description: o,
|
|
@@ -42,20 +42,20 @@ function K(e, i) {
|
|
|
42
42
|
detail: t,
|
|
43
43
|
insertText: a,
|
|
44
44
|
insertTextMode: f.asIs,
|
|
45
|
-
insertTextFormat:
|
|
46
|
-
kind:
|
|
45
|
+
insertTextFormat: u.PlainText,
|
|
46
|
+
kind: r,
|
|
47
47
|
documentation: { kind: "markdown", value: o }
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
async function
|
|
51
|
+
async function K(e, r) {
|
|
52
52
|
const t = await e.loadSource(), { name: s } = e, o = e.getDescription(), a = {
|
|
53
53
|
label: s,
|
|
54
54
|
detail: s,
|
|
55
55
|
insertText: s,
|
|
56
56
|
insertTextMode: f.asIs,
|
|
57
|
-
insertTextFormat:
|
|
58
|
-
kind:
|
|
57
|
+
insertTextFormat: u.PlainText,
|
|
58
|
+
kind: r
|
|
59
59
|
}, n = {
|
|
60
60
|
name: s,
|
|
61
61
|
description: o,
|
|
@@ -65,12 +65,12 @@ async function _(e, i) {
|
|
|
65
65
|
};
|
|
66
66
|
if (!t)
|
|
67
67
|
return n;
|
|
68
|
-
const [
|
|
68
|
+
const [i, c] = A(t.fields, o, {
|
|
69
69
|
includeAliases: !0
|
|
70
70
|
});
|
|
71
|
-
return n.properties =
|
|
71
|
+
return n.properties = i, a.documentation = { kind: "markdown", value: c }, n;
|
|
72
72
|
}
|
|
73
|
-
async function
|
|
73
|
+
async function _(e, r) {
|
|
74
74
|
const t = await e.loadSource(), s = e.toProfileVariableDefinition();
|
|
75
75
|
if (s.type !== "pixel")
|
|
76
76
|
throw new Error("Incorrect definition passed to pixel variable");
|
|
@@ -79,9 +79,9 @@ async function z(e, i) {
|
|
|
79
79
|
detail: o,
|
|
80
80
|
insertText: o,
|
|
81
81
|
insertTextMode: f.asIs,
|
|
82
|
-
insertTextFormat:
|
|
83
|
-
kind:
|
|
84
|
-
},
|
|
82
|
+
insertTextFormat: u.PlainText,
|
|
83
|
+
kind: r
|
|
84
|
+
}, i = {
|
|
85
85
|
name: o,
|
|
86
86
|
description: a,
|
|
87
87
|
type: "dictionary",
|
|
@@ -89,17 +89,17 @@ async function z(e, i) {
|
|
|
89
89
|
completion: n
|
|
90
90
|
};
|
|
91
91
|
if (!t || !s.definition)
|
|
92
|
-
return
|
|
93
|
-
const c = await
|
|
94
|
-
return
|
|
92
|
+
return i;
|
|
93
|
+
const c = await U(t), [d, l] = F(c, a);
|
|
94
|
+
return i.properties = d, n.documentation = { kind: "markdown", value: l }, i;
|
|
95
95
|
}
|
|
96
|
-
async function
|
|
97
|
-
const { name: t, dictionaryVariables: s } = e, o = e.getDescription(), a = s.reduce((n,
|
|
96
|
+
async function z(e, r) {
|
|
97
|
+
const { name: t, dictionaryVariables: s } = e, o = e.getDescription(), a = s.reduce((n, i) => {
|
|
98
98
|
n !== "" && (n += `
|
|
99
99
|
|
|
100
|
-
`), n += `**${
|
|
101
|
-
${
|
|
102
|
-
const c =
|
|
100
|
+
`), n += `**${i.name}**
|
|
101
|
+
${i.type}`;
|
|
102
|
+
const c = i.getDescription();
|
|
103
103
|
return c && (n += `
|
|
104
104
|
${c}`), n;
|
|
105
105
|
}, o);
|
|
@@ -108,73 +108,74 @@ ${c}`), n;
|
|
|
108
108
|
description: o,
|
|
109
109
|
type: "dictionary",
|
|
110
110
|
// TODO(editor-profile): remove filter once we have a arcade-specific editor profile type that doesn't include SQL-layer-specific variables.
|
|
111
|
-
properties: await b(s.filter(
|
|
111
|
+
properties: await b(s.filter(T), w.Field),
|
|
112
112
|
completion: {
|
|
113
113
|
label: t,
|
|
114
114
|
detail: t,
|
|
115
115
|
insertText: t,
|
|
116
116
|
insertTextMode: f.asIs,
|
|
117
|
-
insertTextFormat:
|
|
118
|
-
kind:
|
|
117
|
+
insertTextFormat: u.PlainText,
|
|
118
|
+
kind: r,
|
|
119
119
|
documentation: { kind: "markdown", value: a }
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
async function y(e = "en") {
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
return
|
|
124
|
+
const r = x.get(e);
|
|
125
|
+
if (r)
|
|
126
|
+
return r;
|
|
127
127
|
if (!j.has(e))
|
|
128
128
|
return await y("en");
|
|
129
129
|
try {
|
|
130
|
-
const t = await fetch(
|
|
131
|
-
return t.ok ?
|
|
130
|
+
const t = await fetch(P(`./assets/arcade-language/profiles/arcade-profiles.t9n.${e}.json`));
|
|
131
|
+
return t.ok ? O(e, await t.json()) : e === "en" ? null : await y("en");
|
|
132
132
|
} catch {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
const x = /* @__PURE__ */ new Map();
|
|
137
|
-
function
|
|
137
|
+
function O(e, r) {
|
|
138
138
|
const t = /* @__PURE__ */ new Map();
|
|
139
|
-
return
|
|
139
|
+
return r.forEach((s) => {
|
|
140
140
|
t.set(s.id, s);
|
|
141
141
|
}), x.set(e, t), t;
|
|
142
142
|
}
|
|
143
|
-
async function
|
|
144
|
-
return (await y(
|
|
143
|
+
async function Q(e, r = "en") {
|
|
144
|
+
return (await y(r))?.get(e) ?? null;
|
|
145
145
|
}
|
|
146
146
|
function G(e) {
|
|
147
147
|
return !!e && typeof e == "object" && "additionalVariables" in e && Array.isArray(e.additionalVariables);
|
|
148
148
|
}
|
|
149
|
-
function H(e) {
|
|
150
|
-
return e?.map(m);
|
|
149
|
+
function H(e, r) {
|
|
150
|
+
return e?.map((t) => m(t, r));
|
|
151
151
|
}
|
|
152
|
-
function m(e) {
|
|
152
|
+
function m(e, r) {
|
|
153
153
|
switch (e.type) {
|
|
154
154
|
case "dictionary":
|
|
155
155
|
return {
|
|
156
156
|
...e,
|
|
157
157
|
type: e.type,
|
|
158
|
-
properties: H(e.properties)
|
|
158
|
+
properties: H(e.properties, r)
|
|
159
159
|
};
|
|
160
160
|
case "array":
|
|
161
161
|
return {
|
|
162
162
|
...e,
|
|
163
163
|
type: e.type,
|
|
164
|
-
|
|
164
|
+
// TODO(5.2): Remove conversion options from the function signatures, its a safety net for a last minute patch. See issue #17618
|
|
165
|
+
...r?.allowUserArrayElementTypes ? {} : { elementType: { type: "number", name: "number" } }
|
|
165
166
|
};
|
|
166
167
|
default:
|
|
167
168
|
return { ...e, type: e.type };
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
|
-
async function J(e,
|
|
171
|
+
async function J(e, r = "en") {
|
|
171
172
|
if (!h(e))
|
|
172
173
|
return;
|
|
173
|
-
const t = await
|
|
174
|
+
const t = await Q(e.id, r);
|
|
174
175
|
if (!t)
|
|
175
176
|
return;
|
|
176
177
|
const s = e.definitions, o = new Map(
|
|
177
|
-
Object.entries(s).map(([n,
|
|
178
|
+
Object.entries(s).map(([n, i]) => [n.toLowerCase(), i])
|
|
178
179
|
), a = {
|
|
179
180
|
bundles: [...t.bundles],
|
|
180
181
|
variables: [],
|
|
@@ -183,26 +184,31 @@ async function J(e, i = "en") {
|
|
|
183
184
|
return t.variables.forEach((n) => {
|
|
184
185
|
if (e.disabledVariables?.includes(n.name))
|
|
185
186
|
return;
|
|
186
|
-
const
|
|
187
|
+
const i = o.get(n.name.toLowerCase());
|
|
187
188
|
switch (n.type) {
|
|
188
189
|
case "dictionary":
|
|
189
190
|
return a.variables.push(
|
|
190
|
-
m(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
m(
|
|
192
|
+
{
|
|
193
|
+
...n,
|
|
194
|
+
type: n.type,
|
|
195
|
+
properties: Array.isArray(i) ? [...i] : n.properties
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
allowUserArrayElementTypes: e.id === "data-pipelines"
|
|
199
|
+
}
|
|
200
|
+
)
|
|
195
201
|
);
|
|
196
202
|
case "feature":
|
|
197
|
-
return C(
|
|
203
|
+
return C(i) ? a.variables.push({ ...n, type: "feature", definition: i }) : void 0;
|
|
198
204
|
case "pixel":
|
|
199
|
-
return I(
|
|
205
|
+
return I(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
|
|
200
206
|
case "voxel":
|
|
201
|
-
return E(
|
|
207
|
+
return E(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
|
|
202
208
|
case "featureSet":
|
|
203
|
-
return k(
|
|
209
|
+
return k(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
|
|
204
210
|
case "featureSetCollection":
|
|
205
|
-
return L(
|
|
211
|
+
return L(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
|
|
206
212
|
default:
|
|
207
213
|
return a.variables.push(m(n));
|
|
208
214
|
}
|
|
@@ -230,7 +236,7 @@ const W = {
|
|
|
230
236
|
R(e)
|
|
231
237
|
)
|
|
232
238
|
};
|
|
233
|
-
class X extends
|
|
239
|
+
class X extends M {
|
|
234
240
|
/**
|
|
235
241
|
* Per-model update chaining to serialize profile updates.
|
|
236
242
|
*
|
|
@@ -261,40 +267,40 @@ class X extends S {
|
|
|
261
267
|
* @param locale The locale to use for the model context.
|
|
262
268
|
* @returns The EditorProfile for the model.
|
|
263
269
|
*/
|
|
264
|
-
async setProfileForModel(
|
|
265
|
-
const o = this._getApiKey(
|
|
270
|
+
async setProfileForModel(r, t, s = { locale: "en" }) {
|
|
271
|
+
const o = this._getApiKey(r), n = (this.#e.get(o) || Promise.resolve()).then(async () => {
|
|
266
272
|
const c = t, d = h(c) ? await J(c, s.locale) : c, l = await $(
|
|
267
273
|
s.locale,
|
|
268
|
-
|
|
274
|
+
P("./assets/editor-profile/t9n"),
|
|
269
275
|
"messages."
|
|
270
276
|
);
|
|
271
277
|
if (!l)
|
|
272
278
|
throw new Error(`Failed to load the language bundle for ${s.locale}`);
|
|
273
|
-
this.disposeForModel(
|
|
274
|
-
const g = new
|
|
279
|
+
this.disposeForModel(r);
|
|
280
|
+
const g = new S(
|
|
275
281
|
d,
|
|
276
282
|
l,
|
|
277
283
|
s.locale,
|
|
278
284
|
W
|
|
279
285
|
);
|
|
280
286
|
this._modelToProfileMap.set(o, g);
|
|
281
|
-
const D = await
|
|
282
|
-
this.updateApiContextForModel(
|
|
287
|
+
const D = await q(g);
|
|
288
|
+
this.updateApiContextForModel(r, {
|
|
283
289
|
locale: s.locale,
|
|
284
290
|
profile: D,
|
|
285
291
|
snippets: s.snippets
|
|
286
292
|
});
|
|
287
|
-
}),
|
|
288
|
-
this.#e.get(o) ===
|
|
293
|
+
}), i = n.finally(() => {
|
|
294
|
+
this.#e.get(o) === i && this.#e.delete(o);
|
|
289
295
|
});
|
|
290
|
-
return this.#e.set(o,
|
|
296
|
+
return this.#e.set(o, i), await n;
|
|
291
297
|
}
|
|
292
298
|
}
|
|
293
|
-
const
|
|
294
|
-
setProfileForModel:
|
|
295
|
-
getApiLibraryForModel:
|
|
299
|
+
const p = new X(), ie = {
|
|
300
|
+
setProfileForModel: p.setProfileForModel.bind(p),
|
|
301
|
+
getApiLibraryForModel: p.getApiLibraryForModel.bind(p)
|
|
296
302
|
};
|
|
297
303
|
export {
|
|
298
|
-
|
|
299
|
-
|
|
304
|
+
ie as a,
|
|
305
|
+
p as b
|
|
300
306
|
};
|