@arcgis/lumina 4.32.0-next.7 → 4.32.0-next.71
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/LitElement.d.ts +12 -1
- package/dist/PublicLitElement.d.ts +1 -0
- package/dist/chunk-J3BVM76V.js +418 -0
- package/dist/{chunk-CH52Q2MB.js → chunk-PGHUBTOM.js} +0 -6
- package/dist/config.d.ts +0 -8
- package/dist/config.js +1 -7
- package/dist/context.d.ts +26 -0
- package/dist/createEvent.d.ts +7 -2
- package/dist/hmrSupport.d.ts +5 -0
- package/dist/hmrSupport.js +127 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +118 -532
- package/dist/jsx/baseTypes.d.ts +35 -0
- package/dist/jsx/directives.d.ts +4 -0
- package/dist/jsx/generatedTypes.d.ts +2300 -0
- package/dist/jsx/types.d.ts +421 -0
- package/dist/lazyLoad.d.ts +16 -2
- package/dist/runtime.d.ts +7 -3
- package/dist/stencilSsrCompatibility/index.d.ts +0 -1
- package/dist/typings/index.d.ts +4 -4
- package/dist/typings/jsxGlobals.d.ts +17 -19
- package/dist/wrappersUtils.d.ts +31 -7
- package/dist/wrappersUtils.test.d.ts +1 -0
- package/package.json +5 -3
- package/dist/jsx/jsx.d.ts +0 -2043
package/dist/LitElement.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { LitElement as OriginalLitElement } from "lit";
|
|
|
3
3
|
import type { LuminaPropertyDeclaration } from "@arcgis/components-controllers";
|
|
4
4
|
import type { Runtime } from "./runtime";
|
|
5
5
|
import type { ProxyComponent } from "./lazyLoad";
|
|
6
|
-
import type { ToElement } from "./jsx/
|
|
6
|
+
import type { ToElement } from "./jsx/types";
|
|
7
7
|
type ComponentLifecycle = {
|
|
8
8
|
connectedCallback?: () => void;
|
|
9
9
|
disconnectedCallback?: () => void;
|
|
@@ -36,6 +36,9 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
36
36
|
/** @internal */
|
|
37
37
|
static runtime: Runtime;
|
|
38
38
|
static tagName: string;
|
|
39
|
+
/**
|
|
40
|
+
* Customize Lit's default style handling to support non-shadow-root styles
|
|
41
|
+
*/
|
|
39
42
|
static finalizeStyles(styles?: CSSResultGroup): CSSResultOrNative[];
|
|
40
43
|
static createProperty(name: PropertyKey,
|
|
41
44
|
/**
|
|
@@ -230,4 +233,12 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
230
233
|
type Listener<ThisType, EventType> = ((this: ThisType, event: EventType) => unknown) | {
|
|
231
234
|
handleEvent(event: EventType): unknown;
|
|
232
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* List of tag names defined by this library.
|
|
238
|
+
*
|
|
239
|
+
* @private
|
|
240
|
+
*/
|
|
241
|
+
export type GlobalThisWithOwnTagNames = typeof globalThis & {
|
|
242
|
+
devOnly$ownTagNames?: Set<string>;
|
|
243
|
+
};
|
|
233
244
|
export {};
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import {
|
|
2
|
+
lazyMetaGroupJoiner,
|
|
3
|
+
lazyMetaItemJoiner,
|
|
4
|
+
lazyMetaSubItemJoiner
|
|
5
|
+
} from "./chunk-PGHUBTOM.js";
|
|
6
|
+
|
|
7
|
+
// src/lazyLoad.ts
|
|
8
|
+
import { Deferred, camelToKebab, isEsriInternalEnv } from "@arcgis/components-utils";
|
|
9
|
+
|
|
10
|
+
// src/devOnlyDetectIncorrectLazyUsages.ts
|
|
11
|
+
function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
12
|
+
const genericPrototype = LitClass.prototype;
|
|
13
|
+
const descriptor = Object.getOwnPropertyDescriptor(genericPrototype, "innerText");
|
|
14
|
+
if (descriptor !== void 0 && descriptor.get === descriptor.set) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const allowList = /* @__PURE__ */ new Set([
|
|
18
|
+
// We shouldn't be overwriting this property
|
|
19
|
+
"constructor",
|
|
20
|
+
// Called by Lit - we proxy it to this.el in ProxyComponent
|
|
21
|
+
"setAttribute",
|
|
22
|
+
// Called by Lit SSR - we proxy it to this.el in ProxyComponent
|
|
23
|
+
"removeAttribute",
|
|
24
|
+
// Called by Lit - we proxy it to this.el in ProxyComponent
|
|
25
|
+
"isConnected",
|
|
26
|
+
// Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
|
|
27
|
+
"localName",
|
|
28
|
+
// Called by Lit Context - we proxy it to this.el in ProxyComponent.
|
|
29
|
+
// Interestingly, they never call removeEventListener.
|
|
30
|
+
"addEventListener"
|
|
31
|
+
]);
|
|
32
|
+
const customErrorMessages = {
|
|
33
|
+
addEventListener: "use this.listen() or this.el.addEventListener()"
|
|
34
|
+
};
|
|
35
|
+
Object.entries({
|
|
36
|
+
...Object.getOwnPropertyDescriptors(HTMLElement.prototype),
|
|
37
|
+
...Object.getOwnPropertyDescriptors(Element.prototype),
|
|
38
|
+
...Object.getOwnPropertyDescriptors(Node.prototype),
|
|
39
|
+
...Object.getOwnPropertyDescriptors(EventTarget.prototype)
|
|
40
|
+
}).forEach(([key, value]) => {
|
|
41
|
+
if (allowList.has(key)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const callback = (...args) => {
|
|
45
|
+
if (key === "hasAttribute" && args[0] === "defer-hydration") {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
throw new Error(
|
|
49
|
+
`You should not be trying to access this.${key} directly as it won't work correctly in lazy-builds. Instead, ${customErrorMessages[key] ?? `use this.el.${key}`}`
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
if (typeof value.value === "function") {
|
|
53
|
+
genericPrototype[key] = callback;
|
|
54
|
+
} else {
|
|
55
|
+
Object.defineProperty(genericPrototype, key, { get: callback, set: callback });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/lifecycleSupport.ts
|
|
61
|
+
function attachToAncestor(child) {
|
|
62
|
+
let ancestor = child;
|
|
63
|
+
while (ancestor = ancestor.parentNode ?? ancestor.host) {
|
|
64
|
+
if (ancestor?.constructor?.lumina) {
|
|
65
|
+
const litParent = ancestor;
|
|
66
|
+
if (!litParent.manager?.loadedCalled) {
|
|
67
|
+
litParent._offspring.push(child);
|
|
68
|
+
}
|
|
69
|
+
return litParent._postLoad.promise;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/lazyLoad.ts
|
|
76
|
+
var makeDefineCustomElements = (runtime, structure) => function defineCustomElements(windowOrOptions, options) {
|
|
77
|
+
if (!globalThis.customElements) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const resolvedOptions = options ?? windowOrOptions ?? {};
|
|
81
|
+
const resourcesUrl = resolvedOptions.resourcesUrl;
|
|
82
|
+
if (resourcesUrl) {
|
|
83
|
+
runtime.setAssetPath(resourcesUrl);
|
|
84
|
+
}
|
|
85
|
+
Object.entries(structure).forEach(createLazyElement);
|
|
86
|
+
};
|
|
87
|
+
function createLazyElement([tagName, [load, compactMeta = ""]]) {
|
|
88
|
+
if (customElements.get(tagName)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const [compactObservedProps, compactAsyncMethods, compactSyncMethods] = compactMeta.split(lazyMetaGroupJoiner);
|
|
92
|
+
const observedProps = compactObservedProps ? compactObservedProps?.split(lazyMetaItemJoiner).map(parseCondensedProp) : void 0;
|
|
93
|
+
const observedProperties = observedProps?.map(([property]) => property);
|
|
94
|
+
const ProxyClass = class extends ProxyComponent {
|
|
95
|
+
static {
|
|
96
|
+
this.observedAttributes = observedProps?.map(([, attribute]) => attribute).filter((attribute) => attribute !== "");
|
|
97
|
+
}
|
|
98
|
+
static {
|
|
99
|
+
this._properties = observedProperties;
|
|
100
|
+
}
|
|
101
|
+
static {
|
|
102
|
+
this._asyncMethods = compactAsyncMethods ? compactAsyncMethods?.split(lazyMetaItemJoiner) : void 0;
|
|
103
|
+
}
|
|
104
|
+
static {
|
|
105
|
+
this._syncMethods = compactSyncMethods?.split(lazyMetaItemJoiner);
|
|
106
|
+
}
|
|
107
|
+
static {
|
|
108
|
+
this._name = tagName;
|
|
109
|
+
}
|
|
110
|
+
constructor() {
|
|
111
|
+
const isFirstInstanceOfType = !ProxyClass._loadPromise;
|
|
112
|
+
if (isFirstInstanceOfType) {
|
|
113
|
+
ProxyClass._loadPromise = load();
|
|
114
|
+
ProxyClass._initializePrototype();
|
|
115
|
+
}
|
|
116
|
+
super();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
customElements.define(tagName, ProxyClass);
|
|
120
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production") {
|
|
121
|
+
globalThis.devOnly$ownTagNames?.add(tagName);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
var defineProperty = Object.defineProperty;
|
|
125
|
+
function parseCondensedProp(propAndAttribute) {
|
|
126
|
+
const name = propAndAttribute.split(lazyMetaSubItemJoiner);
|
|
127
|
+
return name.length === 1 ? [name[0], camelToKebab(name[0])] : name;
|
|
128
|
+
}
|
|
129
|
+
var HtmlElement = globalThis.HTMLElement ?? parseCondensedProp;
|
|
130
|
+
var ProxyComponent = class extends HtmlElement {
|
|
131
|
+
constructor() {
|
|
132
|
+
super();
|
|
133
|
+
/** @internal */
|
|
134
|
+
this._store = {};
|
|
135
|
+
/**
|
|
136
|
+
* If attributeChangedCallback() is called before the LitElement is loaded,
|
|
137
|
+
* store the attributes here, and replay later
|
|
138
|
+
*/
|
|
139
|
+
this._pendingAttributes = [];
|
|
140
|
+
/**
|
|
141
|
+
* Resolved once LitElement's load() is complete.
|
|
142
|
+
* Not read inside of this class, but needed for LitElement to determine if
|
|
143
|
+
* it's closest ancestor finished load()
|
|
144
|
+
*/
|
|
145
|
+
this._postLoad = new Deferred();
|
|
146
|
+
/**
|
|
147
|
+
* Resolved once LitElement's loaded() is complete
|
|
148
|
+
*/
|
|
149
|
+
this._postLoaded = new Deferred();
|
|
150
|
+
/**
|
|
151
|
+
* Direct offspring that should be awaited before loaded() is emitted
|
|
152
|
+
*/
|
|
153
|
+
this._offspring = [];
|
|
154
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
155
|
+
this._hmrSetProps = /* @__PURE__ */ new Set();
|
|
156
|
+
this._hmrSetAttributes = /* @__PURE__ */ new Set();
|
|
157
|
+
globalThis.devOnly$createdElements ??= [];
|
|
158
|
+
globalThis.devOnly$createdElements.push(new WeakRef(this));
|
|
159
|
+
}
|
|
160
|
+
this._saveInstanceProperties();
|
|
161
|
+
const ProxyClass = this.constructor;
|
|
162
|
+
if (ProxyClass._LitConstructor) {
|
|
163
|
+
this._initializeComponent({ a: ProxyClass._LitConstructor });
|
|
164
|
+
} else {
|
|
165
|
+
void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch((error) => {
|
|
166
|
+
this._postLoaded.reject(error);
|
|
167
|
+
setTimeout(() => {
|
|
168
|
+
throw error;
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
173
|
+
ProxyClass._hmrInstances ??= [];
|
|
174
|
+
ProxyClass._hmrInstances.push(new WeakRef(this));
|
|
175
|
+
Object.defineProperty(this, "_store", {
|
|
176
|
+
value: this._store,
|
|
177
|
+
enumerable: false,
|
|
178
|
+
configurable: true
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
static {
|
|
183
|
+
this.lumina = true;
|
|
184
|
+
}
|
|
185
|
+
/** @internal */
|
|
186
|
+
static _initializePrototype() {
|
|
187
|
+
this._properties?.forEach(this._bindProp, this);
|
|
188
|
+
this._asyncMethods?.forEach(this._bindAsync, this);
|
|
189
|
+
this._syncMethods?.forEach(this._bindSync, this);
|
|
190
|
+
}
|
|
191
|
+
static _bindProp(propName) {
|
|
192
|
+
defineProperty(this.prototype, propName, {
|
|
193
|
+
configurable: true,
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get() {
|
|
196
|
+
return this._store[propName];
|
|
197
|
+
},
|
|
198
|
+
set(value) {
|
|
199
|
+
this._store[propName] = value;
|
|
200
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
201
|
+
this._hmrSetProps.add(propName);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
static _bindAsync(methodName) {
|
|
207
|
+
defineProperty(this.prototype, methodName, {
|
|
208
|
+
async value(...args) {
|
|
209
|
+
if (!this._litElement) {
|
|
210
|
+
await this._postLoaded.promise;
|
|
211
|
+
}
|
|
212
|
+
const genericLitElement = this._litElement;
|
|
213
|
+
return await genericLitElement[methodName](...args);
|
|
214
|
+
},
|
|
215
|
+
configurable: true
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
static _bindSync(methodName) {
|
|
219
|
+
defineProperty(this.prototype, methodName, {
|
|
220
|
+
value(...args) {
|
|
221
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && !this._litElement) {
|
|
222
|
+
const ProxyClass = this.constructor;
|
|
223
|
+
throw new Error(
|
|
224
|
+
`Tried to call method ${methodName}() on <${ProxyClass._name}> component before it's fully loaded. Please do 'await component.componentOnReady();' before calling this method.`
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
const genericLitElement = this._litElement;
|
|
228
|
+
return genericLitElement[methodName](...args);
|
|
229
|
+
},
|
|
230
|
+
configurable: true
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
get manager() {
|
|
234
|
+
return this._litElement?.manager;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Until the custom element is registered on the page, an instance of that
|
|
238
|
+
* element can be constructed and some properties on that instance set.
|
|
239
|
+
*
|
|
240
|
+
* These properties are set before the element prototype is set to this proxy
|
|
241
|
+
* class and thus none of our getters/setters are yet registered - such
|
|
242
|
+
* properties will be set by JavaScript on the instance directly.
|
|
243
|
+
*
|
|
244
|
+
* Once element is registered, the properties set in the meanwhile will shadow
|
|
245
|
+
* the getter/setters, and thus break reactivity. The fix is to delete these
|
|
246
|
+
* properties from the instance, and re-apply them once accessors are set.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* import { defineCustomElements } from '@arcgis/map-components';
|
|
251
|
+
* const map = document.createElement('arcgis-map');
|
|
252
|
+
* // This will shadow the getter/setters
|
|
253
|
+
* map.itemId = '...';
|
|
254
|
+
* // This finally defines the custom elements and sets the property accessors
|
|
255
|
+
* defineCustomElements();
|
|
256
|
+
* ```
|
|
257
|
+
*
|
|
258
|
+
* @remarks
|
|
259
|
+
* This is an equivalent of the __saveInstanceProperties method in Lit's
|
|
260
|
+
* ReactiveElement. Lit takes care of this on LitElement, but we have to take
|
|
261
|
+
* care of this on the lazy proxy
|
|
262
|
+
*/
|
|
263
|
+
_saveInstanceProperties() {
|
|
264
|
+
const ProxyClass = this.constructor;
|
|
265
|
+
const genericThis = this;
|
|
266
|
+
ProxyClass._properties?.forEach((propName) => {
|
|
267
|
+
if (Object.hasOwn(this, propName)) {
|
|
268
|
+
this._store[propName] = genericThis[propName];
|
|
269
|
+
delete genericThis[propName];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/*
|
|
274
|
+
* This method must be statically present rather than added later, or else,
|
|
275
|
+
* browsers won't call it. Same for connected and disconnected callbacks.
|
|
276
|
+
*/
|
|
277
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
278
|
+
this._litElement?.attributeChangedCallback(name, oldValue, newValue);
|
|
279
|
+
if (!this._litElement) {
|
|
280
|
+
this._pendingAttributes.push(name);
|
|
281
|
+
}
|
|
282
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
283
|
+
this._hmrSetAttributes.add(name);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
connectedCallback() {
|
|
287
|
+
if (this._litElement) {
|
|
288
|
+
this._litElement.connectedCallback?.();
|
|
289
|
+
} else {
|
|
290
|
+
queueMicrotask(() => {
|
|
291
|
+
this._ancestorLoad = attachToAncestor(this);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
disconnectedCallback() {
|
|
296
|
+
this._litElement?.disconnectedCallback?.();
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Create a promise that resolves once component is fully loaded
|
|
300
|
+
*/
|
|
301
|
+
async componentOnReady() {
|
|
302
|
+
await this._postLoaded.promise;
|
|
303
|
+
return this;
|
|
304
|
+
}
|
|
305
|
+
/** @internal */
|
|
306
|
+
_initializeComponent(module) {
|
|
307
|
+
const ProxyClass = this.constructor;
|
|
308
|
+
const tagName = ProxyClass._name;
|
|
309
|
+
const store = this._store;
|
|
310
|
+
const LitConstructor = Object.values(module).find(
|
|
311
|
+
(LitConstructor2) => LitConstructor2.tagName === tagName
|
|
312
|
+
);
|
|
313
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv() && !LitConstructor) {
|
|
314
|
+
throw new Error(
|
|
315
|
+
`Unable to find the LitElement class for the "${tagName}" custom element in the lazy-loaded module`
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
const lazyTagName = typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv() ? (ProxyClass._hmrIndex ?? 0) === 0 ? `${tagName}--lazy` : `${tagName}--lazy-${ProxyClass._hmrIndex}` : `${tagName}--lazy`;
|
|
319
|
+
let parentClass = LitConstructor;
|
|
320
|
+
while (parentClass && !Object.hasOwn(parentClass, "lumina")) {
|
|
321
|
+
parentClass = Object.getPrototypeOf(parentClass);
|
|
322
|
+
}
|
|
323
|
+
const litElementPrototype = parentClass.prototype;
|
|
324
|
+
const elementPrototype = Element.prototype;
|
|
325
|
+
const alreadyPatched = Object.hasOwn(litElementPrototype, "isConnected");
|
|
326
|
+
if (!alreadyPatched) {
|
|
327
|
+
litElementPrototype.setAttribute = function(qualifiedName, value) {
|
|
328
|
+
elementPrototype.setAttribute.call(this.el, qualifiedName, value);
|
|
329
|
+
};
|
|
330
|
+
litElementPrototype.removeAttribute = function(qualifiedName) {
|
|
331
|
+
elementPrototype.removeAttribute.call(this.el, qualifiedName);
|
|
332
|
+
};
|
|
333
|
+
defineProperty(litElementPrototype, "isConnected", {
|
|
334
|
+
get() {
|
|
335
|
+
return Reflect.get(elementPrototype, "isConnected", this.el);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
340
|
+
devOnlyDetectIncorrectLazyUsages(parentClass);
|
|
341
|
+
}
|
|
342
|
+
const isFirstInitialization = !ProxyClass._LitConstructor;
|
|
343
|
+
if (isFirstInitialization) {
|
|
344
|
+
ProxyClass._LitConstructor = LitConstructor;
|
|
345
|
+
customElements.define(lazyTagName, LitConstructor);
|
|
346
|
+
}
|
|
347
|
+
LitConstructor.lazy = this;
|
|
348
|
+
const litElement = document.createElement(lazyTagName);
|
|
349
|
+
LitConstructor.lazy = void 0;
|
|
350
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
351
|
+
Object.defineProperty(this, "_litElement", {
|
|
352
|
+
value: litElement,
|
|
353
|
+
configurable: true,
|
|
354
|
+
enumerable: false
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
this._litElement = litElement;
|
|
358
|
+
}
|
|
359
|
+
this._store = litElement;
|
|
360
|
+
this._pendingAttributes.forEach((name) => {
|
|
361
|
+
const value = this.getAttribute(name);
|
|
362
|
+
litElement.attributeChangedCallback(
|
|
363
|
+
name,
|
|
364
|
+
// Lit doesn't look at this value, thus even if attribute already exists, that's ok
|
|
365
|
+
null,
|
|
366
|
+
value
|
|
367
|
+
);
|
|
368
|
+
});
|
|
369
|
+
Object.entries(store).forEach(syncLitElement, litElement);
|
|
370
|
+
if (typeof process === "object" && process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
371
|
+
const litObserved = LitConstructor.observedAttributes ?? [];
|
|
372
|
+
const lazyObserved = ProxyClass.observedAttributes ?? [];
|
|
373
|
+
const missingFromLazy = litObserved.filter((attribute) => !lazyObserved.includes(attribute));
|
|
374
|
+
const missingFromLit = lazyObserved.filter((attribute) => !litObserved.includes(attribute));
|
|
375
|
+
if (missingFromLazy.length > 0) {
|
|
376
|
+
console.warn(
|
|
377
|
+
`The following attributes on <${ProxyClass._name}> are present on the Lit element, but are missing from the lazy proxy component: ${missingFromLazy.join(", ")}. This either indicates a bug in Lumina, or you are creating the attribute dynamically in a way that compiler cannot infer statically. For these attributes, lazy-loading version of your component won't work correctly, thus this must be resolved`
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
if (missingFromLit.length > 0) {
|
|
381
|
+
console.warn(
|
|
382
|
+
`The following attributes on <${ProxyClass._name}> are defined on the lazy proxy component, but not on the actual Lit element: ${missingFromLit.join(", ")}. This either indicates a bug in Lumina, or you are creating the attribute dynamically in a way that compiler cannot infer statically. This is a non-critical issue, but does indicate that something is going wrong and should be fixed`
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const isStillConnected = this.isConnected;
|
|
387
|
+
if (isStillConnected || this._ancestorLoad) {
|
|
388
|
+
litElement.connectedCallback?.();
|
|
389
|
+
if (!isStillConnected) {
|
|
390
|
+
litElement.disconnectedCallback();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Implemented on the proxy for compatibility with Lit Context.
|
|
396
|
+
*/
|
|
397
|
+
addController() {
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Implemented on the proxy for compatibility with Lit Context.
|
|
401
|
+
*/
|
|
402
|
+
requestUpdate() {
|
|
403
|
+
this._litElement?.requestUpdate();
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
function syncLitElement([key, value]) {
|
|
407
|
+
this[key] = value;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// src/utils.ts
|
|
411
|
+
var noShadowRoot = {};
|
|
412
|
+
|
|
413
|
+
export {
|
|
414
|
+
attachToAncestor,
|
|
415
|
+
makeDefineCustomElements,
|
|
416
|
+
ProxyComponent,
|
|
417
|
+
noShadowRoot
|
|
418
|
+
};
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
var lazyMetaGroupJoiner = ";";
|
|
3
3
|
var lazyMetaItemJoiner = ",";
|
|
4
4
|
var lazyMetaSubItemJoiner = ":";
|
|
5
|
-
var defaultEventBubbles = true;
|
|
6
|
-
var defaultEventCancelable = true;
|
|
7
|
-
var defaultEventComposed = true;
|
|
8
5
|
var PropertyFlags = /* @__PURE__ */ ((PropertyFlags2) => {
|
|
9
6
|
PropertyFlags2[PropertyFlags2["ATTRIBUTE"] = 1] = "ATTRIBUTE";
|
|
10
7
|
PropertyFlags2[PropertyFlags2["REFLECT"] = 2] = "REFLECT";
|
|
@@ -20,8 +17,5 @@ export {
|
|
|
20
17
|
lazyMetaGroupJoiner,
|
|
21
18
|
lazyMetaItemJoiner,
|
|
22
19
|
lazyMetaSubItemJoiner,
|
|
23
|
-
defaultEventBubbles,
|
|
24
|
-
defaultEventCancelable,
|
|
25
|
-
defaultEventComposed,
|
|
26
20
|
PropertyFlags
|
|
27
21
|
};
|
package/dist/config.d.ts
CHANGED
|
@@ -6,14 +6,6 @@
|
|
|
6
6
|
export declare const lazyMetaGroupJoiner = ";";
|
|
7
7
|
export declare const lazyMetaItemJoiner = ",";
|
|
8
8
|
export declare const lazyMetaSubItemJoiner = ":";
|
|
9
|
-
/**
|
|
10
|
-
* While these defaults don't match DOM defaults (all false), they match
|
|
11
|
-
* Stencil and Shoelace defaults. Also, they make more sense for our
|
|
12
|
-
* usage (i.e why would you want events to not be cancelable by default?)
|
|
13
|
-
*/
|
|
14
|
-
export declare const defaultEventBubbles = true;
|
|
15
|
-
export declare const defaultEventCancelable = true;
|
|
16
|
-
export declare const defaultEventComposed = true;
|
|
17
9
|
/**
|
|
18
10
|
* By default in Lit, the `@property()` decorator accepts an object. However, to
|
|
19
11
|
* keep the bundle size smaller, in production builds, instead of passing it an
|
package/dist/config.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PropertyFlags,
|
|
3
|
-
defaultEventBubbles,
|
|
4
|
-
defaultEventCancelable,
|
|
5
|
-
defaultEventComposed,
|
|
6
3
|
lazyMetaGroupJoiner,
|
|
7
4
|
lazyMetaItemJoiner,
|
|
8
5
|
lazyMetaSubItemJoiner
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PGHUBTOM.js";
|
|
10
7
|
export {
|
|
11
8
|
PropertyFlags,
|
|
12
|
-
defaultEventBubbles,
|
|
13
|
-
defaultEventCancelable,
|
|
14
|
-
defaultEventComposed,
|
|
15
9
|
lazyMetaGroupJoiner,
|
|
16
10
|
lazyMetaItemJoiner,
|
|
17
11
|
lazyMetaSubItemJoiner
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ControllerHost } from "@arcgis/components-controllers";
|
|
2
|
+
import { ContextConsumer, ContextProvider, type Context, type ContextType } from "@lit/context";
|
|
3
|
+
interface ContextProviderOptions<C extends Context<unknown, unknown>> {
|
|
4
|
+
context: C;
|
|
5
|
+
initialValue?: ContextType<C>;
|
|
6
|
+
}
|
|
7
|
+
interface ContextConsumerOptions<C extends Context<unknown, unknown>> {
|
|
8
|
+
context: C;
|
|
9
|
+
callback?: (value: ContextType<C>, dispose?: () => void) => void;
|
|
10
|
+
subscribe?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper for Lit's ContextProvider controller to provide lazy-loading compatibility.
|
|
14
|
+
*
|
|
15
|
+
* @see https://lit.dev/docs/data/context/
|
|
16
|
+
*/
|
|
17
|
+
export declare function useContextProvider<C extends Context<unknown, unknown>>(options: ContextProviderOptions<C>): ContextProvider<C>;
|
|
18
|
+
/**
|
|
19
|
+
* Wrapper for Lit's ContextConsumer controller to provide lazy-loading compatibility.
|
|
20
|
+
*
|
|
21
|
+
* @see https://lit.dev/docs/data/context/
|
|
22
|
+
*
|
|
23
|
+
* FEATURE: wrap this in proxyExports to improve DX, or keep it simple?
|
|
24
|
+
*/
|
|
25
|
+
export declare function useContextConsumer<C extends Context<unknown, unknown>>(options: ContextConsumerOptions<C>): ContextConsumer<C, ControllerHost & HTMLElement>;
|
|
26
|
+
export {};
|
package/dist/createEvent.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { EventEmitter } from "@arcgis/components-controllers";
|
|
1
|
+
import type { BaseComponent, EventEmitter } from "@arcgis/components-controllers";
|
|
2
|
+
/**
|
|
3
|
+
* While these defaults don't match DOM defaults (all false), they match
|
|
4
|
+
* Stencil and Shoelace defaults. Also, they make more sense for our
|
|
5
|
+
* usage (i.e why would you want events to not be cancelable by default?)
|
|
6
|
+
*/
|
|
2
7
|
export type EventOptions = {
|
|
3
8
|
/**
|
|
4
9
|
* A Boolean indicating whether the event bubbles up through the DOM or not.
|
|
@@ -22,7 +27,7 @@ export type EventOptions = {
|
|
|
22
27
|
*/
|
|
23
28
|
composed?: boolean;
|
|
24
29
|
};
|
|
25
|
-
export declare const createEventFactory: <T = undefined>(eventName?: string, options?: EventOptions, component?:
|
|
30
|
+
export declare const createEventFactory: <T = undefined>(eventName?: string, options?: EventOptions, component?: BaseComponent) => EventEmitter<T>;
|
|
26
31
|
/**
|
|
27
32
|
* Creates an event emitter.
|
|
28
33
|
* Events emitted by your component will be included in the documentation.
|
package/dist/hmrSupport.d.ts
CHANGED
|
@@ -5,8 +5,11 @@ import type { ModuleNamespace } from "vite/types/hot.js";
|
|
|
5
5
|
* @remarks
|
|
6
6
|
* You should not need to call this function directly - it will be inserted
|
|
7
7
|
* automatically when running in serve mode.
|
|
8
|
+
*
|
|
9
|
+
* @private
|
|
8
10
|
*/
|
|
9
11
|
export declare function handleHmrUpdate(newModules: (ModuleNamespace | undefined)[]): void;
|
|
12
|
+
/** @private */
|
|
10
13
|
export type HmrComponentMeta = {
|
|
11
14
|
readonly tagName: string;
|
|
12
15
|
/**
|
|
@@ -25,5 +28,7 @@ export type HmrComponentMeta = {
|
|
|
25
28
|
* @remarks
|
|
26
29
|
* You should not need to call this function directly - it will be inserted
|
|
27
30
|
* automatically when running in serve mode.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
28
33
|
*/
|
|
29
34
|
export declare function handleComponentMetaUpdate(meta: HmrComponentMeta): void;
|