@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.
- package/dist/{ControllerManager-DpJfvft9.js → ControllerManager-4cSEnB5Y.js} +12 -8
- package/dist/{Controller-Cer_6Z29.js → GenericController-C8NSb50b.js} +59 -23
- package/dist/LitElement.d.ts +179 -250
- package/dist/PublicLitElement.d.ts +64 -30
- package/dist/config.d.ts +22 -16
- package/dist/context.d.ts +24 -24
- package/dist/controllers/Controller.d.ts +106 -139
- package/dist/controllers/ControllerInternals.d.ts +33 -25
- package/dist/controllers/ControllerManager.d.ts +40 -61
- package/dist/controllers/GenericController.d.ts +26 -0
- package/dist/controllers/accessor/index.d.ts +6 -4
- package/dist/controllers/accessor/index.js +23 -5
- package/dist/controllers/accessor/reEmitEvent.d.ts +6 -3
- package/dist/controllers/accessor/store.d.ts +21 -14
- package/dist/controllers/accessor/useAccessor.d.ts +86 -68
- package/dist/controllers/functional.d.ts +11 -4
- package/dist/controllers/index.d.ts +35 -36
- package/dist/controllers/index.js +5 -7
- package/dist/controllers/load.d.ts +3 -2
- package/dist/controllers/proxyExports.d.ts +6 -5
- package/dist/controllers/toFunction.d.ts +4 -2
- package/dist/controllers/trackKey.d.ts +9 -4
- package/dist/controllers/trackPropKey.d.ts +8 -2
- package/dist/controllers/trackPropertyKey.d.ts +11 -6
- package/dist/controllers/types.d.ts +99 -170
- package/dist/controllers/useDirection.d.ts +5 -6
- package/dist/controllers/useMedia.d.ts +3 -2
- package/dist/controllers/usePropertyChange.d.ts +9 -10
- package/dist/controllers/useSlottableRequest.d.ts +15 -10
- package/dist/controllers/useT9n.d.ts +44 -38
- package/dist/controllers/useWatchAttributes.d.ts +6 -3
- package/dist/controllers/utils.d.ts +13 -5
- package/dist/createEvent.d.ts +32 -32
- package/dist/decorators.d.ts +16 -9
- package/dist/formAssociatedUtils.d.ts +5 -47
- package/dist/globalTypes/importMeta.d.ts +18 -10
- package/dist/globalTypes/index.d.ts +6 -4
- package/dist/globalTypes/jsxGlobals.d.ts +36 -23
- package/dist/globalTypes/loadLitCss.d.ts +61 -40
- package/dist/globalTypes/viteEnv.d.ts +60 -26
- package/dist/hmrSupport.d.ts +24 -28
- package/dist/index.d.ts +17 -16
- package/dist/index.js +27 -7
- package/dist/jsx/baseTypes.d.ts +26 -26
- package/dist/jsx/directives.d.ts +30 -42
- package/dist/jsx/generatedTypes.d.ts +3002 -2923
- package/dist/jsx/types.d.ts +214 -171
- package/dist/jsx/utils.d.ts +19 -14
- package/dist/lazyLoad.d.ts +31 -110
- package/dist/makeRuntime.d.ts +104 -127
- package/dist/{proxyExports-BkN6hND0.js → proxyExports-ZRLty8oJ.js} +1 -1
- package/dist/render.d.ts +4 -2
- package/dist/utils.d.ts +9 -14
- package/dist/wrappersUtils.d.ts +25 -26
- package/package.json +7 -4
- package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +0 -14
- package/dist/lifecycleSupport.d.ts +0 -8
- 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
|
|
2
|
-
import { ReactiveControllerHost } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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
|
-
|
|
36
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
2
|
-
import { BaseController } from
|
|
3
|
-
import { LitElement } from
|
|
4
|
-
|
|
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
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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
|
|
13
|
-
|
|
21
|
+
export function setAmbientComponent(component: LitElement): void;
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
|
19
|
-
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
2
|
-
export { makeAccessorController, AccessorController, reCreateAccessor, makeBinderProxy, getAccessorControllerBoundProperties
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
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 "../../
|
|
5
|
-
import { p as proxyExports } from "../../proxyExports-
|
|
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
|
-
|
|
94
|
-
|
|
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
|
|
2
|
-
import { Evented } from
|
|
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
|
|
14
|
+
export function reEmitEvent<T>(getEventedAccessor: () => Evented, eventName: string): EventEmitter<T>;
|