@arcgis/lumina 4.34.0-next.67 → 4.34.0-next.69

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.
@@ -6,7 +6,7 @@ const trackPropertyKey = (object, onResolved, defaultValue) => {
6
6
  const keys = Object.keys(object);
7
7
  const keyCount = keys.length;
8
8
  if (keyTrackMap === void 0) {
9
- queueMicrotask(keyTrackResolve);
9
+ queueMicrotask(propertyTrackResolve);
10
10
  }
11
11
  keyTrackMap ??= /* @__PURE__ */ new Map();
12
12
  let pendingTrackers = keyTrackMap.get(object);
@@ -33,7 +33,7 @@ const trackPropertyKey = (object, onResolved, defaultValue) => {
33
33
  return defaultValue;
34
34
  };
35
35
  let keyTrackMap = void 0;
36
- const keyTrackResolve = () => {
36
+ const propertyTrackResolve = () => {
37
37
  keyTrackMap?.forEach(({ callbacks }, object) => {
38
38
  const keys = Object.keys(object);
39
39
  callbacks.forEach((commit) => commit(keys));
@@ -93,7 +93,7 @@ const createEventFactory = (eventName = "", options = {}, component = retrieveCo
93
93
  console.warn(`Trying to emit an ${eventName} event on a disconnected element ${component.el.localName}`);
94
94
  }
95
95
  if (eventName === "") {
96
- keyTrackResolve();
96
+ propertyTrackResolve();
97
97
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv() && eventName === "") {
98
98
  throw new Error("Unable to resolve event name from property name");
99
99
  }
@@ -456,6 +456,6 @@ export {
456
456
  trackPropertyKey as b,
457
457
  createEvent as c,
458
458
  trackPropKey as d,
459
- keyTrackResolve as k,
459
+ propertyTrackResolve as p,
460
460
  trackKey as t
461
461
  };
@@ -1,8 +1,8 @@
1
1
  import { isEsriInternalEnv } from "@arcgis/toolkit/error";
2
2
  import { r as retrieveComponent } from "../../ControllerInternals-CWQrfEA8.js";
3
3
  import { on, watch } from "@arcgis/core/core/reactiveUtils.js";
4
- import { a as createEventFactory, G as GenericController, d as trackPropKey, t as trackKey } from "../../Controller-ik0igmGm.js";
5
- import { p as proxyExports } from "../../proxyExports-Ch_IR1V2.js";
4
+ import { a as createEventFactory, G as GenericController, d as trackPropKey, t as trackKey } from "../../Controller-ftAEcdmI.js";
5
+ import { p as proxyExports } from "../../proxyExports-D906TEtL.js";
6
6
  import { createObservable, trackAccess } from "@arcgis/core/applications/Components/reactiveUtils.js";
7
7
  import { property, subclass } from "@arcgis/core/core/accessorSupport/decorators.js";
8
8
  import Accessor from "@arcgis/core/core/Accessor.js";
@@ -3,7 +3,7 @@ export type { GenericControllerType } from './Controller';
3
3
  export { Controller, GenericController } from './Controller';
4
4
  export type { ControllerManager } from './ControllerManager';
5
5
  export { retrieveComponent, bypassSetter, bypassReadOnly } from './ControllerInternals';
6
- export { trackPropertyKey, keyTrackResolve } from './trackPropertyKey';
6
+ export { trackPropertyKey, propertyTrackResolve } from './trackPropertyKey';
7
7
  export { trackPropKey } from './trackPropKey';
8
8
  export { trackKey } from './trackKey';
9
9
  export { makeController, makeGenericController } from './functional';
@@ -22,3 +22,7 @@ export { isController, getControllersCount } from './utils';
22
22
  * @deprecated import from "@arcgis/lumina" instead
23
23
  */
24
24
  export type EventEmitter<T = undefined> = _EventEmitter<T>;
25
+ /**
26
+ * @deprecated Let us know if someone is using this
27
+ */
28
+ export declare const keyTrackResolve: () => void;
@@ -1,8 +1,8 @@
1
- import { C as Controller, t as trackKey, a as createEventFactory } from "../Controller-ik0igmGm.js";
2
- import { G, k, d, b } from "../Controller-ik0igmGm.js";
1
+ import { C as Controller, t as trackKey, a as createEventFactory, p as propertyTrackResolve } from "../Controller-ftAEcdmI.js";
2
+ import { G, d, b } from "../Controller-ftAEcdmI.js";
3
3
  import { s as setAmbientComponent, i as isPromise, b as setParentController, d as retrieveParentControllers, r as retrieveComponent } from "../ControllerInternals-CWQrfEA8.js";
4
4
  import { f, e, c, h, g } from "../ControllerInternals-CWQrfEA8.js";
5
- import { p as proxyExports } from "../proxyExports-Ch_IR1V2.js";
5
+ import { p as proxyExports } from "../proxyExports-D906TEtL.js";
6
6
  import { isServer } from "lit";
7
7
  import { isEsriInternalEnv } from "@arcgis/toolkit/error";
8
8
  import { observeAncestorsMutation, getElementAttribute } from "@arcgis/toolkit/dom";
@@ -248,6 +248,7 @@ const propertyChangeController = (...toWatch) => {
248
248
  }
249
249
  return eventEmitter;
250
250
  };
251
+ const keyTrackResolve = propertyTrackResolve;
251
252
  export {
252
253
  Controller,
253
254
  G as GenericController,
@@ -256,11 +257,12 @@ export {
256
257
  c as controllerSymbol,
257
258
  h as getControllersCount,
258
259
  g as isController,
259
- k as keyTrackResolve,
260
+ keyTrackResolve,
260
261
  load,
261
262
  makeController,
262
263
  makeGenericController,
263
264
  makeT9nController,
265
+ propertyTrackResolve,
264
266
  proxyExports,
265
267
  retrieveComponent,
266
268
  toFunction,
@@ -26,4 +26,4 @@ export declare const trackPropertyKey: <T>(object: BaseController | LitElement,
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 const keyTrackResolve: () => void;
29
+ export declare const propertyTrackResolve: () => void;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalCompon
9
9
  export { makeRuntime } from './makeRuntime';
10
10
  export type { EventHandler } from './jsx/baseTypes';
11
11
  export * from './jsx/types';
12
- export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, directive, live } from './jsx/directives';
12
+ export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, stabilizedRef, directive, live, } from './jsx/directives';
13
13
  export { nothing, noChange, setAttribute, stringOrBoolean } from './jsx/utils';
14
14
  export { noShadowRoot, devOnly$getLitElementTagNameAndRuntime } from './utils';
15
15
  export { makeReactWrapperFactory, getReactWrapperOptions } from './wrappersUtils';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GenericController, k as keyTrackResolve } from "./Controller-ik0igmGm.js";
2
- import { c } from "./Controller-ik0igmGm.js";
1
+ import { G as GenericController, p as propertyTrackResolve } from "./Controller-ftAEcdmI.js";
2
+ import { c } from "./Controller-ftAEcdmI.js";
3
3
  import { state } from "@lit/reactive-element/decorators/state.js";
4
4
  import { property as property$1 } from "@lit/reactive-element/decorators/property.js";
5
5
  import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-B6Te7FRR.js";
@@ -14,6 +14,7 @@ import { classMap } from "lit-html/directives/class-map.js";
14
14
  import { styleMap } from "lit/directives/style-map.js";
15
15
  import { directive as directive$1, Directive } from "lit-html/directive.js";
16
16
  import { live as live$1 } from "lit-html/directives/live.js";
17
+ import { ref } from "lit/directives/ref.js";
17
18
  import { nothing as nothing$2, noChange as noChange$2, render } from "lit-html";
18
19
  const property = property$1;
19
20
  const method = void 0;
@@ -47,7 +48,7 @@ class ControllerManager extends GenericController {
47
48
  if (this.#autoDestroyTimeout !== void 0) {
48
49
  clearTimeout(this.#autoDestroyTimeout);
49
50
  }
50
- keyTrackResolve();
51
+ propertyTrackResolve();
51
52
  for (const controller of component.M) {
52
53
  if ("triggerConnected" in controller) {
53
54
  controller.triggerConnected();
@@ -321,6 +322,7 @@ class LitElement extends LitElement$1 {
321
322
  this.#observables?.get(name)?.notify();
322
323
  }
323
324
  if (manager.T.length > 0) {
325
+ propertyTrackResolve();
324
326
  manager?.S(name, rawNewValue);
325
327
  }
326
328
  }
@@ -581,6 +583,25 @@ class DeferLoad extends Directive {
581
583
  }
582
584
  const deferLoad = /* @__PURE__ */ directive$1(DeferLoad)();
583
585
  const deferredLoaders = /* @__PURE__ */ new Map();
586
+ class StabilizedRef extends Directive {
587
+ #refValue;
588
+ #callback;
589
+ constructor(partInfo) {
590
+ super(partInfo);
591
+ const that = this;
592
+ this.#callback = function ref2(element) {
593
+ return that.#refValue.call(this, element);
594
+ };
595
+ }
596
+ render(refValue) {
597
+ if (typeof refValue === "function") {
598
+ this.#refValue = refValue;
599
+ return ref(this.#callback);
600
+ }
601
+ return ref(refValue);
602
+ }
603
+ }
604
+ const stabilizedRef = directive$1(StabilizedRef);
584
605
  const directive = directive$1;
585
606
  const live = live$1;
586
607
  const nothing = nothing$2;
@@ -669,6 +690,7 @@ export {
669
690
  safeClassMap,
670
691
  safeStyleMap,
671
692
  setAttribute,
693
+ stabilizedRef,
672
694
  state,
673
695
  stringOrBoolean
674
696
  };
@@ -4,8 +4,10 @@ import { ClassInfo } from 'lit-html/directives/class-map.js';
4
4
  import { DirectiveResult } from 'lit/directive.js';
5
5
  import { ClassMapDirective } from 'lit/directives/class-map.js';
6
6
  import { StyleMapDirective } from 'lit/directives/style-map.js';
7
- import { DirectiveClass, ElementPart, Directive } from 'lit-html/directive.js';
7
+ import { DirectiveClass, ElementPart, PartInfo, Directive } from 'lit-html/directive.js';
8
8
  import { noChange } from 'lit';
9
+ import { CustomAttributes } from './baseTypes';
10
+ import { RefDirective } from 'lit/directives/ref.js';
9
11
  /**
10
12
  * You likely won't have to import this directly. It will be added during
11
13
  * _JSX to lit-html_ conversion.
@@ -72,6 +74,32 @@ export declare const deferLoad: DirectiveResult<typeof DeferLoad>;
72
74
  * [Documentation](https://qawebgis.esri.com/components/lumina/jsx#deferring-web-component-load)
73
75
  */
74
76
  export declare const deferredLoaders: Map<string, () => Promise<unknown>>;
77
+ declare class StabilizedRef extends Directive {
78
+ #private;
79
+ constructor(partInfo: PartInfo);
80
+ render(refValue: CustomAttributes<Element>["ref"]): DirectiveResult<typeof RefDirective>;
81
+ }
82
+ /**
83
+ * Because of how Lit's ref() works, there are two requirements on ref
84
+ * function:
85
+ * - It must be stable between re-renders (else Lit will call it twice on each
86
+ * render() - with undefined and then with element)
87
+ * - Each element must have a unique instance of this function - if two
88
+ * elements share the same ref function, on each render Lit will call
89
+ * it multiple times (undefined, element1, undefined, element2)
90
+ *
91
+ * The `stabilizedRef` directive resolves both of these requirements by creating
92
+ * a stable wrapper function for the ref callback.
93
+ *
94
+ * @private
95
+ * Lumina will insert this directive automatically when the `ref` JSX prop is
96
+ * authored in a way that clearly creates a new function on each render:
97
+ * ```tsx
98
+ * <my-component ref={(el) => this.myComponent = el} />
99
+ * <my-component ref={this.callback.bind(this, index)} />
100
+ * ```
101
+ */
102
+ export declare const stabilizedRef: <T extends Element>(refValue: CustomAttributes<T>["ref"]) => DirectiveResult<typeof StabilizedRef>;
75
103
  /**
76
104
  * Creates a user-facing directive function from a Directive class. This
77
105
  * function has the same parameters as the directive's render() method.
@@ -1,5 +1,5 @@
1
1
  import { b as setParentController, d as retrieveParentControllers, j as setAmbientChildController, f as bypassReadOnly } from "./ControllerInternals-CWQrfEA8.js";
2
- import { t as trackKey } from "./Controller-ik0igmGm.js";
2
+ import { t as trackKey } from "./Controller-ftAEcdmI.js";
3
3
  const proxyExports = (Class) => (...args) => {
4
4
  const ambientControllers = retrieveParentControllers();
5
5
  const instance = new Class(...args);
package/dist/render.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import { JsxNode } from './jsx/types';
2
2
  /**
3
3
  * Retrieve an HTML element to be manually appended to an existing component.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const fullScreen = renderElement(<arcgis-fullscreen />);
8
+ * document.body.appendChild(fullScreen);
9
+ * ```
4
10
  */
5
11
  export declare const renderElement: <Element extends HTMLElement = HTMLElement>(element: JsxNode) => Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.34.0-next.67",
3
+ "version": "4.34.0-next.69",
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/toolkit": "4.34.0-next.67",
25
+ "@arcgis/toolkit": "4.34.0-next.69",
26
26
  "csstype": "^3.1.3",
27
27
  "tslib": "^2.8.1"
28
28
  },