@arcgis/lumina 5.1.0-next.6 → 5.1.0-next.60
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-DQnXLHsP.js → Controller-mLlWzD96.js} +9 -9
- package/dist/{ControllerInternals-By6dhpY-.js → ControllerInternals-DP8cXrza.js} +5 -5
- package/dist/{ControllerManager-eFkqujn9.js → ControllerManager-A4d_wLLl.js} +8 -8
- package/dist/LitElement.d.ts +15 -0
- package/dist/context.js +2 -2
- package/dist/controllers/accessor/index.js +3 -3
- package/dist/controllers/index.js +12 -12
- package/dist/formAssociatedUtils.d.ts +48 -0
- package/dist/hmrSupport.d.ts +1 -0
- package/dist/hmrSupport.js +3 -1
- package/dist/index.js +45 -14
- package/dist/jsx/types.d.ts +1 -1
- package/dist/{lazyLoad-DJM-hmfq.js → lazyLoad-D3mMxcvZ.js} +29 -8
- package/dist/lazyLoad.d.ts +12 -5
- package/dist/makeRuntime.d.ts +1 -1
- package/dist/{proxyExports-CXEnG2Az.js → proxyExports-i81aYgwa.js} +2 -2
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { safeCall, isEsriInternalEnv, safeAsyncCall } from "@arcgis/toolkit/error";
|
|
2
|
-
import { r as retrieveComponent, d as retrieveParentControllers, b as setParentController, a as setAmbientComponent, u as use, k as useRef, l as useRefSync, c as controllerSymbol } from "./ControllerInternals-
|
|
2
|
+
import { r as retrieveComponent, d as retrieveParentControllers, b as setParentController, a as setAmbientComponent, u as use, k as useRef, l as useRefSync, c as controllerSymbol } from "./ControllerInternals-DP8cXrza.js";
|
|
3
3
|
import { nothing } from "lit";
|
|
4
4
|
import { Deferred } from "@arcgis/toolkit/promise";
|
|
5
5
|
import { rethrowError } from "@arcgis/toolkit/log";
|
|
@@ -211,19 +211,19 @@ class Controller {
|
|
|
211
211
|
* controller as ready (for usage in other controllers). Also, triggers
|
|
212
212
|
* re-render of the component
|
|
213
213
|
*/
|
|
214
|
-
set exports(exports) {
|
|
214
|
+
set exports(exports$1) {
|
|
215
215
|
const oldExports = this.#exports;
|
|
216
|
-
if (oldExports !== exports) {
|
|
217
|
-
this.#exports = exports;
|
|
216
|
+
if (oldExports !== exports$1) {
|
|
217
|
+
this.#exports = exports$1;
|
|
218
218
|
this.#exportWatchers.forEach(safeCall);
|
|
219
219
|
if (this.connectedCalled && this.O !== false) {
|
|
220
220
|
this.#component.requestUpdate(this.O, oldExports);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
this.P.resolve(exports);
|
|
223
|
+
this.P.resolve(exports$1);
|
|
224
224
|
}
|
|
225
|
-
setProvisionalExports(exports, proxy = true) {
|
|
226
|
-
this.#exports = proxy ? makeProvisionalValue(exports) : exports;
|
|
225
|
+
setProvisionalExports(exports$1, proxy = true) {
|
|
226
|
+
this.#exports = proxy ? makeProvisionalValue(exports$1) : exports$1;
|
|
227
227
|
this.#exportWatchers.forEach(safeCall);
|
|
228
228
|
}
|
|
229
229
|
#exportWatchers;
|
|
@@ -454,9 +454,9 @@ export {
|
|
|
454
454
|
Controller as C,
|
|
455
455
|
GenericController as G,
|
|
456
456
|
createEventFactory as a,
|
|
457
|
-
|
|
457
|
+
trackPropKey as b,
|
|
458
458
|
createEvent as c,
|
|
459
|
-
|
|
459
|
+
trackPropertyKey as d,
|
|
460
460
|
propertyTrackResolve as p,
|
|
461
461
|
trackKey as t
|
|
462
462
|
};
|
|
@@ -74,7 +74,7 @@ const use = async (value, watchExports) => {
|
|
|
74
74
|
throw new Error(`The controller must implement watchExports method to support watching exports`);
|
|
75
75
|
}
|
|
76
76
|
const unsubscribe = controller.watchExports(
|
|
77
|
-
(exports) => watchExports(exports, unsubscribe)
|
|
77
|
+
(exports$1) => watchExports(exports$1, unsubscribe)
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
return controller.exports;
|
|
@@ -119,10 +119,10 @@ export {
|
|
|
119
119
|
setParentController as b,
|
|
120
120
|
controllerSymbol as c,
|
|
121
121
|
retrieveParentControllers as d,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
bypassReadOnly as e,
|
|
123
|
+
bypassSetter as f,
|
|
124
|
+
getControllersCount as g,
|
|
125
|
+
isController as h,
|
|
126
126
|
isPromise as i,
|
|
127
127
|
setAmbientChildController as j,
|
|
128
128
|
useRef as k,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { safeCall, isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
2
|
-
import { G as GenericController, p as propertyTrackResolve } from "./Controller-
|
|
2
|
+
import { G as GenericController, p as propertyTrackResolve } from "./Controller-mLlWzD96.js";
|
|
3
3
|
import { nothing, LitElement as LitElement$1 } from "lit";
|
|
4
4
|
import { devToolsAwareTimeout } from "@arcgis/toolkit/promise";
|
|
5
|
-
import { a as setAmbientComponent } from "./ControllerInternals-
|
|
5
|
+
import { a as setAmbientComponent } from "./ControllerInternals-DP8cXrza.js";
|
|
6
6
|
class ControllerManager extends GenericController {
|
|
7
7
|
constructor(component) {
|
|
8
8
|
super(component);
|
|
@@ -132,15 +132,15 @@ class ControllerManager extends GenericController {
|
|
|
132
132
|
*
|
|
133
133
|
* @private
|
|
134
134
|
*/
|
|
135
|
-
W(controller, exports) {
|
|
136
|
-
if (typeof exports === "object" && exports !== null || typeof exports === "function") {
|
|
137
|
-
this.#exportsStore.set(exports, controller);
|
|
135
|
+
W(controller, exports$1) {
|
|
136
|
+
if (typeof exports$1 === "object" && exports$1 !== null || typeof exports$1 === "function") {
|
|
137
|
+
this.#exportsStore.set(exports$1, controller);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
/** @private */
|
|
141
|
-
X(exports) {
|
|
142
|
-
if (typeof exports === "object" && exports !== null || typeof exports === "function") {
|
|
143
|
-
return this.#exportsStore.get(exports);
|
|
141
|
+
X(exports$1) {
|
|
142
|
+
if (typeof exports$1 === "object" && exports$1 !== null || typeof exports$1 === "function") {
|
|
143
|
+
return this.#exportsStore.get(exports$1);
|
|
144
144
|
} else {
|
|
145
145
|
return void 0;
|
|
146
146
|
}
|
package/dist/LitElement.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ToElement } from './jsx/types.ts';
|
|
|
5
5
|
import { BaseController, LuminaPropertyDeclaration } from './controllers/types.ts';
|
|
6
6
|
import { ControllerManager } from './controllers/ControllerManager.ts';
|
|
7
7
|
import { Controller } from './controllers/Controller.ts';
|
|
8
|
+
import { FormAssociatedEvents } from './formAssociatedUtils.ts';
|
|
8
9
|
type ComponentLifecycle = {
|
|
9
10
|
connectedCallback?: () => void;
|
|
10
11
|
disconnectedCallback?: () => void;
|
|
@@ -117,6 +118,19 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
117
118
|
* @private
|
|
118
119
|
*/
|
|
119
120
|
__offspringComponents: ProxyComponent["__offspringComponents"];
|
|
121
|
+
/**
|
|
122
|
+
* For HMR, if the .elementInternals was created, preserve that element
|
|
123
|
+
* internals instance across hot reloads. This method lets HMR get a reference
|
|
124
|
+
* to element internals in a side-effect free way and without adding production
|
|
125
|
+
* bytes.
|
|
126
|
+
*
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
devOnly$PureGetElementInternals?: () => ElementInternals | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* @see [MDN ElementInternals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
132
|
+
*/
|
|
133
|
+
get elementInternals(): ElementInternals;
|
|
120
134
|
constructor();
|
|
121
135
|
connectedCallback(): void;
|
|
122
136
|
disconnectedCallback(): void;
|
|
@@ -157,6 +171,7 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
157
171
|
* ```
|
|
158
172
|
*/
|
|
159
173
|
listen<K extends keyof HTMLElementEventMap>(name: K, listener: (this: this, event: HTMLElementEventMap[K]) => unknown, options?: AddEventListenerOptions | boolean): void;
|
|
174
|
+
listen<K extends keyof FormAssociatedEvents>(name: K, listener: (this: this, event: FormAssociatedEvents[K]) => unknown, options?: Omit<AddEventListenerOptions, "capture" | "passive"> | boolean): void;
|
|
160
175
|
listen(name: string, listener: (this: this, event: Event) => unknown, options?: AddEventListenerOptions | boolean): void;
|
|
161
176
|
listen<EventType extends Event = CustomEvent<"Provide type like this.listenOn<ToEvents<ArcgisCounter>['arcgisClick']>() to get type-checked payload type">>(name: string,
|
|
162
177
|
/**
|
package/dist/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as retrieveComponent } from "./ControllerInternals-
|
|
1
|
+
import { ContextConsumer, ContextProvider } from "@lit/context";
|
|
2
|
+
import { r as retrieveComponent } from "./ControllerInternals-DP8cXrza.js";
|
|
3
3
|
const useContextProvider = (options) => {
|
|
4
4
|
const component = retrieveComponent();
|
|
5
5
|
const controller = new ContextProvider(component.el, options);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
2
|
-
import { r as retrieveComponent } from "../../ControllerInternals-
|
|
2
|
+
import { r as retrieveComponent } from "../../ControllerInternals-DP8cXrza.js";
|
|
3
3
|
import { on, watch } from "@arcgis/core/core/reactiveUtils.js";
|
|
4
|
-
import { a as createEventFactory, G as GenericController,
|
|
5
|
-
import { p as proxyExports } from "../../proxyExports-
|
|
4
|
+
import { a as createEventFactory, G as GenericController, b as trackPropKey, t as trackKey } from "../../Controller-mLlWzD96.js";
|
|
5
|
+
import { p as proxyExports } from "../../proxyExports-i81aYgwa.js";
|
|
6
6
|
import { createObservable, trackAccess } from "@arcgis/core/applications/Components/reactiveUtils.js";
|
|
7
7
|
import { property, subclass } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
8
8
|
import Accessor from "@arcgis/core/core/Accessor.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as Controller, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-
|
|
2
|
-
import { G,
|
|
3
|
-
import { a as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-
|
|
4
|
-
import {
|
|
5
|
-
import { p as proxyExports } from "../proxyExports-
|
|
1
|
+
import { C as Controller, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-mLlWzD96.js";
|
|
2
|
+
import { G, b, d } from "../Controller-mLlWzD96.js";
|
|
3
|
+
import { a as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-DP8cXrza.js";
|
|
4
|
+
import { e, f, c, g, h } from "../ControllerInternals-DP8cXrza.js";
|
|
5
|
+
import { p as proxyExports } from "../proxyExports-i81aYgwa.js";
|
|
6
6
|
import { isServer } from "lit";
|
|
7
7
|
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
8
8
|
import { observeAncestorsMutation, getElementAttribute } from "@arcgis/toolkit/dom";
|
|
9
9
|
import { getElementLocale, startLocaleObserver } from "@arcgis/toolkit/intl";
|
|
10
|
-
import { s as setAutoDestroyOnDisconnectTimeout, b as autoDestroyOnDisconnectTimeout } from "../ControllerManager-
|
|
10
|
+
import { s as setAutoDestroyOnDisconnectTimeout, b as autoDestroyOnDisconnectTimeout } from "../ControllerManager-A4d_wLLl.js";
|
|
11
11
|
const makeController = (constructor) => proxy(void 0, constructor);
|
|
12
12
|
const makeGenericController = (constructor) => (component) => proxy(
|
|
13
13
|
component,
|
|
@@ -258,12 +258,12 @@ const exportsForTests = {
|
|
|
258
258
|
export {
|
|
259
259
|
Controller,
|
|
260
260
|
G as GenericController,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
e as bypassReadOnly,
|
|
262
|
+
f as bypassSetter,
|
|
263
263
|
c as controllerSymbol,
|
|
264
264
|
exportsForTests,
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
g as getControllersCount,
|
|
266
|
+
h as isController,
|
|
267
267
|
keyTrackResolve,
|
|
268
268
|
load,
|
|
269
269
|
makeController,
|
|
@@ -274,8 +274,8 @@ export {
|
|
|
274
274
|
retrieveComponent,
|
|
275
275
|
toFunction,
|
|
276
276
|
trackKey,
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
b as trackPropKey,
|
|
278
|
+
d as trackPropertyKey,
|
|
279
279
|
useDirection,
|
|
280
280
|
useMedia,
|
|
281
281
|
usePropertyChange,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ProxyComponent } from './lazyLoad.ts';
|
|
2
|
+
import { LitElement } from './LitElement.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Web platform allows custom elements to define these methods to handle the
|
|
5
|
+
* corresponding form events. For performance reasons, the engines require that
|
|
6
|
+
* these methods are present when the customElements.define() is called - it
|
|
7
|
+
* means that we need to include them in the lazy proxy as well.
|
|
8
|
+
*
|
|
9
|
+
* The lazy proxy today only creates the methods proxies the first time a proxy
|
|
10
|
+
* element of that tag name is created, which is too late.
|
|
11
|
+
*
|
|
12
|
+
* We could update the proxy to define the method proxies right away. Some cons
|
|
13
|
+
* with that:
|
|
14
|
+
* - In lazy builds, most components are never loaded, so I want to keep the
|
|
15
|
+
* per-proxy overhead minimal.
|
|
16
|
+
* - To handle this form event, the component would need to define a
|
|
17
|
+
* corresponding method with a \@method() decorator (to ensure it is present
|
|
18
|
+
* on the proxy), and the method needs to be async (so that the lazy proxy
|
|
19
|
+
* knows to await component loading before calling the method)
|
|
20
|
+
* - If you forget to add \@method(), lazy proxy won't proxy this method. If
|
|
21
|
+
* you forget to make it async, lazy proxy will error if the component is
|
|
22
|
+
* not loaded yet. These are not obvious constraints from lazy-loading, and
|
|
23
|
+
* do not match the examples online/copilot. We may need lint rules about
|
|
24
|
+
* this.
|
|
25
|
+
* - Such API is not composable - if the method needs to be present on the
|
|
26
|
+
* component, it is hard for a controller to handle it, creating wiring
|
|
27
|
+
* boilerplate.
|
|
28
|
+
*
|
|
29
|
+
* To address these concerns, the proxy does the following:
|
|
30
|
+
* - Always define these methods on the prototype (harmless for
|
|
31
|
+
* non-form-associated components). The methods are created once, so no
|
|
32
|
+
* per-proxy overhead.
|
|
33
|
+
* - The proxy waits for component to be loaded. This avoids a race condition of
|
|
34
|
+
* event being emitted before the constructor is lazy-loaded, and keeps timing
|
|
35
|
+
* consistent with non-lazy builds.
|
|
36
|
+
* - The proxy will emit a corresponding event on itself. The component or any
|
|
37
|
+
* controller can choose to listen to these events. The event does not bubble
|
|
38
|
+
* and does not compose, so will have minimum visibility outside the component.
|
|
39
|
+
* - To keep the non-lazy behavior aligned, we also emit such events on itself
|
|
40
|
+
* in non-lazy builds.
|
|
41
|
+
*/
|
|
42
|
+
export interface FormAssociatedEvents {
|
|
43
|
+
luminaFormAssociatedCallback: CustomEvent<readonly [form: HTMLFormElement | null]>;
|
|
44
|
+
luminaFormDisabledCallback: CustomEvent<readonly [disabled: boolean]>;
|
|
45
|
+
luminaFormResetCallback: CustomEvent<readonly []>;
|
|
46
|
+
luminaFormStateRestoreCallback: CustomEvent<readonly [state: unknown, mode: "autocomplete" | "restore"]>;
|
|
47
|
+
}
|
|
48
|
+
export declare function proxyFormMethodsToEvents(constructor: typeof LitElement | typeof ProxyComponent): void;
|
package/dist/hmrSupport.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type HmrComponentMeta = {
|
|
|
21
21
|
readonly properties: (readonly [property: string, attribute: string] | readonly [property: string])[];
|
|
22
22
|
readonly asyncMethods: readonly string[];
|
|
23
23
|
readonly syncMethods: readonly string[];
|
|
24
|
+
readonly formAssociated: boolean;
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* Update lazy component meta
|
package/dist/hmrSupport.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as ProxyComponent, n as noShadowRoot } from "./lazyLoad-D3mMxcvZ.js";
|
|
2
2
|
import { camelToKebab } from "@arcgis/toolkit/string";
|
|
3
3
|
function handleHmrUpdate(newModules) {
|
|
4
4
|
newModules.forEach((newModule) => {
|
|
@@ -56,6 +56,8 @@ function reInitialize(instance, newModule) {
|
|
|
56
56
|
([propertyName, descriptor]) => typeof propertyName === "string" && (instance.devOnly$hmrSetProps.has(propertyName) || typeof descriptor.attribute === "string" && instance.devOnly$hmrSetAttributes.has(descriptor.attribute))
|
|
57
57
|
).map(([key]) => [key, instance[key]]);
|
|
58
58
|
instance.devOnly$hmrResetStore(Object.fromEntries(preservedProperties));
|
|
59
|
+
const elementInternals = instance.$component.devOnly$PureGetElementInternals();
|
|
60
|
+
instance.devOnly$elementInternals = elementInternals;
|
|
59
61
|
if (instance.isConnected) {
|
|
60
62
|
instance.$component.disconnectedCallback();
|
|
61
63
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { p as propertyTrackResolve } from "./Controller-
|
|
2
|
-
import { c } from "./Controller-
|
|
1
|
+
import { p as propertyTrackResolve } from "./Controller-mLlWzD96.js";
|
|
2
|
+
import { c } from "./Controller-mLlWzD96.js";
|
|
3
3
|
import { state } from "lit/decorators/state.js";
|
|
4
4
|
import { property as property$1 } from "lit/decorators/property.js";
|
|
5
|
-
import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-
|
|
6
|
-
import { d, m } from "./lazyLoad-
|
|
5
|
+
import { e as emptyFunction, n as noShadowRoot, p as proxyFormMethodsToEvents, a as attachToAncestor } from "./lazyLoad-D3mMxcvZ.js";
|
|
6
|
+
import { d, m } from "./lazyLoad-D3mMxcvZ.js";
|
|
7
7
|
import { isEsriInternalEnv, safeAsyncCall, safeCall } from "@arcgis/toolkit/error";
|
|
8
8
|
import { camelToKebab } from "@arcgis/toolkit/string";
|
|
9
9
|
import { Deferred } from "@arcgis/toolkit/promise";
|
|
10
10
|
import { LitElement as LitElement$1, isServer, notEqual, noChange as noChange$1, nothing as nothing$1, render } from "lit";
|
|
11
|
-
import { c as controllerSymbol, s as shouldBypassReadOnly } from "./ControllerInternals-
|
|
12
|
-
import { C as ControllerManager, a as autoDestroyDisabledPropName } from "./ControllerManager-
|
|
11
|
+
import { c as controllerSymbol, s as shouldBypassReadOnly } from "./ControllerInternals-DP8cXrza.js";
|
|
12
|
+
import { C as ControllerManager, a as autoDestroyDisabledPropName } from "./ControllerManager-A4d_wLLl.js";
|
|
13
13
|
import { propertyFlagAttribute, propertyFlagNoAccessor, propertyFlagReadOnly, propertyFlagState, propertyFlagBoolean, propertyFlagNumber, propertyFlagReflect } from "./config.js";
|
|
14
14
|
import { classMap } from "lit/directives/class-map.js";
|
|
15
15
|
import { styleMap } from "lit/directives/style-map.js";
|
|
@@ -65,6 +65,10 @@ class LitElement extends LitElement$1 {
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
this.devOnly$PureGetElementInternals = () => this.#elementInternals;
|
|
69
|
+
if (lazy?.devOnly$elementInternals !== void 0) {
|
|
70
|
+
this.#elementInternals = lazy.devOnly$elementInternals;
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
if (createObservable) {
|
|
@@ -160,6 +164,9 @@ class LitElement extends LitElement$1 {
|
|
|
160
164
|
static {
|
|
161
165
|
this.lumina = true;
|
|
162
166
|
}
|
|
167
|
+
static {
|
|
168
|
+
proxyFormMethodsToEvents(this);
|
|
169
|
+
}
|
|
163
170
|
/**
|
|
164
171
|
* The JS API's Accessor observables. This is used to integrate with the JS
|
|
165
172
|
* API's reactivity system.
|
|
@@ -171,14 +178,26 @@ class LitElement extends LitElement$1 {
|
|
|
171
178
|
#enableUpdating;
|
|
172
179
|
#postLoadedDeferred;
|
|
173
180
|
#trackingTarget;
|
|
181
|
+
#elementInternals;
|
|
182
|
+
/**
|
|
183
|
+
* @see [MDN ElementInternals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
184
|
+
*/
|
|
185
|
+
get elementInternals() {
|
|
186
|
+
this.#elementInternals ??= this.el.attachInternals();
|
|
187
|
+
return this.#elementInternals;
|
|
188
|
+
}
|
|
174
189
|
connectedCallback() {
|
|
175
|
-
if (this.
|
|
176
|
-
|
|
190
|
+
if (!this.hasAttribute("defer-hydration")) {
|
|
191
|
+
this.#connectedCallback(true);
|
|
177
192
|
}
|
|
193
|
+
}
|
|
194
|
+
#connectedCallback(callSuper) {
|
|
178
195
|
const trackingTarget = this.constructor.K.c?.(() => this.requestUpdate());
|
|
179
196
|
this.#trackingTarget = trackingTarget;
|
|
180
197
|
const isFirstCall = !this.manager.connectedCalled;
|
|
181
|
-
|
|
198
|
+
if (callSuper) {
|
|
199
|
+
super.connectedCallback();
|
|
200
|
+
}
|
|
182
201
|
if (isFirstCall) {
|
|
183
202
|
queueMicrotask(
|
|
184
203
|
// eslint-disable-next-line @typescript-eslint/promise-function-async, @typescript-eslint/no-misused-promises
|
|
@@ -222,9 +241,13 @@ class LitElement extends LitElement$1 {
|
|
|
222
241
|
const options = Class.shadowRootOptions;
|
|
223
242
|
const useLightDom = options === noShadowRoot;
|
|
224
243
|
const renderRoot = existingShadowRoot ?? (useLightDom ? this.el : this.el.attachShadow(options));
|
|
225
|
-
if (existingShadowRoot && //
|
|
226
|
-
// SSR
|
|
227
|
-
|
|
244
|
+
if (existingShadowRoot && // If we are in production, we are not in HMR, so assume SSR.
|
|
245
|
+
// If we are not in production, we might still be in SSR, as long as we
|
|
246
|
+
// are not in HMR
|
|
247
|
+
(process.env.NODE_ENV === "production" || this.el.constructor.devOnly$hmrIndex === void 0)) {
|
|
248
|
+
if (!this.manager.connectedCalled) {
|
|
249
|
+
this.#connectedCallback(false);
|
|
250
|
+
}
|
|
228
251
|
LitElement$1.prototype.createRenderRoot.call(this);
|
|
229
252
|
return existingShadowRoot;
|
|
230
253
|
}
|
|
@@ -264,7 +287,7 @@ class LitElement extends LitElement$1 {
|
|
|
264
287
|
this.#enableUpdating(true);
|
|
265
288
|
this.performUpdate();
|
|
266
289
|
this.I.resolve();
|
|
267
|
-
await
|
|
290
|
+
await 0;
|
|
268
291
|
const pendingChildren = this.J.filter((loaded) => !loaded.manager?.loadedCalled);
|
|
269
292
|
if (pendingChildren.length) {
|
|
270
293
|
await Promise.allSettled(pendingChildren.map(async (child) => await child.componentOnReady()));
|
|
@@ -386,7 +409,15 @@ const makeRuntime = (options) => {
|
|
|
386
409
|
customElement(tagName, component) {
|
|
387
410
|
component.K = runtime;
|
|
388
411
|
component.L = tagName;
|
|
389
|
-
if (
|
|
412
|
+
if (isServer) {
|
|
413
|
+
let define = function() {
|
|
414
|
+
try {
|
|
415
|
+
customElements.define(tagName, component);
|
|
416
|
+
} catch {
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
define();
|
|
420
|
+
} else if (!customElements.get(tagName)) {
|
|
390
421
|
customElements.define(tagName, component);
|
|
391
422
|
}
|
|
392
423
|
}
|
package/dist/jsx/types.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ interface JsxNodeArray extends Array<JsxNode> {
|
|
|
178
178
|
* Do not exclude "manager" and "componentOnReady" since these properties are
|
|
179
179
|
* available both on lazy and non-lazy instance.
|
|
180
180
|
*/
|
|
181
|
-
type ExcludedProperties = "addController" | "attributeChangedCallback" | "connectedCallback" | "disconnectedCallback" | "el" | "hasUpdated" | "isUpdatePending" | "listen" | "load" | "loaded" | "removeController" | "render" | "renderOptions" | "renderRoot" | "requestUpdate" | "updateComplete" | "updated" | "willUpdate";
|
|
181
|
+
type ExcludedProperties = "addController" | "attributeChangedCallback" | "connectedCallback" | "disconnectedCallback" | "el" | "elementInternals" | "hasUpdated" | "isUpdatePending" | "listen" | "load" | "loaded" | "removeController" | "render" | "renderOptions" | "renderRoot" | "requestUpdate" | "updateComplete" | "updated" | "willUpdate";
|
|
182
182
|
/**
|
|
183
183
|
* this.el property on a component only has the public properties of the
|
|
184
184
|
* component. All internal methods, properties, as well as LitElement methods
|
|
@@ -15,6 +15,8 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
|
15
15
|
"setAttribute",
|
|
16
16
|
// Called by Lit SSR - we proxy it to this.el in ProxyComponent
|
|
17
17
|
"removeAttribute",
|
|
18
|
+
// Called by Lit SSR - we proxy it to this.el in ProxyComponent
|
|
19
|
+
"hasAttribute",
|
|
18
20
|
// Called by Lit - we proxy it to this.el in ProxyComponent
|
|
19
21
|
"isConnected",
|
|
20
22
|
// Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
|
|
@@ -32,21 +34,18 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
|
32
34
|
if (allowList.has(key)) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
|
-
function validateUsage(
|
|
37
|
+
function validateUsage() {
|
|
36
38
|
const isDynamicallyCreatedComponentInTest = this === this.el;
|
|
37
39
|
if (isDynamicallyCreatedComponentInTest) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
|
-
if (key === "hasAttribute" && args[0] === "defer-hydration") {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
42
|
throw new Error(
|
|
44
43
|
`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}`}`
|
|
45
44
|
);
|
|
46
45
|
}
|
|
47
46
|
if (typeof value.value === "function") {
|
|
48
47
|
genericPrototype[key] = function functionWrapper(...args) {
|
|
49
|
-
return validateUsage.call(this
|
|
48
|
+
return validateUsage.call(this) ?? value.value.call(this, ...args);
|
|
50
49
|
};
|
|
51
50
|
} else if (typeof value.get === "function") {
|
|
52
51
|
Object.defineProperty(genericPrototype, key, {
|
|
@@ -62,7 +61,7 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
|
|
|
62
61
|
} else if (key === key.toUpperCase() && typeof value.value === "number") {
|
|
63
62
|
return;
|
|
64
63
|
} else {
|
|
65
|
-
throw new Error(`Unexpected value type for ${key}: ${value}`);
|
|
64
|
+
throw new Error(`Unexpected value type for ${key}: ${String(value)}`);
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
67
|
}
|
|
@@ -106,6 +105,17 @@ const devOnly$getLitElementTagNameAndRuntime = process.env.NODE_ENV !== "product
|
|
|
106
105
|
runtime: componentClass.K
|
|
107
106
|
};
|
|
108
107
|
} : void 0;
|
|
108
|
+
function proxyFormMethodsToEvents(constructor) {
|
|
109
|
+
for (const namePart of ["Associated", "Disabled", "Reset", "StateRestore"]) {
|
|
110
|
+
const callbackNamePart = `orm${namePart}Callback`;
|
|
111
|
+
constructor.prototype["f" + callbackNamePart] = async function(...args) {
|
|
112
|
+
await this.componentOnReady();
|
|
113
|
+
(this.el ?? this).dispatchEvent(
|
|
114
|
+
new CustomEvent(`luminaF${callbackNamePart}`, { detail: args })
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
109
119
|
const makeDefineCustomElements = (runtime, structure) => function defineCustomElements(windowOrOptions, options) {
|
|
110
120
|
if (!globalThis.customElements) {
|
|
111
121
|
return;
|
|
@@ -115,7 +125,7 @@ const makeDefineCustomElements = (runtime, structure) => function defineCustomEl
|
|
|
115
125
|
if (resourcesUrl) {
|
|
116
126
|
runtime.setAssetPath(resourcesUrl);
|
|
117
127
|
}
|
|
118
|
-
for (const [tagName, [load, compactMeta = ""]] of Object.entries(structure)) {
|
|
128
|
+
for (const [tagName, [load, compactMeta = "", flags = 0]] of Object.entries(structure)) {
|
|
119
129
|
if (customElements.get(tagName)) {
|
|
120
130
|
continue;
|
|
121
131
|
}
|
|
@@ -123,6 +133,9 @@ const makeDefineCustomElements = (runtime, structure) => function defineCustomEl
|
|
|
123
133
|
const observedProps = compactObservedProps ? compactObservedProps?.split(lazyMetaItemJoiner).map(parseCondensedProp) : void 0;
|
|
124
134
|
const observedProperties = observedProps?.map(([property]) => property);
|
|
125
135
|
const ProxyClass = class extends ProxyComponent {
|
|
136
|
+
static {
|
|
137
|
+
this.formAssociated = flags === 1;
|
|
138
|
+
}
|
|
126
139
|
static {
|
|
127
140
|
this.observedAttributes = observedProps?.map(([, attribute]) => attribute).filter((attribute) => attribute !== "");
|
|
128
141
|
}
|
|
@@ -179,6 +192,7 @@ class ProxyComponent extends HtmlElement {
|
|
|
179
192
|
this.devOnly$hmrResetStore = (newStore) => {
|
|
180
193
|
this.#store = newStore;
|
|
181
194
|
};
|
|
195
|
+
this.devOnly$elementInternals = void 0;
|
|
182
196
|
}
|
|
183
197
|
const that = this;
|
|
184
198
|
const ProxyClass = that.constructor;
|
|
@@ -265,6 +279,9 @@ class ProxyComponent extends HtmlElement {
|
|
|
265
279
|
});
|
|
266
280
|
}
|
|
267
281
|
}
|
|
282
|
+
static {
|
|
283
|
+
proxyFormMethodsToEvents(this);
|
|
284
|
+
}
|
|
268
285
|
#litElement;
|
|
269
286
|
#store;
|
|
270
287
|
#pendingAttributes;
|
|
@@ -394,6 +411,9 @@ const patchLitElement = (parentClass) => {
|
|
|
394
411
|
litElementPrototype.removeAttribute = function(qualifiedName) {
|
|
395
412
|
elementPrototype.removeAttribute.call(this.el, qualifiedName);
|
|
396
413
|
};
|
|
414
|
+
litElementPrototype.hasAttribute = function(qualifiedName) {
|
|
415
|
+
return elementPrototype.hasAttribute.call(this.el, qualifiedName);
|
|
416
|
+
};
|
|
397
417
|
defineProperty(litElementPrototype, "isConnected", {
|
|
398
418
|
get() {
|
|
399
419
|
return Reflect.get(elementPrototype, "isConnected", this.el);
|
|
@@ -410,5 +430,6 @@ export {
|
|
|
410
430
|
devOnly$getLitElementTagNameAndRuntime as d,
|
|
411
431
|
emptyFunction as e,
|
|
412
432
|
makeDefineCustomElements as m,
|
|
413
|
-
noShadowRoot as n
|
|
433
|
+
noShadowRoot as n,
|
|
434
|
+
proxyFormMethodsToEvents as p
|
|
414
435
|
};
|
package/dist/lazyLoad.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { ControllerManager } from './controllers/ControllerManager.ts';
|
|
|
9
9
|
* it will start loading the actual web component source code.
|
|
10
10
|
*/
|
|
11
11
|
export interface DefineCustomElements {
|
|
12
|
+
/** @deprecated Passing the Window argument is not necessary - omit the first argument */
|
|
12
13
|
(_window?: Window, options?: LazyLoadOptions): void;
|
|
13
14
|
(options?: LazyLoadOptions): void;
|
|
14
15
|
}
|
|
@@ -24,14 +25,19 @@ export declare const makeDefineCustomElements: (runtime: Runtime, structure: Rea
|
|
|
24
25
|
* map-components). Also, the meta is a string to speed-up parsing
|
|
25
26
|
* (browsers parse strings much faster).
|
|
26
27
|
* See https://twitter.com/mathias/status/1143551692732030979
|
|
28
|
+
*
|
|
29
|
+
* - 1st item - the promise to load the component.
|
|
30
|
+
* - 2nd item: compact metadata string (lists attributes, properties, async
|
|
31
|
+
* methods, and sync methods)
|
|
32
|
+
* - 3rd item: flags. If present, it will be 1 and indicates that the component
|
|
33
|
+
* is formAssociated. We can expand this field to include more information in
|
|
34
|
+
* the future using bit flags.
|
|
27
35
|
*/
|
|
28
|
-
type CompactMeta = readonly [load: () => Promise<Record<string, typeof LitElement>>, compact?: string];
|
|
36
|
+
type CompactMeta = readonly [load: () => Promise<Record<string, typeof LitElement>>, compact?: string, flags?: 1];
|
|
29
37
|
/**
|
|
30
38
|
* If this file is run from a Node.js environment, HTMLElement won't be defined.
|
|
31
|
-
* Falling back to uselessly extending
|
|
32
|
-
*
|
|
33
|
-
* needlessly creating mock class/function)
|
|
34
|
-
* That will error if you try to instantiate a ProxyComponent in Node.js, but
|
|
39
|
+
* Falling back to uselessly extending emptyFunction in that case.
|
|
40
|
+
* This will error if you try to instantiate a ProxyComponent in Node.js, but
|
|
35
41
|
* that is expected - if you need to instantiate ProxyComponent, HTMLElement
|
|
36
42
|
* must be defined
|
|
37
43
|
*/
|
|
@@ -75,6 +81,7 @@ export declare abstract class ProxyComponent extends HtmlElement {
|
|
|
75
81
|
devOnly$hmrSetAttributes: Set<string>;
|
|
76
82
|
devOnly$InitializeComponent?: (module: Record<string, typeof LitElement>) => void;
|
|
77
83
|
devOnly$hmrResetStore?: (newStore: Record<string, unknown>) => void;
|
|
84
|
+
devOnly$elementInternals?: ElementInternals;
|
|
78
85
|
/**
|
|
79
86
|
* This property is only set in development mode and exists only for usage in
|
|
80
87
|
* tests or during debugging
|
package/dist/makeRuntime.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export type Runtime = RuntimeOptions & {
|
|
|
70
70
|
*/
|
|
71
71
|
o?: () => AccessorObservableLike;
|
|
72
72
|
/**
|
|
73
|
-
* In CDN build, we can only import
|
|
73
|
+
* In CDN build, we can only import `@arcgis/core` async, so the lazy loader will need
|
|
74
74
|
* to await this promise before beginning hydration so that the reactiveUtils
|
|
75
75
|
* integration modules had time to load.
|
|
76
76
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as setParentController,
|
|
2
|
-
import { t as trackKey } from "./Controller-
|
|
1
|
+
import { b as setParentController, j as setAmbientChildController, d as retrieveParentControllers, e as bypassReadOnly } from "./ControllerInternals-DP8cXrza.js";
|
|
2
|
+
import { t as trackKey } from "./Controller-mLlWzD96.js";
|
|
3
3
|
const proxyExports = (Class) => (...args) => {
|
|
4
4
|
const ambientControllers = retrieveParentControllers();
|
|
5
5
|
const instance = new Class(...args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/lumina",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.60",
|
|
4
|
+
"description": "Runtime for WebGIS SDK web components",
|
|
4
5
|
"sideEffects": false,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.cjs",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"csstype": "^3.1.3",
|
|
30
31
|
"tslib": "^2.8.1",
|
|
31
|
-
"@arcgis/toolkit": "~5.1.0-next.
|
|
32
|
+
"@arcgis/toolkit": "~5.1.0-next.60"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"@lit/context": "^1.1.6",
|