@arcgis/coding-components 4.30.0-next.29 → 4.30.0-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-2262edb5.js → p-05407167.js} +2 -2
- package/dist/arcgis-coding-components/p-0e4fd488.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-eff2d3a4.js → p-1b04872b.js} +3 -3
- package/dist/arcgis-coding-components/{p-77ed71a8.js → p-305e6a27.js} +3 -3
- package/dist/arcgis-coding-components/{p-24adbb7c.js → p-38778060.js} +3 -3
- package/dist/arcgis-coding-components/{p-9a00ddea.js → p-3e84bed2.js} +2 -2
- package/dist/arcgis-coding-components/{p-23baf361.js → p-50cbdef2.js} +2 -2
- package/dist/arcgis-coding-components/p-51032f3c.js +68 -0
- package/dist/arcgis-coding-components/{p-9f9cd0b9.js → p-61a3a32b.js} +2 -2
- package/dist/arcgis-coding-components/{p-6df29b26.js → p-7f41598e.js} +2 -2
- package/dist/arcgis-coding-components/{p-9a6e0c8c.js → p-a09a2021.js} +1 -1
- package/dist/arcgis-coding-components/{p-622b32b2.js → p-f2b266c1.js} +1 -1
- package/dist/cjs/{arcade-defaults-5269f6ab.js → arcade-defaults-18a60f03.js} +663 -337
- package/dist/cjs/{arcade-mode-85df9043.js → arcade-mode-c53bfc0e.js} +45 -51
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +366 -261
- package/dist/cjs/arcgis-coding-components.cjs.js +2 -2
- package/dist/cjs/{css-894bed01.js → css-56924b29.js} +1 -1
- package/dist/cjs/{cssMode-0fd626db.js → cssMode-ea630257.js} +3 -3
- package/dist/cjs/{html-64719fae.js → html-3d953aa2.js} +3 -3
- package/dist/cjs/{htmlMode-ad637d19.js → htmlMode-f3da6666.js} +3 -3
- package/dist/cjs/{index-994ea295.js → index-084a0845.js} +1 -1
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/{javascript-72aed55a.js → javascript-470dd761.js} +4 -4
- package/dist/cjs/{jsonMode-b98b4ca9.js → jsonMode-f2bad76f.js} +3 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{tsMode-7b613436.js → tsMode-4dbfa911.js} +3 -3
- package/dist/cjs/{typescript-585a7543.js → typescript-8fb2fceb.js} +3 -3
- package/dist/components/arcade-api.js +6 -6
- package/dist/components/arcade-contribution.js +9 -10
- package/dist/components/arcade-defaults.js +58 -58
- package/dist/components/arcade-mode.js +44 -50
- package/dist/components/arcade-results.js +27 -27
- package/dist/components/arcade-suggestions.js +4 -4
- package/dist/components/arcade-variables.js +5 -5
- package/dist/components/arcgis-arcade-api.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +24 -24
- package/dist/components/arcgis-arcade-results.js +1 -1
- package/dist/components/arcgis-arcade-suggestions.js +1 -1
- package/dist/components/arcgis-arcade-variables.js +1 -1
- package/dist/components/arcgis-assets.d.ts +1 -1
- package/dist/components/arcgis-assets.js +1 -1
- package/dist/components/arcgis-code-editor.js +1 -1
- package/dist/components/{chunk-MRROWYKQ.js → chunk-FQ4KFKVY.js} +305 -199
- package/dist/components/code-editor.js +13 -13
- package/dist/components/fields.js +2 -62
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +387 -3
- package/dist/components/markdown.js +3 -3
- package/dist/components/utilities.js +3 -3
- package/dist/esm/{arcade-defaults-87a86d11.js → arcade-defaults-3f0e1c43.js} +650 -326
- package/dist/esm/{arcade-mode-45fc67da.js → arcade-mode-5aef1763.js} +45 -51
- package/dist/esm/arcgis-arcade-api_6.entry.js +419 -314
- package/dist/esm/arcgis-coding-components.js +3 -3
- package/dist/esm/{css-08f38d73.js → css-4c710cf8.js} +1 -1
- package/dist/esm/{cssMode-ab8f5063.js → cssMode-54cea919.js} +3 -3
- package/dist/esm/{html-af497230.js → html-3908d2da.js} +3 -3
- package/dist/esm/{htmlMode-da083262.js → htmlMode-2fa6e6a4.js} +3 -3
- package/dist/esm/{index-18371544.js → index-06d390be.js} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/{javascript-5e6afc56.js → javascript-1d86322d.js} +4 -4
- package/dist/esm/{jsonMode-71281d55.js → jsonMode-27eb619c.js} +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{tsMode-98a33527.js → tsMode-9a8f9af2.js} +3 -3
- package/dist/esm/{typescript-1dcc1a21.js → typescript-7a26367c.js} +3 -3
- package/dist/loader/cdn.js +1 -1
- package/dist/loader/index.cjs.js +1 -1
- package/dist/loader/index.es2017.js +1 -1
- package/dist/loader/index.js +1 -1
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -1
- package/package.json +9 -9
- package/dist/arcgis-coding-components/p-0dc0bb8a.js +0 -6
- package/dist/arcgis-coding-components/p-1cdc731d.js +0 -6
- package/dist/arcgis-coding-components/p-62e5bb1a.js +0 -6
- package/dist/arcgis-coding-components/p-9dc57c40.entry.js +0 -6
- package/dist/arcgis-coding-components/p-e2200653.js +0 -68
- package/dist/cjs/Accessor-U5QUEX2T-e8f5e012.js +0 -1249
- package/dist/cjs/chunk-CQC6TXVI-eb50b11c.js +0 -1286
- package/dist/cjs/decorators-5KFQ5FDO-45eeb3a7.js +0 -120
- package/dist/components/Accessor-U5QUEX2T.js +0 -1247
- package/dist/components/chunk-CQC6TXVI.js +0 -1257
- package/dist/components/decorators-5KFQ5FDO.js +0 -109
- package/dist/esm/Accessor-U5QUEX2T-0dfda39e.js +0 -1247
- package/dist/esm/chunk-CQC6TXVI-f8d27710.js +0 -1257
- package/dist/esm/decorators-5KFQ5FDO-7ae08fab.js +0 -109
- /package/dist/types/data/{actions-runner-2 → 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
- /package/dist/types/data/{actions-runner-2 → 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
- /package/dist/types/data/{actions-runner-2 → 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
|
@@ -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.30/esri/copyright.txt for details.
|
|
4
|
-
* v4.30.0-next.
|
|
4
|
+
* v4.30.0-next.30
|
|
5
5
|
*/
|
|
6
|
-
import { f as forceUpdate, g as getAssetPath, r as registerInstance, c as createEvent, h
|
|
7
|
-
import { g as generateTokensCSSForColorMap, e as editor, S as StandaloneServices, I as IStandaloneThemeService, c as createCommonjsModule, b as commonjsGlobal, d as
|
|
6
|
+
import { f as forceUpdate, g as getAssetPath, r as registerInstance, c as createEvent, h, H as Host, a as getElement, F as Fragment } from './index-06d390be.js';
|
|
7
|
+
import { g as generateTokensCSSForColorMap, e as editor, S as StandaloneServices, I as IStandaloneThemeService, c as createCommonjsModule, b as commonjsGlobal, i as importCoreAccessor, d as importCoreAccessorSupportDecorators, f as isURL, h as hasSameOrigin, j as importRequest, l as languages, k as arcadeDefaults, U as Uri, s as setFocusOnElement, m as filterCollection, n as addLTRMark, o as importArcade, D as Deferred$1, p as generateGuid, q as getElementTheme, K as KeyCode, r as setValuesInString, t as quoteString, u as supportedFields, v as createFilterExpression, R as Range, w as observeAncestorsMutation$1, x as KeyMod } from './arcade-defaults-3f0e1c43.js';
|
|
8
8
|
|
|
9
9
|
async function colorizeCode(code) {
|
|
10
10
|
return await editor.colorize(code, "arcade", { tabSize: 2 });
|
|
@@ -2922,8 +2922,8 @@ marked_umd.marked.use({
|
|
|
2922
2922
|
renderer: {
|
|
2923
2923
|
link(href, title, text) {
|
|
2924
2924
|
return `<calcite-link href="${href}" title="${title ?? text}" target="Arcade Help">${text}</calcite-link>`;
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2925
|
+
},
|
|
2926
|
+
},
|
|
2927
2927
|
});
|
|
2928
2928
|
/**
|
|
2929
2929
|
* Converts a markdown string to HTML using the marked library.
|
|
@@ -2936,105 +2936,93 @@ function convertMarkdownString(value) {
|
|
|
2936
2936
|
}
|
|
2937
2937
|
|
|
2938
2938
|
// ../components-utils/dist/index.js
|
|
2939
|
-
var
|
|
2939
|
+
var Deferred = class {
|
|
2940
|
+
/**
|
|
2941
|
+
* Creates a new deferred promise.
|
|
2942
|
+
*/
|
|
2940
2943
|
constructor() {
|
|
2941
|
-
this.resolve = () =>
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
this.resolve =
|
|
2944
|
+
this.resolve = () => void 0;
|
|
2945
|
+
this.reject = () => void 0;
|
|
2946
|
+
this.promise = new Promise((resolve, reject) => {
|
|
2947
|
+
this.resolve = resolve;
|
|
2948
|
+
this.reject = reject;
|
|
2945
2949
|
});
|
|
2946
2950
|
}
|
|
2947
2951
|
};
|
|
2948
|
-
function
|
|
2949
|
-
let
|
|
2950
|
-
|
|
2951
|
-
if (
|
|
2952
|
+
function inTargetElement(element, targetElement) {
|
|
2953
|
+
let currentElement = element;
|
|
2954
|
+
while (currentElement) {
|
|
2955
|
+
if (currentElement === targetElement) {
|
|
2952
2956
|
return true;
|
|
2953
|
-
|
|
2957
|
+
}
|
|
2958
|
+
if (!currentElement.parentNode) {
|
|
2954
2959
|
return false;
|
|
2955
|
-
|
|
2960
|
+
}
|
|
2961
|
+
if (currentElement.parentNode instanceof ShadowRoot) {
|
|
2962
|
+
currentElement = currentElement.parentNode.host;
|
|
2963
|
+
} else {
|
|
2964
|
+
currentElement = currentElement.parentNode;
|
|
2965
|
+
}
|
|
2956
2966
|
}
|
|
2957
2967
|
return false;
|
|
2958
2968
|
}
|
|
2959
|
-
function
|
|
2960
|
-
|
|
2961
|
-
return
|
|
2962
|
-
|
|
2969
|
+
function observeAncestorsMutation(element, attributeFilter, callback) {
|
|
2970
|
+
const { subscribe } = observe(attributeFilter);
|
|
2971
|
+
return subscribe((mutations) => {
|
|
2972
|
+
const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
|
|
2973
|
+
if (matched)
|
|
2974
|
+
callback();
|
|
2963
2975
|
});
|
|
2964
2976
|
}
|
|
2965
|
-
var
|
|
2966
|
-
function
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2977
|
+
var observers = {};
|
|
2978
|
+
function observe(attributeFilter) {
|
|
2979
|
+
const attributes = attributeFilter.join(",");
|
|
2980
|
+
const previousObserver = observers[attributes];
|
|
2981
|
+
if (previousObserver !== void 0)
|
|
2982
|
+
return previousObserver;
|
|
2983
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2984
|
+
const mutationObserver = new MutationObserver((mutations) => subscribers.forEach((callback) => callback(mutations)));
|
|
2985
|
+
mutationObserver.observe(document.documentElement, {
|
|
2986
|
+
attributes: true,
|
|
2987
|
+
attributeFilter,
|
|
2988
|
+
subtree: true
|
|
2989
|
+
});
|
|
2990
|
+
const observer = {
|
|
2991
|
+
subscribe(callback) {
|
|
2992
|
+
subscribers.add(callback);
|
|
2993
|
+
return {
|
|
2994
|
+
remove: () => {
|
|
2995
|
+
subscribers.delete(callback);
|
|
2996
|
+
if (subscribers.size === 0) {
|
|
2997
|
+
mutationObserver.disconnect();
|
|
2998
|
+
observers[attributes] = void 0;
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
observers[attributes] = observer;
|
|
3005
|
+
return observer;
|
|
2978
3006
|
}
|
|
2979
|
-
function
|
|
2980
|
-
let
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
if (
|
|
2984
|
-
return
|
|
2985
|
-
|
|
2986
|
-
|
|
3007
|
+
function closestElement(base, selector) {
|
|
3008
|
+
let currentElement = base;
|
|
3009
|
+
while (currentElement) {
|
|
3010
|
+
const element = currentElement.closest(selector);
|
|
3011
|
+
if (element) {
|
|
3012
|
+
return element;
|
|
3013
|
+
}
|
|
3014
|
+
const rootElement = currentElement.getRootNode();
|
|
3015
|
+
if (rootElement === document) {
|
|
2987
3016
|
return null;
|
|
2988
|
-
|
|
3017
|
+
}
|
|
3018
|
+
currentElement = rootElement.host;
|
|
2989
3019
|
}
|
|
2990
3020
|
return null;
|
|
2991
3021
|
}
|
|
2992
|
-
function
|
|
2993
|
-
|
|
3022
|
+
function getElementAttribute(el, prop, fallbackValue) {
|
|
3023
|
+
const closest = closestElement(el, `[${prop}]`);
|
|
3024
|
+
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
2994
3025
|
}
|
|
2995
|
-
var A = (e) => e.charAt(0).toUpperCase() + e.slice(1);
|
|
2996
|
-
var T = (e) => A(e.replaceAll(/([a-z])([A-Z])/gu, "$1 $2"));
|
|
2997
|
-
var v = /* @__PURE__ */ new Set(["ar", "bg", "bs", "ca", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "he", "hr", "hu", "id", "it", "ja", "ko", "lt", "lv", "nl", "nb", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sr", "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-HK", "zh-TW"]);
|
|
2998
|
-
var g = "en";
|
|
2999
|
-
async function j(e, t, n = "") {
|
|
3000
|
-
let r = `${t}/${n}`, o = `${r}${e}.json`;
|
|
3001
|
-
return u[o] ?? (u[o] = S(e, r)), await u[o];
|
|
3002
|
-
}
|
|
3003
|
-
var u = {};
|
|
3004
|
-
async function S(e, t) {
|
|
3005
|
-
let n = `${t}${e}.json`;
|
|
3006
|
-
try {
|
|
3007
|
-
let r = await fetch(n);
|
|
3008
|
-
if (r.ok)
|
|
3009
|
-
return await r.json();
|
|
3010
|
-
} catch (r) {
|
|
3011
|
-
return console.error(r), E;
|
|
3012
|
-
}
|
|
3013
|
-
return e === g ? E : await S(g, t);
|
|
3014
|
-
}
|
|
3015
|
-
var E = new Proxy({}, { get: (e, t) => T(t.toString()) });
|
|
3016
|
-
function M(e) {
|
|
3017
|
-
let t = m(e, "lang", navigator.language || g);
|
|
3018
|
-
if (v.has(t))
|
|
3019
|
-
return { lang: t, t9nLocale: t };
|
|
3020
|
-
let n = t.slice(0, 2);
|
|
3021
|
-
return { lang: t, t9nLocale: v.has(n) ? n : g };
|
|
3022
|
-
}
|
|
3023
|
-
function Y(e, t, n, r) {
|
|
3024
|
-
let o, i = () => void P(e, t, r).then((s) => {
|
|
3025
|
-
(o?.lang !== s.lang || o.t9nLocale !== s.t9nLocale || o.t9nStrings !== s.t9nStrings) && n(s), o = s;
|
|
3026
|
-
}).catch(console.error);
|
|
3027
|
-
return i(), b(e, ["lang"], i);
|
|
3028
|
-
}
|
|
3029
|
-
async function P(e, t, n = e.tagName.toLowerCase().replace("arcgis-", "")) {
|
|
3030
|
-
let { lang: r, t9nLocale: o } = M(e), i = `${t}/${n}/t9n`, s = `${n}.t9n.`, a = await j(o, i, s);
|
|
3031
|
-
return { lang: r, t9nLocale: o, t9nStrings: a };
|
|
3032
|
-
}
|
|
3033
|
-
|
|
3034
|
-
// src/types.ts
|
|
3035
|
-
var controllerSymbol = Symbol("controller");
|
|
3036
|
-
|
|
3037
|
-
// src/utils.ts
|
|
3038
3026
|
function safeCall(callback) {
|
|
3039
3027
|
try {
|
|
3040
3028
|
return callback?.();
|
|
@@ -3051,6 +3039,108 @@ async function safeAsyncCall(callback) {
|
|
|
3051
3039
|
}
|
|
3052
3040
|
return void 0;
|
|
3053
3041
|
}
|
|
3042
|
+
var capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
3043
|
+
var camelToHuman = (value) => capitalize(value.replaceAll(/([a-z])([A-Z])/gu, "$1 $2"));
|
|
3044
|
+
var supportedLocales = /* @__PURE__ */ new Set([
|
|
3045
|
+
"ar",
|
|
3046
|
+
"bg",
|
|
3047
|
+
"bs",
|
|
3048
|
+
"ca",
|
|
3049
|
+
"cs",
|
|
3050
|
+
"da",
|
|
3051
|
+
"de",
|
|
3052
|
+
"el",
|
|
3053
|
+
"en",
|
|
3054
|
+
"es",
|
|
3055
|
+
"et",
|
|
3056
|
+
"fi",
|
|
3057
|
+
"fr",
|
|
3058
|
+
"he",
|
|
3059
|
+
"hr",
|
|
3060
|
+
"hu",
|
|
3061
|
+
"id",
|
|
3062
|
+
"it",
|
|
3063
|
+
"ja",
|
|
3064
|
+
"ko",
|
|
3065
|
+
"lt",
|
|
3066
|
+
"lv",
|
|
3067
|
+
"nl",
|
|
3068
|
+
"nb",
|
|
3069
|
+
"pl",
|
|
3070
|
+
"pt-BR",
|
|
3071
|
+
"pt-PT",
|
|
3072
|
+
"ro",
|
|
3073
|
+
"ru",
|
|
3074
|
+
"sk",
|
|
3075
|
+
"sl",
|
|
3076
|
+
"sr",
|
|
3077
|
+
"sv",
|
|
3078
|
+
"th",
|
|
3079
|
+
"tr",
|
|
3080
|
+
"uk",
|
|
3081
|
+
"vi",
|
|
3082
|
+
"zh-CN",
|
|
3083
|
+
"zh-HK",
|
|
3084
|
+
"zh-TW"
|
|
3085
|
+
]);
|
|
3086
|
+
var defaultLocale = "en";
|
|
3087
|
+
async function fetchT9NStringsBundle(locale, assetsPath, prefix = "") {
|
|
3088
|
+
const path = `${assetsPath}/${prefix}`;
|
|
3089
|
+
const filePath = `${path}${locale}.json`;
|
|
3090
|
+
t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
|
|
3091
|
+
return await t9nStringsCache[filePath];
|
|
3092
|
+
}
|
|
3093
|
+
var t9nStringsCache = {};
|
|
3094
|
+
async function fetchBundle(locale, path) {
|
|
3095
|
+
const filePath = `${path}${locale}.json`;
|
|
3096
|
+
try {
|
|
3097
|
+
const response = await fetch(filePath);
|
|
3098
|
+
if (response.ok)
|
|
3099
|
+
return await response.json();
|
|
3100
|
+
} catch (error) {
|
|
3101
|
+
console.error(error);
|
|
3102
|
+
return fallbackBundle;
|
|
3103
|
+
}
|
|
3104
|
+
if (locale === defaultLocale)
|
|
3105
|
+
return fallbackBundle;
|
|
3106
|
+
return await fetchBundle(defaultLocale, path);
|
|
3107
|
+
}
|
|
3108
|
+
var fallbackBundle = new Proxy(
|
|
3109
|
+
{},
|
|
3110
|
+
{
|
|
3111
|
+
get: (_target, property) => camelToHuman(property.toString())
|
|
3112
|
+
}
|
|
3113
|
+
);
|
|
3114
|
+
function getElementLocales(element) {
|
|
3115
|
+
const lang = getElementAttribute(element, "lang", navigator.language || defaultLocale);
|
|
3116
|
+
if (supportedLocales.has(lang)) {
|
|
3117
|
+
return { lang, t9nLocale: lang };
|
|
3118
|
+
}
|
|
3119
|
+
const rootCode = lang.slice(0, 2);
|
|
3120
|
+
return { lang, t9nLocale: supportedLocales.has(rootCode) ? rootCode : defaultLocale };
|
|
3121
|
+
}
|
|
3122
|
+
function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
|
|
3123
|
+
let result = void 0;
|
|
3124
|
+
const callback = () => void updateComponentLocateState(element, assetsPath, assetName).then((newResult) => {
|
|
3125
|
+
if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings)
|
|
3126
|
+
onUpdated(newResult);
|
|
3127
|
+
result = newResult;
|
|
3128
|
+
}).catch(console.error);
|
|
3129
|
+
callback();
|
|
3130
|
+
return observeAncestorsMutation(element, ["lang"], callback);
|
|
3131
|
+
}
|
|
3132
|
+
async function updateComponentLocateState(element, assetsPath, assetName = element.tagName.toLowerCase().replace("arcgis-", "")) {
|
|
3133
|
+
const { lang, t9nLocale } = getElementLocales(element);
|
|
3134
|
+
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
3135
|
+
const prefix = `${assetName}.t9n.`;
|
|
3136
|
+
const t9nStrings = await fetchT9NStringsBundle(t9nLocale, t9nAssetsPath, prefix);
|
|
3137
|
+
return { lang, t9nLocale, t9nStrings };
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
// src/types.ts
|
|
3141
|
+
var controllerSymbol = Symbol("controller");
|
|
3142
|
+
|
|
3143
|
+
// src/utils.ts
|
|
3054
3144
|
function extendObject(base, extend) {
|
|
3055
3145
|
Object.entries(extend).forEach(([key, value]) => {
|
|
3056
3146
|
if (key in base)
|
|
@@ -3100,6 +3190,7 @@ var ControllerInternals = class {
|
|
|
3100
3190
|
return controller;
|
|
3101
3191
|
};
|
|
3102
3192
|
this.shouldBypassSetter = false;
|
|
3193
|
+
this.shouldBypassGetter = false;
|
|
3103
3194
|
this.shouldBypassReadonly = false;
|
|
3104
3195
|
/**
|
|
3105
3196
|
* A map from component instance or component element to component instance.
|
|
@@ -3109,7 +3200,7 @@ var ControllerInternals = class {
|
|
|
3109
3200
|
this.elementToInstance = /* @__PURE__ */ new WeakMap();
|
|
3110
3201
|
}
|
|
3111
3202
|
/*
|
|
3112
|
-
* Allow controllers to implicitly
|
|
3203
|
+
* Allow controllers to implicitly retrieve which component they are in, to
|
|
3113
3204
|
* improve DX (avoids the need to pass "this" explicitly for each controller)
|
|
3114
3205
|
*/
|
|
3115
3206
|
setAmbientComponent(component) {
|
|
@@ -3121,7 +3212,7 @@ var ControllerInternals = class {
|
|
|
3121
3212
|
this._ambientComponent = void 0;
|
|
3122
3213
|
});
|
|
3123
3214
|
}
|
|
3124
|
-
|
|
3215
|
+
retrieveComponent(name) {
|
|
3125
3216
|
if (this._ambientComponent === void 0)
|
|
3126
3217
|
throw new Error(
|
|
3127
3218
|
[
|
|
@@ -3154,7 +3245,7 @@ var ControllerInternals = class {
|
|
|
3154
3245
|
this._ambientControllers = [];
|
|
3155
3246
|
});
|
|
3156
3247
|
}
|
|
3157
|
-
|
|
3248
|
+
retrieveParentControllers() {
|
|
3158
3249
|
return this._ambientControllers;
|
|
3159
3250
|
}
|
|
3160
3251
|
/*
|
|
@@ -3170,7 +3261,7 @@ var ControllerInternals = class {
|
|
|
3170
3261
|
this._ambientChildController = void 0;
|
|
3171
3262
|
});
|
|
3172
3263
|
}
|
|
3173
|
-
|
|
3264
|
+
retrieveAmbientChildController() {
|
|
3174
3265
|
const controller = this._ambientChildController;
|
|
3175
3266
|
this._ambientChildController = void 0;
|
|
3176
3267
|
return controller;
|
|
@@ -3179,10 +3270,10 @@ var ControllerInternals = class {
|
|
|
3179
3270
|
* Try to resolve a controller, without awaiting it's load
|
|
3180
3271
|
*/
|
|
3181
3272
|
_useRefSync(value) {
|
|
3182
|
-
const ambientChildController = this.
|
|
3273
|
+
const ambientChildController = this.retrieveAmbientChildController();
|
|
3183
3274
|
if (ambientChildController !== void 0)
|
|
3184
3275
|
return ambientChildController;
|
|
3185
|
-
const component = Controller.internals.
|
|
3276
|
+
const component = Controller.internals.retrieveComponent();
|
|
3186
3277
|
const controller = component.manager.internals.resolveExports(value);
|
|
3187
3278
|
if (controller !== void 0)
|
|
3188
3279
|
return controller;
|
|
@@ -3204,7 +3295,7 @@ function retrieveComponentMeta(component) {
|
|
|
3204
3295
|
constructor.__registerControllers = void 0;
|
|
3205
3296
|
if (typeof meta !== "object")
|
|
3206
3297
|
throw new Error(
|
|
3207
|
-
"Failed to
|
|
3298
|
+
"Failed to retrieve internal component meta. Make sure you have the useComponentsControllers() Rollup Plugin for Stencil Controllers configured in your Stencil config."
|
|
3208
3299
|
);
|
|
3209
3300
|
component.manager.internals.meta = { members: meta[0], watchers: meta[1] };
|
|
3210
3301
|
}
|
|
@@ -3222,8 +3313,8 @@ function parsePropertyValue(value, type = 8 /* Any */) {
|
|
|
3222
3313
|
return value;
|
|
3223
3314
|
}
|
|
3224
3315
|
var makeMemberFilter = (filter) => (component) => {
|
|
3225
|
-
const
|
|
3226
|
-
return Object.entries(
|
|
3316
|
+
const members = component.manager.internals.meta?.members;
|
|
3317
|
+
return Object.entries(members ?? {}).filter(([_name, [propType]]) => (propType & filter) !== 0).map(([name]) => name);
|
|
3227
3318
|
};
|
|
3228
3319
|
var getPropLikeMembers = makeMemberFilter(63 /* PropLike */);
|
|
3229
3320
|
var getMemberType = (component, name) => component.manager.internals.meta.members?.[name]?.[0];
|
|
@@ -3251,7 +3342,7 @@ var watcherCallbackName = "dynamicWatcherCallback";
|
|
|
3251
3342
|
var _a;
|
|
3252
3343
|
var _Controller = class _Controller {
|
|
3253
3344
|
constructor(component) {
|
|
3254
|
-
this._ready = new
|
|
3345
|
+
this._ready = new Deferred();
|
|
3255
3346
|
this._lifecycleDisconnected = [];
|
|
3256
3347
|
this.connectedCalled = false;
|
|
3257
3348
|
this.willLoadCalled = false;
|
|
@@ -3266,7 +3357,7 @@ var _Controller = class _Controller {
|
|
|
3266
3357
|
this._exports = makeProvisionalValue(this);
|
|
3267
3358
|
this._exportWatchers = /* @__PURE__ */ new Set();
|
|
3268
3359
|
const resolvedComponent = toControllerHost(
|
|
3269
|
-
component ?? _Controller.internals.
|
|
3360
|
+
component ?? _Controller.internals.retrieveComponent(new.target.name)
|
|
3270
3361
|
);
|
|
3271
3362
|
Object.defineProperty(this, "component", {
|
|
3272
3363
|
writable: false,
|
|
@@ -3372,7 +3463,7 @@ var _Controller = class _Controller {
|
|
|
3372
3463
|
* Use cases:
|
|
3373
3464
|
* - You have a controller and you want to make sure it's loaded before you
|
|
3374
3465
|
* try to use it
|
|
3375
|
-
* - Your
|
|
3466
|
+
* - Your controller is not using exports, so you wish to access some props on
|
|
3376
3467
|
* it directly
|
|
3377
3468
|
* - You have a controller exports only, and you want to retrieve the
|
|
3378
3469
|
* controller itself. This is useful if you wish to call .watchExports() or
|
|
@@ -3388,7 +3479,7 @@ var _Controller = class _Controller {
|
|
|
3388
3479
|
* of this function
|
|
3389
3480
|
*
|
|
3390
3481
|
* @example
|
|
3391
|
-
* @Prop(
|
|
3482
|
+
* @Prop() readOnly = this.manager.readOnly(true);
|
|
3392
3483
|
*
|
|
3393
3484
|
* someAction(): void {
|
|
3394
3485
|
* this.manager.bypassSetter(()=>{
|
|
@@ -3413,6 +3504,30 @@ var _Controller = class _Controller {
|
|
|
3413
3504
|
_Controller.internals.shouldBypassReadonly = false;
|
|
3414
3505
|
return result;
|
|
3415
3506
|
}
|
|
3507
|
+
/**
|
|
3508
|
+
* Property reads inside of this function will bypass any custom getter you
|
|
3509
|
+
* may have, and read the value directly from what's stored in Stencil.
|
|
3510
|
+
*
|
|
3511
|
+
* This also bypasses reactiveUtils integration - reading a property inside of
|
|
3512
|
+
* bypassGetter won't make that property tracked.
|
|
3513
|
+
*
|
|
3514
|
+
* @example
|
|
3515
|
+
* reactiveUtils.watch(
|
|
3516
|
+
* ()=>{
|
|
3517
|
+
* this.manager.bypassGetter(()=>{
|
|
3518
|
+
* console.log(this.someProp);
|
|
3519
|
+
* });
|
|
3520
|
+
* return this.prop;
|
|
3521
|
+
* },
|
|
3522
|
+
* console.log
|
|
3523
|
+
* )
|
|
3524
|
+
*/
|
|
3525
|
+
bypassGetter(callback) {
|
|
3526
|
+
_Controller.internals.shouldBypassGetter = true;
|
|
3527
|
+
const result = safeCall(callback);
|
|
3528
|
+
_Controller.internals.shouldBypassGetter = false;
|
|
3529
|
+
return result;
|
|
3530
|
+
}
|
|
3416
3531
|
/**
|
|
3417
3532
|
* Like this.manager.getSet(), but can be called on any component's
|
|
3418
3533
|
* state/prop from anywhere, rather than just from the default value
|
|
@@ -3427,25 +3542,14 @@ var _Controller = class _Controller {
|
|
|
3427
3542
|
*/
|
|
3428
3543
|
genericGetSet(property, getSet) {
|
|
3429
3544
|
var _a2, _b;
|
|
3430
|
-
const classPrototype = Object.getPrototypeOf(this.component);
|
|
3431
|
-
this.internals.getSetProxy(classPrototype, property, getSet, "class");
|
|
3432
|
-
const htmlPrototype = Object.getPrototypeOf(this.component.el);
|
|
3433
|
-
if (classPrototype !== htmlPrototype)
|
|
3434
|
-
this.internals.getSetProxy(htmlPrototype, property, getSet, "html");
|
|
3435
3545
|
const genericGetSet = getSet;
|
|
3436
3546
|
if (genericGetSet.get !== void 0) {
|
|
3437
3547
|
(_a2 = this.internals.getters)[property] ?? (_a2[property] = []);
|
|
3438
|
-
|
|
3439
|
-
this.internals.getters[property].splice(-1, 0, genericGetSet.get);
|
|
3440
|
-
else
|
|
3441
|
-
this.internals.getters[property].unshift(genericGetSet.get);
|
|
3548
|
+
this.internals.getters[property].unshift(genericGetSet.get);
|
|
3442
3549
|
}
|
|
3443
3550
|
if (genericGetSet.set !== void 0) {
|
|
3444
3551
|
(_b = this.internals.setters)[property] ?? (_b[property] = []);
|
|
3445
|
-
|
|
3446
|
-
this.internals.setters[property].splice(-1, 0, genericGetSet.set);
|
|
3447
|
-
else
|
|
3448
|
-
this.internals.setters[property].unshift(genericGetSet.set);
|
|
3552
|
+
this.internals.setters[property].unshift(genericGetSet.set);
|
|
3449
3553
|
}
|
|
3450
3554
|
}
|
|
3451
3555
|
// FEATURE: improve typings
|
|
@@ -3598,9 +3702,9 @@ function makeProvisionalValue(base) {
|
|
|
3598
3702
|
console.error(`Trying to access "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
|
|
3599
3703
|
return void 0;
|
|
3600
3704
|
},
|
|
3601
|
-
set(target, prop, newValue,
|
|
3705
|
+
set(target, prop, newValue, receiver) {
|
|
3602
3706
|
console.error(`Trying to set "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
|
|
3603
|
-
return Reflect.set(target, prop, newValue,
|
|
3707
|
+
return Reflect.set(target, prop, newValue, receiver);
|
|
3604
3708
|
}
|
|
3605
3709
|
});
|
|
3606
3710
|
return proxy3;
|
|
@@ -3640,13 +3744,14 @@ function trackPropertyKey(object, onResolved, defaultValue) {
|
|
|
3640
3744
|
pendingTrackers.keyCount = keyCount;
|
|
3641
3745
|
}
|
|
3642
3746
|
pendingTrackers.callbacks.push((keys2) => {
|
|
3747
|
+
const callback = (key2) => safeCall(() => onResolved(key2));
|
|
3643
3748
|
const key = keys2[keyCount];
|
|
3644
3749
|
if (key === void 0)
|
|
3645
|
-
|
|
3750
|
+
callback(void 0);
|
|
3646
3751
|
else if (object[key] === defaultValue)
|
|
3647
|
-
|
|
3752
|
+
callback(key);
|
|
3648
3753
|
else
|
|
3649
|
-
|
|
3754
|
+
callback(void 0);
|
|
3650
3755
|
});
|
|
3651
3756
|
return defaultValue;
|
|
3652
3757
|
}
|
|
@@ -3706,7 +3811,7 @@ var ComponentInternals = class {
|
|
|
3706
3811
|
queueMicrotask(() => this._firePropertyTrackers(void 0, void 0, void 0));
|
|
3707
3812
|
this._trackedValue = defaultValue;
|
|
3708
3813
|
this._keyTrackers.push(
|
|
3709
|
-
(key, value, previousValue) => onResolved(defaultValue === value ? key : void 0, previousValue)
|
|
3814
|
+
(key, value, previousValue) => safeCall(() => onResolved(defaultValue === value ? key : void 0, previousValue))
|
|
3710
3815
|
);
|
|
3711
3816
|
return defaultValue;
|
|
3712
3817
|
};
|
|
@@ -3714,6 +3819,8 @@ var ComponentInternals = class {
|
|
|
3714
3819
|
this._keyTrackers = [];
|
|
3715
3820
|
this.getters = {};
|
|
3716
3821
|
this.setters = {};
|
|
3822
|
+
this.accessorGetter = {};
|
|
3823
|
+
this.accessorSetter = {};
|
|
3717
3824
|
this._exports = /* @__PURE__ */ new WeakMap();
|
|
3718
3825
|
Object.defineProperty(this, "component", {
|
|
3719
3826
|
writable: false,
|
|
@@ -3729,15 +3836,22 @@ var ComponentInternals = class {
|
|
|
3729
3836
|
trackers.forEach((tracker) => tracker(key, value, oldValue));
|
|
3730
3837
|
}
|
|
3731
3838
|
/**
|
|
3732
|
-
* Configure a getter or setter for a given
|
|
3733
|
-
*
|
|
3734
|
-
*
|
|
3735
|
-
*
|
|
3839
|
+
* Configure a getter or setter for a given \@Prop/\@State
|
|
3840
|
+
*
|
|
3841
|
+
* Note, since props are defined on the prototype, they are shared between all
|
|
3842
|
+
* instances of a component. Thus, instead of passing a reference to the
|
|
3843
|
+
* getter/setter function, you should update the
|
|
3844
|
+
* ComponentInternals.getters/setters properties, and then call getSetProxy
|
|
3845
|
+
* to apply the changes to the prototype
|
|
3736
3846
|
*/
|
|
3737
|
-
getSetProxy(
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3847
|
+
getSetProxy(property, hasGetter, hasSetter) {
|
|
3848
|
+
const classPrototype = Object.getPrototypeOf(this.component);
|
|
3849
|
+
this._getSetProxy(classPrototype, property, hasGetter, hasSetter, "class");
|
|
3850
|
+
const htmlPrototype = Object.getPrototypeOf(this.component.el);
|
|
3851
|
+
if (classPrototype !== htmlPrototype)
|
|
3852
|
+
this._getSetProxy(htmlPrototype, property, hasGetter, hasSetter, "html");
|
|
3853
|
+
}
|
|
3854
|
+
_getSetProxy(prototype, name, hasGetter, hasSetter, type) {
|
|
3741
3855
|
const component = this.component;
|
|
3742
3856
|
const propType = getMemberType(component, name);
|
|
3743
3857
|
const descriptor = Object.getOwnPropertyDescriptor(prototype, name);
|
|
@@ -3754,36 +3868,37 @@ var ComponentInternals = class {
|
|
|
3754
3868
|
const { get: originalGet, set: originalSet } = descriptor;
|
|
3755
3869
|
const isGetterAlreadyOverwritten = customAccessor in originalGet;
|
|
3756
3870
|
const isSetterAlreadyOverwritten = customAccessor in originalSet;
|
|
3757
|
-
const shouldOverwriteGet = !isGetterAlreadyOverwritten &&
|
|
3758
|
-
const shouldOverwriteSet = !isSetterAlreadyOverwritten &&
|
|
3871
|
+
const shouldOverwriteGet = !isGetterAlreadyOverwritten && hasGetter;
|
|
3872
|
+
const shouldOverwriteSet = !isSetterAlreadyOverwritten && hasSetter;
|
|
3759
3873
|
if (!shouldOverwriteGet && !shouldOverwriteSet)
|
|
3760
3874
|
return;
|
|
3761
3875
|
const finalGetter = shouldOverwriteGet ? function getter() {
|
|
3762
3876
|
let value = originalGet.call(this);
|
|
3877
|
+
if (Controller.internals.shouldBypassGetter)
|
|
3878
|
+
return value;
|
|
3763
3879
|
const component2 = Controller.internals.elementToInstance.get(this);
|
|
3764
|
-
const
|
|
3880
|
+
const internals = component2.manager.internals;
|
|
3881
|
+
value = internals.accessorGetter[name](value, name);
|
|
3882
|
+
const getters = internals.getters[name] ?? emptyArray;
|
|
3765
3883
|
for (let i = 0; i < getters.length; i++)
|
|
3766
3884
|
value = getters[i](value, name);
|
|
3767
3885
|
return value;
|
|
3768
3886
|
} : originalGet;
|
|
3769
3887
|
const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
|
|
3770
|
-
if (Controller.internals.shouldBypassSetter) {
|
|
3771
|
-
originalSet.call(this, rawNewValue);
|
|
3772
|
-
return;
|
|
3773
|
-
}
|
|
3774
3888
|
const oldValue = originalGet.call(this);
|
|
3775
3889
|
let newValue = parsePropertyValue(rawNewValue, propType);
|
|
3776
3890
|
const component2 = Controller.internals.elementToInstance.get(this);
|
|
3777
|
-
const internals = component2
|
|
3891
|
+
const internals = component2.manager.internals;
|
|
3778
3892
|
if (newValue === oldValue)
|
|
3779
3893
|
originalSet.call(this, rawNewValue);
|
|
3780
3894
|
else {
|
|
3781
|
-
const setters = internals
|
|
3895
|
+
const setters = Controller.internals.shouldBypassSetter ? emptyArray : internals.setters[name] ?? emptyArray;
|
|
3782
3896
|
for (let i = 0; i < setters.length; i++)
|
|
3783
3897
|
newValue = setters[i](newValue, oldValue, name);
|
|
3898
|
+
newValue = internals.accessorSetter[name](newValue, oldValue, name);
|
|
3784
3899
|
originalSet.call(this, newValue);
|
|
3785
3900
|
}
|
|
3786
|
-
if (
|
|
3901
|
+
if (internals._keyTrackers.length > 0)
|
|
3787
3902
|
internals?._firePropertyTrackers(name, rawNewValue, oldValue);
|
|
3788
3903
|
} : originalSet;
|
|
3789
3904
|
if (shouldOverwriteGet)
|
|
@@ -3811,59 +3926,42 @@ var ComponentInternals = class {
|
|
|
3811
3926
|
return void 0;
|
|
3812
3927
|
}
|
|
3813
3928
|
};
|
|
3929
|
+
var emptyArray = [];
|
|
3814
3930
|
var customAccessor = Symbol("controllersCustomAccessor");
|
|
3815
3931
|
var nothing = Symbol("nothing");
|
|
3816
|
-
|
|
3817
|
-
// ../core-adapter/dist/index.js
|
|
3818
|
-
var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis;
|
|
3819
|
-
function isDefaultModule(module) {
|
|
3820
|
-
return module.default !== void 0;
|
|
3821
|
-
}
|
|
3822
|
-
async function importCoreAccessor() {
|
|
3823
|
-
if (isAMD) {
|
|
3824
|
-
return await window.$arcgis.import("esri/core/Accessor");
|
|
3825
|
-
}
|
|
3826
|
-
const module = await import('./Accessor-U5QUEX2T-0dfda39e.js');
|
|
3827
|
-
return isDefaultModule(module) ? module.default : module;
|
|
3828
|
-
}
|
|
3829
|
-
async function importCoreAccessorSupportDecorators() {
|
|
3830
|
-
if (isAMD) {
|
|
3831
|
-
return await window.$arcgis.import("esri/core/accessorSupport/decorators");
|
|
3832
|
-
}
|
|
3833
|
-
const module = await import('./decorators-5KFQ5FDO-7ae08fab.js');
|
|
3834
|
-
return isDefaultModule(module) ? module.default : module;
|
|
3835
|
-
}
|
|
3836
|
-
|
|
3837
|
-
// src/accessorIntegration.ts
|
|
3838
3932
|
var accessorPromise = Promise.all([importCoreAccessor(), importCoreAccessorSupportDecorators()]);
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
const
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3933
|
+
function reactiveUtilsIntegration(component) {
|
|
3934
|
+
const members = getPropLikeMembers(component);
|
|
3935
|
+
const internals = component.manager.internals;
|
|
3936
|
+
members.forEach((name) => {
|
|
3937
|
+
internals.accessorGetter[name] = defaultGetterSetter;
|
|
3938
|
+
internals.accessorSetter[name] = defaultGetterSetter;
|
|
3939
|
+
internals.getSetProxy(name, true, true);
|
|
3940
|
+
});
|
|
3941
|
+
return async (enabledMembers = members) => {
|
|
3942
|
+
const [Accessor, { subclass, property }] = await accessorPromise;
|
|
3943
|
+
class AccessorSubclass extends Accessor {
|
|
3944
|
+
}
|
|
3945
|
+
const getter = (_value, propertyName) => accessor[propertyName];
|
|
3946
|
+
function setter(newValue, _oldValue, propertyName) {
|
|
3847
3947
|
if (accessor !== void 0)
|
|
3848
3948
|
accessor[propertyName] = newValue;
|
|
3849
3949
|
return newValue;
|
|
3850
3950
|
}
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
(name) => property({
|
|
3860
|
-
value: component[name]
|
|
3861
|
-
})(AccessorSubclass.prototype, name)
|
|
3951
|
+
component.manager.bypassGetter(
|
|
3952
|
+
() => enabledMembers.forEach((name) => {
|
|
3953
|
+
internals.accessorGetter[name] = getter;
|
|
3954
|
+
internals.accessorSetter[name] = setter;
|
|
3955
|
+
property({
|
|
3956
|
+
value: component[name]
|
|
3957
|
+
})(AccessorSubclass.prototype, name);
|
|
3958
|
+
})
|
|
3862
3959
|
);
|
|
3863
3960
|
const Subclass = subclass(component.el.tagName)(AccessorSubclass);
|
|
3864
|
-
accessor = new Subclass();
|
|
3961
|
+
const accessor = new Subclass();
|
|
3865
3962
|
};
|
|
3866
3963
|
}
|
|
3964
|
+
var defaultGetterSetter = (value) => value;
|
|
3867
3965
|
|
|
3868
3966
|
// src/ControllerManager.ts
|
|
3869
3967
|
var useControllerManager = (component) => new ControllerManager(component);
|
|
@@ -3885,12 +3983,12 @@ var ControllerManager = class extends GenericController {
|
|
|
3885
3983
|
};
|
|
3886
3984
|
extendObject(component, controllerHost);
|
|
3887
3985
|
super(component);
|
|
3888
|
-
this._connected = new
|
|
3986
|
+
this._connected = new Deferred();
|
|
3889
3987
|
this.internals = new ComponentInternals(this.component);
|
|
3890
3988
|
this.connected = this._connected.promise;
|
|
3891
3989
|
this.hasDestroy = false;
|
|
3892
3990
|
this.destroyed = false;
|
|
3893
|
-
this._updatePromise = new
|
|
3991
|
+
this._updatePromise = new Deferred();
|
|
3894
3992
|
this._originalLifecycles = {};
|
|
3895
3993
|
/**
|
|
3896
3994
|
* A magical solution to finding out what property name a given controller
|
|
@@ -3935,6 +4033,26 @@ var ControllerManager = class extends GenericController {
|
|
|
3935
4033
|
* \@Prop() decorator or not
|
|
3936
4034
|
*/
|
|
3937
4035
|
this.trackKey = this.internals.trackKey;
|
|
4036
|
+
this._readonlySetter = (newValue, _oldValue, property) => {
|
|
4037
|
+
if (Controller.internals.shouldBypassReadonly)
|
|
4038
|
+
return newValue;
|
|
4039
|
+
const isProp = getPropType(this.component, property) === "prop";
|
|
4040
|
+
if (isProp)
|
|
4041
|
+
forceUpdate(this.component);
|
|
4042
|
+
throw new Error(
|
|
4043
|
+
`Cannot assign to read-only property "${property}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(
|
|
4044
|
+
newValue
|
|
4045
|
+
)}"`
|
|
4046
|
+
);
|
|
4047
|
+
};
|
|
4048
|
+
/**
|
|
4049
|
+
* In development, on hot module reload, controller would be re-initialized
|
|
4050
|
+
* with all Props and State values persistent, but properties lost. This unsafe
|
|
4051
|
+
* development-only API lets you set or get data for a controller that would
|
|
4052
|
+
* persist across hot reloads.
|
|
4053
|
+
*/
|
|
4054
|
+
this.devOnlySetPersistentControllerData = void 0 ;
|
|
4055
|
+
this.devOnlyGetPersistentControllerData = void 0 ;
|
|
3938
4056
|
this.component.manager = this;
|
|
3939
4057
|
retrieveComponentMeta(component);
|
|
3940
4058
|
this._controllers = controllers;
|
|
@@ -3947,8 +4065,7 @@ var ControllerManager = class extends GenericController {
|
|
|
3947
4065
|
Object.defineProperty(component, "updateComplete", {
|
|
3948
4066
|
get: async () => await this._updatePromise.promise
|
|
3949
4067
|
});
|
|
3950
|
-
this.
|
|
3951
|
-
this._accessorIntegrationReady = accessorIntegration(this.component);
|
|
4068
|
+
this.internals.reactiveUtilsIntegration = reactiveUtilsIntegration(this.component);
|
|
3952
4069
|
Controller.internals.setParentController(void 0);
|
|
3953
4070
|
Controller.internals.setAmbientComponent(component);
|
|
3954
4071
|
Controller.internals.elementToInstance.set(component.el, component);
|
|
@@ -4017,8 +4134,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4017
4134
|
this._preserveOnDisconnectWatcher();
|
|
4018
4135
|
}
|
|
4019
4136
|
async _componentWillLoad() {
|
|
4020
|
-
|
|
4021
|
-
enableIntegration();
|
|
4137
|
+
await this.internals.reactiveUtilsIntegration();
|
|
4022
4138
|
await Promise.allSettled(
|
|
4023
4139
|
Array.from(
|
|
4024
4140
|
this._controllers,
|
|
@@ -4063,7 +4179,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4063
4179
|
);
|
|
4064
4180
|
this._originalLifecycles.componentDidUpdate?.call(this.component);
|
|
4065
4181
|
const updatePromise = this._updatePromise;
|
|
4066
|
-
this._updatePromise = new
|
|
4182
|
+
this._updatePromise = new Deferred();
|
|
4067
4183
|
updatePromise.resolve(true);
|
|
4068
4184
|
}
|
|
4069
4185
|
async destroy() {
|
|
@@ -4104,18 +4220,6 @@ var ControllerManager = class extends GenericController {
|
|
|
4104
4220
|
readonly(value) {
|
|
4105
4221
|
return this.getSet(value, { set: this._readonlySetter });
|
|
4106
4222
|
}
|
|
4107
|
-
_readonlySetter(newValue, _oldValue, property) {
|
|
4108
|
-
if (Controller.internals.shouldBypassReadonly)
|
|
4109
|
-
return newValue;
|
|
4110
|
-
const isProp = getPropType(this.component, property) === "prop";
|
|
4111
|
-
if (isProp)
|
|
4112
|
-
forceUpdate(this.component);
|
|
4113
|
-
throw new Error(
|
|
4114
|
-
`Cannot assign to read-only property "${property}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(
|
|
4115
|
-
newValue
|
|
4116
|
-
)}"`
|
|
4117
|
-
);
|
|
4118
|
-
}
|
|
4119
4223
|
/**
|
|
4120
4224
|
* Listen for any component's @State()/@Prop() change, and mutate it's
|
|
4121
4225
|
* value before it is set.
|
|
@@ -4171,7 +4275,7 @@ ${// Don't expose internal code in production, and keep bundle smaller:
|
|
|
4171
4275
|
|
|
4172
4276
|
// src/proxyExports.ts
|
|
4173
4277
|
var proxyExports = (Class) => (...args) => {
|
|
4174
|
-
const ambientControllers = Controller.internals.
|
|
4278
|
+
const ambientControllers = Controller.internals.retrieveParentControllers();
|
|
4175
4279
|
const instance = new Class(...args);
|
|
4176
4280
|
const initialExports = instance.exports;
|
|
4177
4281
|
Controller.internals.setParentController(ambientControllers.at(-1));
|
|
@@ -4250,20 +4354,21 @@ function useT9n({
|
|
|
4250
4354
|
} = {}) {
|
|
4251
4355
|
return makeController((component, controller) => {
|
|
4252
4356
|
controller.onLifecycle(
|
|
4253
|
-
() =>
|
|
4357
|
+
() => startLocaleObserver(
|
|
4254
4358
|
component.el,
|
|
4255
4359
|
getAssetPath("./assets"),
|
|
4256
4360
|
({ t9nLocale, t9nStrings, lang }) => {
|
|
4257
4361
|
controller.exports = { ...t9nStrings, _lang: lang, _t9nLocale: t9nLocale };
|
|
4258
|
-
|
|
4259
|
-
|
|
4362
|
+
const label = t9nStrings.componentLabel ?? t9nStrings.widgetLabel;
|
|
4363
|
+
if (typeof label === "string" && "label" in component && component.label == null)
|
|
4364
|
+
component.label ?? (component.label = label);
|
|
4260
4365
|
},
|
|
4261
4366
|
name
|
|
4262
4367
|
)
|
|
4263
4368
|
);
|
|
4264
4369
|
if (blocking)
|
|
4265
4370
|
return controller.ready;
|
|
4266
|
-
const locale =
|
|
4371
|
+
const locale = getElementLocales(component.el);
|
|
4267
4372
|
return { _lang: locale.lang, _t9nLocale: locale.t9nLocale };
|
|
4268
4373
|
});
|
|
4269
4374
|
}
|
|
@@ -4308,18 +4413,18 @@ function setupMonacoEnvironment(assetsPath) {
|
|
|
4308
4413
|
break;
|
|
4309
4414
|
}
|
|
4310
4415
|
// If we have a relative path or we are on same orgin, we can use the default js implementation
|
|
4311
|
-
if (!
|
|
4416
|
+
if (!isURL(url) || hasSameOrigin(url, globalThis.location.href, true)) {
|
|
4312
4417
|
return new Worker(url, { name: languageId });
|
|
4313
4418
|
}
|
|
4314
4419
|
// For cross orgin, we will load the worker code as a string and manufacture a blob
|
|
4315
4420
|
const esriRequest = await importRequest();
|
|
4316
4421
|
const response = await esriRequest(url, {
|
|
4317
|
-
responseType: "text"
|
|
4422
|
+
responseType: "text",
|
|
4318
4423
|
});
|
|
4319
4424
|
return new Worker(URL.createObjectURL(new Blob([response.data], {
|
|
4320
|
-
type: "text/javascript"
|
|
4425
|
+
type: "text/javascript",
|
|
4321
4426
|
})));
|
|
4322
|
-
}
|
|
4427
|
+
},
|
|
4323
4428
|
};
|
|
4324
4429
|
}
|
|
4325
4430
|
|
|
@@ -4358,9 +4463,9 @@ function setupArcadeTheme() {
|
|
|
4358
4463
|
{ token: "keyword.arc", foreground: colors.keyword },
|
|
4359
4464
|
{ token: "identifier.arc", foreground: colors.identifier },
|
|
4360
4465
|
{ token: "number.arc", foreground: colors.number },
|
|
4361
|
-
{ token: "string.arc", foreground: colors.string }
|
|
4466
|
+
{ token: "string.arc", foreground: colors.string },
|
|
4362
4467
|
],
|
|
4363
|
-
colors: {}
|
|
4468
|
+
colors: {},
|
|
4364
4469
|
});
|
|
4365
4470
|
});
|
|
4366
4471
|
}
|
|
@@ -4415,14 +4520,14 @@ async function getArcadeWorker(uri) {
|
|
|
4415
4520
|
* @returns arcade mode module
|
|
4416
4521
|
*/
|
|
4417
4522
|
async function getMode() {
|
|
4418
|
-
return await import('./arcade-mode-
|
|
4523
|
+
return await import('./arcade-mode-5aef1763.js');
|
|
4419
4524
|
}
|
|
4420
4525
|
// Register the language in Monaco
|
|
4421
4526
|
languages.register({
|
|
4422
4527
|
id: arcadeDefaults.languageId,
|
|
4423
4528
|
aliases: ["Arcade", "arcade"],
|
|
4424
4529
|
extensions: [".arc"],
|
|
4425
|
-
mimetypes: ["application/arcade"]
|
|
4530
|
+
mimetypes: ["application/arcade"],
|
|
4426
4531
|
});
|
|
4427
4532
|
// An event emitted when a language is first time needed
|
|
4428
4533
|
languages.onLanguage(arcadeDefaults.languageId, () => {
|
|
@@ -4552,7 +4657,7 @@ const ArcgisArcadeApi = class {
|
|
|
4552
4657
|
// When switching between flow the same reference is reused
|
|
4553
4658
|
this._flowObserver = new MutationObserver(() => {
|
|
4554
4659
|
// Get the last panel and try to set focus on the input element
|
|
4555
|
-
|
|
4660
|
+
setFocusOnElement(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
4556
4661
|
});
|
|
4557
4662
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
4558
4663
|
}
|
|
@@ -4563,14 +4668,14 @@ const ArcgisArcadeApi = class {
|
|
|
4563
4668
|
if (!filteredApiItems.length) {
|
|
4564
4669
|
return null;
|
|
4565
4670
|
}
|
|
4566
|
-
return (h
|
|
4671
|
+
return (h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (h("calcite-list-item", { label: addLTRMark(apiItem.completion.detail), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": apiItem }, h("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "Expand", icon: "chevron-right", iconFlipRtl: true, scale: "s", onClick: this._selectItem, "data-item": apiItem }))))));
|
|
4567
4672
|
}
|
|
4568
4673
|
renderApiItemFlowItem() {
|
|
4569
4674
|
const apiItem = this._selectedApiItem;
|
|
4570
4675
|
if (!apiItem) {
|
|
4571
4676
|
return null;
|
|
4572
4677
|
}
|
|
4573
|
-
return (h
|
|
4678
|
+
return (h("calcite-flow-item", { heading: this.messages.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", scale: "s", href: apiItem.link, target: "Arcade Help", "icon-start": "information" }, this.messages.moreinformation)), h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelectedAndClose, "data-item": apiItem, ref: (e) => void e?.setFocus() }, this.messages.insert ?? "Insert"), h("calcite-block", { open: true, heading: addLTRMark(apiItem.completion.detail) }, h("div", { innerHTML: convertMarkdownString(apiItem.completion.documentation) }), apiItem.examples ? (h("div", { ref: (e) => {
|
|
4574
4679
|
if (!e) {
|
|
4575
4680
|
return;
|
|
4576
4681
|
}
|
|
@@ -4581,7 +4686,7 @@ const ArcgisArcadeApi = class {
|
|
|
4581
4686
|
render() {
|
|
4582
4687
|
const categories = (this._apiLibrary ?? []).map((apiCategory) => this.renderApiCategory(apiCategory));
|
|
4583
4688
|
const empty = categories.every((g) => !g);
|
|
4584
|
-
return (h
|
|
4689
|
+
return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this.messages.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), this._preparingApi ? (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 ?? "No items") : categories))), this.renderApiItemFlowItem())));
|
|
4585
4690
|
}
|
|
4586
4691
|
static get assetsDirs() { return ["assets"]; }
|
|
4587
4692
|
get el() { return getElement(this); }
|
|
@@ -4771,7 +4876,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
4771
4876
|
// Setup an executor with the script
|
|
4772
4877
|
const arcade = await importArcade();
|
|
4773
4878
|
const executor = await arcade.createArcadeExecutor(script ?? "", {
|
|
4774
|
-
variables: editorProfile?.variables ?? []
|
|
4879
|
+
variables: editorProfile?.variables ?? [],
|
|
4775
4880
|
});
|
|
4776
4881
|
// We want to measure the execution time
|
|
4777
4882
|
const t1 = performance.now();
|
|
@@ -4781,7 +4886,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
4781
4886
|
spatialReference,
|
|
4782
4887
|
timeZone,
|
|
4783
4888
|
rawOutput: true,
|
|
4784
|
-
console
|
|
4889
|
+
console,
|
|
4785
4890
|
};
|
|
4786
4891
|
// Execute the script
|
|
4787
4892
|
const scriptOutput = await executor.executeAsync(profileVariableInstances, executeContext);
|
|
@@ -4805,7 +4910,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
4805
4910
|
error,
|
|
4806
4911
|
timeStamp,
|
|
4807
4912
|
compilationTime: 0,
|
|
4808
|
-
executionTime: 0
|
|
4913
|
+
executionTime: 0,
|
|
4809
4914
|
};
|
|
4810
4915
|
}
|
|
4811
4916
|
}
|
|
@@ -4818,8 +4923,8 @@ const ArcgisArcadeEditor = class {
|
|
|
4818
4923
|
this.scriptChange = createEvent(this, "scriptChange", 3);
|
|
4819
4924
|
this.diagnosticsChange = createEvent(this, "diagnosticsChange", 3);
|
|
4820
4925
|
this.manager = useControllerManager(this);
|
|
4821
|
-
this._componentReadyDefer = new
|
|
4822
|
-
this._modelId =
|
|
4926
|
+
this._componentReadyDefer = new Deferred$1();
|
|
4927
|
+
this._modelId = generateGuid();
|
|
4823
4928
|
this._editorProfilePromise = Promise.resolve(undefined);
|
|
4824
4929
|
this._disposables = [];
|
|
4825
4930
|
this._executeScript = async () => {
|
|
@@ -4899,7 +5004,7 @@ const ArcgisArcadeEditor = class {
|
|
|
4899
5004
|
}
|
|
4900
5005
|
_snippetChanged() {
|
|
4901
5006
|
arcadeDefaults.updateApiContextForModel(this._modelId, {
|
|
4902
|
-
snippets: this.snippets
|
|
5007
|
+
snippets: this.snippets,
|
|
4903
5008
|
});
|
|
4904
5009
|
}
|
|
4905
5010
|
// #endregion
|
|
@@ -4948,7 +5053,7 @@ const ArcgisArcadeEditor = class {
|
|
|
4948
5053
|
* @internal
|
|
4949
5054
|
*/
|
|
4950
5055
|
async updateThemeColors(colorRules) {
|
|
4951
|
-
const theme =
|
|
5056
|
+
const theme = getElementTheme(this.el);
|
|
4952
5057
|
updateThemeColors(theme, colorRules);
|
|
4953
5058
|
if (colorRules === undefined) {
|
|
4954
5059
|
colorRulesKeys.forEach((key) => {
|
|
@@ -4998,7 +5103,7 @@ const ArcgisArcadeEditor = class {
|
|
|
4998
5103
|
if (this.testData) {
|
|
4999
5104
|
this._executeScript().catch(console.error);
|
|
5000
5105
|
}
|
|
5001
|
-
}
|
|
5106
|
+
},
|
|
5002
5107
|
});
|
|
5003
5108
|
await this._codeEditorElt?.setFocus();
|
|
5004
5109
|
}
|
|
@@ -5020,7 +5125,7 @@ const ArcgisArcadeEditor = class {
|
|
|
5020
5125
|
// Set a new profile for the model using the profile definition and the locale.
|
|
5021
5126
|
await arcadeDefaults.setProfileForModel(this._modelId, this.profile, {
|
|
5022
5127
|
locale: this.messages._t9nLocale,
|
|
5023
|
-
snippets: this.snippets
|
|
5128
|
+
snippets: this.snippets,
|
|
5024
5129
|
});
|
|
5025
5130
|
// Get the corresponding editor profile for the model.
|
|
5026
5131
|
// The editor profile contains the specialized profile for the UI.
|
|
@@ -5040,41 +5145,41 @@ const ArcgisArcadeEditor = class {
|
|
|
5040
5145
|
if (!this.testData) {
|
|
5041
5146
|
return null;
|
|
5042
5147
|
}
|
|
5043
|
-
return (h
|
|
5148
|
+
return (h("calcite-action-bar", { class: "main-action-bar", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { scale: "s" }, h("calcite-action", { text: this.messages.run ?? "Run", "text-enabled": true, icon: "play", scale: "s", loading: this._preparingProfile, onClick: this._executeScript }), this._executionResult ? (h("calcite-action", { text: this.messages.lastresults ?? "Last results", active: this._showExecutionPanel, "text-enabled": true, icon: "access-string-results", iconFlipRtl: true, scale: "s", onClick: this._toggleShowExecutionPanel })) : null)));
|
|
5044
5149
|
}
|
|
5045
5150
|
//#endregion
|
|
5046
5151
|
//#region Render Main Panel
|
|
5047
5152
|
renderMainPanel() {
|
|
5048
|
-
return (h
|
|
5153
|
+
return (h("arcgis-code-editor", { class: "flex-adjustable", language: arcadeDefaults.languageId, value: this.script ?? "", modelId: this._modelId, options: this.editorOptions, onValueChange: this._emitScriptChange, ref: (e) => (this._codeEditorElt = e) }));
|
|
5049
5154
|
}
|
|
5050
5155
|
//#endregion
|
|
5051
5156
|
//#region Rendering the Action Bar
|
|
5052
|
-
renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel }) {
|
|
5053
|
-
return (h
|
|
5157
|
+
renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel, }) {
|
|
5158
|
+
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)))));
|
|
5054
5159
|
}
|
|
5055
5160
|
renderSideActionBar() {
|
|
5056
5161
|
if (this.hideSideBar) {
|
|
5057
5162
|
return null;
|
|
5058
5163
|
}
|
|
5059
|
-
return (h
|
|
5164
|
+
return (h("calcite-action-bar", { class: "side-action-bar border-inline-start", expanded: !!this.sideActionBarExpanded, position: "end", onCalciteActionBarToggle: this._toggleSideActionBarExpanded }, h("calcite-action-group", null, this.renderAction({
|
|
5060
5165
|
id: "profile-variables-action",
|
|
5061
5166
|
label: this.messages.profilevariables ?? "Profile variables",
|
|
5062
5167
|
icon: "profile-variables",
|
|
5063
5168
|
active: this.openedSidePanel === "variables",
|
|
5064
|
-
panelName: "variables"
|
|
5169
|
+
panelName: "variables",
|
|
5065
5170
|
}), this.renderAction({
|
|
5066
5171
|
id: "function-action",
|
|
5067
5172
|
label: this.messages.constantsandfunctions ?? "Constants and functions",
|
|
5068
5173
|
icon: "function",
|
|
5069
5174
|
active: this.openedSidePanel === "api",
|
|
5070
|
-
panelName: "api"
|
|
5175
|
+
panelName: "api",
|
|
5071
5176
|
}), this.suggestions?.length
|
|
5072
5177
|
? this.renderAction({
|
|
5073
5178
|
id: "suggestions-action",
|
|
5074
5179
|
label: this.messages.suggestions ?? "Suggestions",
|
|
5075
5180
|
icon: "lightbulb",
|
|
5076
5181
|
active: this.openedSidePanel === "suggestions",
|
|
5077
|
-
panelName: "suggestions"
|
|
5182
|
+
panelName: "suggestions",
|
|
5078
5183
|
})
|
|
5079
5184
|
: null, this.hideDocumentationActions
|
|
5080
5185
|
? null
|
|
@@ -5084,7 +5189,7 @@ const ArcgisArcadeEditor = class {
|
|
|
5084
5189
|
icon: "question",
|
|
5085
5190
|
active: false,
|
|
5086
5191
|
panelName: "none",
|
|
5087
|
-
onClick: this._openArcadeHelp
|
|
5192
|
+
onClick: this._openArcadeHelp,
|
|
5088
5193
|
}))));
|
|
5089
5194
|
}
|
|
5090
5195
|
//#endregion
|
|
@@ -5095,11 +5200,11 @@ const ArcgisArcadeEditor = class {
|
|
|
5095
5200
|
}
|
|
5096
5201
|
switch (this.openedSidePanel) {
|
|
5097
5202
|
case "api":
|
|
5098
|
-
return (h
|
|
5203
|
+
return (h("arcgis-arcade-api", { class: "side-panel flex-panel border-inline-start", modelId: this._modelId, hideDocumentationActions: this.hideDocumentationActions, onItemSelected: this._insertAsSnippet, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
|
|
5099
5204
|
case "variables":
|
|
5100
|
-
return (h
|
|
5205
|
+
return (h("arcgis-arcade-variables", { class: "side-panel flex-panel border-inline-start", loading: this._preparingProfile, modelId: this._modelId, onItemSelected: this._insertAsText, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
|
|
5101
5206
|
case "suggestions":
|
|
5102
|
-
return (h
|
|
5207
|
+
return (h("arcgis-arcade-suggestions", { class: "side-panel flex-panel border-inline-start", suggestions: this.suggestions, onItemSelected: this._insertAsText, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
|
|
5103
5208
|
default:
|
|
5104
5209
|
return null;
|
|
5105
5210
|
}
|
|
@@ -5110,12 +5215,12 @@ const ArcgisArcadeEditor = class {
|
|
|
5110
5215
|
if (!this._showExecutionPanel) {
|
|
5111
5216
|
return null;
|
|
5112
5217
|
}
|
|
5113
|
-
return (h
|
|
5218
|
+
return (h("arcgis-arcade-results", { class: "flex-adjustable", openedResultPanel: this._resultPanel, loading: this._executingScript, result: this._executionResult, consoleLogs: this._consoleLogs, onOpenedResultPanelChange: this._onResultPanelChange, onClose: this._onExecutionPanelClose }));
|
|
5114
5219
|
}
|
|
5115
5220
|
//#endregion
|
|
5116
5221
|
//#region Render
|
|
5117
5222
|
render() {
|
|
5118
|
-
return (h
|
|
5223
|
+
return (h(Host, null, this.renderMainActionBar(), h("div", { class: "flex-row flex-adjustable" }, h("div", { class: "flex-column flex-adjustable" }, this.renderMainPanel(), this.renderResultsPanel()), this.renderSidePanel(), this.renderSideActionBar())));
|
|
5119
5224
|
}
|
|
5120
5225
|
static get assetsDirs() { return ["assets"]; }
|
|
5121
5226
|
get el() { return getElement(this); }
|
|
@@ -5134,55 +5239,55 @@ const treeProps = {
|
|
|
5134
5239
|
lines: true,
|
|
5135
5240
|
selectionMode: "none",
|
|
5136
5241
|
scale: "s",
|
|
5137
|
-
onCalciteTreeSelect: (e) => e.target.selectedItems.forEach((itemElt) => (itemElt.selected = false))
|
|
5242
|
+
onCalciteTreeSelect: (e) => e.target.selectedItems.forEach((itemElt) => (itemElt.selected = false)),
|
|
5138
5243
|
};
|
|
5139
5244
|
const expandableTreeItemProps = {
|
|
5140
5245
|
onClick: (e) => {
|
|
5141
5246
|
const item = e.currentTarget;
|
|
5142
5247
|
item.expanded = !item.expanded;
|
|
5143
|
-
}
|
|
5248
|
+
},
|
|
5144
5249
|
};
|
|
5145
5250
|
//#endregion
|
|
5146
5251
|
//#region Helper Functions
|
|
5147
5252
|
function renderDictionaryProperty(key) {
|
|
5148
|
-
return (h
|
|
5253
|
+
return (h(Fragment, null, h("span", { class: "dictionary-property" }, key), h("span", null, ":\u00A0")));
|
|
5149
5254
|
}
|
|
5150
5255
|
function renderDictionaryAsJsonTree(value, subtree = false) {
|
|
5151
|
-
return (h
|
|
5256
|
+
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", { class: "string-value" }, JSON.stringify(value.castAsJson(), undefined, 2))));
|
|
5152
5257
|
}
|
|
5153
5258
|
function renderGeometryTree(value, subtree = false) {
|
|
5154
|
-
return (h
|
|
5259
|
+
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), h("span", { class: "string-value" }, JSON.stringify(value, undefined, 2))))));
|
|
5155
5260
|
}
|
|
5156
5261
|
function renderSimpleValue(arcadeResult) {
|
|
5157
5262
|
switch (arcadeResult.type) {
|
|
5158
5263
|
case "unknown":
|
|
5159
5264
|
case "null":
|
|
5160
|
-
return h
|
|
5265
|
+
return h("span", { class: "constant-value" }, arcadeResult.type);
|
|
5161
5266
|
case "text":
|
|
5162
|
-
return h
|
|
5267
|
+
return h("span", { class: "string-value" }, quoteString(arcadeResult.value));
|
|
5163
5268
|
case "number":
|
|
5164
|
-
return h
|
|
5269
|
+
return h("span", { class: "number-value" }, arcadeResult.value.toString());
|
|
5165
5270
|
case "boolean":
|
|
5166
|
-
return h
|
|
5271
|
+
return h("span", { class: "constant-value" }, arcadeResult.value.toString());
|
|
5167
5272
|
case "date":
|
|
5168
|
-
return h
|
|
5273
|
+
return h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
|
|
5169
5274
|
case "dateOnly":
|
|
5170
|
-
return h
|
|
5275
|
+
return h("span", { class: "string-value" }, quoteString(formatArcadeResultDateOnly(arcadeResult)));
|
|
5171
5276
|
case "time":
|
|
5172
|
-
return h
|
|
5277
|
+
return h("span", { class: "string-value" }, quoteString(formatArcadeResultTimeOnly(arcadeResult)));
|
|
5173
5278
|
default:
|
|
5174
5279
|
return null;
|
|
5175
5280
|
}
|
|
5176
5281
|
}
|
|
5177
5282
|
function renderFeatureSetTable(arcadeResult) {
|
|
5178
5283
|
const fields = supportedFields(arcadeResult.value.fields);
|
|
5179
|
-
return (h
|
|
5284
|
+
return (h("table", null, h("thead", null, h("tr", null, fields.map((field) => (h("th", null, field.name))))), h("tbody", null, arcadeResult.features.map((feature) => (h("tr", null, fields.map((field) => {
|
|
5180
5285
|
try {
|
|
5181
5286
|
const arcadeResult = valueToArcadeResult(feature.field(field.name));
|
|
5182
|
-
return h
|
|
5287
|
+
return h("td", null, renderSimpleValue(arcadeResult));
|
|
5183
5288
|
}
|
|
5184
5289
|
catch {
|
|
5185
|
-
return h
|
|
5290
|
+
return h("td", null);
|
|
5186
5291
|
}
|
|
5187
5292
|
})))))));
|
|
5188
5293
|
}
|
|
@@ -5223,96 +5328,96 @@ const ArcgisArcadeResults = class {
|
|
|
5223
5328
|
return null;
|
|
5224
5329
|
}
|
|
5225
5330
|
if (this.loading && !this.consoleLogs?.length) {
|
|
5226
|
-
return h
|
|
5331
|
+
return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
|
|
5227
5332
|
}
|
|
5228
|
-
return (h
|
|
5333
|
+
return (h("div", { class: "console-logs-container ltr-container" }, this.consoleLogs?.length ? this.consoleLogs.map((log) => h("p", null, log)) : h("p", null, this.messages.consolemessage)));
|
|
5229
5334
|
}
|
|
5230
5335
|
renderLogPanel() {
|
|
5231
5336
|
if (this.openedResultPanel !== "log") {
|
|
5232
5337
|
return null;
|
|
5233
5338
|
}
|
|
5234
5339
|
if (this.loading) {
|
|
5235
|
-
return h
|
|
5340
|
+
return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
|
|
5236
5341
|
}
|
|
5237
5342
|
const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
|
|
5238
|
-
return (h
|
|
5343
|
+
return (h("calcite-list", null, this.result ? (h(Fragment, null, h("calcite-list-item", { label: setValuesInString(this.messages.lastexecutionformat, {
|
|
5239
5344
|
timeStamp: new Intl.DateTimeFormat(this.messages._t9nLocale, {
|
|
5240
5345
|
dateStyle: "medium",
|
|
5241
|
-
timeStyle: "medium"
|
|
5242
|
-
}).format(this.result.timeStamp)
|
|
5243
|
-
}) }, h
|
|
5346
|
+
timeStyle: "medium",
|
|
5347
|
+
}).format(this.result.timeStamp),
|
|
5348
|
+
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: setValuesInString(this.messages.compilationtimeformat, {
|
|
5244
5349
|
time: new Intl.NumberFormat(this.messages._t9nLocale, {
|
|
5245
5350
|
style: "unit",
|
|
5246
5351
|
unit: "millisecond",
|
|
5247
|
-
maximumFractionDigits: 2
|
|
5248
|
-
}).format(this.result.compilationTime ?? 0)
|
|
5249
|
-
}) }, h
|
|
5352
|
+
maximumFractionDigits: 2,
|
|
5353
|
+
}).format(this.result.compilationTime ?? 0),
|
|
5354
|
+
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: setValuesInString(this.messages.executiontimeformat, {
|
|
5250
5355
|
time: new Intl.NumberFormat(this.messages._t9nLocale, {
|
|
5251
5356
|
style: "unit",
|
|
5252
5357
|
unit: "millisecond",
|
|
5253
|
-
maximumFractionDigits: 2
|
|
5254
|
-
}).format(this.result.executionTime ?? 0)
|
|
5255
|
-
}) }, h
|
|
5358
|
+
maximumFractionDigits: 2,
|
|
5359
|
+
}).format(this.result.executionTime ?? 0),
|
|
5360
|
+
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h("calcite-list-item", { label: this.messages.runscriptmessage ?? "No output, run the script once." }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
|
|
5256
5361
|
}
|
|
5257
5362
|
renderOutputPanel() {
|
|
5258
5363
|
if (this.openedResultPanel !== "output") {
|
|
5259
5364
|
return null;
|
|
5260
5365
|
}
|
|
5261
5366
|
if (this.loading) {
|
|
5262
|
-
return h
|
|
5367
|
+
return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
|
|
5263
5368
|
}
|
|
5264
5369
|
switch (this.result?.type) {
|
|
5265
5370
|
case "error":
|
|
5266
|
-
return (h
|
|
5267
|
-
message: this.result.value
|
|
5371
|
+
return (h("div", { class: "result-value-simple flex-adjustable" }, setValuesInString(this.messages.executionerrorformat, {
|
|
5372
|
+
message: this.result.value,
|
|
5268
5373
|
})));
|
|
5269
5374
|
case "null":
|
|
5270
5375
|
case "unknown":
|
|
5271
|
-
return h
|
|
5376
|
+
return h("div", { class: "result-value-simple ltr-container" }, renderSimpleValue(this.result));
|
|
5272
5377
|
case "text":
|
|
5273
5378
|
case "number":
|
|
5274
5379
|
case "date":
|
|
5275
5380
|
case "dateOnly":
|
|
5276
5381
|
case "time":
|
|
5277
5382
|
case "boolean":
|
|
5278
|
-
return (h
|
|
5383
|
+
return (h("div", { class: "result-value-simple ltr-container" }, h("span", { class: "value-type" }, this.result.type, ":\u00A0"), renderSimpleValue(this.result)));
|
|
5279
5384
|
case "array": {
|
|
5280
5385
|
const items = this.result.value ?? [];
|
|
5281
5386
|
const firstItems = items.slice(0, MaxArrayItems);
|
|
5282
|
-
return (h
|
|
5387
|
+
return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderArrayHeader(this.result)), this.renderArrayTree(firstItems, true)))));
|
|
5283
5388
|
}
|
|
5284
5389
|
case "geometry":
|
|
5285
|
-
return (h
|
|
5390
|
+
return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), renderGeometryTree(this.result.value, true)))));
|
|
5286
5391
|
case "attachment":
|
|
5287
|
-
return (h
|
|
5392
|
+
return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), renderDictionaryAsJsonTree(this.result.value, true)))));
|
|
5288
5393
|
case "feature":
|
|
5289
5394
|
case "dictionary":
|
|
5290
5395
|
case "portal":
|
|
5291
|
-
return (h
|
|
5396
|
+
return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryTree(this.result.value, true)))));
|
|
5292
5397
|
case "featureSet":
|
|
5293
|
-
return (h
|
|
5398
|
+
return (h("div", { class: "result-value-table ltr-container" }, this.renderFeatureSetLabel(this.result), renderFeatureSetTable(this.result)));
|
|
5294
5399
|
case "knowledgeGraph":
|
|
5295
|
-
return (h
|
|
5400
|
+
return (h("div", { class: "result-value-simple ltr-container" }, h("span", { class: "value-type" }, this.result.type, ":\u00A0"), h("span", { class: "string-value" }, this.result.value.url)));
|
|
5296
5401
|
default:
|
|
5297
|
-
return h
|
|
5402
|
+
return h("div", { class: "result-value-simple flex-adjustable ltr-container" }, this.messages.runscriptmessage);
|
|
5298
5403
|
}
|
|
5299
5404
|
}
|
|
5300
5405
|
renderArrayHeader(arcadeResult) {
|
|
5301
5406
|
const items = arcadeResult.value ?? [];
|
|
5302
5407
|
const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
|
|
5303
|
-
return (h
|
|
5304
|
-
count: MaxArrayItems.toString()
|
|
5408
|
+
return (h(Fragment, null, h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h("span", null, "\u00A0", setValuesInString(this.messages.showingfirstitemsformat, {
|
|
5409
|
+
count: MaxArrayItems.toString(),
|
|
5305
5410
|
}))) : null));
|
|
5306
5411
|
}
|
|
5307
5412
|
renderArrayTree(items, subtree = false) {
|
|
5308
|
-
return (h
|
|
5413
|
+
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, items.map((value, key) => {
|
|
5309
5414
|
const arcadeValue = valueToArcadeResult(value);
|
|
5310
5415
|
return this.renderTreeItem(arcadeValue, key, !subtree);
|
|
5311
5416
|
})));
|
|
5312
5417
|
}
|
|
5313
5418
|
renderDictionaryTree(value, subtree = false) {
|
|
5314
5419
|
const geometry = value.geometry?.();
|
|
5315
|
-
return (h
|
|
5420
|
+
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, value.keys().map((key) => {
|
|
5316
5421
|
const arcadeValue = valueToArcadeResult(value.field(key));
|
|
5317
5422
|
return this.renderTreeItem(arcadeValue, key);
|
|
5318
5423
|
}), geometry ? this.renderTreeItem({ type: "geometry", value: geometry }, "geometry") : null));
|
|
@@ -5327,31 +5432,31 @@ const ArcgisArcadeResults = class {
|
|
|
5327
5432
|
case "dateOnly":
|
|
5328
5433
|
case "time":
|
|
5329
5434
|
case "boolean":
|
|
5330
|
-
return (h
|
|
5435
|
+
return (h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), renderSimpleValue(arcadeResult))));
|
|
5331
5436
|
case "array": {
|
|
5332
5437
|
const items = arcadeResult.value ?? [];
|
|
5333
5438
|
const firstItems = items.slice(0, MaxArrayItems);
|
|
5334
|
-
return (h
|
|
5439
|
+
return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), this.renderArrayHeader(arcadeResult)), this.renderArrayTree(firstItems, true)));
|
|
5335
5440
|
}
|
|
5336
5441
|
case "geometry":
|
|
5337
|
-
return (h
|
|
5442
|
+
return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h("span", null, arcadeResult.type)), renderGeometryTree(arcadeResult.value, true)));
|
|
5338
5443
|
case "attachment":
|
|
5339
|
-
return (h
|
|
5444
|
+
return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h("span", null, arcadeResult.type)), renderDictionaryAsJsonTree(arcadeResult.value, true)));
|
|
5340
5445
|
case "feature":
|
|
5341
5446
|
case "dictionary":
|
|
5342
5447
|
case "portal":
|
|
5343
|
-
return (h
|
|
5448
|
+
return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderDictionaryTree(arcadeResult.value, true)));
|
|
5344
5449
|
default:
|
|
5345
5450
|
return null;
|
|
5346
5451
|
}
|
|
5347
5452
|
}
|
|
5348
5453
|
renderFeatureSetLabel(arcadeResult) {
|
|
5349
|
-
return (h
|
|
5350
|
-
count: BatchSize.toString()
|
|
5454
|
+
return (h("div", { class: "value-type" }, h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h("span", null, "\u00A0", setValuesInString(this.messages.showingfirstitemsformat, {
|
|
5455
|
+
count: BatchSize.toString(),
|
|
5351
5456
|
}))) : null));
|
|
5352
5457
|
}
|
|
5353
5458
|
render() {
|
|
5354
|
-
return (h
|
|
5459
|
+
return (h(Host, null, h("header", { class: "flex-row" }, h("calcite-action-bar", { class: "flex-adjustable", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { scale: "s" }, h("calcite-action", { active: this.openedResultPanel === "output", text: this.messages.output ?? "Output", "text-enabled": true, scale: "s", icon: "list-show-all", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "output" }), h("calcite-action", { active: this.openedResultPanel === "console", text: this.messages.console ?? "Console", "text-enabled": true, scale: "s", icon: "console", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "console" }), h("calcite-action", { active: this.openedResultPanel === "log", text: this.messages.log ?? "Log", "text-enabled": true, scale: "s", icon: "list", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "log" }))), h("calcite-action", { scale: "s", icon: "x", text: this.messages.close ?? "", onClick: this._emitClose })), h("article", { class: "flex-adjustable" }, this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: "" })) : (h("div", { class: "flex-column y-scrollable-container" }, this.renderOutputPanel(), this.renderConsolePanel(), this.renderLogPanel())))));
|
|
5355
5460
|
}
|
|
5356
5461
|
static get assetsDirs() { return ["assets"]; }
|
|
5357
5462
|
get el() { return getElement(this); }
|
|
@@ -5439,7 +5544,7 @@ const ArcgisArcadeSuggestions = class {
|
|
|
5439
5544
|
// When switching between flow the same reference is reused
|
|
5440
5545
|
this._flowObserver = new MutationObserver(() => {
|
|
5441
5546
|
// Get the last panel and try to set focus on the input element
|
|
5442
|
-
|
|
5547
|
+
setFocusOnElement(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
5443
5548
|
});
|
|
5444
5549
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
5445
5550
|
}
|
|
@@ -5450,26 +5555,26 @@ const ArcgisArcadeSuggestions = class {
|
|
|
5450
5555
|
return null;
|
|
5451
5556
|
}
|
|
5452
5557
|
if (isSuggestionGroups(this.suggestions)) {
|
|
5453
|
-
return this.suggestions.map((suggestionGroup) => (h
|
|
5558
|
+
return this.suggestions.map((suggestionGroup) => (h("calcite-list-item-group", { heading: suggestionGroup.label }, this.renderSuggestionListItems(suggestionGroup.suggestions))));
|
|
5454
5559
|
}
|
|
5455
5560
|
return this.renderSuggestionListItems(this.suggestions);
|
|
5456
5561
|
}
|
|
5457
5562
|
renderSuggestionListItems(suggestions) {
|
|
5458
5563
|
suggestions = filterCollection(suggestions, "label", this._filterValue);
|
|
5459
5564
|
if (!suggestions.length) {
|
|
5460
|
-
return h
|
|
5565
|
+
return h("div", { class: "notice-container" }, this.messages.noitems ?? "No item");
|
|
5461
5566
|
}
|
|
5462
|
-
return suggestions.map((suggestion) => (h
|
|
5567
|
+
return suggestions.map((suggestion) => (h("calcite-list-item", { label: suggestion.label, description: suggestion.description, onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": suggestion }, h("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showSuggestionDetail, "data-item": suggestion }))));
|
|
5463
5568
|
}
|
|
5464
5569
|
renderSuggestionFlowItem() {
|
|
5465
5570
|
const suggestion = this._selectedSuggestion;
|
|
5466
5571
|
if (!suggestion) {
|
|
5467
5572
|
return null;
|
|
5468
5573
|
}
|
|
5469
|
-
return (h
|
|
5574
|
+
return (h("calcite-flow-item", { heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelected, ref: (e) => void e?.setFocus(), "data-item": suggestion }, this.messages.insert), h("calcite-block", { open: true, heading: suggestion.label, description: suggestion.description }, h("div", { innerHTML: convertMarkdownString(suggestion.documentation) }), h("pre", null, h("code", { ref: (e) => e === undefined ? undefined : void colorizeCodeElement(e, suggestion.code).catch(console.error) })))));
|
|
5470
5575
|
}
|
|
5471
5576
|
render() {
|
|
5472
|
-
return (h
|
|
5577
|
+
return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), h("calcite-list", null, this.renderSuggestionGroups())), this.renderSuggestionFlowItem())));
|
|
5473
5578
|
}
|
|
5474
5579
|
static get assetsDirs() { return ["assets"]; }
|
|
5475
5580
|
get el() { return getElement(this); }
|
|
@@ -5560,7 +5665,7 @@ const ArcgisArcadeVariables = class {
|
|
|
5560
5665
|
// When switching between flow the same reference is reused
|
|
5561
5666
|
this._flowObserver = new MutationObserver(() => {
|
|
5562
5667
|
// Get the last panel and try to set focus on the input element
|
|
5563
|
-
|
|
5668
|
+
setFocusOnElement(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
5564
5669
|
});
|
|
5565
5670
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
5566
5671
|
}
|
|
@@ -5589,15 +5694,15 @@ const ArcgisArcadeVariables = class {
|
|
|
5589
5694
|
});
|
|
5590
5695
|
loading = true;
|
|
5591
5696
|
}
|
|
5592
|
-
return (h
|
|
5697
|
+
return (h("calcite-flow-item", { heading: this.messages.profilevariables, description: collection.breadcrumb, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-action", { slot: "header-actions-end", text: this.messages.backtotop ?? "Back to top", scale: "m", hidden: topPanel, icon: "chevrons-left", iconFlipRtl: true, onClick: this._backToTop }), h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this.messages.loading ?? "Loading" })) : (h("calcite-list", null, this.renderEditorVariables(collection)))));
|
|
5593
5698
|
};
|
|
5594
5699
|
}
|
|
5595
5700
|
renderEditorVariables(collection) {
|
|
5596
5701
|
// Filter the variables. Skip group, we will filter the children later on.
|
|
5597
|
-
const filterExpression =
|
|
5702
|
+
const filterExpression = createFilterExpression(this._filterValue);
|
|
5598
5703
|
const filteredVariables = collection.variables.filter((variable) => variable.passFilter(filterExpression));
|
|
5599
5704
|
if (!filteredVariables.length) {
|
|
5600
|
-
return h
|
|
5705
|
+
return h("div", { class: "notice-container" }, this.messages.noitems ?? "No item");
|
|
5601
5706
|
}
|
|
5602
5707
|
return filteredVariables.map((variable) => this.renderEditorVariable(variable));
|
|
5603
5708
|
}
|
|
@@ -5605,17 +5710,17 @@ const ArcgisArcadeVariables = class {
|
|
|
5605
5710
|
switch (variable.type) {
|
|
5606
5711
|
case "group":
|
|
5607
5712
|
// Group is a collection but we represent it differently
|
|
5608
|
-
return (h
|
|
5713
|
+
return (h("calcite-list-item-group", { heading: variable.getLabel() }, this.renderEditorVariables(variable)));
|
|
5609
5714
|
default:
|
|
5610
|
-
return (h
|
|
5715
|
+
return (h("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (h("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showCollectionPanel, onKeyPress: stopEnterPropagation, "data-item": variable })) : null, variable.icon ? h("calcite-icon", { icon: variable.icon, scale: "s", slot: "content-start" }) : null));
|
|
5611
5716
|
}
|
|
5612
5717
|
}
|
|
5613
5718
|
render() {
|
|
5614
5719
|
const profile = arcadeDefaults.getEditorProfileForModel(this.modelId ?? "");
|
|
5615
5720
|
if (!this.loading && !profile?.variables.length) {
|
|
5616
|
-
return (h
|
|
5721
|
+
return (h("calcite-flow", null, h("calcite-flow-item", { heading: this.messages.profilevariables, closable: true, onCalciteFlowItemClose: this._emitClose }, h("div", { class: "notice-container" }, this.messages.noprofilevariablesmessage ?? ""))));
|
|
5617
5722
|
}
|
|
5618
|
-
return (h
|
|
5723
|
+
return (h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, this.collectionBasedVariableRenderer(profile, true)(), this._flowItemRenderers.map((renderer) => renderer())));
|
|
5619
5724
|
}
|
|
5620
5725
|
static get assetsDirs() { return ["assets"]; }
|
|
5621
5726
|
get el() { return getElement(this); }
|
|
@@ -5636,20 +5741,20 @@ const EditorOptionsDefaults = {
|
|
|
5636
5741
|
renderLineHighlight: "none",
|
|
5637
5742
|
suggest: {
|
|
5638
5743
|
snippetsPreventQuickSuggestions: false,
|
|
5639
|
-
showWords: false
|
|
5744
|
+
showWords: false,
|
|
5640
5745
|
},
|
|
5641
5746
|
tabSize: 2,
|
|
5642
|
-
useShadowDOM: true
|
|
5747
|
+
useShadowDOM: true,
|
|
5643
5748
|
};
|
|
5644
5749
|
const ArcgisCodeEditor = class {
|
|
5645
5750
|
constructor(hostRef) {
|
|
5646
5751
|
registerInstance(this, hostRef);
|
|
5647
5752
|
this.valueChange = createEvent(this, "valueChange", 3);
|
|
5648
|
-
this._componentReadyDefer = new
|
|
5753
|
+
this._componentReadyDefer = new Deferred$1();
|
|
5649
5754
|
this._disposables = [];
|
|
5650
5755
|
this.value = undefined;
|
|
5651
5756
|
this.language = undefined;
|
|
5652
|
-
this.modelId =
|
|
5757
|
+
this.modelId = generateGuid();
|
|
5653
5758
|
this.options = undefined;
|
|
5654
5759
|
}
|
|
5655
5760
|
valuePropChange(newValue) {
|
|
@@ -5777,7 +5882,7 @@ const ArcgisCodeEditor = class {
|
|
|
5777
5882
|
...(this.options ?? {}),
|
|
5778
5883
|
model,
|
|
5779
5884
|
fixedOverflowWidgets: true,
|
|
5780
|
-
scrollBeyondLastLine: false
|
|
5885
|
+
scrollBeyondLastLine: false,
|
|
5781
5886
|
});
|
|
5782
5887
|
this._disposables.push(this._editorInstance);
|
|
5783
5888
|
// Set the value now to trigger a diagnostic again
|
|
@@ -5791,7 +5896,7 @@ const ArcgisCodeEditor = class {
|
|
|
5791
5896
|
this.valueChange.emit(script);
|
|
5792
5897
|
});
|
|
5793
5898
|
// Detect if the host element or its ancestors got a theme attribute mutation
|
|
5794
|
-
this._themeObserver =
|
|
5899
|
+
this._themeObserver = observeAncestorsMutation$1(this._hostElt, ["class"], () => this.updateTheme());
|
|
5795
5900
|
// Update the theme of the Monaco Editor
|
|
5796
5901
|
this.updateTheme();
|
|
5797
5902
|
// Creates a resize observer to re-layout the editor on size changing
|
|
@@ -5822,7 +5927,7 @@ const ArcgisCodeEditor = class {
|
|
|
5822
5927
|
// This is called the first time and subsequently by the Mutation Observer
|
|
5823
5928
|
// Figure out the theme by walking the ancestor path.
|
|
5824
5929
|
// If no theme is found then default to light.
|
|
5825
|
-
const theme =
|
|
5930
|
+
const theme = getElementTheme(this._hostElt) === "light" ? "vs" : "vs-dark";
|
|
5826
5931
|
if (theme === this._currentTheme) {
|
|
5827
5932
|
return;
|
|
5828
5933
|
}
|
|
@@ -5847,7 +5952,7 @@ const ArcgisCodeEditor = class {
|
|
|
5847
5952
|
contextMenuOrder: 1,
|
|
5848
5953
|
// Method that will be executed when the action is triggered.
|
|
5849
5954
|
// @param editor The editor instance is passed in as a convenience
|
|
5850
|
-
run: async () => await zoomInFn?.run()
|
|
5955
|
+
run: async () => await zoomInFn?.run(),
|
|
5851
5956
|
});
|
|
5852
5957
|
this._editorInstance?.addAction({
|
|
5853
5958
|
id: "editor.action.fontZoomOut",
|
|
@@ -5855,13 +5960,13 @@ const ArcgisCodeEditor = class {
|
|
|
5855
5960
|
keybindings: [KeyMod.CtrlCmd | KeyCode.Minus],
|
|
5856
5961
|
contextMenuGroupId: "zooming",
|
|
5857
5962
|
contextMenuOrder: 2,
|
|
5858
|
-
run: async () => await zoomOutFn?.run()
|
|
5963
|
+
run: async () => await zoomOutFn?.run(),
|
|
5859
5964
|
});
|
|
5860
5965
|
}
|
|
5861
5966
|
//#endregion
|
|
5862
5967
|
// #region Rendering
|
|
5863
5968
|
render() {
|
|
5864
|
-
return h
|
|
5969
|
+
return h(Host, null);
|
|
5865
5970
|
}
|
|
5866
5971
|
static get assetsDirs() { return ["assets"]; }
|
|
5867
5972
|
get _hostElt() { return getElement(this); }
|