@arcgis/lumina 4.32.0-next.2 → 4.32.0-next.21

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.
@@ -36,6 +36,9 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
36
36
  /** @internal */
37
37
  static runtime: Runtime;
38
38
  static tagName: string;
39
+ /**
40
+ * Customize Lit's default style handling to support non-shadow-root styles
41
+ */
39
42
  static finalizeStyles(styles?: CSSResultGroup): CSSResultOrNative[];
40
43
  static createProperty(name: PropertyKey,
41
44
  /**
@@ -2,9 +2,6 @@
2
2
  var lazyMetaGroupJoiner = ";";
3
3
  var lazyMetaItemJoiner = ",";
4
4
  var lazyMetaSubItemJoiner = ":";
5
- var defaultEventBubbles = true;
6
- var defaultEventCancelable = true;
7
- var defaultEventComposed = true;
8
5
  var PropertyFlags = /* @__PURE__ */ ((PropertyFlags2) => {
9
6
  PropertyFlags2[PropertyFlags2["ATTRIBUTE"] = 1] = "ATTRIBUTE";
10
7
  PropertyFlags2[PropertyFlags2["REFLECT"] = 2] = "REFLECT";
@@ -20,8 +17,5 @@ export {
20
17
  lazyMetaGroupJoiner,
21
18
  lazyMetaItemJoiner,
22
19
  lazyMetaSubItemJoiner,
23
- defaultEventBubbles,
24
- defaultEventCancelable,
25
- defaultEventComposed,
26
20
  PropertyFlags
27
21
  };
package/dist/config.d.ts CHANGED
@@ -6,14 +6,6 @@
6
6
  export declare const lazyMetaGroupJoiner = ";";
7
7
  export declare const lazyMetaItemJoiner = ",";
8
8
  export declare const lazyMetaSubItemJoiner = ":";
9
- /**
10
- * While these defaults don't match DOM defaults (all false), they match
11
- * Stencil and Shoelace defaults. Also, they make more sense for our
12
- * usage (i.e why would you want events to not be cancelable by default?)
13
- */
14
- export declare const defaultEventBubbles = true;
15
- export declare const defaultEventCancelable = true;
16
- export declare const defaultEventComposed = true;
17
9
  /**
18
10
  * By default in Lit, the `@property()` decorator accepts an object. However, to
19
11
  * keep the bundle size smaller, in production builds, instead of passing it an
package/dist/config.js CHANGED
@@ -1,17 +1,11 @@
1
1
  import {
2
2
  PropertyFlags,
3
- defaultEventBubbles,
4
- defaultEventCancelable,
5
- defaultEventComposed,
6
3
  lazyMetaGroupJoiner,
7
4
  lazyMetaItemJoiner,
8
5
  lazyMetaSubItemJoiner
9
- } from "./chunk-CH52Q2MB.js";
6
+ } from "./chunk-PGHUBTOM.js";
10
7
  export {
11
8
  PropertyFlags,
12
- defaultEventBubbles,
13
- defaultEventCancelable,
14
- defaultEventComposed,
15
9
  lazyMetaGroupJoiner,
16
10
  lazyMetaItemJoiner,
17
11
  lazyMetaSubItemJoiner
@@ -0,0 +1,26 @@
1
+ import { type ControllerHost } from "@arcgis/components-controllers";
2
+ import { ContextConsumer, ContextProvider, type Context, type ContextType } from "@lit/context";
3
+ interface ContextProviderOptions<C extends Context<unknown, unknown>> {
4
+ context: C;
5
+ initialValue?: ContextType<C>;
6
+ }
7
+ interface ContextConsumerOptions<C extends Context<unknown, unknown>> {
8
+ context: C;
9
+ callback?: (value: ContextType<C>, dispose?: () => void) => void;
10
+ subscribe?: boolean;
11
+ }
12
+ /**
13
+ * Wrapper for Lit's ContextProvider controller to provide lazy-loading compatibility.
14
+ *
15
+ * @see https://lit.dev/docs/data/context/
16
+ */
17
+ export declare function useContextProvider<C extends Context<unknown, unknown>>(options: ContextProviderOptions<C>): ContextProvider<C>;
18
+ /**
19
+ * Wrapper for Lit's ContextConsumer controller to provide lazy-loading compatibility.
20
+ *
21
+ * @see https://lit.dev/docs/data/context/
22
+ *
23
+ * FEATURE: wrap this in proxyExports to improve DX, or keep it simple?
24
+ */
25
+ export declare function useContextConsumer<C extends Context<unknown, unknown>>(options: ContextConsumerOptions<C>): ContextConsumer<C, ControllerHost & HTMLElement>;
26
+ export {};
@@ -1,4 +1,9 @@
1
- import type { EventEmitter } from "@arcgis/components-controllers";
1
+ import type { BaseComponent, EventEmitter } from "@arcgis/components-controllers";
2
+ /**
3
+ * While these defaults don't match DOM defaults (all false), they match
4
+ * Stencil and Shoelace defaults. Also, they make more sense for our
5
+ * usage (i.e why would you want events to not be cancelable by default?)
6
+ */
2
7
  export type EventOptions = {
3
8
  /**
4
9
  * A Boolean indicating whether the event bubbles up through the DOM or not.
@@ -22,7 +27,7 @@ export type EventOptions = {
22
27
  */
23
28
  composed?: boolean;
24
29
  };
25
- export declare const createEventFactory: <T = undefined>(eventName?: string, options?: EventOptions, component?: import("@arcgis/components-controllers").BaseComponent) => EventEmitter<T>;
30
+ export declare const createEventFactory: <T = undefined>(eventName?: string, options?: EventOptions, component?: BaseComponent) => EventEmitter<T>;
26
31
  /**
27
32
  * Creates an event emitter.
28
33
  * Events emitted by your component will be included in the documentation.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { useContextProvider, useContextConsumer } from "./context";
1
2
  export type { EventOptions } from "./createEvent";
2
3
  export { createEvent } from "./createEvent";
3
4
  export { state, property, method } from "./decorators";
@@ -10,7 +11,7 @@ export type { PublicLitElement } from "./PublicLitElement";
10
11
  export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from "./runtime";
11
12
  export { makeRuntime } from "./runtime";
12
13
  export * from "./jsx/jsx";
13
- export { safeClassMap, safeStyleMap, directive, dynamicValueDirective, live } from "./jsx/directives";
14
+ export { safeClassMap, safeStyleMap, directive, live } from "./jsx/directives";
14
15
  export { nothing, noChange, setAttribute, stringOrBoolean } from "./jsx/utils";
15
16
  export { noShadowRoot } from "./utils";
16
17
  export { createPrototypeProxy } from "./wrappersUtils";
package/dist/index.js CHANGED
@@ -1,15 +1,28 @@
1
1
  import {
2
- defaultEventBubbles,
3
- defaultEventCancelable,
4
- defaultEventComposed,
5
2
  lazyMetaGroupJoiner,
6
3
  lazyMetaItemJoiner,
7
4
  lazyMetaSubItemJoiner
8
- } from "./chunk-CH52Q2MB.js";
5
+ } from "./chunk-PGHUBTOM.js";
6
+
7
+ // src/context.ts
8
+ import { retrieveComponent } from "@arcgis/components-controllers";
9
+ import { ContextConsumer, ContextProvider } from "@lit/context";
10
+ function useContextProvider(options) {
11
+ const component = retrieveComponent();
12
+ const controller = new ContextProvider(component.el, options);
13
+ component.addController(controller);
14
+ return controller;
15
+ }
16
+ function useContextConsumer(options) {
17
+ const component = retrieveComponent();
18
+ const controller = new ContextConsumer(component.el, options);
19
+ component.addController(controller);
20
+ return controller;
21
+ }
9
22
 
10
23
  // src/createEvent.ts
11
- import { retrieveComponent, trackPropertyKey, keyTrackResolve } from "@arcgis/components-controllers";
12
- var createEventFactory = (eventName = "", options = {}, component = retrieveComponent()) => {
24
+ import { retrieveComponent as retrieveComponent2, trackPropertyKey, keyTrackResolve } from "@arcgis/components-controllers";
25
+ var createEventFactory = (eventName = "", options = {}, component = retrieveComponent2()) => {
13
26
  const emitter = {
14
27
  emit: (payload) => {
15
28
  if (process.env.NODE_ENV !== "production" && !component.el.isConnected) {
@@ -25,9 +38,9 @@ var createEventFactory = (eventName = "", options = {}, component = retrieveComp
25
38
  }
26
39
  const event = new CustomEvent(eventName, {
27
40
  detail: payload,
28
- cancelable: defaultEventCancelable,
29
- bubbles: defaultEventBubbles,
30
- composed: defaultEventComposed,
41
+ cancelable: true,
42
+ bubbles: true,
43
+ composed: true,
31
44
  ...options
32
45
  });
33
46
  component.el.dispatchEvent(event);
@@ -76,7 +89,10 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
76
89
  // Called by Lit - we proxy it to this.el in ProxyComponent
77
90
  "isConnected",
78
91
  // Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
79
- "localName"
92
+ "localName",
93
+ // Called by Lit Context - we proxy it to this.el in ProxyComponent.
94
+ // Interestingly, they never call removeEventListener.
95
+ "addEventListener"
80
96
  ]);
81
97
  const customErrorMessages = {
82
98
  addEventListener: "use this.listen() or this.el.addEventListener()"
@@ -121,9 +137,6 @@ function attachToAncestor(child) {
121
137
  return false;
122
138
  }
123
139
 
124
- // src/utils.ts
125
- var noShadowRoot = {};
126
-
127
140
  // src/lazyLoad.ts
128
141
  var makeDefineCustomElements = (runtime, structure) => function defineCustomElements(windowOrOptions, options) {
129
142
  if (!globalThis.customElements) {
@@ -212,8 +225,10 @@ var ProxyComponent = class extends HtmlElement {
212
225
  this._initializeComponent({ a: ProxyClass._LitConstructor });
213
226
  } else {
214
227
  void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch((error) => {
215
- console.error(error);
216
228
  this._postLoaded.reject(error);
229
+ setTimeout(() => {
230
+ throw error;
231
+ });
217
232
  });
218
233
  }
219
234
  if (process.env.NODE_ENV !== "production") {
@@ -332,7 +347,7 @@ var ProxyComponent = class extends HtmlElement {
332
347
  }
333
348
  connectedCallback() {
334
349
  if (this._litElement) {
335
- this._litElement.connectedCallback();
350
+ this._litElement.connectedCallback?.();
336
351
  } else {
337
352
  queueMicrotask(() => {
338
353
  this._ancestorLoad = attachToAncestor(this);
@@ -340,19 +355,20 @@ var ProxyComponent = class extends HtmlElement {
340
355
  }
341
356
  }
342
357
  disconnectedCallback() {
343
- this._litElement?.disconnectedCallback();
358
+ this._litElement?.disconnectedCallback?.();
344
359
  }
345
360
  /**
346
361
  * Create a promise that resolves once component is fully loaded
347
362
  */
348
363
  async componentOnReady() {
349
364
  await this._postLoaded.promise;
350
- return this._litElement;
365
+ return this;
351
366
  }
352
367
  /** @internal */
353
368
  _initializeComponent(module) {
354
369
  const ProxyClass = this.constructor;
355
370
  const tagName = ProxyClass._name;
371
+ const store = this._store;
356
372
  if (process.env.NODE_ENV !== "production") {
357
373
  Object.entries(module).forEach(([name, LitConstructor2]) => {
358
374
  if (name !== "exportsForTests" && typeof LitConstructor2 !== "function" || typeof LitConstructor2.tagName !== "string") {
@@ -371,27 +387,32 @@ var ProxyComponent = class extends HtmlElement {
371
387
  );
372
388
  }
373
389
  const lazyTagName = process.env.NODE_ENV === "production" ? `${tagName}--lazy` : (ProxyClass._hmrIndex ?? 0) === 0 ? `${tagName}--lazy` : `${tagName}--lazy-${ProxyClass._hmrIndex}`;
374
- const isFirstInitialization = !ProxyClass._LitConstructor;
375
- if (isFirstInitialization) {
376
- ProxyClass._LitConstructor = LitConstructor;
377
- LitConstructor.prototype.removeAttribute = function(qualifiedName) {
378
- HTMLElement.prototype.removeAttribute.call(this.el, qualifiedName);
390
+ let parentClass = LitConstructor;
391
+ while (parentClass && !Object.hasOwn(parentClass, "lumina")) {
392
+ parentClass = Object.getPrototypeOf(parentClass);
393
+ }
394
+ const litElementPrototype = parentClass.prototype;
395
+ const elementPrototype = Element.prototype;
396
+ const alreadyPatched = Object.hasOwn(litElementPrototype, "isConnected");
397
+ if (!alreadyPatched) {
398
+ litElementPrototype.setAttribute = function(qualifiedName, value) {
399
+ elementPrototype.setAttribute.call(this.el, qualifiedName, value);
379
400
  };
380
- LitConstructor.prototype.setAttribute = function(qualifiedName, value) {
381
- HTMLElement.prototype.setAttribute.call(this.el, qualifiedName, value);
401
+ litElementPrototype.removeAttribute = function(qualifiedName) {
402
+ elementPrototype.removeAttribute.call(this.el, qualifiedName);
382
403
  };
383
- defineProperty(LitConstructor.prototype, "isConnected", {
404
+ defineProperty(litElementPrototype, "isConnected", {
384
405
  get() {
385
- return this.el.isConnected;
406
+ return Reflect.get(elementPrototype, "isConnected", this.el);
386
407
  }
387
408
  });
388
- if (process.env.NODE_ENV !== "production" && LitConstructor.shadowRootOptions !== noShadowRoot) {
389
- let prototype = LitConstructor;
390
- while (prototype && !Object.hasOwn(prototype, "lumina")) {
391
- prototype = Object.getPrototypeOf(prototype);
392
- }
393
- devOnlyDetectIncorrectLazyUsages(prototype);
394
- }
409
+ }
410
+ if (process.env.NODE_ENV !== "production") {
411
+ devOnlyDetectIncorrectLazyUsages(parentClass);
412
+ }
413
+ const isFirstInitialization = !ProxyClass._LitConstructor;
414
+ if (isFirstInitialization) {
415
+ ProxyClass._LitConstructor = LitConstructor;
395
416
  customElements.define(lazyTagName, LitConstructor);
396
417
  }
397
418
  LitConstructor.lazy = this;
@@ -406,6 +427,7 @@ var ProxyComponent = class extends HtmlElement {
406
427
  } else {
407
428
  this._litElement = litElement;
408
429
  }
430
+ this._store = litElement;
409
431
  this._pendingAttributes.forEach((name) => {
410
432
  const value = this.getAttribute(name);
411
433
  litElement.attributeChangedCallback(
@@ -415,8 +437,7 @@ var ProxyComponent = class extends HtmlElement {
415
437
  value
416
438
  );
417
439
  });
418
- Object.entries(this._store).forEach(syncLitElement, litElement);
419
- this._store = litElement;
440
+ Object.entries(store).forEach(syncLitElement, litElement);
420
441
  if (process.env.NODE_ENV !== "production") {
421
442
  const litObserved = LitConstructor.observedAttributes ?? [];
422
443
  const lazyObserved = ProxyClass.observedAttributes ?? [];
@@ -441,6 +462,17 @@ var ProxyComponent = class extends HtmlElement {
441
462
  }
442
463
  }
443
464
  }
465
+ /**
466
+ * Implemented on the proxy for compatibility with Lit Context.
467
+ */
468
+ addController() {
469
+ }
470
+ /**
471
+ * Implemented on the proxy for compatibility with Lit Context.
472
+ */
473
+ requestUpdate() {
474
+ this._litElement?.requestUpdate();
475
+ }
444
476
  };
445
477
  function syncLitElement([key, value]) {
446
478
  this[key] = value;
@@ -448,6 +480,11 @@ function syncLitElement([key, value]) {
448
480
 
449
481
  // src/hmrSupport.ts
450
482
  import { camelToKebab as camelToKebab2 } from "@arcgis/components-utils";
483
+
484
+ // src/utils.ts
485
+ var noShadowRoot = {};
486
+
487
+ // src/hmrSupport.ts
451
488
  function handleHmrUpdate(newModules) {
452
489
  newModules.forEach((newModule) => {
453
490
  if (newModule === void 0) {
@@ -484,6 +521,21 @@ function handleHmrUpdate(newModules) {
484
521
  }
485
522
  function reInitialize(instance, newModule) {
486
523
  const PreviousLitConstructor = instance._litElement.constructor;
524
+ const isShadowRoot = PreviousLitConstructor.shadowRootOptions !== noShadowRoot;
525
+ if (!isShadowRoot) {
526
+ const root = instance.getRootNode() ?? document;
527
+ if ("adoptedStyleSheets" in root) {
528
+ const rootStyles = Array.from(root.adoptedStyleSheets);
529
+ PreviousLitConstructor.elementStyles.forEach((style) => {
530
+ const styleSheet = "styleSheet" in style ? style.styleSheet : style;
531
+ const index = rootStyles.lastIndexOf(styleSheet);
532
+ if (index > -1) {
533
+ rootStyles.splice(index, 1);
534
+ }
535
+ });
536
+ root.adoptedStyleSheets = rootStyles;
537
+ }
538
+ }
487
539
  const properties = PreviousLitConstructor.elementProperties;
488
540
  const preservedProperties = Array.from(properties.entries()).filter(
489
541
  ([propertyName, descriptor]) => typeof propertyName === "string" && (instance._hmrSetProps.has(propertyName) || typeof descriptor.attribute === "string" && instance._hmrSetAttributes.has(descriptor.attribute))
@@ -501,10 +553,11 @@ function handleComponentMetaUpdate(meta) {
501
553
  return;
502
554
  }
503
555
  const attributes = meta.properties.map(([property2, attribute]) => attribute ?? camelToKebab2(property2)).filter(Boolean);
556
+ const observedAttributes = initializeAttributeObserver();
504
557
  observedAttributes[meta.tagName] ??= {};
505
558
  observedAttributes[meta.tagName].original ??= new Set(ProxyClass.observedAttributes);
506
559
  const originallyObserved = observedAttributes[meta.tagName].original;
507
- observedAttributes[meta.tagName].manuallyObserved ??= new Set(
560
+ observedAttributes[meta.tagName].manuallyObserved = new Set(
508
561
  /**
509
562
  * Never manually observe attributes that were in the original
510
563
  * observedAttributes as those would be observed by the browser
@@ -516,27 +569,30 @@ function handleComponentMetaUpdate(meta) {
516
569
  ProxyClass._properties = meta.properties.map(([name]) => name);
517
570
  ProxyClass.observedAttributes = attributes;
518
571
  }
519
- var observedAttributesSymbol = Symbol.for("@arcgis/lumina:observedAttributes");
520
- var globalThisWithObservedAttributes = globalThis;
521
- var alreadyHadObservers = observedAttributesSymbol in globalThisWithObservedAttributes;
522
- globalThisWithObservedAttributes[observedAttributesSymbol] ??= {};
523
- var observedAttributes = globalThisWithObservedAttributes[observedAttributesSymbol];
524
- if (!alreadyHadObservers) {
525
- const makeObserver = (original) => function observeAttributes(qualifiedName, ...rest) {
526
- const observed = observedAttributes[this.tagName.toLowerCase()]?.manuallyObserved;
527
- if (observed?.has(qualifiedName)) {
528
- const oldValue = this.getAttribute(qualifiedName);
529
- const returns = original.call(this, qualifiedName, ...rest);
530
- const newValue = this.getAttribute(qualifiedName);
531
- this.attributeChangedCallback(qualifiedName, oldValue, newValue);
532
- return returns;
533
- } else {
534
- return original.call(this, qualifiedName, ...rest);
535
- }
536
- };
537
- ProxyComponent.prototype.setAttribute = makeObserver(ProxyComponent.prototype.setAttribute);
538
- ProxyComponent.prototype.toggleAttribute = makeObserver(ProxyComponent.prototype.toggleAttribute);
539
- ProxyComponent.prototype.removeAttribute = makeObserver(ProxyComponent.prototype.removeAttribute);
572
+ function initializeAttributeObserver() {
573
+ const observedAttributesSymbol = Symbol.for("@arcgis/lumina:observedAttributes");
574
+ const globalThisWithObservedAttributes = globalThis;
575
+ const alreadyHadObservers = observedAttributesSymbol in globalThisWithObservedAttributes;
576
+ globalThisWithObservedAttributes[observedAttributesSymbol] ??= {};
577
+ const observedAttributes = globalThisWithObservedAttributes[observedAttributesSymbol];
578
+ if (!alreadyHadObservers) {
579
+ const makeObserver = (original) => function observeAttributes(qualifiedName, ...rest) {
580
+ const observed = observedAttributes[this.tagName.toLowerCase()]?.manuallyObserved;
581
+ if (observed?.has(qualifiedName)) {
582
+ const oldValue = this.getAttribute(qualifiedName);
583
+ const returns = original.call(this, qualifiedName, ...rest);
584
+ const newValue = this.getAttribute(qualifiedName);
585
+ this.attributeChangedCallback(qualifiedName, oldValue, newValue);
586
+ return returns;
587
+ } else {
588
+ return original.call(this, qualifiedName, ...rest);
589
+ }
590
+ };
591
+ ProxyComponent.prototype.setAttribute = makeObserver(ProxyComponent.prototype.setAttribute);
592
+ ProxyComponent.prototype.toggleAttribute = makeObserver(ProxyComponent.prototype.toggleAttribute);
593
+ ProxyComponent.prototype.removeAttribute = makeObserver(ProxyComponent.prototype.removeAttribute);
594
+ }
595
+ return observedAttributes;
540
596
  }
541
597
 
542
598
  // src/LitElement.ts
@@ -598,13 +654,15 @@ var LitElement = class _LitElement extends OriginalLitElement {
598
654
  this.el.setAttribute(this.constructor.runtime.hydratedAttribute, "");
599
655
  }
600
656
  }
657
+ /**
658
+ * Customize Lit's default style handling to support non-shadow-root styles
659
+ */
601
660
  static finalizeStyles(styles) {
602
661
  if (process.env.NODE_ENV === "test" && Array.isArray(styles)) {
603
662
  styles = styles.filter(Boolean);
604
663
  }
605
664
  const finalizedStyles = super.finalizeStyles(styles);
606
- const options = this.constructor.shadowRootOptions;
607
- const useLightDom = options === noShadowRoot;
665
+ const useLightDom = this.shadowRootOptions === noShadowRoot;
608
666
  return this.runtime?.commonStyles === void 0 || useLightDom ? finalizedStyles : [this.runtime.commonStyles, ...finalizedStyles];
609
667
  }
610
668
  static createProperty(name, options) {
@@ -655,8 +713,10 @@ var LitElement = class _LitElement extends OriginalLitElement {
655
713
  queueMicrotask(
656
714
  // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async
657
715
  () => this._load().catch((error) => {
658
- console.error(error);
659
716
  this._postLoaded.reject(error);
717
+ setTimeout(() => {
718
+ throw error;
719
+ });
660
720
  })
661
721
  );
662
722
  }
@@ -797,47 +857,11 @@ var bindEvent = void 0;
797
857
  // src/jsx/directives.ts
798
858
  import { classMap } from "lit-html/directives/class-map.js";
799
859
  import { styleMap } from "lit/directives/style-map.js";
800
- import { Directive } from "lit-html/directive.js";
801
860
  import { directive as litDirective } from "lit-html/directive.js";
802
861
  import { live as litLive } from "lit-html/directives/live.js";
803
862
  var safeClassMap = (parameters) => typeof parameters === "object" && parameters != null ? classMap(parameters) : parameters;
804
863
  var safeStyleMap = (parameters) => typeof parameters === "object" && parameters != null ? styleMap(parameters) : parameters;
805
864
  var directive = litDirective;
806
- var DynamicHtmlValueDirective = class extends Directive {
807
- update(part, [prop, value]) {
808
- if (process.env.NODE_ENV !== "production") {
809
- if (part.type !== 6) {
810
- throw new Error("DynamicHtmlValueDirective can only be used in the element part position");
811
- }
812
- if (prop !== "value" && prop !== "defaultValue") {
813
- throw new Error('Expected the first argument to DynamicHtmlValueDirective to be "value" or "defaultValue"');
814
- }
815
- if (typeof value === "object" && value != null) {
816
- if ("_$litDirective$" in value) {
817
- throw new Error(
818
- "Directive is not supported as a value for the `value` or `defaultValue` prop when the tag name is dynamic."
819
- );
820
- } else {
821
- throw new Error(
822
- `Tried to set an object as the value/defaultValue prop in a <${part.element.tagName}> element.`
823
- );
824
- }
825
- }
826
- }
827
- const element = part.element;
828
- const tagName = element.tagName;
829
- if (prop === "value" ? tagName === "INPUT" : tagName === "BUTTON" || tagName === "DATA") {
830
- if (element[prop] !== value) {
831
- element[prop] = value;
832
- }
833
- } else if (value != null) {
834
- element.setAttribute("value", value);
835
- } else {
836
- element.removeAttribute("value");
837
- }
838
- }
839
- };
840
- var dynamicValueDirective = directive(DynamicHtmlValueDirective);
841
865
  var live = litLive;
842
866
 
843
867
  // src/jsx/utils.ts
@@ -884,7 +908,6 @@ export {
884
908
  createEvent,
885
909
  createPrototypeProxy,
886
910
  directive,
887
- dynamicValueDirective,
888
911
  handleComponentMetaUpdate,
889
912
  handleHmrUpdate,
890
913
  live,
@@ -899,5 +922,7 @@ export {
899
922
  safeStyleMap,
900
923
  setAttribute,
901
924
  state,
902
- stringOrBoolean
925
+ stringOrBoolean,
926
+ useContextConsumer,
927
+ useContextProvider
903
928
  };
@@ -60,14 +60,6 @@ export declare const safeStyleMap: (parameters: CssProperties | Nil | string) =>
60
60
  * "never" to allow it be set as a value for any JSX attribute.
61
61
  */
62
62
  export declare const directive: <C extends DirectiveClass>(c: C) => (...values: Parameters<InstanceType<C>["render"]>) => never;
63
- /**
64
- * Do not import this directly. It will be inserted automatically by JSX to
65
- * lit-html transformer when you are setting "value" or "defaultValue" JSX prop
66
- * in an element with dynamic tag name.
67
- *
68
- * @internal
69
- */
70
- export declare const dynamicValueDirective: (...values: never) => never;
71
63
  /**
72
64
  * Checks binding values against live DOM values, instead of previously bound
73
65
  * values, when determining whether to update the value.
package/dist/jsx/jsx.d.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  * /// <reference types="@arcgis/lumina/typings" />
7
7
  * ```
8
8
  */
9
- /// <reference path="../typings/jsxGlobals.d.ts" />
10
9
  import type { Properties as CssProperties } from "csstype";
11
10
  import type { TemplateResult } from "lit-html";
12
11
  import type { DirectiveResult } from "lit-html/directive.js";
@@ -843,6 +842,7 @@ export declare namespace LuminaJsx {
843
842
  }
844
843
  interface HTMLAttributes<T = HTMLElement> extends AriaAttributes, DOMAttributes<T>, RdfaAttributes {
845
844
  accessKey?: string;
845
+ autofocus?: boolean;
846
846
  dir?: HTMLDir;
847
847
  draggable?: boolean;
848
848
  hidden?: boolean | "hidden" | "until-found";
@@ -922,7 +922,6 @@ export declare namespace LuminaJsx {
922
922
  cite?: string;
923
923
  }
924
924
  interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
925
- autofocus?: boolean;
926
925
  disabled?: boolean;
927
926
  form?: string;
928
927
  name?: string;
@@ -1031,7 +1030,6 @@ export declare namespace LuminaJsx {
1031
1030
  autocomplete?: AutoFill;
1032
1031
  accept?: string;
1033
1032
  alt?: string;
1034
- autofocus?: boolean;
1035
1033
  capture?: boolean | string;
1036
1034
  checked?: boolean;
1037
1035
  disabled?: boolean;
@@ -1293,6 +1291,8 @@ export declare namespace LuminaJsx {
1293
1291
  form?: string;
1294
1292
  for?: string;
1295
1293
  name?: string;
1294
+ value?: string | number;
1295
+ defaultValue?: string | number;
1296
1296
  }
1297
1297
  interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
1298
1298
  max?: number | string;
@@ -1311,7 +1311,6 @@ export declare namespace LuminaJsx {
1311
1311
  referrerPolicy?: HTMLReferrerPolicy;
1312
1312
  }
1313
1313
  interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
1314
- autofocus?: boolean;
1315
1314
  disabled?: boolean;
1316
1315
  form?: string;
1317
1316
  multiple?: boolean;
@@ -1348,7 +1347,6 @@ export declare namespace LuminaJsx {
1348
1347
  }
1349
1348
  interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
1350
1349
  children?: "Error: Use value property instead. See https://lit.dev/docs/templates/expressions/#invalid-locations";
1351
- autofocus?: boolean;
1352
1350
  cols?: number | string;
1353
1351
  dirname?: string;
1354
1352
  disabled?: boolean;
@@ -1862,7 +1860,7 @@ export declare namespace LuminaJsx {
1862
1860
  base: BaseHTMLAttributes<HTMLBaseElement>;
1863
1861
  bdi: HTMLAttributes;
1864
1862
  bdo: HTMLAttributes;
1865
- blockquote: BlockquoteHTMLAttributes<HTMLElement>;
1863
+ blockquote: BlockquoteHTMLAttributes<HTMLQuoteElement>;
1866
1864
  body: HTMLAttributes<HTMLBodyElement>;
1867
1865
  br: HTMLAttributes<HTMLBRElement>;
1868
1866
  button: ButtonHTMLAttributes<HTMLButtonElement>;
@@ -1872,7 +1870,7 @@ export declare namespace LuminaJsx {
1872
1870
  code: HTMLAttributes;
1873
1871
  col: ColHTMLAttributes<HTMLTableColElement>;
1874
1872
  colgroup: ColgroupHTMLAttributes<HTMLTableColElement>;
1875
- data: DataHTMLAttributes<HTMLElement>;
1873
+ data: DataHTMLAttributes<HTMLDataElement>;
1876
1874
  datalist: HTMLAttributes<HTMLDataListElement>;
1877
1875
  dd: HTMLAttributes;
1878
1876
  del: HTMLAttributes;
@@ -1914,16 +1912,16 @@ export declare namespace LuminaJsx {
1914
1912
  map: MapHTMLAttributes<HTMLMapElement>;
1915
1913
  math: MathMLAttributes;
1916
1914
  mark: HTMLAttributes;
1917
- menu: MenuHTMLAttributes<HTMLElement>;
1915
+ menu: MenuHTMLAttributes<HTMLMenuElement>;
1918
1916
  meta: MetaHTMLAttributes<HTMLMetaElement>;
1919
- meter: MeterHTMLAttributes<HTMLElement>;
1917
+ meter: MeterHTMLAttributes<HTMLMeterElement>;
1920
1918
  nav: HTMLAttributes;
1921
1919
  noscript: HTMLAttributes;
1922
1920
  object: ObjectHTMLAttributes<HTMLObjectElement>;
1923
1921
  ol: OlHTMLAttributes<HTMLOListElement>;
1924
1922
  optgroup: OptgroupHTMLAttributes<HTMLOptGroupElement>;
1925
1923
  option: OptionHTMLAttributes<HTMLOptionElement>;
1926
- output: OutputHTMLAttributes<HTMLElement>;
1924
+ output: OutputHTMLAttributes<HTMLOutputElement>;
1927
1925
  p: HTMLAttributes<HTMLParagraphElement>;
1928
1926
  picture: HTMLAttributes;
1929
1927
  pre: HTMLAttributes<HTMLPreElement>;
@@ -1961,7 +1959,7 @@ export declare namespace LuminaJsx {
1961
1959
  tfoot: HTMLAttributes<HTMLTableSectionElement>;
1962
1960
  th: ThHTMLAttributes<HTMLTableCellElement>;
1963
1961
  thead: HTMLAttributes<HTMLTableSectionElement>;
1964
- time: TimeHTMLAttributes<HTMLElement>;
1962
+ time: TimeHTMLAttributes<HTMLTimeElement>;
1965
1963
  title: HTMLAttributes<HTMLTitleElement>;
1966
1964
  tr: HTMLAttributes<HTMLTableRowElement>;
1967
1965
  track: TrackHTMLAttributes<HTMLTrackElement>;
@@ -2,6 +2,7 @@ import { Deferred } from "@arcgis/components-utils";
2
2
  import type { LitElement } from "./LitElement";
3
3
  import type { Runtime } from "./runtime";
4
4
  import type { ControllerManager } from "@arcgis/components-controllers";
5
+ import type { PublicLitElement } from "./PublicLitElement";
5
6
  /**
6
7
  * Defines lazy-loading proxy components for all web components in this package.
7
8
  *
@@ -105,7 +106,9 @@ export declare abstract class ProxyComponent extends HtmlElement {
105
106
  /**
106
107
  * Direct offspring that should be awaited before loaded() is emitted
107
108
  */
108
- _offspring: (Element & Partial<Pick<LitElement, "manager">> & Pick<LitElement, "componentOnReady">)[];
109
+ _offspring: (PublicLitElement & {
110
+ manager?: LitElement["manager"];
111
+ })[];
109
112
  /**
110
113
  * Promise that resolves once parent's load() completed. False if there is no
111
114
  * parent
@@ -147,9 +150,17 @@ export declare abstract class ProxyComponent extends HtmlElement {
147
150
  /**
148
151
  * Create a promise that resolves once component is fully loaded
149
152
  */
150
- componentOnReady(): Promise<LitElement>;
153
+ componentOnReady(): Promise<this>;
151
154
  /** @internal */
152
155
  _initializeComponent(module: Record<string, typeof LitElement>): void;
156
+ /**
157
+ * Implemented on the proxy for compatibility with Lit Context.
158
+ */
159
+ addController(): void;
160
+ /**
161
+ * Implemented on the proxy for compatibility with Lit Context.
162
+ */
163
+ requestUpdate(): void;
153
164
  }
154
165
  export type GlobalThisWithPuppeteerEnv = typeof globalThis & {
155
166
  devOnly$createdElements?: WeakRef<ProxyComponent>[];
package/dist/runtime.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { LitElement } from "./LitElement";
8
8
  export type Runtime = RuntimeOptions & {
9
9
  /**
10
10
  * Get the base path to where the package assets can be found.
11
- * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
11
+ * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
12
12
  * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
13
13
  * It is CORS-enabled, so you can load the assets from any domain.
14
14
  * Use "setAssetPath(path)" if the path needs to be customized.
@@ -18,8 +18,8 @@ export type Runtime = RuntimeOptions & {
18
18
  * Used to manually set the base path where package assets (like localization
19
19
  * and icons) can be found.
20
20
  *
21
- * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
22
- * For example, "https://js.arcgis.com/map-components/4.30/".
21
+ * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
22
+ * For example, `https://js.arcgis.com/map-components/4.30/`.
23
23
  * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
24
24
  * It is CORS-enabled, so you can load the assets from any domain.
25
25
  * This is the recommended way to load the assets and avoid bundling them with your application.
@@ -2,7 +2,6 @@
2
2
  * Lots of silencing of ESLint in this file to be compatible with Stencil's
3
3
  * unsafe typings.
4
4
  */
5
- /// <reference types="node" />
6
5
  import { type RenderInfo } from "@lit-labs/ssr/lib/render.js";
7
6
  import type { Readable } from "node:stream";
8
7
  /**
@@ -1,4 +1,4 @@
1
- /// <reference path="jsxGlobals.d.ts" />
2
- /// <reference path="loadLitCss.d.ts" />
3
- /// <reference path="viteEnv.d.ts" />
4
- /// <reference path="importMeta.d.ts" />
1
+ /// <reference path="jsxGlobals.d.ts" preserve="true" />
2
+ /// <reference path="loadLitCss.d.ts" preserve="true" />
3
+ /// <reference path="viteEnv.d.ts" preserve="true" />
4
+ /// <reference path="importMeta.d.ts" preserve="true" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.32.0-next.2",
3
+ "version": "4.32.0-next.21",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -17,33 +17,15 @@
17
17
  "files": [
18
18
  "dist/"
19
19
  ],
20
- "publishConfig": {
21
- "registry": "https://registry.npmjs.org/",
22
- "access": "public"
23
- },
24
20
  "license": "SEE LICENSE IN LICENSE.md",
25
- "scripts": {
26
- "build": "tsup",
27
- "build:dev": "tsup --sourcemap",
28
- "watch": "yarn build:dev --watch",
29
- "clean": "rimraf ./dist ./build ./turbo ./node_modules"
30
- },
31
21
  "dependencies": {
32
- "@arcgis/components-controllers": "4.32.0-next.2",
33
- "@arcgis/components-utils": "4.32.0-next.2",
22
+ "@arcgis/components-controllers": "4.32.0-next.21",
23
+ "@arcgis/components-utils": "4.32.0-next.21",
34
24
  "@lit-labs/ssr": "^3.2.2",
35
25
  "@lit-labs/ssr-client": "^1.1.7",
26
+ "@lit/context": "^1.1.3",
36
27
  "csstype": "^3.1.3",
37
28
  "lit": "^3.2.0",
38
29
  "tslib": "^2.7.0"
39
- },
40
- "devDependencies": {
41
- "@arcgis/typescript-config": "4.32.0-next.2",
42
- "@types/node": "^20.2.5",
43
- "eslint": "^8.55.0",
44
- "rimraf": "^5.0.0",
45
- "tsup": "^8.3.0",
46
- "typescript": "~5.4.0"
47
- },
48
- "gitHead": "8c9d6f7c0e88ea1b6ddbc00ebdb1c89069b0cbbf"
49
- }
30
+ }
31
+ }