@arcgis/lumina 5.2.0-next.2 → 5.2.0-next.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/{ControllerManager-DpJfvft9.js → ControllerManager-4cSEnB5Y.js} +12 -8
  2. package/dist/{Controller-Cer_6Z29.js → GenericController-C8NSb50b.js} +59 -23
  3. package/dist/LitElement.d.ts +179 -250
  4. package/dist/PublicLitElement.d.ts +64 -30
  5. package/dist/config.d.ts +22 -16
  6. package/dist/context.d.ts +24 -24
  7. package/dist/controllers/Controller.d.ts +106 -139
  8. package/dist/controllers/ControllerInternals.d.ts +33 -25
  9. package/dist/controllers/ControllerManager.d.ts +40 -61
  10. package/dist/controllers/GenericController.d.ts +26 -0
  11. package/dist/controllers/accessor/index.d.ts +6 -4
  12. package/dist/controllers/accessor/index.js +23 -5
  13. package/dist/controllers/accessor/reEmitEvent.d.ts +6 -3
  14. package/dist/controllers/accessor/store.d.ts +21 -14
  15. package/dist/controllers/accessor/useAccessor.d.ts +86 -68
  16. package/dist/controllers/functional.d.ts +11 -4
  17. package/dist/controllers/index.d.ts +35 -36
  18. package/dist/controllers/index.js +5 -7
  19. package/dist/controllers/load.d.ts +3 -2
  20. package/dist/controllers/proxyExports.d.ts +6 -5
  21. package/dist/controllers/toFunction.d.ts +4 -2
  22. package/dist/controllers/trackKey.d.ts +9 -4
  23. package/dist/controllers/trackPropKey.d.ts +8 -2
  24. package/dist/controllers/trackPropertyKey.d.ts +11 -6
  25. package/dist/controllers/types.d.ts +99 -170
  26. package/dist/controllers/useDirection.d.ts +5 -6
  27. package/dist/controllers/useMedia.d.ts +3 -2
  28. package/dist/controllers/usePropertyChange.d.ts +9 -10
  29. package/dist/controllers/useSlottableRequest.d.ts +15 -10
  30. package/dist/controllers/useT9n.d.ts +44 -38
  31. package/dist/controllers/useWatchAttributes.d.ts +6 -3
  32. package/dist/controllers/utils.d.ts +13 -5
  33. package/dist/createEvent.d.ts +32 -32
  34. package/dist/decorators.d.ts +16 -9
  35. package/dist/formAssociatedUtils.d.ts +5 -47
  36. package/dist/globalTypes/importMeta.d.ts +18 -10
  37. package/dist/globalTypes/index.d.ts +6 -4
  38. package/dist/globalTypes/jsxGlobals.d.ts +36 -23
  39. package/dist/globalTypes/loadLitCss.d.ts +61 -40
  40. package/dist/globalTypes/viteEnv.d.ts +60 -26
  41. package/dist/hmrSupport.d.ts +24 -28
  42. package/dist/index.d.ts +17 -16
  43. package/dist/index.js +27 -7
  44. package/dist/jsx/baseTypes.d.ts +26 -26
  45. package/dist/jsx/directives.d.ts +30 -42
  46. package/dist/jsx/generatedTypes.d.ts +3002 -2923
  47. package/dist/jsx/types.d.ts +214 -171
  48. package/dist/jsx/utils.d.ts +19 -14
  49. package/dist/lazyLoad.d.ts +31 -110
  50. package/dist/makeRuntime.d.ts +104 -127
  51. package/dist/{proxyExports-BkN6hND0.js → proxyExports-ZRLty8oJ.js} +1 -1
  52. package/dist/render.d.ts +4 -2
  53. package/dist/utils.d.ts +9 -14
  54. package/dist/wrappersUtils.d.ts +25 -26
  55. package/package.json +7 -4
  56. package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +0 -14
  57. package/dist/lifecycleSupport.d.ts +0 -8
  58. package/dist/tests/wrappersUtils.typeTest.d.ts +0 -1
package/dist/context.d.ts CHANGED
@@ -1,36 +1,36 @@
1
- import { ContextConsumer, ContextProvider, Context, ContextType } from '@lit/context';
2
- import { ReactiveControllerHost } from 'lit';
3
- interface ContextProviderOptions<C extends Context<unknown, unknown>> {
4
- context: C;
5
- initialValue?: ContextType<C>;
1
+ import type { ContextConsumer, ContextProvider, Context, ContextType } from "@lit/context";
2
+ import type { ReactiveControllerHost } from "lit";
3
+
4
+ export interface ContextProviderOptions<C extends Context<unknown, unknown>> {
5
+ context: C;
6
+ initialValue?: ContextType<C>;
6
7
  }
7
- interface ContextConsumerOptions<C extends Context<unknown, unknown>> {
8
- context: C;
9
- callback?: (value: ContextType<C>, dispose?: () => void) => void;
10
- subscribe?: boolean;
8
+
9
+ export interface ContextConsumerOptions<C extends Context<unknown, unknown>> {
10
+ context: C;
11
+ /**
12
+ * @param value
13
+ * @param dispose
14
+ */
15
+ callback?(value: ContextType<C>, dispose?: () => void): void;
16
+ subscribe?: boolean;
11
17
  }
18
+
12
19
  /**
13
20
  * Wrapper for Lit's ContextProvider controller to provide lazy-loading compatibility.
14
21
  *
22
+ * @param options
15
23
  * @see https://lit.dev/docs/data/context/
16
24
  */
17
- export declare const useContextProvider: <C extends Context<unknown, unknown>>(options: ContextProviderOptions<C>) => ContextProvider<C>;
25
+ export function useContextProvider<C extends Context<unknown, unknown>>(options: ContextProviderOptions<C>): ContextProvider<C>;
26
+
18
27
  /**
19
28
  * Wrapper for Lit's ContextConsumer controller to provide lazy-loading compatibility.
20
29
  *
30
+ * @param options
21
31
  * @see https://lit.dev/docs/data/context/
22
- *
23
- * FEATURE: wrap this in proxyExports to improve DX, or keep it simple?
24
- */
25
- export declare const useContextConsumer: <C extends Context<unknown, unknown>>(options: ContextConsumerOptions<C>) => ContextConsumer<C, LitContextHost>;
26
- /**
27
- * Lit context wasn't written with lazy loading proxy in mind. For it to
28
- * work correctly, we must provide the DOM-attached element as the host element.
29
- * Events will be fired/listened on it.
30
- *
31
- * At the same time, .addController() and .requestUpdate() methods will be
32
- * called on it. We had to implement these on the lazy proxy to redirect the
33
- * calls to the actual LitElement.
34
32
  */
35
- type LitContextHost = HTMLElement & ReactiveControllerHost;
36
- export {};
33
+ export function useContextConsumer<C extends Context<unknown, unknown>>(options: ContextConsumerOptions<C>): ContextConsumer<C, LitContextHost>;
34
+
35
+ export type LitContextHost = HTMLElement
36
+ & ReactiveControllerHost;
@@ -1,145 +1,112 @@
1
- import { Deferred } from '@arcgis/toolkit/promise';
2
- import { BaseController, ControllerLifecycleMethods, controllerSymbol } from './types.ts';
3
- import { use, useRef, useRefSync } from './ControllerInternals.ts';
4
- import { PropertyValues } from 'lit';
5
- import { LitElement } from '../LitElement.ts';
1
+ import type { ControllerLifecycleMethods } from "./types.js";
2
+ import type { NotNever, InferController } from "./ControllerInternals.js";
3
+ import type { LitElement } from "../LitElement.js";
4
+
6
5
  /**
7
6
  * Base class for Controllers defined using a class rather than a function.
8
7
  * Defining controller using makeController() function is more succinct for smaller
9
8
  * controllers. For controllers that need to declare several methods, or need
10
9
  * more flexibility, this class may be used
11
10
  */
12
- export declare abstract class Controller<Exports = never> implements BaseController {
13
- #private;
14
- /** @private */
15
- protected __ready: Deferred<Exports>;
16
- /** @private */
17
- __assignedProperty?: string | false;
18
- connectedCalled: boolean;
19
- loadedCalled: boolean;
20
- readonly [controllerSymbol] = true;
21
- component: LitElement;
22
- ready: Promise<Exports>;
23
- constructor(component?: LitElement);
24
- /**
25
- * If controller is being added dynamically, after the component
26
- * construction, then trigger connected and load right away
27
- */
28
- catchUpLifecycle(): void;
29
- get exports(): Exports;
30
- /**
31
- * Set controller's exports property (for usage with proxyExports()) and mark
32
- * controller as ready (for usage in other controllers). Also, triggers
33
- * re-render of the component
34
- */
35
- set exports(exports: Exports);
36
- /**
37
- * If controller needs to await a promise before it's exports are fully ready
38
- * but it wishes to make some limited exports available before then,
39
- * this method can be used.
40
- *
41
- * This is useful for permitting a limited usage of the controller in default
42
- * values of properties or in component constructor.
43
- *
44
- * In order to help detect bugs, trying to access a prop on the exports value
45
- * that does not exist will throw an error (in development only). This is
46
- * useful to detect usages of controller that forgot to await it's exports.
47
- * (the "value in this.myController" check won't cause an exception though)
48
- *
49
- * @param proxy [true] - whether to throw an error if unknown property is
50
- * accessed before the controller is loaded.
51
- */
52
- setProvisionalExports(exports: Exports, proxy?: boolean): void;
53
- setProvisionalExports(exports: Exports extends object ? Partial<Exports> : Exports, proxy?: boolean): void;
54
- setProvisionalExports<Props extends keyof Exports>(exports: Pick<Exports, Props>, proxy?: boolean): void;
55
- watchExports(callback: (exports: Exports) => void): () => void;
56
- /**
57
- * A flexible utility for making sure a controller is loaded before it's used,
58
- * regardless of how or where a controller was defined:
59
- *
60
- * @example
61
- * makeGenericController(async (component, controller) => {
62
- * // Await some controller from the component:
63
- * await controller.use(component.someController);
64
- * // Initialize new controllers
65
- * await controller.use(load(importCoreReactiveUtils));
66
- * await controller.use(new ViewModelController(component,newWidgetsHomeHomeViewModel));
67
- * await controller.use(someController(component));
68
- * });
69
- *
70
- * @remarks
71
- * If your controller is not async, and you are not creating it async, then
72
- * you are not required to use controller.use - you can use it directly.
73
- * Similarly, accessing controllers after componentWillLoad callback does not
74
- * require awaiting them as they are guaranteed to be loaded by then.
75
- */
76
- get use(): typeof use;
77
- /**
78
- * Just like controller.use, but returns the controller itself, rather than it's
79
- * exports
80
- *
81
- * Use cases:
82
- * - You have a controller and you want to make sure it's loaded before you
83
- * try to use it
84
- * - Your controller is not using exports, so you wish to access some props on
85
- * it directly
86
- * - You have a controller exports only, and you want to retrieve the
87
- * controller itself. This is useful if you wish to call .watchExports() or
88
- * some other method on the controller
89
- */
90
- get useRef(): typeof useRef;
91
- /**
92
- * Like useRef, but doesn't wait for the controller to get ready
93
- *
94
- * @private
95
- */
96
- get useRefSync(): typeof useRefSync;
97
- controllerRemoved(): void;
98
- onConnected(callback: NonNullable<ControllerLifecycleMethods["hostConnected"]>): void;
99
- onDisconnected(callback: NonNullable<ControllerLifecycleMethods["hostDisconnected"]>): void;
100
- onLoad(callback: NonNullable<ControllerLifecycleMethods["hostLoad"]>): void;
101
- onLoaded(callback: NonNullable<ControllerLifecycleMethods["hostLoaded"]>): void;
102
- onUpdate(callback: NonNullable<ControllerLifecycleMethods["hostUpdate"]>): void;
103
- onUpdated(callback: NonNullable<ControllerLifecycleMethods["hostUpdated"]>): void;
104
- onDestroy(callback: NonNullable<ControllerLifecycleMethods["hostDestroy"]>): void;
105
- onLifecycle(callback: NonNullable<ControllerLifecycleMethods["hostLifecycle"]>): void;
106
- /** @private */
107
- triggerConnected(): void;
108
- /** @private */
109
- triggerDisconnected(): void;
110
- /** @private */
111
- triggerLoad(): Promise<void>;
112
- /** @private */
113
- triggerLoaded(): void;
114
- /** @private */
115
- triggerUpdate(changes: PropertyValues): void;
116
- /** @private */
117
- triggerUpdated(changes: PropertyValues): void;
118
- /** @private */
119
- triggerDestroy(): void;
120
- /** @private */
121
- triggerLifecycle(): void;
122
- }
123
- export declare abstract class GenericControllerType<Exports, Requires = LitElement> extends Controller<Exports> {
124
- component: LitElement & Requires;
125
- constructor(component: LitElement & Requires);
126
- }
127
- /**
128
- * If your controller requires some specific properties to be present on the
129
- * component, besides what's included in LitElement, use
130
- * GenericController over the usual Controller. Use the 2nd generic argument
131
- * on this class for specifying what properties your controller expects on the
132
- * component
133
- *
134
- * When using a controller created using GenericController, consumer must
135
- * pass in "this" explicitly to the constructor. If controller was
136
- * created using Controller, that is not necessary
137
- *
138
- * @remarks
139
- * GenericController class is identical to Controller class in all but typing.
140
- * That is why, at runtime GenericController is actually equal to Controller
141
- * class.
142
- * You can use GenericControllerType type if you wish to reference generic
143
- * controller instance type.
144
- */
145
- export declare const GenericController: typeof GenericControllerType;
11
+ export abstract class Controller<Exports = never> {
12
+ constructor(component?: LitElement);
13
+ component: LitElement;
14
+ /** @default false */
15
+ connectedCalled: boolean;
16
+ /**
17
+ * Setting .exports set controller's exports property for usage with
18
+ * proxyExports() and marks the controller as ready for usage in other
19
+ * controllers. Also, this triggers re-render of the component.
20
+ */
21
+ accessor exports: Exports;
22
+ /** @default false */
23
+ loadedCalled: boolean;
24
+ ready: Promise<Exports>;
25
+ /**
26
+ * A flexible utility for making sure a controller is loaded before it's used,
27
+ * regardless of how or where a controller was defined:
28
+ *
29
+ * If your controller is not async, and you are not creating it inside async
30
+ * function, then you are not required to use controller.use - you can create
31
+ * controller directly. Similarly, accessing controllers after
32
+ * componentWillLoad callback does not require awaiting them as they are
33
+ * guaranteed to be loaded by then.
34
+ *
35
+ * @example
36
+ * makeGenericController(async (component, controller) => {
37
+ * // Await some controller from the component:
38
+ * await controller.use(component.someController);
39
+ * // Initialize new controllers
40
+ * await controller.use(load(importCoreReactiveUtils));
41
+ * await controller.use(new ViewModelController(component,newWidgetsHomeHomeViewModel));
42
+ * await controller.use(someController(component));
43
+ * });
44
+ */
45
+ get use(): <Value>(value: Value, watchExports?: (value: NotNever<InferController<Value>>, unsubscribe: () => void) => void) => Promise<NotNever<InferController<Value>>>;
46
+ /**
47
+ * Just like controller.use, but returns the controller itself, rather than it's
48
+ * exports
49
+ *
50
+ * Use cases:
51
+ * - You have a controller and you want to make sure it's loaded before you
52
+ * try to use it
53
+ * - Your controller is not using exports, so you wish to access some props on
54
+ * it directly
55
+ * - You have a controller exports only, and you want to retrieve the
56
+ * controller itself. This is useful if you wish to call .watchExports() or
57
+ * some other method on the controller
58
+ */
59
+ get useRef(): <Value>(value: Value) => Promise<InferController<Value>>;
60
+ /** @internal */
61
+ controllerRemoved(): void;
62
+ /**
63
+ * Register a connected lifecycle callback
64
+ *
65
+ * @param callback
66
+ */
67
+ onConnected(callback: NonNullable<ControllerLifecycleMethods["hostConnected"]>): void;
68
+ /** @param callback */
69
+ onDestroy(callback: NonNullable<ControllerLifecycleMethods["hostDestroy"]>): void;
70
+ /** @param callback */
71
+ onDisconnected(callback: NonNullable<ControllerLifecycleMethods["hostDisconnected"]>): void;
72
+ /** @param callback */
73
+ onLifecycle(callback: NonNullable<ControllerLifecycleMethods["hostLifecycle"]>): void;
74
+ /** @param callback */
75
+ onLoad(callback: NonNullable<ControllerLifecycleMethods["hostLoad"]>): void;
76
+ /** @param callback */
77
+ onLoaded(callback: NonNullable<ControllerLifecycleMethods["hostLoaded"]>): void;
78
+ /** @param callback */
79
+ onUpdate(callback: NonNullable<ControllerLifecycleMethods["hostUpdate"]>): void;
80
+ /** @param callback */
81
+ onUpdated(callback: NonNullable<ControllerLifecycleMethods["hostUpdated"]>): void;
82
+ /**
83
+ * If controller needs to await a promise before it's exports are fully ready
84
+ * but it wishes to make some limited exports available before then,
85
+ * this method can be used.
86
+ *
87
+ * This is useful for permitting a limited usage of the controller in default
88
+ * values of properties or in component constructor.
89
+ *
90
+ * In order to help detect bugs, trying to access a prop on the exports value
91
+ * that does not exist will throw an error (in development only). This is
92
+ * useful to detect usages of controller that forgot to await it's exports.
93
+ * (the "value in this.myController" check won't cause an exception though)
94
+ *
95
+ * @param exports
96
+ * @param proxy - whether to throw an error if unknown property is
97
+ * accessed before the controller is loaded.
98
+ */
99
+ setProvisionalExports(exports: Exports, proxy?: boolean): void;
100
+ /**
101
+ * @param exports
102
+ * @param proxy
103
+ */
104
+ setProvisionalExports(exports: Exports extends object ? Partial<Exports> : Exports, proxy?: boolean): void;
105
+ /**
106
+ * @param exports
107
+ * @param proxy
108
+ */
109
+ setProvisionalExports<Props extends keyof Exports>(exports: Pick<Exports, Props>, proxy?: boolean): void;
110
+ /** @param callback */
111
+ watchExports(callback: (exports: Exports) => void): () => void;
112
+ }
@@ -1,30 +1,42 @@
1
- import { Controller } from './Controller.ts';
2
- import { BaseController } from './types.ts';
3
- import { LitElement } from '../LitElement.ts';
4
- export declare const setAmbientComponent: (component: LitElement) => void;
5
- export declare const retrieveComponent: (name?: string) => LitElement;
6
- export declare const setParentController: (controller: BaseController | undefined) => void;
1
+ import type { Controller } from "./Controller.js";
2
+ import type { BaseController } from "./types.js";
3
+ import type { LitElement } from "../LitElement.js";
4
+
7
5
  /**
8
- * Get references to controllers this nested controller might have been called
9
- * from. The list may include extra controllers, but at least one of them or
10
- * the component itself is the parent for this controller.
6
+ * Allow controllers to implicitly retrieve which component they are in, to
7
+ * improve DX (avoids the need to pass "this" explicitly for each controller)
8
+ *
9
+ * All controllers on the page share a single instance of ControllerInternals
10
+ * class. However, this does not cause a conflict. This variable is set at
11
+ * the very beginning of a component constructor, and is unset at the very
12
+ * next microtask. This way, when controllers are being initialized in the
13
+ * component constructor, this is pointing to the correct component. And, on
14
+ * the very next tick the reference to the component is cleared, to prevent
15
+ * memory leaks and to prevent anyone from accessing this value when they
16
+ * are not supposed to.
17
+ *
18
+ * @param component
19
+ * @internal
11
20
  */
12
- export declare const retrieveParentControllers: () => readonly BaseController[];
13
- export declare const setAmbientChildController: (controller: BaseController | undefined) => void;
21
+ export function setAmbientComponent(component: LitElement): void;
22
+
14
23
  /**
15
- * The type definition has to be duplicated due to this TypeScript error:
16
- * "'use' is referenced directly or indirectly in its own type annotation."
24
+ * Get a reference to a custom element. This is only reliably available during
25
+ * component's constructor execution. Controllers are invoked during that
26
+ * stage.
27
+ *
28
+ * @param name
17
29
  */
18
- export declare const use: <Value>(value: Value, watchExports?: (value: NotNever<InferController<Value>>, unsubscribe: () => void) => void) => Promise<NotNever<InferController<Value>>>;
19
- export declare const useRef: <Value>(value: Value) => Promise<InferController<Value>>;
20
- export declare const useRefSync: <Value>(value: Value) => InferController<Value> | undefined;
21
- export declare let shouldBypassReadOnly: boolean;
30
+ export function retrieveComponent(name?: string): LitElement;
31
+
22
32
  /**
23
33
  * Permits updating read-only properties
24
34
  *
35
+ * @param callback
25
36
  * @see https://webgis.esri.com/references/lumina/properties#read-only-properties
26
37
  */
27
- export declare const bypassReadOnly: <T = void>(callback: () => T) => T | void;
38
+ export function bypassReadOnly<T = void>(callback: () => T): T | void;
39
+
28
40
  /**
29
41
  * If passed value is a controller, then return it. Otherwise, assume it's a
30
42
  * proxyExports() result and wrap it into a controller
@@ -32,18 +44,14 @@ export declare const bypassReadOnly: <T = void>(callback: () => T) => T | void;
32
44
  * This won't type correctly if a proxyExports() controller is exporting a
33
45
  * non-proxyExports() controller
34
46
  */
35
- type InferController<ControllerOrExports> = ControllerOrExports extends BaseController ? ControllerOrExports & {
47
+ export type InferController<ControllerOrExports> = ControllerOrExports extends BaseController ? ControllerOrExports & {
36
48
  exports?: unknown;
37
49
  ready?: Promise<void>;
38
50
  watchExports?: Controller["watchExports"];
39
51
  } : Controller<ControllerOrExports>;
52
+
40
53
  /**
41
54
  * If controller never sets its exports, then its default exports is "this".
42
55
  * This allows usage of controller.use with controllers that don't have exports
43
56
  */
44
- type NotNever<T extends {
45
- exports?: any;
46
- }> = T extends {
47
- exports: never;
48
- } ? T : T["exports"];
49
- export {};
57
+ export type NotNever<T extends { exports?: any; }> = T extends { exports: never; } ? T : T["exports"];
@@ -1,66 +1,45 @@
1
- import { BaseController } from './types.ts';
2
- import { GenericController } from './Controller.ts';
3
- import { PropertyValues } from 'lit';
4
- import { LitElement } from '../LitElement.ts';
1
+ import type { PropertyValues } from "lit";
2
+ import type { LitElement } from "../LitElement.js";
3
+ import type { GenericController } from "./GenericController.js";
4
+
5
5
  /**
6
6
  * A manager for all other controllers. It finds all controllers on the
7
7
  * component, loads them, and forwards lifecycle events to them.
8
8
  */
9
- export declare class ControllerManager extends GenericController<undefined> {
10
- #private;
11
- hasDestroy: boolean;
12
- destroyed: boolean;
13
- constructor(component: LitElement);
14
- /**
15
- * Throws an error if component does not implement destroy() lifecycle, but
16
- * tries to use it. This check is only present in development mode
17
- *
18
- * @private
19
- */
20
- devOnly$ensureHasDestroy?: () => void;
21
- destroy(): Promise<void>;
22
- /** @private */
23
- _setAutoDestroyTimeout(): void;
24
- /**
25
- * "readOnly" is not enabled initially since we need to allow to set property
26
- * default values in the constructor.
27
- *
28
- * @private
29
- */
30
- _isEnforcingReadonly: boolean;
31
- /** @private */
32
- _trackedValue: unknown;
33
- /** @private */
34
- _keyTrackers: ((key: string | undefined, value: unknown) => void)[];
35
- /** @private */
36
- _firePropTrackers(key: string | undefined, value: unknown): void;
37
- /**
38
- * Map with keys for any properties that have changed since the last
39
- * update cycle with previous values.
40
- *
41
- * Do not access this directly as this value is only set during the update
42
- * lifecycle. Instead, use the `changes` property that is provided
43
- * to the shouldUpdate(), willUpdate() and updated() lifecycle hooks.
44
- *
45
- * @private
46
- */
47
- _changedProperties?: PropertyValues;
48
- /**
49
- * Associate an exports object with a controller for reverse lookup in
50
- * controller.use
51
- *
52
- * @private
53
- */
54
- _markExports(controller: BaseController, exports: unknown): void;
55
- /** @private */
56
- _resolveExports(exports: unknown): BaseController | undefined;
9
+ export class ControllerManager extends GenericController<undefined> {
10
+ constructor(component: LitElement);
11
+ /**
12
+ * Map with keys for any properties that have changed since the last
13
+ * update cycle with previous values.
14
+ *
15
+ * Do not access this directly as this value is only set during the update
16
+ * lifecycle. Instead, use the `changes` property that is provided
17
+ * to the shouldUpdate(), willUpdate() and updated() lifecycle hooks.
18
+ *
19
+ * @internal
20
+ */
21
+ _changedProperties?: PropertyValues;
22
+ /** @default false */
23
+ destroyed: boolean;
24
+ /**
25
+ * Throws an error if component does not implement destroy() lifecycle, but
26
+ * tries to use it. This check is only present in development mode
27
+ *
28
+ * @internal
29
+ */
30
+ devOnly$ensureHasDestroy?: () => void;
31
+ hasDestroy: boolean;
32
+ destroy(): Promise<void>;
57
33
  }
58
- export declare let autoDestroyOnDisconnectTimeout: number;
59
- export declare const autoDestroyDisabledPropName = "autoDestroyDisabled";
60
- export declare function setAutoDestroyOnDisconnectTimeout(timeout: number): void;
61
- export type LuminaLifecycles = {
62
- connectedCallback?: LitElement["connectedCallback"];
63
- disconnectedCallback?: LitElement["disconnectedCallback"];
64
- load?: () => Promise<void> | void;
65
- loaded?: () => void;
66
- };
34
+
35
+ /**
36
+ * @default 1000
37
+ * @internal
38
+ */
39
+ export const autoDestroyOnDisconnectTimeout: number;
40
+
41
+ /**
42
+ * @param timeout
43
+ * @internal
44
+ */
45
+ export function setAutoDestroyOnDisconnectTimeout(timeout: number): void;
@@ -0,0 +1,26 @@
1
+ import type { LitElement } from "../LitElement.js";
2
+ import type { Controller } from "./Controller.js";
3
+
4
+ export abstract class GenericControllerType<Exports, Requires = LitElement> extends Controller<Exports> {
5
+ constructor(component: LitElement & Requires);
6
+ component: LitElement & Requires;
7
+ }
8
+
9
+ /**
10
+ * If your controller requires some specific properties to be present on the
11
+ * component, besides what's included in LitElement, use
12
+ * GenericController over the usual Controller. Use the 2nd generic argument
13
+ * on this class for specifying what properties your controller expects on the
14
+ * component
15
+ *
16
+ * When using a controller created using GenericController, consumer must
17
+ * pass in "this" explicitly to the constructor. If controller was
18
+ * created using Controller, that is not necessary
19
+ *
20
+ * GenericController class is identical to Controller class in all but typing.
21
+ * That is why, at runtime GenericController is actually equal to Controller
22
+ * class.
23
+ * You can use GenericControllerType type if you wish to reference generic
24
+ * controller instance type.
25
+ */
26
+ export const GenericController: typeof GenericControllerType;
@@ -1,4 +1,6 @@
1
- export { reEmitEvent } from './reEmitEvent.ts';
2
- export { makeAccessorController, AccessorController, reCreateAccessor, makeBinderProxy, getAccessorControllerBoundProperties, } from './useAccessor.ts';
3
- export { createStore, createLegacyStore } from './store.ts';
4
- export type { ObservableMap } from './store.ts';
1
+ export { reEmitEvent } from "./reEmitEvent.js";
2
+ export { makeAccessorController, AccessorController, reCreateAccessor, makeBinderProxy, getAccessorControllerBoundProperties } from "./useAccessor.js";
3
+ export { type AccessorControllerRequires } from "./useAccessor.js";
4
+ export { createStore, createLegacyStore } from "./store.js";
5
+ export { type ObservableMap } from "./store.js";
6
+
@@ -1,8 +1,8 @@
1
1
  import { isEsriInternalEnv } from "@arcgis/toolkit/error";
2
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, b as trackPropKey, t as trackKey } from "../../Controller-Cer_6Z29.js";
5
- import { p as proxyExports } from "../../proxyExports-BkN6hND0.js";
4
+ import { a as createEventFactory, G as GenericController, b as trackPropKey, t as trackKey } from "../../GenericController-C8NSb50b.js";
5
+ import { p as proxyExports } from "../../proxyExports-ZRLty8oJ.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";
@@ -20,6 +20,11 @@ const reEmitEvent = (getEventedAccessor, eventName) => {
20
20
  };
21
21
  const makeAccessorController = (createInstance, _options) => (component) => proxy(component, createInstance);
22
22
  class AccessorController extends GenericController {
23
+ /**
24
+ * @public
25
+ * @param component
26
+ * @param createInstance
27
+ */
23
28
  constructor(component, createInstance) {
24
29
  super(component);
25
30
  this.Y = /* @__PURE__ */ new Map();
@@ -73,6 +78,7 @@ class AccessorController extends GenericController {
73
78
  #isInstanceOwner;
74
79
  #exportsObservable;
75
80
  #createInstance;
81
+ /** @public */
76
82
  get exports() {
77
83
  trackAccess(this.#exportsObservable);
78
84
  return super.exports;
@@ -81,17 +87,29 @@ class AccessorController extends GenericController {
81
87
  super.exports = value;
82
88
  this.#exportsObservable.notify();
83
89
  }
84
- /** @private */
85
90
  Z() {
86
91
  const that = this;
87
92
  that.instance = "prototype" in that.#createInstance && "declaredClass" in that.#createInstance.prototype ? new that.#createInstance() : that.#createInstance();
88
93
  that.#isInstanceOwner = true;
89
94
  }
95
+ /**
96
+ * If you subclass this controller and override this method, make sure to call
97
+ * super.hostConnected();
98
+ * @public
99
+ * @privateRemarks
100
+ * We expose this only so that subclasses remember to call `super`.
101
+ */
90
102
  hostConnected() {
91
103
  this.exports = this.instance;
92
104
  }
93
- // FEATURE: is there a way to detect that accessor does not need to be destroyed?
94
- // Is it possible to write accessors that don't need to be destroyed?
105
+ /**
106
+ * If you subclass this controller and override this method, make sure to call
107
+ * super.hostDestroy();
108
+ * @public
109
+ * @privateRemarks
110
+ * FEATURE: is there a way to detect that accessor does not need to be destroyed?
111
+ * Is it possible to write accessors that don't need to be destroyed?
112
+ */
95
113
  hostDestroy() {
96
114
  if (this.#isInstanceOwner) {
97
115
  this.instance.destroy?.();
@@ -1,11 +1,14 @@
1
- import { EventEmitter } from '../../createEvent.ts';
2
- import { Evented } from '@arcgis/core/core/Evented.js';
1
+ import type { EventEmitter } from "../../createEvent.js";
2
+ import type { Evented } from "@arcgis/core/core/Evented.js";
3
+
3
4
  /**
4
5
  * Re-emit an event from the accessor instance on the component
5
6
  *
7
+ * @param getEventedAccessor
8
+ * @param eventName
6
9
  * @example
7
10
  * ```tsx
8
11
  * arcgisGo = reEmitEvent<HomeViewModelGoEvent>(() => this.viewModel, "go");
9
12
  * ```
10
13
  */
11
- export declare const reEmitEvent: <T>(getEventedAccessor: () => Evented, eventName: string) => EventEmitter<T>;
14
+ export function reEmitEvent<T>(getEventedAccessor: () => Evented, eventName: string): EventEmitter<T>;