@glasshome/ui 1.21.1 → 1.22.0

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 (146) 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/index.d.ts +9 -9
  5. package/dist/solid/index.js +5431 -5424
  6. package/dist/solid/sonner.d.ts +1 -0
  7. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  8. package/package.json +128 -126
  9. package/scripts/check-gallery.ts +142 -142
  10. package/scripts/check-pack.ts +13 -13
  11. package/scripts/check-structural-classes.ts +20 -20
  12. package/scripts/check-tokens.ts +27 -27
  13. package/scripts/check-ui-drift.mjs +103 -103
  14. package/src/index.ts +75 -80
  15. package/src/lib/alert-tones.ts +41 -41
  16. package/src/lib/anchor-placement.ts +21 -21
  17. package/src/lib/button-variants.ts +28 -28
  18. package/src/lib/card-classes.ts +9 -9
  19. package/src/lib/carousel-classes.ts +14 -14
  20. package/src/lib/glass-tone.ts +11 -11
  21. package/src/lib/input-classes.ts +6 -6
  22. package/src/lib/layers.ts +4 -4
  23. package/src/lib/logo-lockup.ts +8 -8
  24. package/src/lib/menu-classes.ts +2 -2
  25. package/src/lib/motion-classes.ts +8 -8
  26. package/src/lib/motion-window.ts +24 -24
  27. package/src/lib/overlay-classes.ts +6 -6
  28. package/src/lib/pill-classes.ts +3 -3
  29. package/src/lib/position-bar-classes.ts +1 -1
  30. package/src/lib/spotlight-geometry.ts +67 -67
  31. package/src/lib/thumb-classes.ts +2 -2
  32. package/src/lib/tier-badge.ts +16 -16
  33. package/src/lib/use-is-mobile.ts +17 -14
  34. package/src/lib/utils.ts +1 -1
  35. package/src/solid/accordion.tsx +41 -41
  36. package/src/solid/alert-dialog.tsx +95 -95
  37. package/src/solid/alert.tsx +88 -88
  38. package/src/solid/area-picker.tsx +204 -204
  39. package/src/solid/aspect-ratio.tsx +13 -13
  40. package/src/solid/avatar.tsx +27 -27
  41. package/src/solid/badge.tsx +49 -49
  42. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  43. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  44. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  45. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  46. package/src/solid/bottom-sheet/index.ts +12 -12
  47. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  48. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  49. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  50. package/src/solid/bottom-sheet/velocity.ts +29 -29
  51. package/src/solid/breadcrumb.tsx +76 -76
  52. package/src/solid/button-group.tsx +46 -46
  53. package/src/solid/button.tsx +19 -19
  54. package/src/solid/card.tsx +67 -67
  55. package/src/solid/carousel.tsx +246 -246
  56. package/src/solid/charts.tsx +253 -253
  57. package/src/solid/checkbox.tsx +51 -51
  58. package/src/solid/collapsible.tsx +22 -22
  59. package/src/solid/color-disc.tsx +213 -213
  60. package/src/solid/color-slider.tsx +81 -81
  61. package/src/solid/color-wheel.tsx +61 -61
  62. package/src/solid/context-menu.tsx +63 -63
  63. package/src/solid/copy-button.tsx +31 -31
  64. package/src/solid/count-pill.tsx +11 -11
  65. package/src/solid/dashboard-preview.tsx +104 -104
  66. package/src/solid/data-table.tsx +228 -228
  67. package/src/solid/dialog-parts.tsx +127 -127
  68. package/src/solid/dialog.tsx +113 -113
  69. package/src/solid/dock-paging.ts +9 -9
  70. package/src/solid/dock.tsx +339 -339
  71. package/src/solid/docked-panel.tsx +35 -35
  72. package/src/solid/dropdown-menu.tsx +77 -77
  73. package/src/solid/empty.tsx +70 -70
  74. package/src/solid/entity-data.ts +38 -38
  75. package/src/solid/entity-selector.tsx +634 -634
  76. package/src/solid/field.tsx +205 -205
  77. package/src/solid/form.tsx +159 -159
  78. package/src/solid/hero-action.tsx +85 -85
  79. package/src/solid/hover-card.tsx +11 -11
  80. package/src/solid/icon-picker.tsx +401 -401
  81. package/src/solid/icon.tsx +101 -78
  82. package/src/solid/image-picker.tsx +416 -414
  83. package/src/solid/index.ts +265 -304
  84. package/src/solid/input-group.tsx +123 -123
  85. package/src/solid/input-otp.tsx +143 -143
  86. package/src/solid/input.tsx +4 -4
  87. package/src/solid/item.tsx +130 -130
  88. package/src/solid/kbd.tsx +20 -20
  89. package/src/solid/label.tsx +12 -12
  90. package/src/solid/list-reorder.ts +122 -122
  91. package/src/solid/logo.tsx +60 -60
  92. package/src/solid/media-copy.ts +21 -21
  93. package/src/solid/media-store.ts +56 -56
  94. package/src/solid/media-tile.tsx +85 -85
  95. package/src/solid/menu-parts.tsx +164 -164
  96. package/src/solid/number-field.tsx +56 -56
  97. package/src/solid/option-card.tsx +164 -164
  98. package/src/solid/ornament.tsx +43 -43
  99. package/src/solid/overlay.tsx +4 -4
  100. package/src/solid/page-header.tsx +75 -75
  101. package/src/solid/pagination.tsx +80 -80
  102. package/src/solid/password-input.tsx +51 -51
  103. package/src/solid/picker-row.tsx +83 -83
  104. package/src/solid/picker-search.tsx +65 -63
  105. package/src/solid/picker-trigger.tsx +59 -57
  106. package/src/solid/popover.tsx +54 -54
  107. package/src/solid/preview-tile.tsx +67 -67
  108. package/src/solid/progress.tsx +21 -21
  109. package/src/solid/radio-group.tsx +51 -51
  110. package/src/solid/resizable.tsx +128 -128
  111. package/src/solid/responsive-dialog.tsx +134 -134
  112. package/src/solid/schema-form.tsx +743 -743
  113. package/src/solid/scope-indicator.tsx +5 -5
  114. package/src/solid/scroll-area.tsx +16 -16
  115. package/src/solid/section-card.tsx +281 -281
  116. package/src/solid/select.tsx +101 -101
  117. package/src/solid/separator.tsx +25 -25
  118. package/src/solid/settings-row.tsx +122 -122
  119. package/src/solid/sheet.tsx +96 -96
  120. package/src/solid/skeleton.tsx +8 -8
  121. package/src/solid/slider.tsx +132 -132
  122. package/src/solid/sliding-indicator.tsx +280 -265
  123. package/src/solid/sonner.tsx +165 -164
  124. package/src/solid/spinner.tsx +12 -12
  125. package/src/solid/spotlight.tsx +140 -140
  126. package/src/solid/step-indicator.tsx +18 -18
  127. package/src/solid/swatch-picker.tsx +38 -38
  128. package/src/solid/switch.tsx +52 -52
  129. package/src/solid/table.tsx +63 -63
  130. package/src/solid/tabs.tsx +93 -93
  131. package/src/solid/textarea.tsx +8 -8
  132. package/src/solid/toggle-group.tsx +83 -83
  133. package/src/solid/toggle.tsx +33 -33
  134. package/src/solid/tooltip.tsx +16 -16
  135. package/src/solid/widget-card.tsx +90 -90
  136. package/src/solid/widget-identity.tsx +99 -99
  137. package/src/solid/widget-trust-badge.tsx +20 -20
  138. package/src/styles/globals.css +316 -319
  139. package/src/styles/theme.css +448 -448
  140. package/src/tokens/hex.ts +29 -29
  141. package/src/tokens/material.ts +75 -75
  142. package/src/tokens/presets.ts +303 -303
  143. package/src/tokens/readability.ts +32 -32
  144. package/src/tokens/theme-colors.ts +95 -95
  145. package/src/tokens/theme-css.ts +22 -22
  146. package/src/tokens/theme-recipe.ts +106 -106
@@ -6,25 +6,25 @@ const EDGE = 16;
6
6
  * least as wide as the element, shifted only as far as the screen needs. The --morph-* values
7
7
  * start the panel clipped to the element's box (MORPH_MOTION's keyframes), so it unrolls out of it. */
8
8
  export function overAnchor(anchor: HTMLElement, width: number): JSX.CSSProperties {
9
- const box = anchor.getBoundingClientRect();
10
- const vw = window.innerWidth;
11
- const vh = window.innerHeight;
12
- const w = Math.min(Math.max(width, box.width), vw - 2 * EDGE);
13
- const x = Math.max(EDGE, Math.min(box.left, vw - EDGE - w));
14
- const y = Math.max(EDGE, Math.min(box.top, vh - EDGE - Math.max(box.height, 240)));
15
- const radius = getComputedStyle(anchor).borderTopLeftRadius || "0px";
16
- return {
17
- left: `${x}px`,
18
- top: `${y}px`,
19
- translate: "none",
20
- width: `${w}px`,
21
- "max-width": "none",
22
- "min-height": `${Math.min(box.height, vh - y - EDGE)}px`,
23
- "max-height": `${vh - y - EDGE}px`,
24
- "--morph-x": `${box.left - x}px`,
25
- "--morph-y": `${box.top - y}px`,
26
- "--morph-w": `${box.width}px`,
27
- "--morph-h": `${box.height}px`,
28
- "--morph-radius": radius,
29
- } as JSX.CSSProperties;
9
+ const box = anchor.getBoundingClientRect();
10
+ const vw = window.innerWidth;
11
+ const vh = window.innerHeight;
12
+ const w = Math.min(Math.max(width, box.width), vw - 2 * EDGE);
13
+ const x = Math.max(EDGE, Math.min(box.left, vw - EDGE - w));
14
+ const y = Math.max(EDGE, Math.min(box.top, vh - EDGE - Math.max(box.height, 240)));
15
+ const radius = getComputedStyle(anchor).borderTopLeftRadius || "0px";
16
+ return {
17
+ left: `${x}px`,
18
+ top: `${y}px`,
19
+ translate: "none",
20
+ width: `${w}px`,
21
+ "max-width": "none",
22
+ "min-height": `${Math.min(box.height, vh - y - EDGE)}px`,
23
+ "max-height": `${vh - y - EDGE}px`,
24
+ "--morph-x": `${box.left - x}px`,
25
+ "--morph-y": `${box.top - y}px`,
26
+ "--morph-w": `${box.width}px`,
27
+ "--morph-h": `${box.height}px`,
28
+ "--morph-radius": radius,
29
+ } as JSX.CSSProperties;
30
30
  }
@@ -3,7 +3,7 @@ import { cva } from "cva";
3
3
  /* Clear control glass: a see-through card fill over a blur, both scaled from the
4
4
  * theme's material tier. `glass-control` lets reduce-blur restore the opaque fill. */
5
5
  const CONTROL_GLASS =
6
- "glass-control [--glass-base:color-mix(in_srgb,var(--card)_calc(var(--material-clarity)*0.6),transparent)] [--glass-light:0.1] backdrop-blur-[calc(var(--material-blur,24px)*0.6)] backdrop-saturate-[1.6] backdrop-brightness-[1.1]";
6
+ "glass-control [--glass-base:color-mix(in_srgb,var(--card)_calc(var(--material-clarity)*0.6),transparent)] [--glass-light:0.1] backdrop-blur-[calc(var(--material-blur,24px)*0.6)] backdrop-saturate-[1.6] backdrop-brightness-[1.1]";
7
7
 
8
8
  /* One outline material, worn by the pill and by Toggle: `glass` owns the
9
9
  * element's background and border, so a real border-input box is a no-op. */
@@ -14,32 +14,32 @@ export const OUTLINE_SURFACE = `glass ${CONTROL_GLASS} [--glass-edge:var(--borde
14
14
  /* Controls take the theme's corner (rounded-lg is --radius): a capsule at the
15
15
  * roundness every preset but the sharp one ships, square at zero. */
16
16
  export const buttonVariants = cva({
17
- // structural-ok: the [&_svg]: utilities stay in Tailwind's utility layer so a
18
- // caller's own [&_svg]:size-* override can still win; unlayered real CSS in
19
- // globals.css would beat every consumer utility regardless of specificity.
20
- base: "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium text-sm outline-none transition-glass focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 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",
21
- variants: {
22
- variant: {
23
- default: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--primary)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--primary)_60%,transparent)] hover:[--glass-wash:65%] dark:[--glass-tone:oklch(from_var(--primary)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:hover:[--glass-wash:62%]`,
24
- destructive: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--destructive)] [--glass-wash:55%] focus-visible:ring-destructive/30 hover:[--glass-edge:color-mix(in_srgb,var(--destructive)_60%,transparent)] hover:[--glass-wash:65%] dark:[--glass-tone:oklch(from_var(--destructive)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:hover:[--glass-wash:62%]`,
25
- secondary: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--accent)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--accent)_60%,transparent)] hover:[--glass-wash:65%] dark:[--glass-tone:oklch(from_var(--accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:hover:[--glass-wash:62%]`,
26
- outline: OUTLINE_SURFACE,
27
- ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50",
28
- link: "text-primary-tint-foreground underline-offset-4 hover:underline",
29
- },
30
- size: {
31
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
32
- sm: "h-8 gap-1.5 px-3 has-[>svg]:px-2.5",
33
- lg: "h-10 px-6 has-[>svg]:px-4",
34
- icon: "size-9 p-2",
35
- xl: "h-[72px] gap-3.5 rounded-full pr-7 pl-3 text-left font-semibold text-[17px] [&_svg:not([class*='size-'])]:size-5",
36
- none: "",
37
- },
38
- },
39
- defaultVariants: {
40
- variant: "default",
41
- size: "default",
42
- },
17
+ // structural-ok: the [&_svg]: utilities stay in Tailwind's utility layer so a
18
+ // caller's own [&_svg]:size-* override can still win; unlayered real CSS in
19
+ // globals.css would beat every consumer utility regardless of specificity.
20
+ base: "transition-glass focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-none focus-visible:ring-[3px] active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
21
+ variants: {
22
+ variant: {
23
+ default: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--primary)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--primary)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--primary)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:62%]`,
24
+ destructive: `glass glass-tint ${CONTROL_GLASS} focus-visible:ring-destructive/30 [--glass-text:0%] [--glass-tone:var(--destructive)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--destructive)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--destructive)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:62%]`,
25
+ secondary: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--accent)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--accent)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:62%]`,
26
+ outline: OUTLINE_SURFACE,
27
+ ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50",
28
+ link: "text-primary-tint-foreground underline-offset-4 hover:underline",
29
+ },
30
+ size: {
31
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
32
+ sm: "h-8 gap-1.5 px-3 has-[>svg]:px-2.5",
33
+ lg: "h-10 px-6 has-[>svg]:px-4",
34
+ icon: "size-9 p-2",
35
+ xl: "h-[72px] gap-3.5 rounded-full pr-7 pl-3 text-left text-[17px] font-semibold [&_svg:not([class*='size-'])]:size-5",
36
+ none: "",
37
+ },
38
+ },
39
+ defaultVariants: {
40
+ variant: "default",
41
+ size: "default",
42
+ },
43
43
  });
44
44
 
45
45
  // Evaluated once for static/SSR call sites (marketing CTAs, .astro frontmatter)
@@ -51,4 +51,4 @@ export const BUTTON_OUTLINE_CLASS = buttonVariants({ variant: "outline", size: "
51
51
  /* Ghost icon button (copy buttons, small icon actions). Size and text color
52
52
  * stay at the call site. */
53
53
  export const ICON_BUTTON_CLASS =
54
- "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]";
54
+ "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]";
@@ -1,14 +1,14 @@
1
1
  import { PRESS_DIP } from "./motion-classes.js";
2
2
 
3
3
  const CARD_KNOBS =
4
- "glass [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]";
4
+ "glass [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]";
5
5
 
6
6
  export const CARD_SURFACE_BASE = `${CARD_KNOBS} [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]`;
7
7
 
8
8
  /* Split from the surface so dash's performant-blur engine can gate it off and
9
9
  * paint a precomputed frost instead. */
10
10
  export const CARD_BLUR =
11
- "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.8]";
11
+ "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.8]";
12
12
 
13
13
  export const CARD_SURFACE = `${CARD_SURFACE_BASE} ${CARD_BLUR}`;
14
14
 
@@ -19,29 +19,29 @@ export const CARD_SURFACE_OPAQUE = CARD_KNOBS;
19
19
  /* Rows inside a section: the card material again, one step in, so a row never
20
20
  * reads as a flat plate on a glass panel. */
21
21
  export const SECTION_ROW_SURFACE =
22
- "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]";
22
+ "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]";
23
23
 
24
24
  /* Recessed track frame (tabs, segmented controls). */
25
25
  export const TRACK_SURFACE = "border border-border/50 bg-card/40 backdrop-blur-sm";
26
26
 
27
27
  export const CARD_PADDING = {
28
- slots: "flex flex-col gap-3 p-3 md:gap-4 md:p-4",
29
- md: "flex flex-col gap-3 p-4",
30
- sm: "flex flex-col gap-2 p-3",
31
- none: "",
28
+ slots: "flex flex-col gap-3 p-3 md:gap-4 md:p-4",
29
+ md: "flex flex-col gap-3 p-4",
30
+ sm: "flex flex-col gap-2 p-3",
31
+ none: "",
32
32
  } as const;
33
33
 
34
34
  export type CardPadding = keyof typeof CARD_PADDING;
35
35
 
36
36
  export const CARD_INTERACTIVE =
37
- "cursor-pointer transition-glass hover:[--glass-light:0.09] focus-within:[--glass-edge:var(--border)]";
37
+ "cursor-pointer transition-glass hover:[--glass-light:0.09] focus-within:[--glass-edge:var(--border)]";
38
38
 
39
39
  /* A row that activates as a whole. Two focus selectors, one look: the row may
40
40
  * be focusable itself, or hold an absolutely-positioned overlay button. */
41
41
  export const SECTION_ROW_INTERACTIVE = `${CARD_INTERACTIVE} ${PRESS_DIP} outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50`;
42
42
 
43
43
  export const CARD_HEADER_CLASS =
44
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]";
44
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]";
45
45
  export const CARD_TITLE_CLASS = "font-semibold leading-none";
46
46
  export const CARD_DESCRIPTION_CLASS = "text-muted-foreground text-sm";
47
47
  export const CARD_ACTION_CLASS = "col-start-2 row-span-2 row-start-1 self-start justify-self-end";
@@ -17,28 +17,28 @@ export const CAROUSEL_VIEWPORT = "h-full overflow-hidden";
17
17
  * advances.
18
18
  */
19
19
  export function carouselTrack(
20
- transition: CarouselTransition,
21
- orientation: "horizontal" | "vertical" = "horizontal",
20
+ transition: CarouselTransition,
21
+ orientation: "horizontal" | "vertical" = "horizontal",
22
22
  ) {
23
- if (transition === "wipe") return "carousel-stack";
24
- const vertical = orientation === "vertical";
25
- // Fade slides sit on top of each other, so the track carries no gutter.
26
- if (transition === "fade") return vertical ? "flex flex-col" : "flex";
27
- return `flex ${vertical ? "-mt-4 flex-col" : "-ml-4"}`;
23
+ if (transition === "wipe") return "carousel-stack";
24
+ const vertical = orientation === "vertical";
25
+ // Fade slides sit on top of each other, so the track carries no gutter.
26
+ if (transition === "fade") return vertical ? "flex flex-col" : "flex";
27
+ return `flex ${vertical ? "-mt-4 flex-col" : "-ml-4"}`;
28
28
  }
29
29
 
30
30
  export function carouselItem(
31
- transition: CarouselTransition,
32
- orientation: "horizontal" | "vertical" = "horizontal",
31
+ transition: CarouselTransition,
32
+ orientation: "horizontal" | "vertical" = "horizontal",
33
33
  ) {
34
- if (transition === "wipe") return "min-w-0 carousel-wipe";
35
- const track = "min-w-0 shrink-0 grow-0 basis-full";
36
- if (transition === "fade") return track;
37
- return `${track} ${orientation === "horizontal" ? "pl-4" : "pt-4"}`;
34
+ if (transition === "wipe") return "min-w-0 carousel-wipe";
35
+ const track = "min-w-0 shrink-0 grow-0 basis-full";
36
+ if (transition === "fade") return track;
37
+ return `${track} ${orientation === "horizontal" ? "pl-4" : "pt-4"}`;
38
38
  }
39
39
 
40
40
  export const CAROUSEL_DOTS = "flex items-center justify-center gap-2";
41
41
 
42
42
  export function carouselDot(active: boolean) {
43
- return `${POSITION_BAR} ${active ? `w-6 ${POSITION_BAR_LIT}` : "w-2.5 hover:[--glass-light:0.12]"}`;
43
+ return `${POSITION_BAR} ${active ? `w-6 ${POSITION_BAR_LIT}` : "w-2.5 hover:[--glass-light:0.12]"}`;
44
44
  }
@@ -1,25 +1,25 @@
1
1
  /* Per-tone label contrast: light tones (amber, lime) mix further toward
2
2
  * --foreground so they read as strongly as dark ones. */
3
3
  const TONE_L: Record<string, number> = {
4
- "var(--primary)": 0.48,
5
- "var(--accent)": 0.6,
6
- "var(--success)": 0.68,
7
- "var(--warning)": 0.76,
8
- "var(--destructive)": 0.66,
9
- "var(--muted-foreground)": 0.55,
4
+ "var(--primary)": 0.48,
5
+ "var(--accent)": 0.6,
6
+ "var(--success)": 0.68,
7
+ "var(--warning)": 0.76,
8
+ "var(--destructive)": 0.66,
9
+ "var(--muted-foreground)": 0.55,
10
10
  };
11
11
 
12
12
  export function toneTextMix(color: string): number {
13
- const known = TONE_L[color];
14
- const raw = color.match(/oklch\(\s*([0-9.]+)/)?.[1];
15
- const l = known ?? (raw ? Number.parseFloat(raw) : 0.6);
16
- return Math.min(70, Math.max(46, Math.round(71 - (l - 0.5) * 60)));
13
+ const known = TONE_L[color];
14
+ const raw = color.match(/oklch\(\s*([0-9.]+)/)?.[1];
15
+ const l = known ?? (raw ? Number.parseFloat(raw) : 0.6);
16
+ return Math.min(70, Math.max(46, Math.round(71 - (l - 0.5) * 60)));
17
17
  }
18
18
 
19
19
  /* oklab, not oklch: no hue channel, so a hued tone desaturates toward neutral
20
20
  * instead of swinging toward yellow. */
21
21
  export function glassToneText(color: string): string {
22
- return `color-mix(in oklab, ${color} ${toneTextMix(color)}%, var(--foreground))`;
22
+ return `color-mix(in oklab, ${color} ${toneTextMix(color)}%, var(--foreground))`;
23
23
  }
24
24
 
25
25
  /* The neutral tone every "no verdict" surface passes (neutral badges,
@@ -8,7 +8,7 @@
8
8
  * overlapping Select listbox). The recess itself is .glass-sink's rim, which is
9
9
  * theme independent. */
10
10
  export const INPUT_SURFACE =
11
- "glass glass-sink [--glass-base:var(--field)] [--glass-edge:var(--field-edge)] [--glass-light:0.04]";
11
+ "glass glass-sink [--glass-base:var(--field)] [--glass-edge:var(--field-edge)] [--glass-light:0.04]";
12
12
 
13
13
  /* Toggle-family chrome and rails: checkbox box, radio ring, switch track, slider
14
14
  * rail, chart wells. Same concave glass, but keyed to --input in both themes:
@@ -20,16 +20,16 @@ export const FIELD_CHROME = "glass glass-sink [--glass-base:var(--input)] [--gla
20
20
  /* Focus on a glass element: border utilities are no-ops there, so the edge
21
21
  * moves through the knob and the ring paints outside. */
22
22
  export const FOCUS_RING =
23
- "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:[--glass-edge:var(--ring)]";
23
+ "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:[--glass-edge:var(--ring)]";
24
24
 
25
25
  export const INVALID_RING =
26
- "aria-invalid:[--glass-edge:var(--destructive)] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40";
26
+ "aria-invalid:[--glass-edge:var(--destructive)] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40";
27
27
 
28
28
  /* The three control heights every field, trigger and button shares. */
29
29
  export const CONTROL_H = {
30
- sm: "h-8",
31
- default: "h-9",
32
- lg: "h-10",
30
+ sm: "h-8",
31
+ default: "h-9",
32
+ lg: "h-10",
33
33
  } as const;
34
34
 
35
35
  /* Field type: 16px on touch so iOS does not zoom, 14px from md up. */
package/src/lib/layers.ts CHANGED
@@ -2,11 +2,11 @@
2
2
  * dropdown opened inside a sheet stacks naturally. Class strings stay literal
3
3
  * for Tailwind's scanner; numbers are for inline styles. */
4
4
  export const Z = {
5
- sheet: 40,
6
- overlay: 50,
5
+ sheet: 40,
6
+ overlay: 50,
7
7
  } as const;
8
8
 
9
9
  export const Z_CLASS = {
10
- sheet: "z-40",
11
- overlay: "z-50",
10
+ sheet: "z-40",
11
+ overlay: "z-50",
12
12
  } as const satisfies Record<keyof typeof Z, string>;
@@ -18,18 +18,18 @@ export const LOGO_DEFAULT_SIZE: LogoSize = "md";
18
18
 
19
19
  /** Rendered pixel size of the mark per size, for width/height attrs (CLS). */
20
20
  export const LOGO_MARK_PX: Record<LogoSize, number> = {
21
- sm: 32,
22
- md: 48,
23
- lg: 64,
21
+ sm: 32,
22
+ md: 48,
23
+ lg: 64,
24
24
  };
25
25
 
26
26
  export const LOGO_SIZES: Record<
27
- LogoSize,
28
- { mark: string; name: string; sub: string; gap: string }
27
+ LogoSize,
28
+ { mark: string; name: string; sub: string; gap: string }
29
29
  > = {
30
- sm: { mark: "h-8 w-8", name: "text-xs", sub: "text-base", gap: "gap-1.5" },
31
- md: { mark: "h-12 w-12", name: "text-base", sub: "text-2xl", gap: "gap-2" },
32
- lg: { mark: "h-16 w-16", name: "text-lg", sub: "text-3xl", gap: "gap-2" },
30
+ sm: { mark: "h-8 w-8", name: "text-xs", sub: "text-base", gap: "gap-1.5" },
31
+ md: { mark: "h-12 w-12", name: "text-base", sub: "text-2xl", gap: "gap-2" },
32
+ lg: { mark: "h-16 w-16", name: "text-lg", sub: "text-3xl", gap: "gap-2" },
33
33
  };
34
34
 
35
35
  /**
@@ -9,8 +9,8 @@
9
9
  * pl-8/pr-2 pair, so both would stay in the class list and the visible result
10
10
  * would come down to CSS emit order. Such a row composes MENU_ITEM_BASE. */
11
11
  export const MENU_ITEM_BASE =
12
- // structural-ok: guards an svg color rule on a sibling data attribute this package always renders, not a class the consumer must also scan
13
- "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px]";
12
+ // structural-ok: guards an svg color rule on a sibling data attribute this package always renders, not a class the consumer must also scan
13
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px]";
14
14
 
15
15
  export const MENU_ITEM_X = "px-2";
16
16
 
@@ -3,9 +3,9 @@
3
3
  * prefers-reduced-motion zeroes all of it in one place. */
4
4
 
5
5
  const ARRIVE =
6
- "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand)";
6
+ "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand)";
7
7
  const LEAVE =
8
- "data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract)";
8
+ "data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract)";
9
9
 
10
10
  /* Anchored panels (menu, popover, tooltip, hover card): unfold from the
11
11
  * trigger edge. Kobalte writes the origin per placement. */
@@ -21,12 +21,12 @@ export const FIELD_MOTION = "data-[closed]:animate-select-out data-[expanded]:an
21
21
  * trigger's box; the content writes --morph-h/--morph-radius from the
22
22
  * trigger it replaces, --morph-w is kobalte's anchor width. */
23
23
  export const MORPH_MOTION =
24
- "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out";
24
+ "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out";
25
25
 
26
26
  /* A dialog anchored on the element that opened it (a tile): it unrolls out of
27
27
  * that element's box and rolls back into it, on MORPH_MOTION's keyframes. */
28
28
  export const ANCHORED_MOTION =
29
- "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out";
29
+ "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out";
30
30
 
31
31
  /* Children of a panel arrive staggered through the `gh-stagger` class
32
32
  * (globals.css): one door, no per-row index, mount-only. */
@@ -39,7 +39,7 @@ export const SCRIM_MOTION = `${ARRIVE} data-[expanded]:fade-in-0 ${LEAVE} data-[
39
39
 
40
40
  /* Content that swaps in place (tab panel, a row added to a list). */
41
41
  export const SETTLE_MOTION =
42
- "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)";
42
+ "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)";
43
43
 
44
44
  /* Every pressable dips the same amount. */
45
45
  export const PRESS_DIP = "active:scale-[0.97]";
@@ -47,15 +47,15 @@ export const PRESS_DIP = "active:scale-[0.97]";
47
47
  /* Hold progress: a fill grows out of the touch while held, dissolves once the
48
48
  * hold fires, and drains back faster if let go early. The host sets data-hold / data-fired. */
49
49
  export const HOLD_MOTION =
50
- "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-morph) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0";
50
+ "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-morph) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0";
51
51
 
52
52
  /* MODAL_MOTION's twin for a surface that stays mounted: it rises out of what
53
53
  * opened it, and its closed state is a resting style, since a mount door's exit
54
54
  * ends and leaves the element showing. */
55
55
  export const RISE_MOTION =
56
- "origin-bottom transition-[opacity,scale,translate] data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:pointer-events-none data-[closed]:translate-y-2 data-[closed]:scale-95 data-[closed]:opacity-0";
56
+ "origin-bottom transition-[opacity,scale,translate] data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:pointer-events-none data-[closed]:translate-y-2 data-[closed]:scale-95 data-[closed]:opacity-0";
57
57
 
58
58
  /* A mounted surface that follows its subject from place to place (the
59
59
  * spotlight's hole and bubble). */
60
60
  export const TRAVEL_MOTION =
61
- "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)";
61
+ "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)";
@@ -4,31 +4,31 @@ export const MOTION_WINDOW_MS = 30_000;
4
4
  * is the one signal, which theme.css turns into `--motion-ambient` and the wallpapers gate on.
5
5
  * Returns the stop function. */
6
6
  export function startMotionWindow(windowMs = MOTION_WINDOW_MS): () => void {
7
- let timer: ReturnType<typeof setTimeout> | undefined;
8
- const root = document.documentElement;
7
+ let timer: ReturnType<typeof setTimeout> | undefined;
8
+ const root = document.documentElement;
9
9
 
10
- const freeze = () => {
11
- clearTimeout(timer);
12
- timer = undefined;
13
- delete root.dataset.motion;
14
- };
15
- const wake = () => {
16
- clearTimeout(timer);
17
- timer = setTimeout(freeze, windowMs);
18
- if (root.dataset.motion !== "live") root.dataset.motion = "live";
19
- };
20
- const onVisibility = () => {
21
- if (document.visibilityState === "hidden") freeze();
22
- else wake();
23
- };
10
+ const freeze = () => {
11
+ clearTimeout(timer);
12
+ timer = undefined;
13
+ delete root.dataset.motion;
14
+ };
15
+ const wake = () => {
16
+ clearTimeout(timer);
17
+ timer = setTimeout(freeze, windowMs);
18
+ if (root.dataset.motion !== "live") root.dataset.motion = "live";
19
+ };
20
+ const onVisibility = () => {
21
+ if (document.visibilityState === "hidden") freeze();
22
+ else wake();
23
+ };
24
24
 
25
- wake();
26
- document.addEventListener("pointerdown", wake, { passive: true, capture: true });
27
- document.addEventListener("visibilitychange", onVisibility);
25
+ wake();
26
+ document.addEventListener("pointerdown", wake, { passive: true, capture: true });
27
+ document.addEventListener("visibilitychange", onVisibility);
28
28
 
29
- return () => {
30
- freeze();
31
- document.removeEventListener("pointerdown", wake, { capture: true });
32
- document.removeEventListener("visibilitychange", onVisibility);
33
- };
29
+ return () => {
30
+ freeze();
31
+ document.removeEventListener("pointerdown", wake, { capture: true });
32
+ document.removeEventListener("visibilitychange", onVisibility);
33
+ };
34
34
  }
@@ -4,12 +4,12 @@ import { Z_CLASS } from "./layers.js";
4
4
  * 13-step grey ramp that bands and washes half the surface, so the glass read
5
5
  * comes from the rim line, the blur and the grain instead. */
6
6
  const OVERLAY_KNOBS =
7
- "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]";
7
+ "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]";
8
8
 
9
9
  /* Split from the surface the way CARD_BLUR is, so a host can gate it off and
10
10
  * paint a precomputed frost instead. */
11
11
  export const OVERLAY_BLUR =
12
- "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.2]";
12
+ "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.2]";
13
13
 
14
14
  export const OVERLAY_SURFACE_BASE = `${OVERLAY_KNOBS} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`;
15
15
 
@@ -42,8 +42,8 @@ export const FLOATING_PANEL = `${OVERLAY_SURFACE} relative ${PANEL_TAIL}`;
42
42
  * width bound to --kb-popper-anchor-width, the panel covers the trigger and
43
43
  * grows downward from it. */
44
44
  export const anchorToTriggerTop = (anchor?: HTMLElement) => {
45
- const r = anchor?.getBoundingClientRect();
46
- return r
47
- ? { x: r.left, y: r.top, width: r.width, height: 0 }
48
- : { x: 0, y: 0, width: 0, height: 0 };
45
+ const r = anchor?.getBoundingClientRect();
46
+ return r
47
+ ? { x: r.left, y: r.top, width: r.width, height: 0 }
48
+ : { x: 0, y: 0, width: 0, height: 0 };
49
49
  };
@@ -5,10 +5,10 @@
5
5
  * caller's --glass-tone (via Badge's style or a [--glass-tone:…] utility);
6
6
  * neutral wells set none and read as foreground glass. */
7
7
  export const CHIP =
8
- "glass glass-tint inline-flex w-fit shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 py-0.5 font-medium text-xs";
8
+ "glass glass-tint inline-flex w-fit shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 py-0.5 font-medium text-xs";
9
9
 
10
10
  export const ICON_PILL =
11
- "glass flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-light:0.08] [--glass-base:color-mix(in_srgb,var(--foreground)_10%,transparent)]";
11
+ "glass flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-light:0.08] [--glass-base:color-mix(in_srgb,var(--foreground)_10%,transparent)]";
12
12
 
13
13
  export const ICON_PILL_TINT =
14
- "glass glass-tint flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-wash:18%]";
14
+ "glass glass-tint flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-wash:18%]";
@@ -7,4 +7,4 @@ import { FIELD_CHROME } from "./input-classes.js";
7
7
  export const POSITION_BAR = `${FIELD_CHROME} h-1.5 rounded-full transition-glass duration-(--duration-morph) ease-(--ease-morph)`;
8
8
 
9
9
  export const POSITION_BAR_LIT =
10
- "glass glass-tint [--glass-tone:var(--primary)] [--glass-wash:70%] [--glass-drop:0%]";
10
+ "glass glass-tint [--glass-tone:var(--primary)] [--glass-wash:70%] [--glass-drop:0%]";