@codenhub/styles 0.0.4 → 0.1.1
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 +201 -201
- package/NOTICE +27 -0
- package/README.md +22 -116
- package/dist/aesthetics/chunky-tile.css +1 -0
- package/dist/aesthetics/glass.css +1 -0
- package/dist/aesthetics/index.css +2 -0
- package/dist/aesthetics/neobrutalism.css +1 -0
- package/dist/aesthetics/pixel.css +1 -0
- package/dist/components.css +2 -2
- package/dist/index.css +2 -2
- package/dist/native.css +2 -0
- package/dist/theme.css +2 -2
- package/dist/tw/aesthetics/chunky-tile.css +109 -0
- package/dist/tw/aesthetics/glass.css +66 -0
- package/dist/tw/aesthetics/index.css +9 -0
- package/dist/tw/aesthetics/neobrutalism.css +63 -0
- package/dist/tw/aesthetics/pixel.css +88 -0
- package/dist/tw/box.css +206 -0
- package/dist/tw/components/button.css +108 -0
- package/dist/tw/components/feedback.css +163 -0
- package/dist/tw/components/form.css +599 -0
- package/dist/tw/components/index.css +28 -0
- package/dist/tw/components/loader.css +122 -0
- package/dist/tw/components/surface.css +122 -0
- package/dist/tw/components/tooltip.css +132 -0
- package/dist/tw/elevation.css +46 -0
- package/dist/tw/index.css +27 -0
- package/dist/tw/intent.css +209 -0
- package/dist/tw/native.css +187 -0
- package/dist/tw/presentation.css +77 -0
- package/dist/tw/reset.css +129 -0
- package/dist/tw/theme.css +223 -0
- package/dist/tw/typography.css +34 -0
- package/dist/tw/utilities/content.css +361 -0
- package/dist/tw/utilities/index.css +6 -0
- package/dist/tw/utilities/layout.css +107 -0
- package/docs/accessibility.md +92 -0
- package/docs/changelog/0.1.0.md +37 -0
- package/docs/changelog/0.1.1.md +10 -0
- package/docs/changelog/index.md +10 -0
- package/docs/concepts.md +68 -0
- package/docs/index.md +35 -0
- package/docs/integrating/astro.md +35 -0
- package/docs/integrating/index.md +41 -0
- package/docs/integrating/nextjs.md +67 -0
- package/docs/integrating/svelte.md +43 -0
- package/docs/integrating/tailwind.md +56 -0
- package/docs/integrating/vue.md +31 -0
- package/docs/setup.md +96 -0
- package/docs/usage/aesthetics.md +120 -0
- package/docs/usage/buttons.md +58 -0
- package/docs/usage/composing.md +143 -0
- package/docs/usage/content-and-layout.md +175 -0
- package/docs/usage/customizing.md +148 -0
- package/docs/usage/feedback.md +79 -0
- package/docs/usage/forms.md +135 -0
- package/docs/usage/index.md +24 -0
- package/docs/usage/theming.md +154 -0
- package/docs/usage/tooltips.md +39 -0
- package/llms-full.txt +1676 -0
- package/llms.txt +26 -0
- package/package.json +176 -33
- package/src/components/button.css +0 -155
- package/src/components/feedback.css +0 -214
- package/src/components/form.css +0 -303
- package/src/components/index.css +0 -9
- package/src/components/loader.css +0 -56
- package/src/components/surface.css +0 -6
- package/src/components/tooltip.css +0 -60
- package/src/index.css +0 -7
- package/src/overrides.css +0 -76
- package/src/theme.css +0 -234
- package/src/typography.css +0 -30
- package/src/utilities.css +0 -40
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
@import "./theme.css";
|
|
2
|
+
@reference "tailwindcss";
|
|
3
|
+
/* Everything that is not `src/` -- see the note in `index.css`. Without the
|
|
4
|
+
docs and root-file excludes a utility used only in a documentation example
|
|
5
|
+
compiles into `dist/native.css`. */
|
|
6
|
+
@import "./typography.css";
|
|
7
|
+
@import "./utilities/index.css";
|
|
8
|
+
@import "./components/index.css";
|
|
9
|
+
@import "./reset.css";
|
|
10
|
+
|
|
11
|
+
/* `intent.css`'s reset keys on class names; these bare elements need the same,
|
|
12
|
+
or a `color-mix()` reading an undefined `--intent-*` drops silently. Zero
|
|
13
|
+
specificity like the class reset, values matching it slot for slot -- a bare
|
|
14
|
+
`<code>` and a `.code` chip are one component reached two ways. */
|
|
15
|
+
:where(table, kbd, code, pre, blockquote, hr, input, textarea, select, button) {
|
|
16
|
+
--intent-color: var(--color-text);
|
|
17
|
+
--intent-contrast: var(--color-text-contrast);
|
|
18
|
+
--intent-hover: var(--color-text-hover);
|
|
19
|
+
--intent-strong: var(--color-text-strong);
|
|
20
|
+
--intent-subtle: var(--color-surface);
|
|
21
|
+
--intent-border: var(--ui-ink, var(--color-border));
|
|
22
|
+
--intent-fill-max: 20%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Native text controls need the same stronger neutral boundary as their classed
|
|
26
|
+
counterparts, without changing buttons, checkboxes, radios, or other inputs. */
|
|
27
|
+
:where(
|
|
28
|
+
input:not([type]),
|
|
29
|
+
input[type="text"],
|
|
30
|
+
input[type="number"],
|
|
31
|
+
input[type="email"],
|
|
32
|
+
input[type="password"],
|
|
33
|
+
input[type="url"],
|
|
34
|
+
input[type="tel"],
|
|
35
|
+
input[type="search"],
|
|
36
|
+
input[type="month"],
|
|
37
|
+
input[type="week"],
|
|
38
|
+
input[type="time"],
|
|
39
|
+
input[type="date"],
|
|
40
|
+
input[type="datetime-local"],
|
|
41
|
+
textarea,
|
|
42
|
+
select
|
|
43
|
+
) {
|
|
44
|
+
--intent-border: var(--ui-ink, var(--color-control-border));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:where(hr) {
|
|
48
|
+
--intent-color: currentColor;
|
|
49
|
+
--intent-border: currentColor;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@layer base {
|
|
53
|
+
/* The `h1`-`ol` margin reset lives in `reset.css`, imported above. */
|
|
54
|
+
|
|
55
|
+
/* Headings */
|
|
56
|
+
h1 {
|
|
57
|
+
@apply text-title-lg;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
h2 {
|
|
61
|
+
@apply text-title;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
h3 {
|
|
65
|
+
@apply text-title-sm;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
h4 {
|
|
69
|
+
@apply text-label-lg;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
h5,
|
|
73
|
+
h6 {
|
|
74
|
+
@apply text-label;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
p,
|
|
78
|
+
li,
|
|
79
|
+
a {
|
|
80
|
+
@apply text-body;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Content */
|
|
84
|
+
table {
|
|
85
|
+
@apply data-table;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
kbd {
|
|
89
|
+
@apply kbd;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
blockquote {
|
|
93
|
+
@apply quote;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
q {
|
|
97
|
+
@apply quote-inline;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
code {
|
|
101
|
+
@apply code;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
pre {
|
|
105
|
+
@apply pre;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
pre code {
|
|
109
|
+
@apply bg-transparent p-0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
hr {
|
|
113
|
+
@apply divider;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Form controls. Every text-like type maps onto `.ipt` for the shared chrome
|
|
117
|
+
and nothing else -- an icon is a wrapper composition (`.input-group`), not a
|
|
118
|
+
property of the type, so no type paints one. */
|
|
119
|
+
input:not([type]),
|
|
120
|
+
input[type="text"],
|
|
121
|
+
input[type="number"],
|
|
122
|
+
input[type="email"],
|
|
123
|
+
input[type="password"],
|
|
124
|
+
input[type="url"],
|
|
125
|
+
input[type="tel"],
|
|
126
|
+
input[type="search"],
|
|
127
|
+
input[type="month"],
|
|
128
|
+
input[type="week"],
|
|
129
|
+
input[type="time"],
|
|
130
|
+
input[type="date"],
|
|
131
|
+
input[type="datetime-local"] {
|
|
132
|
+
@apply ipt;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
textarea {
|
|
136
|
+
@apply textarea;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
select {
|
|
140
|
+
@apply select;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
input[type="checkbox"] {
|
|
144
|
+
@apply checkbox;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
input[type="radio"] {
|
|
148
|
+
@apply radio;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Buttons */
|
|
152
|
+
button,
|
|
153
|
+
input[type="button"],
|
|
154
|
+
input[type="submit"],
|
|
155
|
+
input[type="reset"] {
|
|
156
|
+
@apply btn;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@media (forced-colors: active) {
|
|
161
|
+
input[type="checkbox"],
|
|
162
|
+
input[type="radio"] {
|
|
163
|
+
/* Keep these explicit system colors from being forced back to transparent. */
|
|
164
|
+
forced-color-adjust: none;
|
|
165
|
+
background-color: Canvas;
|
|
166
|
+
border-color: CanvasText;
|
|
167
|
+
transition: none;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
input[type="checkbox"]:checked {
|
|
171
|
+
background-color: Highlight;
|
|
172
|
+
border-color: Highlight;
|
|
173
|
+
|
|
174
|
+
&::after {
|
|
175
|
+
background-color: HighlightText;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
input[type="radio"]:checked {
|
|
180
|
+
background-color: Canvas;
|
|
181
|
+
border-color: Highlight;
|
|
182
|
+
|
|
183
|
+
&::after {
|
|
184
|
+
background-color: Highlight;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* Presentation answers two independent questions, and each is its own closed
|
|
2
|
+
set: how much of the intent color fills the box, and whether the box draws a
|
|
3
|
+
line at its boundary. Exactly one value from each set applies, so the six
|
|
4
|
+
combinations are the whole vocabulary.
|
|
5
|
+
|
|
6
|
+
A fill class never decides an edge and an edge class never decides a fill.
|
|
7
|
+
`.solid` briefly broke that rule, writing `--ui-border: 0%` alongside its fill
|
|
8
|
+
so that a filled box could not be ringed in another colour. It bought a real
|
|
9
|
+
fix -- the edge blend runs the line toward the fill, which lands *on* the fill
|
|
10
|
+
when the fill is opaque and on a second coat of the same tint when it is not,
|
|
11
|
+
so every capped intent that drew a line drew a visible ring over its own plate
|
|
12
|
+
-- at the cost of the one property that makes the six combinations readable:
|
|
13
|
+
that each half means only what it says. Two axes that are independent in two
|
|
14
|
+
cases out of three are not axes.
|
|
15
|
+
|
|
16
|
+
The ring is a fault in the blend rather than in the class, and it is recorded
|
|
17
|
+
as such: `.solid.edged` on a capped intent measures 1.53:1 against its own
|
|
18
|
+
plate in light and 1.82:1 in dark. `.solid.edgeless` is how a consumer asks
|
|
19
|
+
for a filled box with no line.
|
|
20
|
+
|
|
21
|
+
Presentation declares only unitless numbers and percentages. A custom
|
|
22
|
+
property's value is resolved on the element that declares it, so anything
|
|
23
|
+
referencing an intent token here would resolve against the container's intent
|
|
24
|
+
and inherit down already-resolved. Numbers carry no intent, so they inherit
|
|
25
|
+
safely and each component mixes them against its own palette.
|
|
26
|
+
|
|
27
|
+
A declaration on the element beats an inherited one, which is what lets a
|
|
28
|
+
container set the look for its subtree while any element still opts out.
|
|
29
|
+
|
|
30
|
+
Hover is derived from these values rather than declared beside them:
|
|
31
|
+
`min(100%, resting fill + --hover-step)`, always in `--intent-hover`. There is
|
|
32
|
+
no hover token and no per-presentation branch. */
|
|
33
|
+
|
|
34
|
+
/* Filled with the intent color. Text is the contrast tone. */
|
|
35
|
+
.solid {
|
|
36
|
+
--ui-fill: 100%;
|
|
37
|
+
--ui-fg-on-fill: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Tinted with the intent color. Text is the intent color. */
|
|
41
|
+
.soft {
|
|
42
|
+
--ui-fill: 12%;
|
|
43
|
+
--ui-fg-on-fill: 0%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* No fill at rest; the derived hover gives it one. Text is the intent color.
|
|
47
|
+
|
|
48
|
+
Named `.ghost` rather than `.bare` because `.bare` and `.edgeless` both read
|
|
49
|
+
as "less of something", so an author wanting no border reached for `.bare`
|
|
50
|
+
first and got no background instead. `.ghost` says fill and only fill.
|
|
51
|
+
|
|
52
|
+
A component that rests on a ground rather than on nothing keeps that ground
|
|
53
|
+
here: `.ghost` is zero fill, not zero paint. `.data-table` is the exception
|
|
54
|
+
that proves it -- its head plate *is* the tint, so a ghost table drops it. */
|
|
55
|
+
.ghost {
|
|
56
|
+
--ui-fill: 0%;
|
|
57
|
+
--ui-fg-on-fill: 0%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* A line in the intent color, at the aesthetic's material width. The width comes
|
|
61
|
+
from the aesthetic and nothing else: there is no presentation scale on it, so
|
|
62
|
+
small components need no ceilings to survive a thick one.
|
|
63
|
+
|
|
64
|
+
The edge is the silhouette and nothing else. Rules *inside* a component that
|
|
65
|
+
has an inside are a separate decision with its own class -- `.data-table.ruled`
|
|
66
|
+
-- because tying them here made them arrive by implication: a table drew rules
|
|
67
|
+
only because its published edge default happened to be `edged`, so whether a
|
|
68
|
+
consumer got them depended on a default they had not read and could not name.
|
|
69
|
+
Two questions, two switches. */
|
|
70
|
+
.edged {
|
|
71
|
+
--ui-border: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* No line. */
|
|
75
|
+
.edgeless {
|
|
76
|
+
--ui-border: 0%;
|
|
77
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
@reference "tailwindcss";
|
|
2
|
+
@import "./theme.css";
|
|
3
|
+
@import "./typography.css";
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
/* The package's own components no longer lean on this: `@utility box` sets
|
|
7
|
+
`box-sizing: border-box` on itself, so a sized control is right in every
|
|
8
|
+
entrypoint including the reset-less `/components` and granular `/tw/*`
|
|
9
|
+
ones. What is left for the universal rule is the consumer's own markup --
|
|
10
|
+
a plain `<div>` laid out beside our components under the full reset -- so
|
|
11
|
+
it stays part of the opinionated baseline the reset already is, rather
|
|
12
|
+
than a correctness prop the components need. */
|
|
13
|
+
*,
|
|
14
|
+
*::before,
|
|
15
|
+
*::after {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
* {
|
|
20
|
+
scrollbar-width: thin;
|
|
21
|
+
scrollbar-color: var(--color-primary) var(--color-background);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
::-webkit-scrollbar {
|
|
25
|
+
width: calc(var(--spacing) * 4);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
::-webkit-scrollbar-thumb {
|
|
29
|
+
background: var(--color-primary);
|
|
30
|
+
border: var(--spacing) solid var(--color-background);
|
|
31
|
+
border-radius: calc(var(--spacing) * 2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
html,
|
|
35
|
+
body {
|
|
36
|
+
@apply bg-background text-text font-default;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
h1,
|
|
40
|
+
h2,
|
|
41
|
+
h3,
|
|
42
|
+
h4,
|
|
43
|
+
h5,
|
|
44
|
+
h6,
|
|
45
|
+
p,
|
|
46
|
+
figure,
|
|
47
|
+
blockquote,
|
|
48
|
+
dl,
|
|
49
|
+
dd,
|
|
50
|
+
ul,
|
|
51
|
+
ol {
|
|
52
|
+
margin: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
button,
|
|
56
|
+
input,
|
|
57
|
+
optgroup,
|
|
58
|
+
select,
|
|
59
|
+
textarea {
|
|
60
|
+
font-family: inherit;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
button,
|
|
64
|
+
input[type="button"],
|
|
65
|
+
input[type="submit"],
|
|
66
|
+
input[type="reset"] {
|
|
67
|
+
@apply enabled:cursor-pointer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
::selection {
|
|
71
|
+
background: var(--color-primary);
|
|
72
|
+
color: var(--color-primary-contrast);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:focus-visible {
|
|
76
|
+
outline: var(--focus-ring-width) solid var(--focus-ring);
|
|
77
|
+
outline-offset: var(--focus-ring-offset);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@media (forced-colors: active) {
|
|
81
|
+
input:is(
|
|
82
|
+
[type="text"],
|
|
83
|
+
[type="email"],
|
|
84
|
+
[type="password"],
|
|
85
|
+
[type="url"],
|
|
86
|
+
[type="tel"],
|
|
87
|
+
[type="number"],
|
|
88
|
+
[type="search"],
|
|
89
|
+
[type="date"],
|
|
90
|
+
[type="datetime-local"],
|
|
91
|
+
[type="month"],
|
|
92
|
+
[type="week"],
|
|
93
|
+
[type="time"],
|
|
94
|
+
[type="checkbox"],
|
|
95
|
+
[type="radio"]
|
|
96
|
+
):focus-visible,
|
|
97
|
+
textarea:focus-visible,
|
|
98
|
+
select:focus-visible {
|
|
99
|
+
outline: 2px solid Highlight !important;
|
|
100
|
+
outline-offset: 2px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (prefers-reduced-motion: reduce) {
|
|
105
|
+
*,
|
|
106
|
+
*::before,
|
|
107
|
+
*::after {
|
|
108
|
+
animation-duration: 0.01ms !important;
|
|
109
|
+
animation-iteration-count: 1 !important;
|
|
110
|
+
scroll-behavior: auto !important;
|
|
111
|
+
transition-duration: 0.01ms !important;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Unlayered on purpose, matching the `forced-colors` blocks in `native.css` and
|
|
117
|
+
`form.css`. An accessibility override has to win over any layered rule
|
|
118
|
+
whatever the specificity, and a `@layer components` wrapper here would let the
|
|
119
|
+
component utilities that draw a border overrule it. */
|
|
120
|
+
@media (forced-colors: active) {
|
|
121
|
+
.btn,
|
|
122
|
+
.ipt,
|
|
123
|
+
.textarea,
|
|
124
|
+
.select,
|
|
125
|
+
.alert,
|
|
126
|
+
.badge {
|
|
127
|
+
border-color: CanvasText;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
@import "tailwindcss/theme.css";
|
|
2
|
+
@import "./intent.css";
|
|
3
|
+
@import "./presentation.css";
|
|
4
|
+
@import "./elevation.css";
|
|
5
|
+
/* Everything that is not `src/` -- see the note in `index.css`. Keeps a
|
|
6
|
+
`--color-*` reference in a docs example from shipping as a real theme entry. */
|
|
7
|
+
|
|
8
|
+
/* Color tokens are declared once with `light-dark()`, which resolves at the
|
|
9
|
+
point of use against the consuming element's computed `color-scheme`. Theme
|
|
10
|
+
selectors below therefore set `color-scheme` and nothing else. Verified
|
|
11
|
+
across Chromium, Firefox, and WebKit, including resolution through
|
|
12
|
+
`color-mix()` and through Tailwind's `@theme`, which emits theme values as
|
|
13
|
+
unregistered custom properties rather than `@property` registrations. */
|
|
14
|
+
@theme {
|
|
15
|
+
--font-default: "Segoe UI", system-ui, sans-serif;
|
|
16
|
+
|
|
17
|
+
--color-primary: light-dark(var(--color-neutral-950), var(--color-neutral-50));
|
|
18
|
+
--color-primary-contrast: light-dark(var(--color-neutral-50), var(--color-neutral-950));
|
|
19
|
+
--color-primary-hover: light-dark(var(--color-neutral-700), var(--color-neutral-200));
|
|
20
|
+
--color-primary-subtle: light-dark(var(--color-neutral-200), var(--color-neutral-900));
|
|
21
|
+
--color-primary-strong: light-dark(var(--color-neutral-900), var(--color-neutral-100));
|
|
22
|
+
--color-accent: light-dark(var(--color-neutral-600), var(--color-neutral-400));
|
|
23
|
+
--color-accent-contrast: light-dark(var(--color-neutral-50), var(--color-neutral-950));
|
|
24
|
+
--color-accent-hover: light-dark(var(--color-neutral-700), var(--color-neutral-300));
|
|
25
|
+
--color-accent-subtle: light-dark(var(--color-neutral-100), var(--color-neutral-800));
|
|
26
|
+
--color-accent-strong: light-dark(var(--color-neutral-800), var(--color-neutral-200));
|
|
27
|
+
--color-border: light-dark(var(--color-neutral-300), var(--color-neutral-700));
|
|
28
|
+
--color-border-hover: light-dark(var(--color-neutral-600), var(--color-neutral-500));
|
|
29
|
+
|
|
30
|
+
/* A text control's line is the only thing identifying it: the box is
|
|
31
|
+
transparent at rest, so nothing else marks where typing goes.
|
|
32
|
+
`--color-border` is neutral-300/700 and measures 1.42:1 on the light page,
|
|
33
|
+
which is a line you can barely see.
|
|
34
|
+
|
|
35
|
+
One value rather than a `light-dark()` pair, and that is the point: the page
|
|
36
|
+
is neutral-50 in light and neutral-950 in dark, so a tone halfway between
|
|
37
|
+
them reads on both grounds at once. A text control draws it at
|
|
38
|
+
`--_line-rest` rather than whole, which is what keeps the field quiet while
|
|
39
|
+
leaving the pointer somewhere to go -- so the line as painted lands under
|
|
40
|
+
the 3:1 WCAG 1.4.11 asks of a control boundary. Recorded in
|
|
41
|
+
docs/accessibility.md. */
|
|
42
|
+
--color-control-border: var(--color-neutral-500);
|
|
43
|
+
--color-background: light-dark(var(--color-neutral-50), var(--color-neutral-950));
|
|
44
|
+
--color-foreground: light-dark(var(--color-neutral-100), var(--color-neutral-900));
|
|
45
|
+
--color-surface: light-dark(var(--color-neutral-200), var(--color-neutral-800));
|
|
46
|
+
--color-text: light-dark(var(--color-neutral-950), var(--color-neutral-50));
|
|
47
|
+
--color-text-secondary: light-dark(var(--color-neutral-700), var(--color-neutral-400));
|
|
48
|
+
--color-text-contrast: light-dark(var(--color-neutral-50), var(--color-neutral-950));
|
|
49
|
+
--color-text-hover: light-dark(var(--color-neutral-700), var(--color-neutral-200));
|
|
50
|
+
/* No `--color-text-subtle`: the neutral intent points `--intent-subtle` at
|
|
51
|
+
`--color-surface`, not at a text-family tint, so the slot the other families
|
|
52
|
+
fill had no reader here. */
|
|
53
|
+
--color-text-strong: light-dark(var(--color-neutral-900), var(--color-neutral-100));
|
|
54
|
+
|
|
55
|
+
/* The tooltip bubble is the one component whose plate is chosen rather than
|
|
56
|
+
derived. Everything else composes its ground from the intent, and for the
|
|
57
|
+
bubble that produced the same 20% of the page's ink in both themes -- which
|
|
58
|
+
steps *lighter* than the surface on a dark page and *darker* on a light one.
|
|
59
|
+
Dark got the conventional reading, a floating thing lifted off its page;
|
|
60
|
+
light got a mid-grey slab two steps darker than every card on the screen,
|
|
61
|
+
carrying dark ink. Measured, the light bubble was neutral-400 at 2.01:1
|
|
62
|
+
against the page while the dark one was 2.27:1 the other way.
|
|
63
|
+
|
|
64
|
+
One derivation cannot serve both directions, so the pair is stated. Both
|
|
65
|
+
ends read as lifted: near-white over a light page, a mid grey over a dark
|
|
66
|
+
one. Near-white is only 1.04:1 against the page, so the bubble draws a
|
|
67
|
+
hairline as well -- see `components/tooltip.css`. */
|
|
68
|
+
--color-tooltip: light-dark(var(--color-white), var(--color-neutral-700));
|
|
69
|
+
--color-tooltip-contrast: light-dark(var(--color-neutral-900), var(--color-neutral-100));
|
|
70
|
+
|
|
71
|
+
/* Emerald-700 rather than 600. A filled button's label is normal-size text, so
|
|
72
|
+
WCAG 1.4.3 asks 4.5:1, and white on emerald-600 measures 3.50:1 -- it passed
|
|
73
|
+
only as large text, which `.btn` is not. One step darker carries the white
|
|
74
|
+
label and leaves the hue where it was. */
|
|
75
|
+
--color-success: var(--color-emerald-700);
|
|
76
|
+
--color-success-contrast: var(--color-neutral-50);
|
|
77
|
+
/* Baked rather than mixed live. `box-hover` nests this token two `color-mix()`
|
|
78
|
+
levels deeper to compose the fill and the edge, and three levels of
|
|
79
|
+
`color-mix()` over a `light-dark()` crashes the WebKit renderer outright on
|
|
80
|
+
hover. Confirmed on all four semantic intents, not only this one. Each
|
|
81
|
+
pinned pair below is
|
|
82
|
+
`color-mix(in srgb, <base> 82%, <strong>)`, resolved once per theme and
|
|
83
|
+
screenshotted back so the blend stays exact; re-bake it if the base or
|
|
84
|
+
strong tone it was mixed from changes. */
|
|
85
|
+
--color-success-hover: light-dark(#007552, #008e66);
|
|
86
|
+
/* The dark ground is `-900` to make room for the `-300` ink above it. `-subtle`
|
|
87
|
+
is what `kbd`, `code`, `pre` and the tooltip bubble rest on, and those are the
|
|
88
|
+
only places a partial fill prints text onto a tinted ground rather than onto
|
|
89
|
+
the page. At `-800` a destructive key cap measured 4.1:1 -- under the 4.5:1
|
|
90
|
+
WCAG 1.4.3 asks of normal text -- and the other three sat at 4.9 to 5.0 with
|
|
91
|
+
no headroom. One step darker puts all four past 9:1. */
|
|
92
|
+
--color-success-subtle: light-dark(var(--color-emerald-100), var(--color-emerald-900));
|
|
93
|
+
/* The dark tone is `-300`, not `-100`. `-strong` is what a partial fill prints
|
|
94
|
+
-- the label of a soft badge, the dot of a soft radio -- and on a dark page
|
|
95
|
+
the `-100` shade of every hue is a pale tint that reads white at small
|
|
96
|
+
sizes. The intent's colour survived only in the fill and the border, so a
|
|
97
|
+
soft success badge and a soft destructive one had the same white label and a
|
|
98
|
+
radio's dot stopped matching its own ring. `-300` keeps the hue and stays
|
|
99
|
+
far above the contrast a mark or a label needs. Light keeps `-800`, which
|
|
100
|
+
was never the problem: it is saturated and dark against a light page. */
|
|
101
|
+
--color-success-strong: light-dark(var(--color-emerald-800), var(--color-emerald-300));
|
|
102
|
+
/* Amber is the one family that cannot solve this by darkening. White on
|
|
103
|
+
amber-600 measures 3.07:1, and the amber dark enough to carry white has
|
|
104
|
+
stopped being amber -- it reads brown, which is not the colour a warning is
|
|
105
|
+
supposed to be. So the ink moves instead of the hue: dark ink on amber is
|
|
106
|
+
what a warning looks like nearly everywhere, and it is the only intent whose
|
|
107
|
+
contrast tone is not the page colour. */
|
|
108
|
+
--color-warning: var(--color-amber-600);
|
|
109
|
+
--color-warning-contrast: var(--color-neutral-950);
|
|
110
|
+
/* Same crash, same fix as `--color-success-hover` above. */
|
|
111
|
+
--color-warning-hover: light-dark(#d46700, #e78300);
|
|
112
|
+
--color-warning-subtle: light-dark(var(--color-amber-100), var(--color-amber-900));
|
|
113
|
+
--color-warning-strong: light-dark(var(--color-amber-800), var(--color-amber-300));
|
|
114
|
+
--color-destructive: var(--color-rose-700);
|
|
115
|
+
--color-destructive-contrast: var(--color-neutral-50);
|
|
116
|
+
/* Same crash, same fix as `--color-success-hover` above. */
|
|
117
|
+
--color-destructive-hover: light-dark(#c00036, #d1054b);
|
|
118
|
+
--color-destructive-subtle: light-dark(var(--color-rose-100), var(--color-rose-900));
|
|
119
|
+
--color-destructive-strong: light-dark(var(--color-rose-800), var(--color-rose-300));
|
|
120
|
+
--color-info: var(--color-indigo-600);
|
|
121
|
+
--color-info-contrast: var(--color-neutral-50);
|
|
122
|
+
/* Same crash, same fix as `--color-success-hover` above. */
|
|
123
|
+
--color-info-hover: light-dark(#4b36e9, #5e4ff9);
|
|
124
|
+
--color-info-subtle: light-dark(var(--color-indigo-100), var(--color-indigo-900));
|
|
125
|
+
--color-info-strong: light-dark(var(--color-indigo-800), var(--color-indigo-300));
|
|
126
|
+
|
|
127
|
+
--breakpoint-xs: 30rem;
|
|
128
|
+
--breakpoint-2xl: 90rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:root {
|
|
132
|
+
/* Both keywords: the system preference decides, and the explicit theme
|
|
133
|
+
selectors below override it at any depth because `color-scheme` inherits. */
|
|
134
|
+
color-scheme: light dark;
|
|
135
|
+
|
|
136
|
+
--container-narrow: 48rem;
|
|
137
|
+
--container-max: 80rem;
|
|
138
|
+
--container-wide: 90rem;
|
|
139
|
+
--layout-gutter: clamp(1rem, 4vw, 2rem);
|
|
140
|
+
--layout-section-block: clamp(4rem, 9vw, 7rem);
|
|
141
|
+
--layout-gap: 1rem;
|
|
142
|
+
--layout-grid-min: 16rem;
|
|
143
|
+
|
|
144
|
+
--radius-small: 0.25rem;
|
|
145
|
+
--radius-control: 0.5rem;
|
|
146
|
+
--radius-surface: 0.875rem;
|
|
147
|
+
--control-height: 2.5rem;
|
|
148
|
+
--border-width: 1px;
|
|
149
|
+
|
|
150
|
+
/* `light-dark()` takes colors only, so the shadow color is the token and the
|
|
151
|
+
three elevations compose from it. Dark themes need a much heavier color to
|
|
152
|
+
read at all against a dark background. */
|
|
153
|
+
--elevation-color: light-dark(rgb(15 23 42 / 0.08), rgb(0 0 0 / 0.55));
|
|
154
|
+
/* Four rungs: no shadow, then a Tailwind-style sm/md/lg progression, so a
|
|
155
|
+
consumer unsure which step to reach for has a named "no depth" value
|
|
156
|
+
instead of inferring it by omitting a shadow declaration. The elevation
|
|
157
|
+
modifier classes (`.elevation-none`/`.elevation-sm`/`.elevation-md` in
|
|
158
|
+
elevation.css) share this naming on purpose -- same weight, same word --
|
|
159
|
+
though they multiply an aesthetic's shadow parts rather than declaring a
|
|
160
|
+
fixed value, so the two are not read from the same place. */
|
|
161
|
+
--elevation-none: none;
|
|
162
|
+
--elevation-sm: 0 1px 2px var(--elevation-color), 0 1px 3px var(--elevation-color);
|
|
163
|
+
--elevation-md: 0 4px 6px -1px var(--elevation-color), 0 2px 4px -2px var(--elevation-color);
|
|
164
|
+
--elevation-lg: 0 20px 25px -5px var(--elevation-color), 0 8px 10px -6px var(--elevation-color);
|
|
165
|
+
|
|
166
|
+
--focus-ring: color-mix(in srgb, var(--color-primary) 64%, transparent);
|
|
167
|
+
/* Negative, so the ring is drawn over the edge rather than beside it: at a
|
|
168
|
+
positive offset the outline floats a gap away and reads as a second, detached
|
|
169
|
+
frame around the control. Pulled in by exactly the material line width, the
|
|
170
|
+
ring lands on top of the line and a focused control reads as its own edge
|
|
171
|
+
thickening -- which is what a focus indicator is meant to look like.
|
|
172
|
+
|
|
173
|
+
A component drawing no line at rest loses nothing: the outline moves one
|
|
174
|
+
pixel inward over its own fill, which at a hairline is not a visible change. */
|
|
175
|
+
--focus-ring-offset: calc(-1 * var(--border-width));
|
|
176
|
+
--focus-ring-width: 3px;
|
|
177
|
+
|
|
178
|
+
--motion-duration-fast: 120ms;
|
|
179
|
+
--motion-duration-normal: 200ms;
|
|
180
|
+
--motion-duration-slow: 400ms;
|
|
181
|
+
--motion-ease: cubic-bezier(0.2, 0, 0, 1);
|
|
182
|
+
|
|
183
|
+
--z-popover: 40;
|
|
184
|
+
|
|
185
|
+
/* The one number the derived-hover formula spends: how much fill a hover adds
|
|
186
|
+
on top of whatever the element rests at. */
|
|
187
|
+
--hover-step: 14%;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* The base look answers a press with a small scale-in. `box-active` applies it on
|
|
191
|
+
`.btn` and `.card.interactive`; every aesthetic sets its own
|
|
192
|
+
`--ui-active-transform` on its class, loaded after this file, so those win.
|
|
193
|
+
Reduced motion opts out. Kept outside `@theme` because a media query cannot go
|
|
194
|
+
inside it. */
|
|
195
|
+
:root {
|
|
196
|
+
--ui-active-transform: scale(0.97);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@media (prefers-reduced-motion: reduce) {
|
|
200
|
+
:root {
|
|
201
|
+
--ui-active-transform: none;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.light,
|
|
206
|
+
.theme-light,
|
|
207
|
+
[data-theme="light"] {
|
|
208
|
+
color-scheme: light;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.dark,
|
|
212
|
+
.theme-dark,
|
|
213
|
+
[data-theme="dark"] {
|
|
214
|
+
color-scheme: dark;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* The selector list mirrors the `color-scheme: dark` block above, all three
|
|
218
|
+
spellings included -- a consumer writing `.theme-dark` for the token theme
|
|
219
|
+
was otherwise left without the matching `dark:` variant. System preference is
|
|
220
|
+
deliberately out: the variant follows an explicit theme selector, the same
|
|
221
|
+
rule the rest of the theme model states, so `dark:` utilities track the theme
|
|
222
|
+
a subtree was actually put in rather than the OS default. */
|
|
223
|
+
@custom-variant dark (&:where(.dark, .dark *, .theme-dark, .theme-dark *, [data-theme="dark"], [data-theme="dark"] *));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@reference "tailwindcss";
|
|
2
|
+
@import "./theme.css";
|
|
3
|
+
|
|
4
|
+
/* `text-6xl` and up bundle `line-height: 1`, which sets a heading's line box to
|
|
5
|
+
the font size exactly: descenders reach the box edge and a wrapped heading's
|
|
6
|
+
lines collide. The two largest steps set an explicit leading that still
|
|
7
|
+
tightens as the type grows -- 1.1 under 1.15 under `text-3xl`'s 1.2. */
|
|
8
|
+
@utility text-display {
|
|
9
|
+
@apply text-6xl leading-[1.1] font-bold tracking-tight md:text-8xl;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@utility text-title-lg {
|
|
13
|
+
@apply text-5xl leading-[1.15] font-bold tracking-tight md:text-6xl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@utility text-title {
|
|
17
|
+
@apply text-3xl font-bold tracking-tight;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@utility text-title-sm {
|
|
21
|
+
@apply text-xl font-semibold tracking-tight;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@utility text-label-lg {
|
|
25
|
+
@apply text-lg font-medium tracking-wide;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@utility text-label {
|
|
29
|
+
@apply text-base font-medium tracking-wide;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@utility text-body {
|
|
33
|
+
@apply text-sm font-normal tracking-wider;
|
|
34
|
+
}
|