@arcgis/lumina 4.33.0-next.124 → 4.33.0-next.126
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 +22 -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 +26 -22
- package/dist/controllers/accessor/index.d.ts +1 -1
- package/dist/controllers/accessor/index.js +177 -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 +35 -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 +186 -192
- package/dist/{utils-BdB9g3GU.js → lazyLoad-ByH-FaBP.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-ByH-FaBP.js";
|
|
7
|
+
import { d, m } from "./lazyLoad-ByH-FaBP.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.
|
|
98
|
+
this.Q = void 0;
|
|
100
99
|
}
|
|
101
100
|
});
|
|
102
|
-
|
|
103
|
-
if (!descriptor.noAccessor) {
|
|
104
|
-
this._accessorGetter[name] = defaultGetterSetter;
|
|
105
|
-
this._accessorSetter[name] = defaultGetterSetter;
|
|
106
|
-
this._getSetProxy(name, descriptor.readOnly);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
queueMicrotask(() => {
|
|
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,42 +287,105 @@ 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;
|
|
352
|
+
#trackingTarget;
|
|
385
353
|
connectedCallback() {
|
|
386
354
|
if (this.el.hasAttribute("defer-hydration")) {
|
|
387
355
|
return;
|
|
388
356
|
}
|
|
357
|
+
const trackingTarget = this.manager.A?.(() => this.requestUpdate());
|
|
358
|
+
this.#trackingTarget = trackingTarget;
|
|
389
359
|
const isFirstCall = !this.manager.connectedCalled;
|
|
390
360
|
super.connectedCallback();
|
|
391
361
|
if (isFirstCall) {
|
|
392
|
-
|
|
393
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
394
|
-
() => this
|
|
395
|
-
this.
|
|
362
|
+
queueMicroTask(
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async, @typescript-eslint/no-misused-promises
|
|
364
|
+
() => this.#load().catch((error) => {
|
|
365
|
+
this.#postLoadedDeferred.reject(error);
|
|
396
366
|
setTimeout(() => {
|
|
397
367
|
throw error;
|
|
398
368
|
});
|
|
399
369
|
})
|
|
400
370
|
);
|
|
371
|
+
} else if (trackingTarget) {
|
|
372
|
+
this.requestUpdate();
|
|
401
373
|
}
|
|
402
374
|
}
|
|
375
|
+
#doTrackedUpdate(changedProperties) {
|
|
376
|
+
try {
|
|
377
|
+
this.#trackingTarget.clear();
|
|
378
|
+
this.manager.B(this.#trackingTarget, () => super.update(changedProperties));
|
|
379
|
+
} catch (error) {
|
|
380
|
+
this.#trackingTarget.clear();
|
|
381
|
+
throw error;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
disconnectedCallback() {
|
|
385
|
+
super.disconnectedCallback();
|
|
386
|
+
this.#trackingTarget?.destroy();
|
|
387
|
+
this.#trackingTarget = void 0;
|
|
388
|
+
}
|
|
403
389
|
/**
|
|
404
390
|
* Overwrite Lit's default behavior of attaching shadow root to the lit
|
|
405
391
|
* element, and instead use this.el to support lazy builds.
|
|
@@ -431,13 +417,13 @@ class LitElement extends LitElement$1 {
|
|
|
431
417
|
return renderRoot;
|
|
432
418
|
}
|
|
433
419
|
/** Do asynchronous component load */
|
|
434
|
-
async
|
|
435
|
-
const parentLoadPromise = this.el.
|
|
420
|
+
async #load() {
|
|
421
|
+
const parentLoadPromise = this.el.G ?? attachToAncestor(this.el);
|
|
436
422
|
if (parentLoadPromise) {
|
|
437
423
|
await parentLoadPromise;
|
|
438
424
|
}
|
|
439
425
|
const promises = [];
|
|
440
|
-
for (const controller of this.
|
|
426
|
+
for (const controller of this.M) {
|
|
441
427
|
if ("triggerLoad" in controller) {
|
|
442
428
|
promises.push(controller.triggerLoad());
|
|
443
429
|
} else {
|
|
@@ -448,20 +434,20 @@ class LitElement extends LitElement$1 {
|
|
|
448
434
|
await this.load?.();
|
|
449
435
|
if (this.manager.hasDestroy) {
|
|
450
436
|
this.manager.onUpdate(
|
|
451
|
-
(changes) => changes.has(autoDestroyDisabledPropName) && this.manager.
|
|
437
|
+
(changes) => changes.has(autoDestroyDisabledPropName) && this.manager.U()
|
|
452
438
|
);
|
|
453
439
|
}
|
|
454
|
-
this
|
|
440
|
+
this.#enableUpdating(true);
|
|
455
441
|
this.performUpdate();
|
|
456
|
-
this.
|
|
442
|
+
this.I.resolve();
|
|
457
443
|
await Promise.resolve();
|
|
458
|
-
const pendingChildren = this.
|
|
444
|
+
const pendingChildren = this.J.filter((loaded) => !loaded.manager?.loadedCalled);
|
|
459
445
|
if (pendingChildren.length) {
|
|
460
446
|
await Promise.allSettled(pendingChildren.map(async (child) => await child.componentOnReady()));
|
|
461
447
|
}
|
|
462
|
-
this.
|
|
463
|
-
this.el.setAttribute(this.constructor.
|
|
464
|
-
for (const controller of this.
|
|
448
|
+
this.J.length = 0;
|
|
449
|
+
this.el.setAttribute(this.constructor.K.hydratedAttribute, "");
|
|
450
|
+
for (const controller of this.M) {
|
|
465
451
|
if ("triggerLoaded" in controller) {
|
|
466
452
|
controller.triggerLoaded();
|
|
467
453
|
} else {
|
|
@@ -469,15 +455,22 @@ class LitElement extends LitElement$1 {
|
|
|
469
455
|
}
|
|
470
456
|
}
|
|
471
457
|
this.loaded?.();
|
|
472
|
-
this.
|
|
458
|
+
this.#postLoadedDeferred.resolve();
|
|
473
459
|
}
|
|
474
460
|
/**
|
|
475
461
|
* Overwriting default shouldUpdate simply to get access to
|
|
476
462
|
* "changedProperties" so that we can later provide it to ControllerManager
|
|
477
463
|
*/
|
|
478
464
|
shouldUpdate(_changedProperties) {
|
|
479
|
-
this.manager.
|
|
480
|
-
return this
|
|
465
|
+
this.manager.Q = _changedProperties;
|
|
466
|
+
return this.#originalShouldUpdate?.(_changedProperties) ?? true;
|
|
467
|
+
}
|
|
468
|
+
update(changedProperties) {
|
|
469
|
+
if (this.#trackingTarget) {
|
|
470
|
+
this.#doTrackedUpdate(changedProperties);
|
|
471
|
+
} else {
|
|
472
|
+
super.update(changedProperties);
|
|
473
|
+
}
|
|
481
474
|
}
|
|
482
475
|
listen(name, listener, options) {
|
|
483
476
|
const boundListener = listener?.bind(this) ?? listener;
|
|
@@ -504,7 +497,7 @@ class LitElement extends LitElement$1 {
|
|
|
504
497
|
* });
|
|
505
498
|
*/
|
|
506
499
|
async componentOnReady() {
|
|
507
|
-
await this.
|
|
500
|
+
await this.#postLoadedDeferred.promise;
|
|
508
501
|
return this;
|
|
509
502
|
}
|
|
510
503
|
/**
|
|
@@ -517,7 +510,7 @@ class LitElement extends LitElement$1 {
|
|
|
517
510
|
* timing, and to add support for load/loaded lifecycle hooks.
|
|
518
511
|
*/
|
|
519
512
|
addController(controller) {
|
|
520
|
-
this.
|
|
513
|
+
this.M.push(controller);
|
|
521
514
|
if (!(controllerSymbol in controller) && this.renderRoot && this.el.isConnected) {
|
|
522
515
|
controller.hostConnected?.();
|
|
523
516
|
}
|
|
@@ -526,11 +519,11 @@ class LitElement extends LitElement$1 {
|
|
|
526
519
|
* Removes a controller from the host.
|
|
527
520
|
*/
|
|
528
521
|
removeController(controller) {
|
|
529
|
-
this.
|
|
522
|
+
this.M.splice(this.M.indexOf(controller), 1);
|
|
530
523
|
controller.controllerRemoved?.();
|
|
531
524
|
}
|
|
532
525
|
}
|
|
533
|
-
|
|
526
|
+
const makeRuntime = (options) => {
|
|
534
527
|
let assetPath;
|
|
535
528
|
const setAssetPath = (path) => {
|
|
536
529
|
assetPath = new URL(
|
|
@@ -564,8 +557,8 @@ function makeRuntime(options) {
|
|
|
564
557
|
},
|
|
565
558
|
setAssetPath,
|
|
566
559
|
customElement(tagName, component) {
|
|
567
|
-
component.
|
|
568
|
-
component.
|
|
560
|
+
component.K = runtime;
|
|
561
|
+
component.L = tagName;
|
|
569
562
|
if (!customElements.get(tagName)) {
|
|
570
563
|
customElements.define(tagName, component);
|
|
571
564
|
}
|
|
@@ -576,7 +569,7 @@ function makeRuntime(options) {
|
|
|
576
569
|
globalThis.devOnly$luminaRuntime = runtime;
|
|
577
570
|
}
|
|
578
571
|
return runtime;
|
|
579
|
-
}
|
|
572
|
+
};
|
|
580
573
|
const Fragment = void 0;
|
|
581
574
|
const bindAttribute = void 0;
|
|
582
575
|
const bindBooleanAttribute = void 0;
|
|
@@ -651,11 +644,11 @@ const makeReactWrapperFactory = (react, createComponent) => (options) => {
|
|
|
651
644
|
return result;
|
|
652
645
|
};
|
|
653
646
|
const getReactWrapperOptions = (tagNameAndElement, events) => ({ tagName: tagNameAndElement, events });
|
|
654
|
-
|
|
647
|
+
const renderElement = (element) => {
|
|
655
648
|
const container = document.createElement("div");
|
|
656
649
|
render(element, container);
|
|
657
650
|
return container.firstElementChild;
|
|
658
|
-
}
|
|
651
|
+
};
|
|
659
652
|
export {
|
|
660
653
|
Fragment,
|
|
661
654
|
LitElement,
|
|
@@ -663,9 +656,10 @@ export {
|
|
|
663
656
|
bindBooleanAttribute,
|
|
664
657
|
bindEvent,
|
|
665
658
|
bindProperty,
|
|
666
|
-
|
|
659
|
+
b as createEvent,
|
|
667
660
|
deferLoad,
|
|
668
661
|
deferredLoaders,
|
|
662
|
+
d as devOnly$getLitElementTagNameAndRuntime,
|
|
669
663
|
directive,
|
|
670
664
|
getReactWrapperOptions,
|
|
671
665
|
live,
|