@arcgis/lumina 4.33.0-next.125 → 4.33.0-next.127

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.
@@ -119,6 +119,7 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
119
119
  __offspringComponents: ProxyComponent["__offspringComponents"];
120
120
  constructor();
121
121
  connectedCallback(): void;
122
+ disconnectedCallback(): void;
122
123
  /**
123
124
  * Overwrite Lit's default behavior of attaching shadow root to the lit
124
125
  * element, and instead use this.el to support lazy builds.
@@ -131,6 +132,7 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
131
132
  * "changedProperties" so that we can later provide it to ControllerManager
132
133
  */
133
134
  protected shouldUpdate(_changedProperties: PropertyValues): boolean;
135
+ protected update(changedProperties: PropertyValues): void;
134
136
  /**
135
137
  * A helper for setting event listener on the current component.
136
138
  *
@@ -1,4 +1,4 @@
1
- import { BaseController } from './types';
1
+ import { BaseController, ReactiveTrackingTarget } from './types';
2
2
  import { GenericController } from './Controller';
3
3
  import { PropertyValues } from 'lit';
4
4
  import { LitElement } from '../LitElement';
@@ -28,6 +28,25 @@ export declare class ControllerManager extends GenericController<undefined> {
28
28
  * @private
29
29
  */
30
30
  _isEnforcingReadonly: boolean;
31
+ /**
32
+ * A possible reference to JS API's createTrackingTarget() function to create
33
+ * an observer that will keep track of what properties were accessed during
34
+ * render().
35
+ *
36
+ * This property is set by useAccessor() if it was used on the component
37
+ *
38
+ * @private
39
+ */
40
+ _createTrackingTarget?: (callback: () => void) => ReactiveTrackingTarget;
41
+ /**
42
+ * A possible reference to JS API's runTracked() function to run update() with
43
+ * property accesses tracking enabled.
44
+ *
45
+ * This property is set by useAccessor() if it was used on the component
46
+ *
47
+ * @private
48
+ */
49
+ _runTracked?: (target: ReactiveTrackingTarget, callback: () => void) => void;
31
50
  /** @private */
32
51
  _trackedValue: unknown;
33
52
  /** @private */
@@ -2,7 +2,7 @@ import { G as GenericController, l as trackPropKey, t as trackKey, r as retrieve
2
2
  import { p as proxyExports } from "../../proxyExports-DQobuu44.js";
3
3
  import { isEsriInternalEnv } from "@arcgis/components-utils";
4
4
  import { watch, on } from "@arcgis/core/core/reactiveUtils.js";
5
- import { createObservable, trackAccess } from "@arcgis/core/applications/Components/reactiveUtils.js";
5
+ import { createObservable, createTrackingTarget, runTracked, trackAccess } from "@arcgis/core/applications/Components/reactiveUtils.js";
6
6
  const makeAccessorController = (createInstance, _options) => (component) => proxy(component, createInstance);
7
7
  class AccessorController extends GenericController {
8
8
  constructor(component, createInstance) {
@@ -12,6 +12,8 @@ class AccessorController extends GenericController {
12
12
  const that = this;
13
13
  that.#createInstance = createInstance;
14
14
  that.Z();
15
+ component.manager.A = createTrackingTarget;
16
+ component.manager.B = runTracked;
15
17
  that.setProvisionalExports(
16
18
  makeBinderProxy(
17
19
  component,
@@ -180,3 +180,8 @@ export type AccessorObservableLike = {
180
180
  */
181
181
  notify: () => void;
182
182
  };
183
+ /** @private */
184
+ export type ReactiveTrackingTarget = {
185
+ clear: () => void;
186
+ destroy: () => void;
187
+ };
@@ -1,4 +1,4 @@
1
- import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-DcVuFccH.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) => {
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import { r as retrieveComponent, G as GenericController, k as keyTrackResolve, q
3
3
  import { b } from "./Controller-B3mB4uaz.js";
4
4
  import { state } from "@lit/reactive-element/decorators/state.js";
5
5
  import { property as property$1 } from "@lit/reactive-element/decorators/property.js";
6
- import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-DcVuFccH.js";
7
- import { d, m } from "./lazyLoad-DcVuFccH.js";
6
+ import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-ByH-FaBP.js";
7
+ import { d, m } from "./lazyLoad-ByH-FaBP.js";
8
8
  import { isEsriInternalEnv, safeCall, devToolsAwareTimeout, Deferred, camelToKebab, safeAsyncCall } from "@arcgis/components-utils";
9
9
  import { nothing as nothing$1, LitElement as LitElement$1, isServer, notEqual, noChange as noChange$1 } from "lit";
10
10
  import { propertyFlagAttribute, propertyFlagNoAccessor, propertyFlagReadOnly, propertyFlagState, propertyFlagBoolean, propertyFlagNumber, propertyFlagReflect } from "./config.js";
@@ -349,10 +349,13 @@ class LitElement extends LitElement$1 {
349
349
  #originalShouldUpdate;
350
350
  #enableUpdating;
351
351
  #postLoadedDeferred;
352
+ #trackingTarget;
352
353
  connectedCallback() {
353
354
  if (this.el.hasAttribute("defer-hydration")) {
354
355
  return;
355
356
  }
357
+ const trackingTarget = this.manager.A?.(() => this.requestUpdate());
358
+ this.#trackingTarget = trackingTarget;
356
359
  const isFirstCall = !this.manager.connectedCalled;
357
360
  super.connectedCallback();
358
361
  if (isFirstCall) {
@@ -365,8 +368,24 @@ class LitElement extends LitElement$1 {
365
368
  });
366
369
  })
367
370
  );
371
+ } else if (trackingTarget) {
372
+ this.requestUpdate();
368
373
  }
369
374
  }
375
+ #doTrackedUpdate(changedProperties) {
376
+ try {
377
+ this.#trackingTarget.clear();
378
+ this.manager.B(this.#trackingTarget, () => super.update(changedProperties));
379
+ } catch (error) {
380
+ this.#trackingTarget.clear();
381
+ throw error;
382
+ }
383
+ }
384
+ disconnectedCallback() {
385
+ super.disconnectedCallback();
386
+ this.#trackingTarget?.destroy();
387
+ this.#trackingTarget = void 0;
388
+ }
370
389
  /**
371
390
  * Overwrite Lit's default behavior of attaching shadow root to the lit
372
391
  * element, and instead use this.el to support lazy builds.
@@ -446,6 +465,13 @@ class LitElement extends LitElement$1 {
446
465
  this.manager.Q = _changedProperties;
447
466
  return this.#originalShouldUpdate?.(_changedProperties) ?? true;
448
467
  }
468
+ update(changedProperties) {
469
+ if (this.#trackingTarget) {
470
+ this.#doTrackedUpdate(changedProperties);
471
+ } else {
472
+ super.update(changedProperties);
473
+ }
474
+ }
449
475
  listen(name, listener, options) {
450
476
  const boundListener = listener?.bind(this) ?? listener;
451
477
  this.manager.onLifecycle(() => {
@@ -109,7 +109,7 @@ const makeDefineCustomElements = (runtime, structure) => function defineCustomEl
109
109
  }
110
110
  for (const [tagName, [load, compactMeta = ""]] of Object.entries(structure)) {
111
111
  if (customElements.get(tagName)) {
112
- return;
112
+ continue;
113
113
  }
114
114
  const [compactObservedProps, compactAsyncMethods, compactSyncMethods] = compactMeta.split(lazyMetaGroupJoiner);
115
115
  const observedProps = compactObservedProps ? compactObservedProps?.split(lazyMetaItemJoiner).map(parseCondensedProp) : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.33.0-next.125",
3
+ "version": "4.33.0-next.127",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
- "@arcgis/components-utils": "4.33.0-next.125",
25
+ "@arcgis/components-utils": "4.33.0-next.127",
26
26
  "@lit-labs/ssr": "^3.2.2",
27
27
  "@lit-labs/ssr-client": "^1.1.7",
28
28
  "@lit/context": "^1.1.5",