@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
|
+
import { ControllerLifecycleMethods } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* If you wish to directly expose the "exports" property of your controller,
|
|
5
|
+
* rather than the entire controller class, wrap your class definition in
|
|
6
|
+
* "proxyExports".
|
|
7
|
+
*
|
|
8
|
+
* This is especially convenient when your exports is not an object, or it is a
|
|
9
|
+
* dynamically created object, and so you don't want your Controller's methods
|
|
10
|
+
* interfering with the keys on the exported value.
|
|
11
|
+
*
|
|
12
|
+
* "proxyExports" is the default behavior for all controllers declared using
|
|
13
|
+
* the makeController()/makeGenericController() function
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* If using readonly(), and controller updates its exports, the readonly prop
|
|
17
|
+
* will still get updated
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* (Advanced) If you wish to use proxyExports() in a class that does not
|
|
21
|
+
* extend Controller class and does not have a useControllerManager(), then your
|
|
22
|
+
* class must subclass a class with the following constructor:
|
|
23
|
+
* `constructor() { setAmbientController(this); }`. This
|
|
24
|
+
* is necessary for proxyExports() to receive a reference to your object
|
|
25
|
+
* implicitly, and before any of your default values are assigned.
|
|
26
|
+
*/
|
|
27
|
+
export declare const proxyExports: <Exports, const Parameters extends unknown[]>(Class: new (...args: Parameters) => ControllerLifecycleMethods & Pick<Controller<Exports>, "component" | "exports" | "onUpdate" | "watchExports">) => ((...args: Parameters) => Exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function captureConsoleErrors(): unknown[][];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tiny helper for using a class-based controller as if it's a function.
|
|
3
|
+
* Main advantage of this is that it's a bit shorter to type.
|
|
4
|
+
*
|
|
5
|
+
* This utility can be used for converting non-controller classes to functions
|
|
6
|
+
* too
|
|
7
|
+
*/
|
|
8
|
+
export declare const toFunction: <T, const P extends unknown[]>(Class: new (...args: P) => T) => ((...args: P) => T);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LitElement } from '../LitElement';
|
|
2
|
+
import { BaseController, TrackKeyResolution } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A combination of trackPropertyKey() and trackPropKey(). For usage when
|
|
5
|
+
* you want to track a property, but don't know if it will be defined with the
|
|
6
|
+
* \@property() decorator or not
|
|
7
|
+
*/
|
|
8
|
+
export declare const trackKey: <T>(hostsCandidates: ((BaseController | LitElement)[] | BaseController | LitElement) | undefined, onResolved: (resolution: TrackKeyResolution | undefined) => void, defaultValue: T) => T;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from '../LitElement';
|
|
2
|
+
/**
|
|
3
|
+
* Like trackPropertyKey(), but for props that have \@state() or \@property()
|
|
4
|
+
* decorator
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* function trackMe() {
|
|
8
|
+
* const component = retrieveComponent();
|
|
9
|
+
* const defaultValue = 'some value';
|
|
10
|
+
* return trackPropKey(component, (key)=>console.log(key), defaultValue);
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* class MyComponent extends LitElement {
|
|
14
|
+
* // Will console log "myProp"
|
|
15
|
+
* \@property() myProp = trackMe();
|
|
16
|
+
*
|
|
17
|
+
* // Will console log "myState"
|
|
18
|
+
* \@state() myState = trackMe();
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare const trackPropKey: <T>(component: LitElement, onResolved: (key: string | undefined) => void, defaultValue: T) => T;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from '../LitElement';
|
|
2
|
+
import { BaseController } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A magical solution to finding out what property name a given controller
|
|
5
|
+
* on a given object was assigned to.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This does not work for properties that have \@property() or \@state()
|
|
9
|
+
* decorator - for those, use trackPropKey() instead.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* function trackMe<T>(defaultValue: T, component: LitElement):T {
|
|
13
|
+
* trackPropertyKey(component, (key)=>console.log(key), defaultValue);
|
|
14
|
+
* return defaultValue;
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* class MyComponent extends LitElement {
|
|
18
|
+
* // Will console log "myProp"
|
|
19
|
+
* myProp = trackMe('a', this);
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare const trackPropertyKey: <T>(object: BaseController | LitElement, onResolved: (key: string | undefined) => void, defaultValue: T) => T;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve all pending trackPropertyKey() calls. This must be called after a
|
|
26
|
+
* property you are trying to resolve had it's default value set, thus after
|
|
27
|
+
* constructor. At the start of connectedCallback is a perfect place.
|
|
28
|
+
*/
|
|
29
|
+
export declare const keyTrackResolve: () => void;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { IHandle } from '@arcgis/components-utils';
|
|
2
|
+
import { ReactiveControllerHost, ReactiveController, PropertyDeclaration, PropertyValues } from 'lit';
|
|
3
|
+
import { LitElement } from '../LitElement';
|
|
4
|
+
export type TrackKeyResolution = {
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly host: BaseController | LitElement;
|
|
7
|
+
/**
|
|
8
|
+
* True if property is decorated with a `@state()` or `@property()` decorator
|
|
9
|
+
*/
|
|
10
|
+
readonly isReactive: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated use LitElement instead
|
|
14
|
+
*/
|
|
15
|
+
export type BaseComponent = Omit<LitElement, "componentOnReady"> & {
|
|
16
|
+
autoDestroyDisabled?: boolean;
|
|
17
|
+
destroy?: () => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Helper utility to get component type from a controller. Can be used in
|
|
21
|
+
* "implements"
|
|
22
|
+
* @example
|
|
23
|
+
* const useHomeViewModel = makeViewModelController(newWidgetsHomeHomeViewModel);
|
|
24
|
+
* export class Home extends LitElement implements Use<typeof useHomeViewModel> {
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* TypeScript detects errors even without Use<typeof useHomeViewModel>, but Use
|
|
28
|
+
* makes errors display in a more readable format
|
|
29
|
+
*/
|
|
30
|
+
export type Use<Callback extends (component: any) => unknown> = Parameters<Callback>[0];
|
|
31
|
+
/**
|
|
32
|
+
* Base API for a controller. Compatible with Lit's Reactive controllers
|
|
33
|
+
*/
|
|
34
|
+
export type ControllerLifecycleMethods = {
|
|
35
|
+
readonly hostConnected?: ReactiveController["hostConnected"];
|
|
36
|
+
readonly hostDisconnected?: ReactiveController["hostDisconnected"];
|
|
37
|
+
readonly hostLoad?: () => Promise<void> | void;
|
|
38
|
+
readonly hostLoaded?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Called during the client-side host update, just before the host calls
|
|
41
|
+
* its own update.
|
|
42
|
+
*
|
|
43
|
+
* Code in `update()` can depend on the DOM as it is not called in
|
|
44
|
+
* server-side rendering.
|
|
45
|
+
*/
|
|
46
|
+
hostUpdate?(changes: PropertyValues): void;
|
|
47
|
+
/**
|
|
48
|
+
* Called after a host update, just before the host calls firstUpdated and
|
|
49
|
+
* updated. It is not called in server-side rendering.
|
|
50
|
+
*/
|
|
51
|
+
hostUpdated?(changes: PropertyValues): void;
|
|
52
|
+
/**
|
|
53
|
+
* Called when the component is finally being destroyed (rather than
|
|
54
|
+
* temporary disconnected from the DOM)
|
|
55
|
+
*/
|
|
56
|
+
readonly hostDestroy?: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* lifecycle() is a convenience higher-level callback that:
|
|
59
|
+
* - calls the provided callback right away the first time if
|
|
60
|
+
* connectedCallback has already happened once
|
|
61
|
+
* - otherwise, calls it on connectedCallback
|
|
62
|
+
* - calls the callback on each future connectedCallback
|
|
63
|
+
* - if you returned a function, or an object like {remove:()=>void}, that
|
|
64
|
+
* function will be called on the next disconnectedCallback
|
|
65
|
+
*
|
|
66
|
+
* This is a bit like useEffect(callback, []) in React
|
|
67
|
+
*/
|
|
68
|
+
readonly hostLifecycle?: () => (() => void)[] | IHandle | IHandle[] | (() => void) | undefined | void;
|
|
69
|
+
/**
|
|
70
|
+
* Called after component.removeComponent(controller) was called on this
|
|
71
|
+
* controller
|
|
72
|
+
*/
|
|
73
|
+
readonly controllerRemoved?: () => void;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Controller host interface, compatible with both Lit's Reactive controllers
|
|
77
|
+
* and Stencil's lifecycle.
|
|
78
|
+
* These members are added to the component instance by ControllerManager.
|
|
79
|
+
*
|
|
80
|
+
* @deprecated use LitElement instead
|
|
81
|
+
*/
|
|
82
|
+
export type ControllerHost = {
|
|
83
|
+
/**
|
|
84
|
+
* Adds a controller to the host, which connects the controller's lifecycle
|
|
85
|
+
* methods to the host's lifecycle.
|
|
86
|
+
*/
|
|
87
|
+
addController(controller: BaseController): void;
|
|
88
|
+
addController(controller: ReactiveController): void;
|
|
89
|
+
/**
|
|
90
|
+
* Removes a controller from the host.
|
|
91
|
+
*/
|
|
92
|
+
removeController(controller: BaseController): void;
|
|
93
|
+
removeController(controller: ReactiveController): void;
|
|
94
|
+
/**
|
|
95
|
+
* Requests a host update which is processed asynchronously. The update can
|
|
96
|
+
* be waited on via the `updateComplete` property.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* It is recommended to provide the property name describing what property
|
|
100
|
+
* triggered the update - property name will be provided to the willUpdate()
|
|
101
|
+
* lifecycle hook, giving it the ability to react to the change.
|
|
102
|
+
*
|
|
103
|
+
* @see https://lit.dev/docs/api/ReactiveElement/#ReactiveElement.requestUpdate
|
|
104
|
+
*/
|
|
105
|
+
requestUpdate: (name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) => void;
|
|
106
|
+
readonly updateComplete: ReactiveControllerHost["updateComplete"];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* A symbol is used to mark providers/controllers on a component instance.
|
|
110
|
+
* This helps to distinguish them from regular properties.
|
|
111
|
+
*/
|
|
112
|
+
export declare const controllerSymbol: unique symbol;
|
|
113
|
+
/**
|
|
114
|
+
* Adding an optional symbol to satisfy TypeScript
|
|
115
|
+
* "type Controller has no properties in common with BaseController"
|
|
116
|
+
*/
|
|
117
|
+
export type BaseController = ControllerLifecycleMethods & {
|
|
118
|
+
readonly [controllerSymbol]?: true;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Property declaration with additional `reaDonly` option (handled by Controllers)
|
|
122
|
+
*/
|
|
123
|
+
export type LuminaPropertyDeclaration = PropertyDeclaration & {
|
|
124
|
+
/**
|
|
125
|
+
* Declare a property that can't be modified by the developer.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* \@property({ readOnly: true })
|
|
130
|
+
* myReadonlyProp = 'initialValue';
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* Inside the component code, you can overwrite the readOnly property like so:
|
|
135
|
+
* ```ts
|
|
136
|
+
* bypassReadOnly(() => {
|
|
137
|
+
* this.myReadonlyProp = 'newValue';
|
|
138
|
+
* });
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* Alternatively, you can declare a readOnly prop like so:
|
|
143
|
+
*
|
|
144
|
+
* ```ts
|
|
145
|
+
* \@property()
|
|
146
|
+
* get myReadonlyProp(): string {
|
|
147
|
+
* return 'someValue';
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
readonly readOnly?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Short for "changed"
|
|
154
|
+
*
|
|
155
|
+
* Temporary set during a setter to track whether property is considered
|
|
156
|
+
* changed.
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
c?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Short for "descriptor"
|
|
162
|
+
*
|
|
163
|
+
* Stores a reference to the property getter and setter. This is overwritten
|
|
164
|
+
* in useAccessor to proxy the get/set through the Accessor instance.
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
d?: PropertyDescriptor;
|
|
168
|
+
/**
|
|
169
|
+
* The positional index of the Accessor controller to which this property is
|
|
170
|
+
* bound.
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
173
|
+
i?: number;
|
|
174
|
+
};
|
|
175
|
+
/** @private */
|
|
176
|
+
export type AccessorObservableLike = {
|
|
177
|
+
/**
|
|
178
|
+
* A callback that will be called in the setter if the value hasChanged to
|
|
179
|
+
* integrate with Accessor's reactivity notification system.
|
|
180
|
+
*/
|
|
181
|
+
notify: () => void;
|
|
182
|
+
};
|
|
183
|
+
/** @private */
|
|
184
|
+
export type ReactiveTrackingTarget = {
|
|
185
|
+
clear: () => void;
|
|
186
|
+
destroy: () => void;
|
|
187
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Direction = "ltr" | "rtl";
|
|
2
|
+
/**
|
|
3
|
+
* Finds the closest "dir" attribute to current component and returns it's value.
|
|
4
|
+
* Watches for changes to "dir" and will re-render your component if needed.
|
|
5
|
+
*
|
|
6
|
+
* Documentation: https://qawebgis.esri.com/components/lumina/controllers/useDirection
|
|
7
|
+
*
|
|
8
|
+
* Design decisions: https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/987
|
|
9
|
+
*/
|
|
10
|
+
export declare const useDirection: () => Direction;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lets you query whether a given CSS media query applies to the page (i.e.
|
|
3
|
+
* whether user asked to use reduced motion, or whether the screen size is above
|
|
4
|
+
* certain threshold).
|
|
5
|
+
*
|
|
6
|
+
* Documentation: https://qawebgis.esri.com/components/lumina/controllers/useMedia
|
|
7
|
+
*/
|
|
8
|
+
export declare const useMedia: (query: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EventEmitter } from '../createEvent';
|
|
2
|
+
import { LitElement } from '../LitElement';
|
|
3
|
+
type PropertyChangeController<Component extends LitElement> = <ToWatch extends keyof Component>(...toWatch: ToWatch[]) => EventEmitter<{
|
|
4
|
+
name: ToWatch & string;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* Let user easily set watchers for component properties.
|
|
8
|
+
*
|
|
9
|
+
* Documentation: https://qawebgis.esri.com/components/lumina/controllers/usePropertyChange
|
|
10
|
+
*/
|
|
11
|
+
export declare const usePropertyChange: <Component extends LitElement>(
|
|
12
|
+
/** Needed for typings only */
|
|
13
|
+
_component?: LitElement) => PropertyChangeController<Component>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { GenericT9nStrings, LocaleObserver } from '@arcgis/components-utils';
|
|
2
|
+
export type T9nMeta<T9nStrings extends GenericT9nStrings> = {
|
|
3
|
+
_lang: LocaleObserver["lang"];
|
|
4
|
+
_t9nLocale: LocaleObserver["t9nLocale"];
|
|
5
|
+
_loading: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The "_overrides" property won't actually exist at runtime and exists only
|
|
8
|
+
* to simplify typing like so:
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // Type of the messageOverrides is set automatically based on _overrides:
|
|
13
|
+
* @property() messageOverrides?: typeof this.messages._overrides;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
_overrides: DeepPartial<T9nStrings>;
|
|
17
|
+
/**
|
|
18
|
+
* If messageOverrides are in effect, this will contain original strings
|
|
19
|
+
*/
|
|
20
|
+
_original?: T9nStrings;
|
|
21
|
+
};
|
|
22
|
+
type DeepPartial<T> = T extends object ? {
|
|
23
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
24
|
+
} : T;
|
|
25
|
+
type Options = {
|
|
26
|
+
readonly name?: string | null;
|
|
27
|
+
/** @default false */
|
|
28
|
+
readonly blocking?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export interface UseT9n {
|
|
31
|
+
<Strings extends GenericT9nStrings>(options: Options & {
|
|
32
|
+
readonly blocking: true;
|
|
33
|
+
}): Strings & T9nMeta<Strings>;
|
|
34
|
+
<Strings extends GenericT9nStrings>(options?: Options & {
|
|
35
|
+
readonly blocking?: false;
|
|
36
|
+
}): Partial<Strings> & T9nMeta<Strings>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Load component's localization strings.
|
|
40
|
+
*
|
|
41
|
+
* Documentation: https://qawebgis.esri.com/components/lumina/controllers/useT9n
|
|
42
|
+
*
|
|
43
|
+
* Design decisions:
|
|
44
|
+
* - https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/969
|
|
45
|
+
* - https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/987
|
|
46
|
+
*/
|
|
47
|
+
export declare const makeT9nController: (getAssetPath: (path: string) => string) => UseT9n;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
|
+
/**
|
|
3
|
+
* Watch when given attributes change on the component element.
|
|
4
|
+
*
|
|
5
|
+
* Documentation: https://qawebgis.esri.com/components/lumina/controllers/useWatchAttributes
|
|
6
|
+
*/
|
|
7
|
+
export declare const useWatchAttributes: <T extends string>(attributes: readonly T[], callback: (newValue: string | null, oldValue: string | null, attribute: T) => void) => Controller;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement } from '../LitElement';
|
|
2
|
+
import { ControllerLifecycleMethods } from './types';
|
|
3
|
+
export declare const isController: (value: unknown) => value is ControllerLifecycleMethods;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the argument is a promise by checking if it has a `then` method.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isPromise: <T>(arg: Promise<T> | T) => arg is Promise<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Get the number of controllers current component has. Can be used to get a
|
|
10
|
+
* unique id for each controller.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getControllersCount: (component: LitElement) => number;
|
package/dist/createEvent.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An event emitter object
|
|
3
|
+
*/
|
|
4
|
+
export type EventEmitter<T = void> = {
|
|
5
|
+
emit(payload: T): CustomEvent<T>;
|
|
6
|
+
};
|
|
2
7
|
/**
|
|
3
8
|
* While these defaults don't match DOM defaults (all false), they match
|
|
4
9
|
* Stencil and Shoelace defaults. Also, they make more sense for our
|
|
@@ -27,7 +32,7 @@ export type EventOptions = {
|
|
|
27
32
|
*/
|
|
28
33
|
composed?: boolean;
|
|
29
34
|
};
|
|
30
|
-
export declare const createEventFactory: <T =
|
|
35
|
+
export declare const createEventFactory: <T = void>(eventName?: string, options?: EventOptions, component?: import('./LitElement').LitElement) => EventEmitter<T>;
|
|
31
36
|
/**
|
|
32
37
|
* Creates an event emitter.
|
|
33
38
|
* Events emitted by your component will be included in the documentation.
|
|
@@ -42,4 +47,4 @@ export declare const createEventFactory: <T = undefined>(eventName?: string, opt
|
|
|
42
47
|
* ```
|
|
43
48
|
*
|
|
44
49
|
*/
|
|
45
|
-
export declare const createEvent: <T =
|
|
50
|
+
export declare const createEvent: <T = void>(options?: EventOptions) => EventEmitter<T>;
|
package/dist/decorators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { state } from
|
|
1
|
+
import { LuminaPropertyDeclaration } from './controllers/types';
|
|
2
|
+
export { state } from '@lit/reactive-element/decorators/state.js';
|
|
3
3
|
/**
|
|
4
4
|
* A class field or accessor decorator which creates a reactive property that
|
|
5
5
|
* reflects a corresponding attribute value. When a decorated property is set
|
package/dist/hmrSupport.d.ts
CHANGED
package/dist/hmrSupport.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProxyComponent,
|
|
3
|
-
noShadowRoot
|
|
4
|
-
} from "./chunk-NO7HOBNA.js";
|
|
5
|
-
import "./chunk-PGHUBTOM.js";
|
|
6
|
-
|
|
7
|
-
// src/hmrSupport.ts
|
|
1
|
+
import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-DUvrNd2L.js";
|
|
8
2
|
import { camelToKebab } from "@arcgis/components-utils";
|
|
9
3
|
function handleHmrUpdate(newModules) {
|
|
10
4
|
newModules.forEach((newModule) => {
|
|
@@ -12,26 +6,26 @@ function handleHmrUpdate(newModules) {
|
|
|
12
6
|
return;
|
|
13
7
|
}
|
|
14
8
|
Object.values(newModule).forEach((exported) => {
|
|
15
|
-
if (typeof exported !== "function" || typeof exported.
|
|
9
|
+
if (typeof exported !== "function" || typeof exported.L !== "string") {
|
|
16
10
|
return;
|
|
17
11
|
}
|
|
18
12
|
const LitConstructor = exported;
|
|
19
|
-
const ProxyClass = customElements.get(LitConstructor.
|
|
13
|
+
const ProxyClass = customElements.get(LitConstructor.L);
|
|
20
14
|
if (ProxyClass === void 0) {
|
|
21
|
-
throw new Error(`Failed to find custom element proxy for tag name: ${LitConstructor.
|
|
15
|
+
throw new Error(`Failed to find custom element proxy for tag name: ${LitConstructor.L}`);
|
|
22
16
|
}
|
|
23
|
-
ProxyClass.
|
|
24
|
-
ProxyClass.
|
|
25
|
-
ProxyClass.
|
|
26
|
-
ProxyClass.
|
|
27
|
-
ProxyClass.
|
|
28
|
-
ProxyClass.
|
|
17
|
+
ProxyClass.A = void 0;
|
|
18
|
+
ProxyClass.B = void 0;
|
|
19
|
+
ProxyClass.devOnly$hmrIndex ??= 0;
|
|
20
|
+
ProxyClass.devOnly$hmrIndex += 1;
|
|
21
|
+
ProxyClass.F();
|
|
22
|
+
ProxyClass.devOnly$hmrInstances?.forEach((instanceWeakRef) => {
|
|
29
23
|
const instance = instanceWeakRef.deref();
|
|
30
24
|
if (instance === void 0) {
|
|
31
25
|
return;
|
|
32
26
|
}
|
|
33
|
-
if (instance
|
|
34
|
-
void ProxyClass.
|
|
27
|
+
if (instance.$component === void 0) {
|
|
28
|
+
void ProxyClass.B.then(() => reInitialize(instance, newModule));
|
|
35
29
|
} else {
|
|
36
30
|
reInitialize(instance, newModule);
|
|
37
31
|
}
|
|
@@ -41,7 +35,7 @@ function handleHmrUpdate(newModules) {
|
|
|
41
35
|
});
|
|
42
36
|
}
|
|
43
37
|
function reInitialize(instance, newModule) {
|
|
44
|
-
const PreviousLitConstructor = instance.
|
|
38
|
+
const PreviousLitConstructor = instance.$component.constructor;
|
|
45
39
|
const isShadowRoot = PreviousLitConstructor.shadowRootOptions !== noShadowRoot;
|
|
46
40
|
if (!isShadowRoot) {
|
|
47
41
|
const root = instance.getRootNode() ?? document;
|
|
@@ -59,20 +53,20 @@ function reInitialize(instance, newModule) {
|
|
|
59
53
|
}
|
|
60
54
|
const properties = PreviousLitConstructor.elementProperties;
|
|
61
55
|
const preservedProperties = Array.from(properties.entries()).filter(
|
|
62
|
-
([propertyName, descriptor]) => typeof propertyName === "string" && (instance.
|
|
56
|
+
([propertyName, descriptor]) => typeof propertyName === "string" && (instance.devOnly$hmrSetProps.has(propertyName) || typeof descriptor.attribute === "string" && instance.devOnly$hmrSetAttributes.has(descriptor.attribute))
|
|
63
57
|
).map(([key]) => [key, instance[key]]);
|
|
64
|
-
instance.
|
|
58
|
+
instance.devOnly$hmrResetStore(Object.fromEntries(preservedProperties));
|
|
65
59
|
if (instance.isConnected) {
|
|
66
|
-
instance.
|
|
60
|
+
instance.$component.disconnectedCallback();
|
|
67
61
|
}
|
|
68
|
-
const renderRoot = instance
|
|
62
|
+
const renderRoot = instance.$component?.renderRoot;
|
|
69
63
|
if (renderRoot) {
|
|
70
|
-
renderRoot
|
|
64
|
+
renderRoot["_$litPart$"] = void 0;
|
|
71
65
|
while (renderRoot.firstChild) {
|
|
72
66
|
renderRoot.removeChild(renderRoot.firstChild);
|
|
73
67
|
}
|
|
74
68
|
}
|
|
75
|
-
instance.
|
|
69
|
+
instance.devOnly$InitializeComponent(newModule);
|
|
76
70
|
}
|
|
77
71
|
function handleComponentMetaUpdate(meta) {
|
|
78
72
|
const ProxyClass = customElements.get(meta.tagName);
|
|
@@ -91,9 +85,9 @@ function handleComponentMetaUpdate(meta) {
|
|
|
91
85
|
*/
|
|
92
86
|
attributes.filter((attribute) => !originallyObserved.has(attribute))
|
|
93
87
|
);
|
|
94
|
-
ProxyClass.
|
|
95
|
-
ProxyClass.
|
|
96
|
-
ProxyClass.
|
|
88
|
+
ProxyClass.E = meta.asyncMethods;
|
|
89
|
+
ProxyClass.D = meta.syncMethods;
|
|
90
|
+
ProxyClass.C = meta.properties.map(([name]) => name);
|
|
97
91
|
ProxyClass.observedAttributes = attributes;
|
|
98
92
|
}
|
|
99
93
|
function initializeAttributeObserver() {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export { useContextProvider, useContextConsumer } from
|
|
2
|
-
export type { EventOptions } from
|
|
3
|
-
export { createEvent } from
|
|
4
|
-
export { state, property, method } from
|
|
5
|
-
export type { DefineCustomElements, LazyLoadOptions, GlobalThisWithPuppeteerEnv } from
|
|
6
|
-
export { makeDefineCustomElements } from
|
|
7
|
-
export { LitElement } from
|
|
8
|
-
export type { PublicLitElement } from
|
|
9
|
-
export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from
|
|
10
|
-
export { makeRuntime } from
|
|
11
|
-
export type { EventHandler } from
|
|
12
|
-
export * from
|
|
13
|
-
export { safeClassMap, safeStyleMap, directive, live } from
|
|
14
|
-
export { nothing, noChange, setAttribute, stringOrBoolean } from
|
|
15
|
-
export { noShadowRoot } from
|
|
16
|
-
export { makeReactWrapperFactory, getReactWrapperOptions } from
|
|
1
|
+
export { useContextProvider, useContextConsumer } from './context';
|
|
2
|
+
export type { EventEmitter, EventOptions } from './createEvent';
|
|
3
|
+
export { createEvent } from './createEvent';
|
|
4
|
+
export { state, property, method } from './decorators';
|
|
5
|
+
export type { DefineCustomElements, LazyLoadOptions, GlobalThisWithPuppeteerEnv } from './lazyLoad';
|
|
6
|
+
export { makeDefineCustomElements } from './lazyLoad';
|
|
7
|
+
export { LitElement } from './LitElement';
|
|
8
|
+
export type { PublicLitElement } from './PublicLitElement';
|
|
9
|
+
export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from './makeRuntime';
|
|
10
|
+
export { makeRuntime } from './makeRuntime';
|
|
11
|
+
export type { EventHandler } from './jsx/baseTypes';
|
|
12
|
+
export * from './jsx/types';
|
|
13
|
+
export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, directive, live } from './jsx/directives';
|
|
14
|
+
export { nothing, noChange, setAttribute, stringOrBoolean } from './jsx/utils';
|
|
15
|
+
export { noShadowRoot, devOnly$getLitElementTagNameAndRuntime } from './utils';
|
|
16
|
+
export { makeReactWrapperFactory, getReactWrapperOptions } from './wrappersUtils';
|
|
17
|
+
export { renderElement } from './render';
|