@arcgis/coding-components 4.31.0-next.54 → 4.31.0-next.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  2. package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +3 -3
  3. package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +32 -32
  4. package/dist/arcgis-coding-components/assets/sql-expression-editor/t9n/sql-expression-editor.t9n.en.json +4 -0
  5. package/dist/arcgis-coding-components/assets/sql-expression-fields/t9n/sql-expression-fields.t9n.en.json +4 -0
  6. package/dist/arcgis-coding-components/index.esm.js +2 -2
  7. package/dist/arcgis-coding-components/{p-e99ebc55.js → p-0048c7be.js} +2 -2
  8. package/dist/arcgis-coding-components/p-3966b909.entry.js +6 -0
  9. package/dist/arcgis-coding-components/p-47da1193.entry.js +6 -0
  10. package/dist/arcgis-coding-components/{p-26d3fcc7.js → p-4afbb375.js} +1 -1
  11. package/dist/arcgis-coding-components/{p-ee8e91c5.js → p-4d15b7fb.js} +2 -2
  12. package/dist/arcgis-coding-components/{p-bf7e11fd.js → p-4d8c4601.js} +2 -2
  13. package/dist/arcgis-coding-components/{p-2aa428af.js → p-515abc51.js} +1 -1
  14. package/dist/arcgis-coding-components/{p-f048c26d.js → p-5285c444.js} +2 -2
  15. package/dist/arcgis-coding-components/p-529e06e1.js +6 -0
  16. package/dist/arcgis-coding-components/{p-5f82bda4.js → p-605de796.js} +9 -9
  17. package/dist/arcgis-coding-components/{p-40c8e02b.js → p-8afe732b.js} +2 -2
  18. package/dist/arcgis-coding-components/p-9e8d27e9.js +6 -0
  19. package/dist/arcgis-coding-components/{p-187be214.js → p-b620b06c.js} +3 -3
  20. package/dist/arcgis-coding-components/{p-7518bf06.js → p-bf988dbf.js} +2 -2
  21. package/dist/arcgis-coding-components/{p-eac1cf63.js → p-d6a50105.js} +2 -2
  22. package/dist/arcgis-coding-components/{p-9cfd8c44.js → p-dbc5c2e8.js} +1 -1
  23. package/dist/arcgis-coding-components/p-e36a3779.js +6 -0
  24. package/dist/arcgis-coding-components/p-f2a42428.entry.js +6 -0
  25. package/dist/cjs/{app-globals-633389bb.js → app-globals-0b20f844.js} +1 -1
  26. package/dist/cjs/{arcade-defaults-e89d821f.js → arcade-defaults-d588ea90.js} +4 -4
  27. package/dist/cjs/{arcade-mode-51017641.js → arcade-mode-23964e19.js} +16 -3
  28. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +46 -123
  29. package/dist/cjs/arcgis-coding-components.cjs.js +4 -4
  30. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +32 -11
  31. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +16 -10
  32. package/dist/cjs/{css-2a866ead.js → css-1527ad06.js} +1 -1
  33. package/dist/cjs/{cssMode-322bf1ca.js → cssMode-266600eb.js} +2 -2
  34. package/dist/cjs/{html-bf50b9d5.js → html-c79594b0.js} +2 -2
  35. package/dist/cjs/{htmlMode-e064979b.js → htmlMode-9f7c4794.js} +2 -2
  36. package/dist/cjs/{index-c6ca5d79.js → index-a6a79883.js} +1 -1
  37. package/dist/cjs/index.cjs.js +4 -4
  38. package/dist/cjs/{javascript-59b31aab.js → javascript-f757ee11.js} +3 -3
  39. package/dist/cjs/{jsonMode-62d33ca8.js → jsonMode-730c12d6.js} +2 -2
  40. package/dist/cjs/{language-defaults-base-7f799681.js → language-defaults-base-f992e8fd.js} +9 -9
  41. package/dist/cjs/loader.cjs.js +4 -4
  42. package/dist/cjs/{sql-expr-defaults-56a073df.js → sql-expr-defaults-14e3c0f4.js} +161 -38
  43. package/dist/cjs/{sql-expr-mode-b76f2cd7.js → sql-expr-mode-5cf780b5.js} +17 -4
  44. package/dist/cjs/{tsMode-343a564e.js → tsMode-f009817f.js} +2 -2
  45. package/dist/cjs/{typescript-aa39a9f1.js → typescript-b067d8ea.js} +2 -2
  46. package/dist/components/arcade-defaults.js +1 -1
  47. package/dist/components/arcade-mode.js +16 -3
  48. package/dist/components/arcade-results.js +2 -2
  49. package/dist/components/arcade-suggestions.js +2 -2
  50. package/dist/components/arcade-variables.js +2 -2
  51. package/dist/components/arcgis-arcade-editor.js +17 -10
  52. package/dist/components/arcgis-arcade-results.js +1 -1
  53. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  54. package/dist/components/arcgis-arcade-variables.js +1 -1
  55. package/dist/components/arcgis-assets.d.ts +1 -1
  56. package/dist/components/arcgis-assets.js +1 -1
  57. package/dist/components/arcgis-code-editor.js +1 -1
  58. package/dist/components/arcgis-language-api-panel.js +1 -1
  59. package/dist/components/arcgis-sql-expression-editor.js +33 -11
  60. package/dist/components/arcgis-sql-expression-fields.js +1 -1
  61. package/dist/components/{chunk-BMBYH3VH.js → chunk-W77CUVCX.js} +54 -31
  62. package/dist/components/code-editor.js +4 -3
  63. package/dist/components/fields.js +1 -1
  64. package/dist/components/index.js +1 -1
  65. package/dist/components/index2.js +1 -1
  66. package/dist/components/language-api-panel.js +22 -4
  67. package/dist/components/language-defaults-base.js +1 -1
  68. package/dist/components/markdown.js +1 -1
  69. package/dist/components/sql-expr-defaults.js +1 -1
  70. package/dist/components/sql-expr-mode.js +15 -2
  71. package/dist/components/sql-expression-fields.js +15 -8
  72. package/dist/components/useT9n.js +2 -2
  73. package/dist/components/utilities.js +1 -1
  74. package/dist/esm/{app-globals-7a9ff748.js → app-globals-68a9d20e.js} +1 -1
  75. package/dist/esm/{arcade-defaults-112cabaa.js → arcade-defaults-06fa8817.js} +4 -4
  76. package/dist/esm/{arcade-mode-78a2482d.js → arcade-mode-e2e247bd.js} +16 -3
  77. package/dist/esm/arcgis-arcade-editor_6.entry.js +41 -118
  78. package/dist/esm/arcgis-coding-components.js +5 -5
  79. package/dist/esm/arcgis-sql-expression-editor.entry.js +32 -11
  80. package/dist/esm/arcgis-sql-expression-fields.entry.js +16 -10
  81. package/dist/esm/{css-e8c18f98.js → css-9bd3c065.js} +1 -1
  82. package/dist/esm/{cssMode-769cabbb.js → cssMode-b0760052.js} +2 -2
  83. package/dist/esm/{html-91c19065.js → html-bccc0bb4.js} +2 -2
  84. package/dist/esm/{htmlMode-2e105097.js → htmlMode-d49b807b.js} +2 -2
  85. package/dist/esm/{index-20936dfe.js → index-b5d43ca7.js} +1 -1
  86. package/dist/esm/index.js +4 -4
  87. package/dist/esm/{javascript-68620191.js → javascript-56c5dd2a.js} +3 -3
  88. package/dist/esm/{jsonMode-e89d6d21.js → jsonMode-5e5edb97.js} +2 -2
  89. package/dist/esm/{language-defaults-base-9e3f1f44.js → language-defaults-base-307b77e5.js} +10 -10
  90. package/dist/esm/loader.js +5 -5
  91. package/dist/esm/{sql-expr-defaults-3913a59f.js → sql-expr-defaults-c2608671.js} +161 -35
  92. package/dist/esm/{sql-expr-mode-abd729cf.js → sql-expr-mode-a76dd370.js} +17 -4
  93. package/dist/esm/{tsMode-05dfb27e.js → tsMode-81f755f4.js} +2 -2
  94. package/dist/esm/{typescript-d6646874.js → typescript-63767e00.js} +2 -2
  95. package/dist/loader/cdn.js +1 -1
  96. package/dist/loader/index.cjs.js +1 -1
  97. package/dist/loader/index.es2017.js +1 -1
  98. package/dist/loader/index.js +1 -1
  99. package/dist/types/components/arcade-editor/arcade-editor.d.ts +4 -3
  100. package/dist/types/components/language-api-panel/language-api-panel.d.ts +1 -0
  101. package/dist/types/components/sql-expression-editor/sql-expression-editor.d.ts +31 -3
  102. package/dist/types/components/sql-expression-fields/sql-expression-fields.d.ts +17 -0
  103. package/dist/types/components.d.ts +27 -0
  104. package/dist/types/data/arcgis-web-compoments/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +3 -0
  105. package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +6 -0
  106. package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +6 -0
  107. package/package.json +11 -11
  108. package/dist/arcgis-coding-components/p-0d09a590.js +0 -6
  109. package/dist/arcgis-coding-components/p-710acdb6.entry.js +0 -6
  110. package/dist/arcgis-coding-components/p-8157c6db.entry.js +0 -6
  111. package/dist/arcgis-coding-components/p-83675007.js +0 -6
  112. package/dist/arcgis-coding-components/p-c5f85501.js +0 -6
  113. package/dist/arcgis-coding-components/p-e65a39fc.entry.js +0 -6
  114. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +0 -3
  115. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/arcade-editor.stories.d.ts +0 -0
  116. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +0 -0
  117. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/code-editor/code-editor.stories.d.ts +0 -0
  118. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/sql-expression-editor/sql-expression-editor.stories.d.ts +0 -0
  119. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/reference/stories/arcade-editor.stories.d.ts +0 -0
  120. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-inline-url-importer.d.ts +0 -0
  121. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-json-importer.d.ts +0 -0
  122. /package/dist/types/data/{actions-runner-1 → arcgis-web-compoments/actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/stencil-monaco-plugins.d.ts +0 -0
@@ -1,12 +1,14 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
6
  import { editor, languages, Emitter } from 'monaco-editor';
7
+ import { D as Deferred, t as debounce } from './index2.js';
7
8
  import { s as sqlExprDefaults } from './sql-expr-defaults.js';
8
- import { t as debounce } from './index2.js';
9
9
 
10
+ // hold onto a promise that resolves when the worker is ready
11
+ let deferredWorker = new Deferred();
10
12
  /**
11
13
  * Manager to create our sql-expression worker and client proxy
12
14
  */
@@ -26,9 +28,17 @@ class SqlExprWorkerManager {
26
28
  if (this._worker) {
27
29
  this._worker.dispose();
28
30
  this._worker = null;
31
+ deferredWorker = new Deferred();
29
32
  }
30
33
  this._client = null;
31
34
  }
35
+ /**
36
+ * Wait for the worker to be ready.
37
+ * @returns A promise that resolves when the worker is ready.
38
+ */
39
+ static async waitForWorker() {
40
+ return await deferredWorker.promise;
41
+ }
32
42
  async _getClientProxy() {
33
43
  // We used createWebWorker to create or run the web worker if it isn’t already created.
34
44
  // Otherwise, we get and return the proxy client.
@@ -42,6 +52,7 @@ class SqlExprWorkerManager {
42
52
  languageOptions,
43
53
  },
44
54
  });
55
+ deferredWorker.resolve(this._worker);
45
56
  this._client = this._worker.getProxy();
46
57
  }
47
58
  return await this._client;
@@ -401,6 +412,8 @@ let sqlExprWorker;
401
412
  * @returns The sql-expression worker.
402
413
  */
403
414
  async function getSqlExprWorker(...uris) {
415
+ // ensures the worker is registered
416
+ await SqlExprWorkerManager.waitForWorker();
404
417
  return await new Promise((resolve, reject) => {
405
418
  if (!sqlExprWorker) {
406
419
  reject(new Error("sql expression worker not registered!"));
@@ -1,11 +1,12 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
7
- import { u as useControllerManager } from './chunk-BMBYH3VH.js';
7
+ import { u as useControllerManager } from './chunk-W77CUVCX.js';
8
8
  import { s as sqlExprDefaults } from './sql-expr-defaults.js';
9
+ import { u as useT9n } from './useT9n.js';
9
10
  import "@esri/calcite-components/dist/components/calcite-block.js";
10
11
  import "@esri/calcite-components/dist/components/calcite-flow.js";
11
12
  import "@esri/calcite-components/dist/components/calcite-flow-item.js";
@@ -27,22 +28,28 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
27
28
  this.arcgisClose = createEvent(this, "arcgisClose", 3);
28
29
  this.arcgisFieldSelected = createEvent(this, "arcgisFieldSelected", 3);
29
30
  this.manager = useControllerManager(this,forceUpdate);
31
+ this.messages = useT9n();
30
32
  // #endregion
31
33
  // #region Private Methods
32
34
  this._handleSelectField = (event) => {
33
35
  if (event.target instanceof HTMLElement) {
34
36
  const tagName = event.target.tagName;
35
37
  switch (tagName.toLowerCase()) {
36
- case "calcite-list-item":
37
- // TODO: why is value missing from HTMLCalciteListElement type?
38
- this.arcgisFieldSelected.emit(event.target.value ?? "");
38
+ case "calcite-list-item": {
39
+ const value = event.target.value;
40
+ this.arcgisFieldSelected.emit(value ?? "");
39
41
  break;
42
+ }
40
43
  case "calcite-action":
41
44
  event.stopPropagation();
42
45
  break;
43
46
  }
44
47
  }
45
48
  };
49
+ this._handleSelectDomain = (event) => {
50
+ const value = event.target.value;
51
+ this.arcgisFieldSelected.emit(value ? `'${value}'` : "");
52
+ };
46
53
  this._emitClose = () => {
47
54
  this.arcgisClose.emit();
48
55
  };
@@ -65,14 +72,14 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
65
72
  render() {
66
73
  const layer = sqlExprDefaults.getFeatureLayerForModel(this.modelId ?? "");
67
74
  if (this.loading || !this.modelId || !layer) {
68
- return h("calcite-block", { heading: "Available Fields" });
75
+ return h("calcite-block", { heading: this.messages.availablefields ?? "" });
69
76
  }
70
- return (h("calcite-flow", null, h("calcite-flow-item", { heading: "Available Fields", closable: true, description: "Select a field to insert into the expression", onCalciteFlowItemClose: this._emitClose }, h("calcite-list", { filterEnabled: true }, layer.fields.map((field) => (h("calcite-list-item", { key: field.name, onClick: this._handleSelectField, label: field.name, description: field.alias, value: field.name }, field.domain && (h("calcite-action", { slot: "actions-end", text: "open", icon: "chevron-right", onClick: () => {
77
+ return (h("calcite-flow", null, h("calcite-flow-item", { heading: this.messages.availablefields ?? "", closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-list", { filterEnabled: true }, layer.fields.map((field) => (h("calcite-list-item", { key: field.name, onClick: this._handleSelectField, label: field.name, description: field.alias, value: field.name }, field.domain && (h("calcite-action", { slot: "actions-end", text: "open", icon: "chevron-right", onClick: () => {
71
78
  const domain = field.domain;
72
79
  if (domain.type === "coded-value") {
73
80
  this._flowItemRenderers = [
74
81
  ...this._flowItemRenderers,
75
- () => (h("calcite-flow-item", { closable: true, heading: "Domains", description: field.name, onCalciteFlowItemClose: this._emitClose }, h("calcite-list", null, domain.codedValues.map((value) => (h("calcite-list-item", { key: value.code, onClick: this._handleSelectField, label: value.name, description: String(value.code), value: value.code })))))),
82
+ () => (h("calcite-flow-item", { closable: true, heading: this.messages.domainvalues ?? "", description: field.name, onCalciteFlowItemClose: this._emitClose }, h("calcite-list", null, domain.codedValues.map((value) => (h("calcite-list-item", { key: value.code, onClick: this._handleSelectDomain, label: value.name, description: String(value.code), value: String(value.code) })))))),
76
83
  ];
77
84
  }
78
85
  } }))))))), this._flowItemRenderers.map((renderer) => renderer())));
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
- import { p as proxyExports, w as watch, C as Controller, s as setAmbientComponent } from './chunk-BMBYH3VH.js';
6
+ import { p as proxyExports, w as watch, C as Controller, s as setAmbientComponent } from './chunk-W77CUVCX.js';
7
7
  import { n as startLocaleObserver, p as getElementLocales } from './index2.js';
8
8
  import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
9
9
 
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
6
  import { d as createFilterExpression } from './index2.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
6
  const globalScripts = () => {};
7
7
 
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
- import { m as main, f as fieldsToProfileValues, i as isPredefinedProfile, a as isFeatureSetCollectionDefinition, b as isFeatureSetDefinition, c as isFeatureDefinition, s as supportedLocales, L as LanguageDefaultsBase, d as fetchT9nStringsBundle, E as EditorProfile, U as Uri } from './language-defaults-base-9e3f1f44.js';
7
- import { g as getAssetPath } from './index-20936dfe.js';
6
+ import { m as main, f as fieldsToProfileValues, i as isPredefinedProfile, a as isFeatureSetCollectionDefinition, b as isFeatureSetDefinition, c as isFeatureDefinition, s as supportedLocales, L as LanguageDefaultsBase, d as fetchT9nStringsBundle, E as EditorProfile, U as Uri } from './language-defaults-base-307b77e5.js';
7
+ import { g as getAssetPath } from './index-b5d43ca7.js';
8
8
 
9
9
  /**
10
10
  * Returns the arcade diagnostic service.
@@ -38,7 +38,7 @@ async function getArcadeWorker(uri) {
38
38
  * @returns arcade mode module
39
39
  */
40
40
  async function getMode() {
41
- return await import('./arcade-mode-78a2482d.js');
41
+ return await import('./arcade-mode-e2e247bd.js');
42
42
  }
43
43
 
44
44
  // #region convert editor profile to apiProfile
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
- import { m as main, g as editor, O as MarkerSeverity, R as Range, z as languages, P as debounce, Q as Emitter } from './language-defaults-base-9e3f1f44.js';
6
+ import { m as main, g as editor, O as MarkerSeverity, R as Range, x as languages, P as debounce, D as Deferred, Q as Emitter } from './language-defaults-base-307b77e5.js';
7
7
 
8
- var V={False:"false",Null:"null",True:"true"},f={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Ee=["++","--"],Je=["-","+","!","~"],Qe=["=","/=","*=","%=","+=","-="],Ze=["||","&&"],Lt=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"];var U=[[],[],[]];Ee.forEach(t=>U[t.length-1]?.push(t));Je.forEach(t=>U[t.length-1]?.push(t));Ze.forEach(t=>U[t.length-1]?.push(t));Qe.forEach(t=>U[t.length-1]?.push(t));Lt.forEach(t=>U[t.length-1]?.push(t));var ft=Object.values(f),gt=Object.values(V);gt.map(t=>({label:t,kind:main.exports.CompletionItemKind.Constant}));ft.map(t=>({label:t,kind:main.exports.CompletionItemKind.Keyword}));
8
+ var V={False:"false",Null:"null",True:"true"},f={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Ee=["++","--"],Je=["-","+","!","~"],Qe=["=","/=","*=","%=","+=","-="],Ze=["||","&&"],Bt=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"];var U=[[],[],[]];Ee.forEach(t=>U[t.length-1]?.push(t));Je.forEach(t=>U[t.length-1]?.push(t));Ze.forEach(t=>U[t.length-1]?.push(t));Qe.forEach(t=>U[t.length-1]?.push(t));Bt.forEach(t=>U[t.length-1]?.push(t));var ft=Object.values(f),gt=Object.values(V);gt.map(t=>({label:t,kind:main.exports.CompletionItemKind.Constant}));ft.map(t=>({label:t,kind:main.exports.CompletionItemKind.Keyword}));
9
9
 
10
10
  const operators = [
11
11
  "<=",
@@ -476,6 +476,8 @@ class FormattingProvider {
476
476
  }
477
477
  //#endregion
478
478
 
479
+ // hold onto a promise that resolves when the worker is ready
480
+ let deferredWorker = new Deferred();
479
481
  /**
480
482
  * Manager to create our arcade worker and client proxy
481
483
  */
@@ -495,9 +497,17 @@ class WorkerManager {
495
497
  if (this._worker) {
496
498
  this._worker.dispose();
497
499
  this._worker = null;
500
+ deferredWorker = new Deferred();
498
501
  }
499
502
  this._client = null;
500
503
  }
504
+ /**
505
+ * Wait for the worker to be ready.
506
+ * @returns A promise that resolves when the worker is ready.
507
+ */
508
+ static async waitForWorker() {
509
+ return await deferredWorker.promise;
510
+ }
501
511
  async _getClientProxy() {
502
512
  // We used createWebWorker to create or run the web worker if it isn’t already created.
503
513
  // Otherwise, we get and return the proxy client.
@@ -511,6 +521,7 @@ class WorkerManager {
511
521
  languageOptions,
512
522
  },
513
523
  });
524
+ deferredWorker.resolve(this._worker);
514
525
  this._client = this._worker.getProxy();
515
526
  }
516
527
  return await this._client;
@@ -529,6 +540,8 @@ let arcadeWorker;
529
540
  * @returns The arcade worker.
530
541
  */
531
542
  async function getArcadeWorker(...uris) {
543
+ // ensures the worker is registered
544
+ await WorkerManager.waitForWorker();
532
545
  return await new Promise((resolve, reject) => {
533
546
  if (!arcadeWorker) {
534
547
  reject(new Error("Arcade not registered!"));
@@ -1,12 +1,12 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
- import { g as getAssetPath, r as registerInstance, c as createEvent, h, F as Fragment, H as Host, a as getElement } from './index-20936dfe.js';
7
- import { e as importArcade, g as editor, h as startLocaleObserver, j as getElementLocales, k as isURL, l as hasSameOrigin, n as importRequest, D as Deferred, o as generateGuid, p as getElementTheme, K as KeyCode, q as setValuesInString, r as quoteString, t as supportedFields, u as generateTokensCSSForColorMap, S as StandaloneServices, I as IStandaloneThemeService, v as commonjsGlobal, w as setFocusOnElement, x as filterCollection, y as createFilterExpression, z as languages, R as Range, A as observeAncestorsMutation, U as Uri, B as KeyMod, C as addLTRMark } from './language-defaults-base-9e3f1f44.js';
8
- import { p as proxyExports, w as watch, C as Controller, s as setAmbientComponent, u as useControllerManager, g as getSet, a as sqlExprDefaults, b as getMode$1 } from './sql-expr-defaults-3913a59f.js';
9
- import { b as arcadeDefaults, g as getArcadeDiagnosticService, c as getMode } from './arcade-defaults-112cabaa.js';
6
+ import { r as registerInstance, c as createEvent, g as getAssetPath, h, F as Fragment, H as Host, a as getElement } from './index-b5d43ca7.js';
7
+ import { e as importArcade, g as editor, h as isURL, j as hasSameOrigin, k as importRequest, D as Deferred, l as generateGuid, n as getElementTheme, K as KeyCode, o as setValuesInString, q as quoteString, p as supportedFields, r as generateTokensCSSForColorMap, S as StandaloneServices, I as IStandaloneThemeService, t as commonjsGlobal, u as setFocusOnElement, v as filterCollection, w as createFilterExpression, x as languages, R as Range, y as observeAncestorsMutation, U as Uri, z as KeyMod, A as addLTRMark } from './language-defaults-base-307b77e5.js';
8
+ import { u as useControllerManager, a as useT9n, g as getSet, s as sqlExprDefaults, b as getMode$1 } from './sql-expr-defaults-c2608671.js';
9
+ import { b as arcadeDefaults, g as getArcadeDiagnosticService, c as getMode } from './arcade-defaults-06fa8817.js';
10
10
 
11
11
  const DevelopersWebSitePath = "https://developers.arcgis.com/arcade/";
12
12
  const MaxArrayItems = 100;
@@ -290,107 +290,6 @@ function updateThemeColors(theme, colorRules) {
290
290
  editor.defineTheme(base, { base, inherit: true, rules, colors: {} });
291
291
  }
292
292
 
293
- // src/functional.ts
294
- var makeController = (constructor) => proxy(void 0, constructor);
295
- var FunctionalController = class extends Controller {
296
- constructor(component, constructor) {
297
- super(component);
298
- const originalExports = this.exports;
299
- try {
300
- setAmbientComponent(this.component);
301
- const value = constructor(this.component, this);
302
- const constructorChangedExports = this.exports !== originalExports;
303
- if (value instanceof Promise) {
304
- if (!constructorChangedExports) {
305
- this.setProvisionalExports(value);
306
- }
307
- const resolved = value.then((result) => {
308
- this.exports = result;
309
- super.catchUpLifecycle();
310
- }).catch((error) => {
311
- this._ready.reject(error);
312
- console.error(error);
313
- });
314
- this.onLoad(async () => await resolved);
315
- } else {
316
- if (!constructorChangedExports || value !== void 0) {
317
- this.exports = value;
318
- }
319
- queueMicrotask(() => super.catchUpLifecycle());
320
- }
321
- } catch (error) {
322
- this._ready.reject(error);
323
- console.error(error);
324
- }
325
- }
326
- /** Noop - will be called in the constructor instead */
327
- catchUpLifecycle() {
328
- return;
329
- }
330
- };
331
- var proxy = proxyExports(FunctionalController);
332
- var makeT9nController = (getAssetPath) => (options = {}) => (
333
- // eslint-disable-next-line @typescript-eslint/promise-function-async
334
- makeController((component, controller) => {
335
- const componentWithOverrides = component;
336
- controller.onLifecycle(
337
- () => startLocaleObserver(
338
- component.el,
339
- getAssetPath("./assets"),
340
- ({ t9nLocale, t9nStrings, lang }) => {
341
- const withoutOverrides = {
342
- ...t9nStrings,
343
- _lang: lang,
344
- _t9nLocale: t9nLocale,
345
- _loading: false
346
- };
347
- controller.exports = withoutOverrides;
348
- const label = t9nStrings.componentLabel ?? t9nStrings.widgetLabel;
349
- if (typeof label === "string" && "label" in component && component.label == null) {
350
- component.label ?? (component.label = label);
351
- }
352
- applyOverrides(componentWithOverrides.messageOverrides);
353
- },
354
- options.name
355
- )
356
- );
357
- function applyOverrides(messageOverrides) {
358
- const currentValue = controller.exports;
359
- const rawMessages = currentValue._original ?? currentValue;
360
- const updated = deepMerge(rawMessages, messageOverrides);
361
- updated._original = rawMessages;
362
- controller.exports = updated;
363
- }
364
- if ("messageOverrides" in componentWithOverrides) {
365
- controller.onLifecycle(() => watch(componentWithOverrides, "messageOverrides", applyOverrides));
366
- }
367
- if (options.blocking) {
368
- return controller.ready;
369
- }
370
- const locale = getElementLocales(component.el);
371
- const pending = {
372
- _lang: locale.lang,
373
- _t9nLocale: locale.t9nLocale,
374
- _loading: true
375
- };
376
- return pending;
377
- })
378
- );
379
- function deepMerge(original, overwrites) {
380
- if (!overwrites) {
381
- return original;
382
- }
383
- const merged = { ...original };
384
- Object.entries(overwrites).forEach(([key, value]) => {
385
- if (typeof value === "object") {
386
- merged[key] = deepMerge(original[key], value);
387
- } else {
388
- merged[key] = value ?? original[key];
389
- }
390
- });
391
- return merged;
392
- }
393
-
394
293
  function isMonacoEnvironmentSetup() {
395
294
  return !!window.MonacoEnvironment?.getWorkerUrl;
396
295
  }
@@ -449,8 +348,6 @@ function setupMonacoEnvironment(assetsPath) {
449
348
  };
450
349
  }
451
350
 
452
- const useT9n = makeT9nController(getAssetPath);
453
-
454
351
  const arcadeEditorCss = "arcgis-arcade-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:1px solid var(--calcite-color-border-3);box-sizing:border-box;background-color:var(--calcite-color-foreground-1);height:100%}arcgis-arcade-editor .flex-adjustable{flex:1 1 auto;overflow:hidden}arcgis-arcade-editor .flex-panel{flex:1 0 auto}arcgis-arcade-editor .position-relative{position:relative}arcgis-arcade-editor .flex-row{display:flex;flex-direction:row;overflow:hidden}arcgis-arcade-editor .flex-column{display:flex;flex-direction:column;overflow:hidden}arcgis-arcade-editor .border-inline-start{border-inline-start:1px solid var(--calcite-color-border-3);box-sizing:border-box}arcgis-arcade-editor .border-inline-end{border-inline-end:1px solid var(--calcite-color-border-3);box-sizing:border-box}arcgis-arcade-editor .sticky{position:sticky;top:0px;z-index:10}arcgis-arcade-editor .notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1);text-align:center}arcgis-arcade-editor .side-action-bar{max-width:25%}arcgis-arcade-editor .side-panel{max-width:45%;width:600px}arcgis-arcade-editor .side-panel calcite-flow{height:100%}arcgis-arcade-editor .main-action-bar{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}arcgis-arcade-editor .main-action-bar calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}arcgis-arcade-editor .main-action-bar calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}arcgis-arcade-editor .main-action-bar calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}arcgis-arcade-editor .main-action-bar calcite-action-group:last-child{border-inline-end-width:0px}arcgis-arcade-editor .main-action-bar calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}arcgis-arcade-editor arcgis-arcade-results{border-top:1px solid var(--calcite-color-border-3);box-sizing:border-box;max-height:50%;min-height:50%;margin-bottom:-1px}arcgis-arcade-editor calcite-flow [slot=footer]{word-break:break-word}";
455
352
  const ArcgisArcadeEditorStyle0 = arcadeEditorCss;
456
353
 
@@ -535,11 +432,13 @@ const ArcgisArcadeEditor = class {
535
432
  set: "ignore",
536
433
  });
537
434
  }
538
- _messagesChanged() {
539
- this._updateArcadeDefaults().catch(console.error);
435
+ async _messagesChanged() {
436
+ await this._updateEditorProfile().catch(console.error);
437
+ await this._updateApiLibrary().catch(console.error);
540
438
  }
541
- _profileChanged() {
542
- this._updateArcadeDefaults().catch(console.error);
439
+ async _profileChanged() {
440
+ await this._updateEditorProfile().catch(console.error);
441
+ await this._updateApiLibrary().catch(console.error);
543
442
  }
544
443
  _testDataChanged() {
545
444
  if (!this._showExecutionPanel) {
@@ -621,12 +520,15 @@ const ArcgisArcadeEditor = class {
621
520
  // However, we need to setup the environment before the code editor is instantiated because
622
521
  // we need to access the arcade language service to get the api library.
623
522
  setupMonacoEnvironment(assetsPath);
624
- await this._updateArcadeDefaults();
523
+ await this._updateEditorProfile();
625
524
  }
626
525
  async componentDidLoad() {
627
526
  // Mark on component as ready.
628
527
  // Some methods are waiting for this state to actually continue.
629
528
  this._componentReadyDefer.resolve();
529
+ // We do updateApiLibrary in componentDidLoad because we need to wait until code editor
530
+ // is rendered for worker to register and allow for fetching the sdk
531
+ await this._updateApiLibrary();
630
532
  // Start listening to the validation diagnostics.
631
533
  // We are doing this as late as possible
632
534
  const diagnosticsService = await getArcadeDiagnosticService();
@@ -655,7 +557,7 @@ const ArcgisArcadeEditor = class {
655
557
  }
656
558
  // #endregion
657
559
  // #region Private methods API
658
- async _updateArcadeDefaults() {
560
+ async _updateEditorProfile() {
659
561
  // The profile definition or the locale has changed.
660
562
  // Ask the arcade defaults to prepare the profile for the model and to download the api library.
661
563
  this._preparingArcade = true;
@@ -665,7 +567,6 @@ const ArcgisArcadeEditor = class {
665
567
  snippets: this.snippets,
666
568
  });
667
569
  this._editorProfile = arcadeDefaults.getEditorProfileForModel(this._modelId);
668
- this._apiLibrary = await arcadeDefaults.getApiLibrary(this._modelId);
669
570
  }
670
571
  catch {
671
572
  this._editorProfile = undefined;
@@ -675,6 +576,9 @@ const ArcgisArcadeEditor = class {
675
576
  this._preparingArcade = false;
676
577
  }
677
578
  }
579
+ async _updateApiLibrary() {
580
+ this._apiLibrary = await arcadeDefaults.getApiLibrary(this._modelId);
581
+ }
678
582
  // #endregion
679
583
  //#region Render Main Action Bar
680
584
  renderMainActionBar() {
@@ -757,7 +661,7 @@ const ArcgisArcadeEditor = class {
757
661
  //#endregion
758
662
  //#region Render
759
663
  render() {
760
- return (h(Host, { key: 'f8a7e9cb7620c72586fc06dba017a44b63330198' }, this.renderMainActionBar(), h("div", { key: '086f52ceaa74266a8bcd28833ae526f73537a165', class: "flex-row flex-adjustable" }, h("div", { key: 'fa33e21b52d41b7c01a504eb85a229714b8c0556', class: "flex-column flex-adjustable" }, this.renderMainPanel(), this.renderResultsPanel()), this.renderSidePanel(), this.renderSideActionBar())));
664
+ return (h(Host, { key: '0d94f0940e22ebdf09ce14dac1f29ff6d0cda848' }, this.renderMainActionBar(), h("div", { key: 'cf41e32ee268570fc70204de9885f351bf2f0f6e', class: "flex-row flex-adjustable" }, h("div", { key: 'd2dd6c0e068baa18aa057b53b31b5ee552de97bc', class: "flex-column flex-adjustable" }, this.renderMainPanel(), this.renderResultsPanel()), this.renderSidePanel(), this.renderSideActionBar())));
761
665
  }
762
666
  static get assetsDirs() { return ["assets"]; }
763
667
  get el() { return getElement(this); }
@@ -4420,6 +4324,7 @@ const ArcgisCodeEditor = class {
4420
4324
  this.addCommonEditorActions();
4421
4325
  }
4422
4326
  disconnectedCallback() {
4327
+ this._editorInstance?.getModel()?.dispose();
4423
4328
  while (this._disposables.length) {
4424
4329
  this._disposables.pop()?.dispose();
4425
4330
  }
@@ -4487,7 +4392,7 @@ const ArcgisCodeEditor = class {
4487
4392
  //#endregion
4488
4393
  // #region Rendering
4489
4394
  render() {
4490
- return h(Host, { key: 'dc46295c6153511a5af31138745f7cb7cc03e1c8' });
4395
+ return h(Host, { key: 'ad62779413690025ea1498106aee049b3c786582' });
4491
4396
  }
4492
4397
  static get assetsDirs() { return ["assets"]; }
4493
4398
  get el() { return getElement(this); }
@@ -4555,6 +4460,21 @@ const ArcgisLanguageApiPanel = class {
4555
4460
  this.loading = false;
4556
4461
  this.apiLibrary = undefined;
4557
4462
  }
4463
+ _apiLibraryChanged(newVal) {
4464
+ // refresh the selected api item if there is one to use the new language
4465
+ if (!this._selectedApiItem) {
4466
+ return;
4467
+ }
4468
+ for (const category of newVal ?? []) {
4469
+ for (const item of category.items) {
4470
+ if (item.name === this._selectedApiItem.name) {
4471
+ this._selectedApiItem = item;
4472
+ return;
4473
+ }
4474
+ }
4475
+ }
4476
+ this._selectedApiItem = undefined;
4477
+ }
4558
4478
  //#endregion
4559
4479
  // #region Component lifecycle events
4560
4480
  async componentWillLoad() {
@@ -4616,10 +4536,13 @@ const ArcgisLanguageApiPanel = class {
4616
4536
  render() {
4617
4537
  const categories = (this.apiLibrary ?? []).map((apiCategory) => this.renderApiCategory(apiCategory));
4618
4538
  const empty = categories.every((g) => !g);
4619
- return (h(Host, { key: '60e169c299bceeb3d2912eea067d69005fb27bf5' }, h("style", { key: '4460f4de437b518f40f5013c6e06dadefc7c90a4' }, this._colorizeStyle), h("calcite-flow", { key: '06a7e13f55efbd24e4eb200ad2c4cbf56b699b50', ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { key: 'db5e4e8817ee85de1c19655496529fb93bb544dd', heading: this.messages.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { key: 'a35a4cedbdec59eed366f719c7d48e662005f6fb', value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this.messages.loading ?? "Loading" })) : (h("calcite-list", null, empty ? h("div", { class: "notice-container" }, this.messages.noitems) : categories))), this.renderApiItemFlowItem())));
4539
+ return (h(Host, { key: '777e65f0a9891fbdf8fd6177890df475261d198e' }, h("style", { key: 'bacffd5a30dfa72f9cc99db6a7066fd551c06e60' }, this._colorizeStyle), h("calcite-flow", { key: 'b48417bccd1a1a5e400d5b205ff0dc3a21e08a76', ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { key: 'a44cdb484d60daa1a6410ed7d513eb680f20f883', heading: this.messages.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { key: 'ebe4708ce6ccb62b2d5639bb9cbc5ee207e7e2b9', value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this.messages.loading ?? "Loading" })) : (h("calcite-list", null, empty ? h("div", { class: "notice-container" }, this.messages.noitems) : categories))), this.renderApiItemFlowItem())));
4620
4540
  }
4621
4541
  static get assetsDirs() { return ["assets"]; }
4622
4542
  get el() { return getElement(this); }
4543
+ static get watchers() { return {
4544
+ "apiLibrary": ["_apiLibraryChanged"]
4545
+ }; }
4623
4546
  };
4624
4547
  ArcgisLanguageApiPanel.style = ArcgisLanguageApiPanelStyle0;
4625
4548
 
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
- import { p as promiseResolve, b as bootstrapLazy } from './index-20936dfe.js';
7
- export { s as setNonce } from './index-20936dfe.js';
8
- import { g as globalScripts } from './app-globals-7a9ff748.js';
6
+ import { p as promiseResolve, b as bootstrapLazy } from './index-b5d43ca7.js';
7
+ export { s as setNonce } from './index-b5d43ca7.js';
8
+ import { g as globalScripts } from './app-globals-68a9d20e.js';
9
9
 
10
10
  /*
11
11
  Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
@@ -21,5 +21,5 @@ var patchBrowser = () => {
21
21
 
22
22
  patchBrowser().then(async (options) => {
23
23
  await globalScripts();
24
- return bootstrapLazy([["arcgis-sql-expression-fields",[[1,"arcgis-sql-expression-fields",{"loading":[4],"modelId":[1,"model-id"],"_mutationCounter":[32],"_flowItemRenderers":[32],"_filterValue":[32]},null,{"modelId":["modelIdPropChanged"]}]]],["arcgis-arcade-editor_6",[[0,"arcgis-arcade-editor",{"profile":[16],"script":[1025],"testData":[16],"suggestions":[16],"snippets":[16],"hideDocumentationActions":[4,"hide-documentation-actions"],"hideSideBar":[4,"hide-side-bar"],"sideActionBarExpanded":[1540,"side-action-bar-expanded"],"openedSidePanel":[1537,"opened-side-panel"],"editorOptions":[16],"editorInstance":[16],"_preparingArcade":[32],"_editorProfile":[32],"_apiLibrary":[32],"_showExecutionPanel":[32],"_resultPanel":[32],"_executingScript":[32],"_consoleLogs":[32],"_executionResult":[32],"messages":[32],"getScript":[64],"setFocus":[64],"getEditorInstance":[64],"getTestResult":[64],"updateThemeColors":[64]},null,{"messages":["_messagesChanged"],"profile":["_profileChanged"],"testData":["_testDataChanged"],"snippets":["_snippetChanged"]}],[1,"arcgis-arcade-results",{"loading":[4],"openedResultPanel":[1537,"opened-result-panel"],"result":[16],"consoleLogs":[16]}],[1,"arcgis-arcade-suggestions",{"suggestions":[16],"_selectedSuggestion":[32],"_filterValue":[32],"_colorizeStyle":[32]},null,{"suggestions":["suggestionsPropChanged"]}],[1,"arcgis-arcade-variables",{"loading":[4],"modelId":[1,"model-id"],"_mutationCounter":[32],"_flowItemRenderers":[32],"_filterValue":[32]},null,{"modelId":["modelIdPropChanged"]}],[0,"arcgis-code-editor",{"value":[1],"language":[1],"modelId":[1,"model-id"],"editorOptions":[16],"editorInstance":[16],"getValue":[64],"setValue":[64],"insertText":[64],"insertSnippet":[64],"getEditorInstance":[64],"setFocus":[64]},null,{"language":["languagePropChange"],"modelId":["modelIdPropChange"],"editorOptions":["editorOptionsPropChange"]}],[1,"arcgis-language-api-panel",{"hideDocumentationActions":[4,"hide-documentation-actions"],"loading":[4],"apiLibrary":[16],"_selectedApiItem":[32],"_filterValue":[32],"_colorizeStyle":[32]}]]],["arcgis-sql-expression-editor",[[0,"arcgis-sql-expression-editor",{"profile":[16],"_preparing":[32],"_editorProfile":[32],"_activeAction":[32],"_apiLibrary":[32]},null,{"profile":["_profileChanged"]}]]]], options);
24
+ return bootstrapLazy([["arcgis-sql-expression-fields",[[1,"arcgis-sql-expression-fields",{"loading":[4],"modelId":[1,"model-id"],"_mutationCounter":[32],"_flowItemRenderers":[32],"_filterValue":[32]},null,{"modelId":["modelIdPropChanged"]}]]],["arcgis-arcade-editor_6",[[0,"arcgis-arcade-editor",{"profile":[16],"script":[1025],"testData":[16],"suggestions":[16],"snippets":[16],"hideDocumentationActions":[4,"hide-documentation-actions"],"hideSideBar":[4,"hide-side-bar"],"sideActionBarExpanded":[1540,"side-action-bar-expanded"],"openedSidePanel":[1537,"opened-side-panel"],"editorOptions":[16],"editorInstance":[16],"_preparingArcade":[32],"_editorProfile":[32],"_apiLibrary":[32],"_showExecutionPanel":[32],"_resultPanel":[32],"_executingScript":[32],"_consoleLogs":[32],"_executionResult":[32],"messages":[32],"getScript":[64],"setFocus":[64],"getEditorInstance":[64],"getTestResult":[64],"updateThemeColors":[64]},null,{"messages":["_messagesChanged"],"profile":["_profileChanged"],"testData":["_testDataChanged"],"snippets":["_snippetChanged"]}],[1,"arcgis-arcade-results",{"loading":[4],"openedResultPanel":[1537,"opened-result-panel"],"result":[16],"consoleLogs":[16]}],[1,"arcgis-arcade-suggestions",{"suggestions":[16],"_selectedSuggestion":[32],"_filterValue":[32],"_colorizeStyle":[32]},null,{"suggestions":["suggestionsPropChanged"]}],[1,"arcgis-arcade-variables",{"loading":[4],"modelId":[1,"model-id"],"_mutationCounter":[32],"_flowItemRenderers":[32],"_filterValue":[32]},null,{"modelId":["modelIdPropChanged"]}],[0,"arcgis-code-editor",{"value":[1],"language":[1],"modelId":[1,"model-id"],"editorOptions":[16],"editorInstance":[16],"getValue":[64],"setValue":[64],"insertText":[64],"insertSnippet":[64],"getEditorInstance":[64],"setFocus":[64]},null,{"language":["languagePropChange"],"modelId":["modelIdPropChange"],"editorOptions":["editorOptionsPropChange"]}],[1,"arcgis-language-api-panel",{"hideDocumentationActions":[4,"hide-documentation-actions"],"loading":[4],"apiLibrary":[16],"_selectedApiItem":[32],"_filterValue":[32],"_colorizeStyle":[32]},null,{"apiLibrary":["_apiLibraryChanged"]}]]],["arcgis-sql-expression-editor",[[0,"arcgis-sql-expression-editor",{"profile":[16],"script":[1025],"_preparing":[32],"_editorProfile":[32],"_activeAction":[32],"_apiLibrary":[32],"messages":[32]},null,{"messages":["_messagesChanged"],"profile":["_profileChanged"]}]]]], options);
25
25
  });
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.54
4
+ * v4.31.0-next.56
5
5
  */
6
- import { r as registerInstance, h, H as Host, a as getElement } from './index-20936dfe.js';
7
- import { u as useControllerManager, a as sqlExprDefaults } from './sql-expr-defaults-3913a59f.js';
8
- import { o as generateGuid } from './language-defaults-base-9e3f1f44.js';
6
+ import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-b5d43ca7.js';
7
+ import { u as useControllerManager, s as sqlExprDefaults, a as useT9n } from './sql-expr-defaults-c2608671.js';
8
+ import { l as generateGuid } from './language-defaults-base-307b77e5.js';
9
9
 
10
10
  const sqlExpressionEditorCss = "arcgis-sql-expression-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:1px solid var(--calcite-color-border-3);box-sizing:border-box;background-color:var(--calcite-color-foreground-1);height:100%}arcgis-sql-expression-editor .flex-adjustable{flex:1 1 auto;overflow:hidden}arcgis-sql-expression-editor .flex-panel{flex:1 0 auto}arcgis-sql-expression-editor .position-relative{position:relative}arcgis-sql-expression-editor .flex-row{display:flex;flex-direction:row;overflow:hidden}arcgis-sql-expression-editor .flex-column{display:flex;flex-direction:column;overflow:hidden}arcgis-sql-expression-editor .border-inline-start{border-inline-start:1px solid var(--calcite-color-border-3);box-sizing:border-box}arcgis-sql-expression-editor .border-inline-end{border-inline-end:1px solid var(--calcite-color-border-3);box-sizing:border-box}arcgis-sql-expression-editor .side-action-bar{max-width:25%}arcgis-sql-expression-editor .side-panel{max-width:45%;width:600px}arcgis-sql-expression-editor .side-panel calcite-flow{height:100%}";
11
11
  const ArcgisSqlExpressionEditorStyle0 = sqlExpressionEditorCss;
@@ -13,27 +13,42 @@ const ArcgisSqlExpressionEditorStyle0 = sqlExpressionEditorCss;
13
13
  const SqlExpressionEditor = class {
14
14
  constructor(hostRef) {
15
15
  registerInstance(this, hostRef);
16
+ this.arcgisScriptChange = createEvent(this, "arcgisScriptChange", 3);
16
17
  this.manager = useControllerManager(this);
17
18
  // #endregion
18
19
  // #region Private properties
19
20
  this._modelId = generateGuid();
20
21
  this._insertAsSnippet = (e) => void this._codeEditorElt?.insertSnippet(e.detail).catch(console.error);
22
+ this._updateApiLibrary = async () => {
23
+ this._apiLibrary = await sqlExprDefaults.getApiLibrary(this._modelId);
24
+ };
25
+ this._onCodeEditorValueChange = (e) => {
26
+ e.stopPropagation();
27
+ this.script = e.detail;
28
+ this.arcgisScriptChange.emit(e.detail);
29
+ };
21
30
  this._preparing = false;
22
31
  this._editorProfile = undefined;
23
32
  this._activeAction = undefined;
24
33
  this._apiLibrary = undefined;
34
+ this.messages = useT9n();
25
35
  this.profile = undefined;
36
+ this.script = "";
37
+ }
38
+ async _messagesChanged() {
39
+ await this._updateEditorProfile().catch(console.error);
40
+ await this._updateApiLibrary().catch(console.error);
26
41
  }
27
- _profileChanged() {
28
- this._updateSqlExprDefaults().catch(console.error);
42
+ async _profileChanged() {
43
+ await this._updateEditorProfile().catch(console.error);
44
+ await this._updateApiLibrary().catch(console.error);
29
45
  }
30
46
  // #endregion
31
47
  // #region Private methods API
32
- async _updateSqlExprDefaults() {
48
+ async _updateEditorProfile() {
33
49
  this._preparing = true;
34
50
  try {
35
51
  await sqlExprDefaults.setProfileForModel(this._modelId, this.profile);
36
- this._apiLibrary = await sqlExprDefaults.getApiLibrary(this._modelId);
37
52
  }
38
53
  catch {
39
54
  this._editorProfile = undefined;
@@ -53,22 +68,28 @@ const SqlExpressionEditor = class {
53
68
  // #endregion
54
69
  // #region Component lifecycle events
55
70
  async componentWillLoad() {
56
- await this._updateSqlExprDefaults().catch(console.error);
71
+ await this._updateEditorProfile().catch(console.error);
57
72
  // The profile has to be refreshed on locale change
58
73
  // this.manager.watch("messages", () => void this._updateEditorProfile().catch(console.error));
59
74
  }
75
+ async componentDidLoad() {
76
+ // We do updateApiLibrary in componentDidLoad because we need to wait until code editor
77
+ // is rendered for worker to register and allow for fetching the sdk
78
+ await this._updateApiLibrary();
79
+ }
60
80
  disconnectedCallback() {
61
81
  sqlExprDefaults.disposeForModel(this._modelId);
62
82
  }
63
83
  // #endregion
64
84
  render() {
65
- return (h(Host, { key: '67f7ebf7a28a8ffc3fe967721389d45c4e2003a1' }, h("div", { key: 'b3bf4ec2a8d04105e97489593ccec95cd33237f0', class: "flex-row flex-adjustable" }, h("div", { key: 'fdac47e22baf64c72f786f9e09b637050f417f94', class: "flex-column flex-adjustable" }, h("arcgis-code-editor", { key: 'f4151dd39ec3523907cd907ebb7558e05bca9cc1', language: "arcgis-sql-expression", modelId: this._modelId, ref: (e) => (this._codeEditorElt = e) })), this._activeAction === "fields" && (h("arcgis-sql-expression-fields", { key: 'aa0e5d88429d4bf865b9adc506028efefec1a73a', class: "side-panel flex-panel border-inline-start", loading: this._preparing, modelId: this._modelId, "data-panel-name": "none", onArcgisFieldSelected: this._insertAsSnippet, onArcgisClose: () => this._setActiveAction(undefined) })), this._activeAction === "functions" && (h("arcgis-language-api-panel", { key: '7826dbb1b08894c6c6385806a3aef6cff77395d0', class: "side-panel flex-panel border-inline-start", onArcgisItemSelected: this._insertAsSnippet, onArcgisClose: () => this._setActiveAction(undefined), loading: this._preparing, apiLibrary: this._apiLibrary, "data-panel-name": "none" })), h("calcite-action-bar", { key: 'ee618d666b70405495627a9d15238e8723c6f961', class: "side-action-bar border-inline-start", expanded: false, position: "end" }, h("calcite-action", { key: '2c828df5dded6347e13e59ba9e313824baa606ff', id: "fields-action", text: "Fields", icon: "profile-variables", active: this._activeAction === "fields", "data-panel-name": "fields",
85
+ return (h(Host, { key: '63348b6e3e5aa7544203c5ec7270db7827c6f3ed' }, h("div", { key: '203ed656208717c877c540ed5c49fc12338d6b15', class: "flex-row flex-adjustable" }, h("div", { key: '4dfe400bbc9ab74ef86c4115ceeabbcb41913427', class: "flex-column flex-adjustable" }, h("arcgis-code-editor", { key: 'dfc9e247b39d2d9901ac911e147d993897809954', language: "arcgis-sql-expression", modelId: this._modelId, ref: (e) => (this._codeEditorElt = e), value: this.script ?? "", onArcgisValueChange: this._onCodeEditorValueChange })), this._activeAction === "fields" && (h("arcgis-sql-expression-fields", { key: 'b5a5516264aae278f3feec00a5e20e2d0855024d', class: "side-panel flex-panel border-inline-start", loading: this._preparing, modelId: this._modelId, "data-panel-name": "none", onArcgisFieldSelected: this._insertAsSnippet, onArcgisClose: () => this._setActiveAction(undefined) })), this._activeAction === "functions" && (h("arcgis-language-api-panel", { key: '6da236e289e8bcdadc27cadece6e1fb34c55b1da', class: "side-panel flex-panel border-inline-start", onArcgisItemSelected: this._insertAsSnippet, onArcgisClose: () => this._setActiveAction(undefined), loading: this._preparing, apiLibrary: this._apiLibrary, "data-panel-name": "none" })), h("calcite-action-bar", { key: '91549ebac7e78165b911e5def1141010032dfa43', class: "side-action-bar border-inline-start", expanded: false, position: "end" }, h("calcite-action", { key: '32211e3b4e8db0530a047ba6c22234d15e504e17', id: "fields-action", text: this.messages.fields ?? "Fields", icon: "profile-variables", active: this._activeAction === "fields", "data-panel-name": "fields",
66
86
  // need to use an arrow function to automatically bind 'this'
67
- onClick: (e) => this._handleActionClick(e) }), h("calcite-action", { key: 'eab785c5b14cadeb5047db1957134f5accfedc76', id: "functions-action", text: "Functions", icon: "function", active: this._activeAction === "functions", "data-panel-name": "functions", onClick: (e) => this._handleActionClick(e) })))));
87
+ onClick: (e) => this._handleActionClick(e) }), h("calcite-action", { key: '3c308d994b45c67df76414580d881a082333d2f8', id: "functions-action", text: this.messages.functions ?? "Functions", icon: "function", active: this._activeAction === "functions", "data-panel-name": "functions", onClick: (e) => this._handleActionClick(e) })))));
68
88
  }
69
89
  static get assetsDirs() { return ["assets"]; }
70
90
  get el() { return getElement(this); }
71
91
  static get watchers() { return {
92
+ "messages": ["_messagesChanged"],
72
93
  "profile": ["_profileChanged"]
73
94
  }; }
74
95
  };