@arcgis/lumina 4.33.0-next.94 → 4.33.0-next.95
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-B2comd8J.js +310 -0
- package/dist/LitElement.d.ts +3 -3
- package/dist/context.d.ts +1 -1
- package/dist/controllers/ComponentInternals.d.ts +92 -0
- package/dist/controllers/Controller.d.ts +152 -0
- package/dist/controllers/ControllerInternals.d.ts +52 -0
- package/dist/controllers/ControllerManager.d.ts +63 -0
- package/dist/controllers/accessor/index.d.ts +2 -0
- package/dist/controllers/accessor/index.js +1045 -0
- package/dist/controllers/accessor/reEmitEvent.d.ts +14 -0
- package/dist/controllers/accessor/useAccessor.d.ts +75 -0
- package/dist/controllers/framework.d.ts +45 -0
- package/dist/controllers/functional.d.ts +19 -0
- package/dist/controllers/getSet.d.ts +116 -0
- package/dist/controllers/index.d.ts +23 -0
- package/dist/controllers/index.js +283 -0
- package/dist/controllers/load.d.ts +6 -0
- package/dist/controllers/proxyExports.d.ts +27 -0
- package/dist/controllers/readonly.d.ts +29 -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 +28 -0
- package/dist/controllers/types.d.ts +182 -0
- package/dist/controllers/useDirection.d.ts +11 -0
- package/dist/controllers/useMedia.d.ts +8 -0
- package/dist/controllers/usePropertyChange.d.ts +11 -0
- package/dist/controllers/useT9n.d.ts +48 -0
- package/dist/controllers/useWatch.d.ts +27 -0
- package/dist/controllers/useWatchAttributes.d.ts +7 -0
- package/dist/controllers/utils.d.ts +15 -0
- package/dist/createEvent.d.ts +1 -1
- package/dist/decorators.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -42
- package/dist/lazyLoad.d.ts +2 -2
- package/dist/makeRuntime.d.ts +109 -0
- package/dist/proxyExports-Dl5CHmHQ.js +150 -0
- package/dist/runtime.d.ts +4 -107
- package/dist/useWatch-CFtSpNnN.js +925 -0
- package/package.json +4 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseComponent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Like manager.trackPropertyKey(), but for props that have \@State() or \@Prop()
|
|
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 BaseComponent {
|
|
14
|
+
* // Will console log "myProp"
|
|
15
|
+
* @Prop() myProp = trackMe();
|
|
16
|
+
*
|
|
17
|
+
* // Will console log "myState"
|
|
18
|
+
* @State() myState = trackMe();
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare function trackPropKey<T>(component: BaseComponent, onResolved: (key: string | undefined) => void, defaultValue: T): T;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseComponent, BaseController } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A magical solution to finding out what property name a given controller
|
|
4
|
+
* on a given object was assigned to.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This does not work for properties that have \@Prop() or \@State()
|
|
8
|
+
* decorator - for those, use manager.trackPropKey() instead.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* function trackMe<T>(defaultValue:T, component:BaseComponent):T {
|
|
12
|
+
* component.manager.trackPropertyKey(component, (key)=>console.log(key), defaultValue);
|
|
13
|
+
* return defaultValue;
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* class MyComponent extends BaseComponent {
|
|
17
|
+
* // Will console log "myProp"
|
|
18
|
+
* myProp = trackMe('a', this);
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare function trackPropertyKey<T>(object: BaseComponent | BaseController, onResolved: (key: string | undefined) => void, defaultValue: T): T;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve all pending trackPropertyKey() calls. This must be called after a
|
|
25
|
+
* property you are trying to resolve had it's default value set, thus after
|
|
26
|
+
* constructor. At the start of connectedCallback is a perfect place.
|
|
27
|
+
*/
|
|
28
|
+
export declare function keyTrackResolve(): void;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { IHandle } from '@arcgis/components-utils';
|
|
2
|
+
import { ReactiveControllerHost, ReactiveController, PropertyDeclaration, PropertyValues } from 'lit';
|
|
3
|
+
import { LitElement } from '../LitElement';
|
|
4
|
+
/**
|
|
5
|
+
* Explicitly picking rather than extending everything because the interface
|
|
6
|
+
* has "[memberName: string]: any;", which ruins type-safety of components
|
|
7
|
+
*
|
|
8
|
+
* @deprecated use LitElement instead
|
|
9
|
+
*/
|
|
10
|
+
export type StencilLifecycles = {
|
|
11
|
+
connectedCallback?: () => void;
|
|
12
|
+
disconnectedCallback?: () => void;
|
|
13
|
+
componentWillLoad?: () => Promise<void> | void;
|
|
14
|
+
componentDidLoad?: () => void;
|
|
15
|
+
componentShouldUpdate?: (newVal: any, oldVal: any, propName: string) => boolean | void;
|
|
16
|
+
componentWillUpdate?: () => Promise<void> | void;
|
|
17
|
+
componentDidUpdate?: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use LitElement instead
|
|
21
|
+
*/
|
|
22
|
+
export type BaseComponent = Omit<LitElement, "componentOnReady"> & {
|
|
23
|
+
autoDestroyDisabled?: boolean;
|
|
24
|
+
destroy?: () => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Helper utility to get component type from a controller. Can be used in
|
|
28
|
+
* "implements"
|
|
29
|
+
* @example
|
|
30
|
+
* const useHomeViewModel = makeViewModelController(newWidgetsHomeHomeViewModel);
|
|
31
|
+
* export class Home implements Use<typeof useHomeViewModel> {
|
|
32
|
+
* // No need for "implements BaseComponent" as that's already included in
|
|
33
|
+
* // every controller
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* TypeScript detects errors even without Use<typeof useHomeViewModel>, but Use
|
|
37
|
+
* makes errors display in a more readable format
|
|
38
|
+
*/
|
|
39
|
+
export type Use<Callback extends (component: any) => unknown> = Parameters<Callback>[0];
|
|
40
|
+
/**
|
|
41
|
+
* Base API for a controller. Compatible with both Lit's Reactive controllers
|
|
42
|
+
* and Stencil's lifecycle
|
|
43
|
+
*/
|
|
44
|
+
export type ControllerLifecycleMethods = {
|
|
45
|
+
readonly hostConnected?: ReactiveController["hostConnected"];
|
|
46
|
+
readonly hostDisconnected?: ReactiveController["hostDisconnected"];
|
|
47
|
+
readonly hostLoad?: StencilLifecycles["componentWillLoad"];
|
|
48
|
+
readonly hostLoaded?: StencilLifecycles["componentDidLoad"];
|
|
49
|
+
/**
|
|
50
|
+
* Called during the client-side host update, just before the host calls
|
|
51
|
+
* its own update.
|
|
52
|
+
*
|
|
53
|
+
* Code in `update()` can depend on the DOM as it is not called in
|
|
54
|
+
* server-side rendering.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* The `changes` parameter will only be present in Lumina, not in Stencil
|
|
58
|
+
*/
|
|
59
|
+
readonly hostUpdate?: (changes: PropertyValues) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Called after a host update, just before the host calls firstUpdated and
|
|
62
|
+
* updated. It is not called in server-side rendering.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* The `changes` parameter will only be present in Lumina, not in Stencil
|
|
66
|
+
*/
|
|
67
|
+
readonly hostUpdated?: (changes: PropertyValues) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Called when the component is finally being destroyed (rather than
|
|
70
|
+
* temporary disconnected from the DOM)
|
|
71
|
+
*/
|
|
72
|
+
readonly hostDestroy?: () => void;
|
|
73
|
+
/**
|
|
74
|
+
* lifecycle() is a convenience higher-level callback that:
|
|
75
|
+
* - calls the provided callback right away the first time if
|
|
76
|
+
* connectedCallback has already happened once
|
|
77
|
+
* - otherwise, calls it on connectedCallback
|
|
78
|
+
* - calls the callback on each future connectedCallback
|
|
79
|
+
* - if you returned a function, or an object like {remove:()=>void}, that
|
|
80
|
+
* function will be called on the next disconnectedCallback
|
|
81
|
+
*
|
|
82
|
+
* This is a bit like useEffect(callback, []) in React
|
|
83
|
+
*/
|
|
84
|
+
readonly hostLifecycle?: () => (() => void)[] | IHandle | IHandle[] | (() => void) | undefined | void;
|
|
85
|
+
/**
|
|
86
|
+
* Called after component.removeComponent(controller) was called on this
|
|
87
|
+
* controller
|
|
88
|
+
*/
|
|
89
|
+
readonly controllerRemoved?: () => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Controller host interface, compatible with both Lit's Reactive controllers
|
|
93
|
+
* and Stencil's lifecycle.
|
|
94
|
+
* These members are added to the component instance by ControllerManager.
|
|
95
|
+
*/
|
|
96
|
+
export type ControllerHost = {
|
|
97
|
+
/**
|
|
98
|
+
* Adds a controller to the host, which connects the controller's lifecycle
|
|
99
|
+
* methods to the host's lifecycle.
|
|
100
|
+
*/
|
|
101
|
+
addController(controller: BaseController): void;
|
|
102
|
+
addController(controller: ReactiveController): void;
|
|
103
|
+
/**
|
|
104
|
+
* Removes a controller from the host.
|
|
105
|
+
*/
|
|
106
|
+
removeController(controller: BaseController): void;
|
|
107
|
+
removeController(controller: ReactiveController): void;
|
|
108
|
+
/**
|
|
109
|
+
* Requests a host update which is processed asynchronously. The update can
|
|
110
|
+
* be waited on via the `updateComplete` property.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* In Stencil:
|
|
114
|
+
* This method will re-render your component. All passed parameters are ignored
|
|
115
|
+
*
|
|
116
|
+
* In Lit:
|
|
117
|
+
* It is recommended to provide the property name describing what property
|
|
118
|
+
* triggered the update - property name will be provided to the willUpdate()
|
|
119
|
+
* lifecycle hook, giving it the ability to react to the change.
|
|
120
|
+
*
|
|
121
|
+
* @see https://lit.dev/docs/api/ReactiveElement/#ReactiveElement.requestUpdate
|
|
122
|
+
*/
|
|
123
|
+
requestUpdate: (name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) => void;
|
|
124
|
+
readonly updateComplete: ReactiveControllerHost["updateComplete"];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A symbol is used to mark providers/controllers on a component instance.
|
|
128
|
+
* This helps to distinguish them from regular properties.
|
|
129
|
+
*/
|
|
130
|
+
export declare const controllerSymbol: unique symbol;
|
|
131
|
+
/**
|
|
132
|
+
* Adding an optional symbol to satisfy TypeScript
|
|
133
|
+
* "type Controller has no properties in common with BaseController"
|
|
134
|
+
*/
|
|
135
|
+
export type BaseController = ControllerLifecycleMethods & {
|
|
136
|
+
readonly [controllerSymbol]?: true;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* A reference to Lit's map of changed properties that triggered the update
|
|
140
|
+
*/
|
|
141
|
+
export type LitElementWithChangedPropertiesMap = {
|
|
142
|
+
$changes: PropertyValues;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* An event emitter object
|
|
146
|
+
*/
|
|
147
|
+
export type EventEmitter<T = undefined> = {
|
|
148
|
+
emit(payload: T extends undefined ? void : T): CustomEvent<T>;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Property declaration with additional `reaDonly` option (handled by Controllers)
|
|
152
|
+
*/
|
|
153
|
+
export type LuminaPropertyDeclaration = PropertyDeclaration & {
|
|
154
|
+
/**
|
|
155
|
+
* Declare a property that can't be modified by the developer.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* \@property({ readOnly: true })
|
|
160
|
+
* myReadonlyProp = 'initialValue';
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* Inside the component code, you can overwrite the readOnly property like so:
|
|
165
|
+
* ```ts
|
|
166
|
+
* bypassReadOnly(() => {
|
|
167
|
+
* this.myReadonlyProp = 'newValue';
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* Alternatively, you can declare a readOnly prop like so:
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* \@property()
|
|
176
|
+
* get myReadonlyProp(): string {
|
|
177
|
+
* return 'someValue';
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
readonly readOnly?: boolean;
|
|
182
|
+
};
|
|
@@ -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,11 @@
|
|
|
1
|
+
import { BaseComponent, EventEmitter } from './types';
|
|
2
|
+
type PropertyChangeController<Component extends BaseComponent> = <ToWatch extends keyof Component>(...toWatch: ToWatch[]) => EventEmitter<{
|
|
3
|
+
name: ToWatch & string;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Let user easily set watchers for component properties.
|
|
7
|
+
*
|
|
8
|
+
* Documentation: https://qawebgis.esri.com/components/lumina/controllers/usePropertyChange
|
|
9
|
+
*/
|
|
10
|
+
export declare const usePropertyChange: <Component extends BaseComponent>(_component?: BaseComponent) => PropertyChangeController<Component>;
|
|
11
|
+
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
|
+
* @Prop() 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,27 @@
|
|
|
1
|
+
import { BaseComponent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Dynamically set a watcher for any reactive property
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* this.manager.onLifecycle(()=>
|
|
8
|
+
* watch(this, "myProp", (newValue,oldValue)=>console.log(newValue,oldValue))
|
|
9
|
+
* )
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* If you are in Lit, you should prefer the willUpdate() lifecycle method
|
|
14
|
+
* over watch(). willUpdate() is going to be more memory-efficient, and more
|
|
15
|
+
* flexible (can watch multiple props at once or provide dynamic prop name)
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* willUpdate(changes: PropertyValues<this>) {
|
|
19
|
+
* if (changes.has('firstName') || changes.has('lastName')) {
|
|
20
|
+
* this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @deprecated see https://qawebgis.esri.com/components/lumina/lifecycle#willupdate and https://qawebgis.esri.com/components/lumina/controllers/lifecycle
|
|
26
|
+
*/
|
|
27
|
+
export declare function watch<Component extends BaseComponent, Property extends keyof Component>(component: Component, property: Property, callback: (newValue: Component[Property], oldValue: Component[Property], property: Property) => void): () => void;
|
|
@@ -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,15 @@
|
|
|
1
|
+
import { Controller } from './Controller';
|
|
2
|
+
import { ControllerLifecycleMethods } from './types';
|
|
3
|
+
export declare const isController: (value: unknown) => value is ControllerLifecycleMethods;
|
|
4
|
+
/**
|
|
5
|
+
* In development, on hot module reload, controller would be re-initialized
|
|
6
|
+
* with all Props and State values persistent, but properties lost. This unsafe
|
|
7
|
+
* development-only API lets you set or get data for a controller that would
|
|
8
|
+
* persist across hot reloads.
|
|
9
|
+
*/
|
|
10
|
+
export declare const devOnlySetPersistentControllerData: ((controller: Controller<unknown>, data: unknown) => void) | undefined;
|
|
11
|
+
export declare const devOnlyGetPersistentControllerData: (<T>(controller: Controller<unknown>) => T | undefined) | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the argument is a promise by checking if it has a `then` method.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isPromise<T>(arg: Promise<T> | T): arg is Promise<T>;
|
package/dist/createEvent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseComponent, EventEmitter } from '
|
|
1
|
+
import { BaseComponent, EventEmitter } from './controllers/types';
|
|
2
2
|
/**
|
|
3
3
|
* While these defaults don't match DOM defaults (all false), they match
|
|
4
4
|
* Stencil and Shoelace defaults. Also, they make more sense for our
|
package/dist/decorators.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LuminaPropertyDeclaration } from '
|
|
1
|
+
import { LuminaPropertyDeclaration } from './controllers/types';
|
|
2
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
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export type { DefineCustomElements, LazyLoadOptions, GlobalThisWithPuppeteerEnv
|
|
|
6
6
|
export { makeDefineCustomElements } from './lazyLoad';
|
|
7
7
|
export { LitElement } from './LitElement';
|
|
8
8
|
export type { PublicLitElement } from './PublicLitElement';
|
|
9
|
-
export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from './
|
|
10
|
-
export { makeRuntime } from './
|
|
9
|
+
export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from './makeRuntime';
|
|
10
|
+
export { makeRuntime } from './makeRuntime';
|
|
11
11
|
export type { EventHandler } from './jsx/baseTypes';
|
|
12
12
|
export * from './jsx/types';
|
|
13
13
|
export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, directive, live } from './jsx/directives';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { retrieveComponent, trackKey, keyTrackResolve, useControllerManager } from "@arcgis/components-controllers";
|
|
2
1
|
import { ContextProvider, ContextConsumer } from "@lit/context";
|
|
3
|
-
import {
|
|
2
|
+
import { r as retrieveComponent } from "./useWatch-CFtSpNnN.js";
|
|
3
|
+
import { c } from "./useWatch-CFtSpNnN.js";
|
|
4
4
|
import { state } from "@lit/reactive-element/decorators/state.js";
|
|
5
5
|
import { property as property$1 } from "@lit/reactive-element/decorators/property.js";
|
|
6
6
|
import { n as noShadowRoot, a as attachToAncestor } from "./utils-GhKD5Lo-.js";
|
|
7
7
|
import { m } from "./utils-GhKD5Lo-.js";
|
|
8
|
+
import { Deferred, isEsriInternalEnv, camelToKebab } from "@arcgis/components-utils";
|
|
8
9
|
import { LitElement as LitElement$1, isServer, noChange as noChange$1 } from "lit";
|
|
9
10
|
import { PropertyFlags } from "./config.js";
|
|
11
|
+
import { u as useControllerManager } from "./ControllerManager-B2comd8J.js";
|
|
10
12
|
import { classMap } from "lit-html/directives/class-map.js";
|
|
11
13
|
import { styleMap } from "lit/directives/style-map.js";
|
|
12
14
|
import { directive as directive$1, Directive } from "lit-html/directive.js";
|
|
@@ -24,44 +26,6 @@ function useContextConsumer(options) {
|
|
|
24
26
|
component.addController(controller);
|
|
25
27
|
return controller;
|
|
26
28
|
}
|
|
27
|
-
const createEventFactory = (eventName = "", options = {}, component = retrieveComponent()) => {
|
|
28
|
-
const emitter = {
|
|
29
|
-
emit: (payload) => {
|
|
30
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && !component.el.isConnected) {
|
|
31
|
-
console.warn(`Trying to emit an ${eventName} event on a disconnected element ${component.el.localName}`);
|
|
32
|
-
}
|
|
33
|
-
if (eventName === "") {
|
|
34
|
-
keyTrackResolve();
|
|
35
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && eventName === "") {
|
|
36
|
-
throw new Error("Unable to resolve event name from property name");
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const event = new CustomEvent(eventName, {
|
|
40
|
-
detail: payload,
|
|
41
|
-
cancelable: true,
|
|
42
|
-
bubbles: true,
|
|
43
|
-
composed: true,
|
|
44
|
-
...options
|
|
45
|
-
});
|
|
46
|
-
component.el.dispatchEvent(event);
|
|
47
|
-
return event;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
if (eventName === "") {
|
|
51
|
-
trackKey(
|
|
52
|
-
void 0,
|
|
53
|
-
(resolution) => {
|
|
54
|
-
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && resolution === void 0) {
|
|
55
|
-
throw new Error(`createEvent must be called in property default value only`);
|
|
56
|
-
}
|
|
57
|
-
eventName = resolution.key;
|
|
58
|
-
},
|
|
59
|
-
emitter
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
return emitter;
|
|
63
|
-
};
|
|
64
|
-
const createEvent = createEventFactory.bind(null, "");
|
|
65
29
|
const property = property$1;
|
|
66
30
|
const method = void 0;
|
|
67
31
|
const emptyFunction = () => void 0;
|
|
@@ -249,7 +213,6 @@ class LitElement extends LitElement$1 {
|
|
|
249
213
|
return this;
|
|
250
214
|
}
|
|
251
215
|
}
|
|
252
|
-
LitElement.$createEvent = createEventFactory;
|
|
253
216
|
if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
|
|
254
217
|
const globalWithLit = globalThis;
|
|
255
218
|
globalWithLit.litIssuedWarnings ??= /* @__PURE__ */ new Set();
|
|
@@ -390,7 +353,7 @@ export {
|
|
|
390
353
|
bindBooleanAttribute,
|
|
391
354
|
bindEvent,
|
|
392
355
|
bindProperty,
|
|
393
|
-
createEvent,
|
|
356
|
+
c as createEvent,
|
|
394
357
|
deferLoad,
|
|
395
358
|
deferredLoaders,
|
|
396
359
|
directive,
|
package/dist/lazyLoad.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Deferred } from '@arcgis/components-utils';
|
|
2
2
|
import { LitElement } from './LitElement';
|
|
3
|
-
import { Runtime } from './
|
|
4
|
-
import { ControllerManager } from '
|
|
3
|
+
import { Runtime } from './makeRuntime';
|
|
4
|
+
import { ControllerManager } from './controllers/ControllerManager';
|
|
5
5
|
/**
|
|
6
6
|
* Defines lazy-loading proxy components for all web components in this package.
|
|
7
7
|
*
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { LitElement } from './LitElement';
|
|
3
|
+
/**
|
|
4
|
+
* `@arcgis/lumina` package may be bundled once but used by multiple packages with
|
|
5
|
+
* different configuration options. For that reason, the configuration options
|
|
6
|
+
* cannot be a global object, but has to be an object that you pass around.
|
|
7
|
+
*/
|
|
8
|
+
export type Runtime = RuntimeOptions & {
|
|
9
|
+
/**
|
|
10
|
+
* Get the base path to where the package assets can be found.
|
|
11
|
+
* By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
|
|
12
|
+
* We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
|
|
13
|
+
* It is CORS-enabled, so you can load the assets from any domain.
|
|
14
|
+
* Use "setAssetPath(path)" if the path needs to be customized.
|
|
15
|
+
*/
|
|
16
|
+
readonly getAssetPath: (suffix: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Used to manually set the base path where package assets (like localization
|
|
19
|
+
* and icons) can be found.
|
|
20
|
+
*
|
|
21
|
+
* By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
|
|
22
|
+
* For example, `https://js.arcgis.com/map-components/4.30/`.
|
|
23
|
+
* We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
|
|
24
|
+
* It is CORS-enabled, so you can load the assets from any domain.
|
|
25
|
+
* This is the recommended way to load the assets and avoid bundling them with your application.
|
|
26
|
+
* It means that by default, you don't need to use "setAssetPath" since the path is already set.
|
|
27
|
+
*
|
|
28
|
+
* However, if you need to host the assets locally, you can use "setAssetPath" to set the base path.
|
|
29
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
30
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
31
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
32
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
33
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
34
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
35
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
36
|
+
*/
|
|
37
|
+
readonly setAssetPath: (path: URL | string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* The customElement decorator. Unlike default Lit's decorator this one
|
|
40
|
+
* provides runtime instance to the LitElement class
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* You do not need to call this decorator in your component.
|
|
44
|
+
* It will be added automatically at build time.
|
|
45
|
+
*
|
|
46
|
+
* Instead, make sure your component file has the following:
|
|
47
|
+
* ```ts
|
|
48
|
+
* declare global {
|
|
49
|
+
* interface DeclareElements {
|
|
50
|
+
* "arcgis-your-component": ArcgisYourComponent;
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
readonly customElement: (tagName: string, component: typeof LitElement) => void;
|
|
56
|
+
};
|
|
57
|
+
export type RuntimeOptions = {
|
|
58
|
+
/**
|
|
59
|
+
* The default asset path to use in NPM and CDN builds.
|
|
60
|
+
*
|
|
61
|
+
* This option will be set by Lumina compiler based on the value of the
|
|
62
|
+
* `assets.defaultPath` option in the `useLumina()` plugin.
|
|
63
|
+
*/
|
|
64
|
+
readonly defaultAssetPath: string;
|
|
65
|
+
/**
|
|
66
|
+
* The attribute that indicates a component has rendered it's content.
|
|
67
|
+
* Usually this attribute is added after your component's `loaded()` lifecycle
|
|
68
|
+
* happened. However, during SSR, "hydrated" is added right away on the
|
|
69
|
+
* server.
|
|
70
|
+
*
|
|
71
|
+
* Until element has this attribute, it will have `visibility:hidden` style
|
|
72
|
+
* applied.
|
|
73
|
+
*
|
|
74
|
+
* This option will be set by the Lumina compiler based on the value of
|
|
75
|
+
* the `css.hydratedAttribute` option in the `useLumina()` plugin.
|
|
76
|
+
*/
|
|
77
|
+
readonly hydratedAttribute: string;
|
|
78
|
+
/**
|
|
79
|
+
* Styles that you wish to make available in each component's shadow root, but
|
|
80
|
+
* to not apply outside the shadow root
|
|
81
|
+
*
|
|
82
|
+
* This option will be set by Lumina compiler based on the value of the
|
|
83
|
+
* `css.commonStylesPath` option in the `useLumina()` plugin.
|
|
84
|
+
*/
|
|
85
|
+
readonly commonStyles?: CSSResult;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* The options object will be provided by Lumina compiler at build-time.
|
|
89
|
+
* It should not be specified in the source code.
|
|
90
|
+
*/
|
|
91
|
+
export declare function makeRuntime(options?: RuntimeOptions): Runtime;
|
|
92
|
+
/**
|
|
93
|
+
* Exposing the reference to the runtime globally when in tests or development.
|
|
94
|
+
* This is primarily for usage by dynamically created components in tests
|
|
95
|
+
*
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
export type DevOnlyGlobalRuntime = typeof globalThis & {
|
|
99
|
+
devOnly$luminaRuntime?: Runtime;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Called from the component constructor when in development or test mode.
|
|
103
|
+
* Used primarily by mount to get a reference to the rendered component.
|
|
104
|
+
*
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
export type DevOnlyGlobalComponentRefCallback = typeof globalThis & {
|
|
108
|
+
devOnly$luminaComponentRefCallback?: (component: LitElement) => void;
|
|
109
|
+
};
|