@arcgis/lumina 4.33.0-next.16 → 4.33.0-next.161

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/Controller-BQOv8BAL.js +587 -0
  2. package/dist/LitElement.d.ts +56 -45
  3. package/dist/config.d.ts +7 -9
  4. package/dist/config.js +18 -8
  5. package/dist/context.d.ts +14 -4
  6. package/dist/controllers/Controller.d.ts +147 -0
  7. package/dist/controllers/ControllerInternals.d.ts +53 -0
  8. package/dist/controllers/ControllerManager.d.ts +68 -0
  9. package/dist/controllers/accessor/index.d.ts +4 -0
  10. package/dist/controllers/accessor/index.js +245 -0
  11. package/dist/controllers/accessor/reEmitEvent.d.ts +10 -0
  12. package/dist/controllers/accessor/store.d.ts +17 -0
  13. package/dist/controllers/accessor/useAccessor.d.ts +76 -0
  14. package/dist/controllers/functional.d.ts +19 -0
  15. package/dist/controllers/index.d.ts +24 -0
  16. package/dist/controllers/index.js +270 -0
  17. package/dist/controllers/load.d.ts +6 -0
  18. package/dist/controllers/proxyExports.d.ts +27 -0
  19. package/dist/controllers/tests/autoDestroyMock.d.ts +5 -0
  20. package/dist/controllers/tests/utils.d.ts +1 -0
  21. package/dist/controllers/toFunction.d.ts +8 -0
  22. package/dist/controllers/trackKey.d.ts +8 -0
  23. package/dist/controllers/trackPropKey.d.ts +21 -0
  24. package/dist/controllers/trackPropertyKey.d.ts +29 -0
  25. package/dist/controllers/types.d.ts +187 -0
  26. package/dist/controllers/useDirection.d.ts +11 -0
  27. package/dist/controllers/useMedia.d.ts +8 -0
  28. package/dist/controllers/usePropertyChange.d.ts +14 -0
  29. package/dist/controllers/useT9n.d.ts +48 -0
  30. package/dist/controllers/useWatchAttributes.d.ts +7 -0
  31. package/dist/controllers/utils.d.ts +12 -0
  32. package/dist/createEvent.d.ts +8 -3
  33. package/dist/decorators.d.ts +2 -2
  34. package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +1 -1
  35. package/dist/hmrSupport.d.ts +1 -1
  36. package/dist/hmrSupport.js +22 -28
  37. package/dist/index.d.ts +17 -16
  38. package/dist/index.js +423 -194
  39. package/dist/jsx/baseTypes.d.ts +13 -9
  40. package/dist/jsx/directives.d.ts +25 -7
  41. package/dist/jsx/generatedTypes.d.ts +420 -90
  42. package/dist/jsx/types.d.ts +5 -32
  43. package/dist/lazyLoad-DUvrNd2L.js +406 -0
  44. package/dist/lazyLoad.d.ts +27 -72
  45. package/dist/lifecycleSupport.d.ts +2 -2
  46. package/dist/makeRuntime.d.ts +148 -0
  47. package/dist/proxyExports-Cdzj7WL_.js +60 -0
  48. package/dist/render.d.ts +5 -0
  49. package/dist/runtime.d.ts +4 -107
  50. package/dist/stencilSsrCompatibility/index.d.ts +2 -6
  51. package/dist/stencilSsrCompatibility/index.js +2 -3
  52. package/dist/typings/importMeta.d.ts +2 -2
  53. package/dist/utils.d.ts +8 -0
  54. package/dist/wrappersUtils.d.ts +13 -1
  55. package/package.json +7 -6
  56. package/dist/chunk-NO7HOBNA.js +0 -421
  57. package/dist/chunk-PGHUBTOM.js +0 -21
  58. 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,5 @@
1
+ /**
2
+ * Mocking utility for changing auto-destroy timeout in ControllerManager to 0ms.
3
+ * Also, returns a convenient promise that resolves after the timeout.
4
+ */
5
+ export declare function autoDestroyMock(timeout?: number): () => Promise<void>;
@@ -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;
@@ -1,4 +1,9 @@
1
- import type { BaseComponent, EventEmitter } from "@arcgis/components-controllers";
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 = undefined>(eventName?: string, options?: EventOptions, component?: BaseComponent) => EventEmitter<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 = undefined>(options?: EventOptions) => EventEmitter<T>;
50
+ export declare const createEvent: <T = void>(options?: EventOptions) => EventEmitter<T>;
@@ -1,5 +1,5 @@
1
- import type { LuminaPropertyDeclaration } from "@arcgis/components-controllers";
2
- export { state } from "@lit/reactive-element/decorators/state.js";
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
@@ -1,4 +1,4 @@
1
- import type { LitElement } from "./LitElement";
1
+ import { LitElement } from './LitElement';
2
2
  /**
3
3
  * When in lazy-build, the actual Lit element is never attached to the DOM.
4
4
  * Instead, a proxy element is present and should be used for all DOM actions.
@@ -1,4 +1,4 @@
1
- import type { ModuleNamespace } from "vite/types/hot.js";
1
+ import { ModuleNamespace } from 'vite/types/hot.js';
2
2
  /**
3
3
  * Update web component proxies when a module is updated.
4
4
  *
@@ -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.tagName !== "string") {
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.tagName);
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.tagName}`);
15
+ throw new Error(`Failed to find custom element proxy for tag name: ${LitConstructor.L}`);
22
16
  }
23
- ProxyClass._LitConstructor = void 0;
24
- ProxyClass._loadPromise = void 0;
25
- ProxyClass._hmrIndex ??= 0;
26
- ProxyClass._hmrIndex += 1;
27
- ProxyClass._initializePrototype();
28
- ProxyClass._hmrInstances?.forEach((instanceWeakRef) => {
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._litElement === void 0) {
34
- void ProxyClass._loadPromise.then(() => reInitialize(instance, newModule));
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._litElement.constructor;
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._hmrSetProps.has(propertyName) || typeof descriptor.attribute === "string" && instance._hmrSetAttributes.has(descriptor.attribute))
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._store = Object.fromEntries(preservedProperties);
58
+ instance.devOnly$hmrResetStore(Object.fromEntries(preservedProperties));
65
59
  if (instance.isConnected) {
66
- instance._litElement.disconnectedCallback();
60
+ instance.$component.disconnectedCallback();
67
61
  }
68
- const renderRoot = instance._litElement?.renderRoot;
62
+ const renderRoot = instance.$component?.renderRoot;
69
63
  if (renderRoot) {
70
- renderRoot._$litPart$ = void 0;
64
+ renderRoot["_$litPart$"] = void 0;
71
65
  while (renderRoot.firstChild) {
72
66
  renderRoot.removeChild(renderRoot.firstChild);
73
67
  }
74
68
  }
75
- instance._initializeComponent(newModule);
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._asyncMethods = meta.asyncMethods;
95
- ProxyClass._syncMethods = meta.syncMethods;
96
- ProxyClass._properties = meta.properties.map(([name]) => name);
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 "./context";
2
- export type { 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 "./runtime";
10
- export { makeRuntime } from "./runtime";
11
- export type { EventHandler } from "./jsx/baseTypes";
12
- export * from "./jsx/types";
13
- export { safeClassMap, safeStyleMap, directive, live } from "./jsx/directives";
14
- export { nothing, noChange, setAttribute, stringOrBoolean } from "./jsx/utils";
15
- export { noShadowRoot } from "./utils";
16
- export { makeReactWrapperFactory, getReactWrapperOptions } from "./wrappersUtils";
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';