@arcgis/coding-components 5.1.0-next.88 → 5.1.0-next.89

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.
Files changed (91) hide show
  1. package/dist/cdn/3VRELPEF.js +2 -0
  2. package/dist/cdn/4B64NBIM.js +2 -0
  3. package/dist/cdn/5DAIGIIS.js +2 -0
  4. package/dist/cdn/6EKA3H3N.js +2 -0
  5. package/dist/cdn/6G5URSC7.js +2 -0
  6. package/dist/cdn/{BVNLUX5A.js → 6HL5GBWZ.js} +1 -1
  7. package/dist/cdn/7B33SKQD.js +2 -0
  8. package/dist/cdn/{GJMI6M3I.js → BA546EMZ.js} +1 -1
  9. package/dist/cdn/{2PRSVBDA.js → BKBBI4SA.js} +1 -1
  10. package/dist/cdn/BQISDYES.js +2 -0
  11. package/dist/cdn/E3TJIEWT.js +2 -0
  12. package/dist/cdn/FEYQMPLI.js +2 -0
  13. package/dist/cdn/GLJQQLP2.js +2 -0
  14. package/dist/cdn/{4I7VT4LW.js → I22MLDO4.js} +1 -1
  15. package/dist/cdn/ID3QICBM.js +4 -0
  16. package/dist/cdn/IIER7Z56.js +2 -0
  17. package/dist/cdn/{LWXQURWG.js → ILQJDTTW.js} +1 -1
  18. package/dist/cdn/JIBWBXDI.js +3 -0
  19. package/dist/cdn/{KEROXLGY.js → JT3FBAVQ.js} +1 -1
  20. package/dist/cdn/KA5TX72B.js +64 -0
  21. package/dist/cdn/MC6EICRD.js +2 -0
  22. package/dist/cdn/MJ7MJPGA.js +2 -0
  23. package/dist/cdn/MTIHPCIF.js +2 -0
  24. package/dist/cdn/N75AXIUZ.js +2 -0
  25. package/dist/cdn/NEIT2PGG.js +2 -0
  26. package/dist/cdn/{N7KYUPBV.js → NK5J27LM.js} +1 -1
  27. package/dist/cdn/NKJUJKFG.js +2 -0
  28. package/dist/cdn/NZDJGAT2.js +2 -0
  29. package/dist/cdn/{JHVMGSI2.js → OI3DH7N2.js} +1 -1
  30. package/dist/cdn/QMNQFBIA.js +4 -0
  31. package/dist/cdn/{INPMAY4D.js → SM3MA3KP.js} +1 -1
  32. package/dist/cdn/SMAQD57G.js +2 -0
  33. package/dist/cdn/{6XDEGPYR.js → UOQZCTHQ.js} +1 -1
  34. package/dist/cdn/{QOX2FNYP.js → VA6SZILK.js} +1 -1
  35. package/dist/cdn/VKNLGQFU.js +2 -0
  36. package/dist/cdn/{YLJUOSJJ.js → XBM4ZDJT.js} +1 -1
  37. package/dist/cdn/YVF4PPDB.js +2 -0
  38. package/dist/cdn/assets/arcade-debugger-console/t9n/messages.en.json +1 -0
  39. package/dist/cdn/assets/arcade-debugger-output/t9n/messages.en.json +1 -0
  40. package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
  41. package/dist/cdn/index.js +1 -1
  42. package/dist/chunks/ArcadeDebuggerPreviewTabsState.js +178 -0
  43. package/dist/chunks/arcade-executor.js +76 -67
  44. package/dist/chunks/arcade-service-accessors.js +2 -2
  45. package/dist/chunks/colorize.js +9 -9
  46. package/dist/chunks/debugger-value-components.js +275 -0
  47. package/dist/chunks/debugger-value-styles.js +171 -0
  48. package/dist/chunks/functional.js +83 -0
  49. package/dist/chunks/setup-monaco-theme.js +1 -1
  50. package/dist/chunks/utilities.js +44 -34
  51. package/dist/components/arcgis-arcade-debugger-console/customElement.js +201 -0
  52. package/dist/components/arcgis-arcade-debugger-console/index.js +11 -0
  53. package/dist/components/arcgis-arcade-debugger-output/customElement.js +42 -0
  54. package/dist/components/arcgis-arcade-debugger-output/index.js +5 -0
  55. package/dist/components/arcgis-arcade-editor/customElement.d.ts +34 -1
  56. package/dist/components/arcgis-arcade-editor/customElement.js +639 -111
  57. package/dist/components/arcgis-arcade-editor/index.js +2 -0
  58. package/dist/components/arcgis-arcade-results/customElement.js +52 -155
  59. package/dist/components/arcgis-code-editor/customElement.js +1 -1
  60. package/dist/components/arcgis-code-editor-shell/customElement.d.ts +2 -1
  61. package/dist/components/arcgis-code-editor-shell/customElement.js +17 -8
  62. package/dist/components/arcgis-code-viewer/customElement.d.ts +28 -1
  63. package/dist/components/arcgis-code-viewer/customElement.js +65 -52
  64. package/dist/docs/api.json +1 -1
  65. package/dist/docs/docs.json +1 -1
  66. package/dist/docs/vscode.html-custom-data.json +1 -1
  67. package/dist/docs/web-types.json +1 -1
  68. package/dist/loader.js +5 -3
  69. package/dist/types/lumina.d.ts +2 -2
  70. package/dist/types/preact.d.ts +2 -2
  71. package/dist/types/react.d.ts +2 -2
  72. package/dist/types/stencil.d.ts +2 -2
  73. package/dist/utils/arcade-executor.d.ts +2 -1
  74. package/package.json +5 -5
  75. package/dist/cdn/3GNGWLOI.js +0 -2
  76. package/dist/cdn/3UZ3JCYW.js +0 -4
  77. package/dist/cdn/43A7UCSS.js +0 -2
  78. package/dist/cdn/4Y64BGY2.js +0 -2
  79. package/dist/cdn/BGQRJR32.js +0 -2
  80. package/dist/cdn/CPJ4MNMY.js +0 -2
  81. package/dist/cdn/G2Z2DNVW.js +0 -2
  82. package/dist/cdn/ISAWP6I3.js +0 -2
  83. package/dist/cdn/IVNVT7UT.js +0 -2
  84. package/dist/cdn/KD7MZWFX.js +0 -2
  85. package/dist/cdn/MSV4QVR2.js +0 -2
  86. package/dist/cdn/PX32GRG7.js +0 -2
  87. package/dist/cdn/QRXX4WHP.js +0 -3
  88. package/dist/cdn/T4G2IY4F.js +0 -2
  89. package/dist/cdn/TTOHS2DV.js +0 -11
  90. package/dist/cdn/VUYXKN7I.js +0 -2
  91. package/dist/cdn/YMEY2NOQ.js +0 -4
@@ -0,0 +1,275 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import { html as c } from "lit";
3
+ import { safeClassMap as M } from "@arcgis/lumina";
4
+ import { t as w } from "./debugger-value-styles.js";
5
+ import { uncapitalize as j, quoteString as O } from "@arcgis/toolkit/string";
6
+ const U = /^[$A-Z_a-z][$\w]*$/u;
7
+ function D(e) {
8
+ return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
9
+ }
10
+ function H(e) {
11
+ return U.test(e);
12
+ }
13
+ function B(e) {
14
+ return typeof e == "number" ? `[${e}]` : e.startsWith("name:") ? `[name="${D(e.slice(5))}"]` : e.startsWith("id:") ? `[id="${D(e.slice(3))}"]` : H(e) ? `.${e}` : `["${D(e)}"]`;
15
+ }
16
+ function A(e, t) {
17
+ if (e[t] !== '"')
18
+ return;
19
+ let n = "", r = t + 1;
20
+ for (; r < e.length; ) {
21
+ const p = e[r];
22
+ if (p === "\\") {
23
+ if (r += 1, r >= e.length)
24
+ return;
25
+ n += e[r], r += 1;
26
+ continue;
27
+ }
28
+ if (p === '"')
29
+ return {
30
+ value: n,
31
+ nextIndex: r + 1
32
+ };
33
+ n += p, r += 1;
34
+ }
35
+ }
36
+ function J(e) {
37
+ if (!e)
38
+ return;
39
+ let t = 0;
40
+ const n = [];
41
+ for (; t < e.length && /[$A-Z_a-z0-9]/u.test(e[t]); )
42
+ t += 1;
43
+ const r = e.slice(0, t);
44
+ if (!r)
45
+ return;
46
+ for (; t < e.length; ) {
47
+ const f = e[t];
48
+ if (f === ".") {
49
+ t += 1;
50
+ const o = t;
51
+ for (; t < e.length && /[$\w]/u.test(e[t]); )
52
+ t += 1;
53
+ if (o === t)
54
+ return;
55
+ n.push(e.slice(o, t));
56
+ continue;
57
+ }
58
+ if (f !== "[")
59
+ return;
60
+ if (t += 1, /\d/u.test(e[t] ?? "")) {
61
+ const o = t;
62
+ for (; t < e.length && /\d/u.test(e[t]); )
63
+ t += 1;
64
+ if (e[t] !== "]")
65
+ return;
66
+ n.push(e.slice(o, t)), t += 1;
67
+ continue;
68
+ }
69
+ const m = e.startsWith("name=", t) ? "name" : e.startsWith("id=", t) ? "id" : void 0;
70
+ if (m) {
71
+ const o = A(e, t + m.length + 1);
72
+ if (!o || e[o.nextIndex] !== "]")
73
+ return;
74
+ n.push(`${m}:${o.value}`), t = o.nextIndex + 1;
75
+ continue;
76
+ }
77
+ const s = A(e, t);
78
+ if (!s || e[s.nextIndex] !== "]")
79
+ return;
80
+ n.push(s.value), t = s.nextIndex + 1;
81
+ }
82
+ const [p, ...a] = n;
83
+ if (p)
84
+ return {
85
+ scopeName: r,
86
+ rootName: p,
87
+ pathSegments: a
88
+ };
89
+ }
90
+ function se(e, t) {
91
+ return `${e}${B(t)}`;
92
+ }
93
+ function I(e, t) {
94
+ return e ? `${e}.${t}` : String(t);
95
+ }
96
+ function k(e, t) {
97
+ if (e)
98
+ return `${e}${B(t)}`;
99
+ }
100
+ function de(e) {
101
+ return J(e);
102
+ }
103
+ function E(e, t) {
104
+ return typeof t == "number" ? `${e}[${t}]` : `${e}.${t}`;
105
+ }
106
+ function K(e) {
107
+ return e.name ? `name:${e.name}` : `id:${e.id}`;
108
+ }
109
+ function X(e) {
110
+ return Object.entries(e).filter(([t]) => t !== "featureSet");
111
+ }
112
+ function Y(e, t) {
113
+ if (t) {
114
+ const n = t.featureSet;
115
+ return {
116
+ kind: "feature-set",
117
+ displayValue: n.arcadeType,
118
+ featureSetValue: n,
119
+ loadRequest: { kind: "schema", load: () => n.schema() },
120
+ mergedCollectionItem: t
121
+ };
122
+ }
123
+ return e.type === "feature-set" ? {
124
+ kind: "feature-set",
125
+ displayValue: e.arcadeType,
126
+ featureSetValue: e,
127
+ loadRequest: { kind: "schema", load: () => e.schema() }
128
+ } : e.type === "feature-set-collection" ? {
129
+ kind: "collection",
130
+ collectionValue: e,
131
+ displayValue: e.arcadeType,
132
+ loadRequest: { kind: "collection", load: () => e.load() }
133
+ } : null;
134
+ }
135
+ function C(e) {
136
+ return c`<calcite-tree slot=children .lines=${w.lines} .selectionMode=${w.selectionMode} .scale=${w.scale} @calciteTreeSelect=${w.oncalciteTreeSelect}>${e}</calcite-tree>`;
137
+ }
138
+ function G({ lazyTreeState: e, nodePath: t, mergedCollectionItem: n, expanded: r = !1, isMetadata: p = !1, messages: a, name: f, value: m, loadPreview: s, previewLabel: o, previewSourcePath: v, previewLoading: b = !1 }) {
139
+ const u = Y(m, n);
140
+ if (!u)
141
+ return null;
142
+ const i = e.ensureNode(t, r, u.loadRequest), g = u.kind === "feature-set" ? u.featureSetValue : void 0, $ = o ?? String(f), S = v ?? t, q = !!(s && $ && g && typeof g.querySample == "function"), d = (l) => {
143
+ l.target === l.currentTarget && e.setExpanded(t, !0, u.loadRequest);
144
+ }, h = (l) => {
145
+ l.target === l.currentTarget && e.setExpanded(t, !1, u.loadRequest);
146
+ }, y = (l) => {
147
+ l.stopPropagation(), !(!s || !$ || !g) && s({
148
+ label: $,
149
+ sourcePath: S,
150
+ value: g
151
+ });
152
+ }, N = () => c`<calcite-tree-item disabled><div class="tree-item-label"><span class="constant-value">${i.errorMessage || (a.loaderror ?? "Unable to load data.")}</span></div></calcite-tree-item>`, W = () => u.kind !== "feature-set" || !i.schemaValue ? null : x({ name: "schema", value: i.schemaValue, messages: a, path: E(t, "schema"), lazyTreeState: e }), Q = () => u.kind !== "feature-set" || !u.mergedCollectionItem ? [] : X(u.mergedCollectionItem).map(([l, V]) => x({ name: l, value: z(V), messages: a, path: E(t, l), lazyTreeState: e })), L = () => {
153
+ if (u.kind !== "feature-set")
154
+ return null;
155
+ if (!i.expanded || i.status === "loading")
156
+ return C();
157
+ const l = [];
158
+ if (i.status === "error")
159
+ l.push(N());
160
+ else {
161
+ l.push(...Q());
162
+ const V = W();
163
+ V && l.push(V);
164
+ }
165
+ return l.length ? C(l) : C();
166
+ }, Z = () => u.kind !== "collection" ? null : !i.expanded || i.status === "loading" ? C() : C(c`${i.status === "error" ? N() : null}${i.status === "loaded" ? i.collectionItems.map((l) => G({ name: l.name || l.id, mergedCollectionItem: l, messages: a, nodePath: E(t, l.id), lazyTreeState: e, value: l.featureSet, loadPreview: s, previewLabel: I(o, l.name || l.id), previewSourcePath: k(S, K(l)), previewLoading: b })) : null}`), _ = () => u.kind === "collection" ? Z() : L();
167
+ return c`<calcite-tree-item .expanded=${i.expanded} @calciteTreeItemExpand=${d} @calciteTreeItemCollapse=${h}><div class="tree-item-label">${T({ name: f, isMetadata: p })}<bdi>${u.displayValue}</bdi></div>${i.status === "loading" ? c`<calcite-loader slot=actions-end scale=s inline type=indeterminate .label=${a.loading ?? "Loading"} .text=${a.loading ?? "Loading"}></calcite-loader>` : null}${q ? c`<calcite-action slot=actions-end scale=s class="load-action" .text=${a.loadpreview ?? "Load preview"} text-enabled icon=play icon-flip-rtl .disabled=${b} @click=${y}></calcite-action>` : null}${_()}</calcite-tree-item>`;
168
+ }
169
+ function z(e) {
170
+ if (e == null)
171
+ return { type: "primitive", arcadeType: "", value: null };
172
+ switch (typeof e) {
173
+ case "boolean":
174
+ return { type: "primitive", arcadeType: "Boolean", value: e };
175
+ case "number":
176
+ return { type: "primitive", arcadeType: "Number", value: e };
177
+ case "string":
178
+ return { type: "primitive", arcadeType: "String", value: e };
179
+ default:
180
+ return { type: "primitive", arcadeType: "String", value: String(e) };
181
+ }
182
+ }
183
+ const R = "tree-item-metadata";
184
+ function T({ name: e, isMetadata: t = !1 }) {
185
+ const n = t ? `dictionary-property ${R}` : "dictionary-property", r = t ? R : void 0;
186
+ return c`<bdi class=${M(n)}>${e}</bdi><bdi class=${M(r)}>:&nbsp;</bdi>`;
187
+ }
188
+ function P({ lazyTreeState: e, path: t, expanded: n = !1, value: r, subtree: p, messages: a, onLoadPreview: f, previewLabel: m, previewSourcePath: s, previewLoading: o = !1 }) {
189
+ const v = (d) => c`<calcite-tree slot=${"children"} .lines=${w.lines} .selectionMode=${w.selectionMode} .scale=${w.scale} @calciteTreeSelect=${w.oncalciteTreeSelect}>${d}</calcite-tree>`;
190
+ if (!n)
191
+ return v();
192
+ const b = e.ensureNode(t, n), u = (d) => b.visibleChildCount >= d ? null : c`<calcite-tree-item @click=${(y) => {
193
+ y.stopPropagation(), e.showMore(t, d);
194
+ }}><div class="tree-item-label"><span class=${M(R)}>${a.showmore ?? "Show more"}</span></div></calcite-tree-item>`, i = r.expand();
195
+ if (Array.isArray(i)) {
196
+ const d = i.slice(0, b.visibleChildCount);
197
+ return v(c`${d.map((h, y) => x({ name: y, value: h, messages: a, path: `${t}[${y}]`, lazyTreeState: e, onLoadPreview: f, previewLabel: I(m, y), previewSourcePath: k(s, y), previewLoading: o }))}${u(i.length)}${x({ name: "length", value: { arcadeType: "Number", type: "primitive", value: i.length }, isMetadata: !0, messages: a, path: `${t}.length`, lazyTreeState: e })}`);
198
+ }
199
+ const g = r.arcadeType === "Feature" ? i.get("Geometry()") : void 0, $ = Math.min(b.visibleChildCount, g ? i.size - 1 : i.size), S = [];
200
+ for (const [d, h] of i.entries())
201
+ if (!(d === "Geometry()" && r.arcadeType === "Feature")) {
202
+ if (S.length >= $)
203
+ break;
204
+ S.push([d, h]);
205
+ }
206
+ const q = !!(g && b.visibleChildCount > S.length);
207
+ return v(c`${S.map(([d, h]) => x({ name: d, value: h, messages: a, path: `${t}.${d}`, lazyTreeState: e, onLoadPreview: f, previewLabel: I(m, d), previewSourcePath: k(s, d), previewLoading: o }))}${q ? x({ name: "geometry", value: g, messages: a, path: `${t}.geometry`, lazyTreeState: e, onLoadPreview: f, previewLabel: I(m, "geometry"), previewSourcePath: k(s, "geometry"), previewLoading: o }) : null}${u(i.size)}`);
208
+ }
209
+ function ee(e) {
210
+ return "expand" in e;
211
+ }
212
+ function te(e) {
213
+ return e.type === "simple";
214
+ }
215
+ function re(e) {
216
+ return e.type === "primitive";
217
+ }
218
+ function ne(e) {
219
+ return e.type === "feature-set";
220
+ }
221
+ function ie(e) {
222
+ return e.type === "feature-set-collection";
223
+ }
224
+ function le(e) {
225
+ return ne(e) || ie(e);
226
+ }
227
+ function x({ lazyTreeState: e, path: t, name: n, value: r, messages: p, expanded: a, isMetadata: f = !1, onLoadPreview: m, previewLabel: s, previewSourcePath: o, previewLoading: v = !1 }) {
228
+ if (r === void 0)
229
+ return null;
230
+ if (r === null)
231
+ return c`<calcite-tree-item .expanded=${a}><div class="tree-item-label">${T({ name: n, isMetadata: f })}<bdi class="constant-value">null</bdi></div></calcite-tree-item>`;
232
+ if (ee(r)) {
233
+ const b = e.ensureNode(t, a), u = ($) => {
234
+ $.target === $.currentTarget && e.setExpanded(t, !0);
235
+ }, i = ($) => {
236
+ $.target === $.currentTarget && e.setExpanded(t, !1);
237
+ }, g = typeof r.arcadeType == "string" ? r.arcadeType : "unknown";
238
+ return c`<calcite-tree-item .expanded=${b.expanded} @calciteTreeItemExpand=${u} @calciteTreeItemCollapse=${i}><div class="tree-item-label">${T({ name: n, isMetadata: f })}<bdi>${j(g)}</bdi></div>${P({ expanded: b.expanded, value: r, subtree: !0, messages: p, path: t, lazyTreeState: e, onLoadPreview: m, previewLabel: s, previewSourcePath: o, previewLoading: v })}</calcite-tree-item>`;
239
+ }
240
+ return le(r) ? G({ name: n, value: r, nodePath: t, lazyTreeState: e, messages: p, expanded: a, isMetadata: f, loadPreview: m, previewLabel: s, previewSourcePath: o, previewLoading: v }) : te(r) ? c`<calcite-tree-item .expanded=${a}><div class="tree-item-label">${T({ name: n, isMetadata: f })}${F({ value: r })}</div></calcite-tree-item>` : re(r) ? c`<calcite-tree-item .expanded=${a}><div class="tree-item-label">${T({ name: n, isMetadata: f })}${F({ value: r })}</div></calcite-tree-item>` : null;
241
+ }
242
+ const F = ({ value: e }) => {
243
+ switch (e.type) {
244
+ case "primitive":
245
+ if (e.value === null)
246
+ return c`<bdi class="constant-value">null</bdi>`;
247
+ switch (e.arcadeType) {
248
+ case "String":
249
+ return c`<bdi class="string-value">${O(String(e.value))}</bdi>`;
250
+ case "Number":
251
+ return c`<bdi class="number-value">${String(e.value)}</bdi>`;
252
+ case "Boolean":
253
+ return c`<bdi class="constant-value">${String(e.value)}</bdi>`;
254
+ default:
255
+ return null;
256
+ }
257
+ case "simple":
258
+ return c`<bdi class="date-value">${e.render()}</bdi>`;
259
+ case "minimal":
260
+ return c`<bdi class="constant-value">${e.arcadeType}</bdi>`;
261
+ default:
262
+ return null;
263
+ }
264
+ };
265
+ export {
266
+ x as D,
267
+ F as S,
268
+ ie as a,
269
+ ne as b,
270
+ re as c,
271
+ te as d,
272
+ se as e,
273
+ ee as i,
274
+ de as p
275
+ };
@@ -0,0 +1,171 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import { html as a, unsafeCSS as d, css as m } from "lit";
3
+ import { nothing as y, safeClassMap as l } from "@arcgis/lumina";
4
+ import { classes as i } from "@arcgis/toolkit/dom";
5
+ import { uncapitalize as f, quoteString as c } from "@arcgis/toolkit/string";
6
+ import { f as g, a as $, b } from "./arcade-executor.js";
7
+ import { t as o } from "./monaco-theme.js";
8
+ const s = {
9
+ lines: !0,
10
+ selectionMode: "none",
11
+ scale: "s",
12
+ oncalciteTreeSelect: (e) => e.currentTarget.selectedItems.forEach((t) => t.selected = !1)
13
+ }, p = "tree-item-metadata", u = ({ name: e, isMetadata: t = !1 }) => a`<span class=${l(i("dictionary-property", t && p))}>${e}</span><span class=${l(i(t && p))}>:&nbsp;</span>`, z = ({ obj: e, subtree: t }) => a`<calcite-tree slot=${"children"} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e, void 0, 2)}</calcite-tree-item></calcite-tree>`, N = ({ value: e, subtree: t = !1 }) => a`<calcite-tree slot=${(t ? "children" : void 0) ?? y} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${u({ name: "type" })}${f(e.type)}</div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${u({ name: "value" })}<span class="string-value">${JSON.stringify(e, void 0, 2)}</span></div></calcite-tree-item></calcite-tree>`, C = ({ type: e, value: t }) => {
14
+ switch (e) {
15
+ case "unknown":
16
+ case "Unknown":
17
+ return a`<span class="constant-value">${e}</span>`;
18
+ case "null":
19
+ case "Null":
20
+ return a`<span class="constant-value">null</span>`;
21
+ case "text":
22
+ case "String":
23
+ case "Text":
24
+ return a`<span class="string-value">${c(t)}</span>`;
25
+ case "number":
26
+ case "Number":
27
+ return a`<span class="number-value">${t}</span>`;
28
+ case "boolean":
29
+ case "Boolean":
30
+ return a`<span class="constant-value">${t}</span>`;
31
+ case "date":
32
+ case "Date":
33
+ return a`<span class="date-value">${t}</span>`;
34
+ case "dateOnly":
35
+ case "DateOnly":
36
+ return a`<span class="string-value">${c(t)}</span>`;
37
+ case "time":
38
+ case "Time":
39
+ return a`<span class="string-value">${c(t)}</span>`;
40
+ case "":
41
+ return a`<span class="string-value">null</span>`;
42
+ default:
43
+ return null;
44
+ }
45
+ }, h = [
46
+ "boolean",
47
+ "date",
48
+ "dateOnly",
49
+ "null",
50
+ "number",
51
+ "text",
52
+ "time",
53
+ "unknown",
54
+ "Boolean",
55
+ "Date",
56
+ "DateOnly",
57
+ "Null",
58
+ "Number",
59
+ "Text",
60
+ // TODO only use string
61
+ "Time",
62
+ "Unknown",
63
+ "String",
64
+ ""
65
+ ], M = (e) => h.includes(e.type);
66
+ function V(e) {
67
+ switch (e.type) {
68
+ case "null":
69
+ case "unknown":
70
+ return { type: e.type, value: e.type };
71
+ case "number":
72
+ return { type: e.type, value: String(e.value) };
73
+ case "boolean":
74
+ return { type: e.type, value: String(e.value) };
75
+ case "text":
76
+ return { type: e.type, value: e.value };
77
+ case "date":
78
+ return { type: e.type, value: b(e) };
79
+ case "dateOnly":
80
+ return { type: e.type, value: $(e) };
81
+ case "time":
82
+ return { type: e.type, value: g(e) };
83
+ }
84
+ }
85
+ const S = "calcite-mode-dark";
86
+ function A() {
87
+ let e = `:host {
88
+ `;
89
+ const t = o["light-theme"];
90
+ Object.entries(t).forEach(([n, r]) => {
91
+ e += ` --arcgis-editor-${n}: ${r};
92
+ `;
93
+ }), e += `}
94
+ `, e += `:host(:state(${S})),
95
+ `, e += `:host([calcite-mode-dark]) {
96
+ `;
97
+ const v = o["dark-theme"];
98
+ return Object.entries(v).forEach(([n, r]) => {
99
+ e += `
100
+ --arcgis-editor-${n}: ${r};`;
101
+ }), e += `
102
+ }
103
+ `, m`
104
+ ${d(e)}
105
+ `;
106
+ }
107
+ const E = m`
108
+ .xs {
109
+ font-size: var(--calcite-font-size-xs);
110
+ color: var(--calcite-color-text-2);
111
+ }
112
+
113
+ .breakpoint-code {
114
+ font-size: var(--calcite-font-size--2);
115
+ }
116
+
117
+ [class*="result-value-"] {
118
+ font-size: var(--calcite-font-size--2);
119
+ background-color: var(--calcite-color-foreground-1);
120
+ }
121
+
122
+ .tree-item-label,
123
+ .number-value,
124
+ .string-value,
125
+ .boolean-value {
126
+ font-family: var(--calcite-code-family);
127
+ }
128
+
129
+ .tree-item-label,
130
+ .value-type {
131
+ color: var(--calcite-color-text-2);
132
+ font-weight: var(--calcite-font-weight-normal);
133
+ }
134
+
135
+ .tree-item-metadata {
136
+ opacity: 0.7;
137
+ }
138
+
139
+ .dictionary-property {
140
+ color: var(--arcgis-editor-identifier);
141
+ }
142
+
143
+ .number-value {
144
+ color: var(--arcgis-editor-number);
145
+ }
146
+
147
+ .string-value {
148
+ color: var(--arcgis-editor-string);
149
+ white-space: pre-wrap;
150
+ }
151
+
152
+ .constant-value {
153
+ color: var(--arcgis-editor-constant);
154
+ }
155
+
156
+ .date-value {
157
+ color: var(--arcgis-editor-date);
158
+ }
159
+ `;
160
+ export {
161
+ u as D,
162
+ N as G,
163
+ C as S,
164
+ V as a,
165
+ z as b,
166
+ S as c,
167
+ E as d,
168
+ A as g,
169
+ M as i,
170
+ s as t
171
+ };
@@ -0,0 +1,83 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import { html as r } from "lit";
3
+ import "@arcgis/lumina";
4
+ import { B as b, v as $, M as d } from "./arcade-executor.js";
5
+ import { uncapitalize as m, setValuesInString as v } from "@arcgis/toolkit/string";
6
+ import { s as g } from "./fields.js";
7
+ import "@arcgis/toolkit/function";
8
+ import { i as S, a as f, S as h, D as o, b as k, G as x } from "./debugger-value-styles.js";
9
+ const n = {
10
+ lines: !0,
11
+ selectionMode: "none",
12
+ scale: "s",
13
+ oncalciteTreeSelect: (e) => e.currentTarget.selectedItems.forEach((t) => t.selected = !1)
14
+ }, u = {
15
+ onClick: (e) => {
16
+ const t = e.currentTarget;
17
+ t.expanded = !t.expanded;
18
+ }
19
+ }, A = ({ arcadeResult: e, t9nStrings: t }) => {
20
+ const a = e.value ?? [], s = Math.max(a.length - d, 0);
21
+ return r`<span>${`${m(e.type)}(${a.length ?? 0})`}</span>${s > 0 ? r`<span>&nbsp;${v(t.showingfirstitemsformat, {
22
+ count: d.toString()
23
+ })}</span>` : null}`;
24
+ }, C = ({ value: e, subtree: t, t9nStrings: a }) => {
25
+ const s = e.geometry?.();
26
+ return r`<calcite-tree slot=${"children"} .lines=${n.lines} .selectionMode=${n.selectionMode} .scale=${n.scale} @calciteTreeSelect=${n.oncalciteTreeSelect}>${e.keys().map((c) => {
27
+ const l = $(e.field(c));
28
+ return e.arcadeDeclaredClass === "esri.arcade.Feature" && l.type === "geometry" ? null : p({ arcadeResult: l, name: c, t9nStrings: a });
29
+ })}${s ? p({ arcadeResult: { type: "geometry", value: s }, name: "geometry", t9nStrings: a }) : null}</calcite-tree>`;
30
+ }, B = ({ arcadeResult: e, t9nStrings: t }) => r`<div class="value-type"><span>${m(e.type)}:</span>${e.features.length >= b ? r`<span>&nbsp;${v(t.showingfirstitemsformat, {
31
+ count: b.toString()
32
+ })}</span>` : null}</div>`, D = ({ items: e, subtree: t, arrayLength: a = e.length, t9nStrings: s }) => r`<calcite-tree slot=${"children"} .lines=${n.lines} .selectionMode=${n.selectionMode} .scale=${n.scale} @calciteTreeSelect=${n.oncalciteTreeSelect}>${e.map((c, l) => {
33
+ const i = $(c);
34
+ return p({ arcadeResult: i, name: l, expanded: !t, t9nStrings: s });
35
+ })}${p({ arcadeResult: { type: "number", value: a }, name: "length", isMetadata: !0, t9nStrings: s })}</calcite-tree>`, p = ({ arcadeResult: e, name: t, isMetadata: a = !1, expanded: s, t9nStrings: c }) => {
36
+ switch (e.type) {
37
+ case "null":
38
+ case "unknown":
39
+ case "text":
40
+ case "number":
41
+ case "date":
42
+ case "dateOnly":
43
+ case "time":
44
+ case "boolean":
45
+ const { type: l, value: i } = f(e);
46
+ return r`<calcite-tree-item><div class="tree-item-label">${o({ name: t, isMetadata: a })}${h({ type: l, value: i })}</div></calcite-tree-item>`;
47
+ case "array": {
48
+ const y = e.value ?? [], T = y.slice(0, d);
49
+ return r`<calcite-tree-item .expanded=${s} @click=${u.onClick}><div class="tree-item-label">${o({ name: t, isMetadata: a })}${A({ arcadeResult: e, t9nStrings: c })}</div>${D({ items: T, arrayLength: y.length, subtree: !0, t9nStrings: c })}</calcite-tree-item>`;
50
+ }
51
+ case "geometry":
52
+ return r`<calcite-tree-item .expanded=${s} @click=${u.onClick}><div class="tree-item-label">${o({ name: t, isMetadata: a })}<span>${m(e.type)}</span></div>${x({ value: e.value, subtree: !0 })}</calcite-tree-item>`;
53
+ case "attachment":
54
+ return r`<calcite-tree-item .expanded=${s} @click=${u.onClick}><div class="tree-item-label">${o({ name: t, isMetadata: a })}<span>${m(e.type)}</span></div>${k({ obj: e.value.castAsJson(), subtree: !0 })}</calcite-tree-item>`;
55
+ case "feature":
56
+ case "dictionary":
57
+ case "portal":
58
+ return r`<calcite-tree-item .expanded=${s} @click=${u.onClick}><div class="tree-item-label">${o({ name: t, isMetadata: a })}<span>${m(e.type)}</span></div>${C({ value: e.value, subtree: !0, t9nStrings: c })}</calcite-tree-item>`;
59
+ default:
60
+ return null;
61
+ }
62
+ }, G = ({ arcadeResult: e }) => {
63
+ const t = g(e.value.fields);
64
+ return r`<div class="table-scroll"><table><thead><tr>${t.map((a) => r`<th>${a.name}</th>`)}</tr></thead><tbody>${e.features.map((a) => r`<tr>${t.map((s) => {
65
+ const c = $(a.field(s.name));
66
+ if (!S(c))
67
+ return r`<td></td>`;
68
+ try {
69
+ const { type: l, value: i } = f(c);
70
+ return r`<td>${h({ type: l, value: i })}</td>`;
71
+ } catch {
72
+ return r`<td></td>`;
73
+ }
74
+ })}</tr>`)}</tbody></table></div>`;
75
+ };
76
+ export {
77
+ A,
78
+ C as D,
79
+ B as F,
80
+ G as a,
81
+ D as b,
82
+ n as t
83
+ };
@@ -8,7 +8,7 @@ import "monaco-editor/esm/vs/base/browser/dom.js";
8
8
  import "monaco-editor/esm/vs/editor/browser/editorDom.js";
9
9
  import "monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js";
10
10
  import { b as t } from "./arcade-defaults.js";
11
- import { a as l } from "./arcade-service-accessors.js";
11
+ import { g as l } from "./arcade-service-accessors.js";
12
12
  import { i as d } from "./monaco-importer.js";
13
13
  import { a } from "./sql-expr-defaults.js";
14
14
  import { g as f } from "./sql-expr-service-accessors.js";
@@ -1,76 +1,76 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { createFilterExpression as d } from "@arcgis/toolkit/string";
2
+ import { createFilterExpression as c } from "@arcgis/toolkit/string";
3
3
  import { format as f } from "@arcgis/arcade-languageservice";
4
- function b(e, n, i, o) {
5
- if (!n)
4
+ function C(e, o, i, n) {
5
+ if (!o)
6
6
  return [];
7
- const t = Array.isArray(n) ? n : [n];
7
+ const t = Array.isArray(o) ? o : [o];
8
8
  if (!t.length)
9
9
  return [];
10
- const m = d(i);
11
- return e.filter((u) => t.some((a) => m.test(String(u[a] ?? ""))));
10
+ const l = c(i);
11
+ return e.filter((u) => t.some((m) => l.test(String(u[m] ?? ""))));
12
12
  }
13
- function L(e) {
13
+ function N(e) {
14
14
  return e ? `${e.portal.url}/home/item.html?id=${e.id}` : "";
15
15
  }
16
- function N(e, n, i = "add", o) {
16
+ function p(e, o, i = "add", n) {
17
17
  if (!e)
18
18
  return;
19
- const t = e.getSelection(), m = t && (t.startLineNumber !== t.endLineNumber || t.startColumn !== t.endColumn);
19
+ const t = e.getSelection(), l = t && (t.startLineNumber !== t.endLineNumber || t.startColumn !== t.endColumn);
20
20
  let u = [];
21
- const a = e.getValue() ?? "";
21
+ const m = e.getValue() ?? "";
22
22
  if (i === "replace") {
23
- const l = o ? `${o}
24
- ${n}` : n, s = e.getModel(), r = s?.getLineCount() ?? 1, c = s?.getLineMaxColumn(r) ?? 1;
23
+ const r = n ? `${n}
24
+ ${o}` : o, a = e.getModel(), s = a?.getLineCount() ?? 1, d = a?.getLineMaxColumn(s) ?? 1;
25
25
  u = [
26
26
  {
27
27
  range: {
28
28
  startLineNumber: 1,
29
29
  startColumn: 1,
30
- endLineNumber: r,
31
- endColumn: c
30
+ endLineNumber: s,
31
+ endColumn: d
32
32
  },
33
- text: l
33
+ text: r
34
34
  }
35
35
  ];
36
36
  } else {
37
- const l = m ? {
37
+ const r = l ? {
38
38
  startLineNumber: t.startLineNumber,
39
39
  startColumn: t.startColumn,
40
40
  endLineNumber: t.endLineNumber,
41
41
  endColumn: t.endColumn
42
42
  } : (() => {
43
- const r = e.getPosition();
43
+ const s = e.getPosition();
44
44
  return {
45
- startLineNumber: r?.lineNumber ?? 1,
46
- startColumn: r?.column ?? 1,
47
- endLineNumber: r?.lineNumber ?? 1,
48
- endColumn: r?.column ?? 1
45
+ startLineNumber: s?.lineNumber ?? 1,
46
+ startColumn: s?.column ?? 1,
47
+ endLineNumber: s?.lineNumber ?? 1,
48
+ endColumn: s?.column ?? 1
49
49
  };
50
50
  })();
51
- let s = !1;
52
- if (o) {
53
- const r = o.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
54
- s = !new RegExp(`^\\s*${r}\\s*$`, "mu").test(a);
51
+ let a = !1;
52
+ if (n) {
53
+ const s = n.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
54
+ a = !new RegExp(`^\\s*${s}\\s*$`, "mu").test(m);
55
55
  }
56
- s && u.push({
56
+ a && u.push({
57
57
  range: {
58
58
  startLineNumber: 1,
59
59
  startColumn: 1,
60
60
  endLineNumber: 1,
61
61
  endColumn: 1
62
62
  },
63
- text: `${o}
63
+ text: `${n}
64
64
  `
65
65
  }), u.push({
66
- range: l,
67
- text: n
66
+ range: r,
67
+ text: o
68
68
  });
69
69
  }
70
70
  try {
71
71
  e.pushUndoStop(), e.executeEdits("insertText", u), e.pushUndoStop(), e.focus();
72
- } catch (l) {
73
- console.error("Failed to edit model:", l);
72
+ } catch (r) {
73
+ console.error("Failed to edit model:", r);
74
74
  }
75
75
  }
76
76
  function x(e) {
@@ -80,9 +80,19 @@ function x(e) {
80
80
  return e;
81
81
  }
82
82
  }
83
+ const L = (e) => e.split(/\r\n|\r|\n/u).length - 1, $ = (e, o) => [...o].sort(
84
+ (i, n) => n.range.startLineNumber - i.range.startLineNumber || n.range.startColumn - i.range.startColumn
85
+ ).reduce(
86
+ (i, n) => {
87
+ const t = n.range.startLineNumber, l = n.range.endLineNumber, u = l - t, m = L(n.text) - u;
88
+ return i.flatMap((r) => r < t ? [r] : u === 0 ? [r >= t ? r + m : r] : r > l ? [r + m] : r === t ? [r] : []);
89
+ },
90
+ [...e]
91
+ );
83
92
  export {
84
93
  x as a,
85
- N as e,
86
- b as f,
87
- L as p
94
+ p as e,
95
+ C as f,
96
+ N as p,
97
+ $ as r
88
98
  };