@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,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
|
-
* v4.30.0-next.
|
|
4
|
+
* v4.30.0-next.30
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const arcadeDefaults = require('./arcade-defaults-
|
|
10
|
+
const index = require('./index-084a0845.js');
|
|
11
|
+
const arcadeDefaults = require('./arcade-defaults-18a60f03.js');
|
|
12
12
|
|
|
13
13
|
async function colorizeCode(code) {
|
|
14
14
|
return await arcadeDefaults.editor.colorize(code, "arcade", { tabSize: 2 });
|
|
@@ -2926,8 +2926,8 @@ marked_umd.marked.use({
|
|
|
2926
2926
|
renderer: {
|
|
2927
2927
|
link(href, title, text) {
|
|
2928
2928
|
return `<calcite-link href="${href}" title="${title ?? text}" target="Arcade Help">${text}</calcite-link>`;
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2929
|
+
},
|
|
2930
|
+
},
|
|
2931
2931
|
});
|
|
2932
2932
|
/**
|
|
2933
2933
|
* Converts a markdown string to HTML using the marked library.
|
|
@@ -2940,105 +2940,93 @@ function convertMarkdownString(value) {
|
|
|
2940
2940
|
}
|
|
2941
2941
|
|
|
2942
2942
|
// ../components-utils/dist/index.js
|
|
2943
|
-
var
|
|
2943
|
+
var Deferred = class {
|
|
2944
|
+
/**
|
|
2945
|
+
* Creates a new deferred promise.
|
|
2946
|
+
*/
|
|
2944
2947
|
constructor() {
|
|
2945
|
-
this.resolve = () =>
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
this.resolve =
|
|
2948
|
+
this.resolve = () => void 0;
|
|
2949
|
+
this.reject = () => void 0;
|
|
2950
|
+
this.promise = new Promise((resolve, reject) => {
|
|
2951
|
+
this.resolve = resolve;
|
|
2952
|
+
this.reject = reject;
|
|
2949
2953
|
});
|
|
2950
2954
|
}
|
|
2951
2955
|
};
|
|
2952
|
-
function
|
|
2953
|
-
let
|
|
2954
|
-
|
|
2955
|
-
if (
|
|
2956
|
+
function inTargetElement(element, targetElement) {
|
|
2957
|
+
let currentElement = element;
|
|
2958
|
+
while (currentElement) {
|
|
2959
|
+
if (currentElement === targetElement) {
|
|
2956
2960
|
return true;
|
|
2957
|
-
|
|
2961
|
+
}
|
|
2962
|
+
if (!currentElement.parentNode) {
|
|
2958
2963
|
return false;
|
|
2959
|
-
|
|
2964
|
+
}
|
|
2965
|
+
if (currentElement.parentNode instanceof ShadowRoot) {
|
|
2966
|
+
currentElement = currentElement.parentNode.host;
|
|
2967
|
+
} else {
|
|
2968
|
+
currentElement = currentElement.parentNode;
|
|
2969
|
+
}
|
|
2960
2970
|
}
|
|
2961
2971
|
return false;
|
|
2962
2972
|
}
|
|
2963
|
-
function
|
|
2964
|
-
|
|
2965
|
-
return
|
|
2966
|
-
|
|
2973
|
+
function observeAncestorsMutation(element, attributeFilter, callback) {
|
|
2974
|
+
const { subscribe } = observe(attributeFilter);
|
|
2975
|
+
return subscribe((mutations) => {
|
|
2976
|
+
const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
|
|
2977
|
+
if (matched)
|
|
2978
|
+
callback();
|
|
2967
2979
|
});
|
|
2968
2980
|
}
|
|
2969
|
-
var
|
|
2970
|
-
function
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2981
|
+
var observers = {};
|
|
2982
|
+
function observe(attributeFilter) {
|
|
2983
|
+
const attributes = attributeFilter.join(",");
|
|
2984
|
+
const previousObserver = observers[attributes];
|
|
2985
|
+
if (previousObserver !== void 0)
|
|
2986
|
+
return previousObserver;
|
|
2987
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2988
|
+
const mutationObserver = new MutationObserver((mutations) => subscribers.forEach((callback) => callback(mutations)));
|
|
2989
|
+
mutationObserver.observe(document.documentElement, {
|
|
2990
|
+
attributes: true,
|
|
2991
|
+
attributeFilter,
|
|
2992
|
+
subtree: true
|
|
2993
|
+
});
|
|
2994
|
+
const observer = {
|
|
2995
|
+
subscribe(callback) {
|
|
2996
|
+
subscribers.add(callback);
|
|
2997
|
+
return {
|
|
2998
|
+
remove: () => {
|
|
2999
|
+
subscribers.delete(callback);
|
|
3000
|
+
if (subscribers.size === 0) {
|
|
3001
|
+
mutationObserver.disconnect();
|
|
3002
|
+
observers[attributes] = void 0;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
};
|
|
3008
|
+
observers[attributes] = observer;
|
|
3009
|
+
return observer;
|
|
2982
3010
|
}
|
|
2983
|
-
function
|
|
2984
|
-
let
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
if (
|
|
2988
|
-
return
|
|
2989
|
-
|
|
2990
|
-
|
|
3011
|
+
function closestElement(base, selector) {
|
|
3012
|
+
let currentElement = base;
|
|
3013
|
+
while (currentElement) {
|
|
3014
|
+
const element = currentElement.closest(selector);
|
|
3015
|
+
if (element) {
|
|
3016
|
+
return element;
|
|
3017
|
+
}
|
|
3018
|
+
const rootElement = currentElement.getRootNode();
|
|
3019
|
+
if (rootElement === document) {
|
|
2991
3020
|
return null;
|
|
2992
|
-
|
|
3021
|
+
}
|
|
3022
|
+
currentElement = rootElement.host;
|
|
2993
3023
|
}
|
|
2994
3024
|
return null;
|
|
2995
3025
|
}
|
|
2996
|
-
function
|
|
2997
|
-
|
|
3026
|
+
function getElementAttribute(el, prop, fallbackValue) {
|
|
3027
|
+
const closest = closestElement(el, `[${prop}]`);
|
|
3028
|
+
return closest?.getAttribute(prop) ?? fallbackValue;
|
|
2998
3029
|
}
|
|
2999
|
-
var A = (e) => e.charAt(0).toUpperCase() + e.slice(1);
|
|
3000
|
-
var T = (e) => A(e.replaceAll(/([a-z])([A-Z])/gu, "$1 $2"));
|
|
3001
|
-
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"]);
|
|
3002
|
-
var g = "en";
|
|
3003
|
-
async function j(e, t, n = "") {
|
|
3004
|
-
let r = `${t}/${n}`, o = `${r}${e}.json`;
|
|
3005
|
-
return u[o] ?? (u[o] = S(e, r)), await u[o];
|
|
3006
|
-
}
|
|
3007
|
-
var u = {};
|
|
3008
|
-
async function S(e, t) {
|
|
3009
|
-
let n = `${t}${e}.json`;
|
|
3010
|
-
try {
|
|
3011
|
-
let r = await fetch(n);
|
|
3012
|
-
if (r.ok)
|
|
3013
|
-
return await r.json();
|
|
3014
|
-
} catch (r) {
|
|
3015
|
-
return console.error(r), E;
|
|
3016
|
-
}
|
|
3017
|
-
return e === g ? E : await S(g, t);
|
|
3018
|
-
}
|
|
3019
|
-
var E = new Proxy({}, { get: (e, t) => T(t.toString()) });
|
|
3020
|
-
function M(e) {
|
|
3021
|
-
let t = m(e, "lang", navigator.language || g);
|
|
3022
|
-
if (v.has(t))
|
|
3023
|
-
return { lang: t, t9nLocale: t };
|
|
3024
|
-
let n = t.slice(0, 2);
|
|
3025
|
-
return { lang: t, t9nLocale: v.has(n) ? n : g };
|
|
3026
|
-
}
|
|
3027
|
-
function Y(e, t, n, r) {
|
|
3028
|
-
let o, i = () => void P(e, t, r).then((s) => {
|
|
3029
|
-
(o?.lang !== s.lang || o.t9nLocale !== s.t9nLocale || o.t9nStrings !== s.t9nStrings) && n(s), o = s;
|
|
3030
|
-
}).catch(console.error);
|
|
3031
|
-
return i(), b(e, ["lang"], i);
|
|
3032
|
-
}
|
|
3033
|
-
async function P(e, t, n = e.tagName.toLowerCase().replace("arcgis-", "")) {
|
|
3034
|
-
let { lang: r, t9nLocale: o } = M(e), i = `${t}/${n}/t9n`, s = `${n}.t9n.`, a = await j(o, i, s);
|
|
3035
|
-
return { lang: r, t9nLocale: o, t9nStrings: a };
|
|
3036
|
-
}
|
|
3037
|
-
|
|
3038
|
-
// src/types.ts
|
|
3039
|
-
var controllerSymbol = Symbol("controller");
|
|
3040
|
-
|
|
3041
|
-
// src/utils.ts
|
|
3042
3030
|
function safeCall(callback) {
|
|
3043
3031
|
try {
|
|
3044
3032
|
return callback?.();
|
|
@@ -3055,6 +3043,108 @@ async function safeAsyncCall(callback) {
|
|
|
3055
3043
|
}
|
|
3056
3044
|
return void 0;
|
|
3057
3045
|
}
|
|
3046
|
+
var capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
3047
|
+
var camelToHuman = (value) => capitalize(value.replaceAll(/([a-z])([A-Z])/gu, "$1 $2"));
|
|
3048
|
+
var supportedLocales = /* @__PURE__ */ new Set([
|
|
3049
|
+
"ar",
|
|
3050
|
+
"bg",
|
|
3051
|
+
"bs",
|
|
3052
|
+
"ca",
|
|
3053
|
+
"cs",
|
|
3054
|
+
"da",
|
|
3055
|
+
"de",
|
|
3056
|
+
"el",
|
|
3057
|
+
"en",
|
|
3058
|
+
"es",
|
|
3059
|
+
"et",
|
|
3060
|
+
"fi",
|
|
3061
|
+
"fr",
|
|
3062
|
+
"he",
|
|
3063
|
+
"hr",
|
|
3064
|
+
"hu",
|
|
3065
|
+
"id",
|
|
3066
|
+
"it",
|
|
3067
|
+
"ja",
|
|
3068
|
+
"ko",
|
|
3069
|
+
"lt",
|
|
3070
|
+
"lv",
|
|
3071
|
+
"nl",
|
|
3072
|
+
"nb",
|
|
3073
|
+
"pl",
|
|
3074
|
+
"pt-BR",
|
|
3075
|
+
"pt-PT",
|
|
3076
|
+
"ro",
|
|
3077
|
+
"ru",
|
|
3078
|
+
"sk",
|
|
3079
|
+
"sl",
|
|
3080
|
+
"sr",
|
|
3081
|
+
"sv",
|
|
3082
|
+
"th",
|
|
3083
|
+
"tr",
|
|
3084
|
+
"uk",
|
|
3085
|
+
"vi",
|
|
3086
|
+
"zh-CN",
|
|
3087
|
+
"zh-HK",
|
|
3088
|
+
"zh-TW"
|
|
3089
|
+
]);
|
|
3090
|
+
var defaultLocale = "en";
|
|
3091
|
+
async function fetchT9NStringsBundle(locale, assetsPath, prefix = "") {
|
|
3092
|
+
const path = `${assetsPath}/${prefix}`;
|
|
3093
|
+
const filePath = `${path}${locale}.json`;
|
|
3094
|
+
t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
|
|
3095
|
+
return await t9nStringsCache[filePath];
|
|
3096
|
+
}
|
|
3097
|
+
var t9nStringsCache = {};
|
|
3098
|
+
async function fetchBundle(locale, path) {
|
|
3099
|
+
const filePath = `${path}${locale}.json`;
|
|
3100
|
+
try {
|
|
3101
|
+
const response = await fetch(filePath);
|
|
3102
|
+
if (response.ok)
|
|
3103
|
+
return await response.json();
|
|
3104
|
+
} catch (error) {
|
|
3105
|
+
console.error(error);
|
|
3106
|
+
return fallbackBundle;
|
|
3107
|
+
}
|
|
3108
|
+
if (locale === defaultLocale)
|
|
3109
|
+
return fallbackBundle;
|
|
3110
|
+
return await fetchBundle(defaultLocale, path);
|
|
3111
|
+
}
|
|
3112
|
+
var fallbackBundle = new Proxy(
|
|
3113
|
+
{},
|
|
3114
|
+
{
|
|
3115
|
+
get: (_target, property) => camelToHuman(property.toString())
|
|
3116
|
+
}
|
|
3117
|
+
);
|
|
3118
|
+
function getElementLocales(element) {
|
|
3119
|
+
const lang = getElementAttribute(element, "lang", navigator.language || defaultLocale);
|
|
3120
|
+
if (supportedLocales.has(lang)) {
|
|
3121
|
+
return { lang, t9nLocale: lang };
|
|
3122
|
+
}
|
|
3123
|
+
const rootCode = lang.slice(0, 2);
|
|
3124
|
+
return { lang, t9nLocale: supportedLocales.has(rootCode) ? rootCode : defaultLocale };
|
|
3125
|
+
}
|
|
3126
|
+
function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
|
|
3127
|
+
let result = void 0;
|
|
3128
|
+
const callback = () => void updateComponentLocateState(element, assetsPath, assetName).then((newResult) => {
|
|
3129
|
+
if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings)
|
|
3130
|
+
onUpdated(newResult);
|
|
3131
|
+
result = newResult;
|
|
3132
|
+
}).catch(console.error);
|
|
3133
|
+
callback();
|
|
3134
|
+
return observeAncestorsMutation(element, ["lang"], callback);
|
|
3135
|
+
}
|
|
3136
|
+
async function updateComponentLocateState(element, assetsPath, assetName = element.tagName.toLowerCase().replace("arcgis-", "")) {
|
|
3137
|
+
const { lang, t9nLocale } = getElementLocales(element);
|
|
3138
|
+
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
3139
|
+
const prefix = `${assetName}.t9n.`;
|
|
3140
|
+
const t9nStrings = await fetchT9NStringsBundle(t9nLocale, t9nAssetsPath, prefix);
|
|
3141
|
+
return { lang, t9nLocale, t9nStrings };
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
// src/types.ts
|
|
3145
|
+
var controllerSymbol = Symbol("controller");
|
|
3146
|
+
|
|
3147
|
+
// src/utils.ts
|
|
3058
3148
|
function extendObject(base, extend) {
|
|
3059
3149
|
Object.entries(extend).forEach(([key, value]) => {
|
|
3060
3150
|
if (key in base)
|
|
@@ -3104,6 +3194,7 @@ var ControllerInternals = class {
|
|
|
3104
3194
|
return controller;
|
|
3105
3195
|
};
|
|
3106
3196
|
this.shouldBypassSetter = false;
|
|
3197
|
+
this.shouldBypassGetter = false;
|
|
3107
3198
|
this.shouldBypassReadonly = false;
|
|
3108
3199
|
/**
|
|
3109
3200
|
* A map from component instance or component element to component instance.
|
|
@@ -3113,7 +3204,7 @@ var ControllerInternals = class {
|
|
|
3113
3204
|
this.elementToInstance = /* @__PURE__ */ new WeakMap();
|
|
3114
3205
|
}
|
|
3115
3206
|
/*
|
|
3116
|
-
* Allow controllers to implicitly
|
|
3207
|
+
* Allow controllers to implicitly retrieve which component they are in, to
|
|
3117
3208
|
* improve DX (avoids the need to pass "this" explicitly for each controller)
|
|
3118
3209
|
*/
|
|
3119
3210
|
setAmbientComponent(component) {
|
|
@@ -3125,7 +3216,7 @@ var ControllerInternals = class {
|
|
|
3125
3216
|
this._ambientComponent = void 0;
|
|
3126
3217
|
});
|
|
3127
3218
|
}
|
|
3128
|
-
|
|
3219
|
+
retrieveComponent(name) {
|
|
3129
3220
|
if (this._ambientComponent === void 0)
|
|
3130
3221
|
throw new Error(
|
|
3131
3222
|
[
|
|
@@ -3158,7 +3249,7 @@ var ControllerInternals = class {
|
|
|
3158
3249
|
this._ambientControllers = [];
|
|
3159
3250
|
});
|
|
3160
3251
|
}
|
|
3161
|
-
|
|
3252
|
+
retrieveParentControllers() {
|
|
3162
3253
|
return this._ambientControllers;
|
|
3163
3254
|
}
|
|
3164
3255
|
/*
|
|
@@ -3174,7 +3265,7 @@ var ControllerInternals = class {
|
|
|
3174
3265
|
this._ambientChildController = void 0;
|
|
3175
3266
|
});
|
|
3176
3267
|
}
|
|
3177
|
-
|
|
3268
|
+
retrieveAmbientChildController() {
|
|
3178
3269
|
const controller = this._ambientChildController;
|
|
3179
3270
|
this._ambientChildController = void 0;
|
|
3180
3271
|
return controller;
|
|
@@ -3183,10 +3274,10 @@ var ControllerInternals = class {
|
|
|
3183
3274
|
* Try to resolve a controller, without awaiting it's load
|
|
3184
3275
|
*/
|
|
3185
3276
|
_useRefSync(value) {
|
|
3186
|
-
const ambientChildController = this.
|
|
3277
|
+
const ambientChildController = this.retrieveAmbientChildController();
|
|
3187
3278
|
if (ambientChildController !== void 0)
|
|
3188
3279
|
return ambientChildController;
|
|
3189
|
-
const component = Controller.internals.
|
|
3280
|
+
const component = Controller.internals.retrieveComponent();
|
|
3190
3281
|
const controller = component.manager.internals.resolveExports(value);
|
|
3191
3282
|
if (controller !== void 0)
|
|
3192
3283
|
return controller;
|
|
@@ -3208,7 +3299,7 @@ function retrieveComponentMeta(component) {
|
|
|
3208
3299
|
constructor.__registerControllers = void 0;
|
|
3209
3300
|
if (typeof meta !== "object")
|
|
3210
3301
|
throw new Error(
|
|
3211
|
-
"Failed to
|
|
3302
|
+
"Failed to retrieve internal component meta. Make sure you have the useComponentsControllers() Rollup Plugin for Stencil Controllers configured in your Stencil config."
|
|
3212
3303
|
);
|
|
3213
3304
|
component.manager.internals.meta = { members: meta[0], watchers: meta[1] };
|
|
3214
3305
|
}
|
|
@@ -3226,8 +3317,8 @@ function parsePropertyValue(value, type = 8 /* Any */) {
|
|
|
3226
3317
|
return value;
|
|
3227
3318
|
}
|
|
3228
3319
|
var makeMemberFilter = (filter) => (component) => {
|
|
3229
|
-
const
|
|
3230
|
-
return Object.entries(
|
|
3320
|
+
const members = component.manager.internals.meta?.members;
|
|
3321
|
+
return Object.entries(members ?? {}).filter(([_name, [propType]]) => (propType & filter) !== 0).map(([name]) => name);
|
|
3231
3322
|
};
|
|
3232
3323
|
var getPropLikeMembers = makeMemberFilter(63 /* PropLike */);
|
|
3233
3324
|
var getMemberType = (component, name) => component.manager.internals.meta.members?.[name]?.[0];
|
|
@@ -3255,7 +3346,7 @@ var watcherCallbackName = "dynamicWatcherCallback";
|
|
|
3255
3346
|
var _a;
|
|
3256
3347
|
var _Controller = class _Controller {
|
|
3257
3348
|
constructor(component) {
|
|
3258
|
-
this._ready = new
|
|
3349
|
+
this._ready = new Deferred();
|
|
3259
3350
|
this._lifecycleDisconnected = [];
|
|
3260
3351
|
this.connectedCalled = false;
|
|
3261
3352
|
this.willLoadCalled = false;
|
|
@@ -3270,7 +3361,7 @@ var _Controller = class _Controller {
|
|
|
3270
3361
|
this._exports = makeProvisionalValue(this);
|
|
3271
3362
|
this._exportWatchers = /* @__PURE__ */ new Set();
|
|
3272
3363
|
const resolvedComponent = toControllerHost(
|
|
3273
|
-
component ?? _Controller.internals.
|
|
3364
|
+
component ?? _Controller.internals.retrieveComponent(new.target.name)
|
|
3274
3365
|
);
|
|
3275
3366
|
Object.defineProperty(this, "component", {
|
|
3276
3367
|
writable: false,
|
|
@@ -3376,7 +3467,7 @@ var _Controller = class _Controller {
|
|
|
3376
3467
|
* Use cases:
|
|
3377
3468
|
* - You have a controller and you want to make sure it's loaded before you
|
|
3378
3469
|
* try to use it
|
|
3379
|
-
* - Your
|
|
3470
|
+
* - Your controller is not using exports, so you wish to access some props on
|
|
3380
3471
|
* it directly
|
|
3381
3472
|
* - You have a controller exports only, and you want to retrieve the
|
|
3382
3473
|
* controller itself. This is useful if you wish to call .watchExports() or
|
|
@@ -3392,7 +3483,7 @@ var _Controller = class _Controller {
|
|
|
3392
3483
|
* of this function
|
|
3393
3484
|
*
|
|
3394
3485
|
* @example
|
|
3395
|
-
* @Prop(
|
|
3486
|
+
* @Prop() readOnly = this.manager.readOnly(true);
|
|
3396
3487
|
*
|
|
3397
3488
|
* someAction(): void {
|
|
3398
3489
|
* this.manager.bypassSetter(()=>{
|
|
@@ -3417,6 +3508,30 @@ var _Controller = class _Controller {
|
|
|
3417
3508
|
_Controller.internals.shouldBypassReadonly = false;
|
|
3418
3509
|
return result;
|
|
3419
3510
|
}
|
|
3511
|
+
/**
|
|
3512
|
+
* Property reads inside of this function will bypass any custom getter you
|
|
3513
|
+
* may have, and read the value directly from what's stored in Stencil.
|
|
3514
|
+
*
|
|
3515
|
+
* This also bypasses reactiveUtils integration - reading a property inside of
|
|
3516
|
+
* bypassGetter won't make that property tracked.
|
|
3517
|
+
*
|
|
3518
|
+
* @example
|
|
3519
|
+
* reactiveUtils.watch(
|
|
3520
|
+
* ()=>{
|
|
3521
|
+
* this.manager.bypassGetter(()=>{
|
|
3522
|
+
* console.log(this.someProp);
|
|
3523
|
+
* });
|
|
3524
|
+
* return this.prop;
|
|
3525
|
+
* },
|
|
3526
|
+
* console.log
|
|
3527
|
+
* )
|
|
3528
|
+
*/
|
|
3529
|
+
bypassGetter(callback) {
|
|
3530
|
+
_Controller.internals.shouldBypassGetter = true;
|
|
3531
|
+
const result = safeCall(callback);
|
|
3532
|
+
_Controller.internals.shouldBypassGetter = false;
|
|
3533
|
+
return result;
|
|
3534
|
+
}
|
|
3420
3535
|
/**
|
|
3421
3536
|
* Like this.manager.getSet(), but can be called on any component's
|
|
3422
3537
|
* state/prop from anywhere, rather than just from the default value
|
|
@@ -3431,25 +3546,14 @@ var _Controller = class _Controller {
|
|
|
3431
3546
|
*/
|
|
3432
3547
|
genericGetSet(property, getSet) {
|
|
3433
3548
|
var _a2, _b;
|
|
3434
|
-
const classPrototype = Object.getPrototypeOf(this.component);
|
|
3435
|
-
this.internals.getSetProxy(classPrototype, property, getSet, "class");
|
|
3436
|
-
const htmlPrototype = Object.getPrototypeOf(this.component.el);
|
|
3437
|
-
if (classPrototype !== htmlPrototype)
|
|
3438
|
-
this.internals.getSetProxy(htmlPrototype, property, getSet, "html");
|
|
3439
3549
|
const genericGetSet = getSet;
|
|
3440
3550
|
if (genericGetSet.get !== void 0) {
|
|
3441
3551
|
(_a2 = this.internals.getters)[property] ?? (_a2[property] = []);
|
|
3442
|
-
|
|
3443
|
-
this.internals.getters[property].splice(-1, 0, genericGetSet.get);
|
|
3444
|
-
else
|
|
3445
|
-
this.internals.getters[property].unshift(genericGetSet.get);
|
|
3552
|
+
this.internals.getters[property].unshift(genericGetSet.get);
|
|
3446
3553
|
}
|
|
3447
3554
|
if (genericGetSet.set !== void 0) {
|
|
3448
3555
|
(_b = this.internals.setters)[property] ?? (_b[property] = []);
|
|
3449
|
-
|
|
3450
|
-
this.internals.setters[property].splice(-1, 0, genericGetSet.set);
|
|
3451
|
-
else
|
|
3452
|
-
this.internals.setters[property].unshift(genericGetSet.set);
|
|
3556
|
+
this.internals.setters[property].unshift(genericGetSet.set);
|
|
3453
3557
|
}
|
|
3454
3558
|
}
|
|
3455
3559
|
// FEATURE: improve typings
|
|
@@ -3602,9 +3706,9 @@ function makeProvisionalValue(base) {
|
|
|
3602
3706
|
console.error(`Trying to access "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
|
|
3603
3707
|
return void 0;
|
|
3604
3708
|
},
|
|
3605
|
-
set(target, prop, newValue,
|
|
3709
|
+
set(target, prop, newValue, receiver) {
|
|
3606
3710
|
console.error(`Trying to set "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
|
|
3607
|
-
return Reflect.set(target, prop, newValue,
|
|
3711
|
+
return Reflect.set(target, prop, newValue, receiver);
|
|
3608
3712
|
}
|
|
3609
3713
|
});
|
|
3610
3714
|
return proxy3;
|
|
@@ -3644,13 +3748,14 @@ function trackPropertyKey(object, onResolved, defaultValue) {
|
|
|
3644
3748
|
pendingTrackers.keyCount = keyCount;
|
|
3645
3749
|
}
|
|
3646
3750
|
pendingTrackers.callbacks.push((keys2) => {
|
|
3751
|
+
const callback = (key2) => safeCall(() => onResolved(key2));
|
|
3647
3752
|
const key = keys2[keyCount];
|
|
3648
3753
|
if (key === void 0)
|
|
3649
|
-
|
|
3754
|
+
callback(void 0);
|
|
3650
3755
|
else if (object[key] === defaultValue)
|
|
3651
|
-
|
|
3756
|
+
callback(key);
|
|
3652
3757
|
else
|
|
3653
|
-
|
|
3758
|
+
callback(void 0);
|
|
3654
3759
|
});
|
|
3655
3760
|
return defaultValue;
|
|
3656
3761
|
}
|
|
@@ -3710,7 +3815,7 @@ var ComponentInternals = class {
|
|
|
3710
3815
|
queueMicrotask(() => this._firePropertyTrackers(void 0, void 0, void 0));
|
|
3711
3816
|
this._trackedValue = defaultValue;
|
|
3712
3817
|
this._keyTrackers.push(
|
|
3713
|
-
(key, value, previousValue) => onResolved(defaultValue === value ? key : void 0, previousValue)
|
|
3818
|
+
(key, value, previousValue) => safeCall(() => onResolved(defaultValue === value ? key : void 0, previousValue))
|
|
3714
3819
|
);
|
|
3715
3820
|
return defaultValue;
|
|
3716
3821
|
};
|
|
@@ -3718,6 +3823,8 @@ var ComponentInternals = class {
|
|
|
3718
3823
|
this._keyTrackers = [];
|
|
3719
3824
|
this.getters = {};
|
|
3720
3825
|
this.setters = {};
|
|
3826
|
+
this.accessorGetter = {};
|
|
3827
|
+
this.accessorSetter = {};
|
|
3721
3828
|
this._exports = /* @__PURE__ */ new WeakMap();
|
|
3722
3829
|
Object.defineProperty(this, "component", {
|
|
3723
3830
|
writable: false,
|
|
@@ -3733,15 +3840,22 @@ var ComponentInternals = class {
|
|
|
3733
3840
|
trackers.forEach((tracker) => tracker(key, value, oldValue));
|
|
3734
3841
|
}
|
|
3735
3842
|
/**
|
|
3736
|
-
* Configure a getter or setter for a given
|
|
3737
|
-
*
|
|
3738
|
-
*
|
|
3739
|
-
*
|
|
3843
|
+
* Configure a getter or setter for a given \@Prop/\@State
|
|
3844
|
+
*
|
|
3845
|
+
* Note, since props are defined on the prototype, they are shared between all
|
|
3846
|
+
* instances of a component. Thus, instead of passing a reference to the
|
|
3847
|
+
* getter/setter function, you should update the
|
|
3848
|
+
* ComponentInternals.getters/setters properties, and then call getSetProxy
|
|
3849
|
+
* to apply the changes to the prototype
|
|
3740
3850
|
*/
|
|
3741
|
-
getSetProxy(
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3851
|
+
getSetProxy(property, hasGetter, hasSetter) {
|
|
3852
|
+
const classPrototype = Object.getPrototypeOf(this.component);
|
|
3853
|
+
this._getSetProxy(classPrototype, property, hasGetter, hasSetter, "class");
|
|
3854
|
+
const htmlPrototype = Object.getPrototypeOf(this.component.el);
|
|
3855
|
+
if (classPrototype !== htmlPrototype)
|
|
3856
|
+
this._getSetProxy(htmlPrototype, property, hasGetter, hasSetter, "html");
|
|
3857
|
+
}
|
|
3858
|
+
_getSetProxy(prototype, name, hasGetter, hasSetter, type) {
|
|
3745
3859
|
const component = this.component;
|
|
3746
3860
|
const propType = getMemberType(component, name);
|
|
3747
3861
|
const descriptor = Object.getOwnPropertyDescriptor(prototype, name);
|
|
@@ -3758,36 +3872,37 @@ var ComponentInternals = class {
|
|
|
3758
3872
|
const { get: originalGet, set: originalSet } = descriptor;
|
|
3759
3873
|
const isGetterAlreadyOverwritten = customAccessor in originalGet;
|
|
3760
3874
|
const isSetterAlreadyOverwritten = customAccessor in originalSet;
|
|
3761
|
-
const shouldOverwriteGet = !isGetterAlreadyOverwritten &&
|
|
3762
|
-
const shouldOverwriteSet = !isSetterAlreadyOverwritten &&
|
|
3875
|
+
const shouldOverwriteGet = !isGetterAlreadyOverwritten && hasGetter;
|
|
3876
|
+
const shouldOverwriteSet = !isSetterAlreadyOverwritten && hasSetter;
|
|
3763
3877
|
if (!shouldOverwriteGet && !shouldOverwriteSet)
|
|
3764
3878
|
return;
|
|
3765
3879
|
const finalGetter = shouldOverwriteGet ? function getter() {
|
|
3766
3880
|
let value = originalGet.call(this);
|
|
3881
|
+
if (Controller.internals.shouldBypassGetter)
|
|
3882
|
+
return value;
|
|
3767
3883
|
const component2 = Controller.internals.elementToInstance.get(this);
|
|
3768
|
-
const
|
|
3884
|
+
const internals = component2.manager.internals;
|
|
3885
|
+
value = internals.accessorGetter[name](value, name);
|
|
3886
|
+
const getters = internals.getters[name] ?? emptyArray;
|
|
3769
3887
|
for (let i = 0; i < getters.length; i++)
|
|
3770
3888
|
value = getters[i](value, name);
|
|
3771
3889
|
return value;
|
|
3772
3890
|
} : originalGet;
|
|
3773
3891
|
const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
|
|
3774
|
-
if (Controller.internals.shouldBypassSetter) {
|
|
3775
|
-
originalSet.call(this, rawNewValue);
|
|
3776
|
-
return;
|
|
3777
|
-
}
|
|
3778
3892
|
const oldValue = originalGet.call(this);
|
|
3779
3893
|
let newValue = parsePropertyValue(rawNewValue, propType);
|
|
3780
3894
|
const component2 = Controller.internals.elementToInstance.get(this);
|
|
3781
|
-
const internals = component2
|
|
3895
|
+
const internals = component2.manager.internals;
|
|
3782
3896
|
if (newValue === oldValue)
|
|
3783
3897
|
originalSet.call(this, rawNewValue);
|
|
3784
3898
|
else {
|
|
3785
|
-
const setters = internals
|
|
3899
|
+
const setters = Controller.internals.shouldBypassSetter ? emptyArray : internals.setters[name] ?? emptyArray;
|
|
3786
3900
|
for (let i = 0; i < setters.length; i++)
|
|
3787
3901
|
newValue = setters[i](newValue, oldValue, name);
|
|
3902
|
+
newValue = internals.accessorSetter[name](newValue, oldValue, name);
|
|
3788
3903
|
originalSet.call(this, newValue);
|
|
3789
3904
|
}
|
|
3790
|
-
if (
|
|
3905
|
+
if (internals._keyTrackers.length > 0)
|
|
3791
3906
|
internals?._firePropertyTrackers(name, rawNewValue, oldValue);
|
|
3792
3907
|
} : originalSet;
|
|
3793
3908
|
if (shouldOverwriteGet)
|
|
@@ -3815,59 +3930,42 @@ var ComponentInternals = class {
|
|
|
3815
3930
|
return void 0;
|
|
3816
3931
|
}
|
|
3817
3932
|
};
|
|
3933
|
+
var emptyArray = [];
|
|
3818
3934
|
var customAccessor = Symbol("controllersCustomAccessor");
|
|
3819
3935
|
var nothing = Symbol("nothing");
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
}
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
return await window.$arcgis.import("esri/core/accessorSupport/decorators");
|
|
3836
|
-
}
|
|
3837
|
-
const module = await Promise.resolve().then(function () { return require('./decorators-5KFQ5FDO-45eeb3a7.js'); });
|
|
3838
|
-
return isDefaultModule(module) ? module.default : module;
|
|
3839
|
-
}
|
|
3840
|
-
|
|
3841
|
-
// src/accessorIntegration.ts
|
|
3842
|
-
var accessorPromise = Promise.all([importCoreAccessor(), importCoreAccessorSupportDecorators()]);
|
|
3843
|
-
async function accessorIntegration(component) {
|
|
3844
|
-
let accessor = void 0;
|
|
3845
|
-
const getSet = {
|
|
3846
|
-
get: (value, propertyName) => {
|
|
3847
|
-
const accessorValue = accessor?.[propertyName];
|
|
3848
|
-
return value ?? accessorValue ?? value;
|
|
3849
|
-
},
|
|
3850
|
-
set: (newValue, oldValue, propertyName) => {
|
|
3936
|
+
var accessorPromise = Promise.all([arcadeDefaults.importCoreAccessor(), arcadeDefaults.importCoreAccessorSupportDecorators()]);
|
|
3937
|
+
function reactiveUtilsIntegration(component) {
|
|
3938
|
+
const members = getPropLikeMembers(component);
|
|
3939
|
+
const internals = component.manager.internals;
|
|
3940
|
+
members.forEach((name) => {
|
|
3941
|
+
internals.accessorGetter[name] = defaultGetterSetter;
|
|
3942
|
+
internals.accessorSetter[name] = defaultGetterSetter;
|
|
3943
|
+
internals.getSetProxy(name, true, true);
|
|
3944
|
+
});
|
|
3945
|
+
return async (enabledMembers = members) => {
|
|
3946
|
+
const [Accessor, { subclass, property }] = await accessorPromise;
|
|
3947
|
+
class AccessorSubclass extends Accessor {
|
|
3948
|
+
}
|
|
3949
|
+
const getter = (_value, propertyName) => accessor[propertyName];
|
|
3950
|
+
function setter(newValue, _oldValue, propertyName) {
|
|
3851
3951
|
if (accessor !== void 0)
|
|
3852
3952
|
accessor[propertyName] = newValue;
|
|
3853
3953
|
return newValue;
|
|
3854
3954
|
}
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
(name) => property({
|
|
3864
|
-
value: component[name]
|
|
3865
|
-
})(AccessorSubclass.prototype, name)
|
|
3955
|
+
component.manager.bypassGetter(
|
|
3956
|
+
() => enabledMembers.forEach((name) => {
|
|
3957
|
+
internals.accessorGetter[name] = getter;
|
|
3958
|
+
internals.accessorSetter[name] = setter;
|
|
3959
|
+
property({
|
|
3960
|
+
value: component[name]
|
|
3961
|
+
})(AccessorSubclass.prototype, name);
|
|
3962
|
+
})
|
|
3866
3963
|
);
|
|
3867
3964
|
const Subclass = subclass(component.el.tagName)(AccessorSubclass);
|
|
3868
|
-
accessor = new Subclass();
|
|
3965
|
+
const accessor = new Subclass();
|
|
3869
3966
|
};
|
|
3870
3967
|
}
|
|
3968
|
+
var defaultGetterSetter = (value) => value;
|
|
3871
3969
|
|
|
3872
3970
|
// src/ControllerManager.ts
|
|
3873
3971
|
var useControllerManager = (component) => new ControllerManager(component);
|
|
@@ -3889,12 +3987,12 @@ var ControllerManager = class extends GenericController {
|
|
|
3889
3987
|
};
|
|
3890
3988
|
extendObject(component, controllerHost);
|
|
3891
3989
|
super(component);
|
|
3892
|
-
this._connected = new
|
|
3990
|
+
this._connected = new Deferred();
|
|
3893
3991
|
this.internals = new ComponentInternals(this.component);
|
|
3894
3992
|
this.connected = this._connected.promise;
|
|
3895
3993
|
this.hasDestroy = false;
|
|
3896
3994
|
this.destroyed = false;
|
|
3897
|
-
this._updatePromise = new
|
|
3995
|
+
this._updatePromise = new Deferred();
|
|
3898
3996
|
this._originalLifecycles = {};
|
|
3899
3997
|
/**
|
|
3900
3998
|
* A magical solution to finding out what property name a given controller
|
|
@@ -3939,6 +4037,26 @@ var ControllerManager = class extends GenericController {
|
|
|
3939
4037
|
* \@Prop() decorator or not
|
|
3940
4038
|
*/
|
|
3941
4039
|
this.trackKey = this.internals.trackKey;
|
|
4040
|
+
this._readonlySetter = (newValue, _oldValue, property) => {
|
|
4041
|
+
if (Controller.internals.shouldBypassReadonly)
|
|
4042
|
+
return newValue;
|
|
4043
|
+
const isProp = getPropType(this.component, property) === "prop";
|
|
4044
|
+
if (isProp)
|
|
4045
|
+
index.forceUpdate(this.component);
|
|
4046
|
+
throw new Error(
|
|
4047
|
+
`Cannot assign to read-only property "${property}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(
|
|
4048
|
+
newValue
|
|
4049
|
+
)}"`
|
|
4050
|
+
);
|
|
4051
|
+
};
|
|
4052
|
+
/**
|
|
4053
|
+
* In development, on hot module reload, controller would be re-initialized
|
|
4054
|
+
* with all Props and State values persistent, but properties lost. This unsafe
|
|
4055
|
+
* development-only API lets you set or get data for a controller that would
|
|
4056
|
+
* persist across hot reloads.
|
|
4057
|
+
*/
|
|
4058
|
+
this.devOnlySetPersistentControllerData = void 0 ;
|
|
4059
|
+
this.devOnlyGetPersistentControllerData = void 0 ;
|
|
3942
4060
|
this.component.manager = this;
|
|
3943
4061
|
retrieveComponentMeta(component);
|
|
3944
4062
|
this._controllers = controllers;
|
|
@@ -3951,8 +4069,7 @@ var ControllerManager = class extends GenericController {
|
|
|
3951
4069
|
Object.defineProperty(component, "updateComplete", {
|
|
3952
4070
|
get: async () => await this._updatePromise.promise
|
|
3953
4071
|
});
|
|
3954
|
-
this.
|
|
3955
|
-
this._accessorIntegrationReady = accessorIntegration(this.component);
|
|
4072
|
+
this.internals.reactiveUtilsIntegration = reactiveUtilsIntegration(this.component);
|
|
3956
4073
|
Controller.internals.setParentController(void 0);
|
|
3957
4074
|
Controller.internals.setAmbientComponent(component);
|
|
3958
4075
|
Controller.internals.elementToInstance.set(component.el, component);
|
|
@@ -4021,8 +4138,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4021
4138
|
this._preserveOnDisconnectWatcher();
|
|
4022
4139
|
}
|
|
4023
4140
|
async _componentWillLoad() {
|
|
4024
|
-
|
|
4025
|
-
enableIntegration();
|
|
4141
|
+
await this.internals.reactiveUtilsIntegration();
|
|
4026
4142
|
await Promise.allSettled(
|
|
4027
4143
|
Array.from(
|
|
4028
4144
|
this._controllers,
|
|
@@ -4067,7 +4183,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4067
4183
|
);
|
|
4068
4184
|
this._originalLifecycles.componentDidUpdate?.call(this.component);
|
|
4069
4185
|
const updatePromise = this._updatePromise;
|
|
4070
|
-
this._updatePromise = new
|
|
4186
|
+
this._updatePromise = new Deferred();
|
|
4071
4187
|
updatePromise.resolve(true);
|
|
4072
4188
|
}
|
|
4073
4189
|
async destroy() {
|
|
@@ -4108,18 +4224,6 @@ var ControllerManager = class extends GenericController {
|
|
|
4108
4224
|
readonly(value) {
|
|
4109
4225
|
return this.getSet(value, { set: this._readonlySetter });
|
|
4110
4226
|
}
|
|
4111
|
-
_readonlySetter(newValue, _oldValue, property) {
|
|
4112
|
-
if (Controller.internals.shouldBypassReadonly)
|
|
4113
|
-
return newValue;
|
|
4114
|
-
const isProp = getPropType(this.component, property) === "prop";
|
|
4115
|
-
if (isProp)
|
|
4116
|
-
index.forceUpdate(this.component);
|
|
4117
|
-
throw new Error(
|
|
4118
|
-
`Cannot assign to read-only property "${property}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(
|
|
4119
|
-
newValue
|
|
4120
|
-
)}"`
|
|
4121
|
-
);
|
|
4122
|
-
}
|
|
4123
4227
|
/**
|
|
4124
4228
|
* Listen for any component's @State()/@Prop() change, and mutate it's
|
|
4125
4229
|
* value before it is set.
|
|
@@ -4175,7 +4279,7 @@ ${// Don't expose internal code in production, and keep bundle smaller:
|
|
|
4175
4279
|
|
|
4176
4280
|
// src/proxyExports.ts
|
|
4177
4281
|
var proxyExports = (Class) => (...args) => {
|
|
4178
|
-
const ambientControllers = Controller.internals.
|
|
4282
|
+
const ambientControllers = Controller.internals.retrieveParentControllers();
|
|
4179
4283
|
const instance = new Class(...args);
|
|
4180
4284
|
const initialExports = instance.exports;
|
|
4181
4285
|
Controller.internals.setParentController(ambientControllers.at(-1));
|
|
@@ -4254,20 +4358,21 @@ function useT9n({
|
|
|
4254
4358
|
} = {}) {
|
|
4255
4359
|
return makeController((component, controller) => {
|
|
4256
4360
|
controller.onLifecycle(
|
|
4257
|
-
() =>
|
|
4361
|
+
() => startLocaleObserver(
|
|
4258
4362
|
component.el,
|
|
4259
4363
|
index.getAssetPath("./assets"),
|
|
4260
4364
|
({ t9nLocale, t9nStrings, lang }) => {
|
|
4261
4365
|
controller.exports = { ...t9nStrings, _lang: lang, _t9nLocale: t9nLocale };
|
|
4262
|
-
|
|
4263
|
-
|
|
4366
|
+
const label = t9nStrings.componentLabel ?? t9nStrings.widgetLabel;
|
|
4367
|
+
if (typeof label === "string" && "label" in component && component.label == null)
|
|
4368
|
+
component.label ?? (component.label = label);
|
|
4264
4369
|
},
|
|
4265
4370
|
name
|
|
4266
4371
|
)
|
|
4267
4372
|
);
|
|
4268
4373
|
if (blocking)
|
|
4269
4374
|
return controller.ready;
|
|
4270
|
-
const locale =
|
|
4375
|
+
const locale = getElementLocales(component.el);
|
|
4271
4376
|
return { _lang: locale.lang, _t9nLocale: locale.t9nLocale };
|
|
4272
4377
|
});
|
|
4273
4378
|
}
|
|
@@ -4312,18 +4417,18 @@ function setupMonacoEnvironment(assetsPath) {
|
|
|
4312
4417
|
break;
|
|
4313
4418
|
}
|
|
4314
4419
|
// If we have a relative path or we are on same orgin, we can use the default js implementation
|
|
4315
|
-
if (!arcadeDefaults.
|
|
4420
|
+
if (!arcadeDefaults.isURL(url) || arcadeDefaults.hasSameOrigin(url, globalThis.location.href, true)) {
|
|
4316
4421
|
return new Worker(url, { name: languageId });
|
|
4317
4422
|
}
|
|
4318
4423
|
// For cross orgin, we will load the worker code as a string and manufacture a blob
|
|
4319
4424
|
const esriRequest = await arcadeDefaults.importRequest();
|
|
4320
4425
|
const response = await esriRequest(url, {
|
|
4321
|
-
responseType: "text"
|
|
4426
|
+
responseType: "text",
|
|
4322
4427
|
});
|
|
4323
4428
|
return new Worker(URL.createObjectURL(new Blob([response.data], {
|
|
4324
|
-
type: "text/javascript"
|
|
4429
|
+
type: "text/javascript",
|
|
4325
4430
|
})));
|
|
4326
|
-
}
|
|
4431
|
+
},
|
|
4327
4432
|
};
|
|
4328
4433
|
}
|
|
4329
4434
|
|
|
@@ -4362,9 +4467,9 @@ function setupArcadeTheme() {
|
|
|
4362
4467
|
{ token: "keyword.arc", foreground: colors.keyword },
|
|
4363
4468
|
{ token: "identifier.arc", foreground: colors.identifier },
|
|
4364
4469
|
{ token: "number.arc", foreground: colors.number },
|
|
4365
|
-
{ token: "string.arc", foreground: colors.string }
|
|
4470
|
+
{ token: "string.arc", foreground: colors.string },
|
|
4366
4471
|
],
|
|
4367
|
-
colors: {}
|
|
4472
|
+
colors: {},
|
|
4368
4473
|
});
|
|
4369
4474
|
});
|
|
4370
4475
|
}
|
|
@@ -4419,14 +4524,14 @@ async function getArcadeWorker(uri) {
|
|
|
4419
4524
|
* @returns arcade mode module
|
|
4420
4525
|
*/
|
|
4421
4526
|
async function getMode() {
|
|
4422
|
-
return await Promise.resolve().then(function () { return require('./arcade-mode-
|
|
4527
|
+
return await Promise.resolve().then(function () { return require('./arcade-mode-c53bfc0e.js'); });
|
|
4423
4528
|
}
|
|
4424
4529
|
// Register the language in Monaco
|
|
4425
4530
|
arcadeDefaults.languages.register({
|
|
4426
4531
|
id: arcadeDefaults.arcadeDefaults.languageId,
|
|
4427
4532
|
aliases: ["Arcade", "arcade"],
|
|
4428
4533
|
extensions: [".arc"],
|
|
4429
|
-
mimetypes: ["application/arcade"]
|
|
4534
|
+
mimetypes: ["application/arcade"],
|
|
4430
4535
|
});
|
|
4431
4536
|
// An event emitted when a language is first time needed
|
|
4432
4537
|
arcadeDefaults.languages.onLanguage(arcadeDefaults.arcadeDefaults.languageId, () => {
|
|
@@ -4556,7 +4661,7 @@ const ArcgisArcadeApi = class {
|
|
|
4556
4661
|
// When switching between flow the same reference is reused
|
|
4557
4662
|
this._flowObserver = new MutationObserver(() => {
|
|
4558
4663
|
// Get the last panel and try to set focus on the input element
|
|
4559
|
-
arcadeDefaults.
|
|
4664
|
+
arcadeDefaults.setFocusOnElement(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
4560
4665
|
});
|
|
4561
4666
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
4562
4667
|
}
|
|
@@ -4567,14 +4672,14 @@ const ArcgisArcadeApi = class {
|
|
|
4567
4672
|
if (!filteredApiItems.length) {
|
|
4568
4673
|
return null;
|
|
4569
4674
|
}
|
|
4570
|
-
return (index.h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (index.h("calcite-list-item", { label: arcadeDefaults.
|
|
4675
|
+
return (index.h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (index.h("calcite-list-item", { label: arcadeDefaults.addLTRMark(apiItem.completion.detail), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": apiItem }, index.h("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "Expand", icon: "chevron-right", iconFlipRtl: true, scale: "s", onClick: this._selectItem, "data-item": apiItem }))))));
|
|
4571
4676
|
}
|
|
4572
4677
|
renderApiItemFlowItem() {
|
|
4573
4678
|
const apiItem = this._selectedApiItem;
|
|
4574
4679
|
if (!apiItem) {
|
|
4575
4680
|
return null;
|
|
4576
4681
|
}
|
|
4577
|
-
return (index.h("calcite-flow-item", { heading: this.messages.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (index.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)), index.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"), index.h("calcite-block", { open: true, heading: arcadeDefaults.
|
|
4682
|
+
return (index.h("calcite-flow-item", { heading: this.messages.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (index.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)), index.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"), index.h("calcite-block", { open: true, heading: arcadeDefaults.addLTRMark(apiItem.completion.detail) }, index.h("div", { innerHTML: convertMarkdownString(apiItem.completion.documentation) }), apiItem.examples ? (index.h("div", { ref: (e) => {
|
|
4578
4683
|
if (!e) {
|
|
4579
4684
|
return;
|
|
4580
4685
|
}
|
|
@@ -4775,7 +4880,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
4775
4880
|
// Setup an executor with the script
|
|
4776
4881
|
const arcade = await arcadeDefaults.importArcade();
|
|
4777
4882
|
const executor = await arcade.createArcadeExecutor(script ?? "", {
|
|
4778
|
-
variables: editorProfile?.variables ?? []
|
|
4883
|
+
variables: editorProfile?.variables ?? [],
|
|
4779
4884
|
});
|
|
4780
4885
|
// We want to measure the execution time
|
|
4781
4886
|
const t1 = performance.now();
|
|
@@ -4785,7 +4890,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
4785
4890
|
spatialReference,
|
|
4786
4891
|
timeZone,
|
|
4787
4892
|
rawOutput: true,
|
|
4788
|
-
console
|
|
4893
|
+
console,
|
|
4789
4894
|
};
|
|
4790
4895
|
// Execute the script
|
|
4791
4896
|
const scriptOutput = await executor.executeAsync(profileVariableInstances, executeContext);
|
|
@@ -4809,7 +4914,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
4809
4914
|
error,
|
|
4810
4915
|
timeStamp,
|
|
4811
4916
|
compilationTime: 0,
|
|
4812
|
-
executionTime: 0
|
|
4917
|
+
executionTime: 0,
|
|
4813
4918
|
};
|
|
4814
4919
|
}
|
|
4815
4920
|
}
|
|
@@ -4822,8 +4927,8 @@ const ArcgisArcadeEditor = class {
|
|
|
4822
4927
|
this.scriptChange = index.createEvent(this, "scriptChange", 3);
|
|
4823
4928
|
this.diagnosticsChange = index.createEvent(this, "diagnosticsChange", 3);
|
|
4824
4929
|
this.manager = useControllerManager(this);
|
|
4825
|
-
this._componentReadyDefer = new arcadeDefaults.
|
|
4826
|
-
this._modelId = arcadeDefaults.
|
|
4930
|
+
this._componentReadyDefer = new arcadeDefaults.Deferred();
|
|
4931
|
+
this._modelId = arcadeDefaults.generateGuid();
|
|
4827
4932
|
this._editorProfilePromise = Promise.resolve(undefined);
|
|
4828
4933
|
this._disposables = [];
|
|
4829
4934
|
this._executeScript = async () => {
|
|
@@ -4903,7 +5008,7 @@ const ArcgisArcadeEditor = class {
|
|
|
4903
5008
|
}
|
|
4904
5009
|
_snippetChanged() {
|
|
4905
5010
|
arcadeDefaults.arcadeDefaults.updateApiContextForModel(this._modelId, {
|
|
4906
|
-
snippets: this.snippets
|
|
5011
|
+
snippets: this.snippets,
|
|
4907
5012
|
});
|
|
4908
5013
|
}
|
|
4909
5014
|
// #endregion
|
|
@@ -4952,7 +5057,7 @@ const ArcgisArcadeEditor = class {
|
|
|
4952
5057
|
* @internal
|
|
4953
5058
|
*/
|
|
4954
5059
|
async updateThemeColors(colorRules) {
|
|
4955
|
-
const theme = arcadeDefaults.
|
|
5060
|
+
const theme = arcadeDefaults.getElementTheme(this.el);
|
|
4956
5061
|
updateThemeColors(theme, colorRules);
|
|
4957
5062
|
if (colorRules === undefined) {
|
|
4958
5063
|
colorRulesKeys.forEach((key) => {
|
|
@@ -5002,7 +5107,7 @@ const ArcgisArcadeEditor = class {
|
|
|
5002
5107
|
if (this.testData) {
|
|
5003
5108
|
this._executeScript().catch(console.error);
|
|
5004
5109
|
}
|
|
5005
|
-
}
|
|
5110
|
+
},
|
|
5006
5111
|
});
|
|
5007
5112
|
await this._codeEditorElt?.setFocus();
|
|
5008
5113
|
}
|
|
@@ -5024,7 +5129,7 @@ const ArcgisArcadeEditor = class {
|
|
|
5024
5129
|
// Set a new profile for the model using the profile definition and the locale.
|
|
5025
5130
|
await arcadeDefaults.arcadeDefaults.setProfileForModel(this._modelId, this.profile, {
|
|
5026
5131
|
locale: this.messages._t9nLocale,
|
|
5027
|
-
snippets: this.snippets
|
|
5132
|
+
snippets: this.snippets,
|
|
5028
5133
|
});
|
|
5029
5134
|
// Get the corresponding editor profile for the model.
|
|
5030
5135
|
// The editor profile contains the specialized profile for the UI.
|
|
@@ -5053,7 +5158,7 @@ const ArcgisArcadeEditor = class {
|
|
|
5053
5158
|
}
|
|
5054
5159
|
//#endregion
|
|
5055
5160
|
//#region Rendering the Action Bar
|
|
5056
|
-
renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel }) {
|
|
5161
|
+
renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel, }) {
|
|
5057
5162
|
return (index.h(index.Fragment, null, index.h("calcite-action", { id: id, text: label, icon: icon, active: active, onClick: onClick, "data-panel-name": panelName }), !this.sideActionBarExpanded && (index.h("calcite-tooltip", { label: label, "reference-element": id }, index.h("span", null, label)))));
|
|
5058
5163
|
}
|
|
5059
5164
|
renderSideActionBar() {
|
|
@@ -5065,20 +5170,20 @@ const ArcgisArcadeEditor = class {
|
|
|
5065
5170
|
label: this.messages.profilevariables ?? "Profile variables",
|
|
5066
5171
|
icon: "profile-variables",
|
|
5067
5172
|
active: this.openedSidePanel === "variables",
|
|
5068
|
-
panelName: "variables"
|
|
5173
|
+
panelName: "variables",
|
|
5069
5174
|
}), this.renderAction({
|
|
5070
5175
|
id: "function-action",
|
|
5071
5176
|
label: this.messages.constantsandfunctions ?? "Constants and functions",
|
|
5072
5177
|
icon: "function",
|
|
5073
5178
|
active: this.openedSidePanel === "api",
|
|
5074
|
-
panelName: "api"
|
|
5179
|
+
panelName: "api",
|
|
5075
5180
|
}), this.suggestions?.length
|
|
5076
5181
|
? this.renderAction({
|
|
5077
5182
|
id: "suggestions-action",
|
|
5078
5183
|
label: this.messages.suggestions ?? "Suggestions",
|
|
5079
5184
|
icon: "lightbulb",
|
|
5080
5185
|
active: this.openedSidePanel === "suggestions",
|
|
5081
|
-
panelName: "suggestions"
|
|
5186
|
+
panelName: "suggestions",
|
|
5082
5187
|
})
|
|
5083
5188
|
: null, this.hideDocumentationActions
|
|
5084
5189
|
? null
|
|
@@ -5088,7 +5193,7 @@ const ArcgisArcadeEditor = class {
|
|
|
5088
5193
|
icon: "question",
|
|
5089
5194
|
active: false,
|
|
5090
5195
|
panelName: "none",
|
|
5091
|
-
onClick: this._openArcadeHelp
|
|
5196
|
+
onClick: this._openArcadeHelp,
|
|
5092
5197
|
}))));
|
|
5093
5198
|
}
|
|
5094
5199
|
//#endregion
|
|
@@ -5138,13 +5243,13 @@ const treeProps = {
|
|
|
5138
5243
|
lines: true,
|
|
5139
5244
|
selectionMode: "none",
|
|
5140
5245
|
scale: "s",
|
|
5141
|
-
onCalciteTreeSelect: (e) => e.target.selectedItems.forEach((itemElt) => (itemElt.selected = false))
|
|
5246
|
+
onCalciteTreeSelect: (e) => e.target.selectedItems.forEach((itemElt) => (itemElt.selected = false)),
|
|
5142
5247
|
};
|
|
5143
5248
|
const expandableTreeItemProps = {
|
|
5144
5249
|
onClick: (e) => {
|
|
5145
5250
|
const item = e.currentTarget;
|
|
5146
5251
|
item.expanded = !item.expanded;
|
|
5147
|
-
}
|
|
5252
|
+
},
|
|
5148
5253
|
};
|
|
5149
5254
|
//#endregion
|
|
5150
5255
|
//#region Helper Functions
|
|
@@ -5163,7 +5268,7 @@ function renderSimpleValue(arcadeResult) {
|
|
|
5163
5268
|
case "null":
|
|
5164
5269
|
return index.h("span", { class: "constant-value" }, arcadeResult.type);
|
|
5165
5270
|
case "text":
|
|
5166
|
-
return index.h("span", { class: "string-value" }, arcadeDefaults.
|
|
5271
|
+
return index.h("span", { class: "string-value" }, arcadeDefaults.quoteString(arcadeResult.value));
|
|
5167
5272
|
case "number":
|
|
5168
5273
|
return index.h("span", { class: "number-value" }, arcadeResult.value.toString());
|
|
5169
5274
|
case "boolean":
|
|
@@ -5171,9 +5276,9 @@ function renderSimpleValue(arcadeResult) {
|
|
|
5171
5276
|
case "date":
|
|
5172
5277
|
return index.h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
|
|
5173
5278
|
case "dateOnly":
|
|
5174
|
-
return index.h("span", { class: "string-value" }, arcadeDefaults.
|
|
5279
|
+
return index.h("span", { class: "string-value" }, arcadeDefaults.quoteString(formatArcadeResultDateOnly(arcadeResult)));
|
|
5175
5280
|
case "time":
|
|
5176
|
-
return index.h("span", { class: "string-value" }, arcadeDefaults.
|
|
5281
|
+
return index.h("span", { class: "string-value" }, arcadeDefaults.quoteString(formatArcadeResultTimeOnly(arcadeResult)));
|
|
5177
5282
|
default:
|
|
5178
5283
|
return null;
|
|
5179
5284
|
}
|
|
@@ -5239,23 +5344,23 @@ const ArcgisArcadeResults = class {
|
|
|
5239
5344
|
return index.h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
|
|
5240
5345
|
}
|
|
5241
5346
|
const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
|
|
5242
|
-
return (index.h("calcite-list", null, this.result ? (index.h(index.Fragment, null, index.h("calcite-list-item", { label: arcadeDefaults.
|
|
5347
|
+
return (index.h("calcite-list", null, this.result ? (index.h(index.Fragment, null, index.h("calcite-list-item", { label: arcadeDefaults.setValuesInString(this.messages.lastexecutionformat, {
|
|
5243
5348
|
timeStamp: new Intl.DateTimeFormat(this.messages._t9nLocale, {
|
|
5244
5349
|
dateStyle: "medium",
|
|
5245
|
-
timeStyle: "medium"
|
|
5246
|
-
}).format(this.result.timeStamp)
|
|
5247
|
-
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.
|
|
5350
|
+
timeStyle: "medium",
|
|
5351
|
+
}).format(this.result.timeStamp),
|
|
5352
|
+
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.setValuesInString(this.messages.compilationtimeformat, {
|
|
5248
5353
|
time: new Intl.NumberFormat(this.messages._t9nLocale, {
|
|
5249
5354
|
style: "unit",
|
|
5250
5355
|
unit: "millisecond",
|
|
5251
|
-
maximumFractionDigits: 2
|
|
5252
|
-
}).format(this.result.compilationTime ?? 0)
|
|
5253
|
-
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.
|
|
5356
|
+
maximumFractionDigits: 2,
|
|
5357
|
+
}).format(this.result.compilationTime ?? 0),
|
|
5358
|
+
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.setValuesInString(this.messages.executiontimeformat, {
|
|
5254
5359
|
time: new Intl.NumberFormat(this.messages._t9nLocale, {
|
|
5255
5360
|
style: "unit",
|
|
5256
5361
|
unit: "millisecond",
|
|
5257
|
-
maximumFractionDigits: 2
|
|
5258
|
-
}).format(this.result.executionTime ?? 0)
|
|
5362
|
+
maximumFractionDigits: 2,
|
|
5363
|
+
}).format(this.result.executionTime ?? 0),
|
|
5259
5364
|
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (index.h("calcite-list-item", { label: this.messages.runscriptmessage ?? "No output, run the script once." }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
|
|
5260
5365
|
}
|
|
5261
5366
|
renderOutputPanel() {
|
|
@@ -5267,8 +5372,8 @@ const ArcgisArcadeResults = class {
|
|
|
5267
5372
|
}
|
|
5268
5373
|
switch (this.result?.type) {
|
|
5269
5374
|
case "error":
|
|
5270
|
-
return (index.h("div", { class: "result-value-simple flex-adjustable" }, arcadeDefaults.
|
|
5271
|
-
message: this.result.value
|
|
5375
|
+
return (index.h("div", { class: "result-value-simple flex-adjustable" }, arcadeDefaults.setValuesInString(this.messages.executionerrorformat, {
|
|
5376
|
+
message: this.result.value,
|
|
5272
5377
|
})));
|
|
5273
5378
|
case "null":
|
|
5274
5379
|
case "unknown":
|
|
@@ -5304,8 +5409,8 @@ const ArcgisArcadeResults = class {
|
|
|
5304
5409
|
renderArrayHeader(arcadeResult) {
|
|
5305
5410
|
const items = arcadeResult.value ?? [];
|
|
5306
5411
|
const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
|
|
5307
|
-
return (index.h(index.Fragment, null, index.h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (index.h("span", null, "\u00A0", arcadeDefaults.
|
|
5308
|
-
count: MaxArrayItems.toString()
|
|
5412
|
+
return (index.h(index.Fragment, null, index.h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (index.h("span", null, "\u00A0", arcadeDefaults.setValuesInString(this.messages.showingfirstitemsformat, {
|
|
5413
|
+
count: MaxArrayItems.toString(),
|
|
5309
5414
|
}))) : null));
|
|
5310
5415
|
}
|
|
5311
5416
|
renderArrayTree(items, subtree = false) {
|
|
@@ -5350,8 +5455,8 @@ const ArcgisArcadeResults = class {
|
|
|
5350
5455
|
}
|
|
5351
5456
|
}
|
|
5352
5457
|
renderFeatureSetLabel(arcadeResult) {
|
|
5353
|
-
return (index.h("div", { class: "value-type" }, index.h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (index.h("span", null, "\u00A0", arcadeDefaults.
|
|
5354
|
-
count: BatchSize.toString()
|
|
5458
|
+
return (index.h("div", { class: "value-type" }, index.h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (index.h("span", null, "\u00A0", arcadeDefaults.setValuesInString(this.messages.showingfirstitemsformat, {
|
|
5459
|
+
count: BatchSize.toString(),
|
|
5355
5460
|
}))) : null));
|
|
5356
5461
|
}
|
|
5357
5462
|
render() {
|
|
@@ -5443,7 +5548,7 @@ const ArcgisArcadeSuggestions = class {
|
|
|
5443
5548
|
// When switching between flow the same reference is reused
|
|
5444
5549
|
this._flowObserver = new MutationObserver(() => {
|
|
5445
5550
|
// Get the last panel and try to set focus on the input element
|
|
5446
|
-
arcadeDefaults.
|
|
5551
|
+
arcadeDefaults.setFocusOnElement(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
5447
5552
|
});
|
|
5448
5553
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
5449
5554
|
}
|
|
@@ -5564,7 +5669,7 @@ const ArcgisArcadeVariables = class {
|
|
|
5564
5669
|
// When switching between flow the same reference is reused
|
|
5565
5670
|
this._flowObserver = new MutationObserver(() => {
|
|
5566
5671
|
// Get the last panel and try to set focus on the input element
|
|
5567
|
-
arcadeDefaults.
|
|
5672
|
+
arcadeDefaults.setFocusOnElement(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
5568
5673
|
});
|
|
5569
5674
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
5570
5675
|
}
|
|
@@ -5598,7 +5703,7 @@ const ArcgisArcadeVariables = class {
|
|
|
5598
5703
|
}
|
|
5599
5704
|
renderEditorVariables(collection) {
|
|
5600
5705
|
// Filter the variables. Skip group, we will filter the children later on.
|
|
5601
|
-
const filterExpression = arcadeDefaults.
|
|
5706
|
+
const filterExpression = arcadeDefaults.createFilterExpression(this._filterValue);
|
|
5602
5707
|
const filteredVariables = collection.variables.filter((variable) => variable.passFilter(filterExpression));
|
|
5603
5708
|
if (!filteredVariables.length) {
|
|
5604
5709
|
return index.h("div", { class: "notice-container" }, this.messages.noitems ?? "No item");
|
|
@@ -5640,20 +5745,20 @@ const EditorOptionsDefaults = {
|
|
|
5640
5745
|
renderLineHighlight: "none",
|
|
5641
5746
|
suggest: {
|
|
5642
5747
|
snippetsPreventQuickSuggestions: false,
|
|
5643
|
-
showWords: false
|
|
5748
|
+
showWords: false,
|
|
5644
5749
|
},
|
|
5645
5750
|
tabSize: 2,
|
|
5646
|
-
useShadowDOM: true
|
|
5751
|
+
useShadowDOM: true,
|
|
5647
5752
|
};
|
|
5648
5753
|
const ArcgisCodeEditor = class {
|
|
5649
5754
|
constructor(hostRef) {
|
|
5650
5755
|
index.registerInstance(this, hostRef);
|
|
5651
5756
|
this.valueChange = index.createEvent(this, "valueChange", 3);
|
|
5652
|
-
this._componentReadyDefer = new arcadeDefaults.
|
|
5757
|
+
this._componentReadyDefer = new arcadeDefaults.Deferred();
|
|
5653
5758
|
this._disposables = [];
|
|
5654
5759
|
this.value = undefined;
|
|
5655
5760
|
this.language = undefined;
|
|
5656
|
-
this.modelId = arcadeDefaults.
|
|
5761
|
+
this.modelId = arcadeDefaults.generateGuid();
|
|
5657
5762
|
this.options = undefined;
|
|
5658
5763
|
}
|
|
5659
5764
|
valuePropChange(newValue) {
|
|
@@ -5781,7 +5886,7 @@ const ArcgisCodeEditor = class {
|
|
|
5781
5886
|
...(this.options ?? {}),
|
|
5782
5887
|
model,
|
|
5783
5888
|
fixedOverflowWidgets: true,
|
|
5784
|
-
scrollBeyondLastLine: false
|
|
5889
|
+
scrollBeyondLastLine: false,
|
|
5785
5890
|
});
|
|
5786
5891
|
this._disposables.push(this._editorInstance);
|
|
5787
5892
|
// Set the value now to trigger a diagnostic again
|
|
@@ -5795,7 +5900,7 @@ const ArcgisCodeEditor = class {
|
|
|
5795
5900
|
this.valueChange.emit(script);
|
|
5796
5901
|
});
|
|
5797
5902
|
// Detect if the host element or its ancestors got a theme attribute mutation
|
|
5798
|
-
this._themeObserver = arcadeDefaults.
|
|
5903
|
+
this._themeObserver = arcadeDefaults.observeAncestorsMutation(this._hostElt, ["class"], () => this.updateTheme());
|
|
5799
5904
|
// Update the theme of the Monaco Editor
|
|
5800
5905
|
this.updateTheme();
|
|
5801
5906
|
// Creates a resize observer to re-layout the editor on size changing
|
|
@@ -5826,7 +5931,7 @@ const ArcgisCodeEditor = class {
|
|
|
5826
5931
|
// This is called the first time and subsequently by the Mutation Observer
|
|
5827
5932
|
// Figure out the theme by walking the ancestor path.
|
|
5828
5933
|
// If no theme is found then default to light.
|
|
5829
|
-
const theme = arcadeDefaults.
|
|
5934
|
+
const theme = arcadeDefaults.getElementTheme(this._hostElt) === "light" ? "vs" : "vs-dark";
|
|
5830
5935
|
if (theme === this._currentTheme) {
|
|
5831
5936
|
return;
|
|
5832
5937
|
}
|
|
@@ -5851,7 +5956,7 @@ const ArcgisCodeEditor = class {
|
|
|
5851
5956
|
contextMenuOrder: 1,
|
|
5852
5957
|
// Method that will be executed when the action is triggered.
|
|
5853
5958
|
// @param editor The editor instance is passed in as a convenience
|
|
5854
|
-
run: async () => await zoomInFn?.run()
|
|
5959
|
+
run: async () => await zoomInFn?.run(),
|
|
5855
5960
|
});
|
|
5856
5961
|
this._editorInstance?.addAction({
|
|
5857
5962
|
id: "editor.action.fontZoomOut",
|
|
@@ -5859,7 +5964,7 @@ const ArcgisCodeEditor = class {
|
|
|
5859
5964
|
keybindings: [arcadeDefaults.KeyMod.CtrlCmd | arcadeDefaults.KeyCode.Minus],
|
|
5860
5965
|
contextMenuGroupId: "zooming",
|
|
5861
5966
|
contextMenuOrder: 2,
|
|
5862
|
-
run: async () => await zoomOutFn?.run()
|
|
5967
|
+
run: async () => await zoomOutFn?.run(),
|
|
5863
5968
|
});
|
|
5864
5969
|
}
|
|
5865
5970
|
//#endregion
|