@arcgis/lumina 4.32.0-next.20 → 4.32.0-next.21
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/context.d.ts +26 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +62 -23
- package/dist/jsx/jsx.d.ts +1 -4
- package/dist/lazyLoad.d.ts +8 -0
- package/package.json +4 -3
|
@@ -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/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,9 +4,25 @@ import {
|
|
|
4
4
|
lazyMetaSubItemJoiner
|
|
5
5
|
} from "./chunk-PGHUBTOM.js";
|
|
6
6
|
|
|
7
|
+
// src/context.ts
|
|
8
|
+
import { retrieveComponent } from "@arcgis/components-controllers";
|
|
9
|
+
import { ContextConsumer, ContextProvider } from "@lit/context";
|
|
10
|
+
function useContextProvider(options) {
|
|
11
|
+
const component = retrieveComponent();
|
|
12
|
+
const controller = new ContextProvider(component.el, options);
|
|
13
|
+
component.addController(controller);
|
|
14
|
+
return controller;
|
|
15
|
+
}
|
|
16
|
+
function useContextConsumer(options) {
|
|
17
|
+
const component = retrieveComponent();
|
|
18
|
+
const controller = new ContextConsumer(component.el, options);
|
|
19
|
+
component.addController(controller);
|
|
20
|
+
return controller;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
// src/createEvent.ts
|
|
8
|
-
import { retrieveComponent, trackPropertyKey, keyTrackResolve } from "@arcgis/components-controllers";
|
|
9
|
-
var createEventFactory = (eventName = "", options = {}, component =
|
|
24
|
+
import { retrieveComponent as retrieveComponent2, trackPropertyKey, keyTrackResolve } from "@arcgis/components-controllers";
|
|
25
|
+
var createEventFactory = (eventName = "", options = {}, component = retrieveComponent2()) => {
|
|
10
26
|
const emitter = {
|
|
11
27
|
emit: (payload) => {
|
|
12
28
|
if (process.env.NODE_ENV !== "production" && !component.el.isConnected) {
|
|
@@ -73,7 +89,10 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
|
73
89
|
// Called by Lit - we proxy it to this.el in ProxyComponent
|
|
74
90
|
"isConnected",
|
|
75
91
|
// Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
|
|
76
|
-
"localName"
|
|
92
|
+
"localName",
|
|
93
|
+
// Called by Lit Context - we proxy it to this.el in ProxyComponent.
|
|
94
|
+
// Interestingly, they never call removeEventListener.
|
|
95
|
+
"addEventListener"
|
|
77
96
|
]);
|
|
78
97
|
const customErrorMessages = {
|
|
79
98
|
addEventListener: "use this.listen() or this.el.addEventListener()"
|
|
@@ -118,9 +137,6 @@ function attachToAncestor(child) {
|
|
|
118
137
|
return false;
|
|
119
138
|
}
|
|
120
139
|
|
|
121
|
-
// src/utils.ts
|
|
122
|
-
var noShadowRoot = {};
|
|
123
|
-
|
|
124
140
|
// src/lazyLoad.ts
|
|
125
141
|
var makeDefineCustomElements = (runtime, structure) => function defineCustomElements(windowOrOptions, options) {
|
|
126
142
|
if (!globalThis.customElements) {
|
|
@@ -371,27 +387,32 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
371
387
|
);
|
|
372
388
|
}
|
|
373
389
|
const lazyTagName = process.env.NODE_ENV === "production" ? `${tagName}--lazy` : (ProxyClass._hmrIndex ?? 0) === 0 ? `${tagName}--lazy` : `${tagName}--lazy-${ProxyClass._hmrIndex}`;
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
390
|
+
let parentClass = LitConstructor;
|
|
391
|
+
while (parentClass && !Object.hasOwn(parentClass, "lumina")) {
|
|
392
|
+
parentClass = Object.getPrototypeOf(parentClass);
|
|
393
|
+
}
|
|
394
|
+
const litElementPrototype = parentClass.prototype;
|
|
395
|
+
const elementPrototype = Element.prototype;
|
|
396
|
+
const alreadyPatched = Object.hasOwn(litElementPrototype, "isConnected");
|
|
397
|
+
if (!alreadyPatched) {
|
|
398
|
+
litElementPrototype.setAttribute = function(qualifiedName, value) {
|
|
399
|
+
elementPrototype.setAttribute.call(this.el, qualifiedName, value);
|
|
379
400
|
};
|
|
380
|
-
|
|
381
|
-
|
|
401
|
+
litElementPrototype.removeAttribute = function(qualifiedName) {
|
|
402
|
+
elementPrototype.removeAttribute.call(this.el, qualifiedName);
|
|
382
403
|
};
|
|
383
|
-
defineProperty(
|
|
404
|
+
defineProperty(litElementPrototype, "isConnected", {
|
|
384
405
|
get() {
|
|
385
|
-
return this.el
|
|
406
|
+
return Reflect.get(elementPrototype, "isConnected", this.el);
|
|
386
407
|
}
|
|
387
408
|
});
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
409
|
+
}
|
|
410
|
+
if (process.env.NODE_ENV !== "production") {
|
|
411
|
+
devOnlyDetectIncorrectLazyUsages(parentClass);
|
|
412
|
+
}
|
|
413
|
+
const isFirstInitialization = !ProxyClass._LitConstructor;
|
|
414
|
+
if (isFirstInitialization) {
|
|
415
|
+
ProxyClass._LitConstructor = LitConstructor;
|
|
395
416
|
customElements.define(lazyTagName, LitConstructor);
|
|
396
417
|
}
|
|
397
418
|
LitConstructor.lazy = this;
|
|
@@ -441,6 +462,17 @@ var ProxyComponent = class extends HtmlElement {
|
|
|
441
462
|
}
|
|
442
463
|
}
|
|
443
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Implemented on the proxy for compatibility with Lit Context.
|
|
467
|
+
*/
|
|
468
|
+
addController() {
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Implemented on the proxy for compatibility with Lit Context.
|
|
472
|
+
*/
|
|
473
|
+
requestUpdate() {
|
|
474
|
+
this._litElement?.requestUpdate();
|
|
475
|
+
}
|
|
444
476
|
};
|
|
445
477
|
function syncLitElement([key, value]) {
|
|
446
478
|
this[key] = value;
|
|
@@ -448,6 +480,11 @@ function syncLitElement([key, value]) {
|
|
|
448
480
|
|
|
449
481
|
// src/hmrSupport.ts
|
|
450
482
|
import { camelToKebab as camelToKebab2 } from "@arcgis/components-utils";
|
|
483
|
+
|
|
484
|
+
// src/utils.ts
|
|
485
|
+
var noShadowRoot = {};
|
|
486
|
+
|
|
487
|
+
// src/hmrSupport.ts
|
|
451
488
|
function handleHmrUpdate(newModules) {
|
|
452
489
|
newModules.forEach((newModule) => {
|
|
453
490
|
if (newModule === void 0) {
|
|
@@ -885,5 +922,7 @@ export {
|
|
|
885
922
|
safeStyleMap,
|
|
886
923
|
setAttribute,
|
|
887
924
|
state,
|
|
888
|
-
stringOrBoolean
|
|
925
|
+
stringOrBoolean,
|
|
926
|
+
useContextConsumer,
|
|
927
|
+
useContextProvider
|
|
889
928
|
};
|
package/dist/jsx/jsx.d.ts
CHANGED
|
@@ -842,6 +842,7 @@ export declare namespace LuminaJsx {
|
|
|
842
842
|
}
|
|
843
843
|
interface HTMLAttributes<T = HTMLElement> extends AriaAttributes, DOMAttributes<T>, RdfaAttributes {
|
|
844
844
|
accessKey?: string;
|
|
845
|
+
autofocus?: boolean;
|
|
845
846
|
dir?: HTMLDir;
|
|
846
847
|
draggable?: boolean;
|
|
847
848
|
hidden?: boolean | "hidden" | "until-found";
|
|
@@ -921,7 +922,6 @@ export declare namespace LuminaJsx {
|
|
|
921
922
|
cite?: string;
|
|
922
923
|
}
|
|
923
924
|
interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
924
|
-
autofocus?: boolean;
|
|
925
925
|
disabled?: boolean;
|
|
926
926
|
form?: string;
|
|
927
927
|
name?: string;
|
|
@@ -1030,7 +1030,6 @@ export declare namespace LuminaJsx {
|
|
|
1030
1030
|
autocomplete?: AutoFill;
|
|
1031
1031
|
accept?: string;
|
|
1032
1032
|
alt?: string;
|
|
1033
|
-
autofocus?: boolean;
|
|
1034
1033
|
capture?: boolean | string;
|
|
1035
1034
|
checked?: boolean;
|
|
1036
1035
|
disabled?: boolean;
|
|
@@ -1312,7 +1311,6 @@ export declare namespace LuminaJsx {
|
|
|
1312
1311
|
referrerPolicy?: HTMLReferrerPolicy;
|
|
1313
1312
|
}
|
|
1314
1313
|
interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1315
|
-
autofocus?: boolean;
|
|
1316
1314
|
disabled?: boolean;
|
|
1317
1315
|
form?: string;
|
|
1318
1316
|
multiple?: boolean;
|
|
@@ -1349,7 +1347,6 @@ export declare namespace LuminaJsx {
|
|
|
1349
1347
|
}
|
|
1350
1348
|
interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1351
1349
|
children?: "Error: Use value property instead. See https://lit.dev/docs/templates/expressions/#invalid-locations";
|
|
1352
|
-
autofocus?: boolean;
|
|
1353
1350
|
cols?: number | string;
|
|
1354
1351
|
dirname?: string;
|
|
1355
1352
|
disabled?: boolean;
|
package/dist/lazyLoad.d.ts
CHANGED
|
@@ -153,6 +153,14 @@ export declare abstract class ProxyComponent extends HtmlElement {
|
|
|
153
153
|
componentOnReady(): Promise<this>;
|
|
154
154
|
/** @internal */
|
|
155
155
|
_initializeComponent(module: Record<string, typeof LitElement>): void;
|
|
156
|
+
/**
|
|
157
|
+
* Implemented on the proxy for compatibility with Lit Context.
|
|
158
|
+
*/
|
|
159
|
+
addController(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Implemented on the proxy for compatibility with Lit Context.
|
|
162
|
+
*/
|
|
163
|
+
requestUpdate(): void;
|
|
156
164
|
}
|
|
157
165
|
export type GlobalThisWithPuppeteerEnv = typeof globalThis & {
|
|
158
166
|
devOnly$createdElements?: WeakRef<ProxyComponent>[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/lumina",
|
|
3
|
-
"version": "4.32.0-next.
|
|
3
|
+
"version": "4.32.0-next.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcgis/components-controllers": "4.32.0-next.
|
|
23
|
-
"@arcgis/components-utils": "4.32.0-next.
|
|
22
|
+
"@arcgis/components-controllers": "4.32.0-next.21",
|
|
23
|
+
"@arcgis/components-utils": "4.32.0-next.21",
|
|
24
24
|
"@lit-labs/ssr": "^3.2.2",
|
|
25
25
|
"@lit-labs/ssr-client": "^1.1.7",
|
|
26
|
+
"@lit/context": "^1.1.3",
|
|
26
27
|
"csstype": "^3.1.3",
|
|
27
28
|
"lit": "^3.2.0",
|
|
28
29
|
"tslib": "^2.7.0"
|