@arcgis/lumina 4.33.0-next.124 → 4.33.0-next.126

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.
@@ -1,6 +1,6 @@
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, q as queueMicroTask, d as setParentController, e as retrieveParentControllers, t as trackKey, r as retrieveComponent, f as createEventFactory } from "../Controller-B3mB4uaz.js";
2
+ import { G, h, g, c, n, m, k, l, j } from "../Controller-B3mB4uaz.js";
3
+ import { p as proxyExports } from "../proxyExports-DQobuu44.js";
4
4
  import { isServer } from "lit";
5
5
  import { observeAncestorsMutation, isEsriInternalEnv, getElementAttribute, getElementLocales, startLocaleObserver } from "@arcgis/components-utils";
6
6
  const makeController = (constructor) => proxy(void 0, constructor);
@@ -29,7 +29,7 @@ class FunctionalController extends Controller {
29
29
  this.exports = result;
30
30
  super.catchUpLifecycle();
31
31
  }).catch((error) => {
32
- this._ready.reject(error);
32
+ this.P.reject(error);
33
33
  console.error(error);
34
34
  });
35
35
  this.onLoad(async () => await resolved);
@@ -37,10 +37,10 @@ class FunctionalController extends Controller {
37
37
  if (!constructorChangedExports || value !== void 0) {
38
38
  this.exports = value;
39
39
  }
40
- queueMicrotask(() => super.catchUpLifecycle());
40
+ queueMicroTask(() => super.catchUpLifecycle());
41
41
  }
42
42
  } catch (error) {
43
- this._ready.reject(error);
43
+ this.P.reject(error);
44
44
  console.error(error);
45
45
  }
46
46
  }
@@ -52,17 +52,20 @@ class FunctionalController extends Controller {
52
52
  const proxy = proxyExports(FunctionalController);
53
53
  const useWatchAttributes = (attributes, callback) => new AttributeWatchController(attributes, callback);
54
54
  class AttributeWatchController extends Controller {
55
- constructor(_attributes, _callback) {
55
+ #observer;
56
+ #attributes;
57
+ #callback;
58
+ constructor(attributes, callback) {
56
59
  super();
57
- this._attributes = _attributes;
58
- this._callback = _callback;
59
60
  if (isServer) {
60
61
  return;
61
62
  }
62
- this._observer = new MutationObserver((mutations) => {
63
+ this.#attributes = attributes;
64
+ this.#callback = callback;
65
+ this.#observer = new MutationObserver((mutations) => {
63
66
  mutations.forEach((mutation) => {
64
- if (_attributes.includes(mutation.attributeName)) {
65
- _callback.call(
67
+ if (attributes.includes(mutation.attributeName)) {
68
+ callback.call(
66
69
  this.component,
67
70
  this.component.el.getAttribute(mutation.attributeName),
68
71
  mutation.oldValue,
@@ -73,19 +76,19 @@ class AttributeWatchController extends Controller {
73
76
  });
74
77
  }
75
78
  hostConnected() {
76
- this._attributes.forEach((attribute) => {
79
+ this.#attributes.forEach((attribute) => {
77
80
  if (this.component.el.hasAttribute(attribute)) {
78
- 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);
79
82
  }
80
83
  });
81
- this._observer.observe(this.component.el, {
84
+ this.#observer.observe(this.component.el, {
82
85
  attributes: true,
83
86
  attributeOldValue: true,
84
- attributeFilter: this._attributes
87
+ attributeFilter: this.#attributes
85
88
  });
86
89
  }
87
90
  hostDisconnected() {
88
- this._observer.disconnect();
91
+ this.#observer.disconnect();
89
92
  }
90
93
  }
91
94
  const load = makeController;
@@ -97,9 +100,9 @@ const toFunction = (Class) => (...args) => {
97
100
  };
98
101
  const useMedia = (query) => makeController((_component, controller) => {
99
102
  const media = globalThis.matchMedia(query);
100
- function changed() {
103
+ const changed = () => {
101
104
  controller.exports = media.matches;
102
- }
105
+ };
103
106
  changed();
104
107
  controller.onLifecycle(() => {
105
108
  media.addEventListener("change", changed);
@@ -111,10 +114,10 @@ const defaultDirection = "ltr";
111
114
  const useDirection = () => makeController((component, controller) => {
112
115
  controller.exports = defaultDirection;
113
116
  controller.onLifecycle(() => {
114
- function callback() {
117
+ const callback = () => {
115
118
  const dir = getElementAttribute(component.el, "dir", defaultDirection);
116
119
  controller.exports = dir === "rtl" ? "rtl" : "ltr";
117
- }
120
+ };
118
121
  callback();
119
122
  return observeAncestorsMutation(component.el, ["dir"], callback);
120
123
  });
@@ -137,7 +140,7 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
137
140
  // eslint-disable-next-line @typescript-eslint/promise-function-async
138
141
  makeController((component, controller) => {
139
142
  const locale = getElementLocales(component.el);
140
- const pending = { _lang: locale.lang, _t9nLocale: locale.t9nLocale, _loading: true };
143
+ const pending = { ["_lang"]: locale.lang, ["_t9nLocale"]: locale.t9nLocale, ["_loading"]: true };
141
144
  const componentWithOverrides = component;
142
145
  controller.onLifecycle(
143
146
  () => startLocaleObserver(
@@ -146,9 +149,9 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
146
149
  ({ t9nLocale, t9nStrings, lang }) => {
147
150
  const withoutOverrides = {
148
151
  ...t9nStrings,
149
- _lang: lang,
150
- _t9nLocale: t9nLocale,
151
- _loading: false
152
+ ["_lang"]: lang,
153
+ ["_t9nLocale"]: t9nLocale,
154
+ ["_loading"]: false
152
155
  };
153
156
  controller.exports = withoutOverrides;
154
157
  const label = t9nStrings.componentLabel;
@@ -160,15 +163,15 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
160
163
  options.name
161
164
  )
162
165
  );
163
- function applyOverrides(messageOverrides) {
166
+ const applyOverrides = (messageOverrides) => {
164
167
  const currentValue = controller.exports;
165
- const rawMessages = currentValue._original ?? currentValue;
168
+ const rawMessages = currentValue["_original"] ?? currentValue;
166
169
  const updated = deepMerge(rawMessages, messageOverrides);
167
170
  if (messageOverrides) {
168
- updated._original = rawMessages;
171
+ updated["_original"] = rawMessages;
169
172
  }
170
173
  controller.exports = updated;
171
- }
174
+ };
172
175
  if ("messageOverrides" in componentWithOverrides) {
173
176
  controller.onUpdate((changes) => {
174
177
  if (changes.has("messageOverrides")) {
@@ -184,7 +187,7 @@ const makeT9nController = (getAssetPath) => (options = {}) => (
184
187
  }
185
188
  })
186
189
  );
187
- function deepMerge(original, overwrites) {
190
+ const deepMerge = (original, overwrites) => {
188
191
  if (!overwrites) {
189
192
  return original;
190
193
  }
@@ -197,10 +200,10 @@ function deepMerge(original, overwrites) {
197
200
  }
198
201
  });
199
202
  return merged;
200
- }
203
+ };
201
204
  const usePropertyChange = (_component) => propertyChangeController;
202
205
  const eventName = "arcgisPropertyChange";
203
- function propertyChangeController(...toWatch) {
206
+ const propertyChangeController = (...toWatch) => {
204
207
  const component = retrieveComponent();
205
208
  const eventEmitter = createEventFactory(eventName, void 0, component);
206
209
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
@@ -240,15 +243,15 @@ function propertyChangeController(...toWatch) {
240
243
  );
241
244
  }
242
245
  return eventEmitter;
243
- }
246
+ };
244
247
  export {
245
248
  Controller,
246
249
  G as GenericController,
247
- h as bypassGetter,
248
- l as bypassReadOnly,
249
- j as bypassSetter,
250
+ h as bypassReadOnly,
251
+ g as bypassSetter,
250
252
  c as controllerSymbol,
251
- o as isController,
253
+ n as getControllersCount,
254
+ m as isController,
252
255
  k as keyTrackResolve,
253
256
  load,
254
257
  makeController,
@@ -258,8 +261,8 @@ export {
258
261
  retrieveComponent,
259
262
  toFunction,
260
263
  trackKey,
261
- n as trackPropKey,
262
- m as trackPropertyKey,
264
+ l as trackPropKey,
265
+ j as trackPropertyKey,
263
266
  useDirection,
264
267
  useMedia,
265
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
  };
@@ -1,15 +1,13 @@
1
- import { Controller } from './Controller';
1
+ import { LitElement } from '../LitElement';
2
2
  import { ControllerLifecycleMethods } from './types';
3
+ export declare const queueMicroTask: typeof queueMicrotask;
3
4
  export declare const isController: (value: unknown) => value is ControllerLifecycleMethods;
4
5
  /**
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.
6
+ * Checks if the argument is a promise by checking if it has a `then` method.
9
7
  */
10
- export declare const devOnlySetPersistentControllerData: ((controller: Controller<unknown>, data: unknown) => void) | undefined;
11
- export declare const devOnlyGetPersistentControllerData: (<T>(controller: Controller<unknown>) => T | undefined) | undefined;
8
+ export declare const isPromise: <T>(arg: Promise<T> | T) => arg is Promise<T>;
12
9
  /**
13
- * Checks if the argument is a promise by checking if it has a `then` method.
10
+ * Get the number of controllers current component has. Can be used to get a
11
+ * unique id for each controller.
14
12
  */
15
- export declare function isPromise<T>(arg: Promise<T> | T): arg is Promise<T>;
13
+ export declare const getControllersCount: (component: LitElement) => number;
@@ -1,4 +1,4 @@
1
- import { n as noShadowRoot, P as ProxyComponent } from "./utils-BdB9g3GU.js";
1
+ import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-ByH-FaBP.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';