@timmo001/groundwork-ui 0.9.0 → 0.9.2

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.
@@ -3250,12 +3250,18 @@
3250
3250
  "kind": "field",
3251
3251
  "name": "#lead",
3252
3252
  "privacy": "private",
3253
+ "type": {
3254
+ "text": "HTMLSpanElement"
3255
+ },
3253
3256
  "readonly": true
3254
3257
  },
3255
3258
  {
3256
3259
  "kind": "field",
3257
3260
  "name": "#text",
3258
3261
  "privacy": "private",
3262
+ "type": {
3263
+ "text": "HTMLSpanElement"
3264
+ },
3259
3265
  "readonly": true
3260
3266
  },
3261
3267
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-ui",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Groundwork's framework-free web components, styled by the --gw-* tokens",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/gw-button.ts CHANGED
@@ -366,7 +366,9 @@ export class GwButton extends GwElement {
366
366
 
367
367
  readonly #swatch = h("span", { class: "swatch", "aria-hidden": "true" });
368
368
 
369
- readonly #lead = h(
369
+ // Typed, since inferring through h() and the tag map that holds this
370
+ // element is circular for consumers that type-check the source
371
+ readonly #lead: HTMLSpanElement = h(
370
372
  "span",
371
373
  { class: "lead" },
372
374
  this.#icon,
@@ -375,7 +377,7 @@ export class GwButton extends GwElement {
375
377
  h("span", { class: "ring" }),
376
378
  );
377
379
 
378
- readonly #text = h("span", { class: "text" }, h("slot"));
380
+ readonly #text: HTMLSpanElement = h("span", { class: "text" }, h("slot"));
379
381
 
380
382
  readonly #over = h("span", { class: "ring over" });
381
383
 
package/src/on.ts CHANGED
@@ -12,12 +12,26 @@ export type { GwEventMap } from "./events.js";
12
12
 
13
13
  type EventTag = keyof GwEventMap;
14
14
 
15
+ /**
16
+ * Each event-firing element's class, by tag. An app only declares the tags it
17
+ * imports, so the ones it doesn't load are `never` rather than an error.
18
+ */
19
+ type Loaded = {
20
+ [T in EventTag]: T extends keyof HTMLElementTagNameMap
21
+ ? HTMLElementTagNameMap[T]
22
+ : never;
23
+ };
24
+
15
25
  /** A `gw-` element that fires events of its own. */
16
- export type GwEventTarget = HTMLElementTagNameMap[EventTag];
26
+ export type GwEventTarget = Loaded[EventTag];
17
27
 
18
28
  /** The events an element fires, found from the tag its class is defined for. */
19
29
  export type GwEventsOf<E extends GwEventTarget> = {
20
- [T in EventTag]: E extends HTMLElementTagNameMap[T] ? GwEventMap[T] : never;
30
+ [T in EventTag]: [Loaded[T]] extends [never]
31
+ ? never
32
+ : E extends Loaded[T]
33
+ ? GwEventMap[T]
34
+ : never;
21
35
  }[EventTag];
22
36
 
23
37
  /**