@arcgis/coding-components 4.30.0-next.47 → 4.30.0-next.49
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-833b0216.js → p-00583f5a.js} +2 -2
- package/dist/arcgis-coding-components/{p-4fd5a02d.js → p-384b88cc.js} +3 -3
- package/dist/arcgis-coding-components/{p-a0704d86.js → p-523db1e4.js} +10 -10
- package/dist/arcgis-coding-components/{p-a412be74.js → p-59f2dedc.js} +2 -2
- package/dist/arcgis-coding-components/{p-1a627096.js → p-82321ce1.js} +3 -3
- package/dist/arcgis-coding-components/{p-6fd22ff7.js → p-82c4966b.js} +3 -3
- package/dist/arcgis-coding-components/{p-621187ef.js → p-8d013f83.js} +2 -2
- package/dist/arcgis-coding-components/{p-0fee5174.js → p-9054397c.js} +3 -3
- package/dist/arcgis-coding-components/p-905b1583.js +7 -0
- package/dist/arcgis-coding-components/{p-29207f1e.js → p-9859037c.js} +1 -1
- package/dist/arcgis-coding-components/{p-ab7e89c0.js → p-d32ebf93.js} +2 -2
- package/dist/arcgis-coding-components/p-fe90777a.entry.js +6 -0
- package/dist/cjs/{arcade-defaults-4e0664fb.js → arcade-defaults-c09aa6ca.js} +10 -26
- package/dist/cjs/{arcade-mode-61a07430.js → arcade-mode-f43455a9.js} +3 -3
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +257 -283
- package/dist/cjs/arcgis-coding-components.cjs.js +2 -2
- package/dist/cjs/{css-fac19960.js → css-d565ba31.js} +1 -1
- package/dist/cjs/{cssMode-22d917f0.js → cssMode-0c9ea16a.js} +3 -3
- package/dist/cjs/{html-5bc24648.js → html-bbac75a5.js} +3 -3
- package/dist/cjs/{htmlMode-f09628e1.js → htmlMode-275dad7c.js} +3 -3
- package/dist/cjs/{index-02749111.js → index-97b5c264.js} +2 -9
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/{javascript-29521fd3.js → javascript-3bc3e94b.js} +4 -4
- package/dist/cjs/{jsonMode-99606370.js → jsonMode-358b250b.js} +3 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{tsMode-e34432d7.js → tsMode-10794c88.js} +3 -3
- package/dist/cjs/{typescript-8ce06335.js → typescript-a3afcaae.js} +3 -3
- package/dist/components/arcade-api.js +6 -5
- package/dist/components/arcade-contribution.js +3 -2
- package/dist/components/arcade-defaults.js +3 -3
- package/dist/components/arcade-mode.js +2 -2
- package/dist/components/arcade-results.js +7 -6
- package/dist/components/arcade-suggestions.js +8 -7
- package/dist/components/arcade-variables.js +6 -5
- package/dist/components/arcgis-arcade-api.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +6 -5
- 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-36QZLGG2.js → chunk-27DTPISK.js} +250 -282
- package/dist/components/code-editor.js +5 -5
- package/dist/components/fields.js +62 -2
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +2 -76
- package/dist/components/markdown.js +1 -1
- package/dist/components/useT9n.js +11 -0
- package/dist/components/utilities.js +2 -2
- package/dist/esm/{arcade-defaults-fdba0972.js → arcade-defaults-0903c8e4.js} +11 -25
- package/dist/esm/{arcade-mode-0d144d92.js → arcade-mode-6bc35b9a.js} +3 -3
- package/dist/esm/arcgis-arcade-api_6.entry.js +256 -282
- package/dist/esm/arcgis-coding-components.js +3 -3
- package/dist/esm/{css-58b4c966.js → css-549e7ecd.js} +1 -1
- package/dist/esm/{cssMode-f5916932.js → cssMode-63059930.js} +3 -3
- package/dist/esm/{html-7c8fbcc5.js → html-03b9ab7d.js} +3 -3
- package/dist/esm/{htmlMode-d7755346.js → htmlMode-ae2b0579.js} +3 -3
- package/dist/esm/{index-c6b28dae.js → index-88cb51ca.js} +3 -9
- package/dist/esm/index.js +3 -3
- package/dist/esm/{javascript-9ac36865.js → javascript-df9e60b6.js} +4 -4
- package/dist/esm/{jsonMode-ef328849.js → jsonMode-e0f3f4e6.js} +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{tsMode-0daf7dc9.js → tsMode-4477deb0.js} +3 -3
- package/dist/esm/{typescript-a34ba038.js → typescript-4ca85521.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/components/arcade-suggestions/arcade-suggestions.d.ts +1 -1
- package/dist/types/controllers/useT9n.d.ts +1 -0
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +3 -0
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-inline-url-importer.d.ts +9 -0
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-json-importer.d.ts +19 -0
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/stencil-monaco-plugins.d.ts +6 -0
- package/package.json +9 -9
- package/dist/arcgis-coding-components/p-2b6dab4b.entry.js +0 -6
- package/dist/arcgis-coding-components/p-d5df8d73.js +0 -7
|
@@ -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.49
|
|
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-97b5c264.js');
|
|
11
|
+
const arcadeDefaults = require('./arcade-defaults-c09aa6ca.js');
|
|
12
12
|
|
|
13
13
|
async function colorizeCode(code) {
|
|
14
14
|
return await arcadeDefaults.editor.colorize(code, "arcade", { tabSize: 2 });
|
|
@@ -2939,17 +2939,30 @@ function convertMarkdownString(value) {
|
|
|
2939
2939
|
return marked_umd.marked.parse(typeof value === "string" ? value : value.value);
|
|
2940
2940
|
}
|
|
2941
2941
|
|
|
2942
|
-
// src/
|
|
2943
|
-
function
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2942
|
+
// src/framework.ts
|
|
2943
|
+
function retrieveComponentMembers(component, isLit) {
|
|
2944
|
+
if (isLit) {
|
|
2945
|
+
const elementProperties = getLitProperties(component);
|
|
2946
|
+
component.manager.internals.members = Object.fromEntries(
|
|
2947
|
+
Array.from(elementProperties, ([name, { state, type }]) => [
|
|
2948
|
+
name,
|
|
2949
|
+
[
|
|
2950
|
+
state ? 32 /* State */ : type === Number ? 2 /* Number */ : type === Boolean ? 4 /* Boolean */ : 1 /* String */
|
|
2951
|
+
]
|
|
2952
|
+
])
|
|
2950
2953
|
);
|
|
2951
|
-
|
|
2954
|
+
} else {
|
|
2955
|
+
const constructor = component.constructor;
|
|
2956
|
+
const members = constructor.__registerControllers?.(component) ?? void 0;
|
|
2957
|
+
constructor.__registerControllers = void 0;
|
|
2958
|
+
if (typeof members !== "object")
|
|
2959
|
+
throw new Error(
|
|
2960
|
+
"Failed to retrieve internal component meta. Make sure you have the useComponentsControllers() Rollup Plugin for Stencil Controllers configured in your Stencil config."
|
|
2961
|
+
);
|
|
2962
|
+
component.manager.internals.members = members;
|
|
2963
|
+
}
|
|
2952
2964
|
}
|
|
2965
|
+
var getLitProperties = (component) => component.constructor.elementProperties;
|
|
2953
2966
|
function parsePropertyValue(value, type = 8 /* Any */) {
|
|
2954
2967
|
const isComplex = value == null || typeof value === "object" || typeof value === "function";
|
|
2955
2968
|
if (isComplex)
|
|
@@ -2957,7 +2970,7 @@ function parsePropertyValue(value, type = 8 /* Any */) {
|
|
|
2957
2970
|
if ((type & 4 /* Boolean */) !== 0)
|
|
2958
2971
|
return value === "false" ? false : value === "" || !!value;
|
|
2959
2972
|
else if ((type & 2 /* Number */) !== 0)
|
|
2960
|
-
return Number.parseFloat(value
|
|
2973
|
+
return Number.parseFloat(value);
|
|
2961
2974
|
else if ((type & 1 /* String */) !== 0)
|
|
2962
2975
|
return String(value);
|
|
2963
2976
|
else
|
|
@@ -2979,6 +2992,21 @@ function getPropType(component, name) {
|
|
|
2979
2992
|
return "prop";
|
|
2980
2993
|
}
|
|
2981
2994
|
|
|
2995
|
+
// src/types.ts
|
|
2996
|
+
var controllerSymbol = Symbol("controller");
|
|
2997
|
+
|
|
2998
|
+
// src/utils.ts
|
|
2999
|
+
function extendObject(base, extend) {
|
|
3000
|
+
Object.entries(extend).forEach(([key, value]) => {
|
|
3001
|
+
if (key in base)
|
|
3002
|
+
throw new Error(`Unable to extend object because property "${key}" is already defined`);
|
|
3003
|
+
const thisBase = base;
|
|
3004
|
+
thisBase[key] = value;
|
|
3005
|
+
});
|
|
3006
|
+
return base;
|
|
3007
|
+
}
|
|
3008
|
+
var isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
|
|
3009
|
+
|
|
2982
3010
|
// ../components-utils/dist/index.js
|
|
2983
3011
|
var Deferred = class {
|
|
2984
3012
|
/**
|
|
@@ -3083,6 +3111,7 @@ async function safeAsyncCall(callback) {
|
|
|
3083
3111
|
}
|
|
3084
3112
|
return void 0;
|
|
3085
3113
|
}
|
|
3114
|
+
var camelToKebab = (string) => string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : "-"}${upper.toLowerCase()}`);
|
|
3086
3115
|
var upperBeforeLower = /[A-Z]+(?![a-z])|[A-Z]/gu;
|
|
3087
3116
|
var capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
3088
3117
|
var camelToHuman = (string) => capitalize(string.replace(upperBeforeLower, (upper, remainder) => `${remainder === 0 ? "" : " "}${upper}`));
|
|
@@ -3182,21 +3211,6 @@ async function updateComponentLocateState(element, assetsPath, assetName = eleme
|
|
|
3182
3211
|
return { lang, t9nLocale, t9nStrings };
|
|
3183
3212
|
}
|
|
3184
3213
|
|
|
3185
|
-
// src/types.ts
|
|
3186
|
-
var controllerSymbol = Symbol("controller");
|
|
3187
|
-
|
|
3188
|
-
// src/utils.ts
|
|
3189
|
-
function extendObject(base, extend) {
|
|
3190
|
-
Object.entries(extend).forEach(([key, value]) => {
|
|
3191
|
-
if (key in base)
|
|
3192
|
-
throw new Error(`Unable to extend object because property "${key}" is already defined`);
|
|
3193
|
-
const thisBase = base;
|
|
3194
|
-
thisBase[key] = value;
|
|
3195
|
-
});
|
|
3196
|
-
return base;
|
|
3197
|
-
}
|
|
3198
|
-
var isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
|
|
3199
|
-
|
|
3200
3214
|
// src/ControllerInternals.ts
|
|
3201
3215
|
var ControllerInternals = class {
|
|
3202
3216
|
constructor() {
|
|
@@ -3361,26 +3375,23 @@ var _Controller = class _Controller {
|
|
|
3361
3375
|
value: resolvedComponent
|
|
3362
3376
|
});
|
|
3363
3377
|
this.component.addController(this);
|
|
3364
|
-
const manager = this.component.manager;
|
|
3365
|
-
this.connected = manager?.connected;
|
|
3366
|
-
this.internals = manager?.internals;
|
|
3367
3378
|
_Controller.internals.setParentController(this);
|
|
3368
3379
|
if ("hostDestroy" in this)
|
|
3369
3380
|
this.component.manager.ensureHasDestroy();
|
|
3370
|
-
|
|
3381
|
+
const manager = this.component.manager;
|
|
3382
|
+
const isInControllerManager = manager === void 0;
|
|
3383
|
+
if (!isInControllerManager)
|
|
3371
3384
|
queueMicrotask(() => this.catchUpLifecycle());
|
|
3372
|
-
const controller = this;
|
|
3385
|
+
const controller = isInControllerManager ? {} : this;
|
|
3373
3386
|
this._callbacks = {
|
|
3374
|
-
hostConnected: "hostConnected" in
|
|
3375
|
-
hostDisconnected: "hostDisconnected" in
|
|
3376
|
-
hostLoad: "hostLoad" in
|
|
3377
|
-
hostLoaded: "hostLoaded" in
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
hostDestroy: "hostDestroy" in this ? [() => controller.hostDestroy?.()] : [],
|
|
3383
|
-
hostLifecycle: "hostLifecycle" in this ? [() => controller.hostLifecycle?.()] : []
|
|
3387
|
+
hostConnected: "hostConnected" in controller ? [() => controller.hostConnected?.()] : [],
|
|
3388
|
+
hostDisconnected: "hostDisconnected" in controller ? [() => controller.hostDisconnected?.()] : [],
|
|
3389
|
+
hostLoad: "hostLoad" in controller ? [() => controller.hostLoad?.()] : [],
|
|
3390
|
+
hostLoaded: "hostLoaded" in controller ? [() => controller.hostLoaded?.()] : [],
|
|
3391
|
+
hostUpdate: "hostUpdate" in controller ? [() => controller.hostUpdate?.()] : [],
|
|
3392
|
+
hostUpdated: "hostUpdated" in controller ? [() => controller.hostUpdated?.()] : [],
|
|
3393
|
+
hostDestroy: "hostDestroy" in controller ? [() => controller.hostDestroy?.()] : [],
|
|
3394
|
+
hostLifecycle: "hostLifecycle" in controller ? [() => controller.hostLifecycle?.()] : []
|
|
3384
3395
|
};
|
|
3385
3396
|
}
|
|
3386
3397
|
/**
|
|
@@ -3505,7 +3516,7 @@ var _Controller = class _Controller {
|
|
|
3505
3516
|
}
|
|
3506
3517
|
/**
|
|
3507
3518
|
* Property reads inside of this function will bypass any custom getter you
|
|
3508
|
-
* may have, and read the value directly from what's stored in Stencil.
|
|
3519
|
+
* may have, and read the value directly from what's stored in Stencil/Lit.
|
|
3509
3520
|
*
|
|
3510
3521
|
* This also bypasses reactiveUtils integration - reading a property inside of
|
|
3511
3522
|
* bypassGetter won't make that property tracked.
|
|
@@ -3544,28 +3555,30 @@ var _Controller = class _Controller {
|
|
|
3544
3555
|
genericGetSet(property, getSet) {
|
|
3545
3556
|
var _a2, _b;
|
|
3546
3557
|
const genericGetSet = getSet;
|
|
3558
|
+
const internals = this.component.manager.internals;
|
|
3547
3559
|
if (genericGetSet.get !== void 0) {
|
|
3548
|
-
(_a2 =
|
|
3549
|
-
|
|
3560
|
+
(_a2 = internals.getters)[property] ?? (_a2[property] = []);
|
|
3561
|
+
internals.getters[property].unshift(genericGetSet.get);
|
|
3550
3562
|
}
|
|
3551
3563
|
if (genericGetSet.set !== void 0) {
|
|
3552
|
-
(_b =
|
|
3553
|
-
|
|
3564
|
+
(_b = internals.setters)[property] ?? (_b[property] = []);
|
|
3565
|
+
internals.setters[property].unshift(genericGetSet.set);
|
|
3554
3566
|
}
|
|
3555
3567
|
}
|
|
3556
3568
|
// FEATURE: improve typings
|
|
3557
3569
|
/**
|
|
3558
|
-
* Dynamically set a watcher for any
|
|
3570
|
+
* Dynamically set a watcher for any reactive property
|
|
3559
3571
|
*/
|
|
3560
3572
|
watch(property, callback) {
|
|
3561
3573
|
var _a2;
|
|
3562
3574
|
const type = getMemberType(this.component, property);
|
|
3563
3575
|
if (type === void 0)
|
|
3564
3576
|
throw new Error(
|
|
3565
|
-
`Trying to watch a non-@
|
|
3577
|
+
`Trying to watch a non-@property, non-@state property "${property}". Either convert it into a @state() or use get/set syntax`
|
|
3566
3578
|
);
|
|
3567
|
-
|
|
3568
|
-
|
|
3579
|
+
const internals = this.component.manager.internals;
|
|
3580
|
+
(_a2 = internals.allWatchers)[property] ?? (_a2[property] = []);
|
|
3581
|
+
const watchers = internals.allWatchers[property];
|
|
3569
3582
|
const genericCallback = callback;
|
|
3570
3583
|
const safeCallback = (newValue, oldValue, propertyName) => safeCall(() => genericCallback(newValue, oldValue, propertyName));
|
|
3571
3584
|
watchers.push(safeCallback);
|
|
@@ -3588,12 +3601,6 @@ var _Controller = class _Controller {
|
|
|
3588
3601
|
onLoaded(callback) {
|
|
3589
3602
|
this._callbacks.hostLoaded.push(callback);
|
|
3590
3603
|
}
|
|
3591
|
-
onRender(callback) {
|
|
3592
|
-
this._callbacks.hostRender.push(callback);
|
|
3593
|
-
}
|
|
3594
|
-
onRendered(callback) {
|
|
3595
|
-
this._callbacks.hostRendered.push(callback);
|
|
3596
|
-
}
|
|
3597
3604
|
onUpdate(callback) {
|
|
3598
3605
|
this._callbacks.hostUpdate.push(callback);
|
|
3599
3606
|
}
|
|
@@ -3634,16 +3641,8 @@ var _Controller = class _Controller {
|
|
|
3634
3641
|
this._callbacks.hostLoaded.forEach(safeCall);
|
|
3635
3642
|
this.didLoadCalled = true;
|
|
3636
3643
|
}
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
await Promise.allSettled(this._callbacks.hostRender.map(safeAsyncCall));
|
|
3640
|
-
}
|
|
3641
|
-
triggerRendered() {
|
|
3642
|
-
this._callbacks.hostRendered.forEach(safeCall);
|
|
3643
|
-
}
|
|
3644
|
-
async triggerUpdate() {
|
|
3645
|
-
if (this._callbacks.hostUpdate.length > 0)
|
|
3646
|
-
await Promise.allSettled(this._callbacks.hostUpdate.map(safeAsyncCall));
|
|
3644
|
+
triggerUpdate() {
|
|
3645
|
+
this._callbacks.hostUpdate.forEach(safeCall);
|
|
3647
3646
|
}
|
|
3648
3647
|
triggerUpdated() {
|
|
3649
3648
|
this._callbacks.hostUpdated.forEach(safeCall);
|
|
@@ -3655,6 +3654,7 @@ var _Controller = class _Controller {
|
|
|
3655
3654
|
this._callbacks.hostLifecycle.forEach((callback) => this._callLifecycle(callback));
|
|
3656
3655
|
}
|
|
3657
3656
|
_callLifecycle(callback) {
|
|
3657
|
+
_Controller.internals.setAmbientComponent(this.component);
|
|
3658
3658
|
const cleanupRaw = safeCall(callback);
|
|
3659
3659
|
const cleanup = Array.isArray(cleanupRaw) ? cleanupRaw : [cleanupRaw];
|
|
3660
3660
|
cleanup.forEach((cleanup2) => {
|
|
@@ -3680,12 +3680,6 @@ var GenericController = class extends Controller {
|
|
|
3680
3680
|
callback
|
|
3681
3681
|
);
|
|
3682
3682
|
}
|
|
3683
|
-
/**
|
|
3684
|
-
* Silence "Property 'dynamicGetSet' in type
|
|
3685
|
-
* 'GenericController<Exports, Requires>' is not assignable to the same
|
|
3686
|
-
* property in base type 'Controller<Exports>'", as TypeScript is being overly
|
|
3687
|
-
* conservative here with what it allows
|
|
3688
|
-
*/
|
|
3689
3683
|
dynamicGetSet(property, getSet) {
|
|
3690
3684
|
super.genericGetSet(property, getSet);
|
|
3691
3685
|
}
|
|
@@ -3693,9 +3687,9 @@ var GenericController = class extends Controller {
|
|
|
3693
3687
|
function makeProvisionalValue(base) {
|
|
3694
3688
|
if (typeof base !== "object" && typeof base !== "function" || base === null)
|
|
3695
3689
|
return base;
|
|
3696
|
-
const
|
|
3690
|
+
const proxy2 = new Proxy(base, {
|
|
3697
3691
|
get(target, prop, receiver) {
|
|
3698
|
-
if (cyclical.has(prop) && prop in target && target[prop] ===
|
|
3692
|
+
if (cyclical.has(prop) && prop in target && target[prop] === proxy2)
|
|
3699
3693
|
return void 0;
|
|
3700
3694
|
if (prop in target || prop in Promise.prototype || typeof prop === "symbol")
|
|
3701
3695
|
return typeof target === "function" ? target[prop] : Reflect.get(target, prop, receiver);
|
|
@@ -3707,16 +3701,10 @@ function makeProvisionalValue(base) {
|
|
|
3707
3701
|
return Reflect.set(target, prop, newValue, receiver);
|
|
3708
3702
|
}
|
|
3709
3703
|
});
|
|
3710
|
-
return
|
|
3704
|
+
return proxy2;
|
|
3711
3705
|
}
|
|
3712
3706
|
var cyclical = /* @__PURE__ */ new Set(["exports", "_exports"]);
|
|
3713
|
-
var accessBeforeLoad =
|
|
3714
|
-
"This might be the case if you are trying to access an async controller in ",
|
|
3715
|
-
"connectedCallback(). Or, if you are using it inside of ",
|
|
3716
|
-
"componentWillLoad()/another controller without controller.use. Example correct ",
|
|
3717
|
-
"usage:\n",
|
|
3718
|
-
"makeController(async (component, controller)=>{ await controller.use(someOtherController); });"
|
|
3719
|
-
].join("");
|
|
3707
|
+
var accessBeforeLoad = "" ;
|
|
3720
3708
|
function toControllerHost(component) {
|
|
3721
3709
|
if ("addController" in component)
|
|
3722
3710
|
return component;
|
|
@@ -3726,6 +3714,82 @@ function toControllerHost(component) {
|
|
|
3726
3714
|
);
|
|
3727
3715
|
}
|
|
3728
3716
|
|
|
3717
|
+
// src/proxyExports.ts
|
|
3718
|
+
var proxyExports = (Class) => (...args) => {
|
|
3719
|
+
const ambientControllers = Controller.internals.retrieveParentControllers();
|
|
3720
|
+
const instance = new Class(...args);
|
|
3721
|
+
const initialExports = instance.exports;
|
|
3722
|
+
Controller.internals.setParentController(ambientControllers.at(-1));
|
|
3723
|
+
const internals = instance.component.manager.internals;
|
|
3724
|
+
internals.markExports(instance, initialExports);
|
|
3725
|
+
instance.watchExports((exports) => internals.markExports(instance, exports));
|
|
3726
|
+
Controller.internals.setAmbientChildController(instance);
|
|
3727
|
+
const hostCandidates = [instance.component, ...ambientControllers].reverse();
|
|
3728
|
+
return internals.trackKey(
|
|
3729
|
+
hostCandidates,
|
|
3730
|
+
(resolution) => resolution === void 0 ? void 0 : setProxy(instance, resolution.host, resolution.key, initialExports),
|
|
3731
|
+
initialExports
|
|
3732
|
+
);
|
|
3733
|
+
};
|
|
3734
|
+
function setProxy(controller, host, key, initialExports) {
|
|
3735
|
+
const genericHost = host;
|
|
3736
|
+
const controllerValueChanged = genericHost[key] !== controller.exports;
|
|
3737
|
+
const hostValueChanged = genericHost[key] !== initialExports;
|
|
3738
|
+
const controllerUpdatedExports = initialExports !== controller.exports;
|
|
3739
|
+
if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports)
|
|
3740
|
+
genericHost[key] = controller.exports;
|
|
3741
|
+
controller.watchExports(() => {
|
|
3742
|
+
if (genericHost[key] === controller.exports)
|
|
3743
|
+
return;
|
|
3744
|
+
const manager = controller.component.manager;
|
|
3745
|
+
const isReadOnly = manager.internals.readonlyProps?.has(key) === true;
|
|
3746
|
+
if (isReadOnly)
|
|
3747
|
+
manager.bypassReadonly(() => {
|
|
3748
|
+
genericHost[key] = controller.exports;
|
|
3749
|
+
});
|
|
3750
|
+
else
|
|
3751
|
+
genericHost[key] = controller.exports;
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
// src/functional.ts
|
|
3756
|
+
var makeController = (constructor) => proxy(void 0, constructor);
|
|
3757
|
+
var FunctionalController = class extends Controller {
|
|
3758
|
+
constructor(component, constructor) {
|
|
3759
|
+
super(component);
|
|
3760
|
+
const originalExports = this.exports;
|
|
3761
|
+
try {
|
|
3762
|
+
Controller.internals.setAmbientComponent(this.component);
|
|
3763
|
+
const value = constructor(this.component, this);
|
|
3764
|
+
const constructorChangedExports = this.exports !== originalExports;
|
|
3765
|
+
if (value instanceof Promise) {
|
|
3766
|
+
if (!constructorChangedExports)
|
|
3767
|
+
this.setProvisionalExports(value);
|
|
3768
|
+
const resolved = value.then((result) => {
|
|
3769
|
+
this.exports = result;
|
|
3770
|
+
super.catchUpLifecycle();
|
|
3771
|
+
}).catch((error) => {
|
|
3772
|
+
this._ready.reject(error);
|
|
3773
|
+
console.error(error);
|
|
3774
|
+
});
|
|
3775
|
+
this.onLoad(async () => await resolved);
|
|
3776
|
+
} else {
|
|
3777
|
+
if (!constructorChangedExports || value !== void 0)
|
|
3778
|
+
this.exports = value;
|
|
3779
|
+
queueMicrotask(() => super.catchUpLifecycle());
|
|
3780
|
+
}
|
|
3781
|
+
} catch (error) {
|
|
3782
|
+
this._ready.reject(error);
|
|
3783
|
+
console.error(error);
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
/** Noop - will be called in the constructor instead */
|
|
3787
|
+
catchUpLifecycle() {
|
|
3788
|
+
return;
|
|
3789
|
+
}
|
|
3790
|
+
};
|
|
3791
|
+
var proxy = proxyExports(FunctionalController);
|
|
3792
|
+
|
|
3729
3793
|
// src/trackPropertyKey.ts
|
|
3730
3794
|
function trackPropertyKey(object, onResolved, defaultValue) {
|
|
3731
3795
|
const keys = Object.keys(object);
|
|
@@ -3816,16 +3880,14 @@ var ComponentInternals = class {
|
|
|
3816
3880
|
}, defaultValue);
|
|
3817
3881
|
return defaultValue;
|
|
3818
3882
|
};
|
|
3819
|
-
this.trackPropKey = (onResolved, defaultValue
|
|
3883
|
+
this.trackPropKey = (onResolved, defaultValue) => {
|
|
3820
3884
|
if (this._trackedValue !== nothing && this._trackedValue !== defaultValue)
|
|
3821
3885
|
this._firePropertyTrackers(void 0, void 0, void 0);
|
|
3822
3886
|
if (this._keyTrackers.length === 0)
|
|
3823
3887
|
queueMicrotask(() => this._firePropertyTrackers(void 0, void 0, void 0));
|
|
3824
3888
|
this._trackedValue = defaultValue;
|
|
3825
3889
|
this._keyTrackers.push(
|
|
3826
|
-
(key, value, previousValue) => safeCall(
|
|
3827
|
-
() => onResolved(defaultValue === value || ignoreDefaultValueMismatch ? key : void 0, previousValue)
|
|
3828
|
-
)
|
|
3890
|
+
(key, value, previousValue) => safeCall(() => onResolved(defaultValue === value ? key : void 0, previousValue))
|
|
3829
3891
|
);
|
|
3830
3892
|
return defaultValue;
|
|
3831
3893
|
};
|
|
@@ -3859,9 +3921,12 @@ var ComponentInternals = class {
|
|
|
3859
3921
|
* to apply the changes to the prototype
|
|
3860
3922
|
*/
|
|
3861
3923
|
getSetProxy(property, hasGetter, hasSetter) {
|
|
3862
|
-
const
|
|
3924
|
+
const component = this.component;
|
|
3925
|
+
const classPrototype = component.constructor.prototype;
|
|
3863
3926
|
this._getSetProxy(classPrototype, property, hasGetter, hasSetter, "class");
|
|
3864
|
-
|
|
3927
|
+
if (component.manager.isLit)
|
|
3928
|
+
return;
|
|
3929
|
+
const htmlPrototype = component.el.constructor.prototype;
|
|
3865
3930
|
if (classPrototype !== htmlPrototype)
|
|
3866
3931
|
this._getSetProxy(htmlPrototype, property, hasGetter, hasSetter, "html");
|
|
3867
3932
|
}
|
|
@@ -3873,7 +3938,7 @@ var ComponentInternals = class {
|
|
|
3873
3938
|
if (descriptor?.set === void 0 || descriptor.get === void 0)
|
|
3874
3939
|
if (descriptor !== void 0 && "value" in descriptor)
|
|
3875
3940
|
throw new Error(
|
|
3876
|
-
`getSet() should only be used on
|
|
3941
|
+
`getSet() should only be used on @Prop/@property/@State/@state properties. For internal component properties, use regular get/set syntax. Tried to use it on "${name}" in ${component.el.tagName}`
|
|
3877
3942
|
);
|
|
3878
3943
|
else if (tolerateNotFound)
|
|
3879
3944
|
return;
|
|
@@ -3900,12 +3965,12 @@ var ComponentInternals = class {
|
|
|
3900
3965
|
} : originalGet;
|
|
3901
3966
|
const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
|
|
3902
3967
|
const oldValue = originalGet.call(this);
|
|
3903
|
-
let newValue = parsePropertyValue(rawNewValue, propType);
|
|
3904
3968
|
const component2 = Controller.internals.elementToInstance.get(this);
|
|
3905
3969
|
if (component2 === void 0) {
|
|
3906
3970
|
originalSet.call(this, rawNewValue);
|
|
3907
3971
|
return;
|
|
3908
3972
|
}
|
|
3973
|
+
let newValue = component2.manager.isLit ? rawNewValue : parsePropertyValue(rawNewValue, propType);
|
|
3909
3974
|
const internals = component2.manager.internals;
|
|
3910
3975
|
if (newValue === oldValue)
|
|
3911
3976
|
originalSet.call(this, rawNewValue);
|
|
@@ -3949,59 +4014,30 @@ var ComponentInternals = class {
|
|
|
3949
4014
|
var emptyArray = [];
|
|
3950
4015
|
var customAccessor = Symbol("controllersCustomAccessor");
|
|
3951
4016
|
var nothing = Symbol("nothing");
|
|
3952
|
-
var accessorPromise = Promise.all([arcadeDefaults.importCoreAccessor(), arcadeDefaults.importCoreAccessorSupportDecorators()]);
|
|
3953
|
-
function reactiveUtilsIntegration(component) {
|
|
3954
|
-
const members = getPropLikeMembers(component);
|
|
3955
|
-
const internals = component.manager.internals;
|
|
3956
|
-
members.forEach((name) => {
|
|
3957
|
-
internals.accessorGetter[name] = defaultGetterSetter;
|
|
3958
|
-
internals.accessorSetter[name] = defaultGetterSetter;
|
|
3959
|
-
internals.getSetProxy(name, true, true);
|
|
3960
|
-
});
|
|
3961
|
-
return async (enabledMembers = members) => {
|
|
3962
|
-
const [Accessor, { subclass, property }] = await accessorPromise;
|
|
3963
|
-
class AccessorSubclass extends Accessor {
|
|
3964
|
-
}
|
|
3965
|
-
const getter = (_value, propertyName) => accessor[propertyName];
|
|
3966
|
-
function setter(newValue, _oldValue, propertyName) {
|
|
3967
|
-
if (accessor !== void 0)
|
|
3968
|
-
accessor[propertyName] = newValue;
|
|
3969
|
-
return newValue;
|
|
3970
|
-
}
|
|
3971
|
-
component.manager.bypassGetter(
|
|
3972
|
-
() => enabledMembers.forEach((name) => {
|
|
3973
|
-
internals.accessorGetter[name] = getter;
|
|
3974
|
-
internals.accessorSetter[name] = setter;
|
|
3975
|
-
property({
|
|
3976
|
-
value: component[name]
|
|
3977
|
-
})(AccessorSubclass.prototype, name);
|
|
3978
|
-
})
|
|
3979
|
-
);
|
|
3980
|
-
const Subclass = subclass(component.el.tagName)(AccessorSubclass);
|
|
3981
|
-
const accessor = new Subclass();
|
|
3982
|
-
};
|
|
3983
|
-
}
|
|
3984
|
-
var defaultGetterSetter = (value) => value;
|
|
3985
4017
|
|
|
3986
4018
|
// src/ControllerManager.ts
|
|
3987
|
-
var useControllerManager = (component) => new ControllerManager(component);
|
|
4019
|
+
var useControllerManager = (component, forceUpdate) => new ControllerManager(component, forceUpdate);
|
|
3988
4020
|
var ControllerManager = class extends GenericController {
|
|
3989
|
-
constructor(component) {
|
|
4021
|
+
constructor(component, forceUpdate) {
|
|
4022
|
+
const isLit = "addController" in component;
|
|
3990
4023
|
const controllers = /* @__PURE__ */ new Set();
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4024
|
+
function addController(controller) {
|
|
4025
|
+
controllers.add(controller);
|
|
4026
|
+
if (isLit && !(controllerSymbol in controller) && component.el.isConnected)
|
|
4027
|
+
controller.hostConnected?.();
|
|
4028
|
+
}
|
|
4029
|
+
const removeController = (controller) => void controllers.delete(controller);
|
|
4030
|
+
if (!isLit) {
|
|
4031
|
+
const update = forceUpdate ?? component.constructor.__forceUpdate;
|
|
4032
|
+
const controllerHost = {
|
|
4033
|
+
addController,
|
|
4034
|
+
removeController,
|
|
4035
|
+
requestUpdate: () => update(component)
|
|
4036
|
+
};
|
|
4037
|
+
extendObject(component, controllerHost);
|
|
4038
|
+
}
|
|
4001
4039
|
super(component);
|
|
4002
|
-
this._connected = new Deferred();
|
|
4003
4040
|
this.internals = new ComponentInternals(this.component);
|
|
4004
|
-
this.connected = this._connected.promise;
|
|
4005
4041
|
this.destroyed = false;
|
|
4006
4042
|
this._updatePromise = new Deferred();
|
|
4007
4043
|
this._originalLifecycles = {};
|
|
@@ -4048,14 +4084,25 @@ var ControllerManager = class extends GenericController {
|
|
|
4048
4084
|
* \@Prop() decorator or not
|
|
4049
4085
|
*/
|
|
4050
4086
|
this.trackKey = this.internals.trackKey;
|
|
4051
|
-
this._readonlySetter = (newValue,
|
|
4087
|
+
this._readonlySetter = (newValue, oldValue, property) => {
|
|
4052
4088
|
if (Controller.internals.shouldBypassReadonly)
|
|
4053
4089
|
return newValue;
|
|
4054
|
-
const
|
|
4055
|
-
|
|
4056
|
-
|
|
4090
|
+
const component = this.component;
|
|
4091
|
+
const isProp = getPropType(component, property) === "prop";
|
|
4092
|
+
if (isProp) {
|
|
4093
|
+
if (this.isLit) {
|
|
4094
|
+
const details = getLitProperties(component).get(property);
|
|
4095
|
+
if (details && details?.attribute !== false)
|
|
4096
|
+
component.el.setAttribute(
|
|
4097
|
+
typeof details.attribute === "string" ? details.attribute : camelToKebab(property),
|
|
4098
|
+
// Not using converter.toAttribute to keep this unlikely case simpler
|
|
4099
|
+
String(oldValue)
|
|
4100
|
+
);
|
|
4101
|
+
} else
|
|
4102
|
+
component.requestUpdate();
|
|
4103
|
+
}
|
|
4057
4104
|
throw new Error(
|
|
4058
|
-
`Cannot assign to read-only property "${property}" of ${
|
|
4105
|
+
`Cannot assign to read-only property "${property}" of ${component.el.tagName.toLowerCase()}. Trying to assign "${String(
|
|
4059
4106
|
newValue
|
|
4060
4107
|
)}"`
|
|
4061
4108
|
);
|
|
@@ -4068,18 +4115,30 @@ var ControllerManager = class extends GenericController {
|
|
|
4068
4115
|
*/
|
|
4069
4116
|
this.devOnlySetPersistentControllerData = void 0 ;
|
|
4070
4117
|
this.devOnlyGetPersistentControllerData = void 0 ;
|
|
4118
|
+
if (isLit) {
|
|
4119
|
+
component.addController = addController;
|
|
4120
|
+
component.removeController = removeController;
|
|
4121
|
+
}
|
|
4122
|
+
this.isLit = isLit;
|
|
4071
4123
|
this.component.manager = this;
|
|
4072
|
-
|
|
4124
|
+
retrieveComponentMembers(component, isLit);
|
|
4073
4125
|
this._controllers = controllers;
|
|
4074
4126
|
this.exports = void 0;
|
|
4075
4127
|
this.hasDestroy = "autoDestroyDisabled" in this.component && typeof this.component.destroy === "function";
|
|
4076
4128
|
if (this.hasDestroy)
|
|
4077
4129
|
this.watch("autoDestroyDisabled", () => this._autoDestroyDisabledWatcher());
|
|
4078
4130
|
this._bindLifecycleMethods();
|
|
4079
|
-
|
|
4080
|
-
|
|
4131
|
+
if (!isLit)
|
|
4132
|
+
Object.defineProperty(component, "updateComplete", {
|
|
4133
|
+
get: async () => await this._updatePromise.promise
|
|
4134
|
+
});
|
|
4135
|
+
const members = getPropLikeMembers(component);
|
|
4136
|
+
const internals = component.manager.internals;
|
|
4137
|
+
members.forEach((name) => {
|
|
4138
|
+
internals.accessorGetter[name] = defaultGetterSetter;
|
|
4139
|
+
internals.accessorSetter[name] = defaultGetterSetter;
|
|
4140
|
+
internals.getSetProxy(name, true, true);
|
|
4081
4141
|
});
|
|
4082
|
-
this.internals.reactiveUtilsIntegration = reactiveUtilsIntegration(this.component);
|
|
4083
4142
|
Controller.internals.setParentController(void 0);
|
|
4084
4143
|
Controller.internals.setAmbientComponent(component);
|
|
4085
4144
|
Controller.internals.elementToInstance.set(component.el, component);
|
|
@@ -4087,25 +4146,25 @@ var ControllerManager = class extends GenericController {
|
|
|
4087
4146
|
}
|
|
4088
4147
|
_bindLifecycleMethods() {
|
|
4089
4148
|
const component = this.component;
|
|
4149
|
+
const isLit = this.isLit;
|
|
4090
4150
|
this._originalLifecycles = {
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
componentDidUpdate: component.componentDidUpdate,
|
|
4151
|
+
// These callbacks will be called by Lit, so we don't have to
|
|
4152
|
+
connectedCallback: isLit ? void 0 : component.connectedCallback,
|
|
4153
|
+
disconnectedCallback: isLit ? void 0 : component.disconnectedCallback,
|
|
4154
|
+
componentWillLoad: isLit ? void 0 : component.componentWillLoad,
|
|
4155
|
+
componentDidLoad: isLit ? void 0 : component.componentDidLoad,
|
|
4156
|
+
componentWillUpdate: isLit ? void 0 : component.componentWillUpdate,
|
|
4157
|
+
componentDidUpdate: isLit ? void 0 : component.componentDidUpdate,
|
|
4099
4158
|
destroy: component.destroy
|
|
4100
4159
|
};
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4160
|
+
if (!isLit) {
|
|
4161
|
+
component.connectedCallback = this.hostConnected.bind(this);
|
|
4162
|
+
component.disconnectedCallback = this.hostDisconnected.bind(this);
|
|
4163
|
+
component.componentWillLoad = this.hostLoad.bind(this);
|
|
4164
|
+
component.componentDidLoad = this.hostLoaded.bind(this);
|
|
4165
|
+
component.componentWillUpdate = this.hostUpdate.bind(this);
|
|
4166
|
+
component.componentDidUpdate = this.hostUpdated.bind(this);
|
|
4167
|
+
}
|
|
4109
4168
|
if (this.hasDestroy)
|
|
4110
4169
|
component.destroy = this.destroy.bind(this);
|
|
4111
4170
|
}
|
|
@@ -4122,7 +4181,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4122
4181
|
* Instead, _bindLifecycleMethods will take care of that. Otherwise, you risk
|
|
4123
4182
|
* calling lifecycle methods twice.
|
|
4124
4183
|
*/
|
|
4125
|
-
|
|
4184
|
+
hostConnected() {
|
|
4126
4185
|
if (this.destroyed) {
|
|
4127
4186
|
const tagName = this.component.el.tagName.toLowerCase();
|
|
4128
4187
|
this.component.el.remove();
|
|
@@ -4134,13 +4193,12 @@ var ControllerManager = class extends GenericController {
|
|
|
4134
4193
|
clearTimeout(this._autoDestroyTimeout);
|
|
4135
4194
|
this.internals.enabledWatchers = this.internals.allWatchers;
|
|
4136
4195
|
keyTrackResolve();
|
|
4137
|
-
this._connected.resolve();
|
|
4138
4196
|
this._controllers.forEach(
|
|
4139
4197
|
(controller) => "triggerConnected" in controller ? controller.triggerConnected() : safeCall(() => controller.hostConnected?.())
|
|
4140
4198
|
);
|
|
4141
4199
|
this._originalLifecycles.connectedCallback?.call(this.component);
|
|
4142
4200
|
}
|
|
4143
|
-
|
|
4201
|
+
hostDisconnected() {
|
|
4144
4202
|
if (this.destroyed)
|
|
4145
4203
|
return;
|
|
4146
4204
|
this._controllers.forEach(
|
|
@@ -4150,8 +4208,10 @@ var ControllerManager = class extends GenericController {
|
|
|
4150
4208
|
if (this.hasDestroy)
|
|
4151
4209
|
this._autoDestroyDisabledWatcher();
|
|
4152
4210
|
}
|
|
4153
|
-
async
|
|
4154
|
-
|
|
4211
|
+
// REFACTOR: don't force async if there are no async load controllers?
|
|
4212
|
+
async hostLoad() {
|
|
4213
|
+
if (typeof this.internals.reactiveUtilsIntegration === "function")
|
|
4214
|
+
await this.internals.reactiveUtilsIntegration();
|
|
4155
4215
|
await Promise.allSettled(
|
|
4156
4216
|
Array.from(
|
|
4157
4217
|
this._controllers,
|
|
@@ -4160,44 +4220,28 @@ var ControllerManager = class extends GenericController {
|
|
|
4160
4220
|
);
|
|
4161
4221
|
await this._originalLifecycles.componentWillLoad?.call(this.component);
|
|
4162
4222
|
}
|
|
4163
|
-
|
|
4223
|
+
hostLoaded() {
|
|
4164
4224
|
this._controllers.forEach(
|
|
4165
4225
|
(controller) => "triggerLoaded" in controller ? controller.triggerLoaded() : safeCall(() => controller.hostLoaded?.())
|
|
4166
4226
|
);
|
|
4167
4227
|
this._originalLifecycles.componentDidLoad?.call(this.component);
|
|
4168
4228
|
}
|
|
4169
|
-
|
|
4170
|
-
await Promise.allSettled(
|
|
4171
|
-
Array.from(
|
|
4172
|
-
this._controllers,
|
|
4173
|
-
async (controller) => "triggerRender" in controller ? await controller.triggerRender() : await safeAsyncCall(async () => await controller.hostRender?.())
|
|
4174
|
-
)
|
|
4175
|
-
);
|
|
4176
|
-
await this._originalLifecycles.componentWillRender?.call(this.component);
|
|
4177
|
-
}
|
|
4178
|
-
_componentDidRender() {
|
|
4229
|
+
hostUpdate() {
|
|
4179
4230
|
this._controllers.forEach(
|
|
4180
|
-
(controller) => "
|
|
4231
|
+
(controller) => "triggerUpdate" in controller ? controller.triggerUpdate() : safeCall(() => controller.hostUpdate?.())
|
|
4181
4232
|
);
|
|
4182
|
-
this._originalLifecycles.
|
|
4233
|
+
void this._originalLifecycles.componentWillUpdate?.call(this.component);
|
|
4183
4234
|
}
|
|
4184
|
-
|
|
4185
|
-
await Promise.allSettled(
|
|
4186
|
-
Array.from(
|
|
4187
|
-
this._controllers,
|
|
4188
|
-
async (controller) => "triggerUpdate" in controller ? await controller.triggerUpdate() : await safeAsyncCall(async () => await controller.hostUpdate?.())
|
|
4189
|
-
)
|
|
4190
|
-
);
|
|
4191
|
-
await this._originalLifecycles.componentWillUpdate?.call(this.component);
|
|
4192
|
-
}
|
|
4193
|
-
_componentDidUpdate() {
|
|
4235
|
+
hostUpdated() {
|
|
4194
4236
|
this._controllers.forEach(
|
|
4195
4237
|
(controller) => "triggerUpdated" in controller ? controller.triggerUpdated() : safeCall(() => controller.hostUpdated?.())
|
|
4196
4238
|
);
|
|
4197
4239
|
this._originalLifecycles.componentDidUpdate?.call(this.component);
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4240
|
+
if (!this.isLit) {
|
|
4241
|
+
const updatePromise = this._updatePromise;
|
|
4242
|
+
this._updatePromise = new Deferred();
|
|
4243
|
+
updatePromise.resolve(true);
|
|
4244
|
+
}
|
|
4201
4245
|
}
|
|
4202
4246
|
async destroy() {
|
|
4203
4247
|
this.ensureHasDestroy();
|
|
@@ -4216,6 +4260,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4216
4260
|
this._controllers.forEach(
|
|
4217
4261
|
(controller) => "triggerDestroy" in controller ? controller.triggerDestroy() : safeCall(() => controller.hostDestroy?.())
|
|
4218
4262
|
);
|
|
4263
|
+
this._controllers.clear();
|
|
4219
4264
|
await this._originalLifecycles.destroy?.call(this.component);
|
|
4220
4265
|
}
|
|
4221
4266
|
_autoDestroyDisabledWatcher() {
|
|
@@ -4226,6 +4271,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4226
4271
|
this._autoDestroyTimeout = setTimeout(destroy, autoDestroyOnDisconnectTimeout);
|
|
4227
4272
|
}
|
|
4228
4273
|
}
|
|
4274
|
+
// REFACTOR: replace this with a readonly:true option in @property()
|
|
4229
4275
|
/**
|
|
4230
4276
|
* Make a @Prop() or @State() readonly (prevent overwriting default value).
|
|
4231
4277
|
*
|
|
@@ -4245,6 +4291,7 @@ var ControllerManager = class extends GenericController {
|
|
|
4245
4291
|
readonly(value) {
|
|
4246
4292
|
return this.getSet(value, { set: this._readonlySetter });
|
|
4247
4293
|
}
|
|
4294
|
+
// REFACTOR: remove this in Lit in favor of native get/set
|
|
4248
4295
|
/**
|
|
4249
4296
|
* Listen for any component's @State()/@Prop() change, and mutate it's
|
|
4250
4297
|
* value before it is set.
|
|
@@ -4271,13 +4318,13 @@ var ControllerManager = class extends GenericController {
|
|
|
4271
4318
|
*/
|
|
4272
4319
|
getSet(defaultValue, getSet) {
|
|
4273
4320
|
return this.component.manager.trackPropKey((name) => {
|
|
4274
|
-
var
|
|
4321
|
+
var _a;
|
|
4275
4322
|
if (name === void 0)
|
|
4276
4323
|
throw new Error(
|
|
4277
4324
|
"Unable to resolve get/set's prop name. Make sure you are using it like @Prop() someProp = this.manager.getSet(defaultValue,{get,set})"
|
|
4278
4325
|
);
|
|
4279
4326
|
if (getSet.set === this._readonlySetter) {
|
|
4280
|
-
(
|
|
4327
|
+
(_a = this.internals).readonlyProps ?? (_a.readonlyProps = /* @__PURE__ */ new Set());
|
|
4281
4328
|
this.internals.readonlyProps.add(name);
|
|
4282
4329
|
}
|
|
4283
4330
|
const genericComponent = this.component;
|
|
@@ -4298,91 +4345,16 @@ ${// Don't expose internal code in production, and keep bundle smaller:
|
|
|
4298
4345
|
`autoDestroyDisabled and destroy` }
|
|
4299
4346
|
`.trim();
|
|
4300
4347
|
var autoDestroyOnDisconnectTimeout = 1e3;
|
|
4348
|
+
var defaultGetterSetter = (value) => value;
|
|
4301
4349
|
|
|
4302
|
-
// src/
|
|
4303
|
-
var
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
const initialExports = instance.exports;
|
|
4307
|
-
Controller.internals.setParentController(ambientControllers.at(-1));
|
|
4308
|
-
const internals = instance.component.manager.internals;
|
|
4309
|
-
internals.markExports(instance, initialExports);
|
|
4310
|
-
instance.watchExports((exports) => internals.markExports(instance, exports));
|
|
4311
|
-
Controller.internals.setAmbientChildController(instance);
|
|
4312
|
-
const hostCandidates = [instance.component, ...ambientControllers].reverse();
|
|
4313
|
-
return internals.trackKey(
|
|
4314
|
-
hostCandidates,
|
|
4315
|
-
(resolution) => resolution === void 0 ? void 0 : setProxy(instance, resolution.host, resolution.key, initialExports),
|
|
4316
|
-
initialExports
|
|
4317
|
-
);
|
|
4318
|
-
};
|
|
4319
|
-
function setProxy(controller, host, key, initialExports) {
|
|
4320
|
-
const genericHost = host;
|
|
4321
|
-
const controllerValueChanged = genericHost[key] !== controller.exports;
|
|
4322
|
-
const hostValueChanged = genericHost[key] !== initialExports;
|
|
4323
|
-
const controllerUpdatedExports = initialExports !== controller.exports;
|
|
4324
|
-
if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports)
|
|
4325
|
-
genericHost[key] = controller.exports;
|
|
4326
|
-
controller.watchExports(() => {
|
|
4327
|
-
if (genericHost[key] === controller.exports)
|
|
4328
|
-
return;
|
|
4329
|
-
const manager = controller.component.manager;
|
|
4330
|
-
const isReadOnly = manager.internals.readonlyProps?.has(key) === true;
|
|
4331
|
-
if (isReadOnly)
|
|
4332
|
-
manager.bypassReadonly(() => {
|
|
4333
|
-
genericHost[key] = controller.exports;
|
|
4334
|
-
});
|
|
4335
|
-
else
|
|
4336
|
-
genericHost[key] = controller.exports;
|
|
4337
|
-
});
|
|
4338
|
-
}
|
|
4339
|
-
|
|
4340
|
-
// src/functional.ts
|
|
4341
|
-
var makeController = (constructor) => proxy(void 0, constructor);
|
|
4342
|
-
var FunctionalController = class extends Controller {
|
|
4343
|
-
constructor(component, constructor) {
|
|
4344
|
-
super(component);
|
|
4345
|
-
const originalExports = this.exports;
|
|
4346
|
-
try {
|
|
4347
|
-
Controller.internals.setAmbientComponent(this.component);
|
|
4348
|
-
const value = constructor(this.component, this);
|
|
4349
|
-
const constructorChangedExports = this.exports !== originalExports;
|
|
4350
|
-
if (value instanceof Promise) {
|
|
4351
|
-
if (!constructorChangedExports)
|
|
4352
|
-
this.setProvisionalExports(value);
|
|
4353
|
-
const resolved = value.then((result) => {
|
|
4354
|
-
this.exports = result;
|
|
4355
|
-
super.catchUpLifecycle();
|
|
4356
|
-
}).catch((error) => {
|
|
4357
|
-
this._ready.reject(error);
|
|
4358
|
-
console.error(error);
|
|
4359
|
-
});
|
|
4360
|
-
this.onLoad(async () => await resolved);
|
|
4361
|
-
} else {
|
|
4362
|
-
if (!constructorChangedExports || value !== void 0)
|
|
4363
|
-
this.exports = value;
|
|
4364
|
-
queueMicrotask(() => super.catchUpLifecycle());
|
|
4365
|
-
}
|
|
4366
|
-
} catch (error) {
|
|
4367
|
-
this._ready.reject(error);
|
|
4368
|
-
console.error(error);
|
|
4369
|
-
}
|
|
4370
|
-
}
|
|
4371
|
-
/** Noop - will be called in the constructor instead */
|
|
4372
|
-
catchUpLifecycle() {
|
|
4373
|
-
return;
|
|
4374
|
-
}
|
|
4375
|
-
};
|
|
4376
|
-
var proxy = proxyExports(FunctionalController);
|
|
4377
|
-
function useT9n({
|
|
4378
|
-
blocking = false,
|
|
4379
|
-
name
|
|
4380
|
-
} = {}) {
|
|
4381
|
-
return makeController((component, controller) => {
|
|
4350
|
+
// src/useT9n.ts
|
|
4351
|
+
var makeT9nController = (getAssetPath) => ({ blocking = false, name } = {}) => (
|
|
4352
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
4353
|
+
makeController((component, controller) => {
|
|
4382
4354
|
controller.onLifecycle(
|
|
4383
4355
|
() => startLocaleObserver(
|
|
4384
4356
|
component.el,
|
|
4385
|
-
|
|
4357
|
+
getAssetPath("./assets"),
|
|
4386
4358
|
({ t9nLocale, t9nStrings, lang }) => {
|
|
4387
4359
|
controller.exports = { ...t9nStrings, _lang: lang, _t9nLocale: t9nLocale };
|
|
4388
4360
|
const label = t9nStrings.componentLabel ?? t9nStrings.widgetLabel;
|
|
@@ -4396,8 +4368,8 @@ function useT9n({
|
|
|
4396
4368
|
return controller.ready;
|
|
4397
4369
|
const locale = getElementLocales(component.el);
|
|
4398
4370
|
return { _lang: locale.lang, _t9nLocale: locale.t9nLocale };
|
|
4399
|
-
})
|
|
4400
|
-
|
|
4371
|
+
})
|
|
4372
|
+
);
|
|
4401
4373
|
|
|
4402
4374
|
function isMonacoEnvironmentSetup() {
|
|
4403
4375
|
return !!window.MonacoEnvironment?.getWorkerUrl;
|
|
@@ -4546,7 +4518,7 @@ async function getArcadeWorker(uri) {
|
|
|
4546
4518
|
* @returns arcade mode module
|
|
4547
4519
|
*/
|
|
4548
4520
|
async function getMode() {
|
|
4549
|
-
return await Promise.resolve().then(function () { return require('./arcade-mode-
|
|
4521
|
+
return await Promise.resolve().then(function () { return require('./arcade-mode-f43455a9.js'); });
|
|
4550
4522
|
}
|
|
4551
4523
|
// Register the language in Monaco
|
|
4552
4524
|
arcadeDefaults.languages.register({
|
|
@@ -4569,6 +4541,8 @@ arcadeDefaults.languages.onLanguage(arcadeDefaults.arcadeDefaults.languageId, ()
|
|
|
4569
4541
|
});
|
|
4570
4542
|
});
|
|
4571
4543
|
|
|
4544
|
+
const useT9n = makeT9nController(index.getAssetPath);
|
|
4545
|
+
|
|
4572
4546
|
const arcadeApiCss = ":host{background-color:var(--calcite-color-foreground-1)}:host .notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}:host .sticky{position:sticky;top:0px;z-index:10}:host calcite-flow{height:100%}:host calcite-block p:first-of-type{margin-top:0}:host calcite-block code{font-family:var(--calcite-code-family)}:host calcite-block pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm)}:host calcite-block pre code{font-size:var(--calcite-font-size--2)}";
|
|
4573
4547
|
|
|
4574
4548
|
const ArcgisArcadeApi = class {
|
|
@@ -5551,11 +5525,11 @@ const ArcgisArcadeSuggestions = class {
|
|
|
5551
5525
|
// #region Component lifecycle events
|
|
5552
5526
|
async componentWillLoad() {
|
|
5553
5527
|
this._colorizeStyle = generateColorizeStyles();
|
|
5554
|
-
this.
|
|
5528
|
+
this._themeChangedListener = onColorizeThemeChanged(() => (this._colorizeStyle = generateColorizeStyles()));
|
|
5555
5529
|
}
|
|
5556
5530
|
disconnectedCallback() {
|
|
5557
5531
|
this._flowObserver?.disconnect();
|
|
5558
|
-
this.
|
|
5532
|
+
this._themeChangedListener?.dispose();
|
|
5559
5533
|
}
|
|
5560
5534
|
// #endregion
|
|
5561
5535
|
//#region Private Methods
|