@arcgis/lumina 5.1.0-next.9 → 5.1.0-next.91

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.
Files changed (31) hide show
  1. package/dist/{Controller-DQnXLHsP.js → Controller-Cer_6Z29.js} +9 -9
  2. package/dist/{ControllerInternals-By6dhpY-.js → ControllerInternals-CeDntN3G.js} +8 -10
  3. package/dist/{ControllerManager-eFkqujn9.js → ControllerManager-DpJfvft9.js} +11 -11
  4. package/dist/LitElement.d.ts +15 -0
  5. package/dist/config.d.ts +1 -0
  6. package/dist/config.js +3 -1
  7. package/dist/context.js +2 -2
  8. package/dist/controllers/ControllerInternals.d.ts +0 -4
  9. package/dist/controllers/accessor/index.js +3 -3
  10. package/dist/controllers/accessor/reEmitEvent.d.ts +3 -2
  11. package/dist/controllers/accessor/store.d.ts +1 -1
  12. package/dist/controllers/accessor/useAccessor.d.ts +8 -7
  13. package/dist/controllers/index.d.ts +2 -1
  14. package/dist/controllers/index.js +59 -12
  15. package/dist/controllers/useSlottableRequest.d.ts +22 -0
  16. package/dist/formAssociatedUtils.d.ts +48 -0
  17. package/dist/hmrSupport.d.ts +1 -0
  18. package/dist/hmrSupport.js +4 -2
  19. package/dist/index.js +47 -15
  20. package/dist/jsx/generatedTypes.d.ts +240 -219
  21. package/dist/jsx/types.d.ts +1 -1
  22. package/dist/{lazyLoad-DJM-hmfq.js → lazyLoad-B5Rj3U_I.js} +31 -8
  23. package/dist/lazyLoad.d.ts +13 -6
  24. package/dist/makeRuntime.d.ts +1 -1
  25. package/dist/{proxyExports-CXEnG2Az.js → proxyExports-BkN6hND0.js} +2 -2
  26. package/package.json +7 -3
  27. /package/dist/{typings → globalTypes}/importMeta.d.ts +0 -0
  28. /package/dist/{typings → globalTypes}/index.d.ts +0 -0
  29. /package/dist/{typings → globalTypes}/jsxGlobals.d.ts +0 -0
  30. /package/dist/{typings → globalTypes}/loadLitCss.d.ts +0 -0
  31. /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-By6dhpY-.js";
2
+ import { r as retrieveComponent, d as retrieveParentControllers, b as setParentController, a as setAmbientComponent, u as use, j as useRef, k as useRefSync, c as controllerSymbol } from "./ControllerInternals-CeDntN3G.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
- trackPropertyKey as b,
457
+ trackPropKey as b,
458
458
  createEvent as c,
459
- trackPropKey as d,
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;
@@ -113,20 +113,18 @@ const bypassReadOnly = (callback) => {
113
113
  shouldBypassReadOnly = false;
114
114
  }
115
115
  };
116
- const bypassSetter = bypassReadOnly;
117
116
  export {
118
117
  setAmbientComponent as a,
119
118
  setParentController as b,
120
119
  controllerSymbol as c,
121
120
  retrieveParentControllers as d,
122
- bypassSetter as e,
123
- bypassReadOnly as f,
124
- isController as g,
125
- getControllersCount as h,
121
+ bypassReadOnly as e,
122
+ isController as f,
123
+ getControllersCount as g,
124
+ setAmbientChildController as h,
126
125
  isPromise as i,
127
- setAmbientChildController as j,
128
- useRef as k,
129
- useRefSync as l,
126
+ useRef as j,
127
+ useRefSync as k,
130
128
  retrieveComponent as r,
131
129
  shouldBypassReadOnly as s,
132
130
  use as u
@@ -1,8 +1,8 @@
1
1
  import { safeCall, isEsriInternalEnv } from "@arcgis/toolkit/error";
2
- import { G as GenericController, p as propertyTrackResolve } from "./Controller-DQnXLHsP.js";
2
+ import { G as GenericController, p as propertyTrackResolve } from "./Controller-Cer_6Z29.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-By6dhpY-.js";
5
+ import { a as setAmbientComponent } from "./ControllerInternals-CeDntN3G.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
  }
@@ -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
@@ -19,3 +19,4 @@ export declare const propertyFlagNumber: number;
19
19
  export declare const propertyFlagState: number;
20
20
  export declare const propertyFlagReadOnly: number;
21
21
  export declare const propertyFlagNoAccessor: number;
22
+ export declare const propertyFlagUseDefault: number;
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 { ContextProvider, ContextConsumer } from "@lit/context";
2
- import { r as retrieveComponent } from "./ControllerInternals-By6dhpY-.js";
1
+ import { ContextConsumer, ContextProvider } from "@lit/context";
2
+ import { r as retrieveComponent } from "./ControllerInternals-CeDntN3G.js";
3
3
  const useContextProvider = (options) => {
4
4
  const component = retrieveComponent();
5
5
  const controller = new ContextProvider(component.el, options);
@@ -25,10 +25,6 @@ export declare let shouldBypassReadOnly: boolean;
25
25
  * @see https://webgis.esri.com/references/lumina/properties#read-only-properties
26
26
  */
27
27
  export declare const bypassReadOnly: <T = void>(callback: () => T) => T | void;
28
- /**
29
- * @deprecated see https://webgis.esri.com/references/lumina/properties#get-set-properties
30
- */
31
- export declare const bypassSetter: <T = void>(callback: () => T) => T | void;
32
28
  /**
33
29
  * If passed value is a controller, then return it. Otherwise, assume it's a
34
30
  * proxyExports() result and wrap it into a controller
@@ -1,8 +1,8 @@
1
1
  import { isEsriInternalEnv } from "@arcgis/toolkit/error";
2
- import { r as retrieveComponent } from "../../ControllerInternals-By6dhpY-.js";
2
+ import { r as retrieveComponent } from "../../ControllerInternals-CeDntN3G.js";
3
3
  import { on, watch } from "@arcgis/core/core/reactiveUtils.js";
4
- import { a as createEventFactory, G as GenericController, d as trackPropKey, t as trackKey } from "../../Controller-DQnXLHsP.js";
5
- import { p as proxyExports } from "../../proxyExports-CXEnG2Az.js";
4
+ import { a as createEventFactory, G as GenericController, b as trackPropKey, t as trackKey } from "../../Controller-Cer_6Z29.js";
5
+ import { p as proxyExports } from "../../proxyExports-BkN6hND0.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<__esri.HomeViewModelGoEvent>(() => this.viewModel, "go");
8
+ * arcgisGo = reEmitEvent<HomeViewModelGoEvent>(() => this.viewModel, "go");
8
9
  * ```
9
10
  */
10
- export declare const reEmitEvent: <T>(getEventedAccessor: () => __esri.Evented, eventName: string) => EventEmitter<T>;
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)) => __esri.Accessor & 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
- type Requires<Props, Accessor extends __esri.Accessor, OmitProps extends string = never> = LitElement & Omit<Pick<Accessor, keyof Accessor & keyof Props>, AlwaysOmit | OmitProps> & {
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 __esri.Accessor, OmitProps extends string = never>(createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor), _options?: {
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 __esri.Accessor, ExtraRequires = Record<never, never>> extends GenericController<Accessor, ExtraRequires & Requires<Props, Accessor>> {
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, __esri.Accessor>, "_currentlyBindingPropertyName" | "exports"> & {
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: __esri.Accessor, boundProperties: Map<string, string>) => unknown;
74
- export declare const getAccessorControllerBoundProperties: <Accessor extends __esri.Accessor>(controller: AccessorController<unknown, Accessor>) => Map<string & keyof Accessor, string>;
75
- export declare const reCreateAccessor: (instance: __esri.Accessor, component: LitElement) => void;
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 {};
@@ -3,7 +3,7 @@ import { setAutoDestroyOnDisconnectTimeout } from './ControllerManager.ts';
3
3
  export type { GenericControllerType } from './Controller.ts';
4
4
  export { Controller, GenericController } from './Controller.ts';
5
5
  export type { ControllerManager } from './ControllerManager.ts';
6
- export { retrieveComponent, bypassSetter, bypassReadOnly } from './ControllerInternals.ts';
6
+ export { retrieveComponent, bypassReadOnly } from './ControllerInternals.ts';
7
7
  export { trackPropertyKey, propertyTrackResolve } from './trackPropertyKey.ts';
8
8
  export { trackPropKey } from './trackPropKey.ts';
9
9
  export { trackKey } from './trackKey.ts';
@@ -12,6 +12,7 @@ export { useWatchAttributes } from './useWatchAttributes.ts';
12
12
  export { load } from './load.ts';
13
13
  export { proxyExports } from './proxyExports.ts';
14
14
  export { toFunction } from './toFunction.ts';
15
+ export { useSlottableRequest } from './useSlottableRequest.ts';
15
16
  export * from './types.ts';
16
17
  export { useMedia } from './useMedia.ts';
17
18
  export { useDirection } from './useDirection.ts';
@@ -1,13 +1,13 @@
1
- import { C as Controller, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-DQnXLHsP.js";
2
- import { G, d, b } from "../Controller-DQnXLHsP.js";
3
- import { a as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-By6dhpY-.js";
4
- import { f, e, c, h, g } from "../ControllerInternals-By6dhpY-.js";
5
- import { p as proxyExports } from "../proxyExports-CXEnG2Az.js";
1
+ import { C as Controller, c as createEvent, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-Cer_6Z29.js";
2
+ import { G, b, d } from "../Controller-Cer_6Z29.js";
3
+ import { a as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-CeDntN3G.js";
4
+ import { e, c, g, f } from "../ControllerInternals-CeDntN3G.js";
5
+ import { p as proxyExports } from "../proxyExports-BkN6hND0.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-eFkqujn9.js";
10
+ import { s as setAutoDestroyOnDisconnectTimeout, b as autoDestroyOnDisconnectTimeout } from "../ControllerManager-DpJfvft9.js";
11
11
  const makeController = (constructor) => proxy(void 0, constructor);
12
12
  const makeGenericController = (constructor) => (component) => proxy(
13
13
  component,
@@ -101,6 +101,53 @@ const toFunction = (Class) => (...args) => {
101
101
  setParentController(ambientControllers.at(-1));
102
102
  return instance;
103
103
  };
104
+ const useSlottableRequest = (component, watch, getDetailsBySlotName) => makeController((_component, controller) => {
105
+ const watchedProps = watch;
106
+ const slottableRequestController = createEvent({ bubbles: false, composed: false });
107
+ controller.onUpdated((changes) => {
108
+ if (!watchedProps.some((prop) => changes.has(prop))) {
109
+ return;
110
+ }
111
+ const previousDetails = getDetailsBySlotName(getWatchedProps(component, watchedProps, changes));
112
+ const currentDetails = getDetailsBySlotName(getWatchedProps(component, watchedProps));
113
+ previousDetails.forEach((previousDetail, slotName) => {
114
+ if (!currentDetails.has(slotName)) {
115
+ slottableRequestController.emit({ ...previousDetail, data: void 0 });
116
+ }
117
+ });
118
+ currentDetails.forEach((currentDetail, slotName) => {
119
+ const previousDetail = previousDetails.get(slotName);
120
+ if (!previousDetail || !isEqualValue(previousDetail, currentDetail)) {
121
+ slottableRequestController.emit(currentDetail);
122
+ }
123
+ });
124
+ });
125
+ return slottableRequestController;
126
+ });
127
+ function getWatchedProps(component, watchedProps, changes) {
128
+ const values = {};
129
+ watchedProps.forEach((prop) => {
130
+ values[prop] = changes?.has(prop) ? changes.get(prop) : component[prop];
131
+ });
132
+ return values;
133
+ }
134
+ function isEqualValue(previous, current) {
135
+ if (previous === current) {
136
+ return true;
137
+ }
138
+ if (!previous || !current || typeof previous !== "object" || typeof current !== "object") {
139
+ return false;
140
+ }
141
+ if (Array.isArray(previous) || Array.isArray(current)) {
142
+ return false;
143
+ }
144
+ const previousEntries = Object.entries(previous);
145
+ const currentEntries = Object.entries(current);
146
+ if (previousEntries.length !== currentEntries.length) {
147
+ return false;
148
+ }
149
+ return previousEntries.every(([key, value]) => isEqualValue(value, current[key]));
150
+ }
104
151
  const useMedia = (query) => makeController((_component, controller) => {
105
152
  const media = globalThis.matchMedia(query);
106
153
  const changed = () => {
@@ -258,12 +305,11 @@ const exportsForTests = {
258
305
  export {
259
306
  Controller,
260
307
  G as GenericController,
261
- f as bypassReadOnly,
262
- e as bypassSetter,
308
+ e as bypassReadOnly,
263
309
  c as controllerSymbol,
264
310
  exportsForTests,
265
- h as getControllersCount,
266
- g as isController,
311
+ g as getControllersCount,
312
+ f as isController,
267
313
  keyTrackResolve,
268
314
  load,
269
315
  makeController,
@@ -274,10 +320,11 @@ export {
274
320
  retrieveComponent,
275
321
  toFunction,
276
322
  trackKey,
277
- d as trackPropKey,
278
- b as trackPropertyKey,
323
+ b as trackPropKey,
324
+ d as trackPropertyKey,
279
325
  useDirection,
280
326
  useMedia,
281
327
  usePropertyChange,
328
+ useSlottableRequest,
282
329
  useWatchAttributes
283
330
  };
@@ -0,0 +1,22 @@
1
+ import { EventEmitter } from '../createEvent.ts';
2
+ import { LitElement } from '../LitElement.ts';
3
+ type SlottableRequestDetail = {
4
+ name: string;
5
+ slotName: string;
6
+ data: unknown;
7
+ };
8
+ type WatchedProps<Component extends LitElement, ToWatch extends readonly (keyof Component)[]> = Pick<Component, ToWatch[number]>;
9
+ /**
10
+ * Watches host properties and emits slottable request details when the
11
+ * requested slot details are added, removed, or changed.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const slottableRequest = useSlottableRequest(this, ["item"], ({ item }) => {
16
+ * const details = new Map<string, Detail>();
17
+ * details.set("item-slot", { name: "item", slotName: "item-slot", data: item });
18
+ * return details;
19
+ * });
20
+ */
21
+ export declare const useSlottableRequest: <Component extends LitElement, const ToWatch extends readonly (keyof Component)[], Detail extends SlottableRequestDetail>(component: Component, watch: ToWatch, getDetailsBySlotName: (component: WatchedProps<Component, ToWatch>) => ReadonlyMap<string, Detail>) => EventEmitter<Detail>;
22
+ export {};
@@ -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;
@@ -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
@@ -1,4 +1,4 @@
1
- import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-DJM-hmfq.js";
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] ??= {};