@arcgis/coding-components 4.31.0-next.10 → 4.31.0-next.11

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 (112) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  2. package/dist/arcgis-coding-components/index.esm.js +2 -2
  3. package/dist/arcgis-coding-components/{p-da9431ba.js → p-21306a37.js} +2 -2
  4. package/dist/arcgis-coding-components/{p-f452d4b8.entry.js → p-29b05690.entry.js} +2 -2
  5. package/dist/arcgis-coding-components/p-2db85972.js +6 -0
  6. package/dist/arcgis-coding-components/{p-8196fa73.js → p-2f2288de.js} +2 -2
  7. package/dist/arcgis-coding-components/{p-923858b5.js → p-4050b5db.js} +2 -2
  8. package/dist/arcgis-coding-components/{p-960aa9dc.js → p-44052160.js} +2 -2
  9. package/dist/arcgis-coding-components/{p-767b17ee.entry.js → p-47bb2fdc.entry.js} +2 -2
  10. package/dist/arcgis-coding-components/p-4fcb5bf0.js +6 -0
  11. package/dist/arcgis-coding-components/{p-ad75160d.js → p-79e7d01c.js} +3 -3
  12. package/dist/arcgis-coding-components/{p-02cae55d.js → p-aedf8504.js} +3 -3
  13. package/dist/arcgis-coding-components/{p-790067b1.js → p-af7ed920.js} +12 -12
  14. package/dist/arcgis-coding-components/{p-6e28fd70.js → p-c28eef63.js} +2 -2
  15. package/dist/arcgis-coding-components/{p-22253750.js → p-ca85726f.js} +1 -1
  16. package/dist/arcgis-coding-components/{p-193ac44f.js → p-cdc11558.js} +1 -1
  17. package/dist/arcgis-coding-components/{p-8cf09bcc.js → p-decda64c.js} +1 -1
  18. package/dist/arcgis-coding-components/p-e6442988.js +6 -0
  19. package/dist/arcgis-coding-components/{p-4fc79a07.entry.js → p-eb99e7e7.entry.js} +2 -2
  20. package/dist/arcgis-coding-components/{p-ab78d6c4.js → p-ef0c4126.js} +3 -3
  21. package/dist/arcgis-coding-components/{p-025fda85.js → p-fa824326.js} +2 -2
  22. package/dist/cjs/{app-globals-bade840e.js → app-globals-d8d56a70.js} +1 -1
  23. package/dist/cjs/arcade-defaults-b1300c3f.js +349 -0
  24. package/dist/cjs/{arcade-language-features-747fb1da.js → arcade-language-features-5c4510c9.js} +2 -2
  25. package/dist/cjs/{arcade-mode-dce44622.js → arcade-mode-185370a7.js} +3 -4
  26. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +6 -6
  27. package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
  28. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
  29. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
  30. package/dist/cjs/{css-077ba0c5.js → css-0d91050a.js} +1 -1
  31. package/dist/cjs/{cssMode-7f2030db.js → cssMode-e8786e83.js} +2 -3
  32. package/dist/cjs/{html-e3a243e9.js → html-adbae3fd.js} +2 -3
  33. package/dist/cjs/{htmlMode-c273d6dc.js → htmlMode-608f8da7.js} +2 -3
  34. package/dist/cjs/{index-37a86ff4.js → index-1cf75f2d.js} +1 -1
  35. package/dist/cjs/index.cjs.js +4 -4
  36. package/dist/cjs/{javascript-7a33cca7.js → javascript-c8733e40.js} +3 -4
  37. package/dist/cjs/{jsonMode-6b4e0850.js → jsonMode-98ec5315.js} +2 -3
  38. package/dist/cjs/{language-defaults-base-b32cb091.js → language-defaults-base-2b2f9d3e.js} +800 -1024
  39. package/dist/cjs/loader.cjs.js +3 -3
  40. package/dist/cjs/{sql-expr-defaults-8a5834f3.js → sql-expr-defaults-a1d5380d.js} +55 -4
  41. package/dist/cjs/{sql-expr-mode-a72a1f92.js → sql-expr-mode-19618e11.js} +5 -5
  42. package/dist/cjs/{tsMode-c2edcd57.js → tsMode-ed34ec8f.js} +2 -3
  43. package/dist/cjs/{typescript-c50c5516.js → typescript-c3d83864.js} +2 -3
  44. package/dist/components/arcade-defaults.js +238 -4
  45. package/dist/components/arcade-language-features.js +1 -1
  46. package/dist/components/arcade-mode.js +1 -1
  47. package/dist/components/arcade-results.js +2 -2
  48. package/dist/components/arcade-suggestions.js +1 -1
  49. package/dist/components/arcade-variables.js +1 -1
  50. package/dist/components/arcgis-arcade-editor.js +1 -1
  51. package/dist/components/arcgis-arcade-results.js +1 -1
  52. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  53. package/dist/components/arcgis-arcade-variables.js +1 -1
  54. package/dist/components/arcgis-assets.d.ts +1 -1
  55. package/dist/components/arcgis-assets.js +1 -1
  56. package/dist/components/arcgis-code-editor.js +1 -1
  57. package/dist/components/arcgis-language-api-panel.js +1 -1
  58. package/dist/components/arcgis-sql-expression-editor.js +1 -1
  59. package/dist/components/arcgis-sql-expression-fields.js +1 -1
  60. package/dist/components/chunk-3IUJHIAA.js +1 -1
  61. package/dist/components/code-editor.js +1 -1
  62. package/dist/components/fields.js +4 -4
  63. package/dist/components/index.js +1 -1
  64. package/dist/components/index2.js +2 -2
  65. package/dist/components/language-api-panel.js +1 -1
  66. package/dist/components/language-defaults-base.js +47 -273
  67. package/dist/components/markdown.js +1 -1
  68. package/dist/components/sql-expr-defaults.js +55 -4
  69. package/dist/components/sql-expr-mode.js +1 -1
  70. package/dist/components/sql-expression-fields.js +1 -1
  71. package/dist/components/useT9n.js +1 -1
  72. package/dist/components/utilities.js +1 -1
  73. package/dist/esm/{app-globals-ed47e16d.js → app-globals-a48930ca.js} +1 -1
  74. package/dist/esm/arcade-defaults-3ea67051.js +344 -0
  75. package/dist/esm/{arcade-language-features-8edb3527.js → arcade-language-features-8274cdc7.js} +2 -2
  76. package/dist/esm/{arcade-mode-ad036f46.js → arcade-mode-c48c3fc6.js} +3 -4
  77. package/dist/esm/arcgis-arcade-editor_6.entry.js +6 -6
  78. package/dist/esm/arcgis-coding-components.js +4 -4
  79. package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
  80. package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
  81. package/dist/esm/{css-810518f1.js → css-4f85f426.js} +1 -1
  82. package/dist/esm/{cssMode-a7208024.js → cssMode-d655f1b9.js} +2 -3
  83. package/dist/esm/{html-e187d7d8.js → html-dd1552df.js} +2 -3
  84. package/dist/esm/{htmlMode-06b7bae2.js → htmlMode-0b7c2367.js} +2 -3
  85. package/dist/esm/{index-3743d31f.js → index-38d652b8.js} +1 -1
  86. package/dist/esm/index.js +4 -4
  87. package/dist/esm/{javascript-04a3f866.js → javascript-ef70f152.js} +3 -4
  88. package/dist/esm/{jsonMode-ee8bb2ea.js → jsonMode-a6ed58a5.js} +2 -3
  89. package/dist/esm/{language-defaults-base-52a397f5.js → language-defaults-base-77487def.js} +797 -1024
  90. package/dist/esm/loader.js +4 -4
  91. package/dist/esm/{sql-expr-defaults-f7c2d5ef.js → sql-expr-defaults-54db53a8.js} +55 -4
  92. package/dist/esm/{sql-expr-mode-433b4a39.js → sql-expr-mode-5c1d43ea.js} +5 -5
  93. package/dist/esm/{tsMode-c80c462e.js → tsMode-fce6766b.js} +2 -3
  94. package/dist/esm/{typescript-a9b8caa7.js → typescript-aed3d402.js} +2 -3
  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/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
  100. package/dist/types/utils/fields.d.ts +2 -2
  101. package/dist/types/utils/profile/editor-profile.d.ts +7 -6
  102. package/dist/types/utils/profile/types.d.ts +3 -0
  103. package/dist/types/utils/profile/utils.d.ts +4 -0
  104. package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +9 -0
  105. package/package.json +10 -10
  106. package/dist/arcgis-coding-components/p-50484a4f.js +0 -6
  107. package/dist/arcgis-coding-components/p-7164c348.js +0 -6
  108. package/dist/arcgis-coding-components/p-9956a574.js +0 -6
  109. package/dist/cjs/arcade-defaults-8b8d6c07.js +0 -116
  110. package/dist/esm/arcade-defaults-562fe19b.js +0 -111
  111. package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
  112. package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
@@ -1,14 +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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  'use strict';
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
- const index = require('./index-37a86ff4.js');
11
- const appGlobals = require('./app-globals-bade840e.js');
10
+ const index = require('./index-1cf75f2d.js');
11
+ const appGlobals = require('./app-globals-d8d56a70.js');
12
12
 
13
13
  const defineCustomElements = async (win, options) => {
14
14
  if (typeof window === 'undefined') return undefined;
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  'use strict';
7
7
 
8
- const languageDefaultsBase = require('./language-defaults-base-b32cb091.js');
9
- const index = require('./index-37a86ff4.js');
8
+ const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
9
+ const index = require('./index-1cf75f2d.js');
10
10
 
11
11
  // src/framework.ts
12
12
  function retrieveComponentMembers(component, isLit) {
@@ -1154,6 +1154,56 @@ var FunctionalController = class extends Controller {
1154
1154
  };
1155
1155
  var proxy = proxyExports(FunctionalController);
1156
1156
 
1157
+ // #region convert editor profile to apiProfile
1158
+ /**
1159
+ * Converts an editor profile to an api profile.
1160
+ * The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
1161
+ */
1162
+ const sqlExprEditorToApiProfile = (editorProfile) => {
1163
+ const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
1164
+ const variable = editorProfile.variables[0];
1165
+ if (!variable || !(variable.type === "featureSet")) {
1166
+ throw Error("No variable found in the editor profile");
1167
+ }
1168
+ const hydratedVariable = variableToApiProfile(variable);
1169
+ return {
1170
+ apiVersion,
1171
+ bundles,
1172
+ variables: [hydratedVariable],
1173
+ hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()),
1174
+ };
1175
+ };
1176
+ function variableToApiProfile(variable) {
1177
+ const { name } = variable;
1178
+ const description = variable.getDescription();
1179
+ const { definition } = variable.toProfileVariableDefinition();
1180
+ const resultCompletion = {
1181
+ label: name,
1182
+ detail: name,
1183
+ insertText: name,
1184
+ insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
1185
+ insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
1186
+ kind: languageDefaultsBase.main.exports.CompletionItemKind.Field,
1187
+ };
1188
+ const result = {
1189
+ name,
1190
+ description,
1191
+ type: "dictionary",
1192
+ properties: [],
1193
+ completion: resultCompletion,
1194
+ };
1195
+ // No fields or definition, then it will be a feature without any known fields
1196
+ if (!definition || !("fields" in definition)) {
1197
+ return result;
1198
+ }
1199
+ // Create properties for the fields
1200
+ // Also improve the feature completion documentation
1201
+ // TODO: should we add aliases to completion? what about domains?
1202
+ const [properties, featureCompletionDescription] = languageDefaultsBase.fieldsToProfileValues(definition.fields, description);
1203
+ result.properties = properties;
1204
+ resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
1205
+ return result;
1206
+ }
1157
1207
  const tempHardcodedProfile = {
1158
1208
  en: {
1159
1209
  id: "field-calculation",
@@ -1202,6 +1252,7 @@ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en"
1202
1252
  });
1203
1253
  return editorProfile;
1204
1254
  }
1255
+ // #endregion
1205
1256
 
1206
1257
  function x(i){return Array.isArray(i.testSdkCategories)}async function S(i,n){try{let e=await i,t=new Map,r=new Map,a=[],o=k(n);return e.forEach(p=>{let c=[];p.items.forEach(s=>V(c,r,t,o,s)),c.length&&a.push({...p,items:c});}),{categories:a,functionDefinitions:t,constantDefinitions:r}}catch{return {categories:[],functionDefinitions:new Map,constantDefinitions:new Map}}}var g=class{constructor(n){this._settings=n;this.sdkCategoriesCache=new Map;}async getApiDatabase(n){let{locale:e="en"}=n,t=this.sdkCategoriesCache.get(e);if(!t){let{assetsPath:r}=this._settings;if(!r)return {categories:[],functionDefinitions:new Map,constantDefinitions:new Map};t=this.loadSdkApiLibrary(e,r),this.sdkCategoriesCache.set(e,t);}return await S(t,n)}async getApiLibrary(n){let{categories:e}=await this.getApiDatabase(n);return e}async loadSdkApiLibrary(n="en",e=""){if(x(this._settings))return this._settings.testSdkCategories;if(e=e.replace(/\/$/u,""),!e)return [];try{let t=this._settings.apiPathTemplate.replace("${assetsPath}",e).replace("${locale}",n),r=await fetch(t);return r.ok?await r.json():n==="en"?[]:await this.loadSdkApiLibrary("en",e)}catch{return []}}};function k(i){let{profile:{apiVersion:n,bundles:e,hiddenApiItems:t=[]}={}}=i,r=A(n),a=Array.isArray(e)&&e.length>0?new Set(["core",...e]):void 0;return o=>h(r,o.sinceVersion)&&(!a||a.has(o.bundle))&&!t.includes(o.name)}function V(i,n,e,t,r){if(Array.isArray(r)){r.forEach(a=>m(i,e,t,a));return}r.type==="constant"?D(i,n,t,r):m(i,e,t,r);}function m(i,n,e,t){if(!e(t))return;t.disableDocumentation||i.push(t);let{completion:{label:r}}=t,a=r.toLowerCase(),o=n.get(a);o||(o={type:"functionDefinition",key:a,overloads:[]},n.set(a,o)),o.overloads.push(t);}function D(i,n,e,t){if(!e(t))return;i.push(t);let{completion:{label:r}}=t,a=r.toLowerCase();n.set(a,t);let[o,p]=t.completion.label.split(".");if(!p)return;let c=o.toLowerCase(),s=n.get(c);s||(s={type:"namespace",key:c,members:[],completion:{label:o,detail:o,insertText:o,insertTextMode:languageDefaultsBase.main.exports.InsertTextMode.adjustIndentation,insertTextFormat:languageDefaultsBase.main.exports.InsertTextFormat.PlainText,kind:languageDefaultsBase.main.exports.CompletionItemKind.Enum}},n.set(c,s));let l=structuredClone(t);l.name=p,l.completion.label=p,l.completion.insertText=p,l.completion.kind=languageDefaultsBase.main.exports.CompletionItemKind.Constant,s.members.push(l),s.completion.documentation=s.members.reduce((u,d)=>(u.value=`${u.value}${u.value?`
1207
1258
 
@@ -1247,7 +1298,7 @@ class SqlExprDefaults extends languageDefaultsBase.LanguageDefaultsBase {
1247
1298
  const key = this._getApiKey(modelId);
1248
1299
  const editorProfile = new languageDefaultsBase.EditorProfile(definition, intlStrings);
1249
1300
  this._profileMap.set(key, editorProfile);
1250
- const apiProfile = await editorProfile.toLSProfile();
1301
+ const apiProfile = sqlExprEditorToApiProfile(editorProfile);
1251
1302
  this.updateApiContextForModel(modelId, {
1252
1303
  locale: apiContext.locale,
1253
1304
  profile: apiProfile,
@@ -1,14 +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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  'use strict';
7
7
 
8
- const languageDefaultsBase = require('./language-defaults-base-b32cb091.js');
9
- const sqlExprDefaults = require('./sql-expr-defaults-8a5834f3.js');
10
- const arcadeLanguageFeatures = require('./arcade-language-features-747fb1da.js');
11
- require('./index-37a86ff4.js');
8
+ const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
9
+ const sqlExprDefaults = require('./sql-expr-defaults-a1d5380d.js');
10
+ const arcadeLanguageFeatures = require('./arcade-language-features-5c4510c9.js');
11
+ require('./index-1cf75f2d.js');
12
12
 
13
13
  /**
14
14
  * Manager to create our sql-expression worker and client proxy
@@ -1,12 +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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  'use strict';
7
7
 
8
- const languageDefaultsBase = require('./language-defaults-base-b32cb091.js');
9
- require('./index-37a86ff4.js');
8
+ const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
10
9
 
11
10
  /*!-----------------------------------------------------------------------------
12
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,12 +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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  'use strict';
7
7
 
8
- const languageDefaultsBase = require('./language-defaults-base-b32cb091.js');
9
- require('./index-37a86ff4.js');
8
+ const languageDefaultsBase = require('./language-defaults-base-2b2f9d3e.js');
10
9
 
11
10
  /*!-----------------------------------------------------------------------------
12
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { Uri } from 'monaco-editor';
7
- import { L as LanguageDefaultsBase, i as isPredefinedProfile, c as convertToEditorProfileDefinition, E as EditorProfile } from './language-defaults-base.js';
8
- import { f as fetchT9nStringsBundle } from './index2.js';
7
+ import { f as fieldsToProfileValues, i as isPredefinedProfile, a as isFeatureSetCollectionDefinition, b as isFeatureSetDefinition, c as isFeatureDefinition, L as LanguageDefaultsBase, E as EditorProfile } from './language-defaults-base.js';
8
+ import { s as supportedLocales, f as fetchT9nStringsBundle } from './index2.js';
9
+ import { CompletionItemKind, InsertTextMode, InsertTextFormat } from 'vscode-languageserver-types';
9
10
  import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
10
11
 
11
12
  /**
@@ -43,6 +44,239 @@ async function getMode() {
43
44
  return await import('./arcade-mode.js');
44
45
  }
45
46
 
47
+ // #region convert editor profile to apiProfile
48
+ /**
49
+ * Converts an editor profile to an api profile.
50
+ * The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
51
+ */
52
+ async function arcadeEditorToApiProfile(editorProfile) {
53
+ const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
54
+ const variables = await variablesToLSVariable(editorProfile.dictionaryVariables);
55
+ return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
56
+ }
57
+ async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.Variable) {
58
+ return await Promise.all(editorVariables.map(async (editorVariable) => {
59
+ switch (editorVariable.type) {
60
+ case "dictionary":
61
+ return await dictionaryToLSDictionary(editorVariable, kind);
62
+ case "feature":
63
+ return await featureToLSFeature(editorVariable, kind);
64
+ default:
65
+ return variableToLSVariable(editorVariable, kind);
66
+ }
67
+ }));
68
+ }
69
+ function variableToLSVariable(editorVariable, kind) {
70
+ const { name, type } = editorVariable;
71
+ const description = editorVariable.getDescription();
72
+ return {
73
+ name,
74
+ description,
75
+ type,
76
+ completion: {
77
+ label: name,
78
+ detail: name,
79
+ insertText: name,
80
+ insertTextMode: InsertTextMode.asIs,
81
+ insertTextFormat: InsertTextFormat.PlainText,
82
+ kind,
83
+ documentation: { kind: "markdown", value: description },
84
+ },
85
+ };
86
+ }
87
+ async function featureToLSFeature(editorFeature, kind) {
88
+ // Get the source for the definition
89
+ const source = await editorFeature.loadSource();
90
+ const { name } = editorFeature;
91
+ const description = editorFeature.getDescription();
92
+ const resultCompletion = {
93
+ label: name,
94
+ detail: name,
95
+ insertText: name,
96
+ insertTextMode: InsertTextMode.asIs,
97
+ insertTextFormat: InsertTextFormat.PlainText,
98
+ kind,
99
+ };
100
+ const result = {
101
+ name,
102
+ description,
103
+ type: "dictionary",
104
+ properties: [],
105
+ completion: resultCompletion,
106
+ };
107
+ // No source definition, then it will be a feature without any known fields
108
+ if (!source) {
109
+ return result;
110
+ }
111
+ // Create properties for the fields and the aliases
112
+ // Also improve the feature completion documentation
113
+ const [properties, featureCompletionDescription] = fieldsToProfileValues(source.fields, description, true);
114
+ result.properties = properties;
115
+ resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
116
+ return result;
117
+ }
118
+ async function dictionaryToLSDictionary(editorDictionary, kind) {
119
+ const { name, dictionaryVariables: variables } = editorDictionary;
120
+ const description = editorDictionary.getDescription();
121
+ const completionDescription = variables.reduce((previous, p) => {
122
+ if (previous !== "") {
123
+ previous += " \n \n";
124
+ }
125
+ previous += `**${p.name}** \n${p.type}`;
126
+ const description = p.getDescription();
127
+ if (description) {
128
+ previous += ` \n${description}`;
129
+ }
130
+ return previous;
131
+ }, description);
132
+ return {
133
+ name,
134
+ description,
135
+ type: "dictionary",
136
+ properties: await variablesToLSVariable(variables, CompletionItemKind.Field),
137
+ completion: {
138
+ label: name,
139
+ detail: name,
140
+ insertText: name,
141
+ insertTextMode: InsertTextMode.asIs,
142
+ insertTextFormat: InsertTextFormat.PlainText,
143
+ kind,
144
+ documentation: { kind: "markdown", value: completionDescription },
145
+ },
146
+ };
147
+ }
148
+ // #endregion
149
+ // #region predefined profile to editor profile definition
150
+ /**
151
+ * Get a PredefinedProfile for a locale. If not already loaded then fetch it.
152
+ * If the locale doesn't exist or the locale profile file doesn't exist then returns
153
+ * the english version of the profile.
154
+ */
155
+ async function getSdkPredefinedProfiles(locale = "en") {
156
+ const profiles = sdkPredefinedProfilesMap.get(locale);
157
+ if (profiles) {
158
+ return profiles;
159
+ }
160
+ if (!supportedLocales.has(locale)) {
161
+ return await getSdkPredefinedProfiles("en");
162
+ }
163
+ try {
164
+ const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
165
+ if (response.ok) {
166
+ return cacheSdkPredefinedProfiles(locale, (await response.json()));
167
+ }
168
+ if (locale === "en") {
169
+ return null;
170
+ }
171
+ return await getSdkPredefinedProfiles("en");
172
+ }
173
+ catch {
174
+ return null;
175
+ }
176
+ }
177
+ const sdkPredefinedProfilesMap = new Map();
178
+ /**
179
+ * Convert a stored profile into a PredefinedProfile and add it to the in-memory
180
+ * Map of profiles per locale.
181
+ */
182
+ function cacheSdkPredefinedProfiles(locale, profiles) {
183
+ const map = new Map();
184
+ profiles.forEach((profile) => {
185
+ map.set(profile.id, profile);
186
+ });
187
+ sdkPredefinedProfilesMap.set(locale, map);
188
+ return map;
189
+ }
190
+ async function getSdkPredefinedProfile(id, locale = "en") {
191
+ const profiles = await getSdkPredefinedProfiles(locale);
192
+ return profiles?.get(id) ?? null;
193
+ }
194
+ function isExtendedPredefinedProfileDefinition(item) {
195
+ return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
196
+ }
197
+ function convertApiVariables(variables) {
198
+ return variables?.map(convertApiVariable);
199
+ }
200
+ function convertApiVariable(variable) {
201
+ switch (variable.type) {
202
+ case "dictionary":
203
+ return {
204
+ ...variable,
205
+ type: variable.type,
206
+ properties: convertApiVariables(variable.properties),
207
+ };
208
+ case "array": {
209
+ return {
210
+ ...variable,
211
+ type: variable.type,
212
+ elementType: { type: "number", name: "number" },
213
+ };
214
+ }
215
+ default:
216
+ return { ...variable, type: variable.type };
217
+ }
218
+ }
219
+ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
220
+ if (!isPredefinedProfile(predefinedProfile)) {
221
+ return undefined;
222
+ }
223
+ const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
224
+ if (!sdkPredefinedProfile) {
225
+ return undefined;
226
+ }
227
+ const editorProfile = {
228
+ bundles: [...sdkPredefinedProfile.bundles],
229
+ variables: [],
230
+ hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
231
+ };
232
+ // Merge the SDK variables' definitions/properties with the predefined profile definitions.
233
+ sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
234
+ // Don't include disabled variables
235
+ if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
236
+ return;
237
+ }
238
+ // Try to get a definition from the predefined profile, for the variable that needs one.
239
+ const definition = predefinedProfile.definitions[predefinedVariable.name];
240
+ // Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
241
+ // despite the type checking from the switch statement.
242
+ switch (predefinedVariable.type) {
243
+ case "dictionary": {
244
+ // For dictionary, we support properties overrride
245
+ return editorProfile.variables.push(convertApiVariable({
246
+ ...predefinedVariable,
247
+ type: predefinedVariable.type,
248
+ properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
249
+ }));
250
+ }
251
+ case "feature":
252
+ // If the definition is not valid, then we don't include it.
253
+ if (!isFeatureDefinition(definition)) {
254
+ return;
255
+ }
256
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
257
+ case "featureSet":
258
+ // If the definition is not valid, then we don't include it.
259
+ if (!isFeatureSetDefinition(definition)) {
260
+ return;
261
+ }
262
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
263
+ case "featureSetCollection":
264
+ // If the definition is not valid, then we don't include it.
265
+ if (!isFeatureSetCollectionDefinition(definition)) {
266
+ return;
267
+ }
268
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
269
+ default:
270
+ return editorProfile.variables.push(convertApiVariable(predefinedVariable));
271
+ }
272
+ });
273
+ if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
274
+ editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
275
+ }
276
+ return editorProfile;
277
+ }
278
+ // #endregion
279
+
46
280
  const arcadeLanguageId = "arcade";
47
281
  class ArcadeLanguageServiceDefaults extends LanguageDefaultsBase {
48
282
  constructor() {
@@ -73,7 +307,7 @@ class ArcadeLanguageServiceDefaults extends LanguageDefaultsBase {
73
307
  const key = this._getApiKey(modelId);
74
308
  const editorProfile = new EditorProfile(definition, profileStrings);
75
309
  this._profileMap.set(key, editorProfile);
76
- const apiProfile = await editorProfile.toLSProfile();
310
+ const apiProfile = await arcadeEditorToApiProfile(editorProfile);
77
311
  this.updateApiContextForModel(modelId, {
78
312
  locale: apiContext.locale,
79
313
  profile: apiProfile,
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { editor, MarkerSeverity, Range, languages } from 'monaco-editor';
7
7
  import { DiagnosticSeverity, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { editor, languages, Emitter } from 'monaco-editor';
7
7
  import { CompletionItemKind } from 'vscode-languageserver-types';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host, forceUpdate } from '@stencil/core/internal/client';
7
7
  import { g as importArcade, s as supportedFields } from './fields.js';
8
8
  import { u as useControllerManager } from './chunk-3IUJHIAA.js';
9
- import { s as setValuesInString, q as quoteString } from './index2.js';
9
+ import { c as setValuesInString, q as quoteString } from './index2.js';
10
10
  import { u as useT9n } from './useT9n.js';
11
11
  import "@esri/calcite-components/dist/components/calcite-tree.js";
12
12
  import "@esri/calcite-components/dist/components/calcite-tree-item.js";
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
7
7
  import { g as generateColorizeStyles, o as onColorizeThemeChanged, c as convertMarkdownString, a as colorizeCodeElement } from './markdown.js';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
7
7
  import { u as useControllerManager } from './chunk-3IUJHIAA.js';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Fragment, Host } from '@stencil/core/internal/client';
7
7
  import { KeyCode } from 'monaco-editor';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { A as ArcgisArcadeResults$1, d as defineCustomElement$1 } from './arcade-results.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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { A as ArcgisArcadeSuggestions$1, d as defineCustomElement$1 } from './arcade-suggestions.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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { A as ArcgisArcadeVariables$1, d as defineCustomElement$1 } from './arcade-variables.js';
7
7
 
@@ -2,7 +2,7 @@
2
2
  /*!
3
3
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
4
4
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
5
- * v4.31.0-next.10
5
+ * v4.31.0-next.11
6
6
  */
7
7
  /**
8
8
  * Get the base path to where the package assets can be found.
@@ -2,7 +2,7 @@
2
2
  /*!
3
3
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
4
4
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
5
- * v4.31.0-next.10
5
+ * v4.31.0-next.11
6
6
  */
7
7
  let resourceUrl = "https://js.arcgis.com/coding-components/next/";
8
8
  export const getArcgisAssetPath = (path) => {
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { A as ArcgisCodeEditor$1, d as defineCustomElement$1 } from './code-editor.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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { A as ArcgisLanguageApiPanel$1, d as defineCustomElement$1 } from './language-api-panel.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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, forceUpdate, h, Host } from '@stencil/core/internal/client';
7
7
  import { u as useControllerManager } from './chunk-3IUJHIAA.js';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { S as SqlExpressionFields, d as defineCustomElement$1 } from './sql-expression-fields.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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { a as isNotUndefined, D as Deferred, k as safeAsyncCall, l as devToolsAwareTimeout, m as safeCall } 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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
7
7
  import { editor, languages, Range, Uri, KeyMod, KeyCode } from 'monaco-editor';
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  // src/index.ts
7
7
  var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis && !("forceESM" in window.$arcgis);
@@ -99,9 +99,9 @@ function fieldTypeToIconName(field) {
99
99
  }
100
100
  }
101
101
  /**
102
- * Returns the Arcade type for the given field.
102
+ * Returns the ApiValueVariable type for the given field.
103
103
  */
104
- function fieldTypeToArcadeType(field) {
104
+ function fieldTypeToApiValueVarType(field) {
105
105
  switch (field.type) {
106
106
  case "small-integer":
107
107
  case "integer":
@@ -152,4 +152,4 @@ function fieldAlias(field) {
152
152
  return field.alias || field.name;
153
153
  }
154
154
 
155
- export { newPortalPortalItem as a, newWebScene as b, newWebMap as c, fieldTypeToIconName as d, fieldTypeToArcadeType as e, fieldAlias as f, importArcade as g, importRequest as i, newLayersFeatureLayer as n, supportedFields as s };
155
+ export { newPortalPortalItem as a, newWebScene as b, newWebMap as c, fieldTypeToIconName as d, fieldTypeToApiValueVarType as e, fieldAlias as f, importArcade as g, importRequest as i, newLayersFeatureLayer as n, supportedFields as s };
@@ -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.10
4
+ * v4.31.0-next.11
5
5
  */
6
6
  export { setNonce, setPlatformOptions } from '@stencil/core/internal/client';
7
7
  export { a as arcade } from './arcade-defaults.js';