@arcgis/lumina 5.2.0-next.2 → 5.2.0-next.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/{ControllerManager-DpJfvft9.js → ControllerManager-4cSEnB5Y.js} +12 -8
  2. package/dist/{Controller-Cer_6Z29.js → GenericController-C8NSb50b.js} +59 -23
  3. package/dist/LitElement.d.ts +179 -250
  4. package/dist/PublicLitElement.d.ts +64 -30
  5. package/dist/config.d.ts +22 -16
  6. package/dist/context.d.ts +24 -24
  7. package/dist/controllers/Controller.d.ts +106 -139
  8. package/dist/controllers/ControllerInternals.d.ts +33 -25
  9. package/dist/controllers/ControllerManager.d.ts +40 -61
  10. package/dist/controllers/GenericController.d.ts +26 -0
  11. package/dist/controllers/accessor/index.d.ts +6 -4
  12. package/dist/controllers/accessor/index.js +23 -5
  13. package/dist/controllers/accessor/reEmitEvent.d.ts +6 -3
  14. package/dist/controllers/accessor/store.d.ts +21 -14
  15. package/dist/controllers/accessor/useAccessor.d.ts +86 -68
  16. package/dist/controllers/functional.d.ts +11 -4
  17. package/dist/controllers/index.d.ts +35 -36
  18. package/dist/controllers/index.js +5 -7
  19. package/dist/controllers/load.d.ts +3 -2
  20. package/dist/controllers/proxyExports.d.ts +6 -5
  21. package/dist/controllers/toFunction.d.ts +4 -2
  22. package/dist/controllers/trackKey.d.ts +9 -4
  23. package/dist/controllers/trackPropKey.d.ts +8 -2
  24. package/dist/controllers/trackPropertyKey.d.ts +11 -6
  25. package/dist/controllers/types.d.ts +99 -170
  26. package/dist/controllers/useDirection.d.ts +5 -6
  27. package/dist/controllers/useMedia.d.ts +3 -2
  28. package/dist/controllers/usePropertyChange.d.ts +9 -10
  29. package/dist/controllers/useSlottableRequest.d.ts +15 -10
  30. package/dist/controllers/useT9n.d.ts +44 -38
  31. package/dist/controllers/useWatchAttributes.d.ts +6 -3
  32. package/dist/controllers/utils.d.ts +13 -5
  33. package/dist/createEvent.d.ts +32 -32
  34. package/dist/decorators.d.ts +16 -9
  35. package/dist/formAssociatedUtils.d.ts +5 -47
  36. package/dist/globalTypes/importMeta.d.ts +18 -10
  37. package/dist/globalTypes/index.d.ts +6 -4
  38. package/dist/globalTypes/jsxGlobals.d.ts +36 -23
  39. package/dist/globalTypes/loadLitCss.d.ts +61 -40
  40. package/dist/globalTypes/viteEnv.d.ts +60 -26
  41. package/dist/hmrSupport.d.ts +24 -28
  42. package/dist/index.d.ts +17 -16
  43. package/dist/index.js +27 -7
  44. package/dist/jsx/baseTypes.d.ts +26 -26
  45. package/dist/jsx/directives.d.ts +30 -42
  46. package/dist/jsx/generatedTypes.d.ts +3002 -2923
  47. package/dist/jsx/types.d.ts +214 -171
  48. package/dist/jsx/utils.d.ts +19 -14
  49. package/dist/lazyLoad.d.ts +31 -110
  50. package/dist/makeRuntime.d.ts +104 -127
  51. package/dist/{proxyExports-BkN6hND0.js → proxyExports-ZRLty8oJ.js} +1 -1
  52. package/dist/render.d.ts +4 -2
  53. package/dist/utils.d.ts +9 -14
  54. package/dist/wrappersUtils.d.ts +25 -26
  55. package/package.json +7 -4
  56. package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +0 -14
  57. package/dist/lifecycleSupport.d.ts +0 -8
  58. package/dist/tests/wrappersUtils.typeTest.d.ts +0 -1
@@ -1,17 +1,24 @@
1
- import { default as Accessor } from '@arcgis/core/core/Accessor.js';
1
+ import type Accessor from "@arcgis/core/core/Accessor.js";
2
+
2
3
  /**
3
- * See https://webgis.esri.com/references/lumina/controllers/useAccessor#createstore-utility
4
+ * @param initializer
5
+ * @see https://webgis.esri.com/references/lumina/controllers/useAccessor#createstore-utility
4
6
  */
5
- export declare const createStore: <T extends object>(initializer: T | (() => T)) => Accessor & T;
6
- /** @deprecated Use {@link createStore} instead */
7
- export declare const createLegacyStore: <T extends object>(defaultState: T | (() => T)) => ObservableMap<T>;
8
- /** @deprecated Use {@link createStore} instead */
7
+ export function createStore<T extends object>(initializer: T | (() => T)): Accessor & T;
8
+
9
+ /**
10
+ * @deprecated Use [createStore()](https://developers.arcgis.com/javascript/latest/references/lumina/controllers/accessor/store/#createStore) instead
11
+ * @param defaultState
12
+ */
13
+ export function createLegacyStore<T extends object>(defaultState: T | (() => T)): ObservableMap<T>;
14
+
15
+ /** @deprecated Use [createStore()](https://developers.arcgis.com/javascript/latest/references/lumina/controllers/accessor/store/#createStore) instead */
9
16
  export type ObservableMap<T> = {
10
- state: Accessor & T;
11
- /** @deprecated Use state[propertyName] instead */
12
- get: <P extends keyof T>(propName: P & string) => T[P];
13
- /** @deprecated Use state[propertyName]=value instead */
14
- set: <P extends keyof T>(propName: P & string, value: T[P]) => void;
15
- /** @deprecated Use reactiveUtils.watch instead */
16
- onChange: <Key extends keyof T>(propName: Key, callback: (newValue: T[Key]) => void) => () => void;
17
- };
17
+ state: Accessor & T;
18
+ /** @deprecated Use state[propertyName] instead */
19
+ get: <P extends keyof T>(propName: P & string) => T[P];
20
+ /** @deprecated Use state[propertyName]=value instead */
21
+ set: <P extends keyof T>(propName: P & string, value: T[P]) => void;
22
+ /** @deprecated Use reactiveUtils.watch instead */
23
+ onChange: <Key extends keyof T>(propName: Key, callback: (newValue: T[Key]) => void) => () => void;
24
+ };
@@ -1,77 +1,95 @@
1
- import { GenericController } from '../Controller.ts';
2
- import { LitElement } from '../../LitElement.ts';
3
- import { default as coreAccessor } from '@arcgis/core/core/Accessor.js';
4
- type Requires<Props, Accessor extends coreAccessor, OmitProps extends string = never> = LitElement & Omit<Pick<Accessor, keyof Accessor & keyof Props>, AlwaysOmit | OmitProps> & {
5
- autoDestroyDisabled: boolean;
6
- destroy: () => Promise<void>;
1
+ import type coreAccessor from "@arcgis/core/core/Accessor.js";
2
+ import type { GenericController } from "../GenericController.js";
3
+ import type { LitElement } from "../../LitElement.js";
4
+
5
+ export type AccessorControllerRequires<Props, Accessor extends coreAccessor, OmitProps extends string = never> = LitElement
6
+ & Omit<Pick<Accessor, keyof Accessor & keyof Props>, AlwaysOmit | OmitProps>
7
+ & {
8
+ /** This must be present for the accessor instance to be garbage collected correctly */
9
+ autoDestroyDisabled: boolean;
10
+ /** This must be present for the accessor instance to be garbage collected correctly */
11
+ destroy: () => Promise<void>;
7
12
  };
8
- type AlwaysOmit = "addHandles" | "declaredClass" | "destroyed" | "hasHandles" | "initialized" | "removeHandles" | "set" | "watch";
13
+
14
+ /**
15
+ * If Accessor class does not override constructor, constructor parameter will
16
+ * be "any". In such cases, all accessor properties are assumed to be required
17
+ * for binding. We add a few exceptions for well known built-in properties
18
+ */
19
+ export type AlwaysOmit = "addHandles" | "declaredClass" | "destroyed" | "hasHandles" | "initialized" | "removeHandles" | "set" | "watch";
20
+
9
21
  /**
10
22
  * Given an Accessor class, create a controller that will do two-way binding of
11
23
  * props between the component and the Accessor.
12
24
  *
13
25
  * See https://webgis.esri.com/references/lumina/controllers/useAccessor for
14
26
  * documentation & examples.
27
+ *
28
+ * @param createInstance
29
+ * @param options
15
30
  */
16
- export declare const makeAccessorController: <Props, Accessor extends coreAccessor, OmitProps extends string = never>(createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor), _options?: {
17
- /**
18
- * By default, to ensure that you didn't accidentally forget to bind any
19
- * of the Accessor's properties on your component, every property that
20
- * is accepted by the Accessor's constructor will be required to be bound
21
- * on your component. If you do not wish to bind certain properties
22
- * (or you wish to bind them but with a different type), you can omit
23
- * them using this option.
24
- *
25
- * You can also bind the property to \@state rather than \@property if you
26
- * wish to use it internally only:
27
- * @example
28
- * ```tsx
29
- * \@State() timeZone = this.viewModel.timeZone;
30
- * ```
31
- *
32
- * @remarks
33
- * This option affects the TypeScript error checking only - it has
34
- * no runtime impact. Thus, if you wish to save a few bytes in the
35
- * bundle, rather than simply setting this property like
36
- * `makeAccessorController(..., { omitProps: ["propName"] })`, you can
37
- * set it like this:
38
- * `makeAccessorController(..., {} as { omitProps: ["propName"] })`
39
- */
40
- omitProps: OmitProps[];
41
- }) => (component: Requires<Props, Accessor, OmitProps>) => Accessor;
42
- export declare class AccessorController<Props, Accessor extends coreAccessor, ExtraRequires = Record<never, never>> extends GenericController<Accessor, ExtraRequires & Requires<Props, Accessor>> {
43
- #private;
44
- protected instance: Accessor;
45
- /**
46
- * Use getAccessorControllerBoundProperties() helper to get access to this map
47
- * @private
48
- */
49
- _boundAccessorProperties: Map<string & keyof Accessor, string>;
50
- /** @private */
51
- _currentlyBindingPropertyName?: string;
52
- /**
53
- * (development only) Allow these props to mismatch the name of the Accessor's
54
- * property to avoid collisions
55
- *
56
- * @private
57
- */
58
- static devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
59
- get exports(): Accessor;
60
- set exports(value: Accessor);
61
- constructor(component: ExtraRequires & Requires<Props, Accessor>, createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor));
62
- /** @private */
63
- _createAccessorInstance(): void;
64
- hostConnected(): void;
65
- hostDestroy(): void;
31
+ export function makeAccessorController<Props, Accessor extends coreAccessor, OmitProps extends string = never>(createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor), options?: MakeAccessorControllerOptions<OmitProps>): ((component: AccessorControllerRequires<Props, Accessor, OmitProps>) => Accessor);
32
+
33
+ export interface MakeAccessorControllerOptions<OmitProps extends string> {
34
+ /**
35
+ * By default, to ensure that you didn't accidentally forget to bind any
36
+ * of the Accessor's properties on your component, every property that
37
+ * is accepted by the Accessor's constructor will be required to be bound
38
+ * on your component. If you do not wish to bind certain properties
39
+ * (or you wish to bind them but with a different type), you can omit
40
+ * them using this option.
41
+ *
42
+ * You can also bind the property to \@state rather than \@property if you
43
+ * wish to use it internally only:
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * \@State() timeZone = this.viewModel.timeZone;
48
+ * ```
49
+ */
50
+ omitProps: OmitProps[];
66
51
  }
67
- type MinimalAccessorController = Pick<AccessorController<never, coreAccessor>, "_currentlyBindingPropertyName" | "exports"> & {
68
- component: LitElement;
69
- };
70
- export declare const makeBinderProxy: (component: LitElement, accessorControllerRef: WeakRef<MinimalAccessorController & {
71
- constructor: MinimalAccessorController["constructor"] & {
72
- devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
73
- };
74
- }>, accessorControllerIndex: number, instance: coreAccessor, boundProperties: Map<string, string>) => unknown;
75
- export declare const getAccessorControllerBoundProperties: <Accessor extends coreAccessor>(controller: AccessorController<unknown, Accessor>) => Map<string & keyof Accessor, string>;
76
- export declare const reCreateAccessor: (instance: coreAccessor, component: LitElement) => void;
77
- export {};
52
+
53
+ export class AccessorController<Props, Accessor extends coreAccessor, ExtraRequires = Record<never, never>> extends GenericController<Accessor, AccessorControllerRequires<Props, Accessor> & ExtraRequires> {
54
+ static devOnly$allowedPropNameMismatches?: ReadonlySet<string>;
55
+ constructor(component: AccessorControllerRequires<Props, Accessor> & ExtraRequires, createInstance: ((props?: Props) => Accessor) | (new (props?: Props) => Accessor));
56
+ /**
57
+ * Setting .exports set controller's exports property for usage with
58
+ * proxyExports() and marks the controller as ready for usage in other
59
+ * controllers. Also, this triggers re-render of the component.
60
+ */
61
+ accessor exports: Accessor;
62
+ protected instance: Accessor;
63
+ /**
64
+ * If you subclass this controller and override this method, make sure to call
65
+ * super.hostConnected();
66
+ */
67
+ hostConnected(): void;
68
+ /**
69
+ * If you subclass this controller and override this method, make sure to call
70
+ * super.hostDestroy();
71
+ */
72
+ hostDestroy(): void;
73
+ }
74
+
75
+ export interface MinimalAccessorController extends Pick<AccessorController<never, coreAccessor>, "exports"> {
76
+ component: LitElement;
77
+ }
78
+
79
+ /**
80
+ * @param component
81
+ * @param accessorControllerRef
82
+ * @param accessorControllerIndex
83
+ * @param instance
84
+ * @param boundProperties
85
+ */
86
+ export function makeBinderProxy(component: LitElement, accessorControllerRef: WeakRef<MinimalAccessorController & { constructor: MinimalAccessorController["constructor"] & { devOnly$allowedPropNameMismatches?: ReadonlySet<string>; }; }>, accessorControllerIndex: number, instance: coreAccessor, boundProperties: Map<string, string>): unknown;
87
+
88
+ /** @param controller */
89
+ export function getAccessorControllerBoundProperties<Accessor extends coreAccessor>(controller: AccessorController<unknown, Accessor>): Map<string & keyof Accessor, string>;
90
+
91
+ /**
92
+ * @param instance
93
+ * @param component
94
+ */
95
+ export function reCreateAccessor(instance: coreAccessor, component: LitElement): void;
@@ -1,12 +1,17 @@
1
- import { LitElement } from '../LitElement.ts';
2
- import { GenericControllerType, Controller } from './Controller.ts';
1
+ import type { LitElement } from "../LitElement.js";
2
+ import type { GenericControllerType } from "./GenericController.js";
3
+ import type { Controller } from "./Controller.js";
4
+
3
5
  /**
4
6
  * Controller is a function that takes a component instance and then can
5
7
  * export some values to the component, or hook into component's lifecycle
6
8
  *
7
9
  * See controllers documentation for many example controllers and their usages
10
+ *
11
+ * @param constructor
8
12
  */
9
- export declare const makeController: <Exports>(constructor: (component: LitElement, controller: Controller<Exports>) => Exports | Promise<Exports>) => Exports;
13
+ export function makeController<Exports>(constructor: (component: LitElement, controller: Controller<Exports>) => Exports | Promise<Exports>): Exports;
14
+
10
15
  /**
11
16
  * If your controller requires some specific properties to be present on the
12
17
  * component, besides what's included in the LitElement, use
@@ -15,5 +20,7 @@ export declare const makeController: <Exports>(constructor: (component: LitEleme
15
20
  * When using a controller created using makeGenericController(), consumer must
16
21
  * pass in "this" explicitly for proper type-checking. If controller was
17
22
  * created using makeController(), that is not necessary
23
+ *
24
+ * @param constructor
18
25
  */
19
- export declare const makeGenericController: <Exports, Component = LitElement>(constructor: (component: Component & LitElement, controller: GenericControllerType<Exports, Component>) => Exports | Promise<Exports>) => (component: Component & LitElement) => Exports;
26
+ export function makeGenericController<Exports, Component = LitElement>(constructor: (component: Component & LitElement, controller: GenericControllerType<Exports, Component>) => Exports | Promise<Exports>): ((component: Component & LitElement) => Exports);
@@ -1,38 +1,37 @@
1
- import { EventEmitter as _EventEmitter } from '../createEvent.ts';
2
- import { setAutoDestroyOnDisconnectTimeout } from './ControllerManager.ts';
3
- export type { GenericControllerType } from './Controller.ts';
4
- export { Controller, GenericController } from './Controller.ts';
5
- export type { ControllerManager } from './ControllerManager.ts';
6
- export { retrieveComponent, bypassReadOnly } from './ControllerInternals.ts';
7
- export { trackPropertyKey, propertyTrackResolve } from './trackPropertyKey.ts';
8
- export { trackPropKey } from './trackPropKey.ts';
9
- export { trackKey } from './trackKey.ts';
10
- export { makeController, makeGenericController } from './functional.ts';
11
- export { useWatchAttributes } from './useWatchAttributes.ts';
12
- export { load } from './load.ts';
13
- export { proxyExports } from './proxyExports.ts';
14
- export { toFunction } from './toFunction.ts';
15
- export { useSlottableRequest } from './useSlottableRequest.ts';
16
- export * from './types.ts';
17
- export { useMedia } from './useMedia.ts';
18
- export { useDirection } from './useDirection.ts';
19
- export type { UseT9n, T9nMeta } from './useT9n.ts';
20
- export { makeT9nController } from './useT9n.ts';
21
- export { usePropertyChange } from './usePropertyChange.ts';
22
- export { isController, getControllersCount } from './utils.ts';
23
- /**
24
- * @deprecated import from "@arcgis/lumina" instead
25
- */
1
+ import type { EventEmitter as _EventEmitter } from "../createEvent.js";
2
+ import type { setAmbientComponent } from "./ControllerInternals.js";
3
+ import type { autoDestroyOnDisconnectTimeout, setAutoDestroyOnDisconnectTimeout } from "./ControllerManager.js";
4
+
5
+ export { type GenericControllerType } from "./GenericController.js";
6
+ export { GenericController } from "./GenericController.js";
7
+ export { Controller } from "./Controller.js";
8
+ export { type ControllerManager } from "./ControllerManager.js";
9
+ export { retrieveComponent, bypassReadOnly } from "./ControllerInternals.js";
10
+ export { trackPropertyKey, propertyTrackResolve } from "./trackPropertyKey.js";
11
+ export { trackPropKey } from "./trackPropKey.js";
12
+ export { trackKey } from "./trackKey.js";
13
+ export { makeController, makeGenericController } from "./functional.js";
14
+ export { useWatchAttributes } from "./useWatchAttributes.js";
15
+ export { load } from "./load.js";
16
+ export { proxyExports } from "./proxyExports.js";
17
+ export { toFunction } from "./toFunction.js";
18
+ export { useSlottableRequest } from "./useSlottableRequest.js";
19
+ export { controllerSymbol } from "./types.js";
20
+ export { type TrackKeyResolution, type Use, type ControllerLifecycleMethods, type BaseController, type LuminaPropertyDeclaration } from "./types.js";
21
+ export { useMedia } from "./useMedia.js";
22
+ export { useDirection } from "./useDirection.js";
23
+ export { type Direction } from "./useDirection.js";
24
+ export { type UseT9n, type T9nMeta } from "./useT9n.js";
25
+ export { makeT9nController } from "./useT9n.js";
26
+ export { usePropertyChange } from "./usePropertyChange.js";
27
+ export { isController, getControllersCount } from "./utils.js";
28
+
29
+ /** @deprecated import from "@arcgis/lumina" instead */
26
30
  export type EventEmitter<T = undefined> = _EventEmitter<T>;
27
- /**
28
- * @deprecated Let us know if someone is using this
29
- */
30
- export declare const keyTrackResolve: () => void;
31
- /**
32
- * @private
33
- */
34
- export declare const exportsForTests: {
35
- setAmbientComponent: (component: import('../LitElement.ts').LitElement) => void;
36
- autoDestroyOnDisconnectTimeout: number;
31
+
32
+ /** @internal */
33
+ export const exportsForTests: {
34
+ setAmbientComponent: typeof setAmbientComponent;
35
+ autoDestroyOnDisconnectTimeout: typeof autoDestroyOnDisconnectTimeout;
37
36
  setAutoDestroyOnDisconnectTimeout: typeof setAutoDestroyOnDisconnectTimeout;
38
- };
37
+ };
@@ -1,13 +1,13 @@
1
- import { C as Controller, c as createEvent, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-Cer_6Z29.js";
2
- import { G, b, d } from "../Controller-Cer_6Z29.js";
1
+ import { C as Controller, c as createEvent, t as trackKey, a as createEventFactory } from "../GenericController-C8NSb50b.js";
2
+ import { G, p, b, d } from "../GenericController-C8NSb50b.js";
3
3
  import { a as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-CeDntN3G.js";
4
4
  import { e, c, g, f } from "../ControllerInternals-CeDntN3G.js";
5
- import { p as proxyExports } from "../proxyExports-BkN6hND0.js";
5
+ import { p as proxyExports } from "../proxyExports-ZRLty8oJ.js";
6
6
  import { isServer } from "lit";
7
7
  import { isEsriInternalEnv } from "@arcgis/toolkit/error";
8
8
  import { observeAncestorsMutation, getElementAttribute } from "@arcgis/toolkit/dom";
9
9
  import { getElementLocale, startLocaleObserver } from "@arcgis/toolkit/intl";
10
- import { s as setAutoDestroyOnDisconnectTimeout, b as autoDestroyOnDisconnectTimeout } from "../ControllerManager-DpJfvft9.js";
10
+ import { s as setAutoDestroyOnDisconnectTimeout, b as autoDestroyOnDisconnectTimeout } from "../ControllerManager-4cSEnB5Y.js";
11
11
  const makeController = (constructor) => proxy(void 0, constructor);
12
12
  const makeGenericController = (constructor) => (component) => proxy(
13
13
  component,
@@ -296,7 +296,6 @@ const propertyChangeController = (...toWatch) => {
296
296
  }
297
297
  return eventEmitter;
298
298
  };
299
- const keyTrackResolve = propertyTrackResolve;
300
299
  const exportsForTests = {
301
300
  setAmbientComponent,
302
301
  autoDestroyOnDisconnectTimeout,
@@ -310,12 +309,11 @@ export {
310
309
  exportsForTests,
311
310
  g as getControllersCount,
312
311
  f as isController,
313
- keyTrackResolve,
314
312
  load,
315
313
  makeController,
316
314
  makeGenericController,
317
315
  makeT9nController,
318
- propertyTrackResolve,
316
+ p as propertyTrackResolve,
319
317
  proxyExports,
320
318
  retrieveComponent,
321
319
  toFunction,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Load a value from a promise and provide it to the component
3
3
  *
4
- * Documentation: https://webgis.esri.com/references/lumina/controllers/load
4
+ * @param loader
5
+ * @see https://webgis.esri.com/references/lumina/controllers/load
5
6
  */
6
- export declare const load: <T>(loader: () => Promise<T>) => T;
7
+ export function load<T>(loader: () => Promise<T>): T;
@@ -1,5 +1,6 @@
1
- import { Controller } from './Controller.ts';
2
- import { ControllerLifecycleMethods } from './types.ts';
1
+ import type { Controller } from "./Controller.js";
2
+ import type { ControllerLifecycleMethods } from "./types.js";
3
+
3
4
  /**
4
5
  * If you wish to directly expose the "exports" property of your controller,
5
6
  * rather than the entire controller class, wrap your class definition in
@@ -12,16 +13,16 @@ import { ControllerLifecycleMethods } from './types.ts';
12
13
  * "proxyExports" is the default behavior for all controllers declared using
13
14
  * the makeController()/makeGenericController() function
14
15
  *
15
- * @remarks
16
16
  * If using readonly(), and controller updates its exports, the readonly prop
17
17
  * will still get updated
18
18
  *
19
- * @remarks
20
19
  * (Advanced) If you wish to use proxyExports() in a class that does not
21
20
  * extend Controller class and does not have a useControllerManager(), then your
22
21
  * class must subclass a class with the following constructor:
23
22
  * `constructor() { setAmbientController(this); }`. This
24
23
  * is necessary for proxyExports() to receive a reference to your object
25
24
  * implicitly, and before any of your default values are assigned.
25
+ *
26
+ * @param Class
26
27
  */
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);
28
+ export function proxyExports<Exports, const Parameters extends unknown[]>(Class: new (...args: Parameters) => ControllerLifecycleMethods & Pick<Controller<Exports>, "component" | "exports" | "onUpdate" | "watchExports">): ((...args: Parameters) => Exports);
@@ -3,6 +3,8 @@
3
3
  * Main advantage of this is that it's a bit shorter to type.
4
4
  *
5
5
  * This utility can be used for converting non-controller classes to functions
6
- * too
6
+ * too.
7
+ *
8
+ * @param Class
7
9
  */
8
- export declare const toFunction: <T, const P extends unknown[]>(Class: new (...args: P) => T) => ((...args: P) => T);
10
+ export function toFunction<T, const P extends unknown[]>(Class: new (...args: P) => T): ((...args: P) => T);
@@ -1,8 +1,13 @@
1
- import { LitElement } from '../LitElement.ts';
2
- import { BaseController, TrackKeyResolution } from './types.ts';
1
+ import type { LitElement } from "../LitElement.js";
2
+ import type { BaseController, TrackKeyResolution } from "./types.js";
3
+
3
4
  /**
4
5
  * A combination of trackPropertyKey() and trackPropKey(). For usage when
5
6
  * you want to track a property, but don't know if it will be defined with the
6
- * \@property() decorator or not
7
+ * \@property() decorator or not.
8
+ *
9
+ * @param hostsCandidates
10
+ * @param onResolved
11
+ * @param defaultValue
7
12
  */
8
- export declare const trackKey: <T>(hostsCandidates: ((BaseController | LitElement)[] | BaseController | LitElement) | undefined, onResolved: (resolution: TrackKeyResolution | undefined) => void, defaultValue: T) => T;
13
+ export function trackKey<T>(hostsCandidates: (BaseController | LitElement)[] | BaseController | LitElement | undefined, onResolved: (resolution: TrackKeyResolution | undefined) => void, defaultValue: T): T;
@@ -1,9 +1,14 @@
1
- import { LitElement } from '../LitElement.ts';
1
+ import type { LitElement } from "../LitElement.js";
2
+
2
3
  /**
3
4
  * Like trackPropertyKey(), but for props that have \@state() or \@property()
4
5
  * decorator
5
6
  *
7
+ * @param component
8
+ * @param onResolved
9
+ * @param defaultValue
6
10
  * @example
11
+ * ```ts
7
12
  * function trackMe() {
8
13
  * const component = retrieveComponent();
9
14
  * const defaultValue = 'some value';
@@ -17,5 +22,6 @@ import { LitElement } from '../LitElement.ts';
17
22
  * // Will console log "myState"
18
23
  * \@state() myState = trackMe();
19
24
  * }
25
+ * ```
20
26
  */
21
- export declare const trackPropKey: <T>(component: LitElement, onResolved: (key: string | undefined) => void, defaultValue: T) => T;
27
+ export function trackPropKey<T>(component: LitElement, onResolved: (key: string | undefined) => void, defaultValue: T): T;
@@ -1,14 +1,18 @@
1
- import { LitElement } from '../LitElement.ts';
2
- import { BaseController } from './types.ts';
1
+ import type { LitElement } from "../LitElement.js";
2
+ import type { BaseController } from "./types.js";
3
+
3
4
  /**
4
5
  * A magical solution to finding out what property name a given controller
5
6
  * on a given object was assigned to.
6
7
  *
7
- * @remarks
8
8
  * This does not work for properties that have \@property() or \@state()
9
9
  * decorator - for those, use trackPropKey() instead.
10
10
  *
11
+ * @param object
12
+ * @param onResolved
13
+ * @param defaultValue
11
14
  * @example
15
+ * ```ts
12
16
  * function trackMe<T>(defaultValue: T, component: LitElement):T {
13
17
  * trackPropertyKey(component, (key)=>console.log(key), defaultValue);
14
18
  * return defaultValue;
@@ -18,12 +22,13 @@ import { BaseController } from './types.ts';
18
22
  * // Will console log "myProp"
19
23
  * myProp = trackMe('a', this);
20
24
  * }
21
- *
25
+ * ```
22
26
  */
23
- export declare const trackPropertyKey: <T>(object: BaseController | LitElement, onResolved: (key: string | undefined) => void, defaultValue: T) => T;
27
+ export function trackPropertyKey<T>(object: BaseController | LitElement, onResolved: (key: string | undefined) => void, defaultValue: T): T;
28
+
24
29
  /**
25
30
  * Resolve all pending trackPropertyKey() calls. This must be called after a
26
31
  * property you are trying to resolve had it's default value set, thus after
27
32
  * constructor. At the start of connectedCallback is a perfect place.
28
33
  */
29
- export declare const propertyTrackResolve: () => void;
34
+ export function propertyTrackResolve(): void;