@arcgis/coding-components 4.30.0-next.86 → 4.30.0-next.88
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-0db53640.js → p-053e6e93.js} +3 -3
- package/dist/arcgis-coding-components/{p-1ba511a8.js → p-05f0fbe3.js} +2 -2
- package/dist/arcgis-coding-components/{p-d8d1153e.js → p-1bde3872.js} +2 -2
- package/dist/arcgis-coding-components/{p-5b38655a.js → p-1ea550b5.js} +2 -2
- package/dist/arcgis-coding-components/{p-f2c8421c.js → p-23a50e40.js} +10 -10
- package/dist/arcgis-coding-components/{p-f59c7154.entry.js → p-57bf8e0d.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-68046b91.js → p-6191a108.js} +1 -1
- package/dist/arcgis-coding-components/{p-ad9d6a5a.js → p-6ff6c6c0.js} +2 -2
- package/dist/arcgis-coding-components/{p-7e1478a2.js → p-75d64e6f.js} +2 -2
- package/dist/arcgis-coding-components/{p-47d25fa3.js → p-83bf0e32.js} +1 -1
- package/dist/arcgis-coding-components/{p-3c5d8cd3.js → p-888440d0.js} +2 -2
- package/dist/arcgis-coding-components/{p-fc702ab7.js → p-b95fad89.js} +2 -2
- package/dist/cjs/{arcade-defaults-4357da16.js → arcade-defaults-4c87490b.js} +20 -15
- package/dist/cjs/{arcade-mode-b295bb2e.js → arcade-mode-0473fc46.js} +3 -3
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +204 -113
- package/dist/cjs/arcgis-coding-components.cjs.js +2 -2
- package/dist/cjs/{css-828ddedd.js → css-51805364.js} +1 -1
- package/dist/cjs/{cssMode-65f8f225.js → cssMode-4db3375d.js} +3 -3
- package/dist/cjs/{html-28008895.js → html-98fcc6e0.js} +3 -3
- package/dist/cjs/{htmlMode-69e0582f.js → htmlMode-08e8d082.js} +3 -3
- package/dist/cjs/{index-e7fa55cc.js → index-a0f77388.js} +1 -1
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/{javascript-379650c7.js → javascript-caafa8ac.js} +4 -4
- package/dist/cjs/{jsonMode-9fa9d9ff.js → jsonMode-9eb31d7e.js} +3 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{tsMode-00270b0b.js → tsMode-fbfa0c20.js} +3 -3
- package/dist/cjs/{typescript-39ee883b.js → typescript-fb309e4d.js} +3 -3
- package/dist/components/arcade-api.js +4 -3
- package/dist/components/arcade-contribution.js +1 -1
- package/dist/components/arcade-defaults.js +1 -1
- package/dist/components/arcade-mode.js +1 -1
- package/dist/components/arcade-results.js +2 -2
- package/dist/components/arcade-suggestions.js +2 -2
- package/dist/components/arcade-variables.js +2 -2
- package/dist/components/arcgis-arcade-api.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +2 -2
- 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-63RMNUHL.js → chunk-IHYYRFLQ.js} +195 -107
- package/dist/components/code-editor.js +2 -2
- package/dist/components/fields.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +11 -6
- package/dist/components/markdown.js +1 -1
- package/dist/components/useT9n.js +6 -4
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{arcade-defaults-38301b95.js → arcade-defaults-72b210ad.js} +20 -15
- package/dist/esm/{arcade-mode-033894f1.js → arcade-mode-2c605ffa.js} +3 -3
- package/dist/esm/arcgis-arcade-api_6.entry.js +204 -113
- package/dist/esm/arcgis-coding-components.js +3 -3
- package/dist/esm/{css-40412441.js → css-db024e9d.js} +1 -1
- package/dist/esm/{cssMode-43027199.js → cssMode-d5d91343.js} +3 -3
- package/dist/esm/{html-7b9cf209.js → html-d6a9fdc6.js} +3 -3
- package/dist/esm/{htmlMode-4ebaceee.js → htmlMode-e55abc8e.js} +3 -3
- package/dist/esm/{index-3a25748f.js → index-5d6d5640.js} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/{javascript-46a169f9.js → javascript-07e29cbd.js} +4 -4
- package/dist/esm/{jsonMode-a84e7059.js → jsonMode-d9eb7871.js} +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{tsMode-eead2094.js → tsMode-a8ddfcae.js} +3 -3
- package/dist/esm/{typescript-953aa066.js → typescript-4bd853ce.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/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +3 -0
- package/package.json +9 -9
- package/dist/types/data/arcgis-web-compoments/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +0 -3
- /package/dist/types/data/{arcgis-web-compoments/actions-runner-1 → 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/{arcgis-web-compoments/actions-runner-1 → actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +0 -0
- /package/dist/types/data/{arcgis-web-compoments/actions-runner-1 → 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/{arcgis-web-compoments/actions-runner-1 → 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
- /package/dist/types/data/{arcgis-web-compoments/actions-runner-1 → actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-inline-url-importer.d.ts +0 -0
- /package/dist/types/data/{arcgis-web-compoments/actions-runner-1 → actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-json-importer.d.ts +0 -0
- /package/dist/types/data/{arcgis-web-compoments/actions-runner-1 → actions-runner-1}/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/stencil-monaco-plugins.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
|
-
* v4.30.0-next.
|
|
4
|
+
* v4.30.0-next.88
|
|
5
5
|
*/
|
|
6
6
|
import { D as Deferred, g as camelToKebab, h as safeCall, j as safeAsyncCall, k as devToolsAwareTimeout } from './index2.js';
|
|
7
7
|
|
|
@@ -21,26 +21,29 @@ function retrieveComponentMembers(component, isLit) {
|
|
|
21
21
|
const constructor = component.constructor;
|
|
22
22
|
const members = constructor.__registerControllers?.(component) ?? void 0;
|
|
23
23
|
constructor.__registerControllers = void 0;
|
|
24
|
-
if (typeof members !== "object")
|
|
24
|
+
if (typeof members !== "object") {
|
|
25
25
|
throw new Error(
|
|
26
26
|
"Failed to retrieve internal component meta. Make sure you have the useComponentsControllers() Rollup Plugin for Stencil Controllers configured in your Stencil config."
|
|
27
27
|
);
|
|
28
|
+
}
|
|
28
29
|
component.manager.internals.members = members;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
var getLitProperties = (component) => component.constructor.elementProperties;
|
|
32
33
|
function parsePropertyValue(value, type = 8 /* Any */) {
|
|
33
34
|
const isComplex = value == null || typeof value === "object" || typeof value === "function";
|
|
34
|
-
if (isComplex)
|
|
35
|
+
if (isComplex) {
|
|
35
36
|
return value;
|
|
36
|
-
|
|
37
|
+
}
|
|
38
|
+
if ((type & 4 /* Boolean */) !== 0) {
|
|
37
39
|
return value === "false" ? false : value === "" || !!value;
|
|
38
|
-
else if ((type & 2 /* Number */) !== 0)
|
|
40
|
+
} else if ((type & 2 /* Number */) !== 0) {
|
|
39
41
|
return Number.parseFloat(value);
|
|
40
|
-
else if ((type & 1 /* String */) !== 0)
|
|
42
|
+
} else if ((type & 1 /* String */) !== 0) {
|
|
41
43
|
return String(value);
|
|
42
|
-
else
|
|
44
|
+
} else {
|
|
43
45
|
return value;
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
48
|
var makeMemberFilter = (filter) => (component) => {
|
|
46
49
|
const members = component.manager.internals.members;
|
|
@@ -50,12 +53,13 @@ var getPropLikeMembers = makeMemberFilter(63 /* PropLike */);
|
|
|
50
53
|
var getMemberType = (component, name) => component.manager.internals.members?.[name]?.[0];
|
|
51
54
|
function getPropType(component, name) {
|
|
52
55
|
const type = getMemberType(component, name);
|
|
53
|
-
if (type === void 0)
|
|
56
|
+
if (type === void 0) {
|
|
54
57
|
return void 0;
|
|
55
|
-
else if (type & 32 /* State */)
|
|
58
|
+
} else if (type & 32 /* State */) {
|
|
56
59
|
return "state";
|
|
57
|
-
else
|
|
60
|
+
} else {
|
|
58
61
|
return "prop";
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
// src/types.ts
|
|
@@ -80,14 +84,17 @@ var ControllerInternals = class {
|
|
|
80
84
|
const error = new Error(
|
|
81
85
|
`Unable to resolve a controller from the provided value, so can't watch it's exports. ${unresolvableExports}`
|
|
82
86
|
);
|
|
83
|
-
|
|
87
|
+
{
|
|
88
|
+
console.error(error);
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
91
|
return value;
|
|
86
92
|
}
|
|
87
93
|
await controller.ready;
|
|
88
94
|
if (typeof watchExports === "function") {
|
|
89
|
-
if (controller.watchExports === void 0)
|
|
95
|
+
if (controller.watchExports === void 0) {
|
|
90
96
|
throw new Error(`The controller must implement watchExports method to support watching exports`);
|
|
97
|
+
}
|
|
91
98
|
const unsubscribe = controller.watchExports(
|
|
92
99
|
(exports) => watchExports(exports, unsubscribe)
|
|
93
100
|
);
|
|
@@ -96,21 +103,25 @@ var ControllerInternals = class {
|
|
|
96
103
|
};
|
|
97
104
|
this.useRef = async (value) => {
|
|
98
105
|
const controller = this.useRefSync(value);
|
|
99
|
-
if (controller === void 0)
|
|
106
|
+
if (controller === void 0) {
|
|
100
107
|
throw new Error(`Unable to resolve a controller from the provided value. ${unresolvableExports}`);
|
|
108
|
+
}
|
|
101
109
|
await controller.ready;
|
|
102
110
|
return controller;
|
|
103
111
|
};
|
|
104
112
|
this.useRefSync = (value) => {
|
|
105
113
|
const ambientChildController = this.retrieveAmbientChildController();
|
|
106
|
-
if (ambientChildController !== void 0)
|
|
114
|
+
if (ambientChildController !== void 0) {
|
|
107
115
|
return ambientChildController;
|
|
116
|
+
}
|
|
108
117
|
const component = Controller.internals.retrieveComponent();
|
|
109
118
|
const controller = component.manager.internals.resolveExports(value);
|
|
110
|
-
if (controller !== void 0)
|
|
119
|
+
if (controller !== void 0) {
|
|
111
120
|
return controller;
|
|
112
|
-
|
|
121
|
+
}
|
|
122
|
+
if (isController(value)) {
|
|
113
123
|
return value;
|
|
124
|
+
}
|
|
114
125
|
return void 0;
|
|
115
126
|
};
|
|
116
127
|
this.shouldBypassSetter = false;
|
|
@@ -128,16 +139,18 @@ var ControllerInternals = class {
|
|
|
128
139
|
* improve DX (avoids the need to pass "this" explicitly for each controller)
|
|
129
140
|
*/
|
|
130
141
|
setAmbientComponent(component) {
|
|
131
|
-
if (this._ambientComponent === component)
|
|
142
|
+
if (this._ambientComponent === component) {
|
|
132
143
|
return;
|
|
144
|
+
}
|
|
133
145
|
this._ambientComponent = component;
|
|
134
146
|
queueMicrotask(() => {
|
|
135
|
-
if (this._ambientComponent === component)
|
|
147
|
+
if (this._ambientComponent === component) {
|
|
136
148
|
this._ambientComponent = void 0;
|
|
149
|
+
}
|
|
137
150
|
});
|
|
138
151
|
}
|
|
139
152
|
retrieveComponent(name) {
|
|
140
|
-
if (this._ambientComponent === void 0)
|
|
153
|
+
if (this._ambientComponent === void 0) {
|
|
141
154
|
throw new Error(
|
|
142
155
|
[
|
|
143
156
|
`Unable to find out which component ${name || "this"} controller `,
|
|
@@ -153,6 +166,7 @@ var ControllerInternals = class {
|
|
|
153
166
|
"You might also have multiple instances of Controllers loaded"
|
|
154
167
|
].join("\n")
|
|
155
168
|
);
|
|
169
|
+
}
|
|
156
170
|
return this._ambientComponent;
|
|
157
171
|
}
|
|
158
172
|
/*
|
|
@@ -177,12 +191,14 @@ var ControllerInternals = class {
|
|
|
177
191
|
* controller exports, rather than the controller itself
|
|
178
192
|
*/
|
|
179
193
|
setAmbientChildController(controller) {
|
|
180
|
-
if (this._ambientChildController === controller)
|
|
194
|
+
if (this._ambientChildController === controller) {
|
|
181
195
|
return;
|
|
196
|
+
}
|
|
182
197
|
this._ambientChildController = controller;
|
|
183
198
|
queueMicrotask(() => {
|
|
184
|
-
if (this._ambientChildController === controller)
|
|
199
|
+
if (this._ambientChildController === controller) {
|
|
185
200
|
this._ambientChildController = void 0;
|
|
201
|
+
}
|
|
186
202
|
});
|
|
187
203
|
}
|
|
188
204
|
retrieveAmbientChildController() {
|
|
@@ -236,12 +252,14 @@ var _Controller = class _Controller {
|
|
|
236
252
|
});
|
|
237
253
|
this.component.addController(this);
|
|
238
254
|
_Controller.internals.setParentController(this);
|
|
239
|
-
if ("hostDestroy" in this)
|
|
255
|
+
if ("hostDestroy" in this) {
|
|
240
256
|
this.component.manager.ensureHasDestroy();
|
|
257
|
+
}
|
|
241
258
|
const manager = this.component.manager;
|
|
242
259
|
const isInControllerManager = manager === void 0;
|
|
243
|
-
if (!isInControllerManager)
|
|
260
|
+
if (!isInControllerManager) {
|
|
244
261
|
queueMicrotask(() => this.catchUpLifecycle());
|
|
262
|
+
}
|
|
245
263
|
}
|
|
246
264
|
/**
|
|
247
265
|
* If controller is being added dynamically, after the component
|
|
@@ -250,15 +268,18 @@ var _Controller = class _Controller {
|
|
|
250
268
|
catchUpLifecycle() {
|
|
251
269
|
const { manager } = this.component;
|
|
252
270
|
const connectedWillStillHappen = !manager.connectedCalled;
|
|
253
|
-
if (!connectedWillStillHappen && !this.connectedCalled)
|
|
271
|
+
if (!connectedWillStillHappen && !this.connectedCalled) {
|
|
254
272
|
this.triggerConnected();
|
|
273
|
+
}
|
|
255
274
|
const loadWillStillHappen = !manager.willLoadCalled;
|
|
256
|
-
if (loadWillStillHappen)
|
|
275
|
+
if (loadWillStillHappen) {
|
|
257
276
|
return;
|
|
277
|
+
}
|
|
258
278
|
this.triggerLoad().then(() => {
|
|
259
279
|
const loadedWillStillHappen = !manager.didLoadCalled;
|
|
260
|
-
if (loadedWillStillHappen)
|
|
280
|
+
if (loadedWillStillHappen) {
|
|
261
281
|
return;
|
|
282
|
+
}
|
|
262
283
|
this.triggerLoaded();
|
|
263
284
|
}).catch(console.error);
|
|
264
285
|
}
|
|
@@ -273,8 +294,9 @@ var _Controller = class _Controller {
|
|
|
273
294
|
set exports(exports) {
|
|
274
295
|
if (this._exports !== exports) {
|
|
275
296
|
this._exports = exports;
|
|
276
|
-
if (this.connectedCalled)
|
|
297
|
+
if (this.connectedCalled) {
|
|
277
298
|
this.component.requestUpdate();
|
|
299
|
+
}
|
|
278
300
|
this._exportWatchers.forEach(safeCall);
|
|
279
301
|
}
|
|
280
302
|
this._ready.resolve(exports);
|
|
@@ -430,10 +452,11 @@ var _Controller = class _Controller {
|
|
|
430
452
|
watch(property, callback) {
|
|
431
453
|
var _a2;
|
|
432
454
|
const type = getMemberType(this.component, property);
|
|
433
|
-
if (type === void 0)
|
|
455
|
+
if (type === void 0) {
|
|
434
456
|
throw new Error(
|
|
435
457
|
`Trying to watch a non-@property, non-@state property "${property}". Either convert it into a @state() or use get/set syntax`
|
|
436
458
|
);
|
|
459
|
+
}
|
|
437
460
|
const internals = this.component.manager.internals;
|
|
438
461
|
(_a2 = internals.allWatchers)[property] ?? (_a2[property] = []);
|
|
439
462
|
const watchers = internals.allWatchers[property];
|
|
@@ -442,13 +465,15 @@ var _Controller = class _Controller {
|
|
|
442
465
|
watchers.push(safeCallback);
|
|
443
466
|
return () => {
|
|
444
467
|
const index = watchers.indexOf(safeCallback);
|
|
445
|
-
if (index !== -1)
|
|
468
|
+
if (index !== -1) {
|
|
446
469
|
watchers.splice(index, 1);
|
|
470
|
+
}
|
|
447
471
|
};
|
|
448
472
|
}
|
|
449
473
|
controllerRemoved() {
|
|
450
|
-
if (this.component.el.isConnected)
|
|
474
|
+
if (this.component.el.isConnected) {
|
|
451
475
|
this.triggerDisconnected();
|
|
476
|
+
}
|
|
452
477
|
this.triggerDestroy();
|
|
453
478
|
}
|
|
454
479
|
// Register a lifecycle callback
|
|
@@ -476,68 +501,80 @@ var _Controller = class _Controller {
|
|
|
476
501
|
}
|
|
477
502
|
onLifecycle(callback) {
|
|
478
503
|
this._callbacks.hostLifecycle.push(callback);
|
|
479
|
-
if (this.connectedCalled && this.component.el.isConnected)
|
|
504
|
+
if (this.connectedCalled && this.component.el.isConnected) {
|
|
480
505
|
this._callLifecycle(callback);
|
|
506
|
+
}
|
|
481
507
|
}
|
|
482
508
|
// Call each lifecycle hook
|
|
483
509
|
triggerConnected() {
|
|
484
510
|
const genericController = this;
|
|
485
|
-
if (genericController.hostConnected)
|
|
511
|
+
if (genericController.hostConnected) {
|
|
486
512
|
safeCall(genericController.hostConnected, genericController);
|
|
513
|
+
}
|
|
487
514
|
this._callbacks.hostConnected.forEach(safeCall);
|
|
488
515
|
this.triggerLifecycle();
|
|
489
516
|
this.connectedCalled = true;
|
|
490
517
|
}
|
|
491
518
|
triggerDisconnected() {
|
|
492
519
|
const genericController = this;
|
|
493
|
-
if (genericController.hostDisconnected)
|
|
520
|
+
if (genericController.hostDisconnected) {
|
|
494
521
|
safeCall(genericController.hostDisconnected, genericController);
|
|
522
|
+
}
|
|
495
523
|
this._callbacks.hostDisconnected.forEach(safeCall);
|
|
496
524
|
this._lifecycleDisconnected.forEach(safeCall);
|
|
497
525
|
this._lifecycleDisconnected = [];
|
|
498
526
|
}
|
|
499
527
|
async triggerLoad() {
|
|
500
|
-
if (this.willLoadCalled)
|
|
528
|
+
if (this.willLoadCalled) {
|
|
501
529
|
return;
|
|
530
|
+
}
|
|
502
531
|
this.willLoadCalled = true;
|
|
503
532
|
const genericController = this;
|
|
504
|
-
if (genericController.hostLoad)
|
|
533
|
+
if (genericController.hostLoad) {
|
|
505
534
|
await safeAsyncCall(genericController.hostLoad, genericController);
|
|
506
|
-
|
|
535
|
+
}
|
|
536
|
+
if (this._callbacks.hostLoad.length > 0) {
|
|
507
537
|
await Promise.allSettled(this._callbacks.hostLoad.map(safeAsyncCall));
|
|
538
|
+
}
|
|
508
539
|
this._ready.resolve(this._exports);
|
|
509
540
|
}
|
|
510
541
|
triggerLoaded() {
|
|
511
|
-
if (this.didLoadCalled)
|
|
542
|
+
if (this.didLoadCalled) {
|
|
512
543
|
return;
|
|
544
|
+
}
|
|
513
545
|
const genericController = this;
|
|
514
|
-
if (genericController.hostLoaded)
|
|
546
|
+
if (genericController.hostLoaded) {
|
|
515
547
|
safeCall(genericController.hostLoaded, genericController);
|
|
548
|
+
}
|
|
516
549
|
this._callbacks.hostLoaded.forEach(safeCall);
|
|
517
550
|
this.didLoadCalled = true;
|
|
518
551
|
}
|
|
519
552
|
triggerUpdate() {
|
|
520
553
|
const genericController = this;
|
|
521
|
-
if (genericController.hostUpdate)
|
|
554
|
+
if (genericController.hostUpdate) {
|
|
522
555
|
safeCall(genericController.hostUpdate, genericController);
|
|
556
|
+
}
|
|
523
557
|
this._callbacks.hostUpdate.forEach(safeCall);
|
|
524
558
|
}
|
|
525
559
|
triggerUpdated() {
|
|
526
560
|
const genericController = this;
|
|
527
|
-
if (genericController.hostUpdated)
|
|
561
|
+
if (genericController.hostUpdated) {
|
|
528
562
|
safeCall(genericController.hostUpdated, genericController);
|
|
563
|
+
}
|
|
529
564
|
this._callbacks.hostUpdated.forEach(safeCall);
|
|
530
565
|
}
|
|
531
566
|
triggerDestroy() {
|
|
532
567
|
const genericController = this;
|
|
533
|
-
if (genericController.hostDestroy)
|
|
568
|
+
if (genericController.hostDestroy) {
|
|
534
569
|
safeCall(genericController.hostDestroy, genericController);
|
|
570
|
+
}
|
|
535
571
|
this._callbacks.hostDestroy.forEach(safeCall);
|
|
536
572
|
}
|
|
537
573
|
triggerLifecycle() {
|
|
538
574
|
const genericController = this;
|
|
539
|
-
if (genericController.hostLifecycle)
|
|
575
|
+
if (genericController.hostLifecycle) {
|
|
540
576
|
this._callLifecycle(() => genericController.hostLifecycle());
|
|
577
|
+
}
|
|
541
578
|
this._callbacks.hostLifecycle.forEach((callback) => this._callLifecycle(callback));
|
|
542
579
|
}
|
|
543
580
|
_callLifecycle(callback) {
|
|
@@ -545,10 +582,11 @@ var _Controller = class _Controller {
|
|
|
545
582
|
const cleanupRaw = safeCall(callback);
|
|
546
583
|
const cleanup = Array.isArray(cleanupRaw) ? cleanupRaw : [cleanupRaw];
|
|
547
584
|
cleanup.forEach((cleanup2) => {
|
|
548
|
-
if (typeof cleanup2 === "function")
|
|
585
|
+
if (typeof cleanup2 === "function") {
|
|
549
586
|
this._lifecycleDisconnected.push(cleanup2);
|
|
550
|
-
else if (typeof cleanup2 === "object" && typeof cleanup2.remove === "function")
|
|
587
|
+
} else if (typeof cleanup2 === "object" && typeof cleanup2.remove === "function") {
|
|
551
588
|
this._lifecycleDisconnected.push(cleanup2.remove);
|
|
589
|
+
}
|
|
552
590
|
});
|
|
553
591
|
}
|
|
554
592
|
};
|
|
@@ -572,14 +610,17 @@ var GenericController = class extends Controller {
|
|
|
572
610
|
}
|
|
573
611
|
};
|
|
574
612
|
function makeProvisionalValue(base) {
|
|
575
|
-
if (typeof base !== "object" && typeof base !== "function" || base === null)
|
|
613
|
+
if (typeof base !== "object" && typeof base !== "function" || base === null) {
|
|
576
614
|
return base;
|
|
615
|
+
}
|
|
577
616
|
const proxy2 = new Proxy(base, {
|
|
578
617
|
get(target, prop, receiver) {
|
|
579
|
-
if (cyclical.has(prop) && prop in target && target[prop] === proxy2)
|
|
618
|
+
if (cyclical.has(prop) && prop in target && target[prop] === proxy2) {
|
|
580
619
|
return void 0;
|
|
581
|
-
|
|
620
|
+
}
|
|
621
|
+
if (prop in target || prop in Promise.prototype || typeof prop === "symbol") {
|
|
582
622
|
return typeof target === "function" ? target[prop] : Reflect.get(target, prop, receiver);
|
|
623
|
+
}
|
|
583
624
|
console.error(`Trying to access "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
|
|
584
625
|
return void 0;
|
|
585
626
|
},
|
|
@@ -593,19 +634,21 @@ function makeProvisionalValue(base) {
|
|
|
593
634
|
var cyclical = /* @__PURE__ */ new Set(["exports", "_exports"]);
|
|
594
635
|
var accessBeforeLoad = "" ;
|
|
595
636
|
function toControllerHost(component) {
|
|
596
|
-
if ("addController" in component)
|
|
637
|
+
if ("addController" in component) {
|
|
597
638
|
return component;
|
|
598
|
-
else
|
|
639
|
+
} else {
|
|
599
640
|
throw new Error(
|
|
600
641
|
"Component does not implement ControllerHost. This might be because you forgot to add 'manager: Controller<this> = useControllerManager(this);' in your component, or you tried to use some controller before that line"
|
|
601
642
|
);
|
|
643
|
+
}
|
|
602
644
|
}
|
|
603
645
|
var ignoreSet = (_, value) => value;
|
|
604
646
|
function trackPropertyKey(object, onResolved, defaultValue) {
|
|
605
647
|
const keys = Object.keys(object);
|
|
606
648
|
const keyCount = keys.length;
|
|
607
|
-
if (keyTrackMap === void 0)
|
|
649
|
+
if (keyTrackMap === void 0) {
|
|
608
650
|
queueMicrotask(keyTrackResolve);
|
|
651
|
+
}
|
|
609
652
|
keyTrackMap ?? (keyTrackMap = /* @__PURE__ */ new Map());
|
|
610
653
|
let pendingTrackers = keyTrackMap.get(object);
|
|
611
654
|
if (pendingTrackers === void 0) {
|
|
@@ -620,12 +663,13 @@ function trackPropertyKey(object, onResolved, defaultValue) {
|
|
|
620
663
|
pendingTrackers.callbacks.push((keys2) => {
|
|
621
664
|
const callback = (key2) => safeCall(onResolved, null, key2);
|
|
622
665
|
const key = keys2[keyCount];
|
|
623
|
-
if (key === void 0)
|
|
666
|
+
if (key === void 0) {
|
|
624
667
|
callback(void 0);
|
|
625
|
-
else if (object[key] === defaultValue)
|
|
668
|
+
} else if (object[key] === defaultValue) {
|
|
626
669
|
callback(key);
|
|
627
|
-
else
|
|
670
|
+
} else {
|
|
628
671
|
callback(void 0);
|
|
672
|
+
}
|
|
629
673
|
});
|
|
630
674
|
return defaultValue;
|
|
631
675
|
}
|
|
@@ -656,10 +700,12 @@ var ComponentInternals = class {
|
|
|
656
700
|
let leftToResolve = candidateHosts.length + 1;
|
|
657
701
|
const resolved = (resolution) => {
|
|
658
702
|
leftToResolve -= 1;
|
|
659
|
-
if (resolution !== void 0)
|
|
703
|
+
if (resolution !== void 0) {
|
|
660
704
|
leftToResolve = 0;
|
|
661
|
-
|
|
705
|
+
}
|
|
706
|
+
if (leftToResolve === 0) {
|
|
662
707
|
onResolved(resolution);
|
|
708
|
+
}
|
|
663
709
|
};
|
|
664
710
|
candidateHosts.forEach(
|
|
665
711
|
(host) => this.component.manager.trackPropertyKey(
|
|
@@ -689,10 +735,12 @@ var ComponentInternals = class {
|
|
|
689
735
|
return defaultValue;
|
|
690
736
|
};
|
|
691
737
|
this.trackPropKey = (onResolved, defaultValue) => {
|
|
692
|
-
if (this._trackedValue !== nothing && this._trackedValue !== defaultValue)
|
|
738
|
+
if (this._trackedValue !== nothing && this._trackedValue !== defaultValue) {
|
|
693
739
|
this._firePropertyTrackers(void 0, void 0, void 0);
|
|
694
|
-
|
|
740
|
+
}
|
|
741
|
+
if (this._keyTrackers.length === 0) {
|
|
695
742
|
queueMicrotask(() => this._firePropertyTrackers(void 0, void 0, void 0));
|
|
743
|
+
}
|
|
696
744
|
this._trackedValue = defaultValue;
|
|
697
745
|
this._keyTrackers.push(
|
|
698
746
|
(key, value, previousValue) => safeCall(onResolved, void 0, defaultValue === value ? key : void 0, previousValue)
|
|
@@ -733,43 +781,50 @@ var ComponentInternals = class {
|
|
|
733
781
|
const component = this.component;
|
|
734
782
|
const classPrototype = component.constructor.prototype;
|
|
735
783
|
this._getSetProxy(classPrototype, property, hasGetter, hasSetter, "class");
|
|
736
|
-
if (component.manager.isLit)
|
|
784
|
+
if (component.manager.isLit) {
|
|
737
785
|
return;
|
|
786
|
+
}
|
|
738
787
|
const htmlPrototype = component.el.constructor.prototype;
|
|
739
|
-
if (classPrototype !== htmlPrototype)
|
|
788
|
+
if (classPrototype !== htmlPrototype) {
|
|
740
789
|
this._getSetProxy(htmlPrototype, property, hasGetter, hasSetter, "html");
|
|
790
|
+
}
|
|
741
791
|
}
|
|
742
792
|
_getSetProxy(prototype, name, hasGetter, hasSetter, type) {
|
|
743
793
|
const component = this.component;
|
|
744
794
|
const propType = getMemberType(component, name);
|
|
745
795
|
const descriptor = Object.getOwnPropertyDescriptor(prototype, name);
|
|
746
796
|
const tolerateNotFound = type === "html";
|
|
747
|
-
if (descriptor?.set === void 0 || descriptor.get === void 0)
|
|
748
|
-
if (descriptor !== void 0 && "value" in descriptor)
|
|
797
|
+
if (descriptor?.set === void 0 || descriptor.get === void 0) {
|
|
798
|
+
if (descriptor !== void 0 && "value" in descriptor) {
|
|
749
799
|
throw new Error(
|
|
750
800
|
`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}`
|
|
751
801
|
);
|
|
752
|
-
else if (tolerateNotFound)
|
|
802
|
+
} else if (tolerateNotFound) {
|
|
753
803
|
return;
|
|
754
|
-
else
|
|
804
|
+
} else {
|
|
755
805
|
throw new Error(`Unable to find "${name}" property on the ${component.el.tagName} component`);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
756
808
|
const { get: originalGet, set: originalSet } = descriptor;
|
|
757
809
|
const isGetterAlreadyOverwritten = customAccessor in originalGet;
|
|
758
810
|
const isSetterAlreadyOverwritten = customAccessor in originalSet;
|
|
759
811
|
const shouldOverwriteGet = !isGetterAlreadyOverwritten && hasGetter;
|
|
760
812
|
const shouldOverwriteSet = !isSetterAlreadyOverwritten && hasSetter;
|
|
761
|
-
if (!shouldOverwriteGet && !shouldOverwriteSet)
|
|
813
|
+
if (!shouldOverwriteGet && !shouldOverwriteSet) {
|
|
762
814
|
return;
|
|
815
|
+
}
|
|
763
816
|
const finalGetter = shouldOverwriteGet ? function getter() {
|
|
764
817
|
let value = originalGet.call(this);
|
|
765
818
|
const component2 = Controller.internals.elementToInstance.get(this);
|
|
766
|
-
if (Controller.internals.shouldBypassGetter || component2 === void 0)
|
|
819
|
+
if (Controller.internals.shouldBypassGetter || component2 === void 0) {
|
|
767
820
|
return value;
|
|
821
|
+
}
|
|
768
822
|
const internals = component2.manager.internals;
|
|
769
823
|
value = internals.accessorGetter[name](value, name);
|
|
770
824
|
const getters = internals.getters[name] ?? emptyArray;
|
|
771
|
-
for (let i = 0; i < getters.length; i++)
|
|
825
|
+
for (let i = 0; i < getters.length; i++) {
|
|
772
826
|
value = getters[i](value, name);
|
|
827
|
+
}
|
|
773
828
|
return value;
|
|
774
829
|
} : originalGet;
|
|
775
830
|
const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
|
|
@@ -781,27 +836,32 @@ var ComponentInternals = class {
|
|
|
781
836
|
}
|
|
782
837
|
let newValue = component2.manager.isLit ? rawNewValue : parsePropertyValue(rawNewValue, propType);
|
|
783
838
|
const internals = component2.manager.internals;
|
|
784
|
-
if (newValue === oldValue)
|
|
839
|
+
if (newValue === oldValue) {
|
|
785
840
|
originalSet.call(this, rawNewValue);
|
|
786
|
-
else {
|
|
841
|
+
} else {
|
|
787
842
|
const setters = Controller.internals.shouldBypassSetter ? emptyArray : internals.setters[name] ?? emptyArray;
|
|
788
843
|
for (let i = 0; i < setters.length; i++) {
|
|
789
844
|
newValue = setters[i](newValue, oldValue, name);
|
|
790
|
-
if (newValue === oldValue)
|
|
845
|
+
if (newValue === oldValue) {
|
|
791
846
|
break;
|
|
847
|
+
}
|
|
792
848
|
}
|
|
793
849
|
newValue = internals.accessorSetter[name](newValue, oldValue, name);
|
|
794
850
|
originalSet.call(this, newValue);
|
|
795
|
-
if (newValue !== oldValue)
|
|
851
|
+
if (newValue !== oldValue) {
|
|
796
852
|
internals.enabledWatchers[name]?.forEach((watcher) => watcher(newValue, oldValue, name));
|
|
853
|
+
}
|
|
797
854
|
}
|
|
798
|
-
if (internals._keyTrackers.length > 0)
|
|
855
|
+
if (internals._keyTrackers.length > 0) {
|
|
799
856
|
internals?._firePropertyTrackers(name, rawNewValue, oldValue);
|
|
857
|
+
}
|
|
800
858
|
} : originalSet;
|
|
801
|
-
if (shouldOverwriteGet)
|
|
859
|
+
if (shouldOverwriteGet) {
|
|
802
860
|
Object.defineProperty(finalGetter, customAccessor, { value: true });
|
|
803
|
-
|
|
861
|
+
}
|
|
862
|
+
if (shouldOverwriteSet) {
|
|
804
863
|
Object.defineProperty(finalSetter, customAccessor, { value: true });
|
|
864
|
+
}
|
|
805
865
|
Object.defineProperty(prototype, name, {
|
|
806
866
|
...descriptor,
|
|
807
867
|
get: finalGetter,
|
|
@@ -813,14 +873,16 @@ var ComponentInternals = class {
|
|
|
813
873
|
* controller.use
|
|
814
874
|
*/
|
|
815
875
|
markExports(controller, exports) {
|
|
816
|
-
if (typeof exports === "object" && exports !== null || typeof exports === "function")
|
|
876
|
+
if (typeof exports === "object" && exports !== null || typeof exports === "function") {
|
|
817
877
|
this._exports.set(exports, controller);
|
|
878
|
+
}
|
|
818
879
|
}
|
|
819
880
|
resolveExports(exports) {
|
|
820
|
-
if (typeof exports === "object" && exports !== null || typeof exports === "function")
|
|
881
|
+
if (typeof exports === "object" && exports !== null || typeof exports === "function") {
|
|
821
882
|
return this._exports.get(exports);
|
|
822
|
-
else
|
|
883
|
+
} else {
|
|
823
884
|
return void 0;
|
|
885
|
+
}
|
|
824
886
|
}
|
|
825
887
|
};
|
|
826
888
|
var emptyArray = [];
|
|
@@ -833,8 +895,9 @@ var ControllerManager = class extends GenericController {
|
|
|
833
895
|
const controllers = /* @__PURE__ */ new Set();
|
|
834
896
|
function addController(controller) {
|
|
835
897
|
controllers.add(controller);
|
|
836
|
-
if (isLit && !(controllerSymbol in controller) && component.el.isConnected)
|
|
898
|
+
if (isLit && !(controllerSymbol in controller) && component.el.isConnected) {
|
|
837
899
|
controller.hostConnected?.();
|
|
900
|
+
}
|
|
838
901
|
}
|
|
839
902
|
function removeController(controller) {
|
|
840
903
|
void controllers.delete(controller);
|
|
@@ -896,21 +959,24 @@ var ControllerManager = class extends GenericController {
|
|
|
896
959
|
*/
|
|
897
960
|
this.trackKey = this.internals.trackKey;
|
|
898
961
|
this._readonlySetter = (newValue, oldValue, property) => {
|
|
899
|
-
if (Controller.internals.shouldBypassReadonly)
|
|
962
|
+
if (Controller.internals.shouldBypassReadonly) {
|
|
900
963
|
return newValue;
|
|
964
|
+
}
|
|
901
965
|
const component = this.component;
|
|
902
966
|
const isProp = getPropType(component, property) === "prop";
|
|
903
967
|
if (isProp) {
|
|
904
968
|
if (this.isLit) {
|
|
905
969
|
const details = getLitProperties(component).get(property);
|
|
906
|
-
if (details && details?.attribute !== false)
|
|
970
|
+
if (details && details?.attribute !== false) {
|
|
907
971
|
component.el.setAttribute(
|
|
908
972
|
typeof details.attribute === "string" ? details.attribute : camelToKebab(property),
|
|
909
973
|
// Not using converter.toAttribute to keep this unlikely case simpler
|
|
910
974
|
String(oldValue)
|
|
911
975
|
);
|
|
912
|
-
|
|
976
|
+
}
|
|
977
|
+
} else {
|
|
913
978
|
component.requestUpdate();
|
|
979
|
+
}
|
|
914
980
|
}
|
|
915
981
|
throw new Error(
|
|
916
982
|
`Cannot assign to read-only property "${property}" of ${component.el.tagName.toLowerCase()}. Trying to assign "${String(
|
|
@@ -932,13 +998,15 @@ var ControllerManager = class extends GenericController {
|
|
|
932
998
|
this._controllers = controllers;
|
|
933
999
|
this.exports = void 0;
|
|
934
1000
|
this.hasDestroy = "autoDestroyDisabled" in this.component && typeof this.component.destroy === "function";
|
|
935
|
-
if (this.hasDestroy)
|
|
1001
|
+
if (this.hasDestroy) {
|
|
936
1002
|
this.watch("autoDestroyDisabled", () => this._autoDestroyDisabledWatcher());
|
|
1003
|
+
}
|
|
937
1004
|
this._bindLifecycleMethods();
|
|
938
|
-
if (!isLit)
|
|
1005
|
+
if (!isLit) {
|
|
939
1006
|
Object.defineProperty(component, "updateComplete", {
|
|
940
1007
|
get: async () => await this._updatePromise.promise
|
|
941
1008
|
});
|
|
1009
|
+
}
|
|
942
1010
|
const members = getPropLikeMembers(component);
|
|
943
1011
|
const internals = component.manager.internals;
|
|
944
1012
|
members.forEach((name) => {
|
|
@@ -968,7 +1036,7 @@ var ControllerManager = class extends GenericController {
|
|
|
968
1036
|
const hostDisconnected = this._disconnectedCallback.bind(this);
|
|
969
1037
|
const hostUpdate = this._update.bind(this);
|
|
970
1038
|
const hostUpdated = this._updated.bind(this);
|
|
971
|
-
if (isLit)
|
|
1039
|
+
if (isLit) {
|
|
972
1040
|
component.constructor.prototype.addController.call(component, {
|
|
973
1041
|
// Lit will call these callbacks
|
|
974
1042
|
hostConnected,
|
|
@@ -976,7 +1044,7 @@ var ControllerManager = class extends GenericController {
|
|
|
976
1044
|
hostUpdate,
|
|
977
1045
|
hostUpdated
|
|
978
1046
|
});
|
|
979
|
-
else {
|
|
1047
|
+
} else {
|
|
980
1048
|
component.connectedCallback = hostConnected;
|
|
981
1049
|
component.disconnectedCallback = hostDisconnected;
|
|
982
1050
|
component.componentWillLoad = this._load.bind(this);
|
|
@@ -984,16 +1052,18 @@ var ControllerManager = class extends GenericController {
|
|
|
984
1052
|
component.componentWillUpdate = hostUpdate;
|
|
985
1053
|
component.componentDidUpdate = hostUpdated;
|
|
986
1054
|
}
|
|
987
|
-
if (this.hasDestroy)
|
|
1055
|
+
if (this.hasDestroy) {
|
|
988
1056
|
component.destroy = this.destroy.bind(this);
|
|
1057
|
+
}
|
|
989
1058
|
}
|
|
990
1059
|
/**
|
|
991
1060
|
* Throws an error if component does not implement destroy() lifecycle, but
|
|
992
1061
|
* tries to use it.
|
|
993
1062
|
*/
|
|
994
1063
|
ensureHasDestroy() {
|
|
995
|
-
if (!this.hasDestroy)
|
|
1064
|
+
if (!this.hasDestroy) {
|
|
996
1065
|
throw new Error(destroyErrorMessage);
|
|
1066
|
+
}
|
|
997
1067
|
}
|
|
998
1068
|
/**
|
|
999
1069
|
* Private because this is not supposed to be called by Component directly.
|
|
@@ -1008,8 +1078,9 @@ var ControllerManager = class extends GenericController {
|
|
|
1008
1078
|
`The ${tagName} component has already been destroyed. It can not be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the autoDestroyDisabled prop.`
|
|
1009
1079
|
);
|
|
1010
1080
|
}
|
|
1011
|
-
if (this._autoDestroyTimeout !== void 0)
|
|
1081
|
+
if (this._autoDestroyTimeout !== void 0) {
|
|
1012
1082
|
clearTimeout(this._autoDestroyTimeout);
|
|
1083
|
+
}
|
|
1013
1084
|
this.internals.enabledWatchers = this.internals.allWatchers;
|
|
1014
1085
|
keyTrackResolve();
|
|
1015
1086
|
this._controllers.forEach(
|
|
@@ -1018,23 +1089,26 @@ var ControllerManager = class extends GenericController {
|
|
|
1018
1089
|
this._originalLifecycles.connectedCallback?.call(this.component);
|
|
1019
1090
|
}
|
|
1020
1091
|
_disconnectedCallback() {
|
|
1021
|
-
if (this.destroyed)
|
|
1092
|
+
if (this.destroyed) {
|
|
1022
1093
|
return;
|
|
1094
|
+
}
|
|
1023
1095
|
this._controllers.forEach(
|
|
1024
1096
|
(controller) => "triggerDisconnected" in controller ? controller.triggerDisconnected() : safeCall(controller.hostDisconnected, controller)
|
|
1025
1097
|
);
|
|
1026
1098
|
this._originalLifecycles.disconnectedCallback?.call(this.component);
|
|
1027
|
-
if (this.hasDestroy)
|
|
1099
|
+
if (this.hasDestroy) {
|
|
1028
1100
|
this._autoDestroyDisabledWatcher();
|
|
1101
|
+
}
|
|
1029
1102
|
}
|
|
1030
1103
|
async _load() {
|
|
1031
1104
|
const integrations = this.internals.reactiveUtilsIntegrations;
|
|
1032
1105
|
if (integrations.size > 0) {
|
|
1033
1106
|
for (const controller of integrations) {
|
|
1034
|
-
if ("triggerLoad" in controller)
|
|
1107
|
+
if ("triggerLoad" in controller) {
|
|
1035
1108
|
await controller.triggerLoad();
|
|
1036
|
-
else
|
|
1109
|
+
} else {
|
|
1037
1110
|
await safeAsyncCall(controller.hostLoad, controller);
|
|
1111
|
+
}
|
|
1038
1112
|
}
|
|
1039
1113
|
}
|
|
1040
1114
|
await Promise.allSettled(
|
|
@@ -1070,8 +1144,9 @@ var ControllerManager = class extends GenericController {
|
|
|
1070
1144
|
}
|
|
1071
1145
|
async destroy() {
|
|
1072
1146
|
this.ensureHasDestroy();
|
|
1073
|
-
if (this.destroyed)
|
|
1147
|
+
if (this.destroyed) {
|
|
1074
1148
|
return;
|
|
1149
|
+
}
|
|
1075
1150
|
if (this.component.el.isConnected) {
|
|
1076
1151
|
this.hasDestroy = false;
|
|
1077
1152
|
try {
|
|
@@ -1090,10 +1165,13 @@ var ControllerManager = class extends GenericController {
|
|
|
1090
1165
|
}
|
|
1091
1166
|
_autoDestroyDisabledWatcher() {
|
|
1092
1167
|
if (!this.component.el.isConnected && !this.component.autoDestroyDisabled) {
|
|
1093
|
-
if (this._autoDestroyTimeout !== void 0)
|
|
1168
|
+
if (this._autoDestroyTimeout !== void 0) {
|
|
1094
1169
|
clearTimeout(this._autoDestroyTimeout);
|
|
1170
|
+
}
|
|
1095
1171
|
const destroy = () => void this.destroy().catch(console.error);
|
|
1096
|
-
|
|
1172
|
+
{
|
|
1173
|
+
this._autoDestroyTimeout = devToolsAwareTimeout(destroy, autoDestroyOnDisconnectTimeout);
|
|
1174
|
+
}
|
|
1097
1175
|
}
|
|
1098
1176
|
}
|
|
1099
1177
|
// REFACTOR: replace this with a readonly:true option in @property()
|
|
@@ -1144,10 +1222,11 @@ var ControllerManager = class extends GenericController {
|
|
|
1144
1222
|
getSet(defaultValue, getSet) {
|
|
1145
1223
|
return this.component.manager.trackPropKey((name) => {
|
|
1146
1224
|
var _a2;
|
|
1147
|
-
if (name === void 0)
|
|
1225
|
+
if (name === void 0) {
|
|
1148
1226
|
throw new Error(
|
|
1149
1227
|
"Unable to resolve get/set's prop name. Make sure you are using it like @Prop() someProp = this.manager.getSet(defaultValue,{get,set})"
|
|
1150
1228
|
);
|
|
1229
|
+
}
|
|
1151
1230
|
if (getSet.set === this._readonlySetter) {
|
|
1152
1231
|
(_a2 = this.internals).readonlyProps ?? (_a2.readonlyProps = /* @__PURE__ */ new Set());
|
|
1153
1232
|
this.internals.readonlyProps.add(name);
|
|
@@ -1158,20 +1237,22 @@ var ControllerManager = class extends GenericController {
|
|
|
1158
1237
|
const initialSet = getSet.initialSet ?? true;
|
|
1159
1238
|
if (value != null && value !== defaultValue && typeof getSet.set === "function" && initialSet && !isStencilHotReload) {
|
|
1160
1239
|
const newValue = getSet.set(value, defaultValue, name);
|
|
1161
|
-
if (newValue !== value)
|
|
1162
|
-
if (this.isLit)
|
|
1240
|
+
if (newValue !== value) {
|
|
1241
|
+
if (this.isLit) {
|
|
1163
1242
|
genericComponent[name] = newValue;
|
|
1164
|
-
else {
|
|
1243
|
+
} else {
|
|
1165
1244
|
let firstConnected = true;
|
|
1166
1245
|
this.onConnected(() => {
|
|
1167
|
-
if (!firstConnected)
|
|
1246
|
+
if (!firstConnected) {
|
|
1168
1247
|
return;
|
|
1248
|
+
}
|
|
1169
1249
|
firstConnected = true;
|
|
1170
1250
|
this.bypassSetter(() => {
|
|
1171
1251
|
genericComponent[name] = newValue;
|
|
1172
1252
|
});
|
|
1173
1253
|
});
|
|
1174
1254
|
}
|
|
1255
|
+
}
|
|
1175
1256
|
}
|
|
1176
1257
|
this.genericGetSet(name, getSet);
|
|
1177
1258
|
}, defaultValue);
|
|
@@ -1208,29 +1289,34 @@ function setProxy(controller, { host, key, type }, initialExports) {
|
|
|
1208
1289
|
const controllerValueChanged = genericHost[key] !== controller.exports;
|
|
1209
1290
|
const hostValueChanged = genericHost[key] !== initialExports;
|
|
1210
1291
|
const controllerUpdatedExports = initialExports !== controller.exports;
|
|
1211
|
-
if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports)
|
|
1292
|
+
if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports) {
|
|
1212
1293
|
genericHost[key] = controller.exports;
|
|
1294
|
+
}
|
|
1213
1295
|
const isProxyExportsOnComponent = host === controller.component;
|
|
1214
1296
|
if (isProxyExportsOnComponent && type === "prop") {
|
|
1215
1297
|
const internals = controller.component.manager.internals;
|
|
1216
|
-
if (hostValueChanged)
|
|
1298
|
+
if (hostValueChanged) {
|
|
1217
1299
|
internals.markExports(controller, genericHost[key]);
|
|
1300
|
+
}
|
|
1218
1301
|
controller.component.manager.watch(key, (value) => {
|
|
1219
|
-
if (value !== controller.exports)
|
|
1302
|
+
if (value !== controller.exports) {
|
|
1220
1303
|
internals.markExports(controller, value);
|
|
1304
|
+
}
|
|
1221
1305
|
});
|
|
1222
1306
|
}
|
|
1223
1307
|
controller.watchExports(() => {
|
|
1224
|
-
if (genericHost[key] === controller.exports)
|
|
1308
|
+
if (genericHost[key] === controller.exports) {
|
|
1225
1309
|
return;
|
|
1310
|
+
}
|
|
1226
1311
|
const manager = controller.component.manager;
|
|
1227
1312
|
const isReadOnly = manager.internals.readonlyProps?.has(key) === true;
|
|
1228
|
-
if (isReadOnly)
|
|
1313
|
+
if (isReadOnly) {
|
|
1229
1314
|
manager.bypassReadonly(() => {
|
|
1230
1315
|
genericHost[key] = controller.exports;
|
|
1231
1316
|
});
|
|
1232
|
-
else
|
|
1317
|
+
} else {
|
|
1233
1318
|
genericHost[key] = controller.exports;
|
|
1319
|
+
}
|
|
1234
1320
|
});
|
|
1235
1321
|
}
|
|
1236
1322
|
|
|
@@ -1245,8 +1331,9 @@ var FunctionalController = class extends Controller {
|
|
|
1245
1331
|
const value = constructor(this.component, this);
|
|
1246
1332
|
const constructorChangedExports = this.exports !== originalExports;
|
|
1247
1333
|
if (value instanceof Promise) {
|
|
1248
|
-
if (!constructorChangedExports)
|
|
1334
|
+
if (!constructorChangedExports) {
|
|
1249
1335
|
this.setProvisionalExports(value);
|
|
1336
|
+
}
|
|
1250
1337
|
const resolved = value.then((result) => {
|
|
1251
1338
|
this.exports = result;
|
|
1252
1339
|
super.catchUpLifecycle();
|
|
@@ -1256,8 +1343,9 @@ var FunctionalController = class extends Controller {
|
|
|
1256
1343
|
});
|
|
1257
1344
|
this.onLoad(async () => await resolved);
|
|
1258
1345
|
} else {
|
|
1259
|
-
if (!constructorChangedExports || value !== void 0)
|
|
1346
|
+
if (!constructorChangedExports || value !== void 0) {
|
|
1260
1347
|
this.exports = value;
|
|
1348
|
+
}
|
|
1261
1349
|
queueMicrotask(() => super.catchUpLifecycle());
|
|
1262
1350
|
}
|
|
1263
1351
|
} catch (error) {
|