@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
@@ -16,28 +16,28 @@ const COMMENT_LINE = /^\s*(\/\/|\/\*|\*)/;
16
16
  let findings = 0;
17
17
 
18
18
  for (const entry of readdirSync(LIB_DIR).sort()) {
19
- if (!entry.endsWith(".ts") || entry.endsWith(".test.ts")) continue;
20
- const file = path.join(LIB_DIR, entry);
21
- const lines = readFileSync(file, "utf8").split("\n");
22
- lines.forEach((text, i) => {
23
- if (COMMENT_LINE.test(text)) return;
24
- if (!ARBITRARY_VARIANT.test(text)) return;
25
- if (text.includes("structural-ok:")) return;
26
- // Walk the comment block directly above for the escape marker.
27
- for (let j = i - 1; j >= 0 && COMMENT_LINE.test(lines[j] ?? ""); j--) {
28
- if (lines[j]?.includes("structural-ok:")) return;
29
- }
30
- findings++;
31
- console.error(
32
- `src/lib/${entry}:${i + 1} consumer-generated structural class (arbitrary variant): ${text.trim().slice(0, 120)}`,
33
- );
34
- });
19
+ if (!entry.endsWith(".ts") || entry.endsWith(".test.ts")) continue;
20
+ const file = path.join(LIB_DIR, entry);
21
+ const lines = readFileSync(file, "utf8").split("\n");
22
+ lines.forEach((text, i) => {
23
+ if (COMMENT_LINE.test(text)) return;
24
+ if (!ARBITRARY_VARIANT.test(text)) return;
25
+ if (text.includes("structural-ok:")) return;
26
+ // Walk the comment block directly above for the escape marker.
27
+ for (let j = i - 1; j >= 0 && COMMENT_LINE.test(lines[j] ?? ""); j--) {
28
+ if (lines[j]?.includes("structural-ok:")) return;
29
+ }
30
+ findings++;
31
+ console.error(
32
+ `src/lib/${entry}:${i + 1} consumer-generated structural class (arbitrary variant): ${text.trim().slice(0, 120)}`,
33
+ );
34
+ });
35
35
  }
36
36
 
37
37
  if (findings > 0) {
38
- console.error(
39
- `\n${findings} arbitrary variant(s) in lib class modules. Move the styling to real CSS in src/styles/globals.css (see .carousel-stack) or annotate with a \`structural-ok: <reason>\` comment.`,
40
- );
41
- process.exit(1);
38
+ console.error(
39
+ `\n${findings} arbitrary variant(s) in lib class modules. Move the styling to real CSS in src/styles/globals.css (see .carousel-stack) or annotate with a \`structural-ok: <reason>\` comment.`,
40
+ );
41
+ process.exit(1);
42
42
  }
43
43
  console.log("check-structural-classes: lib class strings are consumer-independent.");
@@ -4,23 +4,23 @@ import path from "node:path";
4
4
  import { DEFAULT_THEME_ID, getPreset, parseThemeBlock, type ThemeColors } from "../src/tokens";
5
5
 
6
6
  const css = readFileSync(
7
- path.resolve(path.dirname(new URL(import.meta.url).pathname), "../src/styles/theme.css"),
8
- "utf8",
7
+ path.resolve(path.dirname(new URL(import.meta.url).pathname), "../src/styles/theme.css"),
8
+ "utf8",
9
9
  );
10
10
 
11
11
  const KEYS: Record<string, keyof ThemeColors> = {
12
- "--primary": "primary",
13
- "--accent": "accent",
14
- "--secondary": "secondary",
15
- "--border": "border",
16
- "--card": "card",
17
- "--background": "background",
18
- "--muted": "muted",
19
- "--muted-foreground": "mutedForeground",
20
- "--input": "input",
21
- "--ring": "ring",
22
- "--destructive": "destructive",
23
- "--popover": "popover",
12
+ "--primary": "primary",
13
+ "--accent": "accent",
14
+ "--secondary": "secondary",
15
+ "--border": "border",
16
+ "--card": "card",
17
+ "--background": "background",
18
+ "--muted": "muted",
19
+ "--muted-foreground": "mutedForeground",
20
+ "--input": "input",
21
+ "--ring": "ring",
22
+ "--destructive": "destructive",
23
+ "--popover": "popover",
24
24
  };
25
25
 
26
26
  const preset = getPreset(DEFAULT_THEME_ID);
@@ -28,22 +28,22 @@ if (!preset) throw new Error(`preset missing: ${DEFAULT_THEME_ID}`);
28
28
 
29
29
  let drift = 0;
30
30
  for (const [mode, block] of [
31
- ["light", ":root"],
32
- ["dark", ".dark"],
31
+ ["light", ":root"],
32
+ ["dark", ".dark"],
33
33
  ] as const) {
34
- const vars = parseThemeBlock(css, block);
35
- for (const [cssKey, tokenKey] of Object.entries(KEYS)) {
36
- const cssValue = vars[cssKey];
37
- const tokenValue = preset.colors[mode][tokenKey];
38
- if (cssValue !== tokenValue) {
39
- console.error(`${mode} ${cssKey}: css="${cssValue}" tokens="${tokenValue}"`);
40
- drift++;
41
- }
42
- }
34
+ const vars = parseThemeBlock(css, block);
35
+ for (const [cssKey, tokenKey] of Object.entries(KEYS)) {
36
+ const cssValue = vars[cssKey];
37
+ const tokenValue = preset.colors[mode][tokenKey];
38
+ if (cssValue !== tokenValue) {
39
+ console.error(`${mode} ${cssKey}: css="${cssValue}" tokens="${tokenValue}"`);
40
+ drift++;
41
+ }
42
+ }
43
43
  }
44
44
 
45
45
  if (drift > 0) {
46
- console.error(`${drift} token(s) drifted between theme.css and tokens/presets.ts`);
47
- process.exit(1);
46
+ console.error(`${drift} token(s) drifted between theme.css and tokens/presets.ts`);
47
+ process.exit(1);
48
48
  }
49
49
  console.log("theme.css and tokens/presets.ts in sync");
@@ -8,119 +8,119 @@ import { readdirSync, readFileSync, statSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
 
10
10
  const RULES = [
11
- [
12
- "hand-rolled blur",
13
- /(?:backdrop-blur(?:-\w+|-\[[^\]]+\])?|backdrop-filter)/,
14
- "blur belongs to the material: use <Card>/CARD_BLUR, OVERLAY_SURFACE, SCRIM_CLASS, or TRACK_SURFACE",
15
- ],
16
- [
17
- "hand-rolled surface fill",
18
- /\b(?<!hover:)(?<!focus:)(?<!active:)(?<!group-hover:)bg-(?:card|background|popover)\/\d+/,
19
- "translucent surface fills come from <Card>, <Overlay>, or a --glass-base knob",
20
- ],
21
- [
22
- "bespoke pill",
23
- /rounded-full[^"'`]*\bborder\b[^"'`]*bg-(?:card|background)\b/,
24
- 'use <Badge tone> or <Button size="none">',
25
- ],
26
- [
27
- "hand-rolled icon well",
28
- /(?=[^"'`]*\brounded-full\b)(?=[^"'`]*\bbg-foreground\/\d+)[^"'`]*\bsize-\d+\b/,
29
- 'a round well is <SectionIcon icon> (or children), a pressable one <Button size="icon">, a person <Avatar>',
30
- ],
31
- [
32
- "raw palette color",
33
- /\b(?:bg|text|border)-(?:amber|green|yellow|red|blue|orange|emerald|rose|sky)-\d{3}\b/,
34
- "use theme vars: var(--success)/var(--warning)/var(--destructive) via <Badge>/<Alert>",
35
- ],
36
- [
37
- "tinted callout",
38
- /border-(?:primary|destructive|warning|success)\/\d+[^"'`]*bg-(?:primary|destructive|warning|success)\/\d+/,
39
- "use <Alert tone> (Solid or astro) or ALERT_TONES",
40
- ],
41
- [
42
- "shadcn field chrome",
43
- /border-input\s[^"'`]*bg-(?:background|transparent)\b/,
44
- "use INPUT_CLASS / INPUT_SURFACE / FIELD_CHROME from @glasshome/ui",
45
- ],
46
- [
47
- "hand-rolled group header",
48
- /<SectionSubtitle\b/,
49
- "a labelled group inside a card is <SectionGroup icon label count action>; an empty state is <Empty> + parts; a list row is <ListRow>",
50
- ],
51
- [
52
- "solid badge",
53
- /border-transparent\s+bg-primary\s+text-primary-foreground/,
54
- "use <Badge tone> — there are no solid badge variants",
55
- ],
11
+ [
12
+ "hand-rolled blur",
13
+ /(?:backdrop-blur(?:-\w+|-\[[^\]]+\])?|backdrop-filter)/,
14
+ "blur belongs to the material: use <Card>/CARD_BLUR, OVERLAY_SURFACE, SCRIM_CLASS, or TRACK_SURFACE",
15
+ ],
16
+ [
17
+ "hand-rolled surface fill",
18
+ /\b(?<!hover:)(?<!focus:)(?<!active:)(?<!group-hover:)bg-(?:card|background|popover)\/\d+/,
19
+ "translucent surface fills come from <Card>, <Overlay>, or a --glass-base knob",
20
+ ],
21
+ [
22
+ "bespoke pill",
23
+ /rounded-full[^"'`]*\bborder\b[^"'`]*bg-(?:card|background)\b/,
24
+ 'use <Badge tone> or <Button size="none">',
25
+ ],
26
+ [
27
+ "hand-rolled icon well",
28
+ /(?=[^"'`]*\brounded-full\b)(?=[^"'`]*\bbg-foreground\/\d+)[^"'`]*\bsize-\d+\b/,
29
+ 'a round well is <SectionIcon icon> (or children), a pressable one <Button size="icon">, a person <Avatar>',
30
+ ],
31
+ [
32
+ "raw palette color",
33
+ /\b(?:bg|text|border)-(?:amber|green|yellow|red|blue|orange|emerald|rose|sky)-\d{3}\b/,
34
+ "use theme vars: var(--success)/var(--warning)/var(--destructive) via <Badge>/<Alert>",
35
+ ],
36
+ [
37
+ "tinted callout",
38
+ /border-(?:primary|destructive|warning|success)\/\d+[^"'`]*bg-(?:primary|destructive|warning|success)\/\d+/,
39
+ "use <Alert tone> (Solid or astro) or ALERT_TONES",
40
+ ],
41
+ [
42
+ "shadcn field chrome",
43
+ /border-input\s[^"'`]*bg-(?:background|transparent)\b/,
44
+ "use INPUT_CLASS / INPUT_SURFACE / FIELD_CHROME from @glasshome/ui",
45
+ ],
46
+ [
47
+ "hand-rolled group header",
48
+ /<SectionSubtitle\b/,
49
+ "a labelled group inside a card is <SectionGroup icon label count action>; an empty state is <Empty> + parts; a list row is <ListRow>",
50
+ ],
51
+ [
52
+ "solid badge",
53
+ /border-transparent\s+bg-primary\s+text-primary-foreground/,
54
+ "use <Badge tone> — there are no solid badge variants",
55
+ ],
56
56
  ];
57
57
 
58
58
  function walk(dir) {
59
- const out = [];
60
- for (const name of readdirSync(dir)) {
61
- const p = join(dir, name);
62
- const s = statSync(p);
63
- if (s.isDirectory()) out.push(...walk(p));
64
- else if (/\.(astro|tsx)$/.test(p)) out.push(p);
65
- }
66
- return out;
59
+ const out = [];
60
+ for (const name of readdirSync(dir)) {
61
+ const p = join(dir, name);
62
+ const s = statSync(p);
63
+ if (s.isDirectory()) out.push(...walk(p));
64
+ else if (/\.(astro|tsx)$/.test(p)) out.push(p);
65
+ }
66
+ return out;
67
67
  }
68
68
 
69
69
  export function checkUiDrift({ root = "src", allowFiles = [], allowPrefixes = [] } = {}) {
70
- if (process.env.SKIP_UI_DRIFT_CHECK === "1") return 0;
70
+ if (process.env.SKIP_UI_DRIFT_CHECK === "1") return 0;
71
71
 
72
- const offenders = [];
73
- for (const file of walk(root)) {
74
- if (allowFiles.includes(file)) continue;
75
- if (allowPrefixes.some((p) => file.startsWith(p))) continue;
76
- const text = readFileSync(file, "utf8");
77
- const lines = text.split("\n");
78
- const flagged = new Set();
79
- lines.forEach((line, i) => {
80
- if (line.includes("ui-drift-ok") || (i > 0 && lines[i - 1].includes("ui-drift-ok"))) return;
81
- for (const [type, re, fix] of RULES) {
82
- if (re.test(line)) {
83
- offenders.push({ file, line: i + 1, type, fix });
84
- flagged.add(type);
85
- }
86
- }
87
- });
88
- // Class lists split across lines evade line rules: rerun on a
89
- // whitespace-collapsed copy and report file-level hits not already seen.
90
- if (!text.includes("ui-drift-ok")) {
91
- const collapsed = text.replace(/\s+/g, " ");
92
- for (const [type, re, fix] of RULES) {
93
- if (!flagged.has(type) && re.test(collapsed)) {
94
- offenders.push({ file, line: 0, type: `${type} (multi-line)`, fix });
95
- }
96
- }
97
- }
98
- }
72
+ const offenders = [];
73
+ for (const file of walk(root)) {
74
+ if (allowFiles.includes(file)) continue;
75
+ if (allowPrefixes.some((p) => file.startsWith(p))) continue;
76
+ const text = readFileSync(file, "utf8");
77
+ const lines = text.split("\n");
78
+ const flagged = new Set();
79
+ lines.forEach((line, i) => {
80
+ if (line.includes("ui-drift-ok") || (i > 0 && lines[i - 1].includes("ui-drift-ok"))) return;
81
+ for (const [type, re, fix] of RULES) {
82
+ if (re.test(line)) {
83
+ offenders.push({ file, line: i + 1, type, fix });
84
+ flagged.add(type);
85
+ }
86
+ }
87
+ });
88
+ // Class lists split across lines evade line rules: rerun on a
89
+ // whitespace-collapsed copy and report file-level hits not already seen.
90
+ if (!text.includes("ui-drift-ok")) {
91
+ const collapsed = text.replace(/\s+/g, " ");
92
+ for (const [type, re, fix] of RULES) {
93
+ if (!flagged.has(type) && re.test(collapsed)) {
94
+ offenders.push({ file, line: 0, type: `${type} (multi-line)`, fix });
95
+ }
96
+ }
97
+ }
98
+ }
99
99
 
100
- if (offenders.length === 0) {
101
- console.log("ui:check — no hand-rolled primitives found ✓");
102
- return 0;
103
- }
100
+ if (offenders.length === 0) {
101
+ console.log("ui:check — no hand-rolled primitives found ✓");
102
+ return 0;
103
+ }
104
104
 
105
- const byType = {};
106
- for (const o of offenders) {
107
- byType[o.type] ??= [];
108
- byType[o.type].push(o);
109
- }
110
- console.error(
111
- `ui:check — ${offenders.length} hand-rolled primitive(s) duplicating @glasshome/ui:\n`,
112
- );
113
- for (const [type, list] of Object.entries(byType)) {
114
- console.error(` ${type} (${list.length}) — ${list[0].fix}`);
115
- for (const o of list) console.error(` ${o.file}${o.line ? `:${o.line}` : ""}`);
116
- console.error("");
117
- }
118
- console.error(
119
- "Migrate to the package primitive, or add `ui-drift-ok <reason>` in a line comment if bespoke is intended.",
120
- );
121
- return 1;
105
+ const byType = {};
106
+ for (const o of offenders) {
107
+ byType[o.type] ??= [];
108
+ byType[o.type].push(o);
109
+ }
110
+ console.error(
111
+ `ui:check — ${offenders.length} hand-rolled primitive(s) duplicating @glasshome/ui:\n`,
112
+ );
113
+ for (const [type, list] of Object.entries(byType)) {
114
+ console.error(` ${type} (${list.length}) — ${list[0].fix}`);
115
+ for (const o of list) console.error(` ${o.file}${o.line ? `:${o.line}` : ""}`);
116
+ console.error("");
117
+ }
118
+ console.error(
119
+ "Migrate to the package primitive, or add `ui-drift-ok <reason>` in a line comment if bespoke is intended.",
120
+ );
121
+ return 1;
122
122
  }
123
123
 
124
124
  if (import.meta.url === `file://${process.argv[1]}`) {
125
- process.exit(checkUiDrift());
125
+ process.exit(checkUiDrift());
126
126
  }
package/src/index.ts CHANGED
@@ -2,111 +2,106 @@
2
2
  * are exported here only for consumers that cannot run Solid (server .astro
3
3
  * frontmatter) or that gate the blur themselves (performant-blur wrappers). */
4
4
  export {
5
- ALERT_CLASS,
6
- ALERT_CONTENT_CLASS,
7
- ALERT_DESCRIPTION_CLASS,
8
- ALERT_ICON_BG_CLASS,
9
- ALERT_ICON_CLASS,
10
- ALERT_ICON_PATHS,
11
- ALERT_TITLE_CLASS,
12
- ALERT_TONES,
13
- type AlertTone,
14
- type AlertToneStyle,
15
- alertBorder,
16
- alertFill,
17
- alertIconBgStyle,
18
- alertIconFill,
5
+ ALERT_CLASS,
6
+ ALERT_CONTENT_CLASS,
7
+ ALERT_DESCRIPTION_CLASS,
8
+ ALERT_ICON_BG_CLASS,
9
+ ALERT_ICON_CLASS,
10
+ ALERT_ICON_PATHS,
11
+ ALERT_TITLE_CLASS,
12
+ ALERT_TONES,
13
+ type AlertTone,
14
+ type AlertToneStyle,
15
+ alertBorder,
16
+ alertFill,
17
+ alertIconBgStyle,
18
+ alertIconFill,
19
19
  } from "./lib/alert-tones.js";
20
20
  export {
21
- BUTTON_DEFAULT_CLASS,
22
- BUTTON_OUTLINE_CLASS,
23
- buttonVariants,
24
- ICON_BUTTON_CLASS,
25
- OUTLINE_SURFACE,
21
+ BUTTON_DEFAULT_CLASS,
22
+ BUTTON_OUTLINE_CLASS,
23
+ buttonVariants,
24
+ ICON_BUTTON_CLASS,
25
+ OUTLINE_SURFACE,
26
26
  } from "./lib/button-variants.js";
27
27
  export {
28
- CARD_BLUR,
29
- CARD_SURFACE,
30
- CARD_SURFACE_BASE,
31
- CARD_SURFACE_OPAQUE,
32
- SECTION_ROW_SURFACE,
33
- TRACK_SURFACE,
28
+ CARD_BLUR,
29
+ CARD_SURFACE,
30
+ CARD_SURFACE_BASE,
31
+ CARD_SURFACE_OPAQUE,
32
+ SECTION_ROW_SURFACE,
33
+ TRACK_SURFACE,
34
34
  } from "./lib/card-classes.js";
35
35
  export {
36
- CAROUSEL_DOTS,
37
- CAROUSEL_VIEWPORT,
38
- type CarouselTransition,
39
- carouselDot,
40
- carouselItem,
41
- carouselTrack,
36
+ CAROUSEL_DOTS,
37
+ CAROUSEL_VIEWPORT,
38
+ type CarouselTransition,
39
+ carouselDot,
40
+ carouselItem,
41
+ carouselTrack,
42
42
  } from "./lib/carousel-classes.js";
43
43
  export { glassToneText, toneTextMix } from "./lib/glass-tone.js";
44
44
  export {
45
- CONTROL_H,
46
- FIELD_CHROME,
47
- FIELD_CONTROL,
48
- FIELD_TEXT,
49
- FOCUS_RING,
50
- INPUT_CLASS,
51
- INPUT_SURFACE,
52
- INVALID_RING,
45
+ CONTROL_H,
46
+ FIELD_CHROME,
47
+ FIELD_CONTROL,
48
+ FIELD_TEXT,
49
+ FOCUS_RING,
50
+ INPUT_CLASS,
51
+ INPUT_SURFACE,
52
+ INVALID_RING,
53
53
  } from "./lib/input-classes.js";
54
54
  export { Z, Z_CLASS } from "./lib/layers.js";
55
55
  export {
56
- LOGO_DEFAULT_SIZE,
57
- LOGO_DEFAULT_SRC,
58
- LOGO_DEFAULT_SUB,
59
- LOGO_MARK_CLASS,
60
- LOGO_MARK_PX,
61
- LOGO_NAME_CLASS,
62
- LOGO_ROOT_CLASS,
63
- LOGO_SIZES,
64
- LOGO_STACK_CLASS,
65
- LOGO_SUB_CLASS,
66
- type LogoSize,
56
+ LOGO_DEFAULT_SIZE,
57
+ LOGO_DEFAULT_SRC,
58
+ LOGO_DEFAULT_SUB,
59
+ LOGO_MARK_CLASS,
60
+ LOGO_MARK_PX,
61
+ LOGO_NAME_CLASS,
62
+ LOGO_ROOT_CLASS,
63
+ LOGO_SIZES,
64
+ LOGO_STACK_CLASS,
65
+ LOGO_SUB_CLASS,
66
+ type LogoSize,
67
67
  } from "./lib/logo-lockup.js";
68
68
  export {
69
- MENU_ITEM,
70
- MENU_ITEM_BASE,
71
- MENU_ITEM_X,
72
- MENU_LABEL,
73
- MENU_SEPARATOR,
69
+ MENU_ITEM,
70
+ MENU_ITEM_BASE,
71
+ MENU_ITEM_X,
72
+ MENU_LABEL,
73
+ MENU_SEPARATOR,
74
74
  } from "./lib/menu-classes.js";
75
75
  export {
76
- FIELD_MOTION,
77
- MODAL_MOTION,
78
- MORPH_MOTION,
79
- OVERLAY_MOTION,
80
- PRESS_DIP,
81
- SCRIM_MOTION,
82
- SETTLE_MOTION,
83
- STAGGER,
76
+ FIELD_MOTION,
77
+ MODAL_MOTION,
78
+ MORPH_MOTION,
79
+ OVERLAY_MOTION,
80
+ PRESS_DIP,
81
+ SCRIM_MOTION,
82
+ SETTLE_MOTION,
83
+ STAGGER,
84
84
  } from "./lib/motion-classes.js";
85
85
  export { MOTION_WINDOW_MS, startMotionWindow } from "./lib/motion-window.js";
86
86
  export {
87
- anchorToTriggerTop,
88
- FLOATING_PANEL,
89
- OVERLAY_BLUR,
90
- OVERLAY_SURFACE,
91
- OVERLAY_SURFACE_BASE,
92
- OVERLAY_SURFACE_OPAQUE,
93
- SCRIM_CLASS,
87
+ anchorToTriggerTop,
88
+ FLOATING_PANEL,
89
+ OVERLAY_BLUR,
90
+ OVERLAY_SURFACE,
91
+ OVERLAY_SURFACE_BASE,
92
+ OVERLAY_SURFACE_OPAQUE,
93
+ SCRIM_CLASS,
94
94
  } from "./lib/overlay-classes.js";
95
95
  export { CONTROL_H_TOUCH, PICKER_LIST, PICKER_TRIGGER } from "./lib/picker-classes.js";
96
96
  export { CHIP, ICON_PILL, ICON_PILL_TINT } from "./lib/pill-classes.js";
97
97
  export { POSITION_BAR, POSITION_BAR_LIT } from "./lib/position-bar-classes.js";
98
98
  export {
99
- SECTION_INNER_RADIUS,
100
- SECTION_OUTER_RADIUS,
101
- SECTION_PADDING,
102
- SECTION_ROW_CLASS,
99
+ SECTION_INNER_RADIUS,
100
+ SECTION_OUTER_RADIUS,
101
+ SECTION_PADDING,
102
+ SECTION_ROW_CLASS,
103
103
  } from "./lib/section-tokens.js";
104
104
  export { SEGMENT_ITEM } from "./lib/segment-classes.js";
105
- export {
106
- THUMB_CLASS,
107
- THUMB_RAIL_BLEED,
108
- THUMB_RAIL_PAD,
109
- THUMB_SIZE,
110
- } from "./lib/thumb-classes.js";
105
+ export { THUMB_CLASS, THUMB_RAIL_BLEED, THUMB_RAIL_PAD, THUMB_SIZE } from "./lib/thumb-classes.js";
111
106
  export { createIsMobile, MOBILE_BREAKPOINT } from "./lib/use-is-mobile.js";
112
107
  export { cn } from "./lib/utils.js";
@@ -1,43 +1,43 @@
1
1
  export type AlertTone = "info" | "warning" | "success" | "destructive";
2
2
 
3
3
  export type AlertToneStyle = {
4
- color: string;
5
- icon: string;
6
- text: string;
4
+ color: string;
5
+ icon: string;
6
+ text: string;
7
7
  };
8
8
 
9
9
  /* Text mixes in oklab: no hue channel, a hued tone desaturates without swinging yellow. */
10
10
  export const ALERT_TONES: Record<AlertTone, AlertToneStyle> = {
11
- info: {
12
- color: "var(--primary)",
13
- icon: "lucide:info",
14
- text: "var(--primary-tint-foreground)",
15
- },
16
- warning: {
17
- color: "var(--warning)",
18
- icon: "lucide:alert-triangle",
19
- text: "color-mix(in oklab, var(--warning) 55%, var(--foreground))",
20
- },
21
- success: {
22
- color: "var(--success)",
23
- icon: "lucide:check-circle-2",
24
- text: "color-mix(in oklab, var(--success) 60%, var(--foreground))",
25
- },
26
- destructive: {
27
- color: "var(--destructive)",
28
- icon: "lucide:alert-octagon",
29
- text: "color-mix(in oklab, var(--destructive) 65%, var(--foreground))",
30
- },
11
+ info: {
12
+ color: "var(--primary)",
13
+ icon: "lucide:info",
14
+ text: "var(--primary-tint-foreground)",
15
+ },
16
+ warning: {
17
+ color: "var(--warning)",
18
+ icon: "lucide:alert-triangle",
19
+ text: "color-mix(in oklab, var(--warning) 55%, var(--foreground))",
20
+ },
21
+ success: {
22
+ color: "var(--success)",
23
+ icon: "lucide:check-circle-2",
24
+ text: "color-mix(in oklab, var(--success) 60%, var(--foreground))",
25
+ },
26
+ destructive: {
27
+ color: "var(--destructive)",
28
+ icon: "lucide:alert-octagon",
29
+ text: "color-mix(in oklab, var(--destructive) 65%, var(--foreground))",
30
+ },
31
31
  };
32
32
 
33
33
  /* Lucide glyph paths (viewBox 0 0 24 24), rendered by both the Solid and Astro <Alert>. */
34
34
  export const ALERT_ICON_PATHS: Record<AlertTone, string> = {
35
- info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
36
- warning:
37
- '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
38
- success: '<path d="M21.801 10A10 10 0 1 1 17 3.335"/><path d="m9 11 3 3L22 4"/>',
39
- destructive:
40
- '<path d="M12 16h.01"/><path d="M12 8v4"/><path d="M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688A2 2 0 0 1 15.312 22H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"/>',
35
+ info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
36
+ warning:
37
+ '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
38
+ success: '<path d="M21.801 10A10 10 0 1 1 17 3.335"/><path d="m9 11 3 3L22 4"/>',
39
+ destructive:
40
+ '<path d="M12 16h.01"/><path d="M12 8v4"/><path d="M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688A2 2 0 0 1 15.312 22H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"/>',
41
41
  };
42
42
 
43
43
  /* srgb, not oklch: oklch drags a tone mixed toward transparent down to mud. */
@@ -46,25 +46,25 @@ export const alertFill = (c: string) => `color-mix(in srgb, ${c} 9%, transparent
46
46
  export const alertIconFill = (c: string) => `color-mix(in srgb, ${c} 16%, transparent)`;
47
47
 
48
48
  export const ALERT_CLASS =
49
- "relative overflow-hidden flex items-start gap-3 rounded-lg p-3 backdrop-blur-sm";
49
+ "relative overflow-hidden flex items-start gap-3 rounded-lg p-3 backdrop-blur-sm";
50
50
  /* gh-alert-* svg chrome lives in globals.css as real CSS: an arbitrary variant
51
51
  * here only works if the consumer's Tailwind scans package source. */
52
52
  export const ALERT_ICON_CLASS =
53
- "gh-alert-icon flex size-8 shrink-0 items-center justify-center rounded-md";
53
+ "gh-alert-icon flex size-8 shrink-0 items-center justify-center rounded-md";
54
54
  export const ALERT_ICON_BG_CLASS =
55
- "gh-alert-icon-bg pointer-events-none absolute -right-3 -bottom-4";
55
+ "gh-alert-icon-bg pointer-events-none absolute -right-3 -bottom-4";
56
56
  export function iconBgMaskStyle(color: string): Record<string, string> {
57
- return {
58
- color,
59
- "-webkit-mask-image": "radial-gradient(140% 140% at 100% 100%, #000 45%, transparent 95%)",
60
- "mask-image": "radial-gradient(140% 140% at 100% 100%, #000 45%, transparent 95%)",
61
- };
57
+ return {
58
+ color,
59
+ "-webkit-mask-image": "radial-gradient(140% 140% at 100% 100%, #000 45%, transparent 95%)",
60
+ "mask-image": "radial-gradient(140% 140% at 100% 100%, #000 45%, transparent 95%)",
61
+ };
62
62
  }
63
63
  export function alertIconBgStyle(color: string): Record<string, string> {
64
- return {
65
- ...iconBgMaskStyle(color),
66
- opacity: "0.32",
67
- };
64
+ return {
65
+ ...iconBgMaskStyle(color),
66
+ opacity: "0.32",
67
+ };
68
68
  }
69
69
  export const ALERT_CONTENT_CLASS = "relative z-10 min-w-0 flex-1";
70
70
  export const ALERT_TITLE_CLASS = "font-semibold text-base leading-snug";