@arcgis/lumina 4.31.0-next.98 → 4.31.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/LitElement.d.ts +20 -3
- package/dist/chunk-A4JIXA23.js +31 -0
- package/dist/chunk-A4JIXA23.js.map +1 -0
- package/dist/chunk-CTQVJVF7.js +39 -0
- package/dist/chunk-CTQVJVF7.js.map +1 -0
- package/dist/chunk-DEEVUK5Y.js +28 -0
- package/dist/chunk-DEEVUK5Y.js.map +1 -0
- package/dist/chunk-EVAF2JRB.js +16 -0
- package/dist/chunk-FOOMFQOW.js +31 -0
- package/dist/chunk-FOOMFQOW.js.map +1 -0
- package/dist/chunk-HHA4SRXI.js +28 -0
- package/dist/chunk-HHA4SRXI.js.map +1 -0
- package/dist/chunk-KAFHPLZ3.js +39 -0
- package/dist/chunk-KAFHPLZ3.js.map +1 -0
- package/dist/chunk-NENDOZLN.js +17 -0
- package/dist/chunk-NENDOZLN.js.map +1 -0
- package/dist/chunk-SWNWS2UY.js +28 -0
- package/dist/chunk-SWNWS2UY.js.map +1 -0
- package/dist/chunk-TITMTQYB.js +28 -0
- package/dist/chunk-TITMTQYB.js.map +1 -0
- package/dist/chunk-VDVC6NX7.js +38 -0
- package/dist/chunk-VDVC6NX7.js.map +1 -0
- package/dist/chunk-WASYSR3I.js +31 -0
- package/dist/chunk-WASYSR3I.js.map +1 -0
- package/dist/config.js.map +1 -0
- package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +4 -1
- package/dist/index.js +92 -34
- package/dist/index.js.map +1 -0
- package/dist/jsx/jsx.d.ts +21 -23
- package/dist/lazyLoad.d.ts +1 -1
- package/dist/lazyLoadSpec.d.ts +0 -0
- package/dist/lifecycleSupport.d.ts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/stencil-ssr-compatibility/index.js +1 -1
- package/dist/stencil-ssr-compatibility/index.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/typings/jsxGlobals.ts +38 -0
- package/dist/wrapperUtils.d.ts +9 -0
- package/package.json +5 -24
package/dist/index.js
CHANGED
|
@@ -61,11 +61,22 @@ import { Deferred, camelToKebab } from "@arcgis/components-utils";
|
|
|
61
61
|
// src/devOnlyDetectIncorrectLazyUsages.ts
|
|
62
62
|
function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
63
63
|
const genericPrototype = LitClass.prototype;
|
|
64
|
+
const firstGetter = Object.getOwnPropertyDescriptor(genericPrototype, "innerText");
|
|
65
|
+
const secondGetter = Object.getOwnPropertyDescriptor(genericPrototype, "innerHTML");
|
|
66
|
+
if (firstGetter === secondGetter && firstGetter !== void 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
64
69
|
const allowList = /* @__PURE__ */ new Set([
|
|
65
70
|
// We shouldn't be overwriting this property
|
|
66
71
|
"constructor",
|
|
67
72
|
// Called by Lit - we proxy it to this.el in ProxyComponent
|
|
68
|
-
"setAttribute"
|
|
73
|
+
"setAttribute",
|
|
74
|
+
// Called by Lit SSR - we proxy it to this.el in ProxyComponent
|
|
75
|
+
"removeAttribute",
|
|
76
|
+
// Called by Lit - we proxy it to this.el in ProxyComponent
|
|
77
|
+
"isConnected",
|
|
78
|
+
// Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
|
|
79
|
+
"localName"
|
|
69
80
|
]);
|
|
70
81
|
const customErrorMessages = {
|
|
71
82
|
addEventListener: "use this.listen() or this.el.addEventListener()"
|
|
@@ -75,28 +86,36 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
|
75
86
|
...Object.getOwnPropertyDescriptors(Element.prototype),
|
|
76
87
|
...Object.getOwnPropertyDescriptors(Node.prototype),
|
|
77
88
|
...Object.getOwnPropertyDescriptors(EventTarget.prototype)
|
|
78
|
-
}).
|
|
79
|
-
|
|
89
|
+
}).forEach(([key, value]) => {
|
|
90
|
+
if (allowList.has(key)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const callback = (...args) => {
|
|
80
94
|
if (key === "hasAttribute" && args[0] === "defer-hydration") {
|
|
81
95
|
return false;
|
|
82
96
|
}
|
|
83
97
|
throw new Error(
|
|
84
|
-
`You should not be
|
|
98
|
+
`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}`}`
|
|
85
99
|
);
|
|
86
100
|
};
|
|
101
|
+
if (typeof value === "function") {
|
|
102
|
+
genericPrototype[key] = callback;
|
|
103
|
+
} else {
|
|
104
|
+
Object.defineProperty(genericPrototype, key, { get: callback, set: callback });
|
|
105
|
+
}
|
|
87
106
|
});
|
|
88
107
|
}
|
|
89
108
|
|
|
90
109
|
// src/lifecycleSupport.ts
|
|
91
|
-
function attachToAncestor(child
|
|
92
|
-
let ancestor =
|
|
110
|
+
function attachToAncestor(child) {
|
|
111
|
+
let ancestor = child;
|
|
93
112
|
while (ancestor = ancestor.parentNode ?? ancestor.host) {
|
|
94
113
|
if (ancestor?.constructor?.lumina) {
|
|
95
114
|
const litParent = ancestor;
|
|
96
115
|
if (!litParent.manager?.loadedCalled) {
|
|
97
116
|
litParent._offspring.push(child);
|
|
98
117
|
}
|
|
99
|
-
return litParent._postLoad
|
|
118
|
+
return litParent._postLoad.promise;
|
|
100
119
|
}
|
|
101
120
|
}
|
|
102
121
|
return false;
|
|
@@ -151,6 +170,7 @@ function createLazyElement([tagName, [load, compactMeta = ""]]) {
|
|
|
151
170
|
};
|
|
152
171
|
customElements.define(tagName, ProxyClass);
|
|
153
172
|
}
|
|
173
|
+
var defineProperty = Object.defineProperty;
|
|
154
174
|
function parseCondensedProp(propAndAttribute) {
|
|
155
175
|
const name = propAndAttribute.split(lazyMetaSubItemJoiner);
|
|
156
176
|
return name.length === 1 ? [name[0], camelToKebab(name[0])] : name;
|
|
@@ -194,7 +214,10 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
194
214
|
if (ProxyClass._LitConstructor) {
|
|
195
215
|
this._initializeComponent({ a: ProxyClass._LitConstructor });
|
|
196
216
|
} else {
|
|
197
|
-
void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch(
|
|
217
|
+
void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch((error) => {
|
|
218
|
+
console.error(error);
|
|
219
|
+
this._postLoaded.reject(error);
|
|
220
|
+
});
|
|
198
221
|
}
|
|
199
222
|
if (process.env.NODE_ENV !== "production") {
|
|
200
223
|
ProxyClass._hmrInstances ??= [];
|
|
@@ -211,7 +234,7 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
211
234
|
this._syncMethods?.forEach(this._bindSync, this);
|
|
212
235
|
}
|
|
213
236
|
static _bindProp(propName) {
|
|
214
|
-
|
|
237
|
+
defineProperty(this.prototype, propName, {
|
|
215
238
|
configurable: true,
|
|
216
239
|
enumerable: true,
|
|
217
240
|
get() {
|
|
@@ -226,7 +249,7 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
226
249
|
});
|
|
227
250
|
}
|
|
228
251
|
static _bindAsync(methodName) {
|
|
229
|
-
|
|
252
|
+
defineProperty(this.prototype, methodName, {
|
|
230
253
|
async value(...args) {
|
|
231
254
|
if (!this._litElement) {
|
|
232
255
|
await this._postLoaded.promise;
|
|
@@ -240,7 +263,7 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
240
263
|
});
|
|
241
264
|
}
|
|
242
265
|
static _bindSync(methodName) {
|
|
243
|
-
|
|
266
|
+
defineProperty(this.prototype, methodName, {
|
|
244
267
|
value(...args) {
|
|
245
268
|
if (process.env.NODE_ENV === "development" && !this._litElement) {
|
|
246
269
|
const ProxyClass = this.constructor;
|
|
@@ -313,7 +336,7 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
313
336
|
this._litElement?.connectedCallback();
|
|
314
337
|
} else {
|
|
315
338
|
queueMicrotask(() => {
|
|
316
|
-
this._ancestorLoad = attachToAncestor(this
|
|
339
|
+
this._ancestorLoad = attachToAncestor(this);
|
|
317
340
|
});
|
|
318
341
|
}
|
|
319
342
|
}
|
|
@@ -352,10 +375,23 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
352
375
|
const isFirstInitialization = !ProxyClass._LitConstructor;
|
|
353
376
|
if (isFirstInitialization) {
|
|
354
377
|
ProxyClass._LitConstructor = LitConstructor;
|
|
355
|
-
LitConstructor.prototype.removeAttribute =
|
|
356
|
-
|
|
378
|
+
LitConstructor.prototype.removeAttribute = function(qualifiedName) {
|
|
379
|
+
HTMLElement.prototype.removeAttribute.call(this.el, qualifiedName);
|
|
380
|
+
};
|
|
381
|
+
LitConstructor.prototype.setAttribute = function(qualifiedName, value) {
|
|
382
|
+
HTMLElement.prototype.setAttribute.call(this.el, qualifiedName, value);
|
|
383
|
+
};
|
|
384
|
+
defineProperty(LitConstructor.prototype, "isConnected", {
|
|
385
|
+
get() {
|
|
386
|
+
return this.el.isConnected;
|
|
387
|
+
}
|
|
388
|
+
});
|
|
357
389
|
if (process.env.NODE_ENV !== "production" && LitConstructor.shadowRootOptions !== noShadowRoot) {
|
|
358
|
-
|
|
390
|
+
let prototype = LitConstructor;
|
|
391
|
+
while (prototype && !Object.hasOwn(prototype, "lumina")) {
|
|
392
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
393
|
+
}
|
|
394
|
+
devOnlyDetectIncorrectLazyUsages(LitConstructor);
|
|
359
395
|
}
|
|
360
396
|
customElements.define(lazyTagName, LitConstructor);
|
|
361
397
|
}
|
|
@@ -381,26 +417,20 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
381
417
|
const missingFromLit = lazyObserved.filter((attribute) => !litObserved.includes(attribute));
|
|
382
418
|
if (missingFromLazy.length > 0) {
|
|
383
419
|
console.warn(
|
|
384
|
-
`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
|
|
420
|
+
`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`
|
|
385
421
|
);
|
|
386
422
|
}
|
|
387
423
|
if (missingFromLit.length > 0) {
|
|
388
424
|
console.warn(
|
|
389
|
-
`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
|
|
425
|
+
`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`
|
|
390
426
|
);
|
|
391
427
|
}
|
|
392
428
|
}
|
|
393
429
|
if (this.isConnected) {
|
|
394
|
-
litElement.connectedCallback();
|
|
430
|
+
litElement.connectedCallback?.();
|
|
395
431
|
}
|
|
396
432
|
}
|
|
397
433
|
};
|
|
398
|
-
function removeAttribute(qualifiedName) {
|
|
399
|
-
HTMLElement.prototype.removeAttribute.call(this.el, qualifiedName);
|
|
400
|
-
}
|
|
401
|
-
function setAttribute(qualifiedName, value) {
|
|
402
|
-
HTMLElement.prototype.setAttribute.call(this.el, qualifiedName, value);
|
|
403
|
-
}
|
|
404
434
|
function syncLitElement([key, value]) {
|
|
405
435
|
this[key] = value;
|
|
406
436
|
}
|
|
@@ -542,13 +572,6 @@ var LitElement = class _LitElement extends OriginalLitElement {
|
|
|
542
572
|
* @internal
|
|
543
573
|
*/
|
|
544
574
|
this._offspring = this.constructor.lazy?._offspring ?? [];
|
|
545
|
-
/**
|
|
546
|
-
* Promise that resolves once parent's load() completed. False if there is no
|
|
547
|
-
* parent
|
|
548
|
-
*
|
|
549
|
-
* @internal
|
|
550
|
-
*/
|
|
551
|
-
this._ancestorLoad = this.constructor.lazy?._ancestorLoad;
|
|
552
575
|
this._postLoaded = this.constructor.lazy?._postLoaded ?? new Deferred2();
|
|
553
576
|
this._enableUpdating = this.enableUpdating;
|
|
554
577
|
this.enableUpdating = emptyFunction;
|
|
@@ -618,7 +641,12 @@ var LitElement = class _LitElement extends OriginalLitElement {
|
|
|
618
641
|
const isFirstCall = !this.manager.connectedCalled;
|
|
619
642
|
super.connectedCallback();
|
|
620
643
|
if (isFirstCall) {
|
|
621
|
-
queueMicrotask(
|
|
644
|
+
queueMicrotask(
|
|
645
|
+
() => void this._load().catch((error) => {
|
|
646
|
+
console.error(error);
|
|
647
|
+
this._postLoaded.reject(error);
|
|
648
|
+
})
|
|
649
|
+
);
|
|
622
650
|
}
|
|
623
651
|
}
|
|
624
652
|
/**
|
|
@@ -652,7 +680,7 @@ var LitElement = class _LitElement extends OriginalLitElement {
|
|
|
652
680
|
}
|
|
653
681
|
/** Do asynchronous component load */
|
|
654
682
|
async _load() {
|
|
655
|
-
const parentLoadPromise = this._ancestorLoad ?? attachToAncestor(this
|
|
683
|
+
const parentLoadPromise = this.el._ancestorLoad ?? attachToAncestor(this.el);
|
|
656
684
|
if (parentLoadPromise) {
|
|
657
685
|
await parentLoadPromise;
|
|
658
686
|
}
|
|
@@ -746,8 +774,9 @@ function makeRuntime(options) {
|
|
|
746
774
|
}
|
|
747
775
|
|
|
748
776
|
// src/jsx/jsx.ts
|
|
749
|
-
import { directive as litDirective } from "lit-html/directive.js";
|
|
777
|
+
import { directive as litDirective, Directive } from "lit-html/directive.js";
|
|
750
778
|
import { noChange as litNoChange, nothing as litNothing } from "lit-html";
|
|
779
|
+
var Fragment = void 0;
|
|
751
780
|
var bindAttribute = void 0;
|
|
752
781
|
var bindBooleanAttribute = void 0;
|
|
753
782
|
var bindProperty = void 0;
|
|
@@ -755,6 +784,33 @@ var bindEvent = void 0;
|
|
|
755
784
|
var nothing = litNothing;
|
|
756
785
|
var noChange = litNoChange;
|
|
757
786
|
var directive = litDirective;
|
|
787
|
+
var DynamicHtmlValueDirective = class extends Directive {
|
|
788
|
+
update(part, [prop, value]) {
|
|
789
|
+
if (process.env.NODE_ENV !== "production") {
|
|
790
|
+
if (part.type !== 6) {
|
|
791
|
+
throw new Error("DynamicHtmlValueDirective can only be used in the element part position");
|
|
792
|
+
}
|
|
793
|
+
if (prop !== "value" && prop !== "defaultValue") {
|
|
794
|
+
throw new Error('Expected the first argument to DynamicHtmlValueDirective to be "value" or "defaultValue"');
|
|
795
|
+
}
|
|
796
|
+
if (typeof value === "object" && value != null) {
|
|
797
|
+
throw new Error(
|
|
798
|
+
`Tried to set an object as the value/defaultValue prop in a <${part.element.tagName}> element.`
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
const element = part.element;
|
|
803
|
+
const tagName = element.tagName;
|
|
804
|
+
if (prop === "value" ? tagName === "INPUT" : tagName === "BUTTON" || tagName === "DATA") {
|
|
805
|
+
element[prop] = value;
|
|
806
|
+
} else if (value != null) {
|
|
807
|
+
element.setAttribute("value", value);
|
|
808
|
+
} else {
|
|
809
|
+
element.removeAttribute("value");
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
var dynamicValueDirective = directive(DynamicHtmlValueDirective);
|
|
758
814
|
|
|
759
815
|
// src/jsx/directives.ts
|
|
760
816
|
import { classMap } from "lit-html/directives/class-map.js";
|
|
@@ -782,6 +838,7 @@ function createPrototypeProxy(tagName) {
|
|
|
782
838
|
return customElement;
|
|
783
839
|
}
|
|
784
840
|
export {
|
|
841
|
+
Fragment,
|
|
785
842
|
LitElement,
|
|
786
843
|
bindAttribute,
|
|
787
844
|
bindBooleanAttribute,
|
|
@@ -790,6 +847,7 @@ export {
|
|
|
790
847
|
createEvent,
|
|
791
848
|
createPrototypeProxy,
|
|
792
849
|
directive,
|
|
850
|
+
dynamicValueDirective,
|
|
793
851
|
handleComponentMetaUpdate,
|
|
794
852
|
handleHmrUpdate,
|
|
795
853
|
makeDefineCustomElements,
|