@arcgis/lumina 4.33.0-next.15 → 4.33.0-next.151
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-BQOv8BAL.js +587 -0
- package/dist/LitElement.d.ts +56 -45
- package/dist/config.d.ts +7 -9
- package/dist/config.js +18 -8
- package/dist/context.d.ts +14 -4
- package/dist/controllers/Controller.d.ts +147 -0
- package/dist/controllers/ControllerInternals.d.ts +53 -0
- package/dist/controllers/ControllerManager.d.ts +68 -0
- package/dist/controllers/accessor/index.d.ts +4 -0
- package/dist/controllers/accessor/index.js +245 -0
- package/dist/controllers/accessor/reEmitEvent.d.ts +10 -0
- package/dist/controllers/accessor/store.d.ts +17 -0
- package/dist/controllers/accessor/useAccessor.d.ts +71 -0
- package/dist/controllers/functional.d.ts +19 -0
- package/dist/controllers/index.d.ts +24 -0
- package/dist/controllers/index.js +270 -0
- package/dist/controllers/load.d.ts +6 -0
- package/dist/controllers/proxyExports.d.ts +27 -0
- package/dist/controllers/tests/autoDestroyMock.d.ts +5 -0
- package/dist/controllers/tests/utils.d.ts +1 -0
- package/dist/controllers/toFunction.d.ts +8 -0
- package/dist/controllers/trackKey.d.ts +8 -0
- package/dist/controllers/trackPropKey.d.ts +21 -0
- package/dist/controllers/trackPropertyKey.d.ts +29 -0
- package/dist/controllers/types.d.ts +187 -0
- package/dist/controllers/useDirection.d.ts +11 -0
- package/dist/controllers/useMedia.d.ts +8 -0
- package/dist/controllers/usePropertyChange.d.ts +14 -0
- package/dist/controllers/useT9n.d.ts +48 -0
- package/dist/controllers/useWatchAttributes.d.ts +7 -0
- package/dist/controllers/utils.d.ts +12 -0
- package/dist/createEvent.d.ts +8 -3
- package/dist/decorators.d.ts +2 -2
- package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +1 -1
- package/dist/hmrSupport.d.ts +1 -1
- package/dist/hmrSupport.js +22 -28
- package/dist/index.d.ts +17 -16
- package/dist/index.js +423 -194
- package/dist/jsx/baseTypes.d.ts +13 -9
- package/dist/jsx/directives.d.ts +25 -7
- package/dist/jsx/generatedTypes.d.ts +420 -90
- package/dist/jsx/types.d.ts +5 -32
- package/dist/lazyLoad-DUvrNd2L.js +406 -0
- package/dist/lazyLoad.d.ts +27 -72
- package/dist/lifecycleSupport.d.ts +2 -2
- package/dist/makeRuntime.d.ts +148 -0
- package/dist/proxyExports-Cdzj7WL_.js +60 -0
- package/dist/render.d.ts +5 -0
- package/dist/runtime.d.ts +4 -107
- package/dist/stencilSsrCompatibility/index.d.ts +2 -6
- package/dist/stencilSsrCompatibility/index.js +2 -3
- package/dist/typings/importMeta.d.ts +2 -2
- package/dist/utils.d.ts +8 -0
- package/dist/wrappersUtils.d.ts +13 -1
- package/package.json +7 -6
- package/dist/chunk-NO7HOBNA.js +0 -421
- package/dist/chunk-PGHUBTOM.js +0 -21
- package/dist/wrappersUtils.test.d.ts +0 -1
package/dist/LitElement.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { CSSResultGroup, CSSResultOrNative, PropertyValues, ReactiveController, LitElement as OriginalLitElement } from 'lit';
|
|
2
|
+
import { Runtime } from './makeRuntime';
|
|
3
|
+
import { ProxyComponent } from './lazyLoad';
|
|
4
|
+
import { ToElement } from './jsx/types';
|
|
5
|
+
import { BaseController, LuminaPropertyDeclaration } from './controllers/types';
|
|
6
|
+
import { ControllerManager } from './controllers/ControllerManager';
|
|
7
|
+
import { Controller } from './controllers/Controller';
|
|
7
8
|
type ComponentLifecycle = {
|
|
8
9
|
connectedCallback?: () => void;
|
|
9
10
|
disconnectedCallback?: () => void;
|
|
@@ -33,9 +34,19 @@ type ComponentLifecycle = {
|
|
|
33
34
|
* only.
|
|
34
35
|
*/
|
|
35
36
|
export declare class LitElement extends OriginalLitElement implements ComponentLifecycle {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
#private;
|
|
38
|
+
/**
|
|
39
|
+
* @private
|
|
40
|
+
* @remarks
|
|
41
|
+
* We prefix private variables with double underscore to avoid collisions with
|
|
42
|
+
* subclasses. All runtime properties that start with underscore are mangled
|
|
43
|
+
* in production build, so collision avoidance is mainly important to avoid
|
|
44
|
+
* triggering TypeScript errors.
|
|
45
|
+
*/
|
|
46
|
+
static __runtime: Runtime;
|
|
47
|
+
/** @private */
|
|
48
|
+
static __tagName: string;
|
|
49
|
+
static elementProperties: Map<PropertyKey, LuminaPropertyDeclaration>;
|
|
39
50
|
/**
|
|
40
51
|
* Customize Lit's default style handling to support non-shadow-root styles
|
|
41
52
|
*/
|
|
@@ -49,14 +60,15 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
49
60
|
* only to satisfy the type checker.
|
|
50
61
|
*/
|
|
51
62
|
options?: LuminaPropertyDeclaration | number | [number, LuminaPropertyDeclaration]): void;
|
|
63
|
+
protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: LuminaPropertyDeclaration): PropertyDescriptor | undefined;
|
|
52
64
|
/**
|
|
53
65
|
* Since we can't pass arguments to web component constructor, before lazy
|
|
54
66
|
* loading logic calls document.createElement(), it temporary sets this static
|
|
55
67
|
* property.
|
|
56
68
|
*
|
|
57
|
-
* @
|
|
69
|
+
* @private
|
|
58
70
|
* */
|
|
59
|
-
static
|
|
71
|
+
static __lazy: ProxyComponent | undefined;
|
|
60
72
|
static readonly lumina = true;
|
|
61
73
|
/**
|
|
62
74
|
* In lazy build, the actual DOM element differs from the class instance:
|
|
@@ -78,50 +90,36 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
78
90
|
* const isLazy = this.el !== this;
|
|
79
91
|
* ```
|
|
80
92
|
*/
|
|
81
|
-
el: ToElement<this>;
|
|
93
|
+
readonly el: ToElement<this>;
|
|
82
94
|
/**
|
|
83
|
-
* Controller
|
|
84
|
-
*
|
|
95
|
+
* Controller does not need to be an instance of the Controller class. Any
|
|
96
|
+
* Lit's Reactive controller will work as well. See examples:
|
|
97
|
+
* https://lit.dev/docs/composition/controllers/
|
|
98
|
+
*
|
|
99
|
+
* @private
|
|
100
|
+
* @privateRemarks
|
|
101
|
+
* For most private names I tried to prefix with __ to not conflict with
|
|
102
|
+
* private names on subclasses. However, Lit already has __controllers private.
|
|
85
103
|
*/
|
|
86
|
-
|
|
104
|
+
readonly _controllers: (BaseController | Controller<unknown>)[];
|
|
87
105
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* Do not access this directly as this value is only set during the update
|
|
92
|
-
* lifecycle. Instead, use the `changes` property that is provided
|
|
93
|
-
* to the shouldUpdate(), willUpdate() and didUpdate() lifecycle hooks.
|
|
94
|
-
*
|
|
95
|
-
* @internal
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* The name does not start with `_` because in the future we may configure the
|
|
99
|
-
* minifier to mangle such properties - but this property is accessed from
|
|
100
|
-
* outside this package, so should not be mangled.
|
|
106
|
+
* Controller Manager orchestrates all controllers used by this component,
|
|
107
|
+
* connecting their lifecycle hooks and providing context information.
|
|
101
108
|
*/
|
|
102
|
-
|
|
103
|
-
/** @
|
|
104
|
-
|
|
109
|
+
readonly manager: ControllerManager;
|
|
110
|
+
/** @private */
|
|
111
|
+
__postLoadDeferred: ProxyComponent["__postLoadDeferred"];
|
|
105
112
|
/**
|
|
106
113
|
* Direct offspring that should be awaited before loaded() is emitted.
|
|
107
114
|
*
|
|
108
115
|
* `attachToAncestor()` will add elements to this array
|
|
109
116
|
*
|
|
110
|
-
* @
|
|
117
|
+
* @private
|
|
111
118
|
*/
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Promise that resolves once parent's load() completed. False if there is no
|
|
115
|
-
* parent
|
|
116
|
-
*
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
_ancestorLoad: ProxyComponent["_ancestorLoad"];
|
|
120
|
-
private _originalShouldUpdate?;
|
|
121
|
-
private _enableUpdating;
|
|
122
|
-
private _postLoaded;
|
|
119
|
+
__offspringComponents: ProxyComponent["__offspringComponents"];
|
|
123
120
|
constructor();
|
|
124
121
|
connectedCallback(): void;
|
|
122
|
+
disconnectedCallback(): void;
|
|
125
123
|
/**
|
|
126
124
|
* Overwrite Lit's default behavior of attaching shadow root to the lit
|
|
127
125
|
* element, and instead use this.el to support lazy builds.
|
|
@@ -129,13 +127,12 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
129
127
|
* Also, support the case when component asked to not use shadow root
|
|
130
128
|
*/
|
|
131
129
|
protected createRenderRoot(): DocumentFragment | HTMLElement;
|
|
132
|
-
/** Do asynchronous component load */
|
|
133
|
-
private _load;
|
|
134
130
|
/**
|
|
135
131
|
* Overwriting default shouldUpdate simply to get access to
|
|
136
132
|
* "changedProperties" so that we can later provide it to ControllerManager
|
|
137
133
|
*/
|
|
138
134
|
protected shouldUpdate(_changedProperties: PropertyValues): boolean;
|
|
135
|
+
protected update(changedProperties: PropertyValues): void;
|
|
139
136
|
/**
|
|
140
137
|
* A helper for setting event listener on the current component.
|
|
141
138
|
*
|
|
@@ -229,6 +226,20 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
229
226
|
* });
|
|
230
227
|
*/
|
|
231
228
|
componentOnReady(): Promise<this>;
|
|
229
|
+
/**
|
|
230
|
+
* Adds a controller to the host, which connects the controller's lifecycle
|
|
231
|
+
* methods to the host's lifecycle.
|
|
232
|
+
*
|
|
233
|
+
* @remarks
|
|
234
|
+
* Even though Lit's LitElement already has addController,
|
|
235
|
+
* we overwrite it with a compatible version to have more control over
|
|
236
|
+
* timing, and to add support for load/loaded lifecycle hooks.
|
|
237
|
+
*/
|
|
238
|
+
addController(controller: BaseController | ReactiveController): void;
|
|
239
|
+
/**
|
|
240
|
+
* Removes a controller from the host.
|
|
241
|
+
*/
|
|
242
|
+
removeController(controller: BaseController | ReactiveController): void;
|
|
232
243
|
}
|
|
233
244
|
type Listener<ThisType, EventType> = ((this: ThisType, event: EventType) => unknown) | {
|
|
234
245
|
handleEvent(event: EventType): unknown;
|
package/dist/config.d.ts
CHANGED
|
@@ -12,12 +12,10 @@ export declare const lazyMetaSubItemJoiner = ":";
|
|
|
12
12
|
* object, we pass it a compact number, that gets converted back to an object
|
|
13
13
|
* in createProperty() at runtime.
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
NO_ACCESSOR = 64
|
|
23
|
-
}
|
|
15
|
+
export declare const propertyFlagAttribute: number;
|
|
16
|
+
export declare const propertyFlagReflect: number;
|
|
17
|
+
export declare const propertyFlagBoolean: number;
|
|
18
|
+
export declare const propertyFlagNumber: number;
|
|
19
|
+
export declare const propertyFlagState: number;
|
|
20
|
+
export declare const propertyFlagReadOnly: number;
|
|
21
|
+
export declare const propertyFlagNoAccessor: number;
|
package/dist/config.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const lazyMetaGroupJoiner = ";";
|
|
2
|
+
const lazyMetaItemJoiner = ",";
|
|
3
|
+
const lazyMetaSubItemJoiner = ":";
|
|
4
|
+
const propertyFlagAttribute = 1 << 0;
|
|
5
|
+
const propertyFlagReflect = 1 << 1;
|
|
6
|
+
const propertyFlagBoolean = 1 << 2;
|
|
7
|
+
const propertyFlagNumber = 1 << 3;
|
|
8
|
+
const propertyFlagState = 1 << 4;
|
|
9
|
+
const propertyFlagReadOnly = 1 << 5;
|
|
10
|
+
const propertyFlagNoAccessor = 1 << 6;
|
|
7
11
|
export {
|
|
8
|
-
PropertyFlags,
|
|
9
12
|
lazyMetaGroupJoiner,
|
|
10
13
|
lazyMetaItemJoiner,
|
|
11
|
-
lazyMetaSubItemJoiner
|
|
14
|
+
lazyMetaSubItemJoiner,
|
|
15
|
+
propertyFlagAttribute,
|
|
16
|
+
propertyFlagBoolean,
|
|
17
|
+
propertyFlagNoAccessor,
|
|
18
|
+
propertyFlagNumber,
|
|
19
|
+
propertyFlagReadOnly,
|
|
20
|
+
propertyFlagReflect,
|
|
21
|
+
propertyFlagState
|
|
12
22
|
};
|
package/dist/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ContextConsumer, ContextProvider, Context, ContextType } from '@lit/context';
|
|
2
|
+
import { ReactiveControllerHost } from 'lit';
|
|
3
3
|
interface ContextProviderOptions<C extends Context<unknown, unknown>> {
|
|
4
4
|
context: C;
|
|
5
5
|
initialValue?: ContextType<C>;
|
|
@@ -14,7 +14,7 @@ interface ContextConsumerOptions<C extends Context<unknown, unknown>> {
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://lit.dev/docs/data/context/
|
|
16
16
|
*/
|
|
17
|
-
export declare
|
|
17
|
+
export declare const useContextProvider: <C extends Context<unknown, unknown>>(options: ContextProviderOptions<C>) => ContextProvider<C>;
|
|
18
18
|
/**
|
|
19
19
|
* Wrapper for Lit's ContextConsumer controller to provide lazy-loading compatibility.
|
|
20
20
|
*
|
|
@@ -22,5 +22,15 @@ export declare function useContextProvider<C extends Context<unknown, unknown>>(
|
|
|
22
22
|
*
|
|
23
23
|
* FEATURE: wrap this in proxyExports to improve DX, or keep it simple?
|
|
24
24
|
*/
|
|
25
|
-
export declare
|
|
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
|
+
*/
|
|
35
|
+
type LitContextHost = HTMLElement & ReactiveControllerHost;
|
|
26
36
|
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Deferred } from '@arcgis/components-utils';
|
|
2
|
+
import { BaseController, ControllerLifecycleMethods, controllerSymbol } from './types';
|
|
3
|
+
import { use, useRef, useRefSync } from './ControllerInternals';
|
|
4
|
+
import { PropertyValues } from 'lit';
|
|
5
|
+
import { LitElement } from '../LitElement';
|
|
6
|
+
/**
|
|
7
|
+
* Base class for Controllers defined using a class rather than a function.
|
|
8
|
+
* Defining controller using makeController() function is more succinct for smaller
|
|
9
|
+
* controllers. For controllers that need to declare several methods, or need
|
|
10
|
+
* more flexibility, this class may be used
|
|
11
|
+
*
|
|
12
|
+
* See ./examples.tsx for many example controllers and their usages.
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class Controller<Exports = never> implements BaseController {
|
|
15
|
+
#private;
|
|
16
|
+
/** @private */
|
|
17
|
+
protected __ready: Deferred<Exports>;
|
|
18
|
+
/** @private */
|
|
19
|
+
__assignedProperty?: string | false;
|
|
20
|
+
connectedCalled: boolean;
|
|
21
|
+
loadedCalled: boolean;
|
|
22
|
+
readonly [controllerSymbol] = true;
|
|
23
|
+
component: LitElement;
|
|
24
|
+
ready: Promise<Exports>;
|
|
25
|
+
constructor(component?: LitElement);
|
|
26
|
+
/**
|
|
27
|
+
* If controller is being added dynamically, after the component
|
|
28
|
+
* construction, then trigger connected and load right away
|
|
29
|
+
*/
|
|
30
|
+
catchUpLifecycle(): void;
|
|
31
|
+
get exports(): Exports;
|
|
32
|
+
/**
|
|
33
|
+
* Set controller's exports property (for usage with proxyExports()) and mark
|
|
34
|
+
* controller as ready (for usage in other controllers). Also, triggers
|
|
35
|
+
* re-render of the component
|
|
36
|
+
*/
|
|
37
|
+
set exports(exports: Exports);
|
|
38
|
+
/**
|
|
39
|
+
* If controller needs to await a promise before it's exports are fully ready
|
|
40
|
+
* but it wishes to make some limited exports available before then,
|
|
41
|
+
* this method can be used.
|
|
42
|
+
*
|
|
43
|
+
* This is useful for permitting a limited usage of the controller in default
|
|
44
|
+
* values of properties or in component constructor.
|
|
45
|
+
*
|
|
46
|
+
* In order to help detect bugs, trying to access a prop on the exports value
|
|
47
|
+
* that does not exist will throw an error (in development only). This is
|
|
48
|
+
* useful to detect usages of controller that forgot to await it's exports.
|
|
49
|
+
* (the "value in this.myController" check won't cause an exception though)
|
|
50
|
+
*
|
|
51
|
+
* @param proxy [true] - whether to throw an error if unknown property is
|
|
52
|
+
* accessed before the controller is loaded.
|
|
53
|
+
*/
|
|
54
|
+
setProvisionalExports(exports: Exports, proxy?: boolean): void;
|
|
55
|
+
setProvisionalExports(exports: Exports extends object ? Partial<Exports> : Exports, proxy?: boolean): void;
|
|
56
|
+
setProvisionalExports<Props extends keyof Exports>(exports: Pick<Exports, Props>, proxy?: boolean): void;
|
|
57
|
+
watchExports(callback: (exports: Exports) => void): () => void;
|
|
58
|
+
/**
|
|
59
|
+
* A flexible utility for making sure a controller is loaded before it's used,
|
|
60
|
+
* regardless of how or where a controller was defined:
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* makeGenericController(async (component, controller) => {
|
|
64
|
+
* // Await some controller from the component:
|
|
65
|
+
* await controller.use(component.someController);
|
|
66
|
+
* // Initialize new controllers
|
|
67
|
+
* await controller.use(load(importCoreReactiveUtils));
|
|
68
|
+
* await controller.use(new ViewModelController(component,newWidgetsHomeHomeViewModel));
|
|
69
|
+
* await controller.use(someController(component));
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* If your controller is not async, and you are not creating it async, then
|
|
74
|
+
* you are not required to use controller.use - you can use it directly.
|
|
75
|
+
* Similarly, accessing controllers after componentWillLoad callback does not
|
|
76
|
+
* require awaiting them as they are guaranteed to be loaded by then.
|
|
77
|
+
*/
|
|
78
|
+
get use(): typeof use;
|
|
79
|
+
/**
|
|
80
|
+
* Just like controller.use, but returns the controller itself, rather than it's
|
|
81
|
+
* exports
|
|
82
|
+
*
|
|
83
|
+
* Use cases:
|
|
84
|
+
* - You have a controller and you want to make sure it's loaded before you
|
|
85
|
+
* try to use it
|
|
86
|
+
* - Your controller is not using exports, so you wish to access some props on
|
|
87
|
+
* it directly
|
|
88
|
+
* - You have a controller exports only, and you want to retrieve the
|
|
89
|
+
* controller itself. This is useful if you wish to call .watchExports() or
|
|
90
|
+
* some other method on the controller
|
|
91
|
+
*/
|
|
92
|
+
get useRef(): typeof useRef;
|
|
93
|
+
/**
|
|
94
|
+
* Like useRef, but doesn't wait for the controller to get ready
|
|
95
|
+
*
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
get useRefSync(): typeof useRefSync;
|
|
99
|
+
controllerRemoved(): void;
|
|
100
|
+
onConnected(callback: NonNullable<ControllerLifecycleMethods["hostConnected"]>): void;
|
|
101
|
+
onDisconnected(callback: NonNullable<ControllerLifecycleMethods["hostDisconnected"]>): void;
|
|
102
|
+
onLoad(callback: NonNullable<ControllerLifecycleMethods["hostLoad"]>): void;
|
|
103
|
+
onLoaded(callback: NonNullable<ControllerLifecycleMethods["hostLoaded"]>): void;
|
|
104
|
+
onUpdate(callback: NonNullable<ControllerLifecycleMethods["hostUpdate"]>): void;
|
|
105
|
+
onUpdated(callback: NonNullable<ControllerLifecycleMethods["hostUpdated"]>): void;
|
|
106
|
+
onDestroy(callback: NonNullable<ControllerLifecycleMethods["hostDestroy"]>): void;
|
|
107
|
+
onLifecycle(callback: NonNullable<ControllerLifecycleMethods["hostLifecycle"]>): void;
|
|
108
|
+
/** @private */
|
|
109
|
+
triggerConnected(): void;
|
|
110
|
+
/** @private */
|
|
111
|
+
triggerDisconnected(): void;
|
|
112
|
+
/** @private */
|
|
113
|
+
triggerLoad(): Promise<void>;
|
|
114
|
+
/** @private */
|
|
115
|
+
triggerLoaded(): void;
|
|
116
|
+
/** @private */
|
|
117
|
+
triggerUpdate(changes: PropertyValues): void;
|
|
118
|
+
/** @private */
|
|
119
|
+
triggerUpdated(changes: PropertyValues): void;
|
|
120
|
+
/** @private */
|
|
121
|
+
triggerDestroy(): void;
|
|
122
|
+
/** @private */
|
|
123
|
+
triggerLifecycle(): void;
|
|
124
|
+
}
|
|
125
|
+
export declare abstract class GenericControllerType<Exports, Requires = LitElement> extends Controller<Exports> {
|
|
126
|
+
component: LitElement & Requires;
|
|
127
|
+
constructor(component: LitElement & Requires);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* If your controller requires some specific properties to be present on the
|
|
131
|
+
* component, besides what's included in LitElement, use
|
|
132
|
+
* GenericController over the usual Controller. Use the 2nd generic argument
|
|
133
|
+
* on this class for specifying what properties your controller expects on the
|
|
134
|
+
* component
|
|
135
|
+
*
|
|
136
|
+
* When using a controller created using GenericController, consumer must
|
|
137
|
+
* pass in "this" explicitly to the constructor. If controller was
|
|
138
|
+
* created using Controller, that is not necessary
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* GenericController class is identical to Controller class in all but typing.
|
|
142
|
+
* That is why, at runtime GenericController is actually equal to Controller
|
|
143
|
+
* class.
|
|
144
|
+
* You can use GenericControllerType type if you wish to reference generic
|
|
145
|
+
* controller instance type.
|
|
146
|
+
*/
|
|
147
|
+
export declare const GenericController: typeof GenericControllerType;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
|
+
import { BaseController } from './types';
|
|
3
|
+
import { LitElement } from '../LitElement';
|
|
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;
|
|
7
|
+
/**
|
|
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.
|
|
11
|
+
*/
|
|
12
|
+
export declare const retrieveParentControllers: () => readonly BaseController[];
|
|
13
|
+
export declare const setAmbientChildController: (controller: BaseController | undefined) => void;
|
|
14
|
+
/**
|
|
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."
|
|
17
|
+
*/
|
|
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;
|
|
22
|
+
/**
|
|
23
|
+
* Permits updating read-only properties
|
|
24
|
+
*
|
|
25
|
+
* @see https://qawebgis.esri.com/components/lumina/properties#read-only-properties
|
|
26
|
+
*/
|
|
27
|
+
export declare const bypassReadOnly: <T = void>(callback: () => T) => T | void;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated see https://qawebgis.esri.com/components/lumina/properties#get-set-properties
|
|
30
|
+
*/
|
|
31
|
+
export declare const bypassSetter: <T = void>(callback: () => T) => T | void;
|
|
32
|
+
/**
|
|
33
|
+
* If passed value is a controller, then return it. Otherwise, assume it's a
|
|
34
|
+
* proxyExports() result and wrap it into a controller
|
|
35
|
+
*
|
|
36
|
+
* This won't type correctly if a proxyExports() controller is exporting a
|
|
37
|
+
* non-proxyExports() controller
|
|
38
|
+
*/
|
|
39
|
+
type InferController<ControllerOrExports> = ControllerOrExports extends BaseController ? ControllerOrExports & {
|
|
40
|
+
exports?: unknown;
|
|
41
|
+
ready?: Promise<void>;
|
|
42
|
+
watchExports?: Controller["watchExports"];
|
|
43
|
+
} : Controller<ControllerOrExports>;
|
|
44
|
+
/**
|
|
45
|
+
* If controller never sets it's exports, then it's default exports is "this".
|
|
46
|
+
* This allows usage of controller.use with controllers that don't have exports
|
|
47
|
+
*/
|
|
48
|
+
type NotNever<T extends {
|
|
49
|
+
exports?: any;
|
|
50
|
+
}> = T extends {
|
|
51
|
+
exports: never;
|
|
52
|
+
} ? T : T["exports"];
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { BaseController } from './types';
|
|
2
|
+
import { GenericController } from './Controller';
|
|
3
|
+
import { PropertyValues } from 'lit';
|
|
4
|
+
import { LitElement } from '../LitElement';
|
|
5
|
+
/**
|
|
6
|
+
* A manager for all other controllers. It finds all controllers on the
|
|
7
|
+
* component, loads them, and forwards lifecycle events to them.
|
|
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;
|
|
57
|
+
}
|
|
58
|
+
export declare let autoDestroyOnDisconnectTimeout: number;
|
|
59
|
+
export declare const autoDestroyDisabledPropName = "autoDestroyDisabled";
|
|
60
|
+
export declare const exportsForTests: {
|
|
61
|
+
setAutoDestroyOnDisconnectTimeout: (timeout: number) => void;
|
|
62
|
+
} | undefined;
|
|
63
|
+
export type LuminaLifecycles = {
|
|
64
|
+
connectedCallback?: LitElement["connectedCallback"];
|
|
65
|
+
disconnectedCallback?: LitElement["disconnectedCallback"];
|
|
66
|
+
load?: () => Promise<void> | void;
|
|
67
|
+
loaded?: () => void;
|
|
68
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { reEmitEvent } from './reEmitEvent';
|
|
2
|
+
export { makeAccessorController, AccessorController, reCreateAccessor, makeBinderProxy, getAccessorControllerBoundProperties, } from './useAccessor';
|
|
3
|
+
export { createStore, createLegacyStore } from './store';
|
|
4
|
+
export type { ObservableMap } from './store';
|