@arcgis/coding-components 4.31.0-next.4 → 4.31.0-next.40

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 (201) hide show
  1. package/README.md +22 -3
  2. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  3. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +1 -1
  4. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +1 -1
  5. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +1 -1
  6. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +6 -6
  7. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +1 -1
  8. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +1 -1
  9. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +1 -1
  10. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +1 -1
  11. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +1 -1
  12. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +1 -1
  13. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +1 -1
  14. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +1 -1
  15. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +1 -1
  16. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +1 -1
  17. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +1 -1
  18. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +1 -1
  19. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +1 -1
  20. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +1 -1
  21. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +1 -1
  22. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +1 -1
  23. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +1 -1
  24. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +1 -1
  25. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +1 -1
  26. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +1 -1
  27. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +1 -1
  28. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +1 -1
  29. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +1 -1
  30. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +1 -1
  31. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +1 -1
  32. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +5 -5
  33. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +1 -1
  34. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +1 -1
  35. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +1 -1
  36. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +1 -1
  37. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +2 -2
  38. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +1 -1
  39. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +1 -1
  40. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +1 -1
  41. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +1 -1
  42. package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +446 -7
  43. package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
  44. package/dist/arcgis-coding-components/index.esm.js +2 -2
  45. package/dist/arcgis-coding-components/{p-a256ee9c.js → p-101c8076.js} +12 -12
  46. package/dist/arcgis-coding-components/{p-26c67f7c.js → p-11fa79f8.js} +2 -2
  47. package/dist/arcgis-coding-components/{p-8e93417c.js → p-1661235a.js} +2 -2
  48. package/dist/arcgis-coding-components/{p-b570d7af.js → p-17a4b887.js} +2 -2
  49. package/dist/arcgis-coding-components/p-2ac72ecc.js +6 -0
  50. package/dist/arcgis-coding-components/p-343ec29e.js +6 -0
  51. package/dist/arcgis-coding-components/{p-736d890c.js → p-36056ac1.js} +3 -3
  52. package/dist/arcgis-coding-components/{p-5da03560.js → p-3f15e8ab.js} +1 -1
  53. package/dist/arcgis-coding-components/p-5828aff9.js +6 -0
  54. package/dist/arcgis-coding-components/{p-86625411.js → p-6a013766.js} +2 -2
  55. package/dist/arcgis-coding-components/p-6c7fc166.entry.js +6 -0
  56. package/dist/arcgis-coding-components/{p-ab0f6db7.js → p-6cbe1fe3.js} +3 -3
  57. package/dist/arcgis-coding-components/{p-b23a3f4e.entry.js → p-7309113a.entry.js} +2 -2
  58. package/dist/arcgis-coding-components/{p-4e56f8ae.js → p-904ce83e.js} +1 -1
  59. package/dist/arcgis-coding-components/p-a2cbed14.js +7 -0
  60. package/dist/arcgis-coding-components/p-d9ae7973.js +6 -0
  61. package/dist/arcgis-coding-components/{p-5e173b51.entry.js → p-da203995.entry.js} +2 -2
  62. package/dist/arcgis-coding-components/{p-8d67b196.js → p-fc66eaf3.js} +3 -3
  63. package/dist/cjs/{app-globals-209c2310.js → app-globals-674a3a3d.js} +1 -1
  64. package/dist/cjs/arcade-defaults-ed0ccdc8.js +349 -0
  65. package/dist/cjs/{arcade-mode-f2c3951e.js → arcade-mode-e4201a06.js} +3 -3
  66. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +20 -26
  67. package/dist/cjs/arcgis-coding-components.cjs.js +5 -5
  68. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
  69. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
  70. package/dist/cjs/{css-bbd000cd.js → css-c33c006f.js} +1 -1
  71. package/dist/cjs/{cssMode-ad163e66.js → cssMode-cf6c5365.js} +2 -3
  72. package/dist/cjs/{html-5c67b9d0.js → html-2ef85c79.js} +2 -3
  73. package/dist/cjs/{htmlMode-e32a97bd.js → htmlMode-07dcb544.js} +2 -3
  74. package/dist/cjs/{index-8b891c40.js → index-b1aa4d20.js} +43 -15
  75. package/dist/cjs/index.cjs.js +4 -4
  76. package/dist/cjs/{javascript-e159fa2f.js → javascript-61e9d53f.js} +3 -4
  77. package/dist/cjs/{jsonMode-5c107443.js → jsonMode-eec500bc.js} +2 -3
  78. package/dist/cjs/{language-defaults-base-4300e691.js → language-defaults-base-e8f93cb5.js} +822 -1062
  79. package/dist/cjs/loader.cjs.js +4 -4
  80. package/dist/cjs/{sql-expr-defaults-783d9c24.js → sql-expr-defaults-1d7415d0.js} +106 -44
  81. package/dist/cjs/sql-expr-mode-de9f89a8.js +467 -0
  82. package/dist/cjs/{tsMode-83c4587f.js → tsMode-213dbfe4.js} +2 -3
  83. package/dist/cjs/{typescript-f6ca5d84.js → typescript-c668fe11.js} +2 -3
  84. package/dist/components/arcade-defaults.js +238 -4
  85. package/dist/components/arcade-mode.js +2 -1
  86. package/dist/components/arcade-results.js +3 -3
  87. package/dist/components/arcade-suggestions.js +2 -2
  88. package/dist/components/arcade-variables.js +2 -2
  89. package/dist/components/arcgis-arcade-editor.js +7 -6
  90. package/dist/components/arcgis-arcade-results.js +1 -1
  91. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  92. package/dist/components/arcgis-arcade-variables.js +1 -1
  93. package/dist/components/arcgis-assets.d.ts +26 -26
  94. package/dist/components/arcgis-assets.js +2 -2
  95. package/dist/components/arcgis-code-editor.js +1 -1
  96. package/dist/components/arcgis-language-api-panel.js +1 -1
  97. package/dist/components/arcgis-sql-expression-editor.js +2 -2
  98. package/dist/components/arcgis-sql-expression-fields.js +1 -1
  99. package/dist/components/{chunk-6TARY3NN.js → chunk-656WPE3G.js} +30 -22
  100. package/dist/components/code-editor.js +16 -23
  101. package/dist/components/fields.js +4 -4
  102. package/dist/components/index.js +1 -1
  103. package/dist/components/index2.js +2 -2
  104. package/dist/components/language-api-panel.js +2 -2
  105. package/dist/components/language-defaults-base.js +81 -323
  106. package/dist/components/markdown.js +1 -1
  107. package/dist/components/sql-expr-defaults.js +77 -24
  108. package/dist/components/sql-expr-mode.js +282 -24951
  109. package/dist/components/sql-expression-fields.js +2 -2
  110. package/dist/components/useT9n.js +2 -2
  111. package/dist/components/utilities.js +1 -1
  112. package/dist/esm/{app-globals-60a61d0d.js → app-globals-b8e72633.js} +1 -1
  113. package/dist/esm/arcade-defaults-f7df9442.js +344 -0
  114. package/dist/esm/{arcade-mode-7e6764ac.js → arcade-mode-efe99f12.js} +3 -3
  115. package/dist/esm/arcgis-arcade-editor_6.entry.js +21 -27
  116. package/dist/esm/arcgis-coding-components.js +6 -6
  117. package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
  118. package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
  119. package/dist/esm/{css-7d75b7ca.js → css-08c12296.js} +1 -1
  120. package/dist/esm/{cssMode-95305ae2.js → cssMode-f536f753.js} +2 -3
  121. package/dist/esm/{html-84fc596c.js → html-6618281c.js} +2 -3
  122. package/dist/esm/{htmlMode-c961f619.js → htmlMode-cf1a7867.js} +2 -3
  123. package/dist/esm/{index-1c1754c0.js → index-438d6c73.js} +43 -15
  124. package/dist/esm/index.js +4 -4
  125. package/dist/esm/{javascript-0aa4505f.js → javascript-3c2117eb.js} +3 -4
  126. package/dist/esm/{jsonMode-86b234eb.js → jsonMode-913faa2d.js} +2 -3
  127. package/dist/esm/{language-defaults-base-949fa7fb.js → language-defaults-base-8712f6ef.js} +819 -1062
  128. package/dist/esm/loader.js +5 -5
  129. package/dist/esm/{sql-expr-defaults-f2f50289.js → sql-expr-defaults-36f45c7c.js} +106 -45
  130. package/dist/esm/sql-expr-mode-63d572b1.js +463 -0
  131. package/dist/esm/{tsMode-ee945c40.js → tsMode-8aeb228a.js} +2 -3
  132. package/dist/esm/{typescript-8bd2bb48.js → typescript-91a0d6c0.js} +2 -3
  133. package/dist/loader/cdn.js +2 -3
  134. package/dist/loader/index.cjs.js +2 -3
  135. package/dist/loader/index.es2017.js +2 -3
  136. package/dist/loader/index.js +2 -3
  137. package/dist/types/components/arcade-editor/arcade-editor.d.ts +13 -3
  138. package/dist/types/components/arcade-results/arcade-results.d.ts +1 -1
  139. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +1 -1
  140. package/dist/types/components/arcade-variables/arcade-variables.d.ts +1 -1
  141. package/dist/types/components/code-editor/code-editor.d.ts +14 -4
  142. package/dist/types/components/language-api-panel/language-api-panel.d.ts +1 -1
  143. package/dist/types/components.d.ts +13 -13
  144. package/dist/types/data/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 +8 -1
  145. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +5 -1
  146. package/dist/types/stencil-public-runtime.d.ts +3 -8
  147. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
  148. package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
  149. package/dist/types/utils/fields.d.ts +2 -2
  150. package/dist/types/utils/profile/editor-profile.d.ts +7 -6
  151. package/dist/types/utils/profile/types.d.ts +53 -65
  152. package/dist/types/utils/profile/utils.d.ts +9 -8
  153. package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +56 -5
  154. package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +61 -0
  155. package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -11
  156. package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +0 -1
  157. package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +18 -534
  158. package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +34 -1
  159. package/dist/types/utils/sql-expr-monaco/sql-expr-parser-utils.d.ts +30 -0
  160. package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
  161. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +0 -7
  162. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +73 -77
  163. package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +5 -6
  164. package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +2 -0
  165. package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +11 -8
  166. package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
  167. package/dist/types/utils/sql-expr-monaco/types.d.ts +30 -28
  168. package/package.json +19 -19
  169. package/dist/arcgis-coding-components/p-103bdac3.js +0 -6
  170. package/dist/arcgis-coding-components/p-2d14950e.js +0 -7
  171. package/dist/arcgis-coding-components/p-374b59c1.js +0 -6
  172. package/dist/arcgis-coding-components/p-a36c357f.js +0 -6
  173. package/dist/arcgis-coding-components/p-de5cabbb.js +0 -6
  174. package/dist/arcgis-coding-components/p-e6cac921.entry.js +0 -6
  175. package/dist/cjs/arcade-defaults-ee308e3a.js +0 -116
  176. package/dist/cjs/sql-expr-mode-6cac37ed.js +0 -25135
  177. package/dist/esm/arcade-defaults-b1a5f013.js +0 -111
  178. package/dist/esm/polyfills/core-js.js +0 -11
  179. package/dist/esm/polyfills/dom.js +0 -79
  180. package/dist/esm/polyfills/es5-html-element.js +0 -1
  181. package/dist/esm/polyfills/index.js +0 -34
  182. package/dist/esm/polyfills/system.js +0 -6
  183. package/dist/esm/sql-expr-mode-14c94be3.js +0 -25132
  184. package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
  185. package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +0 -41
  186. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +0 -16
  187. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +0 -26
  188. package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +0 -37
  189. package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +0 -11
  190. package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +0 -122
  191. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +0 -5
  192. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +0 -18
  193. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +0 -6
  194. package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +0 -156
  195. package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +0 -150
  196. package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +0 -1397
  197. package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +0 -59
  198. package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +0 -295
  199. package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +0 -135
  200. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +0 -3
  201. package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
@@ -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.4
4
+ * v4.31.0-next.40
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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { editor, MarkerSeverity, Range, languages, Emitter } from 'monaco-editor';
7
7
  import { CompletionItemKind, DiagnosticSeverity, InsertTextFormat } from 'vscode-languageserver-types';
@@ -344,6 +344,7 @@ function isInsertReplaceEdit(edit) {
344
344
  return (typeof edit.insert !== "undefined" &&
345
345
  typeof edit.replace !== "undefined");
346
346
  }
347
+ // TODO: extract this function to common util
347
348
  function toCompletionItemKind(kind) {
348
349
  const mItemKind = languages.CompletionItemKind;
349
350
  switch (kind) {
@@ -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.4
4
+ * v4.31.0-next.40
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
- import { u as useControllerManager } from './chunk-6TARY3NN.js';
9
- import { s as setValuesInString, q as quoteString } from './index2.js';
8
+ import { u as useControllerManager } from './chunk-656WPE3G.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,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.4
4
+ * v4.31.0-next.40
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';
8
8
  import { f as filterCollection } from './utilities.js';
9
- import { u as useControllerManager } from './chunk-6TARY3NN.js';
9
+ import { u as useControllerManager } from './chunk-656WPE3G.js';
10
10
  import { r as setFocusOnElement } from './index2.js';
11
11
  import { u as useT9n } from './useT9n.js';
12
12
  import "@esri/calcite-components/dist/components/calcite-list-item-group.js";
@@ -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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
7
- import { u as useControllerManager } from './chunk-6TARY3NN.js';
7
+ import { u as useControllerManager } from './chunk-656WPE3G.js';
8
8
  import { r as setFocusOnElement, d as createFilterExpression } from './index2.js';
9
9
  import { b as arcadeDefaults } from './arcade-defaults.js';
10
10
  import { u as useT9n } from './useT9n.js';
@@ -1,13 +1,13 @@
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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Fragment, Host } from '@stencil/core/internal/client';
7
7
  import { KeyCode } from 'monaco-editor';
8
8
  import { d as defineCustomElement$6, e as executeScript, D as DevelopersWebSitePath } from './arcade-results.js';
9
9
  import { d as defineCustomElement$3, u as updateThemeColors, c as colorRulesKeys, s as setupMonacoEnvironment } from './code-editor.js';
10
- import { u as useControllerManager, g as getSet } from './chunk-6TARY3NN.js';
10
+ import { u as useControllerManager, g as getSet } from './chunk-656WPE3G.js';
11
11
  import { D as Deferred, g as generateGuid, e as getElementTheme } from './index2.js';
12
12
  import { b as arcadeDefaults, g as getArcadeDiagnosticService } from './arcade-defaults.js';
13
13
  import { u as useT9n } from './useT9n.js';
@@ -260,12 +260,12 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
260
260
  //#endregion
261
261
  //#region Render Main Panel
262
262
  renderMainPanel() {
263
- return (h("arcgis-code-editor", { class: "flex-adjustable", language: arcadeDefaults.languageId, value: this.script ?? "", modelId: this._modelId, options: this.editorOptions, onArcgisValueChange: this._onCodeEditorValueChange, ref: (e) => (this._codeEditorElt = e) }));
263
+ return (h("arcgis-code-editor", { class: "flex-adjustable", editorOptions: this.editorOptions, language: arcadeDefaults.languageId, value: this.script ?? "", modelId: this._modelId, onArcgisValueChange: this._onCodeEditorValueChange, ref: (e) => (this._codeEditorElt = e) }));
264
264
  }
265
265
  //#endregion
266
266
  //#region Rendering the Action Bar
267
- renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel, }) {
268
- return (h(Fragment, null, h("calcite-action", { id: id, text: label, icon: icon, active: active, onClick: onClick, "data-panel-name": panelName }), !this.sideActionBarExpanded && (h("calcite-tooltip", { label: label, "reference-element": id }, h("span", null, label)))));
267
+ renderAction({ id, label, icon, active, panelName, iconFlipRtl = false, onClick = this._toggleSidePanel, }) {
268
+ return (h(Fragment, null, h("calcite-action", { id: id, text: label, icon: icon, active: active, onClick: onClick, "data-panel-name": panelName, iconFlipRtl: iconFlipRtl }), !this.sideActionBarExpanded && (h("calcite-tooltip", { "reference-element": id }, h("span", null, label)))));
269
269
  }
270
270
  renderSideActionBar() {
271
271
  if (this.hideSideBar) {
@@ -299,6 +299,7 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
299
299
  icon: "question",
300
300
  active: false,
301
301
  panelName: "none",
302
+ iconFlipRtl: this.messages._lang === "ar",
302
303
  onClick: this._openArcadeHelp,
303
304
  }))));
304
305
  }
@@ -330,7 +331,7 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
330
331
  //#endregion
331
332
  //#region Render
332
333
  render() {
333
- return (h(Host, { key: '6181895e6ce6843a58b7f45c33ade62ffc38f589' }, this.renderMainActionBar(), h("div", { key: '8f7bad1c9c75beca375520361683a3f67fc502c9', class: "flex-row flex-adjustable" }, h("div", { key: '36a21e23ca9218a35388ae3d92826435b28cde99', class: "flex-column flex-adjustable" }, this.renderMainPanel(), this.renderResultsPanel()), this.renderSidePanel(), this.renderSideActionBar())));
334
+ 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())));
334
335
  }
335
336
  static get assetsDirs() { return ["assets"]; }
336
337
  get el() { return this; }
@@ -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.4
4
+ * v4.31.0-next.40
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.4
4
+ * v4.31.0-next.40
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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { A as ArcgisArcadeVariables$1, d as defineCustomElement$1 } from './arcade-variables.js';
7
7
 
@@ -1,35 +1,35 @@
1
-
2
1
  /*!
3
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
4
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
5
- * v4.31.0-next.4
4
+ * v4.31.0-next.40
6
5
  */
6
+
7
7
  /**
8
- * Get the base path to where the package assets can be found.
9
- * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
10
- * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
11
- * It is CORS-enabled, so you can load the assets from any domain.
12
- * Use "setArcgisAssetPath(path)" if the path needs to be customized.
13
- */
8
+ * Get the base path to where the package assets can be found.
9
+ * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
10
+ * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
11
+ * It is CORS-enabled, so you can load the assets from any domain.
12
+ * Use "setArcgisAssetPath(path)" if the path needs to be customized.
13
+ */
14
14
  export declare const getArcgisAssetPath: (path: string) => string;
15
15
 
16
16
  /**
17
- * Used to manually set the base path where package assets can be found.
18
- *
19
- * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
20
- * For example, "https://js.arcgis.com/map-components/4.29/".
21
- * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
22
- * It is CORS-enabled, so you can load the assets from any domain.
23
- * This is the recommended way to load the assets and avoid bundling them with your application.
24
- * It means that by default, you don't need to use "setArcgisAssetPath" since the path is already set.
25
- *
26
- * However, if you need to host the assets locally, you can use "setArcgisAssetPath" to set the base path.
27
- * If the script is used as "module", it's recommended to use "import.meta.url",
28
- * such as "setArcgisAssetPath(import.meta.url)". Other options include
29
- * "setArcgisAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
30
- * dynamically set the path at build time, such as "setArcgisAssetPath(process.env.ASSET_PATH)".
31
- * But do note that this configuration depends on how your script is bundled, or lack of
32
- * bundling, and where your assets can be loaded from. Additionally custom bundling
33
- * will have to ensure the static assets are copied to its build directory.
34
- */
17
+ * Used to manually set the base path where package assets can be found.
18
+ *
19
+ * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
20
+ * For example, "https://js.arcgis.com/map-components/4.29/".
21
+ * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
22
+ * It is CORS-enabled, so you can load the assets from any domain.
23
+ * This is the recommended way to load the assets and avoid bundling them with your application.
24
+ * It means that by default, you don't need to use "setArcgisAssetPath" since the path is already set.
25
+ *
26
+ * However, if you need to host the assets locally, you can use "setArcgisAssetPath" to set the base path.
27
+ * If the script is used as "module", it's recommended to use "import.meta.url",
28
+ * such as "setArcgisAssetPath(import.meta.url)". Other options include
29
+ * "setArcgisAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
30
+ * dynamically set the path at build time, such as "setArcgisAssetPath(process.env.ASSET_PATH)".
31
+ * But do note that this configuration depends on how your script is bundled, or lack of
32
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
33
+ * will have to ensure the static assets are copied to its build directory.
34
+ */
35
35
  export declare const setArcgisAssetPath: (path: string) => void;
@@ -1,10 +1,10 @@
1
-
2
1
  /*!
3
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
4
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
5
- * v4.31.0-next.4
4
+ * v4.31.0-next.40
6
5
  */
7
6
  let resourceUrl = "https://js.arcgis.com/coding-components/next/";
7
+
8
8
  export const getArcgisAssetPath = (path) => {
9
9
  const assetUrl = new URL(path, resourceUrl);
10
10
  return assetUrl.origin !== window.location.origin ? assetUrl.href : assetUrl.pathname;
@@ -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.4
4
+ * v4.31.0-next.40
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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { A as ArcgisLanguageApiPanel$1, d as defineCustomElement$1 } from './language-api-panel.js';
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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, forceUpdate, h, Host } from '@stencil/core/internal/client';
7
- import { u as useControllerManager } from './chunk-6TARY3NN.js';
7
+ import { u as useControllerManager } from './chunk-656WPE3G.js';
8
8
  import { g as generateGuid } from './index2.js';
9
9
  import { s as sqlExprDefaults } from './sql-expr-defaults.js';
10
10
  import { d as defineCustomElement$4 } from './code-editor.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.4
4
+ * v4.31.0-next.40
5
5
  */
6
6
  import { S as SqlExpressionFields, d as defineCustomElement$1 } from './sql-expression-fields.js';
7
7