@arcgis/lumina 5.2.0-next.2 → 5.2.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.
Files changed (58) hide show
  1. package/dist/{ControllerManager-DpJfvft9.js → ControllerManager-4cSEnB5Y.js} +12 -8
  2. package/dist/{Controller-Cer_6Z29.js → GenericController-C8NSb50b.js} +59 -23
  3. package/dist/LitElement.d.ts +179 -250
  4. package/dist/PublicLitElement.d.ts +64 -30
  5. package/dist/config.d.ts +22 -16
  6. package/dist/context.d.ts +24 -24
  7. package/dist/controllers/Controller.d.ts +106 -139
  8. package/dist/controllers/ControllerInternals.d.ts +33 -25
  9. package/dist/controllers/ControllerManager.d.ts +40 -61
  10. package/dist/controllers/GenericController.d.ts +26 -0
  11. package/dist/controllers/accessor/index.d.ts +6 -4
  12. package/dist/controllers/accessor/index.js +23 -5
  13. package/dist/controllers/accessor/reEmitEvent.d.ts +6 -3
  14. package/dist/controllers/accessor/store.d.ts +21 -14
  15. package/dist/controllers/accessor/useAccessor.d.ts +86 -68
  16. package/dist/controllers/functional.d.ts +11 -4
  17. package/dist/controllers/index.d.ts +35 -36
  18. package/dist/controllers/index.js +5 -7
  19. package/dist/controllers/load.d.ts +3 -2
  20. package/dist/controllers/proxyExports.d.ts +6 -5
  21. package/dist/controllers/toFunction.d.ts +4 -2
  22. package/dist/controllers/trackKey.d.ts +9 -4
  23. package/dist/controllers/trackPropKey.d.ts +8 -2
  24. package/dist/controllers/trackPropertyKey.d.ts +11 -6
  25. package/dist/controllers/types.d.ts +99 -170
  26. package/dist/controllers/useDirection.d.ts +5 -6
  27. package/dist/controllers/useMedia.d.ts +3 -2
  28. package/dist/controllers/usePropertyChange.d.ts +9 -10
  29. package/dist/controllers/useSlottableRequest.d.ts +15 -10
  30. package/dist/controllers/useT9n.d.ts +44 -38
  31. package/dist/controllers/useWatchAttributes.d.ts +6 -3
  32. package/dist/controllers/utils.d.ts +13 -5
  33. package/dist/createEvent.d.ts +32 -32
  34. package/dist/decorators.d.ts +16 -9
  35. package/dist/formAssociatedUtils.d.ts +5 -47
  36. package/dist/globalTypes/importMeta.d.ts +18 -10
  37. package/dist/globalTypes/index.d.ts +6 -4
  38. package/dist/globalTypes/jsxGlobals.d.ts +36 -23
  39. package/dist/globalTypes/loadLitCss.d.ts +61 -40
  40. package/dist/globalTypes/viteEnv.d.ts +60 -26
  41. package/dist/hmrSupport.d.ts +24 -28
  42. package/dist/index.d.ts +17 -16
  43. package/dist/index.js +27 -7
  44. package/dist/jsx/baseTypes.d.ts +26 -26
  45. package/dist/jsx/directives.d.ts +30 -42
  46. package/dist/jsx/generatedTypes.d.ts +3002 -2923
  47. package/dist/jsx/types.d.ts +214 -171
  48. package/dist/jsx/utils.d.ts +19 -14
  49. package/dist/lazyLoad.d.ts +31 -110
  50. package/dist/makeRuntime.d.ts +104 -127
  51. package/dist/{proxyExports-BkN6hND0.js → proxyExports-ZRLty8oJ.js} +1 -1
  52. package/dist/render.d.ts +4 -2
  53. package/dist/utils.d.ts +9 -14
  54. package/dist/wrappersUtils.d.ts +25 -26
  55. package/package.json +7 -4
  56. package/dist/devOnlyDetectIncorrectLazyUsages.d.ts +0 -14
  57. package/dist/lifecycleSupport.d.ts +0 -8
  58. package/dist/tests/wrappersUtils.typeTest.d.ts +0 -1
@@ -1,33 +1,119 @@
1
- import { TemplateResult } from 'lit';
2
- import { DirectiveResult } from 'lit/directive.js';
3
- import { HTMLElementTags, HTMLAttributes, GlobalEventHandlersCamelCase, SvgElementTags, DOMAttributes, AriaAttributes } from './generatedTypes.ts';
4
- import { CustomAttributes } from './baseTypes.ts';
1
+ import type { TemplateResult } from "lit";
2
+ import type { DirectiveResult } from "lit/directive.js";
3
+ import type { HTMLElementTags as HTMLElementTagsAlias, HTMLAttributes as HTMLAttributesAlias, GlobalEventHandlersCamelCase, SvgElementTags as SvgElementTagsAlias, DOMAttributes as DOMAttributesAlias, AriaAttributes as AriaAttributesAlias, HTMLAttributes } from "./generatedTypes.js";
4
+ import type { CustomAttributes as CustomAttributesAlias } from "./baseTypes.js";
5
+
6
+
7
+
5
8
  /**
6
9
  * The "h" namespace is used to import JSX types for elements and attributes.
7
10
  * It is imported in order to avoid conflicting global JSX issues.
11
+ *
12
+ * @public
8
13
  */
9
14
  export declare namespace h {
10
- export function h(sel: any, data?: any, text?: any): TemplateResult;
11
- export type { LuminaJsx as JSX };
15
+ // TypeScript does not type-check the JSX function signature
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ export function h(sel: any, data?: any, text?: any): TemplateResult;
18
+
19
+ export type { LuminaJsx as JSX };
12
20
  }
21
+
22
+
23
+
13
24
  /**
14
- * The references to this function are removed at build time.
25
+ * These types are based on dom-expressions typed (used by Solid and Preact):
26
+ * https://github.com/ryansolid/dom-expressions/blob/main/packages/dom-expressions/src/jsx.d.ts
27
+ *
28
+ * They in turn are based on Surplus and Inferno:
29
+ * - https://github.com/adamhaile/surplus/blob/master/index.d.ts
30
+ * - https://github.com/infernojs/inferno/blob/master/packages/inferno/src/core/types.ts
31
+ *
32
+ * Documentation about how to type JSX in TypeScript:
33
+ * https://www.typescriptlang.org/docs/handbook/jsx.html
34
+ *
35
+ * @public
15
36
  */
16
- export declare const Fragment: (props: {
17
- children?: JsxNode;
18
- }) => TemplateResult;
37
+ export declare namespace LuminaJsx {
38
+ export type Element = TemplateResult;
39
+
40
+ export type ElementType = JsxNode;
41
+
42
+ /*
43
+ * Class-based components are not supported. All custom elements are to be
44
+ * invoked as <intrinsic-elements>.
45
+ */
46
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
47
+ export interface ElementClass {}
48
+
49
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
50
+ export interface ElementAttributesProperty {}
51
+
52
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
53
+ export interface IntrinsicClassAttributes {}
54
+
55
+ export interface ElementChildrenAttribute {
56
+ children: JsxNode;
57
+ }
58
+
59
+ export interface IntrinsicAttributes {
60
+ /**
61
+ * The `key` is a special attribute that can be set on any element.
62
+ *
63
+ * At build-time it is translated into the `keyed()` directive:
64
+ * https://lit.dev/docs/templates/directives/#keyed
65
+ *
66
+ * @remarks
67
+ * Unlike in React or Stencil, any JavaScript value is acceptable as a key
68
+ */
69
+ key?: unknown;
70
+ }
71
+
72
+ export interface IntrinsicElements
73
+ extends HTMLElementTags,
74
+ SvgElementTags,
75
+ ReMappedComponents<DeclareElements>,
76
+ ReMapStencilComponents<ImportStencilElements> {}
77
+
78
+ /** @deprecated import type { CustomAttributes } from "@arcgis/lumina/jsx/baseTypes"; instead */
79
+ export interface CustomAttributes<T = HTMLElement> extends CustomAttributesAlias<T> {}
80
+ /** @deprecated import type { DOMAttributes } from "@arcgis/lumina/jsx/generatedTypes"; instead */
81
+ export interface DOMAttributes<T = HTMLElement> extends DOMAttributesAlias<T> {}
82
+ /** @deprecated import type { HTMLAttributes } from "@arcgis/lumina/jsx/generatedTypes"; instead */
83
+ export interface HTMLAttributes<T = HTMLElement> extends HTMLAttributesAlias<T> {}
84
+ /** @deprecated import type { HTMLElementTags } from "@arcgis/lumina/jsx/generatedTypes"; instead */
85
+ export interface HTMLElementTags extends HTMLElementTagsAlias {}
86
+ /** @deprecated import type { SvgElementTags } from "@arcgis/lumina/jsx/generatedTypes"; instead */
87
+ export interface SvgElementTags extends SvgElementTagsAlias {}
88
+ /** @deprecated import type { AriaAttributes } from "@arcgis/lumina/jsx/generatedTypes"; instead */
89
+ export interface AriaAttributes extends AriaAttributesAlias {}
90
+ }
91
+
92
+ /** The references to this function are removed at build time. */
93
+ export const Fragment: (props: { children?: JsxNode; }) => TemplateResult;
94
+
19
95
  /**
20
- * @private
21
96
  * The references to this function are removed at build time. You do not need
22
97
  * to import it directly
98
+ *
99
+ * @param type
100
+ * @param props
101
+ * @param key
102
+ * @internal
23
103
  */
24
- export declare function jsx(type: string, props: unknown, key?: unknown): JsxNode;
104
+ export function jsx(type: string, props: unknown, key?: unknown): JsxNode;
105
+
25
106
  /**
26
- * @private
27
107
  * The references to this function are removed at build time. You do not need
28
108
  * to import it directly
109
+ *
110
+ * @param type
111
+ * @param props
112
+ * @param key
113
+ * @internal
29
114
  */
30
- export declare function jsxs(type: string, props: unknown, key?: unknown): JsxNode;
115
+ export function jsxs(type: string, props: unknown, key?: unknown): JsxNode;
116
+
31
117
  /**
32
118
  * The JSX to lit-html conversion has a heuristic to determine whether a prop
33
119
  * should be converted to a property or attribute at runtime. In cases where
@@ -38,6 +124,10 @@ export declare function jsxs(type: string, props: unknown, key?: unknown): JsxNo
38
124
  * impact. But that also means you should not call this function anywhere other
39
125
  * than at the top level of a JSX prop value
40
126
  *
127
+ * If you often encounter cases where the JSX to lit-html incorrectly converts
128
+ * the prop to a property necessitating the use of `bindAttribute()`, please open
129
+ * an issue for Lumina.
130
+ *
41
131
  * @example
42
132
  * ```tsx
43
133
  * <my-component
@@ -49,13 +139,9 @@ export declare function jsxs(type: string, props: unknown, key?: unknown): JsxNo
49
139
  * ```ts
50
140
  * html`<my-component name="Pass name as attribute rather than property"></my-component>`
51
141
  * ```
52
- *
53
- * @remarks
54
- * If you often encounter cases where the JSX to lit-html incorrectly converts
55
- * the prop to a property necessitating the use of `bindAttribute()`, please open
56
- * an issue for Lumina.
57
142
  */
58
- export declare const bindAttribute: <T>(value: T) => T;
143
+ export const bindAttribute: <T>(value: T) => T;
144
+
59
145
  /**
60
146
  * The JSX to lit-html conversion has a heuristic to determine whether a prop
61
147
  * should be converted to a property, attribute or boolean attribute at runtime.
@@ -67,8 +153,11 @@ export declare const bindAttribute: <T>(value: T) => T;
67
153
  * impact. But that also means you should not call this function anywhere other
68
154
  * than at the top level of a JSX prop value
69
155
  *
70
- * @see https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
156
+ * If you often encounter cases where the JSX to lit-html incorrectly converts
157
+ * the prop necessitating the use of `bindBooleanAttribute()`, please open
158
+ * an issue for Lumina.
71
159
  *
160
+ * @see https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
72
161
  * @example
73
162
  * ```tsx
74
163
  * <my-component
@@ -80,13 +169,9 @@ export declare const bindAttribute: <T>(value: T) => T;
80
169
  * ```ts
81
170
  * html`<my-component ?checked=${myBoolean}></my-component>`
82
171
  * ```
83
- *
84
- * @remarks
85
- * If you often encounter cases where the JSX to lit-html incorrectly converts
86
- * the prop necessitating the use of `bindBooleanAttribute()`, please open
87
- * an issue for Lumina.
88
172
  */
89
- export declare const bindBooleanAttribute: <T>(value: T) => T;
173
+ export const bindBooleanAttribute: <T>(value: T) => T;
174
+
90
175
  /**
91
176
  * The JSX to lit-html conversion has a heuristic to determine whether a prop
92
177
  * should be converted to a property or attribute at runtime. In cases where
@@ -97,6 +182,10 @@ export declare const bindBooleanAttribute: <T>(value: T) => T;
97
182
  * impact. But that also means you should not call this function anywhere other
98
183
  * than at the top level of a JSX prop value
99
184
  *
185
+ * If you often encounter cases where the JSX to lit-html incorrectly converts
186
+ * the prop to an attribute necessitating the use of `bindProperty()`, please open
187
+ * an issue for Lumina.
188
+ *
100
189
  * @example
101
190
  * ```tsx
102
191
  * <my-component
@@ -108,17 +197,9 @@ export declare const bindBooleanAttribute: <T>(value: T) => T;
108
197
  * ```ts
109
198
  * html`<my-component .my-prop="Pass my-prop as a property rather than attribute"></my-component>`
110
199
  * ```
111
- *
112
- * @remarks
113
- * If you often encounter cases where the JSX to lit-html incorrectly converts
114
- * the prop to an attribute necessitating the use of `bindProperty()`, please open
115
- * an issue for Lumina.
116
- *
117
- * @remarks
118
- * This function is not named `property()` because that is already taken by
119
- * Lit's \@property() decorator
120
200
  */
121
- export declare const bindProperty: <T>(value: T) => T;
201
+ export const bindProperty: <T>(value: T) => T;
202
+
122
203
  /**
123
204
  * The `bindEvent()` function lets you customize the event binding behavior by
124
205
  * providing options like passive, capture, once and other options that you
@@ -127,6 +208,10 @@ export declare const bindProperty: <T>(value: T) => T;
127
208
  * This function call will be erased at build-time, thus it has no runtime
128
209
  * impact.
129
210
  *
211
+ * This function is a _JSX to lit-html_ adaptation of the Lit's event listener
212
+ * customization syntax.
213
+ * See https://lit.dev/docs/components/events/#event-options-decorator
214
+ *
130
215
  * @example
131
216
  * ```tsx
132
217
  * <my-component
@@ -137,23 +222,13 @@ export declare const bindProperty: <T>(value: T) => T;
137
222
  * ```ts
138
223
  * html`<my-component onScroll=${{ handleEvent: console.log, passive:true }}></my-component>`
139
224
  * ```
140
- *
141
- * @remarks
142
- * This function is a _JSX to lit-html_ adaptation of the Lit's event listener
143
- * customization syntax.
144
- * See https://lit.dev/docs/components/events/#event-options-decorator
145
- *
146
- *
147
- * @remarks
148
- * This function is not named `event` because there is a legacy `window.event`
149
- * global that was interfering with auto-imports of this function.
150
225
  */
151
- export declare const bindEvent: <T>(descriptor: T | (AddEventListenerOptions & {
152
- handleEvent: T;
153
- })) => T;
226
+ export const bindEvent: <T>(descriptor: T | (AddEventListenerOptions & { handleEvent: T; })) => T;
227
+
154
228
  export type JsxNode = DirectiveResult<any> | JsxNodeArray | Node | TemplateResult | boolean | number | (NonNullable<unknown> & string) | null | undefined;
155
- interface JsxNodeArray extends Array<JsxNode> {
156
- }
229
+
230
+ export interface JsxNodeArray extends Array<JsxNode> {}
231
+
157
232
  /**
158
233
  * By not requiring to have some sort of typings generation watcher to run
159
234
  * in the background and generate types for the components based on the
@@ -174,11 +249,10 @@ interface JsxNodeArray extends Array<JsxNode> {
174
249
  * information and can generate the typings that expose only the actual
175
250
  * properties component declared.
176
251
  *
177
- * @remarks
178
- * Do not exclude "manager" and "componentOnReady" since these properties are
179
- * available both on lazy and non-lazy instance.
252
+ * @internal
180
253
  */
181
- type ExcludedProperties = "addController" | "attributeChangedCallback" | "connectedCallback" | "disconnectedCallback" | "el" | "elementInternals" | "hasUpdated" | "isUpdatePending" | "listen" | "load" | "loaded" | "removeController" | "render" | "renderOptions" | "renderRoot" | "requestUpdate" | "updateComplete" | "updated" | "willUpdate";
254
+ export type ExcludedProperties = "addController" | "attributeChangedCallback" | "connectedCallback" | "disconnectedCallback" | "el" | "elementInternals" | "hasUpdated" | "isUpdatePending" | "listen" | "load" | "loaded" | "removeController" | "render" | "renderOptions" | "renderRoot" | "requestUpdate" | "updateComplete" | "updated" | "willUpdate";
255
+
182
256
  /**
183
257
  * this.el property on a component only has the public properties of the
184
258
  * component. All internal methods, properties, as well as LitElement methods
@@ -189,12 +263,9 @@ type ExcludedProperties = "addController" | "attributeChangedCallback" | "connec
189
263
  * Usually, you don't need to use this type directly. If you have an
190
264
  * `ArcgisCounter` element, you can get its el type by using
191
265
  * `ArcgisCounter["el"]`
192
- *
193
- * @remarks
194
- * By using Omit<>, TypeScript also "forgets" all private members of the
195
- * passed in type, which is convenient for us.
196
266
  */
197
267
  export type ToElement<Component> = Omit<Component, ExcludedProperties>;
268
+
198
269
  /**
199
270
  * Utility type for getting the JSX prop types for a given component. In particular:
200
271
  *
@@ -211,29 +282,31 @@ export type ToElement<Component> = Omit<Component, ExcludedProperties>;
211
282
  * absence of decorator does not change the type). Thus, if we don't mark all
212
283
  * properties as optional, TypeScript will force us to provide a value for all
213
284
  * methods, and regular properties component may have.
285
+ *
286
+ * @internal
214
287
  */
215
- export type ToJsx<Component extends {
216
- el: unknown;
217
- }> = HTMLAttributes<Component["el"]> & Partial<Omit<Component, ExcludedProperties | keyof HTMLElement | keyof RemapEvents<Component>>> & RemapEvents<Component>;
288
+ export type ToJsx<Component extends { el: unknown; }> = HTMLAttributesAlias<Component["el"]>
289
+ & Partial<Omit<Component, ExcludedProperties | keyof HTMLElement | keyof RemapEvents<Component>>>
290
+ & RemapEvents<Component>;
291
+
218
292
  /**
219
293
  * From event emitters create event listener callbacks
294
+ *
295
+ * @internal
220
296
  */
221
- type RemapEvents<Component extends {
222
- el: unknown;
223
- }> = {
224
- [Key in keyof Component as `on${Key & string}`]?: unknown extends Component[Key] ? never : Component[Key] extends {
225
- emit: (...rest: never[]) => infer PayloadType;
226
- } ? (event: PayloadType & {
297
+ export type RemapEvents<Component extends { el: unknown; }> = {
298
+ [Key in keyof Component as `on${Key & string}`]?: unknown extends Component[Key] ? never : Component[Key] extends { emit: (...rest: never[]) => infer PayloadType; } ? (event: PayloadType & {
227
299
  currentTarget: Component["el"];
228
300
  target: Component["el"];
229
301
  }) => void : never;
230
302
  };
303
+
231
304
  /**
232
305
  * This interface will be automatically extended in src/lumina.ts files to add
233
306
  * typings for Stencil elements usages in Lumina. You do not need to manually
234
307
  * extend this interface.
235
308
  *
236
- * @private
309
+ * @internal
237
310
  * @example
238
311
  * ```ts
239
312
  * import type { JSX as CalciteJSX } from "@esri/calcite-components/dist/types/components";
@@ -247,8 +320,8 @@ type RemapEvents<Component extends {
247
320
  * }
248
321
  * ```
249
322
  */
250
- export interface ImportStencilElements {
251
- }
323
+ export interface ImportStencilElements {}
324
+
252
325
  /**
253
326
  * Get the type of all events for a given component. Includes native DOM events
254
327
  * and custom events.
@@ -263,132 +336,102 @@ export interface ImportStencilElements {
263
336
  * // event.currentTarget
264
337
  * }
265
338
  * ```
266
- *
267
- * @remarks
268
- * This helper is intended to be used on components defined within the same
269
- * package. For external components, you can use
270
- * `HTMLArcgisMapElement["arcgisViewClick"]` directly, without need for
271
- * `ToEvents<>`.
272
- *
273
- * @remarks
274
- * Alternative implementation of this type that is simpler, and potentially
275
- * more performant, but looses "go to definition" information.
276
- *
277
- * ```tsx
278
- * export type ToEvents<Component extends { el: unknown }> = {
279
- * [Key in keyof ToJsx<Component> as Key extends `on${infer EventName}`
280
- * ? Uncapitalize<EventName>
281
- * : never]-?: ListenerToPayloadType<ToJsx<Component>[Key]>;
282
- * };
283
- *
284
- * type ListenerToPayloadType<Listener> = Listener extends (event: infer EventType) => unknown ? EventType : never;
285
- * ```
286
- *
287
- * TypeScript issues that may fix this:
288
- * - https://github.com/microsoft/TypeScript/issues/49909
289
- * - https://github.com/microsoft/TypeScript/issues/50715
290
339
  */
291
- export type ToEvents<Component> = GlobalEventTypes<MaybeEl<Component>> & {
340
+ export type ToEvents<Component> = GlobalEventTypes<MaybeEl<Component>>
341
+ & {
292
342
  [Key in keyof Component as ListenerToPayloadType<Component[Key]> extends BaseEvent ? Key : never]-?: ListenerToPayloadType<Component[Key]> & {
293
343
  currentTarget: MaybeEl<Component>;
294
344
  target: MaybeEl<Component>;
295
345
  };
296
346
  };
297
- type MaybeEl<Component> = Component extends {
298
- el: unknown;
299
- } ? Component["el"] : Component;
347
+
348
+ export type MaybeEl<Component> = Component extends { el: unknown; } ? Component["el"] : Component;
349
+
300
350
  export interface TargetedEvent<Target = EventTarget | null, Payload = void> extends BaseEvent {
301
- /**
302
- * Returns any custom data event was created with.
303
- *
304
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
305
- */
306
- readonly detail: Payload;
307
- /**
308
- * Returns the object whose event listener's callback is currently being invoked.
309
- *
310
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
311
- */
312
- readonly currentTarget: Target;
313
- /**
314
- * Returns the object to which event is dispatched (its target).
315
- *
316
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
317
- */
318
- readonly target: Target;
351
+ /**
352
+ * Returns any custom data event was created with.
353
+ *
354
+ * @see [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
355
+ */
356
+ readonly detail: Payload;
357
+ /**
358
+ * Returns the object whose event listener's callback is currently being invoked.
359
+ *
360
+ * @see [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
361
+ */
362
+ readonly currentTarget: Target;
363
+ /**
364
+ * Returns the object to which event is dispatched (its target).
365
+ *
366
+ * @see [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
367
+ */
368
+ readonly target: Target;
319
369
  }
320
- interface BaseEvent extends Omit<Event, "currentTarget" | "target"> {
321
- /** @deprecated */
322
- initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: any): void;
370
+
371
+ /** @internal */
372
+ export interface BaseEvent extends Omit<Event, "currentTarget" | "target"> {
373
+ /**
374
+ * @deprecated Deprecated DOM method. Do not use.
375
+ * @param type
376
+ * @param bubbles
377
+ * @param cancelable
378
+ * @param detail
379
+ */
380
+ initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: any): void;
323
381
  }
382
+
324
383
  /**
325
384
  * From "GlobalEventHandlersCamelCase" extract event names and their payloads.
326
385
  * Not using "HTMLElementEventMap" because that map has all events in lowercase.
386
+ *
387
+ * @internal
327
388
  */
328
- type GlobalEventTypes<Target = HTMLElement> = {
389
+ export type GlobalEventTypes<Target = HTMLElement> = {
329
390
  [Key in keyof GlobalEventHandlersCamelCase<Target> as Key extends `on${infer EventName}` ? Uncapitalize<EventName> : never]-?: Parameters<NonNullable<GlobalEventHandlersCamelCase<Target>[Key]>>[0];
330
391
  };
331
- type ListenerToPayloadType<Listener> = unknown extends Listener ? void : Listener extends {
332
- emit: (...rest: never[]) => infer PayloadType;
333
- } ? PayloadType : Listener extends BaseEvent ? Listener : void;
392
+
393
+ /** @internal */
394
+ export type ListenerToPayloadType<Listener> = unknown extends Listener ? void : Listener extends { emit: (...rest: never[]) => infer PayloadType; } ? PayloadType : Listener extends BaseEvent ? Listener : void;
395
+
334
396
  /**
335
397
  * Defined Lumina custom elements. This interface is used only for internal
336
398
  * type-checking.
337
399
  */
338
- export interface DeclareElements {
339
- }
340
- type ReMappedComponents<Components> = {
341
- [Key in keyof Components]: Components[Key] extends {
342
- el: unknown;
343
- } ? ToJsx<Components[Key]> : never;
400
+ export interface DeclareElements {}
401
+
402
+ /** @internal */
403
+ export type ReMappedComponents<Components> = {
404
+ [Key in keyof Components]: Components[Key] extends { el: unknown; } ? ToJsx<Components[Key]> : never;
344
405
  };
406
+
345
407
  /**
346
408
  * For common properties, add Lumina's types rather than use Stencil's types
409
+ *
410
+ * @internal
347
411
  */
348
- type ReMapStencilComponents<Components> = {
412
+ export type ReMapStencilComponents<Components> = {
349
413
  [Key in keyof Pick<Components, keyof Components & keyof HTMLElementTagNameMap>]: HTMLAttributes<HTMLElementTagNameMap[Key]> & ReMapStencilComponent<Components[Key]>;
350
414
  };
351
- type ReMapStencilComponent<Component> = {
415
+
416
+ /** @internal */
417
+ export type ReMapStencilComponent<Component> = {
352
418
  [Key in keyof Component as FixupStencilEventCasing<Key>]: Component[Key];
353
419
  };
354
- type FixupStencilEventCasing<PropertyName extends PropertyKey> = PropertyName extends `on${infer EventName}` ? `on${Uncapitalize<EventName>}` : PropertyName;
420
+
355
421
  /**
356
- * These typings are based on dom-expressions typings:
357
- * https://github.com/ryansolid/dom-expressions/blob/main/packages/dom-expressions/src/jsx.d.ts
358
- *
359
- * They in turn based the typings on Surplus and Inferno:
360
- * - https://github.com/adamhaile/surplus/blob/master/index.d.ts
361
- * - https://github.com/infernojs/inferno/blob/master/packages/inferno/src/core/types.ts
422
+ * Uncapitalize the event properties to match the syntax of React 19, Preact and
423
+ * Lumina
362
424
  *
363
- * Documentation about how to type JSX in TypeScript:
364
- * https://www.typescriptlang.org/docs/handbook/jsx.html
425
+ * @internal
365
426
  */
366
- export declare namespace LuminaJsx {
367
- export type Element = TemplateResult;
368
- export type ElementType = JsxNode;
369
- export interface ElementClass {
370
- }
371
- export interface ElementAttributesProperty {
372
- }
373
- export interface IntrinsicClassAttributes {
374
- }
375
- export interface ElementChildrenAttribute {
376
- children: JsxNode;
377
- }
378
- export interface IntrinsicAttributes {
379
- /**
380
- * The `key` is a special attribute that can be set on any element.
381
- *
382
- * At build-time it is translated into the `keyed()` directive:
383
- * https://lit.dev/docs/templates/directives/#keyed
384
- *
385
- * @remarks
386
- * Unlike in React or Stencil, any JavaScript value is acceptable as a key
387
- */
388
- key?: unknown;
389
- }
390
- export interface IntrinsicElements extends HTMLElementTags, SvgElementTags, ReMappedComponents<DeclareElements>, ReMapStencilComponents<ImportStencilElements> {
391
- }
392
- export type { CustomAttributes, DOMAttributes, HTMLAttributes, HTMLElementTags, SvgElementTags, AriaAttributes };
393
- }
394
- export {};
427
+ export type FixupStencilEventCasing<PropertyName extends PropertyKey> = PropertyName extends `on${infer EventName}` ? `on${Uncapitalize<EventName>}` : PropertyName;
428
+
429
+ /** @internal */
430
+ export type _TypeHelper<_ extends [
431
+ CustomAttributesAlias,
432
+ DOMAttributesAlias,
433
+ HTMLAttributesAlias,
434
+ HTMLElementTagsAlias,
435
+ SvgElementTagsAlias,
436
+ AriaAttributesAlias
437
+ ]> = void;
@@ -6,32 +6,37 @@
6
6
  * value (which is interpreted by HTML as "true"). To tell Lit that you don't
7
7
  * want the attribute to be present, use the `nothing` value.
8
8
  *
9
- * @example
10
- * ```tsx
11
- * <a href={this.href ?? nothing}>{this.label}</a>
12
- * ```
13
- *
14
- * @remarks
15
9
  * This is not a concern for properties as they are passed as is without
16
10
  * serialization. For this reason, during _JSX to lit-html_ conversion, most JSX
17
11
  * props are converted properties, except for the few cases when an attribute
18
12
  * has no equivalent property.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <a href={this.href ?? nothing}>{this.label}</a>
17
+ * ```
19
18
  */
20
- export declare const nothing: never;
19
+ export const nothing: never;
20
+
21
21
  /**
22
22
  * A sentinel value that signals that a value was handled by a directive and
23
23
  * should not be written to the DOM.
24
24
  *
25
- * @remarks
26
25
  * This is equivalent to Lit's native "noChange", but has type "never" to allow
27
26
  * it be set as a value for any JSX attribute.
28
27
  */
29
- export declare const noChange: never;
28
+ export const noChange: never;
29
+
30
30
  /**
31
31
  * Like native element.setAttribute(), but instead of stringifying nullish
32
32
  * values, will call element.removeAttribute()
33
+ *
34
+ * @param element
35
+ * @param attributeName
36
+ * @param value
33
37
  */
34
- export declare function setAttribute(element: Element, attributeName: string, value: unknown): void;
38
+ export function setAttribute(element: Element, attributeName: string, value: unknown): void;
39
+
35
40
  /**
36
41
  * If you have a property that can be both of string or boolean type, there is
37
42
  * no automatic boolean conversion in place - that means the attribute is
@@ -44,13 +49,13 @@ export declare function setAttribute(element: Element, attributeName: string, va
44
49
  * be either `null` or `""`). This matches the behavior in Stencil.
45
50
  *
46
51
  * ```tsx
47
- * @property({ reflects:true, converter: stringOrBoolean }) icon: string | boolean;
52
+ *
53
+ * @property({
54
+ * reflects:true, converter: stringOrBoolean }) icon: string | boolean;
48
55
  * // ...
49
56
  * this.icon = false; // attribute is removed
50
57
  * this.icon = true; // attribute is ""
51
58
  * this.icon = "name"; // attribute is "name"
52
59
  * ```
53
60
  */
54
- export declare const stringOrBoolean: {
55
- toAttribute: (value: unknown) => string | null;
56
- };
61
+ export const stringOrBoolean: { toAttribute: (value: string) => string | null; };