@arcgis/lumina 4.33.0-next.99 → 4.34.0-next.1

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 (36) hide show
  1. package/dist/{Controller-CZ8Djohh.js → Controller-BQOv8BAL.js} +170 -210
  2. package/dist/LitElement.d.ts +22 -18
  3. package/dist/config.d.ts +7 -9
  4. package/dist/config.js +15 -12
  5. package/dist/context.d.ts +2 -2
  6. package/dist/controllers/Controller.d.ts +4 -10
  7. package/dist/controllers/ControllerInternals.d.ts +7 -13
  8. package/dist/controllers/ControllerManager.d.ts +6 -21
  9. package/dist/controllers/accessor/index.d.ts +3 -1
  10. package/dist/controllers/accessor/index.js +208 -222
  11. package/dist/controllers/accessor/reEmitEvent.d.ts +1 -1
  12. package/dist/controllers/accessor/store.d.ts +17 -0
  13. package/dist/controllers/accessor/useAccessor.d.ts +29 -32
  14. package/dist/controllers/index.d.ts +2 -2
  15. package/dist/controllers/index.js +45 -38
  16. package/dist/controllers/trackKey.d.ts +1 -1
  17. package/dist/controllers/trackPropKey.d.ts +1 -1
  18. package/dist/controllers/trackPropertyKey.d.ts +2 -2
  19. package/dist/controllers/types.d.ts +35 -0
  20. package/dist/controllers/usePropertyChange.d.ts +3 -1
  21. package/dist/controllers/utils.d.ts +6 -9
  22. package/dist/createEvent.d.ts +4 -4
  23. package/dist/hmrSupport.js +22 -22
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +193 -200
  26. package/dist/jsx/generatedTypes.d.ts +414 -80
  27. package/dist/lazyLoad-DUvrNd2L.js +406 -0
  28. package/dist/lazyLoad.d.ts +22 -67
  29. package/dist/lifecycleSupport.d.ts +1 -1
  30. package/dist/makeRuntime.d.ts +40 -1
  31. package/dist/{proxyExports-CK5BLFLO.js → proxyExports-Cdzj7WL_.js} +8 -8
  32. package/dist/render.d.ts +1 -1
  33. package/dist/utils.d.ts +8 -0
  34. package/dist/wrappersUtils.d.ts +13 -1
  35. package/package.json +5 -5
  36. package/dist/utils-DBdf1Dqp.js +0 -405
@@ -1,6 +1,7 @@
1
- import { C as Controller, s as setAmbientComponent, i as isPromise, e as setParentController, f as retrieveParentControllers, t as trackKey, r as retrieveComponent, g as createEventFactory } from "../Controller-CZ8Djohh.js";
2
- import { G, h, l, j, c, o, k, n, m } from "../Controller-CZ8Djohh.js";
3
- import { p as proxyExports } from "../proxyExports-CK5BLFLO.js";
1
+ import { C as Controller, s as setAmbientComponent, i as isPromise, d as setParentController, e as retrieveParentControllers, t as trackKey, r as retrieveComponent, f as createEventFactory } from "../Controller-BQOv8BAL.js";
2
+ import { G, h, g, c, n, m, k, l, j } from "../Controller-BQOv8BAL.js";
3
+ import { p as proxyExports } from "../proxyExports-Cdzj7WL_.js";
4
+ import { isServer } from "lit";
4
5
  import { observeAncestorsMutation, isEsriInternalEnv, getElementAttribute, getElementLocales, startLocaleObserver } from "@arcgis/components-utils";
5
6
  const makeController = (constructor) => proxy(void 0, constructor);
6
7
  const makeGenericController = (constructor) => (component) => proxy(
@@ -28,7 +29,7 @@ class FunctionalController extends Controller {
28
29
  this.exports = result;
29
30
  super.catchUpLifecycle();
30
31
  }).catch((error) => {
31
- this._ready.reject(error);
32
+ this.P.reject(error);
32
33
  console.error(error);
33
34
  });
34
35
  this.onLoad(async () => await resolved);
@@ -39,7 +40,7 @@ class FunctionalController extends Controller {
39
40
  queueMicrotask(() => super.catchUpLifecycle());
40
41
  }
41
42
  } catch (error) {
42
- this._ready.reject(error);
43
+ this.P.reject(error);
43
44
  console.error(error);
44
45
  }
45
46
  }
@@ -51,14 +52,20 @@ class FunctionalController extends Controller {
51
52
  const proxy = proxyExports(FunctionalController);
52
53
  const useWatchAttributes = (attributes, callback) => new AttributeWatchController(attributes, callback);
53
54
  class AttributeWatchController extends Controller {
54
- constructor(_attributes, _callback) {
55
+ #observer;
56
+ #attributes;
57
+ #callback;
58
+ constructor(attributes, callback) {
55
59
  super();
56
- this._attributes = _attributes;
57
- this._callback = _callback;
58
- this._observer = new MutationObserver((mutations) => {
60
+ if (isServer) {
61
+ return;
62
+ }
63
+ this.#attributes = attributes;
64
+ this.#callback = callback;
65
+ this.#observer = new MutationObserver((mutations) => {
59
66
  mutations.forEach((mutation) => {
60
- if (_attributes.includes(mutation.attributeName)) {
61
- _callback.call(
67
+ if (attributes.includes(mutation.attributeName)) {
68
+ callback.call(
62
69
  this.component,
63
70
  this.component.el.getAttribute(mutation.attributeName),
64
71
  mutation.oldValue,
@@ -69,19 +76,19 @@ class AttributeWatchController extends Controller {
69
76
  });
70
77
  }
71
78
  hostConnected() {
72
- this._attributes.forEach((attribute) => {
79
+ this.#attributes.forEach((attribute) => {
73
80
  if (this.component.el.hasAttribute(attribute)) {
74
- this._callback.call(this.component, null, this.component.el.getAttribute(attribute), attribute);
81
+ this.#callback.call(this.component, null, this.component.el.getAttribute(attribute), attribute);
75
82
  }
76
83
  });
77
- this._observer.observe(this.component.el, {
84
+ this.#observer.observe(this.component.el, {
78
85
  attributes: true,
79
86
  attributeOldValue: true,
80
- attributeFilter: this._attributes
87
+ attributeFilter: this.#attributes
81
88
  });
82
89
  }
83
90
  hostDisconnected() {
84
- this._observer.disconnect();
91
+ this.#observer.disconnect();
85
92
  }
86
93
  }
87
94
  const load = makeController;
@@ -93,9 +100,9 @@ const toFunction = (Class) => (...args) => {
93
100
  };
94
101
  const useMedia = (query) => makeController((_component, controller) => {
95
102
  const media = globalThis.matchMedia(query);
96
- function changed() {
103
+ const changed = () => {
97
104
  controller.exports = media.matches;
98
- }
105
+ };
99
106
  changed();
100
107
  controller.onLifecycle(() => {
101
108
  media.addEventListener("change", changed);
@@ -107,10 +114,10 @@ const defaultDirection = "ltr";
107
114
  const useDirection = () => makeController((component, controller) => {
108
115
  controller.exports = defaultDirection;
109
116
  controller.onLifecycle(() => {
110
- function callback() {
117
+ const callback = () => {
111
118
  const dir = getElementAttribute(component.el, "dir", defaultDirection);
112
119
  controller.exports = dir === "rtl" ? "rtl" : "ltr";
113
- }
120
+ };
114
121
  callback();
115
122
  return observeAncestorsMutation(component.el, ["dir"], callback);
116
123
  });
@@ -133,7 +140,7 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
133
140
  // eslint-disable-next-line @typescript-eslint/promise-function-async
134
141
  makeController((component, controller) => {
135
142
  const locale = getElementLocales(component.el);
136
- const pending = { _lang: locale.lang, _t9nLocale: locale.t9nLocale, _loading: true };
143
+ const pending = { ["_lang"]: locale.lang, ["_t9nLocale"]: locale.t9nLocale, ["_loading"]: true };
137
144
  const componentWithOverrides = component;
138
145
  controller.onLifecycle(
139
146
  () => startLocaleObserver(
@@ -142,9 +149,9 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
142
149
  ({ t9nLocale, t9nStrings, lang }) => {
143
150
  const withoutOverrides = {
144
151
  ...t9nStrings,
145
- _lang: lang,
146
- _t9nLocale: t9nLocale,
147
- _loading: false
152
+ ["_lang"]: lang,
153
+ ["_t9nLocale"]: t9nLocale,
154
+ ["_loading"]: false
148
155
  };
149
156
  controller.exports = withoutOverrides;
150
157
  const label = t9nStrings.componentLabel;
@@ -156,15 +163,15 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
156
163
  options.name
157
164
  )
158
165
  );
159
- function applyOverrides(messageOverrides) {
166
+ const applyOverrides = (messageOverrides) => {
160
167
  const currentValue = controller.exports;
161
- const rawMessages = currentValue._original ?? currentValue;
168
+ const rawMessages = currentValue["_original"] ?? currentValue;
162
169
  const updated = deepMerge(rawMessages, messageOverrides);
163
170
  if (messageOverrides) {
164
- updated._original = rawMessages;
171
+ updated["_original"] = rawMessages;
165
172
  }
166
173
  controller.exports = updated;
167
- }
174
+ };
168
175
  if ("messageOverrides" in componentWithOverrides) {
169
176
  controller.onUpdate((changes) => {
170
177
  if (changes.has("messageOverrides")) {
@@ -180,7 +187,7 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
180
187
  }
181
188
  })
182
189
  );
183
- function deepMerge(original, overwrites) {
190
+ const deepMerge = (original, overwrites) => {
184
191
  if (!overwrites) {
185
192
  return original;
186
193
  }
@@ -193,10 +200,10 @@ function deepMerge(original, overwrites) {
193
200
  }
194
201
  });
195
202
  return merged;
196
- }
203
+ };
197
204
  const usePropertyChange = (_component) => propertyChangeController;
198
205
  const eventName = "arcgisPropertyChange";
199
- function propertyChangeController(...toWatch) {
206
+ const propertyChangeController = (...toWatch) => {
200
207
  const component = retrieveComponent();
201
208
  const eventEmitter = createEventFactory(eventName, void 0, component);
202
209
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
@@ -236,15 +243,15 @@ function propertyChangeController(...toWatch) {
236
243
  );
237
244
  }
238
245
  return eventEmitter;
239
- }
246
+ };
240
247
  export {
241
248
  Controller,
242
249
  G as GenericController,
243
- h as bypassGetter,
244
- l as bypassReadOnly,
245
- j as bypassSetter,
250
+ h as bypassReadOnly,
251
+ g as bypassSetter,
246
252
  c as controllerSymbol,
247
- o as isController,
253
+ n as getControllersCount,
254
+ m as isController,
248
255
  k as keyTrackResolve,
249
256
  load,
250
257
  makeController,
@@ -254,8 +261,8 @@ export {
254
261
  retrieveComponent,
255
262
  toFunction,
256
263
  trackKey,
257
- n as trackPropKey,
258
- m as trackPropertyKey,
264
+ l as trackPropKey,
265
+ j as trackPropertyKey,
259
266
  useDirection,
260
267
  useMedia,
261
268
  usePropertyChange,
@@ -5,4 +5,4 @@ import { BaseController, TrackKeyResolution } from './types';
5
5
  * you want to track a property, but don't know if it will be defined with the
6
6
  * \@property() decorator or not
7
7
  */
8
- export declare function trackKey<T>(hostsCandidates: ((BaseController | LitElement)[] | BaseController | LitElement) | undefined, onResolved: (resolution: TrackKeyResolution | undefined) => void, defaultValue: T): T;
8
+ export declare const trackKey: <T>(hostsCandidates: ((BaseController | LitElement)[] | BaseController | LitElement) | undefined, onResolved: (resolution: TrackKeyResolution | undefined) => void, defaultValue: T) => T;
@@ -18,4 +18,4 @@ import { LitElement } from '../LitElement';
18
18
  * \@state() myState = trackMe();
19
19
  * }
20
20
  */
21
- export declare function trackPropKey<T>(component: LitElement, onResolved: (key: string | undefined) => void, defaultValue: T): T;
21
+ export declare const trackPropKey: <T>(component: LitElement, onResolved: (key: string | undefined) => void, defaultValue: T) => T;
@@ -20,10 +20,10 @@ import { BaseController } from './types';
20
20
  * }
21
21
  *
22
22
  */
23
- export declare function trackPropertyKey<T>(object: BaseController | LitElement, onResolved: (key: string | undefined) => void, defaultValue: T): T;
23
+ export declare const trackPropertyKey: <T>(object: BaseController | LitElement, onResolved: (key: string | undefined) => void, defaultValue: T) => T;
24
24
  /**
25
25
  * Resolve all pending trackPropertyKey() calls. This must be called after a
26
26
  * property you are trying to resolve had it's default value set, thus after
27
27
  * constructor. At the start of connectedCallback is a perfect place.
28
28
  */
29
- export declare function keyTrackResolve(): void;
29
+ export declare const keyTrackResolve: () => void;
@@ -149,4 +149,39 @@ export type LuminaPropertyDeclaration = PropertyDeclaration & {
149
149
  * ```
150
150
  */
151
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;
152
187
  };
@@ -8,5 +8,7 @@ type PropertyChangeController<Component extends LitElement> = <ToWatch extends k
8
8
  *
9
9
  * Documentation: https://qawebgis.esri.com/components/lumina/controllers/usePropertyChange
10
10
  */
11
- export declare const usePropertyChange: <Component extends LitElement>(_component?: LitElement) => PropertyChangeController<Component>;
11
+ export declare const usePropertyChange: <Component extends LitElement>(
12
+ /** Needed for typings only */
13
+ _component?: LitElement) => PropertyChangeController<Component>;
12
14
  export {};
@@ -1,15 +1,12 @@
1
- import { Controller } from './Controller';
1
+ import { LitElement } from '../LitElement';
2
2
  import { ControllerLifecycleMethods } from './types';
3
3
  export declare const isController: (value: unknown) => value is ControllerLifecycleMethods;
4
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.
5
+ * Checks if the argument is a promise by checking if it has a `then` method.
9
6
  */
10
- export declare const devOnlySetPersistentControllerData: ((controller: Controller<unknown>, data: unknown) => void) | undefined;
11
- export declare const devOnlyGetPersistentControllerData: (<T>(controller: Controller<unknown>) => T | undefined) | undefined;
7
+ export declare const isPromise: <T>(arg: Promise<T> | T) => arg is Promise<T>;
12
8
  /**
13
- * Checks if the argument is a promise by checking if it has a `then` method.
9
+ * Get the number of controllers current component has. Can be used to get a
10
+ * unique id for each controller.
14
11
  */
15
- export declare function isPromise<T>(arg: Promise<T> | T): arg is Promise<T>;
12
+ export declare const getControllersCount: (component: LitElement) => number;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * An event emitter object
3
3
  */
4
- export type EventEmitter<T = undefined> = {
5
- emit(payload: T extends undefined ? void : T): CustomEvent<T>;
4
+ export type EventEmitter<T = void> = {
5
+ emit(payload: T): CustomEvent<T>;
6
6
  };
7
7
  /**
8
8
  * While these defaults don't match DOM defaults (all false), they match
@@ -32,7 +32,7 @@ export type EventOptions = {
32
32
  */
33
33
  composed?: boolean;
34
34
  };
35
- export declare const createEventFactory: <T = undefined>(eventName?: string, options?: EventOptions, component?: import('./LitElement').LitElement) => EventEmitter<T>;
35
+ export declare const createEventFactory: <T = void>(eventName?: string, options?: EventOptions, component?: import('./LitElement').LitElement) => EventEmitter<T>;
36
36
  /**
37
37
  * Creates an event emitter.
38
38
  * Events emitted by your component will be included in the documentation.
@@ -47,4 +47,4 @@ export declare const createEventFactory: <T = undefined>(eventName?: string, opt
47
47
  * ```
48
48
  *
49
49
  */
50
- export declare const createEvent: <T = undefined>(options?: EventOptions) => EventEmitter<T>;
50
+ export declare const createEvent: <T = void>(options?: EventOptions) => EventEmitter<T>;
@@ -1,4 +1,4 @@
1
- import { n as noShadowRoot, P as ProxyComponent } from "./utils-DBdf1Dqp.js";
1
+ import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-DUvrNd2L.js";
2
2
  import { camelToKebab } from "@arcgis/components-utils";
3
3
  function handleHmrUpdate(newModules) {
4
4
  newModules.forEach((newModule) => {
@@ -6,26 +6,26 @@ function handleHmrUpdate(newModules) {
6
6
  return;
7
7
  }
8
8
  Object.values(newModule).forEach((exported) => {
9
- if (typeof exported !== "function" || typeof exported.tagName !== "string") {
9
+ if (typeof exported !== "function" || typeof exported.L !== "string") {
10
10
  return;
11
11
  }
12
12
  const LitConstructor = exported;
13
- const ProxyClass = customElements.get(LitConstructor.tagName);
13
+ const ProxyClass = customElements.get(LitConstructor.L);
14
14
  if (ProxyClass === void 0) {
15
- 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}`);
16
16
  }
17
- ProxyClass._LitConstructor = void 0;
18
- ProxyClass._loadPromise = void 0;
19
- ProxyClass._hmrIndex ??= 0;
20
- ProxyClass._hmrIndex += 1;
21
- ProxyClass._initializePrototype();
22
- 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) => {
23
23
  const instance = instanceWeakRef.deref();
24
24
  if (instance === void 0) {
25
25
  return;
26
26
  }
27
- if (instance._litElement === void 0) {
28
- void ProxyClass._loadPromise.then(() => reInitialize(instance, newModule));
27
+ if (instance.$component === void 0) {
28
+ void ProxyClass.B.then(() => reInitialize(instance, newModule));
29
29
  } else {
30
30
  reInitialize(instance, newModule);
31
31
  }
@@ -35,7 +35,7 @@ function handleHmrUpdate(newModules) {
35
35
  });
36
36
  }
37
37
  function reInitialize(instance, newModule) {
38
- const PreviousLitConstructor = instance._litElement.constructor;
38
+ const PreviousLitConstructor = instance.$component.constructor;
39
39
  const isShadowRoot = PreviousLitConstructor.shadowRootOptions !== noShadowRoot;
40
40
  if (!isShadowRoot) {
41
41
  const root = instance.getRootNode() ?? document;
@@ -53,20 +53,20 @@ function reInitialize(instance, newModule) {
53
53
  }
54
54
  const properties = PreviousLitConstructor.elementProperties;
55
55
  const preservedProperties = Array.from(properties.entries()).filter(
56
- ([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))
57
57
  ).map(([key]) => [key, instance[key]]);
58
- instance._store = Object.fromEntries(preservedProperties);
58
+ instance.devOnly$hmrResetStore(Object.fromEntries(preservedProperties));
59
59
  if (instance.isConnected) {
60
- instance._litElement.disconnectedCallback();
60
+ instance.$component.disconnectedCallback();
61
61
  }
62
- const renderRoot = instance._litElement?.renderRoot;
62
+ const renderRoot = instance.$component?.renderRoot;
63
63
  if (renderRoot) {
64
- renderRoot._$litPart$ = void 0;
64
+ renderRoot["_$litPart$"] = void 0;
65
65
  while (renderRoot.firstChild) {
66
66
  renderRoot.removeChild(renderRoot.firstChild);
67
67
  }
68
68
  }
69
- instance._initializeComponent(newModule);
69
+ instance.devOnly$InitializeComponent(newModule);
70
70
  }
71
71
  function handleComponentMetaUpdate(meta) {
72
72
  const ProxyClass = customElements.get(meta.tagName);
@@ -85,9 +85,9 @@ function handleComponentMetaUpdate(meta) {
85
85
  */
86
86
  attributes.filter((attribute) => !originallyObserved.has(attribute))
87
87
  );
88
- ProxyClass._asyncMethods = meta.asyncMethods;
89
- ProxyClass._syncMethods = meta.syncMethods;
90
- 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);
91
91
  ProxyClass.observedAttributes = attributes;
92
92
  }
93
93
  function initializeAttributeObserver() {
package/dist/index.d.ts CHANGED
@@ -12,6 +12,6 @@ export type { EventHandler } from './jsx/baseTypes';
12
12
  export * from './jsx/types';
13
13
  export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, directive, live } from './jsx/directives';
14
14
  export { nothing, noChange, setAttribute, stringOrBoolean } from './jsx/utils';
15
- export { noShadowRoot } from './utils';
15
+ export { noShadowRoot, devOnly$getLitElementTagNameAndRuntime } from './utils';
16
16
  export { makeReactWrapperFactory, getReactWrapperOptions } from './wrappersUtils';
17
17
  export { renderElement } from './render';