@glasshome/ui 1.1.1 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/glasshome/ui#readme",
@@ -1,11 +1,4 @@
1
1
  ---
2
- /**
3
- * Static tone alert/callout for Astro / SSR pages — the same `ALERT_TONES` table
4
- * and surface recipe the Solid <Alert> and hub's docs Callout use, rendered as
5
- * plain HTML with zero JS and the lucide glyph inlined as SVG (no icon runtime).
6
- * Drop this into `.astro` markup instead of hand-writing a
7
- * `rounded-lg border border-primary/40 bg-primary/10` note box.
8
- */
9
2
  import {
10
3
  ALERT_CLASS,
11
4
  ALERT_CONTENT_CLASS,
@@ -19,12 +12,19 @@ import {
19
12
  cn,
20
13
  glassToneText,
21
14
  } from "@glasshome/ui";
15
+ /**
16
+ * Static tone alert/callout for Astro / SSR pages — the same `ALERT_TONES` table
17
+ * and surface recipe the Solid <Alert> and hub's docs Callout use, rendered as
18
+ * plain HTML with zero JS and the lucide glyph inlined as SVG (no icon runtime).
19
+ * Drop this into `.astro` markup instead of hand-writing a
20
+ * `rounded-lg border border-primary/40 bg-primary/10` note box.
21
+ */
22
+ import type { HTMLAttributes } from "astro/types";
22
23
 
23
- interface Props {
24
+ interface Props extends HTMLAttributes<"div"> {
24
25
  tone?: AlertTone;
25
26
  /** Bold heading line. Optional. */
26
27
  title?: string;
27
- class?: string;
28
28
  }
29
29
 
30
30
  const { tone = "info", title, class: className, ...rest } = Astro.props;
@@ -1,12 +1,14 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from "astro/types";
2
3
  import { BADGE_DEFAULT_TONE, BADGE_TONE_CLASS } from "../lib/badge-tone";
3
4
  import { cn } from "../lib/utils";
4
5
 
5
- interface Props {
6
+ // Polymorphic because `as` changes the rendered tag: everything not
7
+ // destructured below is spread onto it, so that tag's attributes must be
8
+ // accepted.
9
+ type Props<Tag extends HTMLTag = "span"> = Polymorphic<{ as: Tag }> & {
6
10
  tone?: string;
7
- as?: keyof HTMLElementTagNameMap;
8
- class?: string;
9
- }
11
+ };
10
12
 
11
13
  const { tone = BADGE_DEFAULT_TONE, as: Tag = "span", class: className, ...rest } = Astro.props;
12
14
  ---
@@ -1,4 +1,7 @@
1
1
  ---
2
+ import { buttonVariants, cn } from "@glasshome/ui";
3
+ import type { HTMLAttributes } from "astro/types";
4
+
2
5
  /**
3
6
  * Static button/CTA for Astro / SSR pages — the same `buttonVariants` recipe the
4
7
  * Solid <Button> uses, rendered as a plain <a>/<button> with zero JS. Drop this
@@ -9,15 +12,16 @@
9
12
  * (sizeless: color + shape only) so marketing CTAs supply their own height and
10
13
  * padding via `class`, matching how the hub pill tokens are used.
11
14
  */
12
- import { buttonVariants, cn } from "@glasshome/ui";
13
15
 
14
- interface Props {
15
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
16
- size?: "default" | "sm" | "lg" | "icon" | "none";
17
- href?: string;
18
- type?: "button" | "submit" | "reset";
19
- class?: string;
20
- }
16
+ // Renders <a> when href is set, <button> otherwise. `type` is omitted from the
17
+ // button attributes because this component narrows it to the three form values.
18
+ type Props = Omit<HTMLAttributes<"button">, "type"> &
19
+ Partial<Pick<HTMLAttributes<"a">, "target" | "rel" | "download">> & {
20
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
21
+ size?: "default" | "sm" | "lg" | "icon" | "none";
22
+ href?: string;
23
+ type?: "button" | "submit" | "reset";
24
+ };
21
25
 
22
26
  const {
23
27
  variant = "default",
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import type { HTMLAttributes } from "astro/types";
2
3
  import {
3
4
  CARD_INTERACTIVE,
4
5
  CARD_PADDING,
@@ -8,12 +9,20 @@ import {
8
9
  } from "../lib/card-classes";
9
10
  import { cn } from "../lib/utils";
10
11
 
11
- interface Props {
12
+ // Everything not destructured below is spread onto the rendered tag, so its
13
+ // attributes must be accepted. Not Polymorphic<>: call sites pick the tag at
14
+ // runtime (`as={href ? "a" : "div"}`), which widens to a union that a generic
15
+ // tag parameter cannot resolve. The div attributes are the base; the handful
16
+ // belonging to the other tags this is used as are named.
17
+ interface Props
18
+ extends HTMLAttributes<"div">,
19
+ Partial<Pick<HTMLAttributes<"a">, "href" | "target" | "rel">>,
20
+ Partial<Pick<HTMLAttributes<"details">, "name" | "open">> {
12
21
  as?: keyof HTMLElementTagNameMap;
13
22
  interactive?: boolean;
14
23
  opaque?: boolean;
15
24
  padding?: CardPadding;
16
- class?: string;
25
+ type?: "button" | "submit" | "reset";
17
26
  }
18
27
 
19
28
  const {
@@ -1,14 +1,4 @@
1
1
  ---
2
- /**
3
- * The GlassHome lockup for Astro / SSR pages — the same spec the Solid <Logo>
4
- * renders, as plain HTML with zero JS. Use this instead of hand-building a
5
- * mark + "GlassHome" + sub-line stack; that is how the lockup ended up in six
6
- * shapes across the repos.
7
- *
8
- * `href` renders the whole lockup as a link. The `sub` slot replaces the
9
- * sub-brand line for surfaces that animate over it (e.g. hub's launch
10
- * countdown cross-fade); it inherits nothing, so pass LOGO_SUB_CLASS yourself.
11
- */
12
2
  import {
13
3
  cn,
14
4
  LOGO_DEFAULT_SIZE,
@@ -23,8 +13,23 @@ import {
23
13
  LOGO_SUB_CLASS,
24
14
  type LogoSize,
25
15
  } from "@glasshome/ui";
16
+ /**
17
+ * The GlassHome lockup for Astro / SSR pages — the same spec the Solid <Logo>
18
+ * renders, as plain HTML with zero JS. Use this instead of hand-building a
19
+ * mark + "GlassHome" + sub-line stack; that is how the lockup ended up in six
20
+ * shapes across the repos.
21
+ *
22
+ * `href` renders the whole lockup as a link. The `sub` slot replaces the
23
+ * sub-brand line for surfaces that animate over it (e.g. hub's launch
24
+ * countdown cross-fade); it inherits nothing, so pass LOGO_SUB_CLASS yourself.
25
+ */
26
+ import type { HTMLAttributes } from "astro/types";
26
27
 
27
- interface Props {
28
+ // Renders <a> when href is set, <div> otherwise, so the div attributes are the
29
+ // common base and the anchor-only ones a lockup link actually wants are added.
30
+ interface Props
31
+ extends HTMLAttributes<"div">,
32
+ Partial<Pick<HTMLAttributes<"a">, "target" | "rel">> {
28
33
  /** Sub-brand line. Defaults to "Dash". */
29
34
  sub?: string;
30
35
  size?: LogoSize;
@@ -32,7 +37,6 @@ interface Props {
32
37
  href?: string;
33
38
  /** Override the mark asset. Both apps serve the default path. */
34
39
  src?: string;
35
- class?: string;
36
40
  /** Extra classes for the mark, e.g. a hover transform. */
37
41
  markClass?: string;
38
42
  }
@@ -4,10 +4,11 @@
4
4
  * FOUNDER) — the same tier tokens the Solid <TierBadge> uses, rendered as plain
5
5
  * HTML with zero JS. One family; only the hi/lo/text triplet changes per tier.
6
6
  */
7
+ import type { HTMLAttributes } from "astro/types";
7
8
  import { TIER_BADGE_CLASS, tierBadgeStyle } from "../lib/tier-badge";
8
9
  import { cn } from "../lib/utils";
9
10
 
10
- interface Props {
11
+ interface Props extends HTMLAttributes<"span"> {
11
12
  /** Gradient high stop (the near end of the diagonal sweep, and by default
12
13
  * the far end too). */
13
14
  hi: string;
@@ -19,7 +20,6 @@ interface Props {
19
20
  end?: string;
20
21
  /** Where `lo` sits, in percent. Default: 50. */
21
22
  stop?: number;
22
- class?: string;
23
23
  }
24
24
 
25
25
  const { hi, lo, text, end, stop, class: className, ...rest } = Astro.props;