@arcgis/coding-components 4.29.0-beta.47 → 4.29.0-beta.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +13 -13
- package/dist/arcgis-coding-components/index.esm.js +1 -1
- package/dist/arcgis-coding-components/{p-10a322ec.js → p-0d616249.js} +9 -9
- package/dist/arcgis-coding-components/p-2c0d6f15.js +2 -0
- package/dist/arcgis-coding-components/{p-71faf9a4.js → p-5802524a.js} +1 -1
- package/dist/arcgis-coding-components/{p-9eabda86.js → p-5ddccf04.js} +1 -1
- package/dist/arcgis-coding-components/p-7475f3a6.js +1 -0
- package/dist/arcgis-coding-components/{p-e6ede32d.js → p-7d8caba9.js} +1 -1
- package/dist/arcgis-coding-components/{p-f7d7d78d.js → p-9f6db08a.js} +1 -1
- package/dist/arcgis-coding-components/{p-e475e6cd.js → p-aefe77ce.js} +1 -1
- package/dist/arcgis-coding-components/p-ce2be55e.entry.js +1 -0
- package/dist/arcgis-coding-components/{p-ce586a8c.js → p-d425a387.js} +1 -1
- package/dist/arcgis-coding-components/{p-c084ada8.js → p-ff21f230.js} +1 -1
- package/dist/cjs/{arcade-defaults-8445d852.js → arcade-defaults-2d513b59.js} +1534 -1534
- package/dist/cjs/arcade-mode-6219f1b8.js +599 -0
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1404 -1408
- package/dist/cjs/arcgis-coding-components.cjs.js +2 -2
- package/dist/cjs/{cssMode-e63287bb.js → cssMode-1ec48254.js} +2 -2
- package/dist/cjs/{html-c0d4db3b.js → html-0e1741fe.js} +2 -2
- package/dist/cjs/{htmlMode-fdc44d57.js → htmlMode-279d3c29.js} +2 -2
- package/dist/cjs/{index-6a382a34.js → index-ac186201.js} +67 -24
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{javascript-a419d064.js → javascript-04f1bce0.js} +3 -3
- package/dist/cjs/{jsonMode-73aee5d2.js → jsonMode-59322f7a.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{tsMode-37d1b053.js → tsMode-17561f70.js} +2 -2
- package/dist/cjs/{typescript-53f9f36a.js → typescript-b7da8629.js} +2 -2
- package/dist/components/arcade-api.js +160 -160
- package/dist/components/arcade-contribution.js +60 -60
- package/dist/components/arcade-defaults.js +1240 -1240
- package/dist/components/arcade-mode.js +514 -513
- package/dist/components/arcade-results.js +426 -430
- package/dist/components/arcade-suggestions.js +130 -132
- package/dist/components/arcade-variables.js +157 -155
- package/dist/components/arcgis-arcade-api.d.ts +2 -2
- package/dist/components/arcgis-arcade-editor.d.ts +2 -2
- package/dist/components/arcgis-arcade-editor.js +391 -391
- package/dist/components/arcgis-arcade-results.d.ts +2 -2
- package/dist/components/arcgis-arcade-suggestions.d.ts +2 -2
- package/dist/components/arcgis-arcade-variables.d.ts +2 -2
- package/dist/components/arcgis-code-editor.d.ts +2 -2
- package/dist/components/code-editor.js +251 -251
- package/dist/components/fields.js +69 -69
- package/dist/components/functional-components.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/markdown.js +28 -28
- package/dist/components/utilities.js +20 -20
- package/dist/esm/{arcade-defaults-d7893362.js → arcade-defaults-0bafa696.js} +1534 -1534
- package/dist/esm/arcade-mode-c17a1fa1.js +595 -0
- package/dist/esm/arcgis-arcade-api_6.entry.js +1404 -1408
- package/dist/esm/arcgis-coding-components.js +3 -3
- package/dist/esm/{cssMode-b1771f92.js → cssMode-3d18bd2b.js} +2 -2
- package/dist/esm/{html-af635d52.js → html-2bce5d77.js} +2 -2
- package/dist/esm/{htmlMode-3021c301.js → htmlMode-69d56956.js} +2 -2
- package/dist/esm/{index-fd6b2fd8.js → index-022fb97b.js} +67 -24
- package/dist/esm/index.js +2 -2
- package/dist/esm/{javascript-70589186.js → javascript-ded5c9d7.js} +3 -3
- package/dist/esm/{jsonMode-cb509b79.js → jsonMode-0bf84cb2.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{tsMode-ed90c9aa.js → tsMode-15d4e936.js} +2 -2
- package/dist/esm/{typescript-db8a0b18.js → typescript-cc4d00f0.js} +2 -2
- package/dist/types/components/arcade-api/arcade-api.d.ts +40 -40
- package/dist/types/components/arcade-api/t9n-types.d.ts +6 -6
- package/dist/types/components/arcade-editor/arcade-editor.d.ts +127 -127
- package/dist/types/components/arcade-editor/t9n-types.d.ts +6 -6
- package/dist/types/components/arcade-results/arcade-results.d.ts +47 -47
- package/dist/types/components/arcade-results/t9n-types.d.ts +11 -11
- package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +34 -34
- package/dist/types/components/arcade-suggestions/t9n-types.d.ts +4 -4
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +41 -41
- package/dist/types/components/arcade-variables/t9n-types.d.ts +6 -6
- package/dist/types/components/code-editor/code-editor.d.ts +73 -73
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/dist/types/utils/arcade-executor.d.ts +79 -79
- package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +66 -66
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +23 -23
- package/dist/types/utils/arcade-monaco/arcade-mode.d.ts +9 -9
- package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +7 -7
- package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +9 -9
- package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +12 -12
- package/dist/types/utils/arcade-monaco/types.d.ts +29 -29
- package/dist/types/utils/editor-suggestions.d.ts +24 -24
- package/dist/types/utils/functional-components.d.ts +1 -1
- package/dist/types/utils/markdown.d.ts +1 -1
- package/dist/types/utils/profile/editor-profile.d.ts +185 -185
- package/dist/types/utils/profile/types.d.ts +101 -101
- package/dist/types/utils/utilities.d.ts +1 -1
- package/package.json +7 -7
- package/dist/arcgis-coding-components/p-5d670bd2.js +0 -2
- package/dist/arcgis-coding-components/p-9e242e76.js +0 -1
- package/dist/arcgis-coding-components/p-ccdf0ac1.entry.js +0 -1
- package/dist/cjs/arcade-mode-b77afcc9.js +0 -598
- package/dist/esm/arcade-mode-70e22d22.js +0 -594
|
@@ -19,177 +19,177 @@ import '@esri/calcite-components/dist/components/calcite-list.js';
|
|
|
19
19
|
const arcadeApiCss = ":host{background-color:var(--calcite-ui-foreground-1)}:host .notice-container{margin:var(--calcite-spacing-quarter);padding:var(--calcite-spacing-half);background-color:var(--calcite-ui-foreground-1)}:host .sticky{position:sticky;top:0px;z-index:10}:host calcite-flow{height:100%}:host calcite-block p:first-of-type{margin-top:0}:host calcite-block code{font-family:var(--calcite-code-family)}:host calcite-block pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-ui-foreground-2);padding:var(--calcite-spacing-half)}:host calcite-block pre code{font-size:var(--calcite-font-size--2)}";
|
|
20
20
|
|
|
21
21
|
const ArcgisArcadeApi = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeApi extends HTMLElement {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.__registerHost();
|
|
25
|
+
this.__attachShadow();
|
|
26
|
+
this.close = createEvent(this, "close", 3);
|
|
27
|
+
this.itemSelected = createEvent(this, "itemSelected", 3);
|
|
28
|
+
this._emitItemSelected = (e) => {
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
const item = e.target?.["data-item"];
|
|
31
|
+
if (!item) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const keyEvent = e;
|
|
35
|
+
if (!keyEvent.key || keyEvent.key === "Enter") {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
this.itemSelected.emit(item.completion.insertText);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this._emitClose = () => this.close.emit();
|
|
41
|
+
this._emitItemSelectedAndClose = (e) => {
|
|
42
|
+
if (!e.target) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const keyEvent = e;
|
|
46
|
+
if (!keyEvent.key || keyEvent.key === "Enter") {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
this.itemSelected.emit(e.target["data-item"].completion.insertText);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this._selectItem = (e) => {
|
|
53
|
+
if (!e.target) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
// @ts-expect-error
|
|
58
|
+
this._selectedApiItem = e.target["data-item"];
|
|
59
|
+
};
|
|
60
|
+
this._unselectItem = async () => {
|
|
61
|
+
this._selectedApiItem = undefined;
|
|
62
|
+
};
|
|
48
63
|
// @ts-expect-error
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this._unselectItem = async () => {
|
|
61
|
-
this._selectedApiItem = undefined;
|
|
62
|
-
};
|
|
63
|
-
// @ts-expect-error
|
|
64
|
-
this._updateFilterValue = (e) => (this._filterValue = e.target?.["value"] ?? "");
|
|
65
|
-
this._lang = "";
|
|
66
|
-
this._t9nLocale = "";
|
|
67
|
-
this._t9nStrings = undefined;
|
|
68
|
-
this._selectedApiItem = undefined;
|
|
69
|
-
this._filterValue = "";
|
|
70
|
-
this._colorizeStyle = "";
|
|
71
|
-
this._preparingApi = false;
|
|
72
|
-
this._apiLibrary = undefined;
|
|
73
|
-
this.hideDocumentationActions = false;
|
|
74
|
-
this.modelId = undefined;
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
// #region Component lifecycle events
|
|
78
|
-
async componentWillLoad() {
|
|
79
|
-
this._colorizeStyle = generateColorizeStyles();
|
|
80
|
-
this._themeChangedListner = onColorizeThemeChanged(() => (this._colorizeStyle = generateColorizeStyles()));
|
|
81
|
-
await F(this, getAssetPath("./assets"));
|
|
82
|
-
arcadeDefaults.onModelContextDidChange((key) => {
|
|
83
|
-
if (!this.modelId || key !== Uri.parse(this.modelId).toString()) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this._updateApiLibrary();
|
|
87
|
-
});
|
|
88
|
-
this._updateApiLibrary();
|
|
89
|
-
}
|
|
90
|
-
disconnectedCallback() {
|
|
91
|
-
U(this);
|
|
92
|
-
this._flowObserver?.disconnect();
|
|
93
|
-
this._themeChangedListner?.dispose();
|
|
94
|
-
}
|
|
95
|
-
// #endregion
|
|
96
|
-
//#region Private Methods
|
|
97
|
-
async _updateApiLibrary() {
|
|
98
|
-
if (!this.modelId) {
|
|
99
|
-
return;
|
|
64
|
+
this._updateFilterValue = (e) => (this._filterValue = e.target?.value ?? "");
|
|
65
|
+
this._lang = "";
|
|
66
|
+
this._t9nLocale = "";
|
|
67
|
+
this._t9nStrings = undefined;
|
|
68
|
+
this._selectedApiItem = undefined;
|
|
69
|
+
this._filterValue = "";
|
|
70
|
+
this._colorizeStyle = "";
|
|
71
|
+
this._preparingApi = false;
|
|
72
|
+
this._apiLibrary = undefined;
|
|
73
|
+
this.hideDocumentationActions = false;
|
|
74
|
+
this.modelId = undefined;
|
|
100
75
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
76
|
+
//#endregion
|
|
77
|
+
// #region Component lifecycle events
|
|
78
|
+
async componentWillLoad() {
|
|
79
|
+
this._colorizeStyle = generateColorizeStyles();
|
|
80
|
+
this._themeChangedListner = onColorizeThemeChanged(() => (this._colorizeStyle = generateColorizeStyles()));
|
|
81
|
+
await F(this, getAssetPath("./assets"));
|
|
82
|
+
arcadeDefaults.onModelContextDidChange((key) => {
|
|
83
|
+
if (!this.modelId || key !== Uri.parse(this.modelId).toString()) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this._updateApiLibrary();
|
|
87
|
+
});
|
|
88
|
+
this._updateApiLibrary();
|
|
111
89
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
U(this);
|
|
92
|
+
this._flowObserver?.disconnect();
|
|
93
|
+
this._themeChangedListner?.dispose();
|
|
116
94
|
}
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
// #endregion
|
|
96
|
+
//#region Private Methods
|
|
97
|
+
async _updateApiLibrary() {
|
|
98
|
+
if (!this.modelId) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this._preparingApi = true;
|
|
102
|
+
try {
|
|
103
|
+
const arcadeWorker = await getArcadeWorker(Uri.parse(this.modelId));
|
|
104
|
+
if (!arcadeWorker) {
|
|
105
|
+
// Something went wrong
|
|
106
|
+
throw new Error("Undefined worker");
|
|
107
|
+
}
|
|
108
|
+
// Fetch the api definitions from the arcade LS worker.
|
|
109
|
+
const context = arcadeDefaults.getApiContextForModel(this.modelId);
|
|
110
|
+
this._apiLibrary = await arcadeWorker.getApiLibrary(context);
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
console.error("Could not load api library", e);
|
|
114
|
+
console.error(e.stack);
|
|
115
|
+
this._apiLibrary = undefined;
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
this._preparingApi = false;
|
|
119
|
+
}
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
flowFocusHandler(ref) {
|
|
122
|
+
// When a flow is removed from the document then a null ref will be passed in
|
|
123
|
+
if (!ref) {
|
|
124
|
+
this._flowObserver?.disconnect();
|
|
125
|
+
this._flowObserver = undefined;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (this._flowObserver) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Observer panel added/removed and also observe the flow id
|
|
132
|
+
// When switching between flow the same reference is reused
|
|
133
|
+
this._flowObserver = new MutationObserver(() => {
|
|
134
|
+
// Get the last panel and try to set focus on the input element
|
|
135
|
+
O(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
136
|
+
});
|
|
137
|
+
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
127
138
|
}
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region Renderers
|
|
141
|
+
renderApiCategory(category) {
|
|
142
|
+
const filteredApiItems = filterCollection(category.items, "name", this._filterValue);
|
|
143
|
+
if (!filteredApiItems.length) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
return (h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (h("calcite-list-item", { label: q(apiItem.completion.detail), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": apiItem }, h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "Expand", icon: "chevron-right", iconFlipRtl: true, scale: "s", onClick: this._selectItem, "data-item": apiItem }))))));
|
|
130
147
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (!filteredApiItems.length) {
|
|
144
|
-
return null;
|
|
148
|
+
renderApiItemFlowItem() {
|
|
149
|
+
const apiItem = this._selectedApiItem;
|
|
150
|
+
if (!apiItem) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return (h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", scale: "s", href: apiItem.link, target: "Arcade Help", "icon-start": "information" }, this._t9nStrings?.moreinformation)), h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelectedAndClose, "data-item": apiItem, ref: (e) => e?.setFocus() }, this._t9nStrings?.insert ?? "Insert"), h("calcite-block", { open: true, heading: q(apiItem.completion.detail) }, h("div", { innerHTML: convertMarkdownString(apiItem.completion.documentation) }), apiItem.examples ? (h("div", { ref: (e) => {
|
|
154
|
+
if (!e) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
e.innerHTML = convertMarkdownString(apiItem.examples);
|
|
158
|
+
colorizedAllCodeElements(e);
|
|
159
|
+
} })) : null)));
|
|
145
160
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (!apiItem) {
|
|
151
|
-
return null;
|
|
161
|
+
render() {
|
|
162
|
+
const categories = (this._apiLibrary ?? []).map((apiCategory) => this.renderApiCategory(apiCategory));
|
|
163
|
+
const empty = categories.every((g) => !g);
|
|
164
|
+
return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h(StickyFilterInput, { filterValue: this._filterValue, onCalciteInputInput: this._updateFilterValue }), this._preparingApi ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (h("calcite-list", null, empty ? h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No items") : categories))), this.renderApiItemFlowItem())));
|
|
152
165
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
e.innerHTML = convertMarkdownString(apiItem.examples);
|
|
158
|
-
colorizedAllCodeElements(e);
|
|
159
|
-
} })) : null)));
|
|
160
|
-
}
|
|
161
|
-
render() {
|
|
162
|
-
const categories = (this._apiLibrary ?? []).map((apiCategory) => this.renderApiCategory(apiCategory));
|
|
163
|
-
const empty = categories.every((g) => !g);
|
|
164
|
-
return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h(StickyFilterInput, { filterValue: this._filterValue, onCalciteInputInput: this._updateFilterValue }), this._preparingApi ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (h("calcite-list", null, empty ? h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No items") : categories))), this.renderApiItemFlowItem())));
|
|
165
|
-
}
|
|
166
|
-
static get assetsDirs() { return ["assets"]; }
|
|
167
|
-
get _hostElement() { return this; }
|
|
168
|
-
static get style() { return arcadeApiCss; }
|
|
166
|
+
static get assetsDirs() { return ["assets"]; }
|
|
167
|
+
get _hostElement() { return this; }
|
|
168
|
+
static get style() { return arcadeApiCss; }
|
|
169
169
|
}, [1, "arcgis-arcade-api", {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
170
|
+
"hideDocumentationActions": [4, "hide-documentation-actions"],
|
|
171
|
+
"modelId": [1, "model-id"],
|
|
172
|
+
"_lang": [32],
|
|
173
|
+
"_t9nLocale": [32],
|
|
174
|
+
"_t9nStrings": [32],
|
|
175
|
+
"_selectedApiItem": [32],
|
|
176
|
+
"_filterValue": [32],
|
|
177
|
+
"_colorizeStyle": [32],
|
|
178
|
+
"_preparingApi": [32],
|
|
179
|
+
"_apiLibrary": [32]
|
|
180
|
+
}]);
|
|
181
181
|
function defineCustomElement() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
if (typeof customElements === "undefined") {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const components = ["arcgis-arcade-api"];
|
|
186
|
+
components.forEach(tagName => { switch (tagName) {
|
|
187
|
+
case "arcgis-arcade-api":
|
|
188
|
+
if (!customElements.get(tagName)) {
|
|
189
|
+
customElements.define(tagName, ArcgisArcadeApi);
|
|
190
|
+
}
|
|
191
|
+
break;
|
|
192
|
+
} });
|
|
193
193
|
}
|
|
194
194
|
defineCustomElement();
|
|
195
195
|
|
|
@@ -4,57 +4,57 @@ import { c as importRequest } from './fields.js';
|
|
|
4
4
|
import { X, V } from './index2.js';
|
|
5
5
|
|
|
6
6
|
function isMonacoEnvironmentSetup() {
|
|
7
|
-
|
|
7
|
+
return !!globalThis.MonacoEnvironment?.getWorkerUrl;
|
|
8
8
|
}
|
|
9
9
|
const additionalLanguageWorkersMap = new Map();
|
|
10
10
|
function getAssetsPath() {
|
|
11
|
-
|
|
11
|
+
return globalThis.MonacoEnvironment?.assetsPath;
|
|
12
12
|
}
|
|
13
13
|
function setupMonacoEnvironment(assetsPath) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
// Since we are using workers, monaco needs to find them.
|
|
20
|
-
// Using the global MonacoEnvironment.
|
|
21
|
-
self.MonacoEnvironment = {
|
|
22
|
-
assetsPath,
|
|
23
|
-
getWorker: async (_, languageId) => {
|
|
24
|
-
// Manufacture the url for the web worker
|
|
25
|
-
let url = additionalLanguageWorkersMap.get(languageId) ?? `${assetsPath}/code-editor/editor.worker.js`;
|
|
26
|
-
switch (languageId) {
|
|
27
|
-
case "json":
|
|
28
|
-
url = `${assetsPath}/code-editor/json.worker.js`;
|
|
29
|
-
break;
|
|
30
|
-
case "css":
|
|
31
|
-
url = `${assetsPath}/code-editor/css.worker.js`;
|
|
32
|
-
break;
|
|
33
|
-
case "html":
|
|
34
|
-
url = `${assetsPath}/code-editor/html.worker.js`;
|
|
35
|
-
break;
|
|
36
|
-
case "typescript":
|
|
37
|
-
case "javascript":
|
|
38
|
-
url = `${assetsPath}/code-editor/ts.worker.js`;
|
|
39
|
-
break;
|
|
40
|
-
case "arcade":
|
|
41
|
-
url = `${assetsPath}/code-editor/arcade.worker.js`;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
// If we have a relative path or we are on same orgin, we can use the default js implementation
|
|
45
|
-
if (!X(url) || V(url, location.href, true)) {
|
|
46
|
-
return new Worker(url, { name: languageId });
|
|
47
|
-
}
|
|
48
|
-
// For cross orgin, we will load the worker code as a string and manufacture a blob
|
|
49
|
-
const esriRequest = await importRequest();
|
|
50
|
-
const response = await esriRequest(url, {
|
|
51
|
-
responseType: "text"
|
|
52
|
-
});
|
|
53
|
-
return new Worker(URL.createObjectURL(new Blob([response.data], {
|
|
54
|
-
type: "text/javascript"
|
|
55
|
-
})));
|
|
14
|
+
//
|
|
15
|
+
// Check if the worker loading logic has already been defined.
|
|
16
|
+
if (isMonacoEnvironmentSetup()) {
|
|
17
|
+
return;
|
|
56
18
|
}
|
|
57
|
-
|
|
19
|
+
// Since we are using workers, monaco needs to find them.
|
|
20
|
+
// Using the global MonacoEnvironment.
|
|
21
|
+
globalThis.MonacoEnvironment = {
|
|
22
|
+
assetsPath,
|
|
23
|
+
getWorker: async (_, languageId) => {
|
|
24
|
+
// Manufacture the url for the web worker
|
|
25
|
+
let url = additionalLanguageWorkersMap.get(languageId) ?? `${assetsPath}/code-editor/editor.worker.js`;
|
|
26
|
+
switch (languageId) {
|
|
27
|
+
case "json":
|
|
28
|
+
url = `${assetsPath}/code-editor/json.worker.js`;
|
|
29
|
+
break;
|
|
30
|
+
case "css":
|
|
31
|
+
url = `${assetsPath}/code-editor/css.worker.js`;
|
|
32
|
+
break;
|
|
33
|
+
case "html":
|
|
34
|
+
url = `${assetsPath}/code-editor/html.worker.js`;
|
|
35
|
+
break;
|
|
36
|
+
case "typescript":
|
|
37
|
+
case "javascript":
|
|
38
|
+
url = `${assetsPath}/code-editor/ts.worker.js`;
|
|
39
|
+
break;
|
|
40
|
+
case "arcade":
|
|
41
|
+
url = `${assetsPath}/code-editor/arcade.worker.js`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
// If we have a relative path or we are on same orgin, we can use the default js implementation
|
|
45
|
+
if (!X(url) || V(url, globalThis.location.href, true)) {
|
|
46
|
+
return new Worker(url, { name: languageId });
|
|
47
|
+
}
|
|
48
|
+
// For cross orgin, we will load the worker code as a string and manufacture a blob
|
|
49
|
+
const esriRequest = await importRequest();
|
|
50
|
+
const response = await esriRequest(url, {
|
|
51
|
+
responseType: "text"
|
|
52
|
+
});
|
|
53
|
+
return new Worker(URL.createObjectURL(new Blob([response.data], {
|
|
54
|
+
type: "text/javascript"
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -69,8 +69,8 @@ function setupMonacoEnvironment(assetsPath) {
|
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
71
|
async function getArcadeDiagnosticService() {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const mode = await getMode();
|
|
73
|
+
return mode.getArcadeDiagnosticService();
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Returns the arcade worker for the model.
|
|
@@ -81,31 +81,31 @@ async function getArcadeDiagnosticService() {
|
|
|
81
81
|
* @returns arcade worker
|
|
82
82
|
*/
|
|
83
83
|
async function getArcadeWorker(uri) {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const mode = await getMode();
|
|
85
|
+
return mode.getArcadeWorker(uri);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Request the arcade mode
|
|
89
89
|
* @returns mode for arcade
|
|
90
90
|
*/
|
|
91
91
|
function getMode() {
|
|
92
|
-
|
|
92
|
+
return import('./arcade-mode.js');
|
|
93
93
|
}
|
|
94
94
|
// Register the language in Monaco
|
|
95
95
|
languages.register({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
id: arcadeDefaults.languageId,
|
|
97
|
+
aliases: ["Arcade", "arcade"],
|
|
98
|
+
extensions: [".arc"],
|
|
99
|
+
mimetypes: ["application/arcade"]
|
|
100
100
|
});
|
|
101
101
|
// An event emitted when a language is first time needed
|
|
102
102
|
languages.onLanguage(arcadeDefaults.languageId, async () => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
// Setup the assets path on the arcadeDefaults
|
|
104
|
+
arcadeDefaults.setLanguageOptions({ assetsPath: `${getAssetsPath() ?? "."}/arcade-language` });
|
|
105
|
+
// Async import the language mode
|
|
106
|
+
const mode = await getMode();
|
|
107
|
+
// Setup the language mode
|
|
108
|
+
mode.setupMode(arcadeDefaults);
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
export { getArcadeDiagnosticService as a, getArcadeWorker as g, setupMonacoEnvironment as s };
|