@arcgis/lumina 5.1.0-next.8 → 5.1.0-next.80
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-4XBxysPn.js} +9 -9
- package/dist/{ControllerInternals-By6dhpY-.js → ControllerInternals-D2JYGiUO.js} +6 -6
- package/dist/{ControllerManager-eFkqujn9.js → ControllerManager-DFn8sm5s.js} +11 -11
- package/dist/LitElement.d.ts +15 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -1
- package/dist/context.js +2 -2
- package/dist/controllers/accessor/index.js +3 -3
- package/dist/controllers/accessor/reEmitEvent.d.ts +3 -2
- package/dist/controllers/accessor/store.d.ts +1 -1
- package/dist/controllers/accessor/useAccessor.d.ts +8 -7
- 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 +4 -2
- package/dist/index.js +47 -15
- package/dist/jsx/generatedTypes.d.ts +240 -219
- package/dist/jsx/types.d.ts +1 -1
- package/dist/{lazyLoad-DJM-hmfq.js → lazyLoad-B5Rj3U_I.js} +31 -8
- package/dist/lazyLoad.d.ts +13 -6
- package/dist/makeRuntime.d.ts +1 -1
- package/dist/{proxyExports-CXEnG2Az.js → proxyExports-DqN4TWBr.js} +2 -2
- package/package.json +7 -3
- /package/dist/{typings → globalTypes}/importMeta.d.ts +0 -0
- /package/dist/{typings → globalTypes}/index.d.ts +0 -0
- /package/dist/{typings → globalTypes}/jsxGlobals.d.ts +0 -0
- /package/dist/{typings → globalTypes}/loadLitCss.d.ts +0 -0
- /package/dist/{typings → globalTypes}/viteEnv.d.ts +0 -0
|
@@ -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-D2JYGiUO.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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isEsriInternalEnv } from "@arcgis/toolkit/error";
|
|
2
|
-
const controllerSymbol = Symbol.for("controller");
|
|
2
|
+
const controllerSymbol = /* @__PURE__ */ Symbol.for("controller");
|
|
3
3
|
const isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
|
|
4
4
|
const isPromise = (arg) => typeof arg?.then === "function";
|
|
5
5
|
const getControllersCount = (component) => component.M.length;
|
|
@@ -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-4XBxysPn.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-D2JYGiUO.js";
|
|
6
6
|
class ControllerManager extends GenericController {
|
|
7
7
|
constructor(component) {
|
|
8
8
|
super(component);
|
|
@@ -83,12 +83,12 @@ class ControllerManager extends GenericController {
|
|
|
83
83
|
// would need to make it async in the future
|
|
84
84
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
85
85
|
async destroy() {
|
|
86
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
87
|
-
this.devOnly$ensureHasDestroy?.();
|
|
88
|
-
}
|
|
89
86
|
if (this.destroyed) {
|
|
90
87
|
return;
|
|
91
88
|
}
|
|
89
|
+
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
90
|
+
this.devOnly$ensureHasDestroy?.();
|
|
91
|
+
}
|
|
92
92
|
if (this.#component.el.isConnected) {
|
|
93
93
|
this.hasDestroy = false;
|
|
94
94
|
this.#component.el.remove();
|
|
@@ -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/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -8,6 +8,7 @@ const propertyFlagNumber = 1 << 3;
|
|
|
8
8
|
const propertyFlagState = 1 << 4;
|
|
9
9
|
const propertyFlagReadOnly = 1 << 5;
|
|
10
10
|
const propertyFlagNoAccessor = 1 << 6;
|
|
11
|
+
const propertyFlagUseDefault = 1 << 7;
|
|
11
12
|
export {
|
|
12
13
|
lazyMetaGroupJoiner,
|
|
13
14
|
lazyMetaItemJoiner,
|
|
@@ -18,5 +19,6 @@ export {
|
|
|
18
19
|
propertyFlagNumber,
|
|
19
20
|
propertyFlagReadOnly,
|
|
20
21
|
propertyFlagReflect,
|
|
21
|
-
propertyFlagState
|
|
22
|
+
propertyFlagState,
|
|
23
|
+
propertyFlagUseDefault
|
|
22
24
|
};
|
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-D2JYGiUO.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-D2JYGiUO.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-4XBxysPn.js";
|
|
5
|
+
import { p as proxyExports } from "../../proxyExports-DqN4TWBr.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,10 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from '../../createEvent.ts';
|
|
2
|
+
import { Evented } from '@arcgis/core/core/Evented.js';
|
|
2
3
|
/**
|
|
3
4
|
* Re-emit an event from the accessor instance on the component
|
|
4
5
|
*
|
|
5
6
|
* @example
|
|
6
7
|
* ```tsx
|
|
7
|
-
* arcgisGo = reEmitEvent<
|
|
8
|
+
* arcgisGo = reEmitEvent<HomeViewModelGoEvent>(() => this.viewModel, "go");
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
|
-
export declare const reEmitEvent: <T>(getEventedAccessor: () =>
|
|
11
|
+
export declare const reEmitEvent: <T>(getEventedAccessor: () => Evented, eventName: string) => EventEmitter<T>;
|
|
@@ -2,7 +2,7 @@ import { default as Accessor } from '@arcgis/core/core/Accessor.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* See https://webgis.esri.com/references/lumina/controllers/useAccessor#createstore-utility
|
|
4
4
|
*/
|
|
5
|
-
export declare const createStore: <T extends object>(initializer: T | (() => T)) =>
|
|
5
|
+
export declare const createStore: <T extends object>(initializer: T | (() => T)) => Accessor & T;
|
|
6
6
|
/** @deprecated Use {@link createStore} instead */
|
|
7
7
|
export declare const createLegacyStore: <T extends object>(defaultState: T | (() => T)) => ObservableMap<T>;
|
|
8
8
|
/** @deprecated Use {@link createStore} instead */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GenericController } from '../Controller.ts';
|
|
2
2
|
import { LitElement } from '../../LitElement.ts';
|
|
3
|
-
|
|
3
|
+
import { default as coreAccessor } from '@arcgis/core/core/Accessor.js';
|
|
4
|
+
type Requires<Props, Accessor extends coreAccessor, OmitProps extends string = never> = LitElement & Omit<Pick<Accessor, keyof Accessor & keyof Props>, AlwaysOmit | OmitProps> & {
|
|
4
5
|
autoDestroyDisabled: boolean;
|
|
5
6
|
destroy: () => Promise<void>;
|
|
6
7
|
};
|
|
@@ -12,7 +13,7 @@ type AlwaysOmit = "addHandles" | "declaredClass" | "destroyed" | "hasHandles" |
|
|
|
12
13
|
* See https://webgis.esri.com/references/lumina/controllers/useAccessor for
|
|
13
14
|
* documentation & examples.
|
|
14
15
|
*/
|
|
15
|
-
export declare const makeAccessorController: <Props, Accessor extends
|
|
16
|
+
export declare const makeAccessorController: <Props, Accessor extends coreAccessor, OmitProps extends string = never>(createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor), _options?: {
|
|
16
17
|
/**
|
|
17
18
|
* By default, to ensure that you didn't accidentally forget to bind any
|
|
18
19
|
* of the Accessor's properties on your component, every property that
|
|
@@ -38,7 +39,7 @@ export declare const makeAccessorController: <Props, Accessor extends __esri.Acc
|
|
|
38
39
|
*/
|
|
39
40
|
omitProps: OmitProps[];
|
|
40
41
|
}) => (component: Requires<Props, Accessor, OmitProps>) => Accessor;
|
|
41
|
-
export declare class AccessorController<Props, Accessor extends
|
|
42
|
+
export declare class AccessorController<Props, Accessor extends coreAccessor, ExtraRequires = Record<never, never>> extends GenericController<Accessor, ExtraRequires & Requires<Props, Accessor>> {
|
|
42
43
|
#private;
|
|
43
44
|
protected instance: Accessor;
|
|
44
45
|
/**
|
|
@@ -63,14 +64,14 @@ export declare class AccessorController<Props, Accessor extends __esri.Accessor,
|
|
|
63
64
|
hostConnected(): void;
|
|
64
65
|
hostDestroy(): void;
|
|
65
66
|
}
|
|
66
|
-
type MinimalAccessorController = Pick<AccessorController<never,
|
|
67
|
+
type MinimalAccessorController = Pick<AccessorController<never, coreAccessor>, "_currentlyBindingPropertyName" | "exports"> & {
|
|
67
68
|
component: LitElement;
|
|
68
69
|
};
|
|
69
70
|
export declare const makeBinderProxy: (component: LitElement, accessorControllerRef: WeakRef<MinimalAccessorController & {
|
|
70
71
|
constructor: MinimalAccessorController["constructor"] & {
|
|
71
72
|
devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
|
|
72
73
|
};
|
|
73
|
-
}>, accessorControllerIndex: number, instance:
|
|
74
|
-
export declare const getAccessorControllerBoundProperties: <Accessor extends
|
|
75
|
-
export declare const reCreateAccessor: (instance:
|
|
74
|
+
}>, accessorControllerIndex: number, instance: coreAccessor, boundProperties: Map<string, string>) => unknown;
|
|
75
|
+
export declare const getAccessorControllerBoundProperties: <Accessor extends coreAccessor>(controller: AccessorController<unknown, Accessor>) => Map<string & keyof Accessor, string>;
|
|
76
|
+
export declare const reCreateAccessor: (instance: coreAccessor, component: LitElement) => void;
|
|
76
77
|
export {};
|
|
@@ -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-4XBxysPn.js";
|
|
2
|
+
import { G, b, d } from "../Controller-4XBxysPn.js";
|
|
3
|
+
import { a as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-D2JYGiUO.js";
|
|
4
|
+
import { e, f, c, g, h } from "../ControllerInternals-D2JYGiUO.js";
|
|
5
|
+
import { p as proxyExports } from "../proxyExports-DqN4TWBr.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-DFn8sm5s.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-B5Rj3U_I.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
|
}
|
|
@@ -91,7 +93,7 @@ function handleComponentMetaUpdate(meta) {
|
|
|
91
93
|
ProxyClass.observedAttributes = attributes;
|
|
92
94
|
}
|
|
93
95
|
function initializeAttributeObserver() {
|
|
94
|
-
const observedAttributesSymbol = Symbol.for("@arcgis/lumina:observedAttributes");
|
|
96
|
+
const observedAttributesSymbol = /* @__PURE__ */ Symbol.for("@arcgis/lumina:observedAttributes");
|
|
95
97
|
const globalThisWithObservedAttributes = globalThis;
|
|
96
98
|
const alreadyHadObservers = observedAttributesSymbol in globalThisWithObservedAttributes;
|
|
97
99
|
globalThisWithObservedAttributes[observedAttributesSymbol] ??= {};
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { p as propertyTrackResolve } from "./Controller-
|
|
2
|
-
import { c } from "./Controller-
|
|
1
|
+
import { p as propertyTrackResolve } from "./Controller-4XBxysPn.js";
|
|
2
|
+
import { c } from "./Controller-4XBxysPn.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-B5Rj3U_I.js";
|
|
6
|
+
import { d, m } from "./lazyLoad-B5Rj3U_I.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-
|
|
13
|
-
import { propertyFlagAttribute, propertyFlagNoAccessor, propertyFlagReadOnly, propertyFlagState, propertyFlagBoolean, propertyFlagNumber, propertyFlagReflect } from "./config.js";
|
|
11
|
+
import { c as controllerSymbol, s as shouldBypassReadOnly } from "./ControllerInternals-D2JYGiUO.js";
|
|
12
|
+
import { C as ControllerManager, a as autoDestroyDisabledPropName } from "./ControllerManager-DFn8sm5s.js";
|
|
13
|
+
import { propertyFlagAttribute, propertyFlagUseDefault, 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";
|
|
16
16
|
import { directive as directive$1, Directive } from "lit/directive.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) {
|
|
@@ -119,6 +123,7 @@ class LitElement extends LitElement$1 {
|
|
|
119
123
|
// Controllers add this option to Lit
|
|
120
124
|
readOnly: !!(flags & propertyFlagReadOnly),
|
|
121
125
|
noAccessor: !!(flags & propertyFlagNoAccessor),
|
|
126
|
+
useDefault: !!(flags & propertyFlagUseDefault),
|
|
122
127
|
c: false,
|
|
123
128
|
...rest,
|
|
124
129
|
hasChanged(newValue, oldValue) {
|
|
@@ -160,6 +165,9 @@ class LitElement extends LitElement$1 {
|
|
|
160
165
|
static {
|
|
161
166
|
this.lumina = true;
|
|
162
167
|
}
|
|
168
|
+
static {
|
|
169
|
+
proxyFormMethodsToEvents(this);
|
|
170
|
+
}
|
|
163
171
|
/**
|
|
164
172
|
* The JS API's Accessor observables. This is used to integrate with the JS
|
|
165
173
|
* API's reactivity system.
|
|
@@ -171,14 +179,26 @@ class LitElement extends LitElement$1 {
|
|
|
171
179
|
#enableUpdating;
|
|
172
180
|
#postLoadedDeferred;
|
|
173
181
|
#trackingTarget;
|
|
182
|
+
#elementInternals;
|
|
183
|
+
/**
|
|
184
|
+
* @see [MDN ElementInternals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
185
|
+
*/
|
|
186
|
+
get elementInternals() {
|
|
187
|
+
this.#elementInternals ??= this.el.attachInternals();
|
|
188
|
+
return this.#elementInternals;
|
|
189
|
+
}
|
|
174
190
|
connectedCallback() {
|
|
175
|
-
if (this.
|
|
176
|
-
|
|
191
|
+
if (!this.hasAttribute("defer-hydration")) {
|
|
192
|
+
this.#connectedCallback(true);
|
|
177
193
|
}
|
|
194
|
+
}
|
|
195
|
+
#connectedCallback(callSuper) {
|
|
178
196
|
const trackingTarget = this.constructor.K.c?.(() => this.requestUpdate());
|
|
179
197
|
this.#trackingTarget = trackingTarget;
|
|
180
198
|
const isFirstCall = !this.manager.connectedCalled;
|
|
181
|
-
|
|
199
|
+
if (callSuper) {
|
|
200
|
+
super.connectedCallback();
|
|
201
|
+
}
|
|
182
202
|
if (isFirstCall) {
|
|
183
203
|
queueMicrotask(
|
|
184
204
|
// eslint-disable-next-line @typescript-eslint/promise-function-async, @typescript-eslint/no-misused-promises
|
|
@@ -222,9 +242,13 @@ class LitElement extends LitElement$1 {
|
|
|
222
242
|
const options = Class.shadowRootOptions;
|
|
223
243
|
const useLightDom = options === noShadowRoot;
|
|
224
244
|
const renderRoot = existingShadowRoot ?? (useLightDom ? this.el : this.el.attachShadow(options));
|
|
225
|
-
if (existingShadowRoot && //
|
|
226
|
-
// SSR
|
|
227
|
-
|
|
245
|
+
if (existingShadowRoot && // If we are in production, we are not in HMR, so assume SSR.
|
|
246
|
+
// If we are not in production, we might still be in SSR, as long as we
|
|
247
|
+
// are not in HMR
|
|
248
|
+
(process.env.NODE_ENV === "production" || this.el.constructor.devOnly$hmrIndex === void 0)) {
|
|
249
|
+
if (!this.manager.connectedCalled) {
|
|
250
|
+
this.#connectedCallback(false);
|
|
251
|
+
}
|
|
228
252
|
LitElement$1.prototype.createRenderRoot.call(this);
|
|
229
253
|
return existingShadowRoot;
|
|
230
254
|
}
|
|
@@ -264,7 +288,7 @@ class LitElement extends LitElement$1 {
|
|
|
264
288
|
this.#enableUpdating(true);
|
|
265
289
|
this.performUpdate();
|
|
266
290
|
this.I.resolve();
|
|
267
|
-
await
|
|
291
|
+
await 0;
|
|
268
292
|
const pendingChildren = this.J.filter((loaded) => !loaded.manager?.loadedCalled);
|
|
269
293
|
if (pendingChildren.length) {
|
|
270
294
|
await Promise.allSettled(pendingChildren.map(async (child) => await child.componentOnReady()));
|
|
@@ -386,7 +410,15 @@ const makeRuntime = (options) => {
|
|
|
386
410
|
customElement(tagName, component) {
|
|
387
411
|
component.K = runtime;
|
|
388
412
|
component.L = tagName;
|
|
389
|
-
if (
|
|
413
|
+
if (isServer) {
|
|
414
|
+
let define = function() {
|
|
415
|
+
try {
|
|
416
|
+
customElements.define(tagName, component);
|
|
417
|
+
} catch {
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
define();
|
|
421
|
+
} else if (!customElements.get(tagName)) {
|
|
390
422
|
customElements.define(tagName, component);
|
|
391
423
|
}
|
|
392
424
|
}
|