@arcgis/lumina 4.33.0-next.10 → 4.33.0-next.100
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-CZ8Djohh.js +627 -0
- package/dist/LitElement.d.ts +36 -29
- package/dist/config.js +13 -6
- package/dist/context.d.ts +13 -3
- package/dist/controllers/Controller.d.ts +153 -0
- package/dist/controllers/ControllerInternals.d.ts +59 -0
- package/dist/controllers/ControllerManager.d.ts +83 -0
- package/dist/controllers/accessor/index.d.ts +2 -0
- package/dist/controllers/accessor/index.js +259 -0
- package/dist/controllers/accessor/reEmitEvent.d.ts +10 -0
- package/dist/controllers/accessor/useAccessor.d.ts +74 -0
- package/dist/controllers/functional.d.ts +19 -0
- package/dist/controllers/index.d.ts +24 -0
- package/dist/controllers/index.js +263 -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 +152 -0
- package/dist/controllers/useDirection.d.ts +11 -0
- package/dist/controllers/useMedia.d.ts +8 -0
- package/dist/controllers/usePropertyChange.d.ts +12 -0
- package/dist/controllers/useT9n.d.ts +48 -0
- package/dist/controllers/useWatchAttributes.d.ts +7 -0
- package/dist/controllers/utils.d.ts +15 -0
- package/dist/createEvent.d.ts +7 -2
- 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 +1 -7
- package/dist/index.d.ts +17 -16
- package/dist/index.js +386 -150
- package/dist/jsx/baseTypes.d.ts +13 -9
- package/dist/jsx/directives.d.ts +25 -7
- package/dist/jsx/generatedTypes.d.ts +6 -10
- package/dist/jsx/types.d.ts +5 -32
- package/dist/lazyLoad.d.ts +18 -18
- package/dist/lifecycleSupport.d.ts +1 -1
- package/dist/makeRuntime.d.ts +109 -0
- package/dist/proxyExports-CK5BLFLO.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/{chunk-NO7HOBNA.js → utils-DBdf1Dqp.js} +45 -61
- package/package.json +4 -3
- 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,7 +34,7 @@ type ComponentLifecycle = {
|
|
|
33
34
|
* only.
|
|
34
35
|
*/
|
|
35
36
|
export declare class LitElement extends OriginalLitElement implements ComponentLifecycle {
|
|
36
|
-
/** @
|
|
37
|
+
/** @private */
|
|
37
38
|
static runtime: Runtime;
|
|
38
39
|
static tagName: string;
|
|
39
40
|
/**
|
|
@@ -54,7 +55,7 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
54
55
|
* loading logic calls document.createElement(), it temporary sets this static
|
|
55
56
|
* property.
|
|
56
57
|
*
|
|
57
|
-
* @
|
|
58
|
+
* @private
|
|
58
59
|
* */
|
|
59
60
|
static lazy: ProxyComponent | undefined;
|
|
60
61
|
static readonly lumina = true;
|
|
@@ -78,43 +79,35 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
78
79
|
* const isLazy = this.el !== this;
|
|
79
80
|
* ```
|
|
80
81
|
*/
|
|
81
|
-
el: ToElement<this>;
|
|
82
|
+
readonly el: ToElement<this>;
|
|
82
83
|
/**
|
|
83
|
-
* Controller
|
|
84
|
-
*
|
|
84
|
+
* Controller does not need to be an instance of the Controller class. Any
|
|
85
|
+
* Lit's Reactive controller will work as well. See examples:
|
|
86
|
+
* https://lit.dev/docs/composition/controllers/
|
|
87
|
+
*
|
|
88
|
+
* @private
|
|
85
89
|
*/
|
|
86
|
-
|
|
90
|
+
readonly _controllers: Set<BaseController | Controller<unknown>>;
|
|
87
91
|
/**
|
|
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.
|
|
92
|
+
* Controller Manager orchestrates all controllers used by this component,
|
|
93
|
+
* connecting their lifecycle hooks and providing context information.
|
|
101
94
|
*/
|
|
102
|
-
|
|
103
|
-
/** @
|
|
95
|
+
readonly manager: ControllerManager;
|
|
96
|
+
/** @private */
|
|
104
97
|
_postLoad: ProxyComponent["_postLoad"];
|
|
105
98
|
/**
|
|
106
99
|
* Direct offspring that should be awaited before loaded() is emitted.
|
|
107
100
|
*
|
|
108
101
|
* `attachToAncestor()` will add elements to this array
|
|
109
102
|
*
|
|
110
|
-
* @
|
|
103
|
+
* @private
|
|
111
104
|
*/
|
|
112
105
|
_offspring: ProxyComponent["_offspring"];
|
|
113
106
|
/**
|
|
114
107
|
* Promise that resolves once parent's load() completed. False if there is no
|
|
115
108
|
* parent
|
|
116
109
|
*
|
|
117
|
-
* @
|
|
110
|
+
* @private
|
|
118
111
|
*/
|
|
119
112
|
_ancestorLoad: ProxyComponent["_ancestorLoad"];
|
|
120
113
|
private _originalShouldUpdate?;
|
|
@@ -229,6 +222,20 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
|
|
|
229
222
|
* });
|
|
230
223
|
*/
|
|
231
224
|
componentOnReady(): Promise<this>;
|
|
225
|
+
/**
|
|
226
|
+
* Adds a controller to the host, which connects the controller's lifecycle
|
|
227
|
+
* methods to the host's lifecycle.
|
|
228
|
+
*
|
|
229
|
+
* @remarks
|
|
230
|
+
* Even though Lit's LitElement already has addController,
|
|
231
|
+
* we overwrite it with a compatible version to have more control over
|
|
232
|
+
* timing, and to add support for load/loaded lifecycle hooks.
|
|
233
|
+
*/
|
|
234
|
+
addController(controller: BaseController | ReactiveController): void;
|
|
235
|
+
/**
|
|
236
|
+
* Removes a controller from the host.
|
|
237
|
+
*/
|
|
238
|
+
removeController(controller: BaseController | ReactiveController): void;
|
|
232
239
|
}
|
|
233
240
|
type Listener<ThisType, EventType> = ((this: ThisType, event: EventType) => unknown) | {
|
|
234
241
|
handleEvent(event: EventType): unknown;
|
package/dist/config.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const lazyMetaGroupJoiner = ";";
|
|
2
|
+
const lazyMetaItemJoiner = ",";
|
|
3
|
+
const lazyMetaSubItemJoiner = ":";
|
|
4
|
+
var PropertyFlags = /* @__PURE__ */ ((PropertyFlags2) => {
|
|
5
|
+
PropertyFlags2[PropertyFlags2["ATTRIBUTE"] = 1] = "ATTRIBUTE";
|
|
6
|
+
PropertyFlags2[PropertyFlags2["REFLECT"] = 2] = "REFLECT";
|
|
7
|
+
PropertyFlags2[PropertyFlags2["BOOLEAN"] = 4] = "BOOLEAN";
|
|
8
|
+
PropertyFlags2[PropertyFlags2["NUMBER"] = 8] = "NUMBER";
|
|
9
|
+
PropertyFlags2[PropertyFlags2["STATE"] = 16] = "STATE";
|
|
10
|
+
PropertyFlags2[PropertyFlags2["READ_ONLY"] = 32] = "READ_ONLY";
|
|
11
|
+
PropertyFlags2[PropertyFlags2["NO_ACCESSOR"] = 64] = "NO_ACCESSOR";
|
|
12
|
+
return PropertyFlags2;
|
|
13
|
+
})(PropertyFlags || {});
|
|
7
14
|
export {
|
|
8
15
|
PropertyFlags,
|
|
9
16
|
lazyMetaGroupJoiner,
|
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>;
|
|
@@ -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 function useContextConsumer<C extends Context<unknown, unknown>>(options: ContextConsumerOptions<C>): ContextConsumer<C,
|
|
25
|
+
export declare function 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,153 @@
|
|
|
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
|
+
protected _callbacks: {
|
|
16
|
+
readonly [KEY in keyof Omit<ControllerLifecycleMethods, "controllerRemoved">]-?: NonNullable<ControllerLifecycleMethods[KEY]>[];
|
|
17
|
+
};
|
|
18
|
+
protected _ready: Deferred<Exports>;
|
|
19
|
+
private _lifecycleCleanups;
|
|
20
|
+
/** @private */
|
|
21
|
+
assignedProperty?: string | false;
|
|
22
|
+
connectedCalled: boolean;
|
|
23
|
+
protected _loadCalled: boolean;
|
|
24
|
+
loadedCalled: boolean;
|
|
25
|
+
readonly [controllerSymbol] = true;
|
|
26
|
+
component: LitElement;
|
|
27
|
+
ready: Promise<Exports>;
|
|
28
|
+
constructor(component?: LitElement);
|
|
29
|
+
/**
|
|
30
|
+
* If controller is being added dynamically, after the component
|
|
31
|
+
* construction, then trigger connected and load right away
|
|
32
|
+
*/
|
|
33
|
+
catchUpLifecycle(): void;
|
|
34
|
+
private _exports;
|
|
35
|
+
get exports(): Exports;
|
|
36
|
+
/**
|
|
37
|
+
* Set controller's exports property (for usage with proxyExports()) and mark
|
|
38
|
+
* controller as ready (for usage in other controllers). Also, triggers
|
|
39
|
+
* re-render of the component
|
|
40
|
+
*/
|
|
41
|
+
set exports(exports: Exports);
|
|
42
|
+
/**
|
|
43
|
+
* If controller needs to await a promise before it's exports are fully ready
|
|
44
|
+
* but it wishes to make some limited exports available before then,
|
|
45
|
+
* this method can be used.
|
|
46
|
+
*
|
|
47
|
+
* This is useful for permitting a limited usage of the controller in default
|
|
48
|
+
* values of properties or in component constructor.
|
|
49
|
+
*
|
|
50
|
+
* In order to help detect bugs, trying to access a prop on the exports value
|
|
51
|
+
* that does not exist will throw an error (in development only). This is
|
|
52
|
+
* useful to detect usages of controller that forgot to await it's exports.
|
|
53
|
+
* (the "value in this.myController" check won't cause an exception though)
|
|
54
|
+
*
|
|
55
|
+
* @param proxy [true] - whether to throw an error if unknown property is
|
|
56
|
+
* accessed before the controller is loaded.
|
|
57
|
+
*/
|
|
58
|
+
setProvisionalExports(exports: Exports, proxy?: boolean): void;
|
|
59
|
+
setProvisionalExports(exports: Exports extends object ? Partial<Exports> : Exports, proxy?: boolean): void;
|
|
60
|
+
setProvisionalExports<Props extends keyof Exports>(exports: Pick<Exports, Props>, proxy?: boolean): void;
|
|
61
|
+
private _exportWatchers;
|
|
62
|
+
watchExports(callback: (exports: Exports) => void): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* A flexible utility for making sure a controller is loaded before it's used,
|
|
65
|
+
* regardless of how or where a controller was defined:
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* makeGenericController(async (component, controller) => {
|
|
69
|
+
* // Await some controller from the component:
|
|
70
|
+
* await controller.use(component.someController);
|
|
71
|
+
* // Initialize new controllers
|
|
72
|
+
* await controller.use(load(importCoreReactiveUtils));
|
|
73
|
+
* await controller.use(new ViewModelController(component,newWidgetsHomeHomeViewModel));
|
|
74
|
+
* await controller.use(someController(component));
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* If your controller is not async, and you are not creating it async, then
|
|
79
|
+
* you are not required to use controller.use - you can use it directly.
|
|
80
|
+
* Similarly, accessing controllers after componentWillLoad callback does not
|
|
81
|
+
* require awaiting them as they are guaranteed to be loaded by then.
|
|
82
|
+
*/
|
|
83
|
+
get use(): typeof use;
|
|
84
|
+
/**
|
|
85
|
+
* Just like controller.use, but returns the controller itself, rather than it's
|
|
86
|
+
* exports
|
|
87
|
+
*
|
|
88
|
+
* Use cases:
|
|
89
|
+
* - You have a controller and you want to make sure it's loaded before you
|
|
90
|
+
* try to use it
|
|
91
|
+
* - Your controller is not using exports, so you wish to access some props on
|
|
92
|
+
* it directly
|
|
93
|
+
* - You have a controller exports only, and you want to retrieve the
|
|
94
|
+
* controller itself. This is useful if you wish to call .watchExports() or
|
|
95
|
+
* some other method on the controller
|
|
96
|
+
*/
|
|
97
|
+
get useRef(): typeof useRef;
|
|
98
|
+
/**
|
|
99
|
+
* Like useRef, but doesn't wait for the controller to get ready
|
|
100
|
+
*
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
get useRefSync(): typeof useRefSync;
|
|
104
|
+
controllerRemoved(): void;
|
|
105
|
+
onConnected(callback: NonNullable<ControllerLifecycleMethods["hostConnected"]>): void;
|
|
106
|
+
onDisconnected(callback: NonNullable<ControllerLifecycleMethods["hostDisconnected"]>): void;
|
|
107
|
+
onLoad(callback: NonNullable<ControllerLifecycleMethods["hostLoad"]>): void;
|
|
108
|
+
onLoaded(callback: NonNullable<ControllerLifecycleMethods["hostLoaded"]>): void;
|
|
109
|
+
onUpdate(callback: NonNullable<ControllerLifecycleMethods["hostUpdate"]>): void;
|
|
110
|
+
onUpdated(callback: NonNullable<ControllerLifecycleMethods["hostUpdated"]>): void;
|
|
111
|
+
onDestroy(callback: NonNullable<ControllerLifecycleMethods["hostDestroy"]>): void;
|
|
112
|
+
onLifecycle(callback: NonNullable<ControllerLifecycleMethods["hostLifecycle"]>): void;
|
|
113
|
+
/** @private */
|
|
114
|
+
triggerConnected(): void;
|
|
115
|
+
/** @private */
|
|
116
|
+
triggerDisconnected(): void;
|
|
117
|
+
/** @private */
|
|
118
|
+
triggerLoad(): Promise<void>;
|
|
119
|
+
/** @private */
|
|
120
|
+
triggerLoaded(): void;
|
|
121
|
+
/** @private */
|
|
122
|
+
triggerUpdate(changes: PropertyValues): void;
|
|
123
|
+
/** @private */
|
|
124
|
+
triggerUpdated(changes: PropertyValues): void;
|
|
125
|
+
/** @private */
|
|
126
|
+
triggerDestroy(): void;
|
|
127
|
+
/** @private */
|
|
128
|
+
triggerLifecycle(): void;
|
|
129
|
+
private _callLifecycle;
|
|
130
|
+
}
|
|
131
|
+
export declare abstract class GenericControllerType<Exports, Requires = LitElement> extends Controller<Exports> {
|
|
132
|
+
component: LitElement & Requires;
|
|
133
|
+
constructor(component: LitElement & Requires);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* If your controller requires some specific properties to be present on the
|
|
137
|
+
* component, besides what's included in LitElement, use
|
|
138
|
+
* GenericController over the usual Controller. Use the 2nd generic argument
|
|
139
|
+
* on this class for specifying what properties your controller expects on the
|
|
140
|
+
* component
|
|
141
|
+
*
|
|
142
|
+
* When using a controller created using GenericController, consumer must
|
|
143
|
+
* pass in "this" explicitly to the constructor. If controller was
|
|
144
|
+
* created using Controller, that is not necessary
|
|
145
|
+
*
|
|
146
|
+
* @remarks
|
|
147
|
+
* GenericController class is identical to Controller class in all but typing.
|
|
148
|
+
* That is why, at runtime GenericController is actually equal to Controller
|
|
149
|
+
* class.
|
|
150
|
+
* You can use GenericControllerType type if you wish to reference generic
|
|
151
|
+
* controller instance type.
|
|
152
|
+
*/
|
|
153
|
+
export declare const GenericController: typeof GenericControllerType;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
|
+
import { BaseController } from './types';
|
|
3
|
+
import { LitElement } from '../LitElement';
|
|
4
|
+
export declare function setAmbientComponent(component: LitElement): void;
|
|
5
|
+
export declare function retrieveComponent(name?: string): LitElement;
|
|
6
|
+
export declare function 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 function retrieveParentControllers(): readonly BaseController[];
|
|
13
|
+
export declare function 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
|
+
/** @deprecated */
|
|
22
|
+
export declare let shouldBypassGetter: boolean;
|
|
23
|
+
export declare let shouldBypassReadOnly: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Permits updating read-only properties
|
|
26
|
+
*
|
|
27
|
+
* @see https://qawebgis.esri.com/components/lumina/properties#read-only-properties
|
|
28
|
+
*/
|
|
29
|
+
export declare function bypassReadOnly<T = void>(callback: () => T): T | void;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated see https://qawebgis.esri.com/components/lumina/properties#get-set-properties
|
|
32
|
+
*/
|
|
33
|
+
export declare const bypassSetter: typeof bypassReadOnly;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated see https://qawebgis.esri.com/components/lumina/properties#get-set-properties
|
|
36
|
+
*/
|
|
37
|
+
export declare function bypassGetter<T = void>(callback: () => T): T | void;
|
|
38
|
+
/**
|
|
39
|
+
* If passed value is a controller, then return it. Otherwise, assume it's a
|
|
40
|
+
* proxyExports() result and wrap it into a controller
|
|
41
|
+
*
|
|
42
|
+
* This won't type correctly if a proxyExports() controller is exporting a
|
|
43
|
+
* non-proxyExports() controller
|
|
44
|
+
*/
|
|
45
|
+
type InferController<ControllerOrExports> = ControllerOrExports extends BaseController ? ControllerOrExports & {
|
|
46
|
+
exports?: unknown;
|
|
47
|
+
ready?: Promise<void>;
|
|
48
|
+
watchExports?: Controller["watchExports"];
|
|
49
|
+
} : Controller<ControllerOrExports>;
|
|
50
|
+
/**
|
|
51
|
+
* If controller never sets it's exports, then it's default exports is "this".
|
|
52
|
+
* This allows usage of controller.use with controllers that don't have exports
|
|
53
|
+
*/
|
|
54
|
+
type NotNever<T extends {
|
|
55
|
+
exports?: any;
|
|
56
|
+
}> = T extends {
|
|
57
|
+
exports: never;
|
|
58
|
+
} ? T : T["exports"];
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
hasDestroy: boolean;
|
|
11
|
+
destroyed: boolean;
|
|
12
|
+
private _autoDestroyTimeout?;
|
|
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
|
+
_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 _enforceReadonly;
|
|
29
|
+
/** @private */
|
|
30
|
+
_trackedValue: unknown;
|
|
31
|
+
/** @private */
|
|
32
|
+
_keyTrackers: ((key: string | undefined, value: unknown) => void)[];
|
|
33
|
+
/** @private */
|
|
34
|
+
_firePropTrackers(key: string | undefined, value: unknown): void;
|
|
35
|
+
/** @private */
|
|
36
|
+
readonly _accessorGetter: Record<string, (value: unknown, propertyName: string) => unknown>;
|
|
37
|
+
/** @private */
|
|
38
|
+
readonly _accessorSetter: Record<string, (newValue: unknown, oldValue: unknown, propertyName: string) => unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Map with keys for any properties that have changed since the last
|
|
41
|
+
* update cycle with previous values.
|
|
42
|
+
*
|
|
43
|
+
* Do not access this directly as this value is only set during the update
|
|
44
|
+
* lifecycle. Instead, use the `changes` property that is provided
|
|
45
|
+
* to the shouldUpdate(), willUpdate() and updated() lifecycle hooks.
|
|
46
|
+
*
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
_changes?: PropertyValues;
|
|
50
|
+
/**
|
|
51
|
+
* Configure a getter or setter for a given \@property/\@state
|
|
52
|
+
*
|
|
53
|
+
* Since props are defined on the prototype, they are shared between all
|
|
54
|
+
* instances of a component. Thus, instead of passing a reference to the
|
|
55
|
+
* getter/setter function, you should update the
|
|
56
|
+
* ComponentInternals.getters/setters properties, and then call getSetProxy
|
|
57
|
+
* to apply the changes to the prototype
|
|
58
|
+
*
|
|
59
|
+
* @deprecated
|
|
60
|
+
*/
|
|
61
|
+
private _getSetProxy;
|
|
62
|
+
private _exportsStore;
|
|
63
|
+
/**
|
|
64
|
+
* Associate an exports object with a controller for reverse lookup in
|
|
65
|
+
* controller.use
|
|
66
|
+
*
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
_markExports(controller: BaseController, exports: unknown): void;
|
|
70
|
+
/** @private */
|
|
71
|
+
_resolveExports(exports: unknown): BaseController | undefined;
|
|
72
|
+
}
|
|
73
|
+
export declare let autoDestroyOnDisconnectTimeout: number;
|
|
74
|
+
export declare const autoDestroyDisabledPropName = "autoDestroyDisabled";
|
|
75
|
+
export declare const exportsForTests: {
|
|
76
|
+
setAutoDestroyOnDisconnectTimeout: (timeout: number) => void;
|
|
77
|
+
} | undefined;
|
|
78
|
+
export type LuminaLifecycles = {
|
|
79
|
+
connectedCallback?: LitElement["connectedCallback"];
|
|
80
|
+
disconnectedCallback?: LitElement["disconnectedCallback"];
|
|
81
|
+
load?: () => Promise<void> | void;
|
|
82
|
+
loaded?: () => void;
|
|
83
|
+
};
|