@arcgis/coding-components 5.1.0-next.105 → 5.1.0-next.107
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/2CBDII2T.js +2 -0
- package/dist/cdn/3LHMOBGC.js +2 -0
- package/dist/cdn/{363GMMQ6.js → 5S2GF6U4.js} +1 -1
- package/dist/cdn/{TCLNQ7Z6.js → 66CFQA7G.js} +1 -1
- package/dist/cdn/{TSZHSRGH.js → 6DAYEZO3.js} +1 -1
- package/dist/cdn/{GZ6HZKQZ.js → AZR47E7L.js} +1 -1
- package/dist/cdn/CK7ERP6J.js +2 -0
- package/dist/cdn/{NWLOXWV6.js → DWYZXGBU.js} +1 -1
- package/dist/cdn/{GPIFJKPY.js → DX64LARM.js} +1 -1
- package/dist/cdn/E5OXH2IV.js +2 -0
- package/dist/cdn/{CHTL74L2.js → ETVSINLC.js} +1 -1
- package/dist/cdn/{G56LJGLK.js → HLDSPJ74.js} +1 -1
- package/dist/cdn/HUJVXIUS.js +2 -0
- package/dist/cdn/{PPV6RAZ3.js → IC45T3XF.js} +1 -1
- package/dist/cdn/{GHTOL7NB.js → KV35R64B.js} +1 -1
- package/dist/cdn/{GVMVHGSK.js → LT4IXMHV.js} +1 -1
- package/dist/cdn/MNHNQABP.js +4 -0
- package/dist/cdn/{OGS4AWC2.js → NMT25LRW.js} +1 -1
- package/dist/cdn/{NOHSS7JG.js → Q7MSRF5V.js} +1 -1
- package/dist/cdn/{P7I5ATMN.js → UN7LGHT2.js} +1 -1
- package/dist/cdn/{SATQDL5P.js → XDJFQDE6.js} +1 -1
- package/dist/cdn/{WL2QW4SI.js → ZSFJLQXB.js} +1 -1
- package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/arcade.worker.js +2 -5
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +2440 -2410
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/arcade-mode.js +174 -142
- package/dist/chunks/sql-expr-defaults.js +97 -75
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +24 -13
- package/dist/components/arcgis-arcade-editor/customElement.d.ts +33 -1
- package/dist/components/arcgis-arcade-editor/customElement.js +311 -184
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +4 -4
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/arcade-executor.d.ts +44 -1
- package/package.json +5 -5
- package/dist/cdn/BWQEBSSL.js +0 -4
- package/dist/cdn/JQQBQXPD.js +0 -2
- package/dist/cdn/SKTKTWIV.js +0 -2
- package/dist/cdn/WP6BSOSW.js +0 -2
- package/dist/cdn/YJW6NUWX.js +0 -2
|
@@ -1,115 +1,137 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { i as c, b as
|
|
3
|
-
import { CompletionItemKind as
|
|
4
|
-
import { f as
|
|
2
|
+
import { i as c, b as h } from "./utils.js";
|
|
3
|
+
import { CompletionItemKind as m, InsertTextFormat as g, InsertTextMode as b } from "vscode-languageserver-types";
|
|
4
|
+
import { f as x, L as F, E } from "./language-defaults-base.js";
|
|
5
5
|
import { fetchT9nStringsBundle as M } from "@arcgis/toolkit/intl";
|
|
6
|
-
import { g as
|
|
7
|
-
const
|
|
8
|
-
|
|
6
|
+
import { g as w } from "./runtime.js";
|
|
7
|
+
const v = {
|
|
8
|
+
allowAllRootBinaryOperators: !1,
|
|
9
|
+
requiresPredicateRootNode: !1
|
|
10
|
+
}, d = {
|
|
11
|
+
"field-calculation": v,
|
|
12
|
+
"where-clause": {
|
|
13
|
+
allowAllRootBinaryOperators: !0,
|
|
14
|
+
requiresPredicateRootNode: !0
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function A(o) {
|
|
18
|
+
return o && o in d ? d[o] : void 0;
|
|
19
|
+
}
|
|
20
|
+
const q = (o) => {
|
|
21
|
+
const i = o.variables[0], e = i?.type === "featureSet" ? T(i) : void 0, { apiVersion: t, bundles: r, hiddenApiItems: s } = o.toEditorProfileDefinition();
|
|
9
22
|
return {
|
|
10
|
-
apiVersion:
|
|
11
|
-
bundles:
|
|
12
|
-
variables:
|
|
23
|
+
apiVersion: t,
|
|
24
|
+
bundles: r,
|
|
25
|
+
variables: e ? [e] : [],
|
|
13
26
|
hiddenApiItems: s?.map((a) => a.toLowerCase())
|
|
14
27
|
};
|
|
15
28
|
};
|
|
16
|
-
function
|
|
17
|
-
const { name:
|
|
18
|
-
label:
|
|
19
|
-
detail:
|
|
20
|
-
insertText:
|
|
21
|
-
insertTextMode:
|
|
22
|
-
insertTextFormat:
|
|
23
|
-
kind:
|
|
29
|
+
function T(o) {
|
|
30
|
+
const { name: i } = o, e = o.getDescription(), { definition: t } = o.toProfileVariableDefinition(), r = {
|
|
31
|
+
label: i,
|
|
32
|
+
detail: i,
|
|
33
|
+
insertText: i,
|
|
34
|
+
insertTextMode: b.asIs,
|
|
35
|
+
insertTextFormat: g.PlainText,
|
|
36
|
+
kind: m.Field
|
|
24
37
|
}, s = {
|
|
25
|
-
name:
|
|
26
|
-
description:
|
|
38
|
+
name: i,
|
|
39
|
+
description: e,
|
|
27
40
|
type: "dictionary",
|
|
28
41
|
properties: [],
|
|
29
|
-
completion:
|
|
42
|
+
completion: r
|
|
30
43
|
};
|
|
31
|
-
if (!
|
|
44
|
+
if (!t || !("fields" in t))
|
|
32
45
|
return s;
|
|
33
|
-
const [a, l] =
|
|
34
|
-
return s.properties = a,
|
|
46
|
+
const [a, l] = x(t.fields, e);
|
|
47
|
+
return s.properties = a, r.documentation = { kind: "markdown", value: l }, s;
|
|
35
48
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
const u = [
|
|
50
|
+
{
|
|
51
|
+
name: "$layer",
|
|
52
|
+
type: "featureSet",
|
|
53
|
+
description: "The layer being calculated."
|
|
54
|
+
}
|
|
55
|
+
], D = {
|
|
56
|
+
"field-calculation": {
|
|
57
|
+
id: "field-calculation",
|
|
58
|
+
variables: u
|
|
59
|
+
},
|
|
60
|
+
"where-clause": {
|
|
61
|
+
id: "where-clause",
|
|
62
|
+
variables: u
|
|
63
|
+
}
|
|
45
64
|
};
|
|
46
|
-
function
|
|
47
|
-
return
|
|
65
|
+
function L(o) {
|
|
66
|
+
return D[o] ?? null;
|
|
48
67
|
}
|
|
49
|
-
function
|
|
50
|
-
if (!c(
|
|
68
|
+
function S(o) {
|
|
69
|
+
if (!c(o))
|
|
51
70
|
return;
|
|
52
|
-
const
|
|
71
|
+
const i = L(
|
|
72
|
+
o.id
|
|
53
73
|
/*locale*/
|
|
54
74
|
);
|
|
55
|
-
if (!
|
|
75
|
+
if (!i)
|
|
56
76
|
return;
|
|
57
|
-
const
|
|
77
|
+
const e = {
|
|
58
78
|
variables: [],
|
|
59
|
-
hiddenApiItems:
|
|
79
|
+
hiddenApiItems: o.hiddenApiItems?.map((t) => t.toLowerCase())
|
|
60
80
|
};
|
|
61
|
-
return
|
|
62
|
-
if (
|
|
81
|
+
return i.variables.forEach((t) => {
|
|
82
|
+
if (o.disabledVariables?.includes(t.name))
|
|
63
83
|
return;
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
67
|
-
throw Error(`sdkVariable type not supported (yet) type: ${
|
|
68
|
-
}),
|
|
84
|
+
const r = o.definitions[t.name];
|
|
85
|
+
if (t.type === "featureSet")
|
|
86
|
+
return h(r) ? e.variables.push({ ...t, type: t.type, definition: r }) : void 0;
|
|
87
|
+
throw Error(`sdkVariable type not supported (yet) type: ${t.type}`);
|
|
88
|
+
}), e;
|
|
69
89
|
}
|
|
70
|
-
const
|
|
71
|
-
class
|
|
90
|
+
const f = "arcgis-sql-expression";
|
|
91
|
+
class _ extends F {
|
|
72
92
|
constructor() {
|
|
73
|
-
super(
|
|
93
|
+
super(f, {
|
|
74
94
|
apiPath: "./assets/sql-language/api",
|
|
75
95
|
apiPrefix: "sql-api.t9n."
|
|
76
|
-
}), this._languageId =
|
|
96
|
+
}), this._languageId = f, this._layerMap = /* @__PURE__ */ new Map();
|
|
77
97
|
}
|
|
78
98
|
// TODO: try to rely on editor profile instance instead of storing a feature layer
|
|
79
|
-
updateFeatureLayerForModel(
|
|
80
|
-
const
|
|
81
|
-
this._layerMap.set(
|
|
99
|
+
updateFeatureLayerForModel(i, e) {
|
|
100
|
+
const t = this._getApiKey(i);
|
|
101
|
+
this._layerMap.set(t, e);
|
|
82
102
|
}
|
|
83
|
-
getFeatureLayerForModel(
|
|
84
|
-
const
|
|
85
|
-
return this._layerMap.get(
|
|
103
|
+
getFeatureLayerForModel(i) {
|
|
104
|
+
const e = this._getApiKey(i);
|
|
105
|
+
return this._layerMap.get(e);
|
|
86
106
|
}
|
|
87
|
-
async setProfileForModel(
|
|
88
|
-
c(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
async setProfileForModel(i, e, t = { locale: "en" }) {
|
|
108
|
+
const r = c(e) ? A(e.id) : void 0;
|
|
109
|
+
c(e) && (e = S(e));
|
|
110
|
+
const s = await M(
|
|
111
|
+
t.locale,
|
|
112
|
+
w("./assets/editor-profile/t9n"),
|
|
92
113
|
"messages."
|
|
93
114
|
);
|
|
94
|
-
if (!
|
|
95
|
-
throw new Error(`Failed to load the language bundle for ${
|
|
96
|
-
this.disposeForModel(
|
|
97
|
-
const
|
|
98
|
-
this._modelToProfileMap.set(
|
|
99
|
-
const
|
|
100
|
-
this.updateApiContextForModel(
|
|
101
|
-
locale:
|
|
102
|
-
profile:
|
|
115
|
+
if (!s)
|
|
116
|
+
throw new Error(`Failed to load the language bundle for ${t.locale}`);
|
|
117
|
+
this.disposeForModel(i);
|
|
118
|
+
const a = this._getApiKey(i), l = new E(e, s);
|
|
119
|
+
this._modelToProfileMap.set(a, l);
|
|
120
|
+
const y = q(l);
|
|
121
|
+
this.updateApiContextForModel(i, {
|
|
122
|
+
locale: t.locale,
|
|
123
|
+
profile: y,
|
|
124
|
+
...r ? { profilePolicy: r } : {}
|
|
103
125
|
});
|
|
104
|
-
const p =
|
|
105
|
-
p && this.updateFeatureLayerForModel(
|
|
126
|
+
const p = e?.variables?.find((P) => P.name === "$layer");
|
|
127
|
+
p && this.updateFeatureLayerForModel(i, p.definition);
|
|
106
128
|
}
|
|
107
129
|
}
|
|
108
|
-
const n = new
|
|
130
|
+
const n = new _(), R = {
|
|
109
131
|
setProfileForModel: n.setProfileForModel.bind(n),
|
|
110
132
|
getApiLibraryForModel: n.getApiLibraryForModel.bind(n)
|
|
111
133
|
};
|
|
112
134
|
export {
|
|
113
135
|
n as a,
|
|
114
|
-
|
|
136
|
+
R as s
|
|
115
137
|
};
|
|
@@ -69,14 +69,14 @@ async function ke(i) {
|
|
|
69
69
|
}
|
|
70
70
|
const l = u.data;
|
|
71
71
|
r.push(l);
|
|
72
|
-
const v = l.conversationId,
|
|
72
|
+
const v = l.conversationId, P = l.inquiryId;
|
|
73
73
|
let $ = l.sequenceNumber;
|
|
74
74
|
async function T() {
|
|
75
75
|
let b = 0;
|
|
76
76
|
const g = 100;
|
|
77
77
|
for (; b < g; ) {
|
|
78
78
|
await new Promise((S) => setTimeout(S, 1e3));
|
|
79
|
-
const x = Se(v, $,
|
|
79
|
+
const x = Se(v, $, P);
|
|
80
80
|
let k;
|
|
81
81
|
try {
|
|
82
82
|
k = await N(p, {
|
|
@@ -89,7 +89,7 @@ async function ke(i) {
|
|
|
89
89
|
responseType: "json"
|
|
90
90
|
});
|
|
91
91
|
} catch (S) {
|
|
92
|
-
const
|
|
92
|
+
const q = S, oe = q.details?.rawResponse || q.message || String(S), _ = O(oe);
|
|
93
93
|
throw _ ? new A(_) : S;
|
|
94
94
|
}
|
|
95
95
|
const y = k.data;
|
|
@@ -185,7 +185,7 @@ function Me({ active: i, setActive: e, messages: t }) {
|
|
|
185
185
|
function Ve({ context: i, messages: e }) {
|
|
186
186
|
return i ? d`<div class="gaps">${i.profileId && d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Pe({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: a, question: n, errorMessage: c, setErrorMessage: p, promptValidationMessage: r, setPromptValidationMessage: s, submitQuestion: u, messages: l, mode: v, assistantRef: P, context: $, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
|
|
189
189
|
const b = $?.contextTooLarge ?? !1, g = Ie({
|
|
190
190
|
promptValidationMessage: r,
|
|
191
191
|
errorMessage: c,
|
|
@@ -215,13 +215,13 @@ function qe({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
215
215
|
s(void 0), await u();
|
|
216
216
|
}} class="hidden-above-380" .label=${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
const qe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", _e = "https://www.esri.com/en-us/privacy/privacy-statements";
|
|
219
219
|
function De({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback: a, onSubmit: n }) {
|
|
220
220
|
return t.active ? d`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(c) => a({ ...t, text: c.target.value })} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(c) => {
|
|
221
221
|
a({ ...t, termsAccepted: c.target.checked });
|
|
222
|
-
}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${_e} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${
|
|
222
|
+
}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${_e} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${qe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => i(!1)} .disabled=${t.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
|
|
223
223
|
}
|
|
224
|
-
function z({
|
|
224
|
+
function z({ promptingEnabled: i, messages: e, slot: t, helpTopicUrl: o }) {
|
|
225
225
|
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? V} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${i ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${C((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${o} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : d`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
|
|
226
226
|
}
|
|
227
227
|
function Ne({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
@@ -564,10 +564,10 @@ class Ze extends re {
|
|
|
564
564
|
this.updateViewState({ feedback: e });
|
|
565
565
|
}, this.onSuggestionClick = (e) => {
|
|
566
566
|
this.textAreaRef.value && (this.textAreaRef.value.value = e, this.textAreaRef.value.setFocus(), this.setQuestionState(e));
|
|
567
|
-
}, this.helpBase = "", this.
|
|
567
|
+
}, this.helpBase = "", this.promptingEnabled = !1, this.closed = !1, this.disableQuestionAnswerLogging = !1;
|
|
568
568
|
}
|
|
569
569
|
static {
|
|
570
|
-
this.properties = { closePanel: 0, insertText: 0, helpBase: 1,
|
|
570
|
+
this.properties = { closePanel: 0, insertText: 0, helpBase: 1, promptingEnabled: 5, portalUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1, diagnostics: 0, disableQuestionAnswerLogging: 5 };
|
|
571
571
|
}
|
|
572
572
|
static {
|
|
573
573
|
this.styles = xe;
|
|
@@ -582,6 +582,16 @@ class Ze extends re {
|
|
|
582
582
|
get usingTheAssitantDocUrl() {
|
|
583
583
|
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`;
|
|
584
584
|
}
|
|
585
|
+
async openPrompt(e) {
|
|
586
|
+
if (this.closed = !1, !this.promptingEnabled)
|
|
587
|
+
return;
|
|
588
|
+
e && this.updateViewState({
|
|
589
|
+
question: e,
|
|
590
|
+
viewMode: "prompt"
|
|
591
|
+
});
|
|
592
|
+
const t = this.textAreaRef.value;
|
|
593
|
+
t && t.setFocus();
|
|
594
|
+
}
|
|
585
595
|
async destroy() {
|
|
586
596
|
}
|
|
587
597
|
connectedCallback() {
|
|
@@ -713,7 +723,8 @@ class Ze extends re {
|
|
|
713
723
|
context: {
|
|
714
724
|
profile_id: n.profileId,
|
|
715
725
|
metadata: [n.metadata],
|
|
716
|
-
editor_code: a.getValue()
|
|
726
|
+
editor_code: a.getValue(),
|
|
727
|
+
...this.diagnostics?.length ? { diagnostics: this.diagnostics } : {}
|
|
717
728
|
}
|
|
718
729
|
}
|
|
719
730
|
});
|
|
@@ -793,9 +804,9 @@ ${e}` : "";
|
|
|
793
804
|
if (this.closed)
|
|
794
805
|
return null;
|
|
795
806
|
const e = this.viewState.viewMode === "result", t = this.getHistoryCards();
|
|
796
|
-
return this.
|
|
807
|
+
return this.promptingEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<calcite-scrim></calcite-scrim>` || ""}${Ee({ messages: this.messages })}${Re({ messages: this.messages, popoverContent: z({ promptingEnabled: this.promptingEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Ne({ messages: this.messages, onProceed: () => {
|
|
797
808
|
this.updateViewState({ splashActive: !1 });
|
|
798
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Me({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${
|
|
809
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Me({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Pe({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && Ue({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${j({
|
|
799
810
|
expanded: e,
|
|
800
811
|
messages: this.messages,
|
|
801
812
|
collapsible: !0,
|
|
@@ -820,7 +831,7 @@ ${e}` : "";
|
|
|
820
831
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
821
832
|
hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
|
|
822
833
|
onCopyCode: this.onCopyCode.bind(this)
|
|
823
|
-
})}</calcite-block-group>${this.viewState.feedback.active ? De({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${z({ slot: "content-top", messages: this.messages,
|
|
834
|
+
})}</calcite-block-group>${this.viewState.feedback.active ? De({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${z({ slot: "content-top", messages: this.messages, promptingEnabled: this.promptingEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
824
835
|
}
|
|
825
836
|
}
|
|
826
837
|
ae("arcgis-arcade-coding-assistant", Ze);
|
|
@@ -4,7 +4,7 @@ import type { Diagnostic } from "@arcgis/arcade-languageservice";
|
|
|
4
4
|
import type { ApiSnippet } from "@arcgis/languages-api-utils";
|
|
5
5
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
6
6
|
import type { IEditorCodeSuggestion, IEditorCodeSuggestionGroup, IEditorProfileDefinition, IPredefinedProfile, IEditorTestContext } from "../types.js";
|
|
7
|
-
import type { ArcadeResult } from "../../utils/arcade-executor.js";
|
|
7
|
+
import type { ArcadeResult, EditorExternalExecutor } from "../../utils/arcade-executor.js";
|
|
8
8
|
import type { ICustomPanel } from "../../utils/custom-panel.js";
|
|
9
9
|
import type { ArcadeAssistantConfig } from "../../utils/arcade-assistant/types.js";
|
|
10
10
|
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
@@ -61,6 +61,26 @@ export abstract class ArcgisArcadeEditor extends LitElement {
|
|
|
61
61
|
* @default false
|
|
62
62
|
*/
|
|
63
63
|
accessor enableDebugger: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* External executor function, if provided, execution will be passed off to this function instead of the built-in executor.
|
|
66
|
+
*
|
|
67
|
+
* For information on how to implement see { \@link stories/details/external-executor.mdx }
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* const myExternalExecutor = cSharpBindings.getExecutor();
|
|
73
|
+
* const externalExecutor: EditorExternalExecutor = async ({ mode, script, console, breakpoints, onDebugPause, signal }) => {
|
|
74
|
+
* if (mode === "run") {
|
|
75
|
+
* return await myExternalExecutor.run(script, { signal, console });
|
|
76
|
+
* } else if (mode === "debug") {
|
|
77
|
+
* return await myExternalExecutor.debug(script, { signal, console, breakpoints, onDebugPause });
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* return <arcgis-arcade-editor externalExecutor={{ execute: externalExecutor }} />
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
accessor externalExecutor: EditorExternalExecutor | undefined;
|
|
64
84
|
/**
|
|
65
85
|
* If true, it will hide the documentation action in the side panel
|
|
66
86
|
*
|
|
@@ -95,6 +115,8 @@ export abstract class ArcgisArcadeEditor extends LitElement {
|
|
|
95
115
|
log?: string | undefined;
|
|
96
116
|
debugconsole?: string | undefined;
|
|
97
117
|
arcadeassistant?: string | undefined;
|
|
118
|
+
askarcadeassistant?: string | undefined;
|
|
119
|
+
askarcadeassistantprompt?: string | undefined;
|
|
98
120
|
profileempty?: string | undefined;
|
|
99
121
|
};
|
|
100
122
|
/** @internal */
|
|
@@ -115,6 +137,8 @@ export abstract class ArcgisArcadeEditor extends LitElement {
|
|
|
115
137
|
log: string;
|
|
116
138
|
debugconsole: string;
|
|
117
139
|
arcadeassistant: string;
|
|
140
|
+
askarcadeassistant: string;
|
|
141
|
+
askarcadeassistantprompt: string;
|
|
118
142
|
profileempty: string;
|
|
119
143
|
}> & T9nMeta<{
|
|
120
144
|
help: string;
|
|
@@ -133,6 +157,8 @@ export abstract class ArcgisArcadeEditor extends LitElement {
|
|
|
133
157
|
log: string;
|
|
134
158
|
debugconsole: string;
|
|
135
159
|
arcadeassistant: string;
|
|
160
|
+
askarcadeassistant: string;
|
|
161
|
+
askarcadeassistantprompt: string;
|
|
136
162
|
profileempty: string;
|
|
137
163
|
}>;
|
|
138
164
|
/**
|
|
@@ -182,6 +208,12 @@ export abstract class ArcgisArcadeEditor extends LitElement {
|
|
|
182
208
|
* @internal
|
|
183
209
|
*/
|
|
184
210
|
getTestResult(): Promise<ArcadeResult>;
|
|
211
|
+
/**
|
|
212
|
+
* Opens the Arcade assistant side panel and optionally pre-fills the prompt input.
|
|
213
|
+
*
|
|
214
|
+
* @param options
|
|
215
|
+
*/
|
|
216
|
+
openArcadeAssistant(options?: { prompt?: string; }): Promise<boolean>;
|
|
185
217
|
/** Set the focus on the element. */
|
|
186
218
|
setFocus(): Promise<void>;
|
|
187
219
|
/** Emitted when the diagnostics collection has changed. */
|