@hanzo/design 0.4.1 → 0.4.3

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/tokens/colors.css CHANGED
@@ -64,59 +64,82 @@
64
64
  --popover:#0f0f0f;
65
65
  --popover-foreground:#fafafa;
66
66
  --primary:#fafafa;
67
- --primary-hover:#d4d4d4;
67
+ /* A 5% step, not the 16% this used to be. A filled button's fill is already
68
+ the top of the ink ramp, so the only directions available on hover are
69
+ "dimmer" and "brighter-around-the-edges" — and a 16% drop reads as the
70
+ button going DISABLED under the cursor, which is the one thing a hover must
71
+ never look like. The step is now small enough to register as pressure while
72
+ --bloom does the actual work of lighting it up. */
73
+ --primary-hover:#e5e5e5;
68
74
  --primary-foreground:#0a0a0a;
69
75
  --secondary:#262626;
76
+ /* One rung up, so a secondary button HAS a hover. It previously resolved to
77
+ --surface-3, which is --secondary — the same value it starts at. */
78
+ --secondary-hover:#333333;
70
79
  --secondary-foreground:#fafafa;
71
80
  --muted:#171717;
72
81
  --muted-foreground:#a3a3a3;
73
82
  --accent:#262626;
74
83
  --accent-foreground:#fafafa;
75
- --destructive:#666666;
84
+ /* Destructive is the ONE place the monochrome rule already yields, and it was
85
+ yielding in only half the system: a field that fails validation draws
86
+ --state-error (#ef4444, which DESIGN.md §2.4 lists as permitted precisely
87
+ for "destructive / blocking error"), while the button that performs the
88
+ destruction drew #666666 — a mid-grey that is indistinguishable from a
89
+ disabled control. "Delete everything" and "you cannot click this" must not
90
+ be the same colour. So the two converge on the one token that already
91
+ names this meaning, and the ramp stays monochrome everywhere else. */
92
+ --destructive:var(--state-error);
93
+ --destructive-hover:#dc2626; /* red-600 — deepens under the cursor */
76
94
  --destructive-foreground:#fafafa;
77
95
 
78
96
  /* ——— boundaries ———
79
- THREE tiers, and the split is the whole point. The first two are DECORATIVE:
80
- they separate content, WCAG imposes no ratio on them, and they must stay
81
- quiet. The third is PERCEIVABLE: it is the edge that IS the affordance.
82
-
83
- --border the hairline. Every card, panel, divider, list row.
84
- --border-strong the SAME hairline, one step up. Hover, active, emphasis.
85
- --border-control a control's edge input, select, textarea, checkbox,
86
- switch. Must clear 3:1 on every surface in both themes
87
- (WCAG 1.4.11); check-tokens.mjs pins it.
88
-
89
- Before this split there were only two rungs and they were an octave apart:
90
- --border at #1f1f1f (1.27:1, invisible on anything lifted) and
91
- --border-strong at --neutral-500 (4.43:1). Nothing sat between, so every
92
- surface that wanted a border it could actually SEE reached for the control
93
- rung and a 1px mid-grey box around a card on near-black is a wireframe.
94
- That is the "garish outlines" complaint, and it is fixed by having a middle.
95
-
96
- A boundary that is WCAG-perceivable on a near-black ground IS a mid-grey;
97
- that cannot be tuned away. So it is not tuned away it is NAMED, so it can
98
- only be spent where it is owed. "strong" is a degree word and will always be
99
- read as one; "control" is a duty.
100
-
101
- Which ladder a boundary is cut from follows from that, and is the whole
102
- rule: DECORATIVE edges come off the ALPHA ladder, because they owe quiet
103
- and they must composite over whatever surface they land on. CONTROL edges
104
- come off the NEUTRAL ladder, because they owe a contrast ratio, and a ratio
105
- you can only meet at a fixed value is not something to express as alpha.
106
- --border-focus is therefore one NEUTRAL rung above --border-control, not an
107
- alpha step: a focused field has to read brighter than a resting one, and
108
- the resting one already sits at the WCAG floor. */
97
+ ONE ladder, cut from alpha, graded by duty. Every rung is a rung of the
98
+ opacity ladder above, so every boundary composites correctly on the page,
99
+ on a card, and inside a popover and every rung is the reference's own
100
+ measured value, not a rounded ramp:
101
+
102
+ --border .10 the hairline. Cards, panels, dividers, list rows.
103
+ --border-strong .16 the same hairline, one step up. Hover, emphasis.
104
+ --border-control .15 a control's resting edge input, select, textarea.
105
+ --border-focus .22 that control, focused.
106
+ --border-selected .30 the thing that is currently CHOSEN — the active
107
+ tab, the current tile, the featured plan.
108
+
109
+ The previous release cut the last three from the NEUTRAL ladder instead,
110
+ because a boundary that clears WCAG 1.4.11's 3:1 on a near-black ground IS
111
+ a mid-grey and no amount of tuning changes that. It is true, and it is also
112
+ what a wireframe looks like: a 1px #737373 box around every field, four
113
+ times heavier than the hairline beside it, so a form read as a debug
114
+ overlay rather than a surface. Aesthetics decided it the reference draws
115
+ an input at rgb(255 255 255 / .15) and a focused one at .22 (sidebar.css
116
+ --input-border / .composer-box:focus-within), and that is what ships here.
117
+
118
+ What replaces the ratio is the FOCUS INDICATOR, which is the thing a
119
+ keyboard user actually navigates by and the one boundary still pinned at
120
+ 3:1 (--ring, below). A resting edge is an affordance; a focus ring is a
121
+ position. Only the second one is load-bearing when you cannot see well, and
122
+ spending the contrast budget there rather than on all four edges of every
123
+ idle field is what lets the system be quiet AND findable at once. */
109
124
  --border:var(--white-10);
110
125
  --border-strong:var(--white-16);
111
- --border-control:var(--neutral-500); /* 4.43:1 worst case — see --ring */
112
- --border-focus:var(--neutral-400); /* one rung up: the field is focused */
113
- --input:var(--border-control); /* shadcn `border-input` a control */
126
+ --border-control:var(--white-15); /* sidebar.css --input-border */
127
+ --border-focus:var(--white-22); /* .composer-box:focus-within */
128
+ --border-selected:var(--white-30); /* the current tab / tile / plan */
129
+ --input:var(--border-control); /* shadcn `border-input` — a control */
114
130
  /* A focus indicator is a NON-TEXT CONTRAST target: WCAG 2.4.11/1.4.11 require
115
- 3:1 against every surface it can land on. --neutral-500 is the only rung on
116
- this ladder that clears 3:1 on all of them #0a0a0a, #0f0f0f, #171717,
117
- #262626, AND the light theme's #ffffff/#fafafa so one value serves both
118
- themes. (Was #333333 = 1.66:1 on --background: not a focus indicator.) */
119
- --ring:var(--neutral-500);
131
+ 3:1 against every surface it can land on, and unlike a resting edge it is
132
+ worth the loudness it is transient, it only appears on keyboard focus,
133
+ and it is the whole of how a keyboard user knows where they are.
134
+ --white-40 clears it on every canvas in both themes precisely BECAUSE it is
135
+ alpha: on a lifted surface the ring lifts with it (3.77:1 on #0a0a0a,
136
+ 3.66:1 on #262626), which a fixed grey cannot do. */
137
+ --ring:var(--white-40);
138
+ /* The soft halo that sits outside the ring — the reference's
139
+ `box-shadow: 0 0 0 2px rgb(255 255 255 / .06)` on a focused composer. It
140
+ carries no ratio; it is what makes focus read as designed rather than as a
141
+ browser default. Spent through --ring-focus (tokens/elevation.css). */
142
+ --ring-halo:var(--white-10);
120
143
  --brand:#e4e4e7;
121
144
  --brand-foreground:#09090b;
122
145
  --brand-muted:#a3a3a3;
@@ -131,12 +154,27 @@
131
154
  --glass:var(--white-05);
132
155
  --glass-strong:var(--white-08);
133
156
 
134
- /* ——— surface recipes (card fills used across hanzo.ai) ——— */
157
+ /* ——— surface recipes ———
158
+ A card has to be a SURFACE, which means you have to be able to see that it
159
+ is not the page. These were cut from neutral-900 (#171717) at .4/.5/.8, and
160
+ at .5 that composites to #101010 on a #0a0a0a ground — six levels above the
161
+ page, which is not a surface, it is a very slightly different black. Three
162
+ cards side by side then read as one flat field with hairlines ruled across
163
+ it, and no amount of shadow fixes it, because you cannot cast a shadow onto
164
+ black.
165
+
166
+ Cut from neutral-800 (#262626) instead, they land on 14 / 18 / 1f — the
167
+ reference's own panel (#171717 on a #0f0f0f container) with room either
168
+ side of it. They stay ALPHA so a card nested in a popover still lifts off
169
+ its parent rather than punching a hole in it; that is the whole reason
170
+ these are recipes and not just --surface-* rungs. */
135
171
  --surface-page:var(--background);
136
- --surface-card:rgb(23 23 23 / .5); /* bg-neutral-900/50 grid tiles */
137
- --surface-card-emphasis:rgb(23 23 23 / .8);/* bg-neutral-900/80 — featured */
138
- --surface-card-quiet:rgb(23 23 23 / .4); /* bg-neutral-900/40 — story cards */
139
- --surface-overlay:rgb(10 10 10 / .95); /* dropdown / popover panels */
172
+ --surface-card:rgb(38 38 38 / .5); /* -> #181818 on the page */
173
+ --surface-card-emphasis:rgb(38 38 38 / .75);/* -> #1f1f1f — featured */
174
+ --surface-card-quiet:rgb(38 38 38 / .35); /* -> #141414 — story cards */
175
+ /* A floating panel that is the SAME colour as the page is not floating. This
176
+ was rgb(10 10 10 / .95) — the page, at 95% of the page. */
177
+ --surface-overlay:rgb(23 23 23 / .92); /* dropdown / popover panels */
140
178
  --surface-header:rgb(0 0 0 / .7); /* fixed nav, with backdrop blur */
141
179
  --surface-scrim:rgb(0 0 0 / .8); /* the dialog / sheet backdrop */
142
180
 
@@ -188,22 +226,30 @@
188
226
  --primary-hover:#262626;
189
227
  --primary-foreground:#fafafa;
190
228
  --secondary:#ededed;
229
+ --secondary-hover:#e0e0e0;
191
230
  --secondary-foreground:#0a0a0a;
192
231
  --muted:#f5f5f5;
193
232
  --muted-foreground:#525252;
194
233
  --accent:#ededed;
195
234
  --accent-foreground:#0a0a0a;
196
- --destructive:#999999;
235
+ --destructive:var(--state-error);
236
+ --destructive-hover:#dc2626;
197
237
  --destructive-foreground:#ffffff;
198
238
  --border:rgb(0 0 0 / .10);
199
239
  --border-strong:rgb(0 0 0 / .16);
200
- --border-control:var(--neutral-500); /* 4.74:1 on #ffffff — conformant here too */
201
- --border-focus:var(--neutral-600); /* one rung DOWN darker reads as brighter here */
240
+ --border-control:rgb(0 0 0 / .15);
241
+ /* Focus and selection are pushed further here than the .22/.30 they sit at in
242
+ dark. Black-on-white at a given alpha reads FAINTER than white-on-black at
243
+ the same alpha — .22 black on #ffffff measures 1.69:1 where .22 white on
244
+ #0a0a0a measures 1.97:1 — so mirroring the number would quietly make the
245
+ light theme's focus state the weakest state in the system. */
246
+ --border-focus:rgb(0 0 0 / .32);
247
+ --border-selected:rgb(0 0 0 / .42);
202
248
  --input:var(--border-control);
203
- /* Same rung as dark: #d4d4d4 measured 1.48:1 on white and could not carry a
204
- focus indicator either. --neutral-500 is 4.74:1 on #ffffff / 4.38:1 on
205
- #f5f5f5, so ONE value is conformant in both themes. */
206
- --ring:var(--neutral-500);
249
+ /* Same duty, same 3:1 floor, opposite direction: .50 black is 3.98:1 on
250
+ #ffffff and 3.67:1 on #f5f5f5. */
251
+ --ring:rgb(0 0 0 / .5);
252
+ --ring-halo:rgb(0 0 0 / .07);
207
253
  --black:#0a0a0a;
208
254
  --white:#ffffff;
209
255
  --selection:rgb(0 0 0 / .16);
@@ -1,11 +1,46 @@
1
- /* Hanzo barely uses shadow: on black, elevation reads as a hairline border plus
2
- a wide, very dark drop. Only two levels ship (Tailwind's shadow-2xl for
3
- floating surfaces) plus the ambient radial glow used behind heroes. */
1
+ /* Elevation on a near-black ground is NOT a drop shadow. A dark blur on a dark
2
+ page is nothing you cannot cast a shadow onto black — which is why a system
3
+ that ships only `box-shadow` reads flat no matter how heavy the alphas get.
4
+
5
+ What actually lifts a surface here is LIGHT, and it arrives in three parts:
6
+
7
+ 1. a hairline EDGE (tokens/colors.css --border)
8
+ 2. an inset top HIGHLIGHT (--edge-highlight, below)
9
+ 3. a wide, very dark DROP (--shadow-*)
10
+
11
+ (2) is the one that was missing and the one that does most of the work: a 1px
12
+ inset white line along the top edge reads as the surface catching the light
13
+ from above, and it is the whole difference between a panel that sits ON the
14
+ page and a rectangle that is merely a different colour than the page. The
15
+ reference spends it on its login card (`inset 0 1px 0 rgb(255 255 255 / .05)`)
16
+ and it is the single cheapest premium signal available on dark UI.
17
+
18
+ They are separate tokens rather than one baked shadow because a component
19
+ composes the ones it needs — `box-shadow: var(--edge-highlight), var(--shadow-lg)`
20
+ — and a card that wants the highlight without the drop should not have to
21
+ accept both. */
4
22
  :root{
5
23
  --shadow-none:none;
6
- --shadow-floating:0 25px 50px -12px rgb(0 0 0 / .25); /* shadow-2xl: composer, dropdowns, mega panel */
24
+ /* The floating surface: dropdowns, dialogs, sheets, the composer. Wide, soft,
25
+ and pushed well down. It was Tailwind's `shadow-2xl` at .25 alpha, which is
26
+ invisible on #0a0a0a — so the surfaces that float highest had the weakest
27
+ drop in the system while the t-shirt ramp below was correctly tuned. */
28
+ --shadow-floating:0 24px 60px -16px rgb(0 0 0 / .75);
7
29
  --shadow-inset-hairline:inset 0 0 0 1px var(--white-10);
8
- --ring-focus:0 0 0 2px var(--ring);
30
+
31
+ /* ——— the light ——— */
32
+ /* The top edge, catching light. Add it to any raised surface. */
33
+ --edge-highlight:inset 0 1px 0 0 rgb(255 255 255 / .10);
34
+ /* The bloom around a LIT action on hover — a filled primary button, the send
35
+ key. Monochrome brand: this is where "alive" comes from instead of a hue,
36
+ and it is the whole hover signal on a fill that is already at the top of
37
+ the ink ramp. It was .10, which is invisible: a white glow has to compete
38
+ with the white object casting it, so the alpha that reads around a WHITE
39
+ button is far higher than the one that reads around a dark one. */
40
+ --bloom:0 0 24px -2px rgb(255 255 255 / .28);
41
+ /* The focus halo: soft, outside the ring, carrying no ratio of its own. This
42
+ was `0 0 0 2px var(--ring)` — a second hard ring around the hard ring. */
43
+ --ring-focus:0 0 0 3px var(--ring-halo);
9
44
 
10
45
  /* The t-shirt ramp. Named by size rather than by role, because that is how
11
46
  every component library already asks for a shadow (and how @hanzo/brand
@@ -23,9 +58,45 @@
23
58
  --glow-hero-blur:120px;
24
59
  /* Card top-corner sheen used on the story cards. */
25
60
  --sheen-card:radial-gradient(120% 120% at 80% 0%,rgb(255 255 255 / .08) 0%,transparent 55%); /* @kind color */
61
+ /* The panel's top hairline, brightest at the centre and dissolving before it
62
+ reaches either corner — so an edge never terminates in a hard stop. One of
63
+ the two details that make the reference's panels look machined rather than
64
+ drawn (sidebar.css .panel::before). Paint it on a 1px-tall ::before. */
65
+ --sheen-edge:linear-gradient(90deg,transparent,rgb(255 255 255 / .14) 50%,transparent); /* @kind color */
26
66
  /* Chrome text: the canonical headline gradient. Never a saturated rainbow. */
27
67
  --gradient-chrome:linear-gradient(to right,#ffffff,var(--white-80),var(--white-60));
28
68
  --gradient-chrome-2:linear-gradient(to right,#ffffff,var(--neutral-500));
29
69
  /* Section-top protection gradient (hero overlays). */
30
70
  --gradient-protect:linear-gradient(to bottom,var(--white-10),transparent);
31
71
  }
72
+
73
+ /* Light theme — the same three parts, redistributed.
74
+ On white the order of work inverts: the DROP does almost all of it and the
75
+ inset highlight does none, because a white line on a white card is nothing.
76
+ Every token below is one whose dark value is white — i.e. one that silently
77
+ stops existing in `.light` unless it is restated here. check-tokens.mjs
78
+ scans this file for exactly that omission.
79
+
80
+ --edge-highlight is `inset 0 0 0 0 transparent` rather than `none` on
81
+ purpose: components compose these — `box-shadow: var(--edge-highlight),
82
+ var(--shadow-lg)` — and `none` is not a legal layer in a comma list, so the
83
+ obvious spelling would invalidate the whole declaration and take the drop
84
+ shadow down with it. A zero-size transparent shadow composes to nothing and
85
+ costs nothing. */
86
+ .light{
87
+ --shadow-floating:0 24px 60px -16px rgb(0 0 0 / .18);
88
+ --shadow-inset-hairline:inset 0 0 0 1px rgb(0 0 0 / .10);
89
+ --edge-highlight:inset 0 0 0 0 transparent;
90
+ --bloom:0 6px 20px -4px rgb(0 0 0 / .18);
91
+ --shadow-sm:0 1px 2px 0 rgb(0 0 0 / .06);
92
+ --shadow:0 1px 3px 0 rgb(0 0 0 / .08), 0 1px 2px -1px rgb(0 0 0 / .06);
93
+ --shadow-md:0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .06);
94
+ --shadow-lg:0 10px 15px -3px rgb(0 0 0 / .09), 0 4px 6px -4px rgb(0 0 0 / .07);
95
+ --shadow-xl:0 20px 25px -5px rgb(0 0 0 / .10), 0 8px 10px -6px rgb(0 0 0 / .08);
96
+ --glow-hero:radial-gradient(circle,rgb(0 0 0 / .06) 0%,transparent 68%);
97
+ --sheen-card:radial-gradient(120% 120% at 80% 0%,rgb(0 0 0 / .04) 0%,transparent 55%);
98
+ --sheen-edge:linear-gradient(90deg,transparent,rgb(0 0 0 / .08) 50%,transparent);
99
+ --gradient-chrome:linear-gradient(to right,#0a0a0a,rgb(10 10 10 / .8),rgb(10 10 10 / .6));
100
+ --gradient-chrome-2:linear-gradient(to right,#0a0a0a,var(--neutral-500));
101
+ --gradient-protect:linear-gradient(to bottom,rgb(0 0 0 / .10),transparent);
102
+ }
package/tokens/motion.css CHANGED
@@ -6,8 +6,17 @@
6
6
  --duration-slow:400ms; /* @kind other */ /* hero element entry */
7
7
  --duration-slower:500ms; /* @kind other */ /* section entry */
8
8
  --duration-glow:9s; /* @kind other */ /* ambient radial breathe */
9
+ --duration-press:90ms; /* @kind other */ /* the press-down on :active */
9
10
  --ease-out:cubic-bezier(0,0,0.2,1); /* @kind other */
10
11
  --ease-in-out:cubic-bezier(0.4,0,0.2,1); /* @kind other */
12
+ /* The entrance curve. Nearly all of the distance is covered in the first
13
+ third and it settles without overshooting, so a panel arrives DECIDED
14
+ rather than drifting in — the difference between 300ms that feels
15
+ immediate and 300ms that feels slow. Use it for anything that appears
16
+ (menus, dialogs, sheets, toasts); --ease-out stays the curve for a state
17
+ change on something already on screen. It is not a spring: this system has
18
+ no bounce anywhere. */
19
+ --ease-emphasis:cubic-bezier(0.16,1,0.3,1); /* @kind other */
11
20
  --stagger:60ms; /* @kind other */ /* per-element delay in a group */
12
21
  --entry-rise:16px; /* hero y-offset */
13
22
  --entry-rise-lg:24px; /* card y-offset */
@@ -16,6 +25,12 @@
16
25
  @keyframes hanzo-fade-up{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
17
26
  @keyframes hanzo-fade-down{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}
18
27
  @keyframes hanzo-slide-up-fade{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
28
+ /* The entrance for anything that appears OVER the page — dialog, sheet, command
29
+ palette. It arrives from very slightly small and very slightly low, which is
30
+ what reads as "came forward" rather than "was toggled on". 3% and 8px: any
31
+ more and it is an animation you notice, which is the failure mode. Pair it
32
+ with --ease-emphasis. */
33
+ @keyframes hanzo-zoom-in{from{opacity:0;transform:scale(.97) translateY(8px)}to{opacity:1;transform:none}}
19
34
  @keyframes hanzo-glow{0%,100%{transform:scale(1);opacity:.45}50%{transform:scale(1.08);opacity:.65}}
20
35
  @keyframes hanzo-pulse-dot{0%,100%{opacity:1}50%{opacity:.35}}
21
36