@heyramzi/ui 1.53.1 → 1.54.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.
- package/COMPONENTS.md +6 -0
- package/package.json +2 -2
- package/src/agents/agent-avatar.svelte +3 -2
- package/src/agents/helpers.ts +9 -0
- package/src/components/data-table/sortable-head.svelte +1 -1
- package/src/components/docs/doc-page.svelte +161 -0
- package/src/components/docs/index.ts +12 -0
- package/src/components/docs/on-this-page.svelte +217 -0
- package/src/components/docs/scroll-spy.svelte.ts +97 -0
- package/src/components/field-row/field-row.svelte +57 -0
- package/src/components/field-row/index.ts +1 -0
- package/src/components/list-page/toolbar-search.svelte +1 -1
- package/src/components/list-page/toolbar-trigger.ts +1 -1
- package/src/components/picker/trigger.ts +2 -2
- package/src/components/section-card/index.ts +1 -0
- package/src/components/section-card/section-card.svelte +43 -0
- package/src/components/section-header/index.ts +1 -0
- package/src/components/section-header/section-header.svelte +54 -0
- package/src/components/section-header/section-header.test.ts +25 -0
- package/src/components/segmented/collapse.test.ts +10 -0
- package/src/components/segmented/collapse.ts +5 -0
- package/src/components/segmented/segmented-filter.svelte +5 -4
- package/src/components/segmented/segmented-track.svelte +20 -0
- package/src/components/segmented/segmented.test.ts +1 -1
- package/src/components/segmented/segmented.ts +2 -2
- package/src/components/table-view/index.ts +3 -0
- package/src/components/table-view/table-view.svelte +103 -0
- package/src/components/table-view/table-view.test.ts +53 -0
- package/src/components/table-view/types.ts +14 -0
- package/src/components/theme/index.ts +17 -0
- package/src/components/theme/theme-provider.svelte +47 -0
- package/src/components/theme/theme-provider.test.ts +61 -0
- package/src/effects/spotlight/Spotlight.svelte +0 -1
- package/src/lib/tone.test.ts +10 -0
- package/src/lib/tone.ts +1 -1
- package/src/shadcn/badge/badge.svelte +1 -1
- package/src/shadcn/button/button.svelte +10 -1
- package/src/shadcn/button/button.test.ts +19 -0
- package/src/shadcn/checkbox/checkbox.svelte +1 -1
- package/src/shadcn/context-menu/context-menu-separator.svelte +4 -1
- package/src/shadcn/dropdown-menu/dropdown-menu-separator.svelte +4 -1
- package/src/shadcn/input/input.svelte +2 -2
- package/src/shadcn/progress/progress.svelte +8 -2
- package/src/shadcn/progress/tone.test.ts +13 -0
- package/src/shadcn/progress/tone.ts +15 -0
- package/src/shadcn/sidebar/sidebar-group-label.svelte +1 -1
- package/src/shadcn/table/table-cell.svelte +21 -1
- package/src/shadcn/table/table-cell.test.ts +16 -0
- package/src/tokens/base.css +183 -0
- package/src/tokens/craft.css +179 -0
- package/src/tokens/index.css +19 -0
- package/src/tokens/palette.css +410 -0
- package/src/tokens/primitives.css +223 -0
- package/scripts/relative-imports.mjs +0 -39
- package/src/tokens.css +0 -993
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
<DropdownMenuPrimitive.Separator
|
|
13
13
|
bind:ref
|
|
14
14
|
data-slot="dropdown-menu-separator"
|
|
15
|
-
class={cn(
|
|
15
|
+
class={cn(
|
|
16
|
+
"bg-border -mx-1 my-1 h-px first:hidden last:hidden [[data-slot=dropdown-menu-separator]+&]:hidden",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
16
19
|
{...restProps}
|
|
17
20
|
/>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
bind:this={ref}
|
|
26
26
|
data-slot={dataSlot}
|
|
27
27
|
class={cn(
|
|
28
|
-
"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base shadow-field transition-[color,background-color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
28
|
+
"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 any-pointer-coarse:h-11 rounded-lg border bg-transparent px-2.5 py-1 text-base shadow-field transition-[color,background-color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
29
29
|
className,
|
|
30
30
|
)}
|
|
31
31
|
type="file"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
bind:this={ref}
|
|
39
39
|
data-slot={dataSlot}
|
|
40
40
|
class={cn(
|
|
41
|
-
"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base shadow-field transition-[color,background-color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
41
|
+
"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 any-pointer-coarse:h-11 rounded-lg border bg-transparent px-2.5 py-1 text-base shadow-field transition-[color,background-color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
42
42
|
className,
|
|
43
43
|
)}
|
|
44
44
|
{type}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Progress as ProgressPrimitive } from "bits-ui";
|
|
3
3
|
import { cn, type WithoutChildrenOrChild } from "@heyramzi/utils";
|
|
4
|
+
import { progressToneClass } from "./tone.js";
|
|
5
|
+
import type { Tone } from "../../lib/tone.js";
|
|
4
6
|
|
|
5
7
|
let {
|
|
6
8
|
ref = $bindable(null),
|
|
7
9
|
class: className,
|
|
8
10
|
max = 100,
|
|
9
11
|
value,
|
|
12
|
+
tone,
|
|
10
13
|
...restProps
|
|
11
|
-
}: WithoutChildrenOrChild<ProgressPrimitive.RootProps>
|
|
14
|
+
}: WithoutChildrenOrChild<ProgressPrimitive.RootProps> & {
|
|
15
|
+
/** The fill's colour on the severity scale. Left out, the primary colour. */
|
|
16
|
+
tone?: Tone;
|
|
17
|
+
} = $props();
|
|
12
18
|
</script>
|
|
13
19
|
|
|
14
20
|
<ProgressPrimitive.Root
|
|
@@ -24,7 +30,7 @@
|
|
|
24
30
|
>
|
|
25
31
|
<div
|
|
26
32
|
data-slot="progress-indicator"
|
|
27
|
-
class="
|
|
33
|
+
class="{progressToneClass(tone)} size-full flex-1 transition-transform duration-[var(--duration-slow)] ease-[var(--ease-smooth-out)] motion-reduce:transition-none"
|
|
28
34
|
style="transform: translateX(-{100 - (100 * (value ?? 0)) / (max ?? 1)}%)"
|
|
29
35
|
></div>
|
|
30
36
|
</ProgressPrimitive.Root>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, expect, it } from "vite-plus/test";
|
|
2
|
+
import { progressToneClass } from "./tone.js";
|
|
3
|
+
|
|
4
|
+
describe("progressToneClass", () => {
|
|
5
|
+
it("keeps the primary fill when no tone is given", () => {
|
|
6
|
+
expect(progressToneClass()).toBe("bg-primary");
|
|
7
|
+
});
|
|
8
|
+
it("gives each tone its own fill", () => {
|
|
9
|
+
expect(progressToneClass("success")).toBe("bg-success");
|
|
10
|
+
expect(progressToneClass("destructive")).toBe("bg-destructive");
|
|
11
|
+
expect(progressToneClass("accent")).toContain("--tone-accent");
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Tone } from "../../lib/tone.js";
|
|
2
|
+
|
|
3
|
+
/** The fill colour for each tone. No tone is the primary colour, as before. */
|
|
4
|
+
const FILL: Record<Tone, string> = {
|
|
5
|
+
neutral: "bg-muted-foreground",
|
|
6
|
+
accent: "bg-[color:var(--tone-accent,var(--color-primary))]",
|
|
7
|
+
info: "bg-info",
|
|
8
|
+
success: "bg-success",
|
|
9
|
+
warning: "bg-warning",
|
|
10
|
+
destructive: "bg-destructive",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function progressToneClass(tone?: Tone): string {
|
|
14
|
+
return tone ? FILL[tone] : "bg-primary";
|
|
15
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
const mergedProps = $derived({
|
|
17
17
|
class: cn(
|
|
18
|
-
"text-sidebar-foreground/
|
|
18
|
+
"text-sidebar-foreground/90 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-[var(--duration-fast)] ease-[var(--ease-smooth-out)] group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:pointer-events-none focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0",
|
|
19
19
|
className,
|
|
20
20
|
),
|
|
21
21
|
"data-slot": "sidebar-group-label",
|
|
@@ -13,8 +13,28 @@
|
|
|
13
13
|
<td
|
|
14
14
|
bind:this={ref}
|
|
15
15
|
data-slot="table-cell"
|
|
16
|
-
class={cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className)}
|
|
16
|
+
class={cn("p-2 align-middle whitespace-nowrap tabular-nums [&:has([role=checkbox])]:pr-0", className)}
|
|
17
17
|
{...restProps}
|
|
18
18
|
>
|
|
19
19
|
{@render children?.()}
|
|
20
20
|
</td>
|
|
21
|
+
|
|
22
|
+
<!-- WHY here: a link in a cell is 20px tall, and a cell is the only place that knows it sits in a
|
|
23
|
+
row of them. On a coarse pointer the link grows a 44px box centred on it, wider when the link
|
|
24
|
+
is. A link that positions itself (a stretched row link) keeps its own box. -->
|
|
25
|
+
<style>
|
|
26
|
+
@media (any-pointer: coarse) {
|
|
27
|
+
td :global(a[href]:not([class*="absolute"], [class*="fixed"], [class*="sticky"])) {
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
td :global(a[href]:not([class*="absolute"], [class*="fixed"], [class*="sticky"]))::after {
|
|
31
|
+
content: "";
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 50%;
|
|
34
|
+
left: 50%;
|
|
35
|
+
width: max(100%, 2.75rem);
|
|
36
|
+
height: max(100%, 2.75rem);
|
|
37
|
+
transform: translate(-50%, -50%);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { flushSync, mount, unmount } from "svelte";
|
|
2
|
+
import { describe, expect, it } from "vite-plus/test";
|
|
3
|
+
import TableCell from "./table-cell.svelte";
|
|
4
|
+
|
|
5
|
+
describe("TableCell", () => {
|
|
6
|
+
// A column of dates or prices has to line up whoever writes the cell.
|
|
7
|
+
it("keeps digits one width", () => {
|
|
8
|
+
const target = document.createElement("tr");
|
|
9
|
+
document.body.appendChild(target);
|
|
10
|
+
const app = mount(TableCell, { target, props: {} });
|
|
11
|
+
flushSync();
|
|
12
|
+
expect(target.querySelector("td")?.className).toContain("tabular-nums");
|
|
13
|
+
void unmount(app);
|
|
14
|
+
target.remove();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/* The shadow family, now valued by @heyramzi/ui/design. Names stay because
|
|
2
|
+
170-odd call sites use them. Shadow only, since these elements draw their own border. */
|
|
3
|
+
|
|
4
|
+
/* New work: use `shadow-btn`, `shadow-card`, `shadow-raised` and `shadow-overlay`. */
|
|
5
|
+
@layer utilities {
|
|
6
|
+
.shadow-soft-sm {
|
|
7
|
+
box-shadow: var(--elev-btn);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.shadow-soft {
|
|
11
|
+
box-shadow: var(--elev-card);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.shadow-soft-md {
|
|
15
|
+
box-shadow: var(--elev-raised);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* The one step that answers a pointer rather than describing a resting
|
|
19
|
+
height, so it borrows the step above whatever it was at rest. */
|
|
20
|
+
.shadow-soft-hover {
|
|
21
|
+
box-shadow: var(--elev-raised);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* The nine bits-ui state variants moved into `@heyramzi/ui/design` on 14 Sep
|
|
26
|
+
2026. app.css imports that before this file. */
|
|
27
|
+
|
|
28
|
+
@utility no-scrollbar {
|
|
29
|
+
-ms-overflow-style: none;
|
|
30
|
+
scrollbar-width: none;
|
|
31
|
+
&::-webkit-scrollbar {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@utility thin-scrollbar {
|
|
37
|
+
scrollbar-width: thin;
|
|
38
|
+
scrollbar-color: oklch(0.84 0 0) transparent;
|
|
39
|
+
&::-webkit-scrollbar {
|
|
40
|
+
width: 4px;
|
|
41
|
+
}
|
|
42
|
+
&::-webkit-scrollbar-track {
|
|
43
|
+
background: transparent;
|
|
44
|
+
}
|
|
45
|
+
&::-webkit-scrollbar-thumb {
|
|
46
|
+
background: oklch(0.84 0 0);
|
|
47
|
+
border-radius: 9999px;
|
|
48
|
+
}
|
|
49
|
+
.dark & {
|
|
50
|
+
scrollbar-color: oklch(0.45 0 0) transparent;
|
|
51
|
+
&::-webkit-scrollbar-thumb {
|
|
52
|
+
background: oklch(0.45 0 0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* WHY: below sm the dialog docks as a bottom sheet. The .t-modal scale would lift
|
|
58
|
+
it off the edge. A sheet enters from the edge it rests on. */
|
|
59
|
+
@media (max-width: 639px) {
|
|
60
|
+
[data-slot="dialog-content"]:not([data-command-dialog]).t-modal {
|
|
61
|
+
transform: translateY(100%);
|
|
62
|
+
transition:
|
|
63
|
+
transform var(--modal-open-dur) var(--modal-ease),
|
|
64
|
+
opacity var(--modal-open-dur) var(--modal-ease);
|
|
65
|
+
}
|
|
66
|
+
[data-slot="dialog-content"]:not([data-command-dialog]).t-modal[data-state="open"] {
|
|
67
|
+
transform: translateY(0);
|
|
68
|
+
}
|
|
69
|
+
[data-slot="dialog-content"]:not([data-command-dialog]).t-modal[data-state="closed"] {
|
|
70
|
+
transform: translateY(100%);
|
|
71
|
+
transition:
|
|
72
|
+
transform var(--modal-close-dur) var(--modal-ease),
|
|
73
|
+
opacity var(--modal-close-dur) var(--modal-ease);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ── The palette does not animate ──────────────────────
|
|
78
|
+
WHY: it's opened by shortcut dozens of times a day, so an entrance feels like
|
|
79
|
+
lag. Raycast and Spotlight don't animate either. */
|
|
80
|
+
|
|
81
|
+
/* The backdrop is a sibling in the portal, so it's named via `overlayClass`.
|
|
82
|
+
Reaching across the portal would also hit a dialog open underneath. */
|
|
83
|
+
[data-slot="dialog-content"][data-command-dialog].t-modal,
|
|
84
|
+
[data-slot="dialog-overlay"].t-modal-backdrop.t-instant {
|
|
85
|
+
transition: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@layer base {
|
|
89
|
+
* {
|
|
90
|
+
@apply border-border outline-ring/50;
|
|
91
|
+
}
|
|
92
|
+
body {
|
|
93
|
+
@apply bg-background text-foreground;
|
|
94
|
+
}
|
|
95
|
+
html {
|
|
96
|
+
@apply font-sans;
|
|
97
|
+
scrollbar-color: var(--gray-300) transparent;
|
|
98
|
+
/* WHY: iOS Safari inflates text in landscape unless this is pinned. */
|
|
99
|
+
-webkit-text-size-adjust: 100%;
|
|
100
|
+
text-size-adjust: 100%;
|
|
101
|
+
}
|
|
102
|
+
.dark html,
|
|
103
|
+
html.dark {
|
|
104
|
+
scrollbar-color: var(--brand-veil) transparent;
|
|
105
|
+
}
|
|
106
|
+
h1,
|
|
107
|
+
h2,
|
|
108
|
+
h3,
|
|
109
|
+
h4,
|
|
110
|
+
h5,
|
|
111
|
+
h6 {
|
|
112
|
+
font-family: var(--font-heading);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* WHY: the browser's default highlight is a system blue from no theme. Indigo
|
|
116
|
+
at 18% keeps text at its own contrast in both modes. */
|
|
117
|
+
::selection {
|
|
118
|
+
background-color: color-mix(in oklab, var(--brand-indigo) 18%, transparent);
|
|
119
|
+
}
|
|
120
|
+
.dark ::selection,
|
|
121
|
+
html.dark ::selection {
|
|
122
|
+
background-color: color-mix(in oklab, var(--brand-indigo-light) 26%, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* ── Touch input ───────────────────────────────────────
|
|
126
|
+
WHY any-pointer: an iPad with a Magic Keyboard reports a fine pointer, and
|
|
127
|
+
`pointer: coarse` would drop touch sizing while the screen's still tapped. */
|
|
128
|
+
|
|
129
|
+
/* iOS paints a gray flash on every tap, which clashes with our own :active
|
|
130
|
+
feedback, so it's turned off. */
|
|
131
|
+
@media (any-pointer: coarse) {
|
|
132
|
+
a,
|
|
133
|
+
button,
|
|
134
|
+
label,
|
|
135
|
+
summary,
|
|
136
|
+
select,
|
|
137
|
+
[role="button"],
|
|
138
|
+
[role="link"],
|
|
139
|
+
[role="menuitem"],
|
|
140
|
+
[role="option"],
|
|
141
|
+
[role="tab"] {
|
|
142
|
+
-webkit-tap-highlight-color: transparent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* WHY: rows are built at desk density (28-32px). A thumb needs 44px, and rows
|
|
146
|
+
stack, so growing them costs only scroll. */
|
|
147
|
+
[data-slot="dropdown-menu-item"],
|
|
148
|
+
[data-slot="dropdown-menu-checkbox-item"],
|
|
149
|
+
[data-slot="dropdown-menu-radio-item"],
|
|
150
|
+
[data-slot="select-item"],
|
|
151
|
+
[data-slot="command-item"],
|
|
152
|
+
[data-slot="context-menu-item"],
|
|
153
|
+
[data-slot="context-menu-checkbox-item"],
|
|
154
|
+
[data-slot="context-menu-radio-item"] {
|
|
155
|
+
min-height: 44px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* ── Reduced motion, once ──────────────────────────────
|
|
161
|
+
WHY here: 22 files had no guard and 32 wrote their own. Both app.css files
|
|
162
|
+
import this, so it's stated once. */
|
|
163
|
+
|
|
164
|
+
/* A floor, not a kill switch: transitions still run at the micro step, so hover
|
|
165
|
+
and focus still answer. Entrance delays, loops and long travel go. */
|
|
166
|
+
|
|
167
|
+
/* Unlayered so it beats utilities and scoped rules. A component that wants
|
|
168
|
+
different behaviour writes its own reduced-motion block with `!important`. */
|
|
169
|
+
@media (prefers-reduced-motion: reduce) {
|
|
170
|
+
*,
|
|
171
|
+
*::before,
|
|
172
|
+
*::after {
|
|
173
|
+
animation-delay: 0ms !important;
|
|
174
|
+
animation-duration: 1ms !important;
|
|
175
|
+
animation-iteration-count: 1 !important;
|
|
176
|
+
transition-delay: 0ms !important;
|
|
177
|
+
transition-duration: var(--duration-micro) !important;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
html {
|
|
181
|
+
scroll-behavior: auto !important;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/* ── Radius, by role not by size ─────────────────────────────
|
|
2
|
+
A chip inside a control inside a card has to read as nested, which needs
|
|
3
|
+
three radii that step, not one radius reused. The Tailwind names are the
|
|
4
|
+
home so `rounded-lg` on a button already resolves to the control radius and
|
|
5
|
+
no component has to learn a new class. */
|
|
6
|
+
@theme {
|
|
7
|
+
--radius-xs: 4px; /* tag, dot, inline code */
|
|
8
|
+
--radius-sm: 6px; /* chip, badge, small pill */
|
|
9
|
+
--radius-md: 7px; /* between a chip and a control */
|
|
10
|
+
--radius-lg: 8px; /* control: button, input, select, menu item */
|
|
11
|
+
--radius-xl: 10px; /* card, panel, stage */
|
|
12
|
+
--radius-2xl: 14px; /* overlay: dialog, sheet, command palette */
|
|
13
|
+
--radius-3xl: 20px; /* hero surface, full-bleed panel */
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* ── Elevation ───────────────────────────────────────────────
|
|
17
|
+
Four steps of lift, plus the two edges that are not lift.
|
|
18
|
+
|
|
19
|
+
WHY the steps are shadow-only and the hairline is its own token: most boxes
|
|
20
|
+
in a kit already draw a border, and an elevation that bakes a `0 0 0 1px`
|
|
21
|
+
ring into every step gives those boxes two edges a pixel apart. Compose them
|
|
22
|
+
where a component drops its border:
|
|
23
|
+
|
|
24
|
+
box-shadow: var(--elev-hairline), var(--elev-card);
|
|
25
|
+
|
|
26
|
+
WHY each step is stacked rather than one blurred drop: a single shadow reads
|
|
27
|
+
as a sticker. Depth is several offsets falling off together, which is what
|
|
28
|
+
the eye reads as distance. They cost nothing extra because every stop is the
|
|
29
|
+
same colour at a different alpha.
|
|
30
|
+
|
|
31
|
+
WHY the blur radii are large and the alphas small: a 4px blur at 20% draws a
|
|
32
|
+
visible grey edge, which the eye reads as a second border. A 28px blur at 7%
|
|
33
|
+
is barely a colour anywhere and reads as height. Reach for more blur before
|
|
34
|
+
more alpha, every time.
|
|
35
|
+
|
|
36
|
+
`--elev-tint` is the one knob an app turns. Pure black greys a warm palette
|
|
37
|
+
out; the hue of the app's own darkest surface keeps the shadow in the
|
|
38
|
+
family. */
|
|
39
|
+
:root {
|
|
40
|
+
|
|
41
|
+
/* Resting on the page. A button, a chip, a row. */
|
|
42
|
+
--elev-btn:
|
|
43
|
+
0 1px 1px -0.5px color-mix(in oklab, var(--elev-tint) 7%, transparent),
|
|
44
|
+
0 2px 5px -2px color-mix(in oklab, var(--elev-tint) 6%, transparent);
|
|
45
|
+
|
|
46
|
+
/* Sitting on the page. A card, a stage, a panel. */
|
|
47
|
+
--elev-card:
|
|
48
|
+
0 1px 2px -1px color-mix(in oklab, var(--elev-tint) 7%, transparent),
|
|
49
|
+
0 4px 9px -3px color-mix(in oklab, var(--elev-tint) 6%, transparent),
|
|
50
|
+
0 14px 28px -10px color-mix(in oklab, var(--elev-tint) 7%, transparent);
|
|
51
|
+
|
|
52
|
+
/* Lifted off the page. A hovered card, a popover, a menu. */
|
|
53
|
+
--elev-raised:
|
|
54
|
+
0 1px 2px -1px color-mix(in oklab, var(--elev-tint) 8%, transparent),
|
|
55
|
+
0 6px 13px -4px color-mix(in oklab, var(--elev-tint) 9%, transparent),
|
|
56
|
+
0 20px 40px -12px color-mix(in oklab, var(--elev-tint) 12%, transparent);
|
|
57
|
+
|
|
58
|
+
/* Floating over a dimmed page. A dialog, a sheet, a command palette. */
|
|
59
|
+
--elev-overlay:
|
|
60
|
+
0 2px 4px -1px color-mix(in oklab, var(--elev-tint) 8%, transparent),
|
|
61
|
+
0 12px 26px -8px color-mix(in oklab, var(--elev-tint) 12%, transparent),
|
|
62
|
+
0 40px 72px -20px color-mix(in oklab, var(--elev-tint) 20%, transparent);
|
|
63
|
+
|
|
64
|
+
/* The two edges. A hairline separates a surface from what is behind it; a rim
|
|
65
|
+
is the light catching its top edge, which is what makes a filled control
|
|
66
|
+
read as a physical key rather than a coloured rectangle. */
|
|
67
|
+
--elev-hairline: 0 0 0 1px var(--color-border, var(--border));
|
|
68
|
+
--elev-rim: inset 0 1px 0 color-mix(in oklab, white 16%, transparent);
|
|
69
|
+
|
|
70
|
+
/* A field is the one box that goes in rather than up. */
|
|
71
|
+
--elev-field: inset 0 1px 2px color-mix(in oklab, var(--elev-tint) 7%, transparent);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* A dark surface cannot cast a darker shadow than the page it sits on, so the
|
|
75
|
+
hairline does the separating and the shadow only sinks what is behind it. On
|
|
76
|
+
dark the hairline is white at a low alpha, which is what reads as a lit edge
|
|
77
|
+
rather than as a drawn border. */
|
|
78
|
+
.dark {
|
|
79
|
+
--elev-btn: 0 1px 2px color-mix(in oklab, black 30%, transparent);
|
|
80
|
+
--elev-card:
|
|
81
|
+
0 1px 2px color-mix(in oklab, black 24%, transparent),
|
|
82
|
+
0 4px 12px -4px color-mix(in oklab, black 30%, transparent);
|
|
83
|
+
--elev-raised:
|
|
84
|
+
0 2px 6px color-mix(in oklab, black 30%, transparent),
|
|
85
|
+
0 10px 24px -6px color-mix(in oklab, black 38%, transparent);
|
|
86
|
+
--elev-overlay:
|
|
87
|
+
0 4px 10px color-mix(in oklab, black 34%, transparent),
|
|
88
|
+
0 24px 56px -12px color-mix(in oklab, black 50%, transparent);
|
|
89
|
+
|
|
90
|
+
--elev-hairline: 0 0 0 1px color-mix(in oklab, white 10%, transparent);
|
|
91
|
+
--elev-rim: inset 0 1px 0 color-mix(in oklab, white 10%, transparent);
|
|
92
|
+
--elev-field: inset 0 1px 2px color-mix(in oklab, black 40%, transparent);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* ── Focus ───────────────────────────────────────────────────
|
|
96
|
+
One ring, two parts: a solid edge that redraws the control's own outline in
|
|
97
|
+
the accent, and a soft halo that carries it off the surface. Written as a
|
|
98
|
+
variable so a component spends one line on it and every control focuses the
|
|
99
|
+
same way. */
|
|
100
|
+
:root {
|
|
101
|
+
--ring-color: var(--color-ring, var(--ring));
|
|
102
|
+
--ring-halo: color-mix(in oklab, var(--ring-color) 16%, transparent);
|
|
103
|
+
/* A solid pixel redrawing the control's own edge, then a wide soft band. At a
|
|
104
|
+
higher alpha the band reads as a second border rather than as a glow, which
|
|
105
|
+
is why it is 16% over 4px and not 30% over 2px. */
|
|
106
|
+
--ring-focus: 0 0 0 1px var(--ring-color), 0 0 0 5px var(--ring-halo);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* ── Motion ──────────────────────────────────────────────────
|
|
110
|
+
The transitions-dev scale, verbatim, so a snippet pasted from that skill and
|
|
111
|
+
a component written here read from the same names.
|
|
112
|
+
|
|
113
|
+
The doctrine in one line: an open is an invitation and a close should get out
|
|
114
|
+
of the way, so every close is shorter than its open and no close bounces. */
|
|
115
|
+
:root {
|
|
116
|
+
--duration-stagger: 40ms;
|
|
117
|
+
--duration-micro: 80ms;
|
|
118
|
+
--duration-quick: 150ms; /* every close, text swap, tooltip in */
|
|
119
|
+
--duration-fast: 250ms; /* every open, tabs, icon swap, page slide */
|
|
120
|
+
--duration-medium: 350ms; /* panel close, toast close */
|
|
121
|
+
--duration-slow: 400ms; /* panel open, skeleton reveal */
|
|
122
|
+
--duration-very-slow: 500ms; /* emphasis: badge, text reveal, success check */
|
|
123
|
+
|
|
124
|
+
--ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1); /* all surface motion */
|
|
125
|
+
--ease-in-out: ease-in-out; /* swaps and cross-fades */
|
|
126
|
+
--ease-out: ease-out; /* tooltips */
|
|
127
|
+
--ease-linear: linear; /* shimmer, pulse, spinner */
|
|
128
|
+
|
|
129
|
+
--distance-micro: 4px;
|
|
130
|
+
--distance-small: 6px;
|
|
131
|
+
--distance-base: 8px;
|
|
132
|
+
--distance-medium: 12px;
|
|
133
|
+
--distance-large: 30px;
|
|
134
|
+
|
|
135
|
+
--scale-large: 0.96; /* modal */
|
|
136
|
+
--scale-medium: 0.97; /* dropdown, popover open */
|
|
137
|
+
--scale-small: 0.98; /* tooltip */
|
|
138
|
+
--scale-tiny: 0.99; /* dropdown close */
|
|
139
|
+
|
|
140
|
+
--blur-small: 2px;
|
|
141
|
+
--blur-medium: 3px;
|
|
142
|
+
--blur-large: 8px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Tailwind utility aliases, so `shadow-card`, `duration-fast` and
|
|
146
|
+
`ease-smooth-out` exist as classes and a component can stay in utilities
|
|
147
|
+
instead of dropping into a style block for one shadow. */
|
|
148
|
+
@theme inline {
|
|
149
|
+
--shadow-hairline: var(--elev-hairline);
|
|
150
|
+
--shadow-btn: var(--elev-btn);
|
|
151
|
+
--shadow-card: var(--elev-card);
|
|
152
|
+
--shadow-raised: var(--elev-raised);
|
|
153
|
+
--shadow-overlay: var(--elev-overlay);
|
|
154
|
+
--shadow-field: var(--elev-field);
|
|
155
|
+
--shadow-rim: var(--elev-rim);
|
|
156
|
+
/* A filled control: the lit top edge and the resting lift, in one class,
|
|
157
|
+
because the two never appear apart and utilities cannot be stacked. */
|
|
158
|
+
--shadow-key: var(--elev-rim), var(--elev-btn);
|
|
159
|
+
/* The composed pair, for a surface that draws no border of its own. */
|
|
160
|
+
--shadow-edge-card: var(--elev-hairline), var(--elev-card);
|
|
161
|
+
--shadow-edge-raised: var(--elev-hairline), var(--elev-raised);
|
|
162
|
+
--shadow-edge-overlay: var(--elev-hairline), var(--elev-overlay);
|
|
163
|
+
|
|
164
|
+
--ease-smooth-out: var(--ease-smooth-out);
|
|
165
|
+
|
|
166
|
+
/* WHY the durations are re-declared under a second name: Tailwind's
|
|
167
|
+
`duration-*` utility reads `--transition-duration-*`, not `--duration-*`, so
|
|
168
|
+
the six names above generated no class at all. `duration-fast` therefore
|
|
169
|
+
compiled to nothing and the element ended up at `transition-duration: 0s`:
|
|
170
|
+
no error, no warning, and a component that simply does not animate. The
|
|
171
|
+
comment at the top of this block had claimed `duration-fast` was a class
|
|
172
|
+
since the block was written. Found 31 Aug 2026 by probing a live page. */
|
|
173
|
+
--transition-duration-micro: var(--duration-micro);
|
|
174
|
+
--transition-duration-quick: var(--duration-quick);
|
|
175
|
+
--transition-duration-fast: var(--duration-fast);
|
|
176
|
+
--transition-duration-medium: var(--duration-medium);
|
|
177
|
+
--transition-duration-slow: var(--duration-slow);
|
|
178
|
+
--transition-duration-very-slow: var(--duration-very-slow);
|
|
179
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* tokens.css
|
|
2
|
+
*
|
|
3
|
+
* The shared style layer for @heyramzi/ui, imported once after Tailwind:
|
|
4
|
+
*
|
|
5
|
+
* @import "tailwindcss";
|
|
6
|
+
* @import "@heyramzi/ui/tokens.css";
|
|
7
|
+
* @import "@heyramzi/ui/animations";
|
|
8
|
+
* @import "@heyramzi/ui/shadcn/utilities.css"; // only if you use Attachment or Message
|
|
9
|
+
*
|
|
10
|
+
* It carries three things: the color palette and semantic tokens, the craft
|
|
11
|
+
* layer (radius, elevation, focus and motion), and the small set of motion
|
|
12
|
+
* primitives the components share. Override any variable on :root to retheme.
|
|
13
|
+
* The parts load in this order because later blocks read earlier variables.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
@import "./palette.css";
|
|
17
|
+
@import "./base.css";
|
|
18
|
+
@import "./craft.css";
|
|
19
|
+
@import "./primitives.css";
|