@arcgis/lumina 4.31.0-next.98 → 4.32.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.
@@ -156,8 +156,17 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
156
156
  * }
157
157
  * ```
158
158
  */
159
- listen<K extends keyof HTMLElementEventMap>(type: K, listener: (this: this, event: HTMLElementEventMap[K]) => unknown, options?: AddEventListenerOptions | boolean): void;
160
- listen(type: string, listener: (this: this, event: Event) => unknown, options?: AddEventListenerOptions | boolean): void;
159
+ listen<K extends keyof HTMLElementEventMap>(name: K, listener: (this: this, event: HTMLElementEventMap[K]) => unknown, options?: AddEventListenerOptions | boolean): void;
160
+ listen(name: string, listener: (this: this, event: Event) => unknown, options?: AddEventListenerOptions | boolean): void;
161
+ listen<EventType extends Event = CustomEvent<"Provide type like this.listenOn<ToEvents<ArcgisCounter>['arcgisClick']>() to get type-checked payload type">>(name: string,
162
+ /**
163
+ * The "NoInfer" here forces type argument to be specified explicitly.
164
+ * Without it, the following would be allowed:
165
+ * ```tsx
166
+ * this.listen("focus",(event:NotFocusEvent)=>{....})
167
+ * ```
168
+ */
169
+ listener: (this: this, event: NoInfer<EventType>) => unknown, options?: AddEventListenerOptions | boolean): void;
161
170
  /**
162
171
  * A helper for setting even listener on any element (or window / document).
163
172
  *
@@ -195,7 +204,15 @@ export declare class LitElement extends OriginalLitElement implements ComponentL
195
204
  listenOn<Name extends keyof HTMLElementEventMap>(target: HTMLElement, name: Name, listener: Listener<this, HTMLElementEventMap[Name] & {
196
205
  currentTarget: HTMLElement;
197
206
  }>, options?: AddEventListenerOptions | boolean): void;
198
- listenOn<EventType extends Event = CustomEvent<"Provide type like this.listenOn<ToEvents<ArcgisCounter>['arcgisClick']>() to get type-checked payload type">, Target = EventTarget>(target: Target, name: string, listener: Listener<this, EventType & {
207
+ listenOn<EventType extends Event = CustomEvent<"Provide type like this.listenOn<ToEvents<ArcgisCounter>['arcgisClick']>() to get type-checked payload type">, Target = EventTarget>(target: Target, name: string,
208
+ /**
209
+ * The "NoInfer" here forces type argument to be specified explicitly.
210
+ * Without it, the following would be allowed:
211
+ * ```tsx
212
+ * this.listen("focus",(event:NotFocusEvent)=>{....})
213
+ * ```
214
+ */
215
+ listener: Listener<this, NoInfer<EventType> & {
199
216
  currentTarget: Target;
200
217
  }>, options?: AddEventListenerOptions | boolean): void;
201
218
  /**
@@ -4,7 +4,10 @@ import type { LitElement } from "./LitElement";
4
4
  * Instead, a proxy element is present and should be used for all DOM actions.
5
5
  *
6
6
  * In practice, this means using this.el.getAttribute() instead of
7
- * this.getAttribute() and etc for each DOM method
7
+ * this.getAttribute() and etc for each DOM method.
8
+ *
9
+ * To detect incorrect usages, this function overwrites each DOM member on the
10
+ * LitElement prototype with an exception-throwing function.
8
11
  *
9
12
  * This code does not ship in production builds.
10
13
  */
package/dist/index.d.ts CHANGED
@@ -3,13 +3,14 @@ export { createEvent } from "./createEvent";
3
3
  export { state, property, method } from "./decorators";
4
4
  export type { HmrComponentMeta } from "./hmrSupport";
5
5
  export { handleComponentMetaUpdate, handleHmrUpdate } from "./hmrSupport";
6
- export type { DefineCustomElements, LazyLoadOptions } from "./lazyLoad";
6
+ export type { DefineCustomElements, LazyLoadOptions, GlobalThisWithPuppeteerEnv } from "./lazyLoad";
7
7
  export { makeDefineCustomElements } from "./lazyLoad";
8
8
  export { LitElement } from "./LitElement";
9
9
  export type { PublicLitElement } from "./PublicLitElement";
10
10
  export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from "./runtime";
11
11
  export { makeRuntime } from "./runtime";
12
12
  export * from "./jsx/jsx";
13
- export { safeClassMap, safeStyleMap } from "./jsx/directives";
13
+ export { safeClassMap, safeStyleMap, directive, dynamicValueDirective, live } from "./jsx/directives";
14
+ export { nothing, noChange, setAttribute, stringOrBoolean } from "./jsx/utils";
14
15
  export { noShadowRoot } from "./utils";
15
16
  export { createPrototypeProxy } from "./wrappersUtils";
package/dist/index.js CHANGED
@@ -61,11 +61,21 @@ import { Deferred, camelToKebab } from "@arcgis/components-utils";
61
61
  // src/devOnlyDetectIncorrectLazyUsages.ts
62
62
  function devOnlyDetectIncorrectLazyUsages(LitClass) {
63
63
  const genericPrototype = LitClass.prototype;
64
+ const descriptor = Object.getOwnPropertyDescriptor(genericPrototype, "innerText");
65
+ if (descriptor !== void 0 && descriptor.get === descriptor.set) {
66
+ return;
67
+ }
64
68
  const allowList = /* @__PURE__ */ new Set([
65
69
  // We shouldn't be overwriting this property
66
70
  "constructor",
67
71
  // Called by Lit - we proxy it to this.el in ProxyComponent
68
- "setAttribute"
72
+ "setAttribute",
73
+ // Called by Lit SSR - we proxy it to this.el in ProxyComponent
74
+ "removeAttribute",
75
+ // Called by Lit - we proxy it to this.el in ProxyComponent
76
+ "isConnected",
77
+ // Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
78
+ "localName"
69
79
  ]);
70
80
  const customErrorMessages = {
71
81
  addEventListener: "use this.listen() or this.el.addEventListener()"
@@ -75,28 +85,36 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
75
85
  ...Object.getOwnPropertyDescriptors(Element.prototype),
76
86
  ...Object.getOwnPropertyDescriptors(Node.prototype),
77
87
  ...Object.getOwnPropertyDescriptors(EventTarget.prototype)
78
- }).filter(([key, { value }]) => typeof value === "function" && !allowList.has(key)).forEach(([key]) => {
79
- genericPrototype[key] = (...args) => {
88
+ }).forEach(([key, value]) => {
89
+ if (allowList.has(key)) {
90
+ return;
91
+ }
92
+ const callback = (...args) => {
80
93
  if (key === "hasAttribute" && args[0] === "defer-hydration") {
81
94
  return false;
82
95
  }
83
96
  throw new Error(
84
- `You should not be calling this.${key}() directly as it won't work correctly in lazy-builds. Instead, ${customErrorMessages[key] ?? `use this.el.${key}()`}`
97
+ `You should not be trying to access this.${key} directly as it won't work correctly in lazy-builds. Instead, ${customErrorMessages[key] ?? `use this.el.${key}`}`
85
98
  );
86
99
  };
100
+ if (typeof value.value === "function") {
101
+ genericPrototype[key] = callback;
102
+ } else {
103
+ Object.defineProperty(genericPrototype, key, { get: callback, set: callback });
104
+ }
87
105
  });
88
106
  }
89
107
 
90
108
  // src/lifecycleSupport.ts
91
- function attachToAncestor(child, el) {
92
- let ancestor = el;
109
+ function attachToAncestor(child) {
110
+ let ancestor = child;
93
111
  while (ancestor = ancestor.parentNode ?? ancestor.host) {
94
112
  if (ancestor?.constructor?.lumina) {
95
113
  const litParent = ancestor;
96
114
  if (!litParent.manager?.loadedCalled) {
97
115
  litParent._offspring.push(child);
98
116
  }
99
- return litParent._postLoad?.promise;
117
+ return litParent._postLoad.promise;
100
118
  }
101
119
  }
102
120
  return false;
@@ -151,6 +169,7 @@ function createLazyElement([tagName, [load, compactMeta = ""]]) {
151
169
  };
152
170
  customElements.define(tagName, ProxyClass);
153
171
  }
172
+ var defineProperty = Object.defineProperty;
154
173
  function parseCondensedProp(propAndAttribute) {
155
174
  const name = propAndAttribute.split(lazyMetaSubItemJoiner);
156
175
  return name.length === 1 ? [name[0], camelToKebab(name[0])] : name;
@@ -159,15 +178,6 @@ var HtmlElement = globalThis.HTMLElement ?? parseCondensedProp;
159
178
  var ProxyComponent = class extends HtmlElement {
160
179
  constructor() {
161
180
  super();
162
- /**
163
- * On HMR, preserve the values of all properties that at least once were set
164
- * by someone other than component itself.
165
- *
166
- * @internal
167
- */
168
- this._hmrSetProps = /* @__PURE__ */ new Set();
169
- /** @internal */
170
- this._hmrSetAttributes = /* @__PURE__ */ new Set();
171
181
  /** @internal */
172
182
  this._store = {};
173
183
  /**
@@ -189,16 +199,30 @@ var ProxyComponent = class extends HtmlElement {
189
199
  * Direct offspring that should be awaited before loaded() is emitted
190
200
  */
191
201
  this._offspring = [];
202
+ if (process.env.NODE_ENV !== "production") {
203
+ this._hmrSetProps = /* @__PURE__ */ new Set();
204
+ this._hmrSetAttributes = /* @__PURE__ */ new Set();
205
+ globalThis.devOnly$createdElements ??= [];
206
+ globalThis.devOnly$createdElements.push(new WeakRef(this));
207
+ }
192
208
  this._saveInstanceProperties();
193
209
  const ProxyClass = this.constructor;
194
210
  if (ProxyClass._LitConstructor) {
195
211
  this._initializeComponent({ a: ProxyClass._LitConstructor });
196
212
  } else {
197
- void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch(this._postLoaded.reject);
213
+ void ProxyClass._loadPromise.then(this._initializeComponent.bind(this)).catch((error) => {
214
+ console.error(error);
215
+ this._postLoaded.reject(error);
216
+ });
198
217
  }
199
218
  if (process.env.NODE_ENV !== "production") {
200
219
  ProxyClass._hmrInstances ??= [];
201
220
  ProxyClass._hmrInstances.push(new WeakRef(this));
221
+ Object.defineProperty(this, "_store", {
222
+ value: this._store,
223
+ enumerable: false,
224
+ configurable: true
225
+ });
202
226
  }
203
227
  }
204
228
  static {
@@ -211,7 +235,7 @@ var ProxyComponent = class extends HtmlElement {
211
235
  this._syncMethods?.forEach(this._bindSync, this);
212
236
  }
213
237
  static _bindProp(propName) {
214
- Object.defineProperty(this.prototype, propName, {
238
+ defineProperty(this.prototype, propName, {
215
239
  configurable: true,
216
240
  enumerable: true,
217
241
  get() {
@@ -226,7 +250,7 @@ var ProxyComponent = class extends HtmlElement {
226
250
  });
227
251
  }
228
252
  static _bindAsync(methodName) {
229
- Object.defineProperty(this.prototype, methodName, {
253
+ defineProperty(this.prototype, methodName, {
230
254
  async value(...args) {
231
255
  if (!this._litElement) {
232
256
  await this._postLoaded.promise;
@@ -234,13 +258,11 @@ var ProxyComponent = class extends HtmlElement {
234
258
  const genericLitElement = this._litElement;
235
259
  return await genericLitElement[methodName](...args);
236
260
  },
237
- configurable: true,
238
- writable: true,
239
- enumerable: true
261
+ configurable: true
240
262
  });
241
263
  }
242
264
  static _bindSync(methodName) {
243
- Object.defineProperty(this.prototype, methodName, {
265
+ defineProperty(this.prototype, methodName, {
244
266
  value(...args) {
245
267
  if (process.env.NODE_ENV === "development" && !this._litElement) {
246
268
  const ProxyClass = this.constructor;
@@ -251,8 +273,7 @@ var ProxyComponent = class extends HtmlElement {
251
273
  const genericLitElement = this._litElement;
252
274
  return genericLitElement[methodName](...args);
253
275
  },
254
- configurable: true,
255
- enumerable: true
276
+ configurable: true
256
277
  });
257
278
  }
258
279
  get manager() {
@@ -310,10 +331,10 @@ var ProxyComponent = class extends HtmlElement {
310
331
  }
311
332
  connectedCallback() {
312
333
  if (this._litElement) {
313
- this._litElement?.connectedCallback();
334
+ this._litElement.connectedCallback();
314
335
  } else {
315
336
  queueMicrotask(() => {
316
- this._ancestorLoad = attachToAncestor(this, this);
337
+ this._ancestorLoad = attachToAncestor(this);
317
338
  });
318
339
  }
319
340
  }
@@ -352,17 +373,38 @@ var ProxyComponent = class extends HtmlElement {
352
373
  const isFirstInitialization = !ProxyClass._LitConstructor;
353
374
  if (isFirstInitialization) {
354
375
  ProxyClass._LitConstructor = LitConstructor;
355
- LitConstructor.prototype.removeAttribute = removeAttribute;
356
- LitConstructor.prototype.setAttribute = setAttribute;
376
+ LitConstructor.prototype.removeAttribute = function(qualifiedName) {
377
+ HTMLElement.prototype.removeAttribute.call(this.el, qualifiedName);
378
+ };
379
+ LitConstructor.prototype.setAttribute = function(qualifiedName, value) {
380
+ HTMLElement.prototype.setAttribute.call(this.el, qualifiedName, value);
381
+ };
382
+ defineProperty(LitConstructor.prototype, "isConnected", {
383
+ get() {
384
+ return this.el.isConnected;
385
+ }
386
+ });
357
387
  if (process.env.NODE_ENV !== "production" && LitConstructor.shadowRootOptions !== noShadowRoot) {
358
- devOnlyDetectIncorrectLazyUsages(Object.getPrototypeOf(LitConstructor));
388
+ let prototype = LitConstructor;
389
+ while (prototype && !Object.hasOwn(prototype, "lumina")) {
390
+ prototype = Object.getPrototypeOf(prototype);
391
+ }
392
+ devOnlyDetectIncorrectLazyUsages(prototype);
359
393
  }
360
394
  customElements.define(lazyTagName, LitConstructor);
361
395
  }
362
396
  LitConstructor.lazy = this;
363
397
  const litElement = document.createElement(lazyTagName);
364
398
  LitConstructor.lazy = void 0;
365
- this._litElement = litElement;
399
+ if (process.env.NODE_ENV !== "production") {
400
+ Object.defineProperty(this, "_litElement", {
401
+ value: litElement,
402
+ configurable: true,
403
+ enumerable: false
404
+ });
405
+ } else {
406
+ this._litElement = litElement;
407
+ }
366
408
  this._pendingAttributes.forEach((name) => {
367
409
  const value = this.getAttribute(name);
368
410
  litElement.attributeChangedCallback(
@@ -381,26 +423,24 @@ var ProxyComponent = class extends HtmlElement {
381
423
  const missingFromLit = lazyObserved.filter((attribute) => !litObserved.includes(attribute));
382
424
  if (missingFromLazy.length > 0) {
383
425
  console.warn(
384
- `The following attributes on <${ProxyClass._name}> are present on the Lit element, but are missing from the lazy proxy component: ${missingFromLazy.join(", ")}. This either indicates a bug in Lumina, or you are creating the attribute dynamically in a way that compiler can not infer statically. For these attributes, lazy-loading version of your component won't work correctly, thus this must be resolved`
426
+ `The following attributes on <${ProxyClass._name}> are present on the Lit element, but are missing from the lazy proxy component: ${missingFromLazy.join(", ")}. This either indicates a bug in Lumina, or you are creating the attribute dynamically in a way that compiler cannot infer statically. For these attributes, lazy-loading version of your component won't work correctly, thus this must be resolved`
385
427
  );
386
428
  }
387
429
  if (missingFromLit.length > 0) {
388
430
  console.warn(
389
- `The following attributes on <${ProxyClass._name}> are defined on the lazy proxy component, but not on the actual Lit element: ${missingFromLit.join(", ")}. This either indicates a bug in Lumina, or you are creating the attribute dynamically in a way that compiler can not infer statically. This is a non-critical issue, but does indicate that something is going wrong and should be fixed`
431
+ `The following attributes on <${ProxyClass._name}> are defined on the lazy proxy component, but not on the actual Lit element: ${missingFromLit.join(", ")}. This either indicates a bug in Lumina, or you are creating the attribute dynamically in a way that compiler cannot infer statically. This is a non-critical issue, but does indicate that something is going wrong and should be fixed`
390
432
  );
391
433
  }
392
434
  }
393
- if (this.isConnected) {
394
- litElement.connectedCallback();
435
+ const isStillConnected = this.isConnected;
436
+ if (isStillConnected || this._ancestorLoad) {
437
+ litElement.connectedCallback?.();
438
+ if (!isStillConnected) {
439
+ litElement.disconnectedCallback();
440
+ }
395
441
  }
396
442
  }
397
443
  };
398
- function removeAttribute(qualifiedName) {
399
- HTMLElement.prototype.removeAttribute.call(this.el, qualifiedName);
400
- }
401
- function setAttribute(qualifiedName, value) {
402
- HTMLElement.prototype.setAttribute.call(this.el, qualifiedName, value);
403
- }
404
444
  function syncLitElement([key, value]) {
405
445
  this[key] = value;
406
446
  }
@@ -542,13 +582,6 @@ var LitElement = class _LitElement extends OriginalLitElement {
542
582
  * @internal
543
583
  */
544
584
  this._offspring = this.constructor.lazy?._offspring ?? [];
545
- /**
546
- * Promise that resolves once parent's load() completed. False if there is no
547
- * parent
548
- *
549
- * @internal
550
- */
551
- this._ancestorLoad = this.constructor.lazy?._ancestorLoad;
552
585
  this._postLoaded = this.constructor.lazy?._postLoaded ?? new Deferred2();
553
586
  this._enableUpdating = this.enableUpdating;
554
587
  this.enableUpdating = emptyFunction;
@@ -618,7 +651,13 @@ var LitElement = class _LitElement extends OriginalLitElement {
618
651
  const isFirstCall = !this.manager.connectedCalled;
619
652
  super.connectedCallback();
620
653
  if (isFirstCall) {
621
- queueMicrotask(() => void this._load().catch(this._postLoaded.reject));
654
+ queueMicrotask(
655
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async
656
+ () => this._load().catch((error) => {
657
+ console.error(error);
658
+ this._postLoaded.reject(error);
659
+ })
660
+ );
622
661
  }
623
662
  }
624
663
  /**
@@ -652,7 +691,7 @@ var LitElement = class _LitElement extends OriginalLitElement {
652
691
  }
653
692
  /** Do asynchronous component load */
654
693
  async _load() {
655
- const parentLoadPromise = this._ancestorLoad ?? attachToAncestor(this, this);
694
+ const parentLoadPromise = this.el._ancestorLoad ?? attachToAncestor(this.el);
656
695
  if (parentLoadPromise) {
657
696
  await parentLoadPromise;
658
697
  }
@@ -746,21 +785,72 @@ function makeRuntime(options) {
746
785
  }
747
786
 
748
787
  // src/jsx/jsx.ts
749
- import { directive as litDirective } from "lit-html/directive.js";
750
- import { noChange as litNoChange, nothing as litNothing } from "lit-html";
788
+ var Fragment = void 0;
751
789
  var bindAttribute = void 0;
752
790
  var bindBooleanAttribute = void 0;
753
791
  var bindProperty = void 0;
754
792
  var bindEvent = void 0;
755
- var nothing = litNothing;
756
- var noChange = litNoChange;
757
- var directive = litDirective;
758
793
 
759
794
  // src/jsx/directives.ts
760
795
  import { classMap } from "lit-html/directives/class-map.js";
761
796
  import { styleMap } from "lit/directives/style-map.js";
797
+ import { Directive } from "lit-html/directive.js";
798
+ import { directive as litDirective } from "lit-html/directive.js";
799
+ import { live as litLive } from "lit-html/directives/live.js";
762
800
  var safeClassMap = (parameters) => typeof parameters === "object" && parameters != null ? classMap(parameters) : parameters;
763
801
  var safeStyleMap = (parameters) => typeof parameters === "object" && parameters != null ? styleMap(parameters) : parameters;
802
+ var directive = litDirective;
803
+ var DynamicHtmlValueDirective = class extends Directive {
804
+ update(part, [prop, value]) {
805
+ if (process.env.NODE_ENV !== "production") {
806
+ if (part.type !== 6) {
807
+ throw new Error("DynamicHtmlValueDirective can only be used in the element part position");
808
+ }
809
+ if (prop !== "value" && prop !== "defaultValue") {
810
+ throw new Error('Expected the first argument to DynamicHtmlValueDirective to be "value" or "defaultValue"');
811
+ }
812
+ if (typeof value === "object" && value != null) {
813
+ if ("_$litDirective$" in value) {
814
+ throw new Error(
815
+ "Directive is not supported as a value for the `value` or `defaultValue` prop when the tag name is dynamic."
816
+ );
817
+ } else {
818
+ throw new Error(
819
+ `Tried to set an object as the value/defaultValue prop in a <${part.element.tagName}> element.`
820
+ );
821
+ }
822
+ }
823
+ }
824
+ const element = part.element;
825
+ const tagName = element.tagName;
826
+ if (prop === "value" ? tagName === "INPUT" : tagName === "BUTTON" || tagName === "DATA") {
827
+ if (element[prop] !== value) {
828
+ element[prop] = value;
829
+ }
830
+ } else if (value != null) {
831
+ element.setAttribute("value", value);
832
+ } else {
833
+ element.removeAttribute("value");
834
+ }
835
+ }
836
+ };
837
+ var dynamicValueDirective = directive(DynamicHtmlValueDirective);
838
+ var live = litLive;
839
+
840
+ // src/jsx/utils.ts
841
+ import { noChange as litNoChange, nothing as litNothing } from "lit-html";
842
+ var nothing = litNothing;
843
+ var noChange = litNoChange;
844
+ function setAttribute(element, attributeName, value) {
845
+ if (value == null) {
846
+ element.removeAttribute(attributeName);
847
+ } else {
848
+ element.setAttribute(attributeName, value);
849
+ }
850
+ }
851
+ var stringOrBoolean = {
852
+ toAttribute: (value) => value === true ? "" : value === false ? null : value
853
+ };
764
854
 
765
855
  // src/wrappersUtils.ts
766
856
  function createPrototypeProxy(tagName) {
@@ -782,6 +872,7 @@ function createPrototypeProxy(tagName) {
782
872
  return customElement;
783
873
  }
784
874
  export {
875
+ Fragment,
785
876
  LitElement,
786
877
  bindAttribute,
787
878
  bindBooleanAttribute,
@@ -790,8 +881,10 @@ export {
790
881
  createEvent,
791
882
  createPrototypeProxy,
792
883
  directive,
884
+ dynamicValueDirective,
793
885
  handleComponentMetaUpdate,
794
886
  handleHmrUpdate,
887
+ live,
795
888
  makeDefineCustomElements,
796
889
  makeRuntime,
797
890
  method,
@@ -801,5 +894,7 @@ export {
801
894
  property,
802
895
  safeClassMap,
803
896
  safeStyleMap,
804
- state
897
+ setAttribute,
898
+ state,
899
+ stringOrBoolean
805
900
  };
@@ -4,6 +4,7 @@ import type { ClassInfo } from "lit-html/directives/class-map.js";
4
4
  import type { DirectiveResult } from "lit/directive.js";
5
5
  import type { ClassMapDirective } from "lit/directives/class-map.js";
6
6
  import type { StyleMapDirective } from "lit/directives/style-map.js";
7
+ import type { DirectiveClass } from "lit-html/directive.js";
7
8
  /**
8
9
  * You likely won't have to import this directly. It will be added during
9
10
  * _JSX to lit-html_ conversion.
@@ -50,3 +51,31 @@ export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => Dir
50
51
  * determine at runtime if directive should be called
51
52
  */
52
53
  export declare const safeStyleMap: (parameters: CssProperties | Nil | string) => DirectiveResult<typeof StyleMapDirective> | Nil | string;
54
+ /**
55
+ * Creates a user-facing directive function from a Directive class. This
56
+ * function has the same parameters as the directive's render() method.
57
+ *
58
+ * @remarks
59
+ * This is equivalent to Lit's native "directive()", but has return type
60
+ * "never" to allow it be set as a value for any JSX attribute.
61
+ */
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
+ /**
72
+ * Checks binding values against live DOM values, instead of previously bound
73
+ * values, when determining whether to update the value.
74
+ *
75
+ * @see https://lit.dev/docs/templates/directives/#live
76
+ *
77
+ * @remarks
78
+ * This is equivalent to Lit's native "directive()", but has return type
79
+ * "never" to allow it be set as a value for any JSX attribute.
80
+ */
81
+ export declare const live: (value: unknown) => never;
package/dist/jsx/jsx.d.ts CHANGED
@@ -10,11 +10,9 @@
10
10
  import type { Properties as CssProperties } from "csstype";
11
11
  import type { TemplateResult } from "lit-html";
12
12
  import type { DirectiveResult } from "lit-html/directive.js";
13
- import type { ClassMapDirective } from "lit-html/directives/class-map.js";
13
+ import type { ClassMapDirective, ClassInfo } from "lit-html/directives/class-map.js";
14
14
  import type { StyleMapDirective } from "lit-html/directives/style-map.js";
15
15
  import type { Ref } from "lit-html/directives/ref.js";
16
- import type { ClassInfo } from "lit/directives/class-map.js";
17
- import type { DirectiveClass } from "lit/directive.js";
18
16
  /**
19
17
  * The "h" namespace is used to import JSX types for elements and attributes.
20
18
  * It is imported in order to avoid conflicting global JSX issues.
@@ -24,31 +22,21 @@ export declare namespace h {
24
22
  export type { LuminaJsx as JSX };
25
23
  }
26
24
  /**
27
- * Fragment
28
- *
29
- * @remarks
30
- * This function is not actually defined in the code since references to it will
31
- * be removed at build time by the jsxToLitHtml plugin.
25
+ * The references to this function are removed at build time.
32
26
  */
33
- export declare function Fragment(props: {
27
+ export declare const Fragment: (props: {
34
28
  children?: JsxNode;
35
- }): TemplateResult;
29
+ }) => TemplateResult;
36
30
  /**
37
- * @remarks
38
- * This function is not actually defined in the code since references to it will
39
- * be removed at build time by the jsxToLitHtml plugin.
40
- */
41
- export declare function h(sel: any, data?: any, text?: any): TemplateResult;
42
- /**
43
- * @remarks
44
- * This function is not actually defined in the code since references to it will
45
- * be removed at build time by the jsxToLitHtml plugin.
31
+ * @internal
32
+ * The references to this function are removed at build time. You do not need
33
+ * to import it directly
46
34
  */
47
35
  export declare function jsx(type: string, props: unknown, key?: unknown): JsxNode;
48
36
  /**
49
- * @remarks
50
- * This function is not actually defined in the code since references to it will
51
- * be removed at build time by the jsxToLitHtml plugin.
37
+ * @internal
38
+ * The references to this function are removed at build time. You do not need
39
+ * to import it directly
52
40
  */
53
41
  export declare function jsxs(type: string, props: unknown, key?: unknown): JsxNode;
54
42
  /**
@@ -177,44 +165,6 @@ export declare const bindEvent: <T>(descriptor: T | (AddEventListenerOptions & {
177
165
  export type JsxNode = DirectiveResult<any> | JsxNodeArray | Node | TemplateResult | boolean | number | (NonNullable<unknown> & string) | null | undefined;
178
166
  interface JsxNodeArray extends Array<JsxNode> {
179
167
  }
180
- /**
181
- * Equivalent to Lit's "nothing", but has type "never" to allow it to be set as a
182
- * value for any JSX attribute.
183
- *
184
- * By default in Lit, nullish attribute value renders to an attribute without a
185
- * value (which is interpreted by HTML as "true"). To tell Lit that you don't
186
- * want the attribute to be present, use the `nothing` value.
187
- *
188
- * @example
189
- * ```tsx
190
- * <a href={this.href ?? nothing}>{this.label}</a>
191
- * ```
192
- *
193
- * @remarks
194
- * This is not a concern for properties as they are passed as is without
195
- * serialization. For this reason, during _JSX to lit-html_ conversion, most JSX
196
- * props are converted properties, except for the few cases when an attribute
197
- * has no equivalent property.
198
- */
199
- export declare const nothing: never;
200
- /**
201
- * A sentinel value that signals that a value was handled by a directive and
202
- * should not be written to the DOM.
203
- *
204
- * @remarks
205
- * This is equivalent to Lit's native "noChange", but has type "never" to allow
206
- * it be set as a value for any JSX attribute.
207
- */
208
- export declare const noChange: never;
209
- /**
210
- * Creates a user-facing directive function from a Directive class. This
211
- * function has the same parameters as the directive's render() method.
212
- *
213
- * @remarks
214
- * This is equivalent to Lit's native "directive()", but has return type
215
- * "never" to allow it be set as a value for any JSX attribute.
216
- */
217
- export declare const directive: <C extends DirectiveClass>(c: C) => (...values: Parameters<InstanceType<C>["render"]>) => never;
218
168
  /**
219
169
  * this.el property on a component only has the public properties of the
220
170
  * component. All internal methods, properties, as well as LitElement methods
@@ -1078,6 +1028,7 @@ export declare namespace LuminaJsx {
1078
1028
  fetchPriority?: "high" | "low" | "auto";
1079
1029
  }
1080
1030
  interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
1031
+ autocomplete?: AutoFill;
1081
1032
  accept?: string;
1082
1033
  alt?: string;
1083
1034
  autofocus?: boolean;
@@ -1409,6 +1360,7 @@ export declare namespace LuminaJsx {
1409
1360
  required?: boolean;
1410
1361
  rows?: number | string;
1411
1362
  value?: string | number;
1363
+ defaultValue?: string | number;
1412
1364
  wrap?: "hard" | "soft" | "off";
1413
1365
  maxLength?: number | string;
1414
1366
  minLength?: number | string;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Equivalent to Lit's "nothing", but has type "never" to allow it to be set as a
3
+ * value for any JSX attribute.
4
+ *
5
+ * By default in Lit, nullish attribute value renders to an attribute without a
6
+ * value (which is interpreted by HTML as "true"). To tell Lit that you don't
7
+ * want the attribute to be present, use the `nothing` value.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <a href={this.href ?? nothing}>{this.label}</a>
12
+ * ```
13
+ *
14
+ * @remarks
15
+ * This is not a concern for properties as they are passed as is without
16
+ * serialization. For this reason, during _JSX to lit-html_ conversion, most JSX
17
+ * props are converted properties, except for the few cases when an attribute
18
+ * has no equivalent property.
19
+ */
20
+ export declare const nothing: never;
21
+ /**
22
+ * A sentinel value that signals that a value was handled by a directive and
23
+ * should not be written to the DOM.
24
+ *
25
+ * @remarks
26
+ * This is equivalent to Lit's native "noChange", but has type "never" to allow
27
+ * it be set as a value for any JSX attribute.
28
+ */
29
+ export declare const noChange: never;
30
+ /**
31
+ * Like native element.setAttribute(), but instead of stringifying nullish
32
+ * values, will call element.removeAttribute()
33
+ */
34
+ export declare function setAttribute(element: Element, attributeName: string, value: unknown): void;
35
+ /**
36
+ * If you have a property that can be both of string or boolean type, there is
37
+ * no automatic boolean conversion in place - that means the attribute is
38
+ * treated as a string.
39
+ *
40
+ * This converter improves that handling by converting `true` property value to
41
+ * an empty attribute, and `false` to removing the attribute.
42
+ *
43
+ * When setting the boolean attribute, the value is still not parsed (and will
44
+ * be either `null` or `""`). This matches the behavior in Stencil.
45
+ *
46
+ * ```tsx
47
+ * @property({ reflects:true, converter: stringOrBoolean }) icon: string | boolean;
48
+ * // ...
49
+ * this.icon = false; // attribute is removed
50
+ * this.icon = true; // attribute is ""
51
+ * this.icon = "name"; // attribute is "name"
52
+ * ```
53
+ */
54
+ export declare const stringOrBoolean: {
55
+ toAttribute: (value: unknown) => string | null;
56
+ };
@@ -105,7 +105,7 @@ export declare abstract class ProxyComponent extends HtmlElement {
105
105
  /**
106
106
  * Direct offspring that should be awaited before loaded() is emitted
107
107
  */
108
- _offspring: (Partial<Pick<LitElement, "manager">> & Pick<LitElement, "componentOnReady">)[];
108
+ _offspring: (Element & Partial<Pick<LitElement, "manager">> & Pick<LitElement, "componentOnReady">)[];
109
109
  /**
110
110
  * Promise that resolves once parent's load() completed. False if there is no
111
111
  * parent
@@ -151,4 +151,7 @@ export declare abstract class ProxyComponent extends HtmlElement {
151
151
  /** @internal */
152
152
  _initializeComponent(module: Record<string, typeof LitElement>): void;
153
153
  }
154
+ export type GlobalThisWithPuppeteerEnv = typeof globalThis & {
155
+ devOnly$createdElements?: WeakRef<ProxyComponent>[];
156
+ };
154
157
  export {};
@@ -5,4 +5,4 @@ import type { ProxyComponent } from "./lazyLoad";
5
5
  * Also, return a promise that will delay our load() until parent's load()
6
6
  * is completed.
7
7
  */
8
- export declare function attachToAncestor(child: ProxyComponent["_offspring"][number], el: HTMLElement): Promise<void> | false;
8
+ export declare function attachToAncestor(child: ProxyComponent["_offspring"][number]): Promise<void> | false;
package/dist/runtime.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { LitElement } from "./LitElement";
3
3
  /**
4
4
  * `@arcgis/lumina` package may be bundled once but used by multiple packages with
5
5
  * different configuration options. For that reason, the configuration options
6
- * can not be a global object, but has to be an object that you pass around.
6
+ * cannot be a global object, but has to be an object that you pass around.
7
7
  */
8
8
  export type Runtime = RuntimeOptions & {
9
9
  /**
@@ -2,7 +2,7 @@
2
2
  import { getWindow } from "@lit-labs/ssr/lib/dom-shim.js";
3
3
  import { render } from "@lit-labs/ssr/lib/render.js";
4
4
  import { html } from "@lit-labs/ssr/lib/server-template.js";
5
- import { unsafeStatic, withStatic } from "lit/static-html.js";
5
+ import { unsafeStatic, withStatic } from "lit-html/static.js";
6
6
  import { collectResult } from "@lit-labs/ssr/lib/render-result.js";
7
7
  import { RenderResultReadable } from "@lit-labs/ssr/lib/render-result-readable.js";
8
8
  var staticHtml = withStatic(html);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.31.0-next.98",
3
+ "version": "4.32.0-next.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "clean": "rimraf ./dist ./build ./turbo ./node_modules"
30
30
  },
31
31
  "dependencies": {
32
- "@arcgis/components-controllers": "4.31.0-next.98",
33
- "@arcgis/components-utils": "4.31.0-next.98",
32
+ "@arcgis/components-controllers": "4.32.0-next.1",
33
+ "@arcgis/components-utils": "4.32.0-next.1",
34
34
  "@lit-labs/ssr": "^3.2.2",
35
35
  "@lit-labs/ssr-client": "^1.1.7",
36
36
  "csstype": "^3.1.3",
@@ -38,12 +38,12 @@
38
38
  "tslib": "^2.7.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@arcgis/typescript-config": "4.31.0-next.98",
41
+ "@arcgis/typescript-config": "4.32.0-next.1",
42
42
  "@types/node": "^20.2.5",
43
43
  "eslint": "^8.55.0",
44
44
  "rimraf": "^5.0.0",
45
- "tsup": "^8.2.4",
45
+ "tsup": "^8.3.0",
46
46
  "typescript": "~5.4.0"
47
47
  },
48
- "gitHead": "cbe08697f9589db42635f6184bf7bd3dafcb2d79"
48
+ "gitHead": "e5c61e5426551da5fa01c269b3b138133e620ca0"
49
49
  }