@bevelo/styles 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +243 -2
- package/package.json +24 -3
- package/src/base.css +5433 -0
- package/src/index.css +6 -0
- package/src/tokens.css +319 -0
package/src/index.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* @bevelo/styles — the entry point is the tokens and nothing else.
|
|
2
|
+
|
|
3
|
+
The kit ships no component look: a component puts its state in attributes and
|
|
4
|
+
the host's stylesheet is what reads them. ./base.css stays as a subpath for a host that wants the neutral
|
|
5
|
+
look written against those attributes without writing it first. */
|
|
6
|
+
@import "./tokens.css";
|
package/src/tokens.css
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/* @bevelo/styles — design tokens.
|
|
2
|
+
|
|
3
|
+
Every visual decision a component could make lives here as a CSS custom
|
|
4
|
+
property, so a host themes the kit by setting variables instead of fighting
|
|
5
|
+
selectors. base.css never writes a colour or a size of its own: it reads these
|
|
6
|
+
names, so a host that overrides one token changes every component that used
|
|
7
|
+
it, in every state.
|
|
8
|
+
|
|
9
|
+
The design language: a warm near-black paper, light-dark pairs, a four-step
|
|
10
|
+
shadow scale with line rings, four radii, three control sizes and a 20px
|
|
11
|
+
leading.
|
|
12
|
+
|
|
13
|
+
@stable — token names follow semver; values may be tuned in a minor release.
|
|
14
|
+
|
|
15
|
+
The tokens come in seven groups:
|
|
16
|
+
- colour: semantic roles, never raw palette values in base.css
|
|
17
|
+
- shadow: the four-step scale (drop, drop-pressed, float, 2, 3)
|
|
18
|
+
- geometry: spacing, radii, border width and stacking
|
|
19
|
+
- size: control heights and the icon box
|
|
20
|
+
- type: families, a fixed type scale, leading and weights
|
|
21
|
+
- motion: one duration and two easings
|
|
22
|
+
|
|
23
|
+
Dark mode has two triggers and both only change color-scheme: every colour is
|
|
24
|
+
one light-dark() pair, so the operating-system preference
|
|
25
|
+
(prefers-color-scheme) applies while no theme is forced, and an explicit
|
|
26
|
+
data-theme attribute on any ancestor (normally <html>) forces a theme.
|
|
27
|
+
[data-theme="light"] inside a dark subtree re-declares color-scheme: light,
|
|
28
|
+
which is what makes a per-section override possible: light-dark() resolves
|
|
29
|
+
against the element's own color-scheme. */
|
|
30
|
+
|
|
31
|
+
:root {
|
|
32
|
+
/* The browser's own widgets (scrollbars, native form controls, the canvas)
|
|
33
|
+
follow the theme. Without this a dark host still gets a white scrollbar and
|
|
34
|
+
a light <select> popup. */
|
|
35
|
+
color-scheme: light dark;
|
|
36
|
+
|
|
37
|
+
/* ---------------------------------------------------------------------
|
|
38
|
+
Colour
|
|
39
|
+
One light-dark() pair per role. ink is the text and the accent (the kit is
|
|
40
|
+
monochrome on purpose: accent, ink and the focus halo share one value);
|
|
41
|
+
paper is the page; surface-1..3 are the steps a control or panel lifts off
|
|
42
|
+
it; line is a control border, line-faint a divider and line-disabled the
|
|
43
|
+
border a disabled control keeps; tint is a subtle fill, muted is secondary
|
|
44
|
+
text, danger is the one red.
|
|
45
|
+
--------------------------------------------------------------------- */
|
|
46
|
+
--ui-color-ink: light-dark(#171717, #dedcd7);
|
|
47
|
+
--ui-color-paper: light-dark(#ffffff, #141413);
|
|
48
|
+
--ui-color-surface-1: light-dark(#ffffff, #1a1a19);
|
|
49
|
+
--ui-color-surface-2: light-dark(#ffffff, #212120);
|
|
50
|
+
--ui-color-surface-3: light-dark(#ffffff, #282827);
|
|
51
|
+
--ui-color-line: light-dark(#a2a2a0, #6f6e6b);
|
|
52
|
+
--ui-color-line-faint: light-dark(#e2e2e0, #3a3937);
|
|
53
|
+
--ui-color-line-disabled: light-dark(#a8a8a6, #5f5e5b);
|
|
54
|
+
--ui-color-tint: light-dark(#f4f4f3, #262625);
|
|
55
|
+
--ui-color-muted: light-dark(#6f6f6c, #9a9893);
|
|
56
|
+
--ui-color-accent: var(--ui-color-ink);
|
|
57
|
+
/* The focus ring, and any other glow around the accent. */
|
|
58
|
+
--ui-color-halo: color-mix(in oklab, var(--ui-color-accent) 22%, transparent);
|
|
59
|
+
--ui-color-backdrop: light-dark(rgb(23 23 23 / 40%), rgb(0 0 0 / 60%));
|
|
60
|
+
--ui-color-danger: light-dark(#d60020, #ec7a72);
|
|
61
|
+
--ui-color-success: light-dark(oklch(0.52 0.13 155), oklch(0.75 0.12 155));
|
|
62
|
+
--ui-color-warning: light-dark(oklch(0.66 0.14 75), oklch(0.82 0.13 80));
|
|
63
|
+
/* Text and glyphs drawn on top of --ui-color-accent, not the accent itself. */
|
|
64
|
+
--ui-color-accent-text: var(--ui-color-paper);
|
|
65
|
+
|
|
66
|
+
/* ---------------------------------------------------------------------
|
|
67
|
+
Shadow
|
|
68
|
+
A four-step scale, each step a light source plus a hairline ring rather
|
|
69
|
+
than a drawn border: drop for a control at rest, drop-pressed for the same
|
|
70
|
+
control held down, float for something that hovers above the page, 2 adds
|
|
71
|
+
the ring to float (a popup) and 3 is the dialog step (a deeper, wider
|
|
72
|
+
float). Light mixes a warm black into the shadow; dark uses pure black,
|
|
73
|
+
because a shadow mixed from the light ink turns into a glow.
|
|
74
|
+
--------------------------------------------------------------------- */
|
|
75
|
+
--ui-shadow-drop: 0 2px 3px -1px light-dark(rgb(23 23 23 / 16%), rgb(0 0 0 / 60%));
|
|
76
|
+
--ui-shadow-drop-pressed: 0 1px 1px -1px light-dark(rgb(23 23 23 / 16%), rgb(0 0 0 / 60%));
|
|
77
|
+
--ui-shadow-float: 0 2px 4px -1px light-dark(rgb(23 23 23 / 6%), rgb(0 0 0 / 24%)),
|
|
78
|
+
0 9px 22px -6px light-dark(rgb(23 23 23 / 16%), rgb(0 0 0 / 56%));
|
|
79
|
+
--ui-shadow-2: 0 0 0 1px var(--ui-color-line), 0 2px 4px -1px light-dark(rgb(23 23 23 / 6%), rgb(0 0 0 / 24%)),
|
|
80
|
+
0 9px 22px -6px light-dark(rgb(23 23 23 / 16%), rgb(0 0 0 / 56%));
|
|
81
|
+
--ui-shadow-3: 0 0 0 1px var(--ui-color-line), 0 4px 8px -2px light-dark(rgb(23 23 23 / 6%), rgb(0 0 0 / 24%)),
|
|
82
|
+
0 22px 46px -12px light-dark(rgb(23 23 23 / 26%), rgb(0 0 0 / 64%));
|
|
83
|
+
|
|
84
|
+
/* ---------------------------------------------------------------------
|
|
85
|
+
Geometry
|
|
86
|
+
A 4px-based spacing scale in rem (so browser zoom and a host's changed root
|
|
87
|
+
font size both scale the kit), four radii, one border width, stacking.
|
|
88
|
+
--------------------------------------------------------------------- */
|
|
89
|
+
--ui-space-1: 0.25rem;
|
|
90
|
+
--ui-space-2: 0.5rem;
|
|
91
|
+
--ui-space-3: 0.75rem;
|
|
92
|
+
--ui-space-4: 1rem;
|
|
93
|
+
--ui-space-5: 1.5rem;
|
|
94
|
+
--ui-space-6: 2rem;
|
|
95
|
+
--ui-space-7: 2.5rem;
|
|
96
|
+
--ui-space-8: 3rem;
|
|
97
|
+
|
|
98
|
+
--ui-radius-row: 7px;
|
|
99
|
+
--ui-radius-control: 8px;
|
|
100
|
+
--ui-radius-surface: 10px;
|
|
101
|
+
--ui-radius-popup: 12px;
|
|
102
|
+
--ui-radius-full: 9999px;
|
|
103
|
+
|
|
104
|
+
--ui-border-width: 1px;
|
|
105
|
+
|
|
106
|
+
/* Stacking. Layer is the portal root's own level, dropdown is an anchored
|
|
107
|
+
panel, overlay is a modal layer (dialog, drawer, command palette). */
|
|
108
|
+
--ui-z-layer: 1;
|
|
109
|
+
--ui-z-dropdown: 100;
|
|
110
|
+
--ui-z-overlay: 200;
|
|
111
|
+
|
|
112
|
+
/* ---------------------------------------------------------------------
|
|
113
|
+
Size
|
|
114
|
+
Control heights are the height a control is drawn at, not a font size:
|
|
115
|
+
small, default and large, plus the row an item occupies in a menu, list or
|
|
116
|
+
toolbar and the square an icon (a check mark, a glyph button) fits in.
|
|
117
|
+
--------------------------------------------------------------------- */
|
|
118
|
+
--ui-size-control-sm: 28px;
|
|
119
|
+
--ui-size-control-md: 34px;
|
|
120
|
+
--ui-size-control-lg: 38px;
|
|
121
|
+
--ui-size-item: 32px;
|
|
122
|
+
--ui-size-icon: 16px;
|
|
123
|
+
|
|
124
|
+
/* ---------------------------------------------------------------------
|
|
125
|
+
Type
|
|
126
|
+
A system stack keeps the kit free of web-font loading; the mono stack is
|
|
127
|
+
for kbd hints, timestamps and code. The scale is fixed in px so a control
|
|
128
|
+
and the text inside it keep their 20px leading, and the leading is a token
|
|
129
|
+
because control padding is computed from it.
|
|
130
|
+
--------------------------------------------------------------------- */
|
|
131
|
+
--ui-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
|
132
|
+
sans-serif;
|
|
133
|
+
--ui-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
|
|
134
|
+
"Liberation Mono", monospace;
|
|
135
|
+
|
|
136
|
+
--ui-text-xs: 12px;
|
|
137
|
+
--ui-text-sm: 13px;
|
|
138
|
+
--ui-text-md: 14px;
|
|
139
|
+
--ui-text-lg: 16px;
|
|
140
|
+
--ui-text-xl: 20px;
|
|
141
|
+
--ui-text-2xl: 24px;
|
|
142
|
+
|
|
143
|
+
--ui-leading: 20px;
|
|
144
|
+
--ui-line-tight: 1.2;
|
|
145
|
+
--ui-line-base: 1.5;
|
|
146
|
+
--ui-line-loose: 1.75;
|
|
147
|
+
|
|
148
|
+
--ui-weight-normal: 400;
|
|
149
|
+
--ui-weight-medium: 500;
|
|
150
|
+
--ui-weight-semibold: 600;
|
|
151
|
+
|
|
152
|
+
/* ---------------------------------------------------------------------
|
|
153
|
+
Motion
|
|
154
|
+
One duration for every state change a pointer causes and every panel that
|
|
155
|
+
appears; the two easings still separate "this responds to me" from "this
|
|
156
|
+
arrived". Reduced motion sets the duration itself to 0s, so the transitions
|
|
157
|
+
stay declared and every consumer (including base.css) inherits the switch.
|
|
158
|
+
|
|
159
|
+
The role curves and duration steps come from the easing guidance: pick a
|
|
160
|
+
curve by what the motion *does*, not by tuning each component. enter is
|
|
161
|
+
for things arriving, exit for things leaving, move for on-screen position
|
|
162
|
+
changes, emphasis for small click confirmations, pop for the small
|
|
163
|
+
overshoot, spring for settling after a drag or a release, and linear only
|
|
164
|
+
for motion that is genuinely constant-speed (spinners, marquees).
|
|
165
|
+
--------------------------------------------------------------------- */
|
|
166
|
+
--ui-duration: 0.15s;
|
|
167
|
+
--ui-ease-standard: cubic-bezier(0.2, 0, 0, 1);
|
|
168
|
+
--ui-ease-out: cubic-bezier(0, 0, 0.2, 1);
|
|
169
|
+
|
|
170
|
+
/* Role-based curves. */
|
|
171
|
+
--ui-ease-linear: linear;
|
|
172
|
+
--ui-ease-enter: cubic-bezier(0, 0, 0.58, 1);
|
|
173
|
+
--ui-ease-exit: cubic-bezier(0.42, 0, 1, 1);
|
|
174
|
+
--ui-ease-move: cubic-bezier(0.42, 0, 0.58, 1);
|
|
175
|
+
--ui-ease-emphasis: cubic-bezier(0.22, 1, 0.36, 1);
|
|
176
|
+
--ui-ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
177
|
+
/* Spring settle: a real linear() spring where supported, the strong ease-out
|
|
178
|
+
as the fallback for engines without it. */
|
|
179
|
+
--ui-ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
|
|
180
|
+
|
|
181
|
+
/* Role durations: quick is an exit or a small state change, fast a small
|
|
182
|
+
entrance and base the medium default (both follow --ui-duration), slow a
|
|
183
|
+
large or full-surface move and spring the ~1.5x a springy settle asks for. */
|
|
184
|
+
--ui-duration-quick: 0.12s;
|
|
185
|
+
--ui-duration-fast: var(--ui-duration);
|
|
186
|
+
--ui-duration-base: var(--ui-duration);
|
|
187
|
+
--ui-duration-slow: 0.45s;
|
|
188
|
+
--ui-duration-spring: 0.45s;
|
|
189
|
+
|
|
190
|
+
/* Press feedback splits by property so the eye reads a key going down: the
|
|
191
|
+
surface moves first, the material shading catches up, the ink settles
|
|
192
|
+
last. The filled button variants below use exactly these three. */
|
|
193
|
+
--ui-duration-press-move: 0.12s;
|
|
194
|
+
--ui-duration-press-shade: 0.14s;
|
|
195
|
+
--ui-duration-press-ink: 0.16s;
|
|
196
|
+
|
|
197
|
+
/* ---------------------------------------------------------------------
|
|
198
|
+
Liquid glass (opt-in surface material for panels over imagery).
|
|
199
|
+
A surface opts in by reading these; nothing applies them by default.
|
|
200
|
+
tint is the translucent colour the glass paints, filter the backdrop
|
|
201
|
+
treatment (blur, saturation lift and the brightness that keeps it from
|
|
202
|
+
going milky), edge the rim light and inset shade, and ink the text colour
|
|
203
|
+
drawn on the glass with its blend mode. Density scales tint between the
|
|
204
|
+
thin and dense stops: busier backgrounds read denser.
|
|
205
|
+
--------------------------------------------------------------------- */
|
|
206
|
+
--ui-glass-tint: light-dark(rgb(255 255 255 / 14%), rgb(20 20 24 / 27%));
|
|
207
|
+
--ui-glass-tint-dense: light-dark(rgb(255 255 255 / 22%), rgb(20 20 24 / 38%));
|
|
208
|
+
--ui-glass-filter: light-dark(blur(2px) saturate(180%) brightness(1.06), blur(2px) saturate(160%) brightness(0.8));
|
|
209
|
+
--ui-glass-edge:
|
|
210
|
+
inset 1.5px 1.5px 1px -1px light-dark(rgb(255 255 255 / 95%), rgb(255 255 255 / 10%)),
|
|
211
|
+
inset -1.5px -1.5px 1px -1px light-dark(rgb(255 255 255 / 55%), rgb(255 255 255 / 6%)),
|
|
212
|
+
inset 0 0 0 0.5px light-dark(rgb(255 255 255 / 30%), rgb(255 255 255 / 8%)),
|
|
213
|
+
0 0 0 0.5px light-dark(rgb(0 0 0 / 6%), rgb(0 0 0 / 40%)),
|
|
214
|
+
0 6px 24px light-dark(rgb(0 0 0 / 8%), rgb(0 0 0 / 30%));
|
|
215
|
+
--ui-glass-ink: light-dark(rgb(23 23 23 / 86%), rgb(255 255 255 / 94%));
|
|
216
|
+
--ui-glass-ink-secondary: light-dark(rgb(60 60 67 / 70%), rgb(235 235 245 / 64%));
|
|
217
|
+
|
|
218
|
+
/* ---------------------------------------------------------------------
|
|
219
|
+
Tactile button material — the key faces behind data-variant on button
|
|
220
|
+
(primary / secondary / tertiary; ghost and text are flat). Neutral
|
|
221
|
+
grayscale only, light source fixed at the top, so the same inset layers
|
|
222
|
+
read as a raised key in both themes. Each filled variant is five layers:
|
|
223
|
+
face gradient, edge border, top-highlight and bottom-shade insets, and a
|
|
224
|
+
two-level drop shadow. Rest and pressed keep the same layer count — two
|
|
225
|
+
insets and two drops each — so the shadows animate instead of jumping.
|
|
226
|
+
--------------------------------------------------------------------- */
|
|
227
|
+
--ui-btn-primary-face: linear-gradient(
|
|
228
|
+
180deg,
|
|
229
|
+
light-dark(#404859, #333a4d),
|
|
230
|
+
light-dark(#273042, #1e2432)
|
|
231
|
+
);
|
|
232
|
+
--ui-btn-primary-face-pressed: linear-gradient(
|
|
233
|
+
180deg,
|
|
234
|
+
light-dark(#2e3750, #262e3f),
|
|
235
|
+
light-dark(#1a2130, #151a26)
|
|
236
|
+
);
|
|
237
|
+
--ui-btn-secondary-face: linear-gradient(
|
|
238
|
+
180deg,
|
|
239
|
+
light-dark(#ffffff, #2c2c2a),
|
|
240
|
+
light-dark(#f4f4f2, #232322)
|
|
241
|
+
);
|
|
242
|
+
--ui-btn-secondary-face-pressed: linear-gradient(
|
|
243
|
+
180deg,
|
|
244
|
+
light-dark(#ededeb, #282826),
|
|
245
|
+
light-dark(#dcdcd9, #1e1e1d)
|
|
246
|
+
);
|
|
247
|
+
--ui-btn-tertiary-face: linear-gradient(
|
|
248
|
+
180deg,
|
|
249
|
+
light-dark(#f4f4f2, #30302e),
|
|
250
|
+
light-dark(#e7e7e3, #282724)
|
|
251
|
+
);
|
|
252
|
+
--ui-btn-tertiary-face-pressed: linear-gradient(
|
|
253
|
+
180deg,
|
|
254
|
+
light-dark(#e3e3df, #2b2b29),
|
|
255
|
+
light-dark(#d3d3ce, #232220)
|
|
256
|
+
);
|
|
257
|
+
--ui-btn-primary-ink: light-dark(#ffffff, #f4f4f2);
|
|
258
|
+
--ui-btn-key-ink: light-dark(#1f1f1d, #ececea);
|
|
259
|
+
--ui-btn-primary-edge: light-dark(#2c3550, #454e66);
|
|
260
|
+
--ui-btn-key-edge: light-dark(#c6c6c1, #4c4c48);
|
|
261
|
+
--ui-btn-inset: inset 0 1px 0 light-dark(rgb(255 255 255 / 50%), rgb(255 255 255 / 6%)),
|
|
262
|
+
inset 0 -1px 0 light-dark(rgb(23 23 23 / 6%), rgb(0 0 0 / 24%));
|
|
263
|
+
--ui-btn-inset-pressed: inset 0 2px 3px light-dark(rgb(23 23 23 / 12%), rgb(0 0 0 / 30%)),
|
|
264
|
+
inset 0 -1px 0 light-dark(rgb(255 255 255 / 35%), rgb(255 255 255 / 4%));
|
|
265
|
+
--ui-btn-drop: 0 1px 1px light-dark(rgb(23 23 23 / 8%), rgb(0 0 0 / 30%)),
|
|
266
|
+
0 6px 14px -4px light-dark(rgb(23 23 23 / 14%), rgb(0 0 0 / 45%));
|
|
267
|
+
--ui-btn-drop-pressed: 0 1px 1px light-dark(rgb(23 23 23 / 6%), rgb(0 0 0 / 26%)),
|
|
268
|
+
0 2px 5px -2px light-dark(rgb(23 23 23 / 8%), rgb(0 0 0 / 34%));
|
|
269
|
+
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Forced light, including inside a dark subtree. light-dark() resolves against
|
|
273
|
+
the element's own color-scheme, so re-declaring it is the whole theme. */
|
|
274
|
+
[data-theme="light"] {
|
|
275
|
+
color-scheme: light;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Forced dark: on <html> it covers the page, on a subtree it covers that
|
|
279
|
+
subtree. */
|
|
280
|
+
[data-theme="dark"] {
|
|
281
|
+
color-scheme: dark;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Reduced motion: the duration token itself goes to zero, so every transition
|
|
285
|
+
declared against it is already off before base.css gets a say. */
|
|
286
|
+
@media (prefers-reduced-motion: reduce) {
|
|
287
|
+
:root {
|
|
288
|
+
--ui-duration: 0s;
|
|
289
|
+
--ui-duration-quick: 0s;
|
|
290
|
+
--ui-duration-fast: 0s;
|
|
291
|
+
--ui-duration-base: 0s;
|
|
292
|
+
--ui-duration-slow: 0s;
|
|
293
|
+
--ui-duration-spring: 0s;
|
|
294
|
+
--ui-duration-press-move: 0s;
|
|
295
|
+
--ui-duration-press-shade: 0s;
|
|
296
|
+
--ui-duration-press-ink: 0s;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Engines with linear() easing get the real spring curve for --ui-ease-spring;
|
|
301
|
+
everywhere else it stays the strong ease-out fallback declared above. */
|
|
302
|
+
@supports (transition-timing-function: linear(0, 1)) {
|
|
303
|
+
:root {
|
|
304
|
+
--ui-ease-spring: linear(0, 0.32, 0.78, 1.04, 1.09, 1.06, 1.02, 1, 0.99, 0.99, 1);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/* Continuous corners: where corner-shape is supported, every surface gets the
|
|
309
|
+
superellipse(1.25) curve — the same family as iOS — which rounds the corner
|
|
310
|
+
without the pinched look of a plain arc. border-radius is unchanged, so
|
|
311
|
+
engines without support render exactly what they did before. The nested
|
|
312
|
+
radius rule (inner radius = outer radius - padding, minimum 4px) is a
|
|
313
|
+
per-component contract; base.css applies the curve and leaves the radii
|
|
314
|
+
themselves to the tokens. */
|
|
315
|
+
@supports (corner-shape: superellipse(1.25)) {
|
|
316
|
+
:where(*) {
|
|
317
|
+
corner-shape: superellipse(1.25);
|
|
318
|
+
}
|
|
319
|
+
}
|