@glasshome/ui 1.21.0 → 1.21.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.
Files changed (154) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/use-is-mobile.d.ts +3 -1
  4. package/dist/solid/alert-dialog.d.ts +7 -1
  5. package/dist/solid/bottom-sheet/bottom-sheet.d.ts +7 -1
  6. package/dist/solid/dialog-parts.d.ts +3 -2
  7. package/dist/solid/dialog.d.ts +7 -1
  8. package/dist/solid/docked-panel.d.ts +7 -1
  9. package/dist/solid/index.d.ts +9 -9
  10. package/dist/solid/index.js +5456 -5447
  11. package/dist/solid/media-store.d.ts +4 -1
  12. package/dist/solid/option-card.d.ts +4 -1
  13. package/dist/solid/responsive-dialog.d.ts +7 -1
  14. package/dist/solid/sheet.d.ts +7 -1
  15. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  16. package/package.json +128 -126
  17. package/scripts/check-gallery.ts +142 -142
  18. package/scripts/check-pack.ts +13 -13
  19. package/scripts/check-structural-classes.ts +20 -20
  20. package/scripts/check-tokens.ts +27 -27
  21. package/scripts/check-ui-drift.mjs +103 -103
  22. package/src/index.ts +75 -80
  23. package/src/lib/alert-tones.ts +41 -41
  24. package/src/lib/anchor-placement.ts +21 -21
  25. package/src/lib/button-variants.ts +28 -28
  26. package/src/lib/card-classes.ts +9 -9
  27. package/src/lib/carousel-classes.ts +14 -14
  28. package/src/lib/glass-tone.ts +11 -11
  29. package/src/lib/input-classes.ts +6 -6
  30. package/src/lib/layers.ts +4 -4
  31. package/src/lib/logo-lockup.ts +8 -8
  32. package/src/lib/menu-classes.ts +2 -2
  33. package/src/lib/motion-classes.ts +8 -8
  34. package/src/lib/motion-window.ts +24 -24
  35. package/src/lib/overlay-classes.ts +6 -6
  36. package/src/lib/pill-classes.ts +3 -3
  37. package/src/lib/position-bar-classes.ts +1 -1
  38. package/src/lib/spotlight-geometry.ts +67 -67
  39. package/src/lib/thumb-classes.ts +2 -2
  40. package/src/lib/tier-badge.ts +16 -16
  41. package/src/lib/use-is-mobile.ts +17 -14
  42. package/src/lib/utils.ts +1 -1
  43. package/src/solid/accordion.tsx +41 -41
  44. package/src/solid/alert-dialog.tsx +95 -95
  45. package/src/solid/alert.tsx +88 -88
  46. package/src/solid/area-picker.tsx +204 -204
  47. package/src/solid/aspect-ratio.tsx +13 -13
  48. package/src/solid/avatar.tsx +27 -27
  49. package/src/solid/badge.tsx +49 -49
  50. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  51. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  52. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  53. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  54. package/src/solid/bottom-sheet/index.ts +12 -12
  55. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  56. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  57. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  58. package/src/solid/bottom-sheet/velocity.ts +29 -29
  59. package/src/solid/breadcrumb.tsx +76 -76
  60. package/src/solid/button-group.tsx +46 -46
  61. package/src/solid/button.tsx +19 -19
  62. package/src/solid/card.tsx +67 -67
  63. package/src/solid/carousel.tsx +246 -246
  64. package/src/solid/charts.tsx +253 -253
  65. package/src/solid/checkbox.tsx +51 -51
  66. package/src/solid/collapsible.tsx +22 -22
  67. package/src/solid/color-disc.tsx +213 -213
  68. package/src/solid/color-slider.tsx +81 -81
  69. package/src/solid/color-wheel.tsx +61 -61
  70. package/src/solid/context-menu.tsx +63 -63
  71. package/src/solid/copy-button.tsx +31 -31
  72. package/src/solid/count-pill.tsx +11 -11
  73. package/src/solid/dashboard-preview.tsx +104 -104
  74. package/src/solid/data-table.tsx +228 -228
  75. package/src/solid/dialog-parts.tsx +129 -129
  76. package/src/solid/dialog.tsx +113 -113
  77. package/src/solid/dock-paging.ts +9 -9
  78. package/src/solid/dock.tsx +339 -338
  79. package/src/solid/docked-panel.tsx +35 -35
  80. package/src/solid/dropdown-menu.tsx +77 -77
  81. package/src/solid/empty.tsx +70 -70
  82. package/src/solid/entity-data.ts +38 -38
  83. package/src/solid/entity-selector.tsx +634 -634
  84. package/src/solid/field.tsx +205 -205
  85. package/src/solid/form.tsx +159 -159
  86. package/src/solid/hero-action.tsx +85 -85
  87. package/src/solid/hover-card.tsx +11 -11
  88. package/src/solid/icon-picker.tsx +401 -401
  89. package/src/solid/icon.tsx +101 -78
  90. package/src/solid/image-picker.tsx +416 -414
  91. package/src/solid/index.ts +265 -304
  92. package/src/solid/input-group.tsx +123 -123
  93. package/src/solid/input-otp.tsx +143 -143
  94. package/src/solid/input.tsx +4 -4
  95. package/src/solid/item.tsx +130 -130
  96. package/src/solid/kbd.tsx +20 -20
  97. package/src/solid/label.tsx +12 -12
  98. package/src/solid/list-reorder.ts +122 -122
  99. package/src/solid/logo.tsx +60 -60
  100. package/src/solid/media-copy.ts +21 -21
  101. package/src/solid/media-store.ts +60 -57
  102. package/src/solid/media-tile.tsx +85 -85
  103. package/src/solid/menu-parts.tsx +164 -164
  104. package/src/solid/number-field.tsx +56 -56
  105. package/src/solid/option-card.tsx +168 -165
  106. package/src/solid/ornament.tsx +43 -43
  107. package/src/solid/overlay.tsx +4 -4
  108. package/src/solid/page-header.tsx +75 -75
  109. package/src/solid/pagination.tsx +80 -80
  110. package/src/solid/password-input.tsx +51 -51
  111. package/src/solid/picker-row.tsx +83 -83
  112. package/src/solid/picker-search.tsx +65 -63
  113. package/src/solid/picker-trigger.tsx +59 -57
  114. package/src/solid/popover.tsx +54 -54
  115. package/src/solid/preview-tile.tsx +67 -67
  116. package/src/solid/progress.tsx +21 -21
  117. package/src/solid/radio-group.tsx +51 -51
  118. package/src/solid/resizable.tsx +128 -128
  119. package/src/solid/responsive-dialog.tsx +134 -134
  120. package/src/solid/schema-form.tsx +746 -739
  121. package/src/solid/scope-indicator.tsx +5 -5
  122. package/src/solid/scroll-area.tsx +16 -16
  123. package/src/solid/section-card.tsx +281 -281
  124. package/src/solid/select.tsx +101 -101
  125. package/src/solid/separator.tsx +25 -25
  126. package/src/solid/settings-row.tsx +122 -122
  127. package/src/solid/sheet.tsx +96 -96
  128. package/src/solid/skeleton.tsx +8 -8
  129. package/src/solid/slider.tsx +132 -132
  130. package/src/solid/sliding-indicator.tsx +280 -265
  131. package/src/solid/sonner.tsx +164 -164
  132. package/src/solid/spinner.tsx +12 -12
  133. package/src/solid/spotlight.tsx +140 -140
  134. package/src/solid/step-indicator.tsx +18 -18
  135. package/src/solid/swatch-picker.tsx +38 -38
  136. package/src/solid/switch.tsx +52 -52
  137. package/src/solid/table.tsx +63 -63
  138. package/src/solid/tabs.tsx +93 -93
  139. package/src/solid/textarea.tsx +8 -8
  140. package/src/solid/toggle-group.tsx +83 -83
  141. package/src/solid/toggle.tsx +33 -33
  142. package/src/solid/tooltip.tsx +16 -16
  143. package/src/solid/widget-card.tsx +90 -90
  144. package/src/solid/widget-identity.tsx +99 -99
  145. package/src/solid/widget-trust-badge.tsx +20 -20
  146. package/src/styles/globals.css +316 -319
  147. package/src/styles/theme.css +448 -448
  148. package/src/tokens/hex.ts +29 -29
  149. package/src/tokens/material.ts +75 -75
  150. package/src/tokens/presets.ts +303 -303
  151. package/src/tokens/readability.ts +32 -32
  152. package/src/tokens/theme-colors.ts +95 -95
  153. package/src/tokens/theme-css.ts +22 -22
  154. package/src/tokens/theme-recipe.ts +106 -106
@@ -7,22 +7,22 @@ import { SEGMENT_ITEM } from "../lib/segment-classes.js";
7
7
  import { cn } from "../lib/utils.js";
8
8
 
9
9
  const toggleVariants = cva({
10
- base: `${SEGMENT_ITEM} border border-transparent aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
11
- variants: {
12
- variant: {
13
- default: "bg-transparent",
14
- outline: OUTLINE_SURFACE,
15
- },
16
- size: {
17
- default: `${CONTROL_H.default} min-w-9 px-2`,
18
- sm: `${CONTROL_H.sm} min-w-8 px-1.5`,
19
- lg: `${CONTROL_H.lg} min-w-10 px-2.5`,
20
- },
21
- },
22
- defaultVariants: {
23
- variant: "default",
24
- size: "default",
25
- },
10
+ base: `${SEGMENT_ITEM} aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 border border-transparent [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,
11
+ variants: {
12
+ variant: {
13
+ default: "bg-transparent",
14
+ outline: OUTLINE_SURFACE,
15
+ },
16
+ size: {
17
+ default: `${CONTROL_H.default} min-w-9 px-2`,
18
+ sm: `${CONTROL_H.sm} min-w-8 px-1.5`,
19
+ lg: `${CONTROL_H.lg} min-w-10 px-2.5`,
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ size: "default",
25
+ },
26
26
  });
27
27
 
28
28
  /* The hover fill lives here, not in the shared variants: a ToggleGroupItem
@@ -31,27 +31,27 @@ const toggleVariants = cva({
31
31
  * adds to cancel it. Unpressed only, because a background utility is a no-op
32
32
  * once `data-[pressed]:glass` engages, so the pressed hover bumps a knob. */
33
33
  const TOGGLE_HOVER: Record<"default" | "outline", string> = {
34
- default:
35
- "not-data-[pressed]:hover:bg-muted not-data-[pressed]:hover:text-muted-foreground data-[pressed]:hover:[--glass-wash:40%]",
36
- outline: "",
34
+ default:
35
+ "not-data-[pressed]:hover:bg-muted not-data-[pressed]:hover:text-muted-foreground data-[pressed]:hover:[--glass-wash:40%]",
36
+ outline: "",
37
37
  };
38
38
 
39
39
  const Toggle: Component<
40
- ComponentProps<typeof ToggleButtonPrimitive> & VariantProps<typeof toggleVariants>
40
+ ComponentProps<typeof ToggleButtonPrimitive> & VariantProps<typeof toggleVariants>
41
41
  > = (props) => {
42
- const [local, rest] = splitProps(props, ["class", "variant", "size"] as const);
43
- return (
44
- <ToggleButtonPrimitive
45
- data-slot="toggle"
46
- class={cn(
47
- toggleVariants({ variant: local.variant, size: local.size }),
48
- TOGGLE_HOVER[local.variant ?? "default"],
49
- "data-[pressed]:glass data-[pressed]:[--glass-tone:var(--primary)]",
50
- local.class,
51
- )}
52
- {...rest}
53
- />
54
- );
42
+ const [local, rest] = splitProps(props, ["class", "variant", "size"] as const);
43
+ return (
44
+ <ToggleButtonPrimitive
45
+ data-slot="toggle"
46
+ class={cn(
47
+ toggleVariants({ variant: local.variant, size: local.size }),
48
+ TOGGLE_HOVER[local.variant ?? "default"],
49
+ "data-[pressed]:glass data-[pressed]:[--glass-tone:var(--primary)]",
50
+ local.class,
51
+ )}
52
+ {...rest}
53
+ />
54
+ );
55
55
  };
56
56
 
57
57
  export { Toggle, toggleVariants };
@@ -7,7 +7,7 @@ import { cn } from "../lib/utils.js";
7
7
  /* Kobalte takes the popper options on the root, not on the content, so the
8
8
  * gutter that keeps the panel off its trigger has to default here. */
9
9
  const TooltipRoot: Component<ComponentProps<typeof TooltipPrimitive>> = (props) => (
10
- <TooltipPrimitive gutter={6} {...props} />
10
+ <TooltipPrimitive gutter={6} {...props} />
11
11
  );
12
12
 
13
13
  /* Object.assign, not a bare wrapper: Kobalte ships Tooltip as a callable
@@ -18,21 +18,21 @@ const Tooltip = Object.assign(TooltipRoot, TooltipPrimitive);
18
18
  const TooltipTrigger = TooltipPrimitive.Trigger;
19
19
 
20
20
  const TooltipContent: Component<ComponentProps<typeof TooltipPrimitive.Content>> = (props) => {
21
- const [local, others] = splitProps(props, ["class"]);
22
- return (
23
- <TooltipPrimitive.Portal>
24
- <TooltipPrimitive.Content
25
- data-slot="tooltip-content"
26
- class={cn(
27
- FLOATING_PANEL,
28
- OVERLAY_MOTION,
29
- "overflow-hidden px-3 py-1.5 text-xs",
30
- local.class,
31
- )}
32
- {...others}
33
- />
34
- </TooltipPrimitive.Portal>
35
- );
21
+ const [local, others] = splitProps(props, ["class"]);
22
+ return (
23
+ <TooltipPrimitive.Portal>
24
+ <TooltipPrimitive.Content
25
+ data-slot="tooltip-content"
26
+ class={cn(
27
+ FLOATING_PANEL,
28
+ OVERLAY_MOTION,
29
+ "overflow-hidden px-3 py-1.5 text-xs",
30
+ local.class,
31
+ )}
32
+ {...others}
33
+ />
34
+ </TooltipPrimitive.Portal>
35
+ );
36
36
  };
37
37
 
38
38
  export { Tooltip, TooltipContent, TooltipTrigger };
@@ -11,108 +11,108 @@ import { WidgetIdentity, WidgetMeta, type WidgetSummary, widgetHref } from "./wi
11
11
  * apps; the data model is `WidgetSummary`.
12
12
  */
13
13
  type WidgetCardProps = {
14
- widget: WidgetSummary;
15
- /** `row` for dense lists, `tile` for grids/galleries. Default `row`. */
16
- layout?: "row" | "tile";
17
- /** When set, the whole card becomes a link. */
18
- href?: string;
19
- /** Click handler (used when no href). */
20
- onClick?: (e: MouseEvent) => void;
21
- /** Show the (personal/org) scope pill. Default false. */
22
- showScopeIndicator?: boolean;
23
- /** Show the version-count meta. Default false. */
24
- showVersions?: boolean;
25
- /** Show the description (tile only). Default true for tiles. */
26
- showDescription?: boolean;
27
- /** Custom trailing element for the row layout. Defaults to a chevron when
28
- * the card is interactive (href/onClick), otherwise nothing. */
29
- trailing?: JSX.Element;
30
- class?: string;
14
+ widget: WidgetSummary;
15
+ /** `row` for dense lists, `tile` for grids/galleries. Default `row`. */
16
+ layout?: "row" | "tile";
17
+ /** When set, the whole card becomes a link. */
18
+ href?: string;
19
+ /** Click handler (used when no href). */
20
+ onClick?: (e: MouseEvent) => void;
21
+ /** Show the (personal/org) scope pill. Default false. */
22
+ showScopeIndicator?: boolean;
23
+ /** Show the version-count meta. Default false. */
24
+ showVersions?: boolean;
25
+ /** Show the description (tile only). Default true for tiles. */
26
+ showDescription?: boolean;
27
+ /** Custom trailing element for the row layout. Defaults to a chevron when
28
+ * the card is interactive (href/onClick), otherwise nothing. */
29
+ trailing?: JSX.Element;
30
+ class?: string;
31
31
  };
32
32
 
33
33
  export function WidgetCard(_props: WidgetCardProps) {
34
- const props = mergeProps({ layout: "row" as const }, _props);
35
- // Default: link to the widget's public page. A call-site that wants different
36
- // behavior (e.g. open a dialog) passes `onClick` and opts out of the link.
37
- const href = () => props.href ?? (props.onClick ? undefined : widgetHref(props.widget));
38
- const interactive = () => href() != null || props.onClick != null;
34
+ const props = mergeProps({ layout: "row" as const }, _props);
35
+ // Default: link to the widget's public page. A call-site that wants different
36
+ // behavior (e.g. open a dialog) passes `onClick` and opts out of the link.
37
+ const href = () => props.href ?? (props.onClick ? undefined : widgetHref(props.widget));
38
+ const interactive = () => href() != null || props.onClick != null;
39
39
 
40
- return (
41
- <Show
42
- when={props.layout === "tile"}
43
- fallback={<WidgetCardRow {...props} href={href()} interactive={interactive()} />}
44
- >
45
- <WidgetCardTile {...props} href={href()} interactive={interactive()} />
46
- </Show>
47
- );
40
+ return (
41
+ <Show
42
+ when={props.layout === "tile"}
43
+ fallback={<WidgetCardRow {...props} href={href()} interactive={interactive()} />}
44
+ >
45
+ <WidgetCardTile {...props} href={href()} interactive={interactive()} />
46
+ </Show>
47
+ );
48
48
  }
49
49
 
50
50
  type InternalProps = WidgetCardProps & { interactive: boolean };
51
51
 
52
52
  function WidgetCardRow(props: InternalProps) {
53
- const hasMeta = () =>
54
- props.widget.downloadCount != null || (props.showVersions && props.widget.versionCount != null);
55
- const showTrailing = () => props.trailing !== undefined || props.interactive;
53
+ const hasMeta = () =>
54
+ props.widget.downloadCount != null || (props.showVersions && props.widget.versionCount != null);
55
+ const showTrailing = () => props.trailing !== undefined || props.interactive;
56
56
 
57
- return (
58
- <Card
59
- as={props.href ? "a" : "div"}
60
- href={props.href}
61
- onClick={props.onClick}
62
- interactive={props.interactive}
63
- padding="sm"
64
- class={cn("group flex-row items-center gap-3", props.class)}
65
- >
66
- <WidgetIdentity
67
- widget={props.widget}
68
- iconSize="sm"
69
- showScopeIndicator={props.showScopeIndicator}
70
- class="flex-1"
71
- />
72
- <Show when={hasMeta()}>
73
- <WidgetMeta widget={props.widget} showVersions={props.showVersions} class="shrink-0" />
74
- </Show>
75
- <Show when={showTrailing()} fallback={null}>
76
- <Show
77
- when={props.trailing !== undefined}
78
- fallback={
79
- <Icon
80
- icon="lucide:chevron-right"
81
- width={16}
82
- height={16}
83
- class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-foreground"
84
- />
85
- }
86
- >
87
- {props.trailing}
88
- </Show>
89
- </Show>
90
- </Card>
91
- );
57
+ return (
58
+ <Card
59
+ as={props.href ? "a" : "div"}
60
+ href={props.href}
61
+ onClick={props.onClick}
62
+ interactive={props.interactive}
63
+ padding="sm"
64
+ class={cn("group flex-row items-center gap-3", props.class)}
65
+ >
66
+ <WidgetIdentity
67
+ widget={props.widget}
68
+ iconSize="sm"
69
+ showScopeIndicator={props.showScopeIndicator}
70
+ class="flex-1"
71
+ />
72
+ <Show when={hasMeta()}>
73
+ <WidgetMeta widget={props.widget} showVersions={props.showVersions} class="shrink-0" />
74
+ </Show>
75
+ <Show when={showTrailing()} fallback={null}>
76
+ <Show
77
+ when={props.trailing !== undefined}
78
+ fallback={
79
+ <Icon
80
+ icon="lucide:chevron-right"
81
+ width={16}
82
+ height={16}
83
+ class="text-muted-foreground group-hover:text-foreground h-4 w-4 shrink-0 transition-transform duration-200 group-hover:translate-x-0.5"
84
+ />
85
+ }
86
+ >
87
+ {props.trailing}
88
+ </Show>
89
+ </Show>
90
+ </Card>
91
+ );
92
92
  }
93
93
 
94
94
  function WidgetCardTile(props: InternalProps) {
95
- const showDescription = () => props.showDescription !== false;
95
+ const showDescription = () => props.showDescription !== false;
96
96
 
97
- return (
98
- <Card
99
- as={props.href ? "a" : "div"}
100
- href={props.href}
101
- onClick={props.onClick}
102
- interactive={props.interactive}
103
- padding="md"
104
- class={cn("group h-full", props.class)}
105
- >
106
- {/* flex-1 body: the meta stays pinned to the tile's foot whether the description is long, missing or off. */}
107
- <div data-slot="widget-card-body" class="flex flex-1 flex-col gap-3">
108
- <WidgetIdentity widget={props.widget} iconSize="md" showVersionInline={false} />
109
- <Show when={showDescription() && props.widget.description}>
110
- <p class="line-clamp-2 text-muted-foreground text-xs leading-relaxed">
111
- {props.widget.description}
112
- </p>
113
- </Show>
114
- </div>
115
- <WidgetMeta widget={props.widget} showLatestVersion />
116
- </Card>
117
- );
97
+ return (
98
+ <Card
99
+ as={props.href ? "a" : "div"}
100
+ href={props.href}
101
+ onClick={props.onClick}
102
+ interactive={props.interactive}
103
+ padding="md"
104
+ class={cn("group h-full", props.class)}
105
+ >
106
+ {/* flex-1 body: the meta stays pinned to the tile's foot whether the description is long, missing or off. */}
107
+ <div data-slot="widget-card-body" class="flex flex-1 flex-col gap-3">
108
+ <WidgetIdentity widget={props.widget} iconSize="md" showVersionInline={false} />
109
+ <Show when={showDescription() && props.widget.description}>
110
+ <p class="text-muted-foreground line-clamp-2 text-xs leading-relaxed">
111
+ {props.widget.description}
112
+ </p>
113
+ </Show>
114
+ </div>
115
+ <WidgetMeta widget={props.widget} showLatestVersion />
116
+ </Card>
117
+ );
118
118
  }
@@ -15,123 +15,123 @@ import { WidgetTrustBadge } from "./widget-trust-badge.js";
15
15
  * `WidgetSummary`.
16
16
  */
17
17
  export interface WidgetSummary {
18
- scope: string;
19
- name: string;
20
- displayName?: string | null;
21
- icon?: string | null;
22
- description?: string | null;
23
- isOfficial?: boolean;
24
- isUnlisted?: boolean;
25
- /** Newest version never finished publishing (bundle upload never confirmed,
26
- * or no version row at all), so nothing is installable. Distinct from
27
- * `isUnlisted`, which is a published widget hidden from search.
28
- * Owner-facing surfaces set it; public ones leave it off. */
29
- isUnpublished?: boolean;
30
- downloadCount?: number;
31
- latestVersion?: string | null;
32
- versionCount?: number;
33
- ownerType?: "personal" | "organization";
18
+ scope: string;
19
+ name: string;
20
+ displayName?: string | null;
21
+ icon?: string | null;
22
+ description?: string | null;
23
+ isOfficial?: boolean;
24
+ isUnlisted?: boolean;
25
+ /** Newest version never finished publishing (bundle upload never confirmed,
26
+ * or no version row at all), so nothing is installable. Distinct from
27
+ * `isUnlisted`, which is a published widget hidden from search.
28
+ * Owner-facing surfaces set it; public ones leave it off. */
29
+ isUnpublished?: boolean;
30
+ downloadCount?: number;
31
+ latestVersion?: string | null;
32
+ versionCount?: number;
33
+ ownerType?: "personal" | "organization";
34
34
  }
35
35
 
36
36
  /** Canonical public detail URL for a widget (`/widgets/@scope/name`). */
37
37
  export function widgetHref(w: { scope: string; name: string }): string {
38
- return `/widgets/@${w.scope}/${w.name}`;
38
+ return `/widgets/@${w.scope}/${w.name}`;
39
39
  }
40
40
 
41
41
  /** Compact download/count formatting, shared by every surface. */
42
42
  export function formatWidgetCount(n: number | null | undefined): string {
43
- const v = n ?? 0;
44
- if (v >= 1_000_000) return `${(v / 1_000_000).toFixed(1)}M`;
45
- if (v >= 1000) return `${(v / 1000).toFixed(1)}k`;
46
- return v.toString();
43
+ const v = n ?? 0;
44
+ if (v >= 1_000_000) return `${(v / 1_000_000).toFixed(1)}M`;
45
+ if (v >= 1000) return `${(v / 1000).toFixed(1)}k`;
46
+ return v.toString();
47
47
  }
48
48
 
49
49
  type WidgetIdentityProps = {
50
- widget: WidgetSummary;
51
- /** Icon pill size. Rows use sm, tiles use md. */
52
- iconSize?: "sm" | "md";
53
- /** CSS color for the icon pill; neutral when unset. */
54
- iconTone?: string;
55
- /** Append `v{latestVersion}` next to the name. Default true. */
56
- showVersionInline?: boolean;
57
- /** Show the (personal/org) scope pill after the @scope/name line. */
58
- showScopeIndicator?: boolean;
59
- class?: string;
50
+ widget: WidgetSummary;
51
+ /** Icon pill size. Rows use sm, tiles use md. */
52
+ iconSize?: "sm" | "md";
53
+ /** CSS color for the icon pill; neutral when unset. */
54
+ iconTone?: string;
55
+ /** Append `v{latestVersion}` next to the name. Default true. */
56
+ showVersionInline?: boolean;
57
+ /** Show the (personal/org) scope pill after the @scope/name line. */
58
+ showScopeIndicator?: boolean;
59
+ class?: string;
60
60
  };
61
61
 
62
62
  export function WidgetIdentity(_props: WidgetIdentityProps) {
63
- const props = mergeProps({ iconSize: "sm" as const, showVersionInline: true }, _props);
64
- return (
65
- <div data-slot="widget-identity" class={cn("flex min-w-0 items-center gap-3", props.class)}>
66
- <SectionIcon size={props.iconSize} tone={props.iconTone}>
67
- <Show when={props.widget.icon} fallback={<Icon icon="lucide:package" />}>
68
- {(icon) => <Icon icon={icon()} />}
69
- </Show>
70
- </SectionIcon>
71
- <div data-slot="widget-identity-headings" class="flex min-w-0 flex-1 flex-col gap-0.5">
72
- <div data-slot="widget-identity-headline" class="flex items-center gap-2">
73
- <SectionSubtitle class="truncate">
74
- {props.widget.displayName || props.widget.name}
75
- </SectionSubtitle>
76
- <Show when={props.showVersionInline && props.widget.latestVersion}>
77
- <span class="shrink-0 font-mono text-muted-foreground text-xs tabular-nums">
78
- v{props.widget.latestVersion}
79
- </span>
80
- </Show>
81
- <WidgetTrustBadge isOfficial={!!props.widget.isOfficial} />
63
+ const props = mergeProps({ iconSize: "sm" as const, showVersionInline: true }, _props);
64
+ return (
65
+ <div data-slot="widget-identity" class={cn("flex min-w-0 items-center gap-3", props.class)}>
66
+ <SectionIcon size={props.iconSize} tone={props.iconTone}>
67
+ <Show when={props.widget.icon} fallback={<Icon icon="lucide:package" />}>
68
+ {(icon) => <Icon icon={icon()} />}
69
+ </Show>
70
+ </SectionIcon>
71
+ <div data-slot="widget-identity-headings" class="flex min-w-0 flex-1 flex-col gap-0.5">
72
+ <div data-slot="widget-identity-headline" class="flex items-center gap-2">
73
+ <SectionSubtitle class="truncate">
74
+ {props.widget.displayName || props.widget.name}
75
+ </SectionSubtitle>
76
+ <Show when={props.showVersionInline && props.widget.latestVersion}>
77
+ <span class="text-muted-foreground shrink-0 font-mono text-xs tabular-nums">
78
+ v{props.widget.latestVersion}
79
+ </span>
80
+ </Show>
81
+ <WidgetTrustBadge isOfficial={!!props.widget.isOfficial} />
82
82
 
83
- <Show when={props.widget.isUnlisted}>
84
- <Badge tone="var(--warning)">Unlisted</Badge>
85
- </Show>
86
- <Show when={props.widget.isUnpublished}>
87
- <Badge tone="var(--destructive)">Not published</Badge>
88
- </Show>
89
- </div>
90
- <div data-slot="widget-identity-scope" class="flex min-w-0 flex-wrap items-center gap-1.5">
91
- <span class="truncate font-mono text-muted-foreground text-xs">
92
- @{props.widget.scope}/{props.widget.name}
93
- </span>
94
- <Show when={props.showScopeIndicator}>
95
- <ScopeIndicator
96
- scope={props.widget.scope}
97
- type={props.widget.ownerType ?? "personal"}
98
- />
99
- </Show>
100
- </div>
101
- </div>
102
- </div>
103
- );
83
+ <Show when={props.widget.isUnlisted}>
84
+ <Badge tone="var(--warning)">Unlisted</Badge>
85
+ </Show>
86
+ <Show when={props.widget.isUnpublished}>
87
+ <Badge tone="var(--destructive)">Not published</Badge>
88
+ </Show>
89
+ </div>
90
+ <div data-slot="widget-identity-scope" class="flex min-w-0 flex-wrap items-center gap-1.5">
91
+ <span class="text-muted-foreground truncate font-mono text-xs">
92
+ @{props.widget.scope}/{props.widget.name}
93
+ </span>
94
+ <Show when={props.showScopeIndicator}>
95
+ <ScopeIndicator
96
+ scope={props.widget.scope}
97
+ type={props.widget.ownerType ?? "personal"}
98
+ />
99
+ </Show>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ );
104
104
  }
105
105
 
106
106
  /** Downloads (+ optional version counts) meta cluster. */
107
107
  export function WidgetMeta(props: {
108
- widget: WidgetSummary;
109
- /** Append `N versions`. */
110
- showVersions?: boolean;
111
- /** Append `v{latestVersion}` (the tile footer's shape). */
112
- showLatestVersion?: boolean;
113
- class?: string;
108
+ widget: WidgetSummary;
109
+ /** Append `N versions`. */
110
+ showVersions?: boolean;
111
+ /** Append `v{latestVersion}` (the tile footer's shape). */
112
+ showLatestVersion?: boolean;
113
+ class?: string;
114
114
  }): JSX.Element {
115
- return (
116
- <div
117
- data-slot="widget-meta"
118
- class={cn("flex items-center gap-4 text-muted-foreground text-xs", props.class)}
119
- >
120
- <Show when={props.widget.downloadCount != null}>
121
- <span class="flex items-center gap-1 tabular-nums">
122
- <Icon icon="lucide:arrow-down-to-line" width={12} height={12} class="size-3" />
123
- {formatWidgetCount(props.widget.downloadCount)}
124
- </span>
125
- </Show>
126
- <Show when={props.showVersions && props.widget.versionCount != null}>
127
- <span class="flex items-center gap-1 tabular-nums">
128
- <Icon icon="lucide:layers" width={12} height={12} class="size-3" />
129
- {props.widget.versionCount} versions
130
- </span>
131
- </Show>
132
- <Show when={props.showLatestVersion && props.widget.latestVersion}>
133
- <span class="tabular-nums">v{props.widget.latestVersion}</span>
134
- </Show>
135
- </div>
136
- );
115
+ return (
116
+ <div
117
+ data-slot="widget-meta"
118
+ class={cn("text-muted-foreground flex items-center gap-4 text-xs", props.class)}
119
+ >
120
+ <Show when={props.widget.downloadCount != null}>
121
+ <span class="flex items-center gap-1 tabular-nums">
122
+ <Icon icon="lucide:arrow-down-to-line" width={12} height={12} class="size-3" />
123
+ {formatWidgetCount(props.widget.downloadCount)}
124
+ </span>
125
+ </Show>
126
+ <Show when={props.showVersions && props.widget.versionCount != null}>
127
+ <span class="flex items-center gap-1 tabular-nums">
128
+ <Icon icon="lucide:layers" width={12} height={12} class="size-3" />
129
+ {props.widget.versionCount} versions
130
+ </span>
131
+ </Show>
132
+ <Show when={props.showLatestVersion && props.widget.latestVersion}>
133
+ <span class="tabular-nums">v{props.widget.latestVersion}</span>
134
+ </Show>
135
+ </div>
136
+ );
137
137
  }
@@ -14,24 +14,24 @@ import { Show } from "solid-js";
14
14
  * name, so it now matches the official marker's compact icon form.
15
15
  */
16
16
  export function WidgetTrustBadge(props: { isOfficial: boolean }) {
17
- return (
18
- <Show
19
- when={props.isOfficial}
20
- fallback={
21
- <span class="inline-flex items-center text-muted-foreground" title="Community widget">
22
- <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
23
- <path d="M12 5.5A3.5 3.5 0 0 1 15.5 9a3.5 3.5 0 0 1-3.5 3.5A3.5 3.5 0 0 1 8.5 9 3.5 3.5 0 0 1 12 5.5M5 8c.56 0 1.08.15 1.53.42-.15 1.43.27 2.85 1.13 3.96C7.16 13.34 6.16 14 5 14a3 3 0 0 1-3-3 3 3 0 0 1 3-3m14 0a3 3 0 0 1 3 3 3 3 0 0 1-3 3c-1.16 0-2.16-.66-2.66-1.62a5.54 5.54 0 0 0 1.13-3.96c.45-.27.97-.42 1.53-.42M5.5 18.25c0-2.07 2.91-3.75 6.5-3.75s6.5 1.68 6.5 3.75V20h-13v-1.75M0 20v-1.5c0-1.39 1.89-2.56 4.45-2.9-.59.68-.95 1.62-.95 2.65V20H0m24 0h-3.5v-1.75c0-1.03-.36-1.97-.95-2.65 2.56.34 4.45 1.51 4.45 2.9V20Z" />
24
- </svg>
25
- <span class="sr-only">Community</span>
26
- </span>
27
- }
28
- >
29
- <span class="inline-flex items-center text-primary" title="Official GlassHome widget">
30
- <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
31
- <path d="M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12m-13 5l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z" />
32
- </svg>
33
- <span class="sr-only">Official</span>
34
- </span>
35
- </Show>
36
- );
17
+ return (
18
+ <Show
19
+ when={props.isOfficial}
20
+ fallback={
21
+ <span class="text-muted-foreground inline-flex items-center" title="Community widget">
22
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
23
+ <path d="M12 5.5A3.5 3.5 0 0 1 15.5 9a3.5 3.5 0 0 1-3.5 3.5A3.5 3.5 0 0 1 8.5 9 3.5 3.5 0 0 1 12 5.5M5 8c.56 0 1.08.15 1.53.42-.15 1.43.27 2.85 1.13 3.96C7.16 13.34 6.16 14 5 14a3 3 0 0 1-3-3 3 3 0 0 1 3-3m14 0a3 3 0 0 1 3 3 3 3 0 0 1-3 3c-1.16 0-2.16-.66-2.66-1.62a5.54 5.54 0 0 0 1.13-3.96c.45-.27.97-.42 1.53-.42M5.5 18.25c0-2.07 2.91-3.75 6.5-3.75s6.5 1.68 6.5 3.75V20h-13v-1.75M0 20v-1.5c0-1.39 1.89-2.56 4.45-2.9-.59.68-.95 1.62-.95 2.65V20H0m24 0h-3.5v-1.75c0-1.03-.36-1.97-.95-2.65 2.56.34 4.45 1.51 4.45 2.9V20Z" />
24
+ </svg>
25
+ <span class="sr-only">Community</span>
26
+ </span>
27
+ }
28
+ >
29
+ <span class="text-primary inline-flex items-center" title="Official GlassHome widget">
30
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
31
+ <path d="M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12m-13 5l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z" />
32
+ </svg>
33
+ <span class="sr-only">Official</span>
34
+ </span>
35
+ </Show>
36
+ );
37
37
  }