@arcgis/coding-components 5.0.0-next.39 → 5.0.0-next.41
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/addons.js +1 -1
- package/dist/cdn/3WIRROBH.js +4 -0
- package/dist/cdn/{AFUBHK37.js → 42JQRIXR.js} +5 -5
- package/dist/cdn/4R4DUTCV.js +6 -0
- package/dist/cdn/5PJI5QQB.js +37 -0
- package/dist/cdn/{A3HSJCES.js → 5UEEUMXL.js} +2 -2
- package/dist/cdn/6CKRGIHZ.js +6 -0
- package/dist/cdn/7EJZH64Z.js +4 -0
- package/dist/cdn/7XW6IKKV.js +4 -0
- package/dist/cdn/{IQRXXWGC.js → A3TLL6LG.js} +2 -2
- package/dist/cdn/AKWJLYC3.js +4 -0
- package/dist/cdn/ASRHMURK.js +4 -0
- package/dist/cdn/{V2PRLYOK.js → BMXVKJ7B.js} +2 -2
- package/dist/cdn/{32D5TXZE.js → CJ65XLTF.js} +2 -2
- package/dist/cdn/{22UJ2NCC.js → D726IUEN.js} +2 -2
- package/dist/cdn/DRX5YPAV.js +4 -0
- package/dist/cdn/DUJT7B4V.js +4 -0
- package/dist/cdn/{LWCU6T2S.js → E2PW5KNS.js} +2 -2
- package/dist/cdn/FF6CRCZF.js +4 -0
- package/dist/cdn/{5A2OAIPG.js → FYVNN5SL.js} +2 -2
- package/dist/cdn/GACCOEJE.js +4 -0
- package/dist/cdn/GUM3FUHK.js +4 -0
- package/dist/cdn/{XQUZTH64.js → HPZKKREG.js} +2 -2
- package/dist/cdn/{HW6JQO5U.js → I2ZZVQNR.js} +2 -2
- package/dist/cdn/{65R5LFH4.js → IDPVSJSA.js} +1 -1
- package/dist/cdn/JJXU7RKH.js +4 -0
- package/dist/cdn/KVOGU23G.js +4 -0
- package/dist/cdn/MG7IUFZ5.js +4 -0
- package/dist/cdn/{B7UCVBR4.js → MPI3VJ27.js} +2 -2
- package/dist/cdn/{463DHUPJ.js → NRSCYJ4X.js} +2 -2
- package/dist/cdn/{MSV35DG3.js → NSG3IIH4.js} +1 -1
- package/dist/cdn/{SO6A33RQ.js → QB4B762H.js} +1 -1
- package/dist/cdn/SNG6BXOJ.js +4 -0
- package/dist/cdn/TA3A544D.js +69 -0
- package/dist/cdn/TDR5QOYK.js +4 -0
- package/dist/cdn/{YVZP32LA.js → UNGROWHP.js} +2 -2
- package/dist/cdn/{NBILS2PA.js → UOMZGMYC.js} +2 -2
- package/dist/cdn/V3QS3R7T.js +6 -0
- package/dist/cdn/{LUBHSH6S.js → VOYE3SWE.js} +15 -15
- package/dist/cdn/{PNX3P5LX.js → VRR5O4LN.js} +2 -2
- package/dist/cdn/{5AE3XQBB.js → W3FWYOGY.js} +1 -1
- package/dist/cdn/WB62GWRN.js +4 -0
- package/dist/cdn/{GYFX6FDB.js → WS4TV7BI.js} +2 -2
- package/dist/cdn/{6DXNKA5R.js → WXEVTZGW.js} +2 -2
- package/dist/cdn/{WPDOXZMT.js → XNU7TDA3.js} +2 -2
- package/dist/cdn/{KMM2L2UC.js → XSTPZUAO.js} +2 -2
- package/dist/cdn/{QV5P6IW2.js → XV2IY5HJ.js} +2 -2
- package/dist/cdn/{DJBX4N35.js → YIFRYPQP.js} +2 -2
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +2107 -2107
- package/dist/cdn/index.js +3 -3
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/arcade-contribution.js +97 -0
- package/dist/chunks/arcade-defaults.js +1 -1
- package/dist/chunks/arcade-executor.js +1 -1
- package/dist/chunks/arcade-mode.js +1 -1
- package/dist/chunks/arcade-service-accessors.js +75 -6
- package/dist/chunks/colorize.js +26 -0
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +37 -36
- package/dist/chunks/markdown.js +64 -91
- package/dist/chunks/monaco-importer.js +8 -93
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/sql-expr-service-accessors.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utilities.js +90 -0
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +3 -3
- package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +1 -0
- package/dist/components/arcgis-arcade-coding-assistant/index.js +1 -0
- package/dist/components/arcgis-arcade-editor/customElement.js +2 -3
- package/dist/components/arcgis-arcade-results/customElement.js +1 -1
- package/dist/components/arcgis-arcade-suggestions/customElement.js +6 -5
- package/dist/components/arcgis-code-editor/customElement.js +3 -3
- package/dist/components/arcgis-code-viewer/customElement.d.ts +63 -0
- package/dist/components/arcgis-code-viewer/customElement.js +119 -0
- package/dist/components/arcgis-code-viewer/index.d.ts +1 -0
- package/dist/components/arcgis-code-viewer/index.js +1 -0
- package/dist/components/arcgis-editor-variables/customElement.js +1 -1
- package/dist/components/arcgis-language-api-panel/customElement.js +24 -28
- package/dist/components/arcgis-sql-expression-editor/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
- package/dist/docs/api.json +144 -2
- package/dist/docs/docs.json +116 -2
- package/dist/docs/vscode.html-custom-data.json +22 -0
- package/dist/docs/web-types.json +40 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/loader.js +5 -4
- package/dist/monacoStyles.js +1 -1
- package/dist/types/lumina.d.ts +5 -0
- package/dist/types/preact.d.ts +6 -0
- package/dist/types/preact10.d.ts +7 -0
- package/dist/types/react.d.ts +7 -0
- package/dist/types/stencil.d.ts +5 -0
- package/dist/utils/colorize.d.ts +1 -1
- package/dist/utils/monaco-languages.d.ts +4 -0
- package/package.json +6 -5
- package/dist/cdn/36J7OXKL.js +0 -4
- package/dist/cdn/5HDJXUGY.js +0 -4
- package/dist/cdn/77G2EUBD.js +0 -4
- package/dist/cdn/BC25UYFG.js +0 -4
- package/dist/cdn/BEW42V7C.js +0 -4
- package/dist/cdn/DQFS5S4N.js +0 -4
- package/dist/cdn/FNKWDH6V.js +0 -4
- package/dist/cdn/FZYOFX2D.js +0 -6
- package/dist/cdn/GQJM6PDN.js +0 -104
- package/dist/cdn/IJJXIW5Z.js +0 -4
- package/dist/cdn/KFRXV3AL.js +0 -4
- package/dist/cdn/LPXQ3NWM.js +0 -4
- package/dist/cdn/M4276KFE.js +0 -4
- package/dist/cdn/SPZVHSF2.js +0 -4
- package/dist/cdn/TIYSNFGO.js +0 -4
- package/dist/cdn/USHS6Y7V.js +0 -6
- package/dist/cdn/X2NBZ5GC.js +0 -4
- package/dist/cdn/XAAE3RER.js +0 -4
- package/dist/chunks/setup-monaco.js +0 -74
- package/dist/chunks/sql-expr-contribution.js +0 -85
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createFilterExpression as d } from "@arcgis/toolkit/string";
|
|
2
|
+
import { format as f } from "@arcgis/arcade-languageservice";
|
|
3
|
+
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
5
|
+
v5.0.0-next.41 */
|
|
6
|
+
function b(e, r, s, u) {
|
|
7
|
+
if (!r)
|
|
8
|
+
return [];
|
|
9
|
+
const t = Array.isArray(r) ? r : [r];
|
|
10
|
+
if (!t.length)
|
|
11
|
+
return [];
|
|
12
|
+
const m = d(s);
|
|
13
|
+
return e.filter((o) => t.some((a) => m.test(String(o[a] ?? ""))));
|
|
14
|
+
}
|
|
15
|
+
function L(e) {
|
|
16
|
+
return e ? `${e.portal.url}/home/item.html?id=${e.id}` : "";
|
|
17
|
+
}
|
|
18
|
+
function p(e, r, s = "add", u) {
|
|
19
|
+
if (!e)
|
|
20
|
+
return;
|
|
21
|
+
const t = e.getSelection(), m = t && (t.startLineNumber !== t.endLineNumber || t.startColumn !== t.endColumn);
|
|
22
|
+
let o = [];
|
|
23
|
+
const a = e.getValue() ?? "";
|
|
24
|
+
if (s === "replace") {
|
|
25
|
+
const l = `${u}
|
|
26
|
+
${r}`, i = e.getModel(), n = i?.getLineCount() ?? 1, c = i?.getLineMaxColumn(n) ?? 1;
|
|
27
|
+
o = [
|
|
28
|
+
{
|
|
29
|
+
range: {
|
|
30
|
+
startLineNumber: 1,
|
|
31
|
+
startColumn: 1,
|
|
32
|
+
endLineNumber: n,
|
|
33
|
+
endColumn: c
|
|
34
|
+
},
|
|
35
|
+
text: l
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
} else {
|
|
39
|
+
const l = m ? {
|
|
40
|
+
startLineNumber: t.startLineNumber,
|
|
41
|
+
startColumn: t.startColumn,
|
|
42
|
+
endLineNumber: t.endLineNumber,
|
|
43
|
+
endColumn: t.endColumn
|
|
44
|
+
} : (() => {
|
|
45
|
+
const n = e.getPosition();
|
|
46
|
+
return {
|
|
47
|
+
startLineNumber: n?.lineNumber ?? 1,
|
|
48
|
+
startColumn: n?.column ?? 1,
|
|
49
|
+
endLineNumber: n?.lineNumber ?? 1,
|
|
50
|
+
endColumn: n?.column ?? 1
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
let i = !1;
|
|
54
|
+
if (u) {
|
|
55
|
+
const n = u.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
56
|
+
i = !new RegExp(`^\\s*${n}\\s*$`, "mu").test(a);
|
|
57
|
+
}
|
|
58
|
+
i && o.push({
|
|
59
|
+
range: {
|
|
60
|
+
startLineNumber: 1,
|
|
61
|
+
startColumn: 1,
|
|
62
|
+
endLineNumber: 1,
|
|
63
|
+
endColumn: 1
|
|
64
|
+
},
|
|
65
|
+
text: `${u}
|
|
66
|
+
`
|
|
67
|
+
}), o.push({
|
|
68
|
+
range: l,
|
|
69
|
+
text: r
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
e.pushUndoStop(), e.executeEdits("insertText", o), e.pushUndoStop(), e.focus();
|
|
74
|
+
} catch (l) {
|
|
75
|
+
console.error("Failed to edit model:", l);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function N(e) {
|
|
79
|
+
try {
|
|
80
|
+
return f(e);
|
|
81
|
+
} catch {
|
|
82
|
+
return e;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
N as a,
|
|
87
|
+
p as e,
|
|
88
|
+
b as f,
|
|
89
|
+
L as p
|
|
90
|
+
};
|
|
@@ -6,7 +6,7 @@ import { u as W } from "../../chunks/useT9n.js";
|
|
|
6
6
|
import { b as S } from "../../chunks/arcade-defaults.js";
|
|
7
7
|
import { css as G, html as r } from "lit";
|
|
8
8
|
import I from "@arcgis/core/request.js";
|
|
9
|
-
import { e as Q, a as J } from "../../chunks/
|
|
9
|
+
import { e as Q, a as J } from "../../chunks/utilities.js";
|
|
10
10
|
import { repeat as U } from "lit/directives/repeat.js";
|
|
11
11
|
import "@arcgis/toolkit/function";
|
|
12
12
|
import { generateGuid as K } from "@arcgis/toolkit/string";
|
|
@@ -17,7 +17,7 @@ import Z from "@arcgis/core/Graphic.js";
|
|
|
17
17
|
import { b as ee } from "../../chunks/language-defaults-base.js";
|
|
18
18
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
19
19
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
20
|
-
v5.0.0-next.
|
|
20
|
+
v5.0.0-next.41 */
|
|
21
21
|
const te = G`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-code-editor-side-panel-max-w);width:var(--arcgis-coding-components-code-editor-side-panel-w);.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.action .error-display{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem;max-height:30vh;overflow-y:auto}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=title] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.code-collapse{margin-inline-start:auto}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.collapsible-error{padding:.5rem}.collapsible-error summary{cursor:pointer;font-weight:500;color:var(--calcite-color-status-danger);outline:none;padding:.25rem 0}.collapsible-error[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}}:host([closed]){display:none}`;
|
|
22
22
|
class v extends Error {
|
|
23
23
|
constructor({
|
|
@@ -190,7 +190,7 @@ function N({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: c
|
|
|
190
190
|
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && s && r`<div class="response-error-container">${F({ errorMessage: a.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext ?? "Response Context"} scale=s>${a.message && !s && r`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${a.chips?.map((l) => {
|
|
191
191
|
const p = K();
|
|
192
192
|
return r`${l.tooltip && r`<calcite-tooltip .referenceElement=${`response-chip-${l.conversationId}-${p}`} placement=top-start class="contained-popover-or-tooltip">${l.tooltip}</calcite-tooltip>` || ""}<calcite-chip .label=${l.label} .scale=${l.scale ?? "s"} .appearance=${l.appearance ?? "outline"} .icon=${l.icon} .id=${`response-chip-${l.conversationId}-${p}`}>${l.label}</calcite-chip>`;
|
|
193
|
-
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><code>${a.code}</code></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(l) => {
|
|
193
|
+
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${a.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(l) => {
|
|
194
194
|
const p = l.currentTarget;
|
|
195
195
|
d(a.code).then(() => {
|
|
196
196
|
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
@@ -18,6 +18,7 @@ import "@esri/calcite-components/components/calcite-dialog";
|
|
|
18
18
|
import "@esri/calcite-components/components/calcite-chip-group";
|
|
19
19
|
import "@esri/calcite-components/components/calcite-card-group";
|
|
20
20
|
import "@esri/calcite-components/components/calcite-card";
|
|
21
|
+
import "../arcgis-code-viewer/index.js";
|
|
21
22
|
import "@esri/calcite-components/components/calcite-flow";
|
|
22
23
|
import "@esri/calcite-components/components/calcite-flow-item";
|
|
23
24
|
import "@esri/calcite-components/components/calcite-scrim";
|
|
@@ -18,6 +18,7 @@ import "@esri/calcite-components/components/calcite-dialog";
|
|
|
18
18
|
import "@esri/calcite-components/components/calcite-chip-group";
|
|
19
19
|
import "@esri/calcite-components/components/calcite-card-group";
|
|
20
20
|
import "@esri/calcite-components/components/calcite-card";
|
|
21
|
+
import "../arcgis-code-viewer/index.js";
|
|
21
22
|
import "@esri/calcite-components/components/calcite-flow";
|
|
22
23
|
import "@esri/calcite-components/components/calcite-flow-item";
|
|
23
24
|
import "@esri/calcite-components/components/calcite-scrim";
|
|
@@ -8,16 +8,15 @@ import { LitElement as y, createEvent as x, noShadowRoot as D, safeClassMap as r
|
|
|
8
8
|
import { generateGuid as C } from "@arcgis/toolkit/string";
|
|
9
9
|
import { Deferred as k } from "@arcgis/toolkit/promise";
|
|
10
10
|
import { D as B, e as v } from "../../chunks/arcade-executor.js";
|
|
11
|
-
import { s as I } from "../../chunks/
|
|
11
|
+
import { s as I, a as M } from "../../chunks/arcade-service-accessors.js";
|
|
12
12
|
import { b as c } from "../../chunks/arcade-defaults.js";
|
|
13
|
-
import { a as M } from "../../chunks/arcade-service-accessors.js";
|
|
14
13
|
import { u as L } from "../../chunks/useT9n.js";
|
|
15
14
|
import { createRef as T, ref as F } from "lit/directives/ref.js";
|
|
16
15
|
import { s as U } from "../../chunks/editor.js";
|
|
17
16
|
import j from "@arcgis/core/identity/IdentityManager.js";
|
|
18
17
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
19
18
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
20
|
-
v5.0.0-next.
|
|
19
|
+
v5.0.0-next.41 */
|
|
21
20
|
const z = w`@layer{arcgis-arcade-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--arcgis-coding-components-border)!important;box-sizing:border-box;background-color:var(--arcgis-coding-components-background-color);height:100%;.sticky{position:sticky;top:0;z-index:10}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1);text-align:center}.main-action-bar{border-bottom:var(--arcgis-coding-components-border)!important;flex:0 0 auto;calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}arcgis-arcade-results{border-top:var(--arcgis-coding-components-border)!important;box-sizing:border-box;max-height:50%;min-height:50%;margin-bottom:-1px}calcite-flow{[slot=footer]{word-break:break-word}}.hidden{display:none}}}`, N = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", O = (s) => {
|
|
22
21
|
const { aiAssistantsEnabled: e } = s;
|
|
23
22
|
return e === void 0 ? (console.warn("areAiAssistantsEnabled is not defined in the organizations settings."), !1) : e;
|
|
@@ -9,7 +9,7 @@ import "@arcgis/toolkit/function";
|
|
|
9
9
|
import { createRef as g, ref as $ } from "lit/directives/ref.js";
|
|
10
10
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
11
11
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
12
|
-
v5.0.0-next.
|
|
12
|
+
v5.0.0-next.41 */
|
|
13
13
|
const _ = M`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}.ltr-container{direction:ltr}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{table{display:block;max-width:fit-content;overflow-x:auto;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}.tree-item-label,.number-value,.string-value,.boolean-value{font-family:var(--calcite-code-family)}.tree-item-label,.value-type{color:var(--calcite-color-text-2);font-weight:var(--calcite-font-weight-normal)}.dictionary-property{color:var(--arcgis-editor-identifier)}.number-value{color:var(--arcgis-editor-number)}.string-value{color:var(--arcgis-editor-string);white-space:pre-wrap}.constant-value{color:var(--arcgis-editor-constant)}.date-value{color:var(--arcgis-editor-date)}}`, a = {
|
|
14
14
|
lines: !0,
|
|
15
15
|
selectionMode: "none",
|
|
@@ -3,12 +3,13 @@ import { ref as l } from "lit/directives/ref.js";
|
|
|
3
3
|
import { css as d, html as s, nothing as c } from "lit";
|
|
4
4
|
import { setFocusOnElement as g, focusElement as u } from "@arcgis/toolkit/dom";
|
|
5
5
|
import { LitElement as h, createEvent as r } from "@arcgis/lumina";
|
|
6
|
-
import { g as a, o as m,
|
|
7
|
-
import { f as
|
|
6
|
+
import { g as a, o as m, a as f } from "../../chunks/colorize.js";
|
|
7
|
+
import { f as p } from "../../chunks/utilities.js";
|
|
8
|
+
import { c as b } from "../../chunks/markdown.js";
|
|
8
9
|
import { u as _ } from "../../chunks/useT9n.js";
|
|
9
10
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
10
11
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
11
|
-
v5.0.0-next.
|
|
12
|
+
v5.0.0-next.41 */
|
|
12
13
|
function v(o) {
|
|
13
14
|
return !Array.isArray(o) || !o.length ? !1 : Array.isArray(o[0].suggestions);
|
|
14
15
|
}
|
|
@@ -66,11 +67,11 @@ class $ extends h {
|
|
|
66
67
|
return this.suggestions === void 0 ? null : v(this.suggestions) ? this.suggestions.map((e) => s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`) : this.renderSuggestionListItems(this.suggestions);
|
|
67
68
|
}
|
|
68
69
|
renderSuggestionListItems(e) {
|
|
69
|
-
return e =
|
|
70
|
+
return e = p(e, "label", this._filterValue), e.length ? e.map((t) => s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${(i) => this._emitItemSelected(i, t)} @keydown=${(i) => this._emitItemSelected(i, t)} data-item=${t ?? c}><calcite-action slot=actions-end .text=${this.messages.expand ?? ""} scale=s icon=chevron-right icon-flip-rtl @click=${(i) => this._showSuggestionDetail(i, t)} data-item=${t ?? c}></calcite-action></calcite-list-item>`) : s`<div class="notice-container">${this.messages.noitems}</div>`;
|
|
70
71
|
}
|
|
71
72
|
renderSuggestionFlowItem() {
|
|
72
73
|
const e = this._selectedSuggestion;
|
|
73
|
-
return e ? s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${(t) => this._emitItemSelected(t, e)} data-item=${e ?? c} ${l(u)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${
|
|
74
|
+
return e ? s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${(t) => this._emitItemSelected(t, e)} data-item=${e ?? c} ${l(u)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${b(e.documentation) ?? ""}></div><pre><code ${l(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>` : null;
|
|
74
75
|
}
|
|
75
76
|
render() {
|
|
76
77
|
return this.closed ? null : s`<style>${this._colorizeStyle}</style><calcite-flow ${l(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list label=suggestions>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`;
|
|
@@ -4,14 +4,14 @@ import { observeAncestorsMutation as h, unsafeGetCalciteModeName as l } from "@a
|
|
|
4
4
|
import { generateGuid as u } from "@arcgis/toolkit/string";
|
|
5
5
|
import { Deferred as m } from "@arcgis/toolkit/promise";
|
|
6
6
|
import { LitElement as p, createEvent as o, noShadowRoot as g } from "@arcgis/lumina";
|
|
7
|
-
import { s as _ } from "../../chunks/
|
|
8
|
-
import "../../chunks/
|
|
7
|
+
import { s as _ } from "../../chunks/arcade-service-accessors.js";
|
|
8
|
+
import "../../chunks/arcade-contribution.js";
|
|
9
9
|
import { css as f } from "lit";
|
|
10
10
|
import { load as I } from "@arcgis/lumina/controllers";
|
|
11
11
|
import { Range as v, Uri as s, KeyMod as n, KeyCode as r } from "monaco-editor";
|
|
12
12
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
13
13
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
14
|
-
v5.0.0-next.
|
|
14
|
+
v5.0.0-next.41 */
|
|
15
15
|
const M = f`@layer{arcgis-code-editor{display:flex;width:100%;height:100%;flex-direction:column;direction:ltr;.monaco-editor{flex:1 1 auto;.monaco-hover,.editor-widget,.suggest-details-container{z-index:9999}div[widgetid="editor.contrib.resizableContentHoverWidget"],div[widgetid="editor.widget.suggestWidget"],div[widgetid="suggest.details"]{z-index:calc(var(--calcite-z-index-header) + 1)!important}}}}`, b = {
|
|
16
16
|
autoIndent: "advanced",
|
|
17
17
|
automaticLayout: !0,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import { JsxNode, PublicLitElement as LitElement, TargetedEvent } from '@arcgis/lumina';
|
|
3
|
+
import { PropertyValues } from 'lit';
|
|
4
|
+
/**
|
|
5
|
+
* @remarks
|
|
6
|
+
* This component has 3 main parts to manage:
|
|
7
|
+
* 1. setting up the theme colors from monaco for syntax highlighting
|
|
8
|
+
* - done via stylesheets created and applied in adoptedStyleSheets
|
|
9
|
+
* - These styles need to update when: 1. the theme changes, 2. the component is first loaded, 3. the component reconnects with a different theme
|
|
10
|
+
* 2. setting the html content of the code block, which is "colorized" by monaco
|
|
11
|
+
* - This needs to happen when: 1. the code changes, 2. the language changes
|
|
12
|
+
* 3. managing the code content provided via the default slot
|
|
13
|
+
* - This needs to handle: 1. slotchange events, 2. mutations to the assigned nodes (e.g., innerHTML or textContent changes)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A code viewer component for displaying code snippets.
|
|
18
|
+
* Supports syntax highlighting for various programming languages, include arcade and arcgis-sql-expression.
|
|
19
|
+
*
|
|
20
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/references/coding-components/arcgis-code-viewer/)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <arcgis-code-viewer language="javascript">
|
|
25
|
+
* function greet() {
|
|
26
|
+
* console.log("Hello, World!");
|
|
27
|
+
* }
|
|
28
|
+
* </arcgis-code-viewer>
|
|
29
|
+
* ```
|
|
30
|
+
* @example
|
|
31
|
+
* HTML snippets (preserve markup)
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <arcgis-code-viewer language="html">
|
|
34
|
+
* <template>
|
|
35
|
+
* <div class="greeting"><span>Hello</span> World!</div>
|
|
36
|
+
* </template>
|
|
37
|
+
* </arcgis-code-viewer>
|
|
38
|
+
* ```
|
|
39
|
+
* When `language="html"`, the component will attempt to preserve your original markup instead of reducing it
|
|
40
|
+
* to plain text. For safety and to prevent the markup from rendering in-page, wrap the snippet in a `<template>`.
|
|
41
|
+
* If no `<template>` is provided, the component falls back to concatenating the `outerHTML` of element nodes and the
|
|
42
|
+
* raw text of text nodes. Script contents are treated as inert string data; they are never executed.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare class ArcgisCodeViewer extends LitElement {
|
|
46
|
+
/**
|
|
47
|
+
* The language for the component.
|
|
48
|
+
* Currently supported language: arcade, arcgis-sql-expression, plus all the following languages found in monaco-editor's repo:
|
|
49
|
+
* https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages.
|
|
50
|
+
*
|
|
51
|
+
* Note: The number of supported languages is limited in cdn builds to reduce package size. In cdn builds,
|
|
52
|
+
* only the following languages are supported: css, html, javascript, typescript, and arcade, arcgis-sql-expression.
|
|
53
|
+
*
|
|
54
|
+
* @default "arcade"
|
|
55
|
+
*/
|
|
56
|
+
language: string;
|
|
57
|
+
/**
|
|
58
|
+
* When `true`, adds a round style to the component.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
round: boolean;
|
|
63
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { g as m, c as u } from "../../chunks/runtime.js";
|
|
2
|
+
import { LitElement as p } from "@arcgis/lumina";
|
|
3
|
+
import { slotChangeHasContent as g, observeAncestorsMutation as f, unsafeGetCalciteModeName as _ } from "@arcgis/toolkit/dom";
|
|
4
|
+
import { load as S } from "@arcgis/lumina/controllers";
|
|
5
|
+
import { i as v } from "../../chunks/monaco-importer.js";
|
|
6
|
+
import { css as E, html as a } from "lit";
|
|
7
|
+
import { w as l, s as c } from "../../chunks/arcade-contribution.js";
|
|
8
|
+
import { c as T, g as d, o as b } from "../../chunks/colorize.js";
|
|
9
|
+
import { s as C } from "../../chunks/arcade-service-accessors.js";
|
|
10
|
+
import { debounce as y } from "@arcgis/toolkit/function";
|
|
11
|
+
import { Task as N } from "@lit/task";
|
|
12
|
+
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
13
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
14
|
+
v5.0.0-next.41 */
|
|
15
|
+
const O = E`pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){pre{border-radius:var(--calcite-corner-radius-round)}}`;
|
|
16
|
+
class w extends p {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this._monacoEditor = S(v), this.#t = Promise.withResolvers(), this.#e = "", this._slotContentObservers = [], this._onDefaultSlotChange = async (e) => {
|
|
19
|
+
g(e) || (this._codeFromSlot = "");
|
|
20
|
+
const t = e.target instanceof HTMLSlotElement ? e.target : null, o = t ? this._computeSlotText(t) : "";
|
|
21
|
+
t && this._observeAssignedSlotNodes(t), o !== this._codeFromSlot && (this._codeFromSlot = o), this.#t.resolve();
|
|
22
|
+
}, this._colorizeTask = new N(this, {
|
|
23
|
+
task: async ([e, t], { signal: o }) => {
|
|
24
|
+
if (await this.#t.promise, o.aborted)
|
|
25
|
+
return this.#e;
|
|
26
|
+
if (await l(t), o.aborted)
|
|
27
|
+
return this.#e;
|
|
28
|
+
const i = await T(e, t);
|
|
29
|
+
return o.aborted ? this.#e : (this.#e = i, i);
|
|
30
|
+
},
|
|
31
|
+
args: () => [this._codeFromSlot, this.language]
|
|
32
|
+
}), this._codeFromSlot = "", this.language = "arcade", this.round = !1;
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
this.properties = { _codeFromSlot: 16, language: 1, round: 7 };
|
|
36
|
+
}
|
|
37
|
+
static {
|
|
38
|
+
this.styles = O;
|
|
39
|
+
}
|
|
40
|
+
#t;
|
|
41
|
+
#e;
|
|
42
|
+
async load() {
|
|
43
|
+
C(m("./assets")), await c(this.language), await l(this.language), this._applyColorizeStyles(d()), this.manager.onLifecycle(() => (this._themeObserver = f(this.el, ["class"], () => this.updateTheme()), this._themeChangedListener = b(() => {
|
|
44
|
+
this._applyColorizeStyles(d());
|
|
45
|
+
}), this.updateTheme(), () => {
|
|
46
|
+
this._themeObserver?.(), this._themeObserver = void 0, this._themeChangedListener?.dispose(), this._themeChangedListener = void 0;
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
loaded() {
|
|
50
|
+
this.el.hasChildNodes() || this.#t.resolve();
|
|
51
|
+
}
|
|
52
|
+
willUpdate(e) {
|
|
53
|
+
e.has("language") && c(this.language).then(() => l(this.language)).catch((t) => console.error(t));
|
|
54
|
+
}
|
|
55
|
+
disconnectedCallback() {
|
|
56
|
+
super.disconnectedCallback(), this._disposeSlotObservers();
|
|
57
|
+
}
|
|
58
|
+
_disposeSlotObservers() {
|
|
59
|
+
this._slotContentObservers.length && (this._slotContentObservers.forEach((e) => e.disconnect()), this._slotContentObservers = []);
|
|
60
|
+
}
|
|
61
|
+
_observeAssignedSlotNodes(e) {
|
|
62
|
+
this._disposeSlotObservers();
|
|
63
|
+
const t = e.assignedNodes({ flatten: !0 });
|
|
64
|
+
if (!t.length)
|
|
65
|
+
return;
|
|
66
|
+
const o = /* @__PURE__ */ new Set();
|
|
67
|
+
for (const s of t)
|
|
68
|
+
s.nodeType === Node.ELEMENT_NODE ? o.add(s) : s.nodeType === Node.TEXT_NODE && s.parentElement && o.add(s.parentElement);
|
|
69
|
+
const i = { characterData: !0, childList: !0, subtree: !0 }, r = y(() => {
|
|
70
|
+
const s = this._computeSlotText(e);
|
|
71
|
+
s !== this._codeFromSlot && (this._codeFromSlot = s);
|
|
72
|
+
}, 100), h = (s) => {
|
|
73
|
+
if (s.some((n) => n.type === "childList")) {
|
|
74
|
+
const n = this._computeSlotText(e);
|
|
75
|
+
n !== this._codeFromSlot && (this._codeFromSlot = n);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
r();
|
|
79
|
+
};
|
|
80
|
+
o.forEach((s) => {
|
|
81
|
+
const n = new MutationObserver(h);
|
|
82
|
+
n.observe(s, i), this._slotContentObservers.push(n);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
_computeSlotText(e) {
|
|
86
|
+
const t = e.assignedNodes({ flatten: !0 }).filter((o) => o.nodeType !== Node.COMMENT_NODE);
|
|
87
|
+
if (this.language === "html" && t.length) {
|
|
88
|
+
const o = t.find((r) => r.nodeType === Node.ELEMENT_NODE && r.tagName === "TEMPLATE");
|
|
89
|
+
if (o)
|
|
90
|
+
return (o.innerHTML ?? "").trim();
|
|
91
|
+
const i = t.map((r) => r.nodeType === Node.ELEMENT_NODE ? r.outerHTML : r.nodeType === Node.TEXT_NODE ? r.textContent ?? "" : "").join("").trim();
|
|
92
|
+
return i && process.env.NODE_ENV !== "production" && console.warn("arcgis-code-viewer(html): Consider wrapping your snippet in a <template> for fully inert, intention-revealing markup."), i;
|
|
93
|
+
}
|
|
94
|
+
return t.map((o) => o.textContent ?? "").join("").trim();
|
|
95
|
+
}
|
|
96
|
+
updateTheme() {
|
|
97
|
+
const e = _(this.el) === "light" ? "vs" : "vs-dark";
|
|
98
|
+
e !== this._currentTheme && (this._currentTheme = e, this._monacoEditor.setTheme(e));
|
|
99
|
+
}
|
|
100
|
+
_applyColorizeStyles(e) {
|
|
101
|
+
if (!this._colorizeSheet) {
|
|
102
|
+
this._colorizeSheet = new CSSStyleSheet();
|
|
103
|
+
const t = this.renderRoot;
|
|
104
|
+
t.adoptedStyleSheets = [...t.adoptedStyleSheets, this._colorizeSheet];
|
|
105
|
+
}
|
|
106
|
+
this._colorizeSheet.replaceSync(e);
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
return a`<div><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot><pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({
|
|
110
|
+
error: () => null,
|
|
111
|
+
pending: () => a`<code class=${`language-${this.language}`}></code>`,
|
|
112
|
+
complete: (e) => a`<code class=${`language-${this.language}`} .innerHTML=${e ?? ""}></code>`
|
|
113
|
+
})}</pre></div>`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
u("arcgis-code-viewer", w);
|
|
117
|
+
export {
|
|
118
|
+
w as ArcgisCodeViewer
|
|
119
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -7,7 +7,7 @@ import { createFilterExpression as f } from "@arcgis/toolkit/string";
|
|
|
7
7
|
import { u as m } from "../../chunks/useT9n.js";
|
|
8
8
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
9
9
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
10
|
-
v5.0.0-next.
|
|
10
|
+
v5.0.0-next.41 */
|
|
11
11
|
const u = n`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}}`;
|
|
12
12
|
function g(l) {
|
|
13
13
|
l.key === "Enter" && l.stopPropagation();
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { css as
|
|
4
|
-
import { setFocusOnElement as
|
|
1
|
+
import { c as r } from "../../chunks/runtime.js";
|
|
2
|
+
import { ref as c } from "lit/directives/ref.js";
|
|
3
|
+
import { css as m, html as s } from "lit";
|
|
4
|
+
import { setFocusOnElement as d, focusElement as u } from "@arcgis/toolkit/dom";
|
|
5
5
|
import { addLtrMark as a } from "@arcgis/toolkit/string";
|
|
6
|
-
import { LitElement as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { u as
|
|
10
|
-
import { s as d } from "../../chunks/sql-expr-contribution.js";
|
|
6
|
+
import { LitElement as h, createEvent as o } from "@arcgis/lumina";
|
|
7
|
+
import { f as p } from "../../chunks/utilities.js";
|
|
8
|
+
import { c as n } from "../../chunks/markdown.js";
|
|
9
|
+
import { u as f } from "../../chunks/useT9n.js";
|
|
11
10
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
12
11
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
13
|
-
v5.0.0-next.
|
|
14
|
-
const
|
|
15
|
-
class
|
|
12
|
+
v5.0.0-next.41 */
|
|
13
|
+
const g = m`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
|
|
14
|
+
class b extends h {
|
|
16
15
|
constructor() {
|
|
17
|
-
super(...arguments), this.messages =
|
|
16
|
+
super(...arguments), this.messages = f(), this._unselectItem = async () => {
|
|
18
17
|
this._selectedApiItem = void 0;
|
|
19
|
-
}, this.
|
|
18
|
+
}, this._filterValue = "", this.languageId = "arcade", this.hideDocumentationActions = !1, this.loading = !1, this.closed = !1, this.arcgisClose = o({ bubbles: !1 }), this.arcgisItemSelected = o({ bubbles: !1 });
|
|
20
19
|
}
|
|
21
20
|
static {
|
|
22
|
-
this.properties = {
|
|
21
|
+
this.properties = { _filterValue: 16, _selectedApiItem: 16, languageId: 1, apiLibrary: 0, hideDocumentationActions: 5, loading: 5, closed: 5 };
|
|
23
22
|
}
|
|
24
23
|
static {
|
|
25
|
-
this.styles =
|
|
26
|
-
}
|
|
27
|
-
async load() {
|
|
28
|
-
await d(this.languageId), this._colorizeStyle = r(), this._themeChangedListener = g(() => this._colorizeStyle = r());
|
|
24
|
+
this.styles = g;
|
|
29
25
|
}
|
|
30
26
|
willUpdate(e) {
|
|
31
|
-
if (e.has("
|
|
27
|
+
if (e.has("apiLibrary")) {
|
|
32
28
|
if (!this._selectedApiItem)
|
|
33
29
|
return;
|
|
34
30
|
for (const i of this.apiLibrary ?? [])
|
|
@@ -41,7 +37,7 @@ class I extends p {
|
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
disconnectedCallback() {
|
|
44
|
-
super.disconnectedCallback(), this._flowObserver?.disconnect()
|
|
40
|
+
super.disconnectedCallback(), this._flowObserver?.disconnect();
|
|
45
41
|
}
|
|
46
42
|
flowFocusHandler(e) {
|
|
47
43
|
if (!e) {
|
|
@@ -49,7 +45,7 @@ class I extends p {
|
|
|
49
45
|
return;
|
|
50
46
|
}
|
|
51
47
|
this._flowObserver || (this._flowObserver = new MutationObserver(() => {
|
|
52
|
-
|
|
48
|
+
d(e.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
53
49
|
}), this._flowObserver.observe(e, { attributes: !0, attributeFilter: ["id"], childList: !0 }));
|
|
54
50
|
}
|
|
55
51
|
_emitItemSelected(e, i) {
|
|
@@ -72,24 +68,24 @@ class I extends p {
|
|
|
72
68
|
this._filterValue = e.currentTarget.value ?? "";
|
|
73
69
|
}
|
|
74
70
|
_elementToMarkdown(e) {
|
|
75
|
-
e !== void 0 && (e.innerHTML = n(this._selectedApiItem.examples)
|
|
71
|
+
e !== void 0 && (e.innerHTML = n(this._selectedApiItem.examples));
|
|
76
72
|
}
|
|
77
73
|
renderApiCategory(e) {
|
|
78
|
-
const i =
|
|
74
|
+
const i = p(e.items, "name", this._filterValue);
|
|
79
75
|
return i.length ? s`<calcite-list-item-group .heading=${e.title}>${i.map((t) => s`<calcite-list-item .label=${a(t.completion.detail)} @calciteListItemSelect=${(l) => this._emitItemSelected(l, t)} @keydown=${(l) => this._emitItemSelected(l, t)}><calcite-action slot=actions-end .text=${this.messages.expand ?? ""} icon=chevron-right icon-flip-rtl scale=s @click=${(l) => this._selectItem(l, t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>` : null;
|
|
80
76
|
}
|
|
81
77
|
renderApiItemFlowItem() {
|
|
82
78
|
const e = this._selectedApiItem;
|
|
83
|
-
return e ? s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions ? null : s`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions ? "full" : "half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${(i) => this._emitItemSelectedAndClose(i, e)} ${
|
|
79
|
+
return e ? s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions ? null : s`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions ? "full" : "half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${(i) => this._emitItemSelectedAndClose(i, e)} ${c(u)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${a(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation) ?? ""}></div>${e.examples ? s`<div ${c(this._elementToMarkdown)}></div>` : null}</calcite-block></calcite-flow-item>` : null;
|
|
84
80
|
}
|
|
85
81
|
render() {
|
|
86
82
|
if (this.closed)
|
|
87
83
|
return null;
|
|
88
84
|
const e = (this.apiLibrary ?? []).map((t) => this.renderApiCategory(t)), i = e.every((t) => !t);
|
|
89
|
-
return s`<
|
|
85
|
+
return s`<calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading ? s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading ?? "Loading"}></calcite-loader>` : s`<calcite-list label="arcade api">${i ? s`<div class="notice-container">${this.messages.noitems}</div>` : e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`;
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
|
-
|
|
88
|
+
r("arcgis-language-api-panel", b);
|
|
93
89
|
export {
|
|
94
|
-
|
|
90
|
+
b as ArcgisLanguageApiPanel
|
|
95
91
|
};
|
|
@@ -9,7 +9,7 @@ import { s as f } from "../../chunks/editor.js";
|
|
|
9
9
|
import { getSqlExprDiagnosticService as _ } from "../../chunks/sql-expr-mode.js";
|
|
10
10
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
11
11
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
12
|
-
v5.0.0-next.
|
|
12
|
+
v5.0.0-next.41 */
|
|
13
13
|
const u = n`@layer{arcgis-sql-expression-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--arcgis-coding-components-border)!important;box-sizing:border-box;background-color:var(--arcgis-coding-components-background-color);height:100%}}`;
|
|
14
14
|
class m extends c {
|
|
15
15
|
constructor() {
|
|
@@ -6,7 +6,7 @@ import { a as m } from "../../chunks/sql-expr-defaults.js";
|
|
|
6
6
|
import { u as d } from "../../chunks/useT9n.js";
|
|
7
7
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
8
8
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
9
|
-
v5.0.0-next.
|
|
9
|
+
v5.0.0-next.41 */
|
|
10
10
|
const h = r`:host{calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
|
|
11
11
|
class g extends n {
|
|
12
12
|
constructor() {
|