@arcgis/lumina 4.33.0-next.99 → 4.34.0-next.0
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-BQOv8BAL.js} +170 -210
- 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 +6 -21
- package/dist/controllers/accessor/index.d.ts +3 -1
- package/dist/controllers/accessor/index.js +208 -222
- package/dist/controllers/accessor/reEmitEvent.d.ts +1 -1
- package/dist/controllers/accessor/store.d.ts +17 -0
- package/dist/controllers/accessor/useAccessor.d.ts +29 -32
- package/dist/controllers/index.d.ts +2 -2
- package/dist/controllers/index.js +45 -38
- 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/usePropertyChange.d.ts +3 -1
- package/dist/controllers/utils.d.ts +6 -9
- package/dist/createEvent.d.ts +4 -4
- package/dist/hmrSupport.js +22 -22
- package/dist/index.d.ts +1 -1
- package/dist/index.js +193 -200
- package/dist/jsx/generatedTypes.d.ts +414 -80
- package/dist/lazyLoad-DUvrNd2L.js +406 -0
- package/dist/lazyLoad.d.ts +22 -67
- package/dist/lifecycleSupport.d.ts +1 -1
- package/dist/makeRuntime.d.ts +40 -1
- package/dist/{proxyExports-CK5BLFLO.js → proxyExports-Cdzj7WL_.js} +8 -8
- package/dist/render.d.ts +1 -1
- package/dist/utils.d.ts +8 -0
- package/dist/wrappersUtils.d.ts +13 -1
- package/package.json +5 -5
- package/dist/utils-DBdf1Dqp.js +0 -405
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, s as setAmbientComponent,
|
|
3
|
-
import {
|
|
2
|
+
import { r as retrieveComponent, G as GenericController, k as keyTrackResolve, s as setAmbientComponent, c as controllerSymbol, a as shouldBypassReadOnly } from "./Controller-BQOv8BAL.js";
|
|
3
|
+
import { b } from "./Controller-BQOv8BAL.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-DUvrNd2L.js";
|
|
7
|
+
import { d, m } from "./lazyLoad-DUvrNd2L.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,108 @@ 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.constructor.K.c?.(() => this.requestUpdate());
|
|
358
|
+
this.#trackingTarget = trackingTarget;
|
|
389
359
|
const isFirstCall = !this.manager.connectedCalled;
|
|
390
360
|
super.connectedCallback();
|
|
391
361
|
if (isFirstCall) {
|
|
392
362
|
queueMicrotask(
|
|
393
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
394
|
-
() => this
|
|
395
|
-
this.
|
|
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();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
#doTrackedUpdate(changedProperties) {
|
|
376
|
+
try {
|
|
377
|
+
this.#trackingTarget.clear();
|
|
378
|
+
this.constructor.K.r(
|
|
379
|
+
this.#trackingTarget,
|
|
380
|
+
() => super.update(changedProperties)
|
|
381
|
+
);
|
|
382
|
+
} catch (error) {
|
|
383
|
+
this.#trackingTarget.clear();
|
|
384
|
+
throw error;
|
|
401
385
|
}
|
|
402
386
|
}
|
|
387
|
+
disconnectedCallback() {
|
|
388
|
+
super.disconnectedCallback();
|
|
389
|
+
this.#trackingTarget?.destroy();
|
|
390
|
+
this.#trackingTarget = void 0;
|
|
391
|
+
}
|
|
403
392
|
/**
|
|
404
393
|
* Overwrite Lit's default behavior of attaching shadow root to the lit
|
|
405
394
|
* element, and instead use this.el to support lazy builds.
|
|
@@ -431,13 +420,13 @@ class LitElement extends LitElement$1 {
|
|
|
431
420
|
return renderRoot;
|
|
432
421
|
}
|
|
433
422
|
/** Do asynchronous component load */
|
|
434
|
-
async
|
|
435
|
-
const parentLoadPromise = this.el.
|
|
423
|
+
async #load() {
|
|
424
|
+
const parentLoadPromise = this.el.G ?? attachToAncestor(this.el);
|
|
436
425
|
if (parentLoadPromise) {
|
|
437
426
|
await parentLoadPromise;
|
|
438
427
|
}
|
|
439
428
|
const promises = [];
|
|
440
|
-
for (const controller of this.
|
|
429
|
+
for (const controller of this.M) {
|
|
441
430
|
if ("triggerLoad" in controller) {
|
|
442
431
|
promises.push(controller.triggerLoad());
|
|
443
432
|
} else {
|
|
@@ -448,20 +437,20 @@ class LitElement extends LitElement$1 {
|
|
|
448
437
|
await this.load?.();
|
|
449
438
|
if (this.manager.hasDestroy) {
|
|
450
439
|
this.manager.onUpdate(
|
|
451
|
-
(changes) => changes.has(autoDestroyDisabledPropName) && this.manager.
|
|
440
|
+
(changes) => changes.has(autoDestroyDisabledPropName) && this.manager.U()
|
|
452
441
|
);
|
|
453
442
|
}
|
|
454
|
-
this
|
|
443
|
+
this.#enableUpdating(true);
|
|
455
444
|
this.performUpdate();
|
|
456
|
-
this.
|
|
445
|
+
this.I.resolve();
|
|
457
446
|
await Promise.resolve();
|
|
458
|
-
const pendingChildren = this.
|
|
447
|
+
const pendingChildren = this.J.filter((loaded) => !loaded.manager?.loadedCalled);
|
|
459
448
|
if (pendingChildren.length) {
|
|
460
449
|
await Promise.allSettled(pendingChildren.map(async (child) => await child.componentOnReady()));
|
|
461
450
|
}
|
|
462
|
-
this.
|
|
463
|
-
this.el.setAttribute(this.constructor.
|
|
464
|
-
for (const controller of this.
|
|
451
|
+
this.J.length = 0;
|
|
452
|
+
this.el.setAttribute(this.constructor.K.hydratedAttribute, "");
|
|
453
|
+
for (const controller of this.M) {
|
|
465
454
|
if ("triggerLoaded" in controller) {
|
|
466
455
|
controller.triggerLoaded();
|
|
467
456
|
} else {
|
|
@@ -469,15 +458,22 @@ class LitElement extends LitElement$1 {
|
|
|
469
458
|
}
|
|
470
459
|
}
|
|
471
460
|
this.loaded?.();
|
|
472
|
-
this.
|
|
461
|
+
this.#postLoadedDeferred.resolve();
|
|
473
462
|
}
|
|
474
463
|
/**
|
|
475
464
|
* Overwriting default shouldUpdate simply to get access to
|
|
476
465
|
* "changedProperties" so that we can later provide it to ControllerManager
|
|
477
466
|
*/
|
|
478
467
|
shouldUpdate(_changedProperties) {
|
|
479
|
-
this.manager.
|
|
480
|
-
return this
|
|
468
|
+
this.manager.Q = _changedProperties;
|
|
469
|
+
return this.#originalShouldUpdate?.(_changedProperties) ?? true;
|
|
470
|
+
}
|
|
471
|
+
update(changedProperties) {
|
|
472
|
+
if (this.#trackingTarget) {
|
|
473
|
+
this.#doTrackedUpdate(changedProperties);
|
|
474
|
+
} else {
|
|
475
|
+
super.update(changedProperties);
|
|
476
|
+
}
|
|
481
477
|
}
|
|
482
478
|
listen(name, listener, options) {
|
|
483
479
|
const boundListener = listener?.bind(this) ?? listener;
|
|
@@ -504,7 +500,7 @@ class LitElement extends LitElement$1 {
|
|
|
504
500
|
* });
|
|
505
501
|
*/
|
|
506
502
|
async componentOnReady() {
|
|
507
|
-
await this.
|
|
503
|
+
await this.#postLoadedDeferred.promise;
|
|
508
504
|
return this;
|
|
509
505
|
}
|
|
510
506
|
/**
|
|
@@ -517,7 +513,7 @@ class LitElement extends LitElement$1 {
|
|
|
517
513
|
* timing, and to add support for load/loaded lifecycle hooks.
|
|
518
514
|
*/
|
|
519
515
|
addController(controller) {
|
|
520
|
-
this.
|
|
516
|
+
this.M.push(controller);
|
|
521
517
|
if (!(controllerSymbol in controller) && this.renderRoot && this.el.isConnected) {
|
|
522
518
|
controller.hostConnected?.();
|
|
523
519
|
}
|
|
@@ -526,18 +522,11 @@ class LitElement extends LitElement$1 {
|
|
|
526
522
|
* Removes a controller from the host.
|
|
527
523
|
*/
|
|
528
524
|
removeController(controller) {
|
|
529
|
-
this.
|
|
525
|
+
this.M.splice(this.M.indexOf(controller), 1);
|
|
530
526
|
controller.controllerRemoved?.();
|
|
531
527
|
}
|
|
532
528
|
}
|
|
533
|
-
|
|
534
|
-
const globalWithLit = globalThis;
|
|
535
|
-
globalWithLit.litIssuedWarnings ??= /* @__PURE__ */ new Set();
|
|
536
|
-
globalWithLit.litIssuedWarnings.add(
|
|
537
|
-
"Overriding ReactiveElement.createProperty() is deprecated. The override will not be called with standard decorators See https://lit.dev/msg/no-override-create-property for more information."
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
function makeRuntime(options) {
|
|
529
|
+
const makeRuntime = (options) => {
|
|
541
530
|
let assetPath;
|
|
542
531
|
const setAssetPath = (path) => {
|
|
543
532
|
assetPath = new URL(
|
|
@@ -571,8 +560,8 @@ function makeRuntime(options) {
|
|
|
571
560
|
},
|
|
572
561
|
setAssetPath,
|
|
573
562
|
customElement(tagName, component) {
|
|
574
|
-
component.
|
|
575
|
-
component.
|
|
563
|
+
component.K = runtime;
|
|
564
|
+
component.L = tagName;
|
|
576
565
|
if (!customElements.get(tagName)) {
|
|
577
566
|
customElements.define(tagName, component);
|
|
578
567
|
}
|
|
@@ -583,7 +572,7 @@ function makeRuntime(options) {
|
|
|
583
572
|
globalThis.devOnly$luminaRuntime = runtime;
|
|
584
573
|
}
|
|
585
574
|
return runtime;
|
|
586
|
-
}
|
|
575
|
+
};
|
|
587
576
|
const Fragment = void 0;
|
|
588
577
|
const bindAttribute = void 0;
|
|
589
578
|
const bindBooleanAttribute = void 0;
|
|
@@ -640,10 +629,13 @@ const makeReactWrapperFactory = (react, createComponent) => (options) => {
|
|
|
640
629
|
*/
|
|
641
630
|
get prototype() {
|
|
642
631
|
if (customElementPrototype === void 0) {
|
|
643
|
-
|
|
644
|
-
if (!
|
|
632
|
+
const customElement = customElements.get(tagName);
|
|
633
|
+
if (!customElement) {
|
|
645
634
|
throw new Error(`Custom element "${tagName}" not found`);
|
|
646
635
|
}
|
|
636
|
+
customElement.F?.();
|
|
637
|
+
customElement.F = emptyFunction;
|
|
638
|
+
customElementPrototype = customElement.prototype;
|
|
647
639
|
Object.defineProperty(elementClass, "prototype", { value: customElementPrototype });
|
|
648
640
|
}
|
|
649
641
|
return customElementPrototype;
|
|
@@ -658,11 +650,11 @@ const makeReactWrapperFactory = (react, createComponent) => (options) => {
|
|
|
658
650
|
return result;
|
|
659
651
|
};
|
|
660
652
|
const getReactWrapperOptions = (tagNameAndElement, events) => ({ tagName: tagNameAndElement, events });
|
|
661
|
-
|
|
653
|
+
const renderElement = (element) => {
|
|
662
654
|
const container = document.createElement("div");
|
|
663
655
|
render(element, container);
|
|
664
656
|
return container.firstElementChild;
|
|
665
|
-
}
|
|
657
|
+
};
|
|
666
658
|
export {
|
|
667
659
|
Fragment,
|
|
668
660
|
LitElement,
|
|
@@ -670,9 +662,10 @@ export {
|
|
|
670
662
|
bindBooleanAttribute,
|
|
671
663
|
bindEvent,
|
|
672
664
|
bindProperty,
|
|
673
|
-
|
|
665
|
+
b as createEvent,
|
|
674
666
|
deferLoad,
|
|
675
667
|
deferredLoaders,
|
|
668
|
+
d as devOnly$getLitElementTagNameAndRuntime,
|
|
676
669
|
directive,
|
|
677
670
|
getReactWrapperOptions,
|
|
678
671
|
live,
|