@arcgis/lumina 4.33.0-next.124 → 4.33.0-next.125
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/{Controller-CZ8Djohh.js → Controller-B3mB4uaz.js} +173 -211
- package/dist/LitElement.d.ts +20 -18
- package/dist/config.d.ts +7 -9
- package/dist/config.js +15 -12
- package/dist/context.d.ts +2 -2
- package/dist/controllers/Controller.d.ts +4 -10
- package/dist/controllers/ControllerInternals.d.ts +7 -13
- package/dist/controllers/ControllerManager.d.ts +6 -21
- package/dist/controllers/accessor/index.d.ts +1 -1
- package/dist/controllers/accessor/index.js +175 -211
- package/dist/controllers/accessor/reEmitEvent.d.ts +1 -1
- package/dist/controllers/accessor/useAccessor.d.ts +29 -32
- package/dist/controllers/index.d.ts +2 -2
- package/dist/controllers/index.js +42 -39
- package/dist/controllers/trackKey.d.ts +1 -1
- package/dist/controllers/trackPropKey.d.ts +1 -1
- package/dist/controllers/trackPropertyKey.d.ts +2 -2
- package/dist/controllers/types.d.ts +30 -0
- package/dist/controllers/utils.d.ts +7 -9
- package/dist/hmrSupport.js +22 -22
- package/dist/index.d.ts +1 -1
- package/dist/index.js +160 -192
- package/dist/{utils-BdB9g3GU.js → lazyLoad-DcVuFccH.js} +173 -185
- package/dist/lazyLoad.d.ts +22 -67
- package/dist/lifecycleSupport.d.ts +1 -1
- package/dist/makeRuntime.d.ts +23 -1
- package/dist/{proxyExports-CK5BLFLO.js → proxyExports-DQobuu44.js} +8 -8
- package/dist/render.d.ts +1 -1
- package/dist/utils.d.ts +8 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
import { ContextProvider, ContextConsumer } from "@lit/context";
|
|
2
|
-
import { r as retrieveComponent, G as GenericController, k as keyTrackResolve,
|
|
3
|
-
import {
|
|
2
|
+
import { r as retrieveComponent, G as GenericController, k as keyTrackResolve, q as queueMicroTask, s as setAmbientComponent, c as controllerSymbol, a as shouldBypassReadOnly } from "./Controller-B3mB4uaz.js";
|
|
3
|
+
import { b } from "./Controller-B3mB4uaz.js";
|
|
4
4
|
import { state } from "@lit/reactive-element/decorators/state.js";
|
|
5
5
|
import { property as property$1 } from "@lit/reactive-element/decorators/property.js";
|
|
6
|
-
import { n as noShadowRoot, a as attachToAncestor } from "./
|
|
7
|
-
import { m } from "./
|
|
6
|
+
import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-DcVuFccH.js";
|
|
7
|
+
import { d, m } from "./lazyLoad-DcVuFccH.js";
|
|
8
8
|
import { isEsriInternalEnv, safeCall, devToolsAwareTimeout, Deferred, camelToKebab, safeAsyncCall } from "@arcgis/components-utils";
|
|
9
|
-
import { nothing as nothing$1, LitElement as LitElement$1, isServer, noChange as noChange$1 } from "lit";
|
|
10
|
-
import {
|
|
9
|
+
import { nothing as nothing$1, LitElement as LitElement$1, isServer, notEqual, noChange as noChange$1 } from "lit";
|
|
10
|
+
import { propertyFlagAttribute, propertyFlagNoAccessor, propertyFlagReadOnly, propertyFlagState, propertyFlagBoolean, propertyFlagNumber, propertyFlagReflect } from "./config.js";
|
|
11
11
|
import { classMap } from "lit-html/directives/class-map.js";
|
|
12
12
|
import { styleMap } from "lit/directives/style-map.js";
|
|
13
13
|
import { directive as directive$1, Directive } from "lit-html/directive.js";
|
|
14
14
|
import { live as live$1 } from "lit-html/directives/live.js";
|
|
15
15
|
import { nothing as nothing$2, noChange as noChange$2, render } from "lit-html";
|
|
16
|
-
|
|
16
|
+
const useContextProvider = (options) => {
|
|
17
17
|
const component = retrieveComponent();
|
|
18
18
|
const controller = new ContextProvider(component.el, options);
|
|
19
19
|
component.addController(controller);
|
|
20
20
|
return controller;
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
};
|
|
22
|
+
const useContextConsumer = (options) => {
|
|
23
23
|
const component = retrieveComponent();
|
|
24
24
|
const controller = new ContextConsumer(component.el, options);
|
|
25
25
|
component.addController(controller);
|
|
26
26
|
return controller;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
const property = property$1;
|
|
29
29
|
const method = void 0;
|
|
30
30
|
class ControllerManager extends GenericController {
|
|
31
31
|
constructor(component) {
|
|
32
32
|
super(component);
|
|
33
33
|
this.destroyed = false;
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this
|
|
38
|
-
this
|
|
39
|
-
this._exportsStore = /* @__PURE__ */ new WeakMap();
|
|
34
|
+
this.R = false;
|
|
35
|
+
this.V = nothing$1;
|
|
36
|
+
this.T = [];
|
|
37
|
+
this.#exportsStore = /* @__PURE__ */ new WeakMap();
|
|
38
|
+
this.#component = component;
|
|
40
39
|
this.exports = void 0;
|
|
41
40
|
this.hasDestroy = autoDestroyDisabledPropName in component && typeof component.destroy === "function";
|
|
42
41
|
LitElement$1.prototype.addController.call(component, {
|
|
@@ -55,11 +54,11 @@ class ControllerManager extends GenericController {
|
|
|
55
54
|
`The ${tagName} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${autoDestroyDisabledPropName} prop.`
|
|
56
55
|
);
|
|
57
56
|
}
|
|
58
|
-
if (this
|
|
59
|
-
clearTimeout(this
|
|
57
|
+
if (this.#autoDestroyTimeout !== void 0) {
|
|
58
|
+
clearTimeout(this.#autoDestroyTimeout);
|
|
60
59
|
}
|
|
61
60
|
keyTrackResolve();
|
|
62
|
-
for (const controller of component.
|
|
61
|
+
for (const controller of component.M) {
|
|
63
62
|
if ("triggerConnected" in controller) {
|
|
64
63
|
controller.triggerConnected();
|
|
65
64
|
} else {
|
|
@@ -68,7 +67,7 @@ class ControllerManager extends GenericController {
|
|
|
68
67
|
}
|
|
69
68
|
},
|
|
70
69
|
hostDisconnected: () => {
|
|
71
|
-
for (const controller of component.
|
|
70
|
+
for (const controller of component.M) {
|
|
72
71
|
if ("triggerDisconnected" in controller) {
|
|
73
72
|
controller.triggerDisconnected();
|
|
74
73
|
} else {
|
|
@@ -76,186 +75,102 @@ class ControllerManager extends GenericController {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
if (this.hasDestroy && !this.destroyed) {
|
|
79
|
-
this.
|
|
78
|
+
this.U();
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
hostUpdate: () => {
|
|
83
|
-
for (const controller of component.
|
|
82
|
+
for (const controller of component.M) {
|
|
84
83
|
if ("triggerUpdate" in controller) {
|
|
85
|
-
controller.triggerUpdate(this.
|
|
84
|
+
controller.triggerUpdate(this.Q);
|
|
86
85
|
} else {
|
|
87
|
-
safeCall(controller.hostUpdate, controller, this.
|
|
86
|
+
safeCall(controller.hostUpdate, controller, this.Q);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
},
|
|
91
90
|
hostUpdated: () => {
|
|
92
|
-
for (const controller of component.
|
|
91
|
+
for (const controller of component.M) {
|
|
93
92
|
if ("triggerUpdated" in controller) {
|
|
94
|
-
controller.triggerUpdated(this.
|
|
93
|
+
controller.triggerUpdated(this.Q);
|
|
95
94
|
} else {
|
|
96
|
-
safeCall(controller.hostUpdated, controller, this.
|
|
95
|
+
safeCall(controller.hostUpdated, controller, this.Q);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
|
-
this.
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
component.constructor.elementProperties.forEach((descriptor, name) => {
|
|
103
|
-
if (!descriptor.noAccessor) {
|
|
104
|
-
this._accessorGetter[name] = defaultGetterSetter;
|
|
105
|
-
this._accessorSetter[name] = defaultGetterSetter;
|
|
106
|
-
this._getSetProxy(name, descriptor.readOnly);
|
|
98
|
+
this.Q = void 0;
|
|
107
99
|
}
|
|
108
100
|
});
|
|
109
|
-
|
|
110
|
-
this._enforceReadonly = true;
|
|
111
|
-
});
|
|
101
|
+
queueMicroTask(() => this.R = true);
|
|
112
102
|
setAmbientComponent(component);
|
|
113
103
|
}
|
|
104
|
+
#autoDestroyTimeout;
|
|
105
|
+
#component;
|
|
114
106
|
// Keep this method async needlessly for now to avoid a breaking change if we
|
|
115
107
|
// would need to make it async in the future
|
|
116
108
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
117
109
|
async destroy() {
|
|
118
110
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
119
|
-
this.
|
|
111
|
+
this.devOnly$ensureHasDestroy?.();
|
|
120
112
|
}
|
|
121
113
|
if (this.destroyed) {
|
|
122
114
|
return;
|
|
123
115
|
}
|
|
124
|
-
if (this
|
|
116
|
+
if (this.#component.el.isConnected) {
|
|
125
117
|
this.hasDestroy = false;
|
|
126
|
-
|
|
127
|
-
this.component.el.remove();
|
|
128
|
-
} finally {
|
|
129
|
-
this.hasDestroy = true;
|
|
130
|
-
}
|
|
118
|
+
this.#component.el.remove();
|
|
131
119
|
}
|
|
132
|
-
this
|
|
120
|
+
this.#autoDestroyTimeout = void 0;
|
|
133
121
|
this.destroyed = true;
|
|
134
|
-
for (const controller of this
|
|
122
|
+
for (const controller of this.#component.M) {
|
|
135
123
|
if ("triggerDestroy" in controller) {
|
|
136
124
|
controller.triggerDestroy();
|
|
137
125
|
} else {
|
|
138
126
|
safeCall(controller.hostDestroy, controller);
|
|
139
127
|
}
|
|
140
128
|
}
|
|
141
|
-
this
|
|
129
|
+
this.#component.M.splice(0);
|
|
142
130
|
}
|
|
143
131
|
/** @private */
|
|
144
|
-
|
|
145
|
-
if (this
|
|
146
|
-
clearTimeout(this
|
|
132
|
+
U() {
|
|
133
|
+
if (this.#autoDestroyTimeout !== void 0) {
|
|
134
|
+
clearTimeout(this.#autoDestroyTimeout);
|
|
147
135
|
}
|
|
148
|
-
if (!this
|
|
149
|
-
const destroy = () => void this
|
|
136
|
+
if (!this.#component.el.isConnected && !this.#component.autoDestroyDisabled) {
|
|
137
|
+
const destroy = () => void this.#component.destroy();
|
|
150
138
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && autoDestroyOnDisconnectTimeout === 0) ;
|
|
151
139
|
else {
|
|
152
|
-
this
|
|
140
|
+
this.#autoDestroyTimeout = devToolsAwareTimeout(destroy, autoDestroyOnDisconnectTimeout);
|
|
153
141
|
}
|
|
154
142
|
}
|
|
155
143
|
}
|
|
156
144
|
/** @private */
|
|
157
|
-
|
|
158
|
-
const trackers = this.
|
|
159
|
-
this.
|
|
160
|
-
this.
|
|
145
|
+
S(key, value) {
|
|
146
|
+
const trackers = this.T;
|
|
147
|
+
this.V = nothing$1;
|
|
148
|
+
this.T = [];
|
|
161
149
|
trackers.forEach((tracker) => tracker(key, value));
|
|
162
150
|
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Configure a getter or setter for a given \@property/\@state
|
|
166
|
-
*
|
|
167
|
-
* Since props are defined on the prototype, they are shared between all
|
|
168
|
-
* instances of a component. Thus, instead of passing a reference to the
|
|
169
|
-
* getter/setter function, you should update the
|
|
170
|
-
* ComponentInternals.getters/setters properties, and then call getSetProxy
|
|
171
|
-
* to apply the changes to the prototype
|
|
172
|
-
*
|
|
173
|
-
* @deprecated
|
|
174
|
-
*/
|
|
175
|
-
_getSetProxy(name, isReadOnly) {
|
|
176
|
-
let prototype = this.component.constructor.prototype;
|
|
177
|
-
let descriptor;
|
|
178
|
-
do {
|
|
179
|
-
descriptor = Object.getOwnPropertyDescriptor(prototype, name);
|
|
180
|
-
} while (!descriptor && (prototype = Object.getPrototypeOf(prototype)));
|
|
181
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
182
|
-
if (descriptor?.set === void 0 || descriptor.get === void 0) {
|
|
183
|
-
if (descriptor !== void 0 && "value" in descriptor) {
|
|
184
|
-
throw new Error(
|
|
185
|
-
`getSet() should only be used on @property/@state properties. For internal component properties, use regular get/set syntax. Tried to use it on "${name}" in ${this.component.el.localName}`
|
|
186
|
-
);
|
|
187
|
-
} else {
|
|
188
|
-
throw new Error(`Unable to find "${name}" property on the ${this.component.el.localName} component`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
} else if (!descriptor) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const originalGet = descriptor.get;
|
|
195
|
-
const originalSet = descriptor.set;
|
|
196
|
-
const isGetterAlreadyOverwritten = customAccessor in originalGet;
|
|
197
|
-
const isSetterAlreadyOverwritten = customAccessor in originalSet;
|
|
198
|
-
if (isGetterAlreadyOverwritten && isSetterAlreadyOverwritten) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
const shouldOverwriteGet = !isGetterAlreadyOverwritten;
|
|
202
|
-
const shouldOverwriteSet = !isSetterAlreadyOverwritten;
|
|
203
|
-
const finalGetter = shouldOverwriteGet ? function getter() {
|
|
204
|
-
const value = originalGet.call(this);
|
|
205
|
-
if (shouldBypassGetter) {
|
|
206
|
-
return value;
|
|
207
|
-
}
|
|
208
|
-
return this.manager._accessorGetter[name](value, name);
|
|
209
|
-
} : originalGet;
|
|
210
|
-
const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
|
|
211
|
-
const oldValue = originalGet.call(this);
|
|
212
|
-
let newValue = rawNewValue ?? void 0;
|
|
213
|
-
const manager = this.manager;
|
|
214
|
-
if (newValue !== oldValue) {
|
|
215
|
-
if (isReadOnly && !shouldBypassReadOnly && (manager._enforceReadonly || manager.connectedCalled)) {
|
|
216
|
-
throw new Error(
|
|
217
|
-
`Cannot assign to read-only property "${name}" of ${this.el.localName}. Trying to assign "${String(
|
|
218
|
-
newValue
|
|
219
|
-
)}"`
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
newValue = manager._accessorSetter[name](newValue, oldValue, name);
|
|
223
|
-
}
|
|
224
|
-
originalSet.call(this, newValue);
|
|
225
|
-
if (manager._keyTrackers.length > 0) {
|
|
226
|
-
manager?._firePropTrackers(name, rawNewValue);
|
|
227
|
-
}
|
|
228
|
-
} : originalSet;
|
|
229
|
-
if (shouldOverwriteGet) {
|
|
230
|
-
finalGetter[customAccessor] = true;
|
|
231
|
-
}
|
|
232
|
-
if (shouldOverwriteSet) {
|
|
233
|
-
finalSetter[customAccessor] = true;
|
|
234
|
-
}
|
|
235
|
-
Object.defineProperty(prototype, name, { ...descriptor, get: finalGetter, set: finalSetter });
|
|
236
|
-
}
|
|
151
|
+
#exportsStore;
|
|
237
152
|
/**
|
|
238
153
|
* Associate an exports object with a controller for reverse lookup in
|
|
239
154
|
* controller.use
|
|
240
155
|
*
|
|
241
156
|
* @private
|
|
242
157
|
*/
|
|
243
|
-
|
|
158
|
+
W(controller, exports) {
|
|
244
159
|
if (typeof exports === "object" && exports !== null || typeof exports === "function") {
|
|
245
|
-
this.
|
|
160
|
+
this.#exportsStore.set(exports, controller);
|
|
246
161
|
}
|
|
247
162
|
}
|
|
248
163
|
/** @private */
|
|
249
|
-
|
|
164
|
+
X(exports) {
|
|
250
165
|
if (typeof exports === "object" && exports !== null || typeof exports === "function") {
|
|
251
|
-
return this.
|
|
166
|
+
return this.#exportsStore.get(exports);
|
|
252
167
|
} else {
|
|
253
168
|
return void 0;
|
|
254
169
|
}
|
|
255
170
|
}
|
|
256
171
|
}
|
|
257
172
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
258
|
-
ControllerManager.prototype.
|
|
173
|
+
ControllerManager.prototype.devOnly$ensureHasDestroy = function ensureHasDestroy() {
|
|
259
174
|
if (!this.hasDestroy) {
|
|
260
175
|
throw new Error(
|
|
261
176
|
`
|
|
@@ -283,31 +198,34 @@ if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
|
283
198
|
let autoDestroyOnDisconnectTimeout = 1e3;
|
|
284
199
|
const autoDestroyDisabledPropName = "autoDestroyDisabled";
|
|
285
200
|
process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? {} : void 0;
|
|
286
|
-
const defaultGetterSetter = (value) => value;
|
|
287
|
-
const customAccessor = Symbol();
|
|
288
|
-
const emptyFunction = () => void 0;
|
|
289
201
|
class LitElement extends LitElement$1 {
|
|
290
202
|
constructor() {
|
|
291
203
|
super();
|
|
292
|
-
this.
|
|
293
|
-
this._controllers = /* @__PURE__ */ new Set();
|
|
204
|
+
this.M = [];
|
|
294
205
|
this.manager = new ControllerManager(this);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
this.enableUpdating = emptyFunction;
|
|
206
|
+
const that = this;
|
|
207
|
+
const constructor = that.constructor;
|
|
208
|
+
const lazy = constructor.N;
|
|
209
|
+
const createObservable = constructor.K.o;
|
|
300
210
|
const ourShouldUpdate = LitElement.prototype.shouldUpdate;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
211
|
+
that.#postLoadedDeferred = lazy?.H ?? new Deferred();
|
|
212
|
+
that.I = lazy?.I ?? new Deferred();
|
|
213
|
+
that.J = lazy?.J ?? [];
|
|
214
|
+
that["_offspring"] = that.J;
|
|
215
|
+
that["_postLoad"] = that.I;
|
|
216
|
+
that.el = lazy ?? that;
|
|
217
|
+
that.#enableUpdating = that.enableUpdating;
|
|
218
|
+
that.enableUpdating = emptyFunction;
|
|
219
|
+
if (that.shouldUpdate !== ourShouldUpdate) {
|
|
220
|
+
that.#originalShouldUpdate = that.shouldUpdate;
|
|
221
|
+
that.shouldUpdate = ourShouldUpdate;
|
|
304
222
|
}
|
|
305
223
|
if (process.env.NODE_ENV !== "production") {
|
|
306
|
-
const isOwnComponent = globalThis.devOnly$ownTagNames?.has(
|
|
307
|
-
const
|
|
308
|
-
const warningsWereCustomized =
|
|
224
|
+
const isOwnComponent = globalThis.devOnly$ownTagNames?.has(that.el.localName);
|
|
225
|
+
const constructor2 = this.constructor;
|
|
226
|
+
const warningsWereCustomized = constructor2.enabledWarnings !== LitElement$1.enabledWarnings;
|
|
309
227
|
if (!isOwnComponent && !warningsWereCustomized) {
|
|
310
|
-
|
|
228
|
+
constructor2.disableWarning?.("change-in-update");
|
|
311
229
|
}
|
|
312
230
|
if (isEsriInternalEnv()) {
|
|
313
231
|
globalThis.devOnly$luminaComponentRefCallback?.(this);
|
|
@@ -329,8 +247,12 @@ class LitElement extends LitElement$1 {
|
|
|
329
247
|
});
|
|
330
248
|
}
|
|
331
249
|
}
|
|
250
|
+
if (createObservable) {
|
|
251
|
+
that.#observables = /* @__PURE__ */ new Map();
|
|
252
|
+
constructor.elementProperties.forEach((_, name) => that.#observables.set(name, createObservable()));
|
|
253
|
+
}
|
|
332
254
|
if (isServer) {
|
|
333
|
-
|
|
255
|
+
that.el.setAttribute(constructor.K.hydratedAttribute, "");
|
|
334
256
|
}
|
|
335
257
|
}
|
|
336
258
|
/**
|
|
@@ -342,12 +264,13 @@ class LitElement extends LitElement$1 {
|
|
|
342
264
|
}
|
|
343
265
|
const finalizedStyles = super.finalizeStyles(styles);
|
|
344
266
|
const useLightDom = this.shadowRootOptions === noShadowRoot;
|
|
345
|
-
return this.
|
|
267
|
+
return this.K?.commonStyles === void 0 || useLightDom ? finalizedStyles : [this.K.commonStyles, ...finalizedStyles];
|
|
346
268
|
}
|
|
347
269
|
static createProperty(name, options) {
|
|
348
270
|
const flags = typeof options === "number" ? options : Array.isArray(options) ? options[0] : 0;
|
|
349
271
|
const rest = Array.isArray(options) ? options[1] : void 0;
|
|
350
|
-
|
|
272
|
+
const hasChanged = rest?.hasChanged ?? notEqual;
|
|
273
|
+
const normalizedOptions = {
|
|
351
274
|
/**
|
|
352
275
|
* By default to infer attribute name from property name, Lit just
|
|
353
276
|
* converts property name to lowercase. That is consistent with
|
|
@@ -364,24 +287,68 @@ class LitElement extends LitElement$1 {
|
|
|
364
287
|
*
|
|
365
288
|
* Thus, overwriting Lit's default behavior to use kebab-case:
|
|
366
289
|
*/
|
|
367
|
-
attribute: !!(flags &
|
|
368
|
-
reflect: !!(flags &
|
|
369
|
-
type: flags &
|
|
290
|
+
attribute: !!(flags & propertyFlagAttribute) && typeof name === "string" ? camelToKebab(name) : false,
|
|
291
|
+
reflect: !!(flags & propertyFlagReflect),
|
|
292
|
+
type: flags & propertyFlagBoolean ? Boolean : flags & propertyFlagNumber ? Number : void 0,
|
|
370
293
|
/**
|
|
371
294
|
* At the moment in Lit, state:true just means attribute:false, so this
|
|
372
295
|
* line is technically redundant, but let's keep it here just in case Lit
|
|
373
296
|
* will add more meaning to state:true in the future.
|
|
374
297
|
*/
|
|
375
|
-
state: !!(flags &
|
|
298
|
+
state: !!(flags & propertyFlagState),
|
|
376
299
|
// Controllers add this option to Lit
|
|
377
|
-
readOnly: !!(flags &
|
|
378
|
-
noAccessor: !!(flags &
|
|
379
|
-
|
|
380
|
-
|
|
300
|
+
readOnly: !!(flags & propertyFlagReadOnly),
|
|
301
|
+
noAccessor: !!(flags & propertyFlagNoAccessor),
|
|
302
|
+
c: false,
|
|
303
|
+
...rest,
|
|
304
|
+
hasChanged(newValue, oldValue) {
|
|
305
|
+
const changed = hasChanged(newValue, oldValue);
|
|
306
|
+
normalizedOptions.c = changed;
|
|
307
|
+
return changed;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
super.createProperty(name, normalizedOptions);
|
|
311
|
+
}
|
|
312
|
+
static getPropertyDescriptor(name, key, options) {
|
|
313
|
+
const runtime = this.K;
|
|
314
|
+
const accessor = super.getPropertyDescriptor(name, key, options);
|
|
315
|
+
options.d = accessor;
|
|
316
|
+
return {
|
|
317
|
+
...accessor,
|
|
318
|
+
get() {
|
|
319
|
+
runtime.t?.(this.#observables.get(name));
|
|
320
|
+
return accessor.get?.call(this);
|
|
321
|
+
},
|
|
322
|
+
set(rawNewValue) {
|
|
323
|
+
const manager = this.manager;
|
|
324
|
+
if (options.readOnly && !shouldBypassReadOnly && (manager.R || manager.connectedCalled)) {
|
|
325
|
+
throw Error(
|
|
326
|
+
`Cannot assign to read-only property "${name}" of ${this.el.localName}. Trying to assign "${rawNewValue}"`
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
accessor.set.call(this, rawNewValue ?? void 0);
|
|
330
|
+
if (options.c) {
|
|
331
|
+
this.#observables?.get(name)?.notify();
|
|
332
|
+
}
|
|
333
|
+
if (manager.T.length > 0) {
|
|
334
|
+
manager?.S(name, rawNewValue);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
381
338
|
}
|
|
382
339
|
static {
|
|
383
340
|
this.lumina = true;
|
|
384
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* The JS API's Accessor observables. This is used to integrate with the JS
|
|
344
|
+
* API's reactivity system.
|
|
345
|
+
*
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
#observables;
|
|
349
|
+
#originalShouldUpdate;
|
|
350
|
+
#enableUpdating;
|
|
351
|
+
#postLoadedDeferred;
|
|
385
352
|
connectedCallback() {
|
|
386
353
|
if (this.el.hasAttribute("defer-hydration")) {
|
|
387
354
|
return;
|
|
@@ -389,10 +356,10 @@ class LitElement extends LitElement$1 {
|
|
|
389
356
|
const isFirstCall = !this.manager.connectedCalled;
|
|
390
357
|
super.connectedCallback();
|
|
391
358
|
if (isFirstCall) {
|
|
392
|
-
|
|
393
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
394
|
-
() => this
|
|
395
|
-
this.
|
|
359
|
+
queueMicroTask(
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async, @typescript-eslint/no-misused-promises
|
|
361
|
+
() => this.#load().catch((error) => {
|
|
362
|
+
this.#postLoadedDeferred.reject(error);
|
|
396
363
|
setTimeout(() => {
|
|
397
364
|
throw error;
|
|
398
365
|
});
|
|
@@ -431,13 +398,13 @@ class LitElement extends LitElement$1 {
|
|
|
431
398
|
return renderRoot;
|
|
432
399
|
}
|
|
433
400
|
/** Do asynchronous component load */
|
|
434
|
-
async
|
|
435
|
-
const parentLoadPromise = this.el.
|
|
401
|
+
async #load() {
|
|
402
|
+
const parentLoadPromise = this.el.G ?? attachToAncestor(this.el);
|
|
436
403
|
if (parentLoadPromise) {
|
|
437
404
|
await parentLoadPromise;
|
|
438
405
|
}
|
|
439
406
|
const promises = [];
|
|
440
|
-
for (const controller of this.
|
|
407
|
+
for (const controller of this.M) {
|
|
441
408
|
if ("triggerLoad" in controller) {
|
|
442
409
|
promises.push(controller.triggerLoad());
|
|
443
410
|
} else {
|
|
@@ -448,20 +415,20 @@ class LitElement extends LitElement$1 {
|
|
|
448
415
|
await this.load?.();
|
|
449
416
|
if (this.manager.hasDestroy) {
|
|
450
417
|
this.manager.onUpdate(
|
|
451
|
-
(changes) => changes.has(autoDestroyDisabledPropName) && this.manager.
|
|
418
|
+
(changes) => changes.has(autoDestroyDisabledPropName) && this.manager.U()
|
|
452
419
|
);
|
|
453
420
|
}
|
|
454
|
-
this
|
|
421
|
+
this.#enableUpdating(true);
|
|
455
422
|
this.performUpdate();
|
|
456
|
-
this.
|
|
423
|
+
this.I.resolve();
|
|
457
424
|
await Promise.resolve();
|
|
458
|
-
const pendingChildren = this.
|
|
425
|
+
const pendingChildren = this.J.filter((loaded) => !loaded.manager?.loadedCalled);
|
|
459
426
|
if (pendingChildren.length) {
|
|
460
427
|
await Promise.allSettled(pendingChildren.map(async (child) => await child.componentOnReady()));
|
|
461
428
|
}
|
|
462
|
-
this.
|
|
463
|
-
this.el.setAttribute(this.constructor.
|
|
464
|
-
for (const controller of this.
|
|
429
|
+
this.J.length = 0;
|
|
430
|
+
this.el.setAttribute(this.constructor.K.hydratedAttribute, "");
|
|
431
|
+
for (const controller of this.M) {
|
|
465
432
|
if ("triggerLoaded" in controller) {
|
|
466
433
|
controller.triggerLoaded();
|
|
467
434
|
} else {
|
|
@@ -469,15 +436,15 @@ class LitElement extends LitElement$1 {
|
|
|
469
436
|
}
|
|
470
437
|
}
|
|
471
438
|
this.loaded?.();
|
|
472
|
-
this.
|
|
439
|
+
this.#postLoadedDeferred.resolve();
|
|
473
440
|
}
|
|
474
441
|
/**
|
|
475
442
|
* Overwriting default shouldUpdate simply to get access to
|
|
476
443
|
* "changedProperties" so that we can later provide it to ControllerManager
|
|
477
444
|
*/
|
|
478
445
|
shouldUpdate(_changedProperties) {
|
|
479
|
-
this.manager.
|
|
480
|
-
return this
|
|
446
|
+
this.manager.Q = _changedProperties;
|
|
447
|
+
return this.#originalShouldUpdate?.(_changedProperties) ?? true;
|
|
481
448
|
}
|
|
482
449
|
listen(name, listener, options) {
|
|
483
450
|
const boundListener = listener?.bind(this) ?? listener;
|
|
@@ -504,7 +471,7 @@ class LitElement extends LitElement$1 {
|
|
|
504
471
|
* });
|
|
505
472
|
*/
|
|
506
473
|
async componentOnReady() {
|
|
507
|
-
await this.
|
|
474
|
+
await this.#postLoadedDeferred.promise;
|
|
508
475
|
return this;
|
|
509
476
|
}
|
|
510
477
|
/**
|
|
@@ -517,7 +484,7 @@ class LitElement extends LitElement$1 {
|
|
|
517
484
|
* timing, and to add support for load/loaded lifecycle hooks.
|
|
518
485
|
*/
|
|
519
486
|
addController(controller) {
|
|
520
|
-
this.
|
|
487
|
+
this.M.push(controller);
|
|
521
488
|
if (!(controllerSymbol in controller) && this.renderRoot && this.el.isConnected) {
|
|
522
489
|
controller.hostConnected?.();
|
|
523
490
|
}
|
|
@@ -526,11 +493,11 @@ class LitElement extends LitElement$1 {
|
|
|
526
493
|
* Removes a controller from the host.
|
|
527
494
|
*/
|
|
528
495
|
removeController(controller) {
|
|
529
|
-
this.
|
|
496
|
+
this.M.splice(this.M.indexOf(controller), 1);
|
|
530
497
|
controller.controllerRemoved?.();
|
|
531
498
|
}
|
|
532
499
|
}
|
|
533
|
-
|
|
500
|
+
const makeRuntime = (options) => {
|
|
534
501
|
let assetPath;
|
|
535
502
|
const setAssetPath = (path) => {
|
|
536
503
|
assetPath = new URL(
|
|
@@ -564,8 +531,8 @@ function makeRuntime(options) {
|
|
|
564
531
|
},
|
|
565
532
|
setAssetPath,
|
|
566
533
|
customElement(tagName, component) {
|
|
567
|
-
component.
|
|
568
|
-
component.
|
|
534
|
+
component.K = runtime;
|
|
535
|
+
component.L = tagName;
|
|
569
536
|
if (!customElements.get(tagName)) {
|
|
570
537
|
customElements.define(tagName, component);
|
|
571
538
|
}
|
|
@@ -576,7 +543,7 @@ function makeRuntime(options) {
|
|
|
576
543
|
globalThis.devOnly$luminaRuntime = runtime;
|
|
577
544
|
}
|
|
578
545
|
return runtime;
|
|
579
|
-
}
|
|
546
|
+
};
|
|
580
547
|
const Fragment = void 0;
|
|
581
548
|
const bindAttribute = void 0;
|
|
582
549
|
const bindBooleanAttribute = void 0;
|
|
@@ -651,11 +618,11 @@ const makeReactWrapperFactory = (react, createComponent) => (options) => {
|
|
|
651
618
|
return result;
|
|
652
619
|
};
|
|
653
620
|
const getReactWrapperOptions = (tagNameAndElement, events) => ({ tagName: tagNameAndElement, events });
|
|
654
|
-
|
|
621
|
+
const renderElement = (element) => {
|
|
655
622
|
const container = document.createElement("div");
|
|
656
623
|
render(element, container);
|
|
657
624
|
return container.firstElementChild;
|
|
658
|
-
}
|
|
625
|
+
};
|
|
659
626
|
export {
|
|
660
627
|
Fragment,
|
|
661
628
|
LitElement,
|
|
@@ -663,9 +630,10 @@ export {
|
|
|
663
630
|
bindBooleanAttribute,
|
|
664
631
|
bindEvent,
|
|
665
632
|
bindProperty,
|
|
666
|
-
|
|
633
|
+
b as createEvent,
|
|
667
634
|
deferLoad,
|
|
668
635
|
deferredLoaders,
|
|
636
|
+
d as devOnly$getLitElementTagNameAndRuntime,
|
|
669
637
|
directive,
|
|
670
638
|
getReactWrapperOptions,
|
|
671
639
|
live,
|