@codenhub/styles 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/NOTICE +18 -16
  2. package/README.es.md +62 -0
  3. package/README.md +28 -22
  4. package/README.pt-BR.md +62 -0
  5. package/dist/aesthetics/chunky-tile.css +1 -1
  6. package/dist/aesthetics/cyber.css +1 -1
  7. package/dist/aesthetics/glass.css +1 -1
  8. package/dist/aesthetics/index.css +2 -2
  9. package/dist/aesthetics/neobrutalism.css +1 -1
  10. package/dist/aesthetics/pixel.css +1 -1
  11. package/dist/aesthetics/sketch.css +1 -1
  12. package/dist/cli.js +189 -0
  13. package/dist/components.css +2 -2
  14. package/dist/index.css +2 -2
  15. package/dist/index.d.ts +1 -0
  16. package/dist/native.css +2 -2
  17. package/dist/palette.css +1 -1
  18. package/dist/theme.css +2 -2
  19. package/docs/accessibility.md +108 -60
  20. package/docs/changelog/0.1.1.md +1 -0
  21. package/docs/changelog/0.2.0.md +1 -0
  22. package/docs/changelog/0.3.0.md +1 -0
  23. package/docs/changelog/0.4.0.md +1 -0
  24. package/docs/changelog/0.5.0.md +8 -3
  25. package/docs/changelog/0.6.0.md +2 -1
  26. package/docs/changelog/0.7.0.md +50 -0
  27. package/docs/changelog/0.8.0.md +70 -0
  28. package/docs/changelog/index.md +2 -0
  29. package/docs/concepts.md +188 -46
  30. package/docs/es/accessibility.md +169 -0
  31. package/docs/es/concepts.md +212 -0
  32. package/docs/es/index.md +105 -0
  33. package/docs/es/integrating/astro.md +35 -0
  34. package/docs/es/integrating/index.md +75 -0
  35. package/docs/es/integrating/nextjs.md +67 -0
  36. package/docs/es/integrating/svelte.md +45 -0
  37. package/docs/es/integrating/tailwind.md +148 -0
  38. package/docs/es/integrating/vue.md +31 -0
  39. package/docs/es/integrating/without-a-bundler.md +238 -0
  40. package/docs/es/setup.md +188 -0
  41. package/docs/es/usage/aesthetics.md +282 -0
  42. package/docs/es/usage/buttons.md +135 -0
  43. package/docs/es/usage/composing.md +168 -0
  44. package/docs/es/usage/content-and-layout.md +219 -0
  45. package/docs/es/usage/customizing.md +304 -0
  46. package/docs/es/usage/feedback.md +157 -0
  47. package/docs/es/usage/forms.md +256 -0
  48. package/docs/es/usage/index.md +33 -0
  49. package/docs/es/usage/presets.md +92 -0
  50. package/docs/es/usage/solo.md +86 -0
  51. package/docs/es/usage/theming.md +309 -0
  52. package/docs/es/usage/tooltips.md +127 -0
  53. package/docs/index.md +86 -26
  54. package/docs/integrating/astro.md +3 -4
  55. package/docs/integrating/index.md +46 -13
  56. package/docs/integrating/nextjs.md +3 -4
  57. package/docs/integrating/svelte.md +5 -4
  58. package/docs/integrating/tailwind.md +89 -6
  59. package/docs/integrating/vue.md +3 -4
  60. package/docs/integrating/without-a-bundler.md +237 -0
  61. package/docs/pt-BR/accessibility.md +169 -0
  62. package/docs/pt-BR/concepts.md +212 -0
  63. package/docs/pt-BR/index.md +105 -0
  64. package/docs/pt-BR/integrating/astro.md +35 -0
  65. package/docs/pt-BR/integrating/index.md +75 -0
  66. package/docs/pt-BR/integrating/nextjs.md +67 -0
  67. package/docs/pt-BR/integrating/svelte.md +45 -0
  68. package/docs/pt-BR/integrating/tailwind.md +148 -0
  69. package/docs/pt-BR/integrating/vue.md +31 -0
  70. package/docs/pt-BR/integrating/without-a-bundler.md +238 -0
  71. package/docs/pt-BR/setup.md +188 -0
  72. package/docs/pt-BR/usage/aesthetics.md +282 -0
  73. package/docs/pt-BR/usage/buttons.md +135 -0
  74. package/docs/pt-BR/usage/composing.md +168 -0
  75. package/docs/pt-BR/usage/content-and-layout.md +219 -0
  76. package/docs/pt-BR/usage/customizing.md +304 -0
  77. package/docs/pt-BR/usage/feedback.md +157 -0
  78. package/docs/pt-BR/usage/forms.md +256 -0
  79. package/docs/pt-BR/usage/index.md +33 -0
  80. package/docs/pt-BR/usage/presets.md +92 -0
  81. package/docs/pt-BR/usage/solo.md +86 -0
  82. package/docs/pt-BR/usage/theming.md +309 -0
  83. package/docs/pt-BR/usage/tooltips.md +127 -0
  84. package/docs/setup.md +142 -91
  85. package/docs/usage/aesthetics.md +89 -73
  86. package/docs/usage/buttons.md +112 -40
  87. package/docs/usage/composing.md +109 -92
  88. package/docs/usage/content-and-layout.md +160 -125
  89. package/docs/usage/customizing.md +117 -41
  90. package/docs/usage/feedback.md +138 -71
  91. package/docs/usage/forms.md +201 -107
  92. package/docs/usage/index.md +22 -14
  93. package/docs/usage/presets.md +91 -0
  94. package/docs/usage/solo.md +85 -0
  95. package/docs/usage/theming.md +273 -118
  96. package/docs/usage/tooltips.md +90 -49
  97. package/llms-full.txt +2820 -1298
  98. package/llms.txt +24 -22
  99. package/package.json +134 -91
  100. package/{dist/tw → tw}/aesthetics/chunky-tile.css +107 -29
  101. package/{dist/tw → tw}/aesthetics/cyber.css +88 -40
  102. package/{dist/tw → tw}/aesthetics/glass.css +257 -61
  103. package/{dist/tw → tw}/aesthetics/neobrutalism.css +113 -20
  104. package/{dist/tw → tw}/aesthetics/pixel.css +93 -8
  105. package/tw/aesthetics/sketch.css +417 -0
  106. package/{dist/tw → tw}/box.css +105 -9
  107. package/tw/components/button.css +11 -0
  108. package/tw/components/button.rules.css +187 -0
  109. package/tw/components/feedback.css +11 -0
  110. package/{dist/tw/components/feedback.css → tw/components/feedback.rules.css} +136 -32
  111. package/tw/components/form.css +11 -0
  112. package/{dist/tw/components/form.css → tw/components/form.rules.css} +577 -125
  113. package/tw/components/index.css +16 -0
  114. package/tw/components/rules.css +41 -0
  115. package/tw/components/surface.css +11 -0
  116. package/tw/components/surface.rules.css +222 -0
  117. package/tw/components/tooltip.css +11 -0
  118. package/{dist/tw/components/tooltip.css → tw/components/tooltip.rules.css} +43 -27
  119. package/{dist/tw → tw}/corner.css +18 -12
  120. package/{dist/tw → tw}/elevation.css +23 -17
  121. package/{dist/tw → tw}/index.css +12 -10
  122. package/tw/index.d.ts +1 -0
  123. package/tw/intent.css +312 -0
  124. package/tw/modifiers.css +127 -0
  125. package/tw/native.css +320 -0
  126. package/tw/presentation.css +139 -0
  127. package/tw/reset.css +10 -0
  128. package/{dist/tw/reset.css → tw/reset.rules.css} +21 -22
  129. package/tw/size.css +34 -0
  130. package/tw/surface.css +9 -0
  131. package/tw/surface.rules.css +212 -0
  132. package/{dist/tw → tw}/theme.css +121 -45
  133. package/tw/typography.css +8 -0
  134. package/{dist/tw/typography.css → tw/typography.rules.css} +0 -3
  135. package/{dist/tw → tw}/utilities/content.css +212 -50
  136. package/tw/utilities/index.css +11 -0
  137. package/tw/utilities/layout.css +208 -0
  138. package/tw/utilities/rules.css +8 -0
  139. package/dist/tw/aesthetics/sketch.css +0 -333
  140. package/dist/tw/components/button.css +0 -139
  141. package/dist/tw/components/index.css +0 -36
  142. package/dist/tw/components/loader.css +0 -116
  143. package/dist/tw/components/surface.css +0 -175
  144. package/dist/tw/intent.css +0 -228
  145. package/dist/tw/native.css +0 -203
  146. package/dist/tw/palette.css +0 -460
  147. package/dist/tw/presentation.css +0 -68
  148. package/dist/tw/surface.css +0 -61
  149. package/dist/tw/utilities/index.css +0 -6
  150. package/dist/tw/utilities/layout.css +0 -130
  151. /package/{dist/tw → tw}/aesthetics/index.css +0 -0
@@ -0,0 +1,417 @@
1
+ /* Sketch: uneven elliptical corners, a solid ink edge, and a small hard shadow.
2
+ The handwriting face is consumer-supplied, so this file has no font asset or
3
+ network side effect. */
4
+
5
+ /* The layer map, stated before anything uses a layer -- see `theme.css`. The
6
+ aesthetic's token class sits in `components`, below every utility, so a
7
+ consumer's own utility or unlayered CSS beats it; the solo class stays
8
+ unlayered, because it has to beat a foreign component's unlayered CSS. See
9
+ docs/internal/model.md#cascade-layers. */
10
+ @layer theme, base, components, utilities;
11
+
12
+ @layer components {
13
+ .sketch {
14
+ /* Complete radii are taken as written, without the size step or corner
15
+ pattern. Chips use a smaller version of the same irregular outline.
16
+ Surfaces use sharp, hand-drawn square contours tailored for container
17
+ dimensions to avoid interior padding encroachment. Knobs follow R8. */
18
+ --ui-corner: initial;
19
+ --ui-corner-surface: initial;
20
+ --ui-corner-tl: initial;
21
+ --ui-corner-tr: initial;
22
+ --ui-corner-br: initial;
23
+ --ui-corner-bl: initial;
24
+ --ui-radius: var(--sketch-radius, 255px 15px 225px 15px / 15px 225px 15px 255px);
25
+ --ui-radius-surface: var(--sketch-radius-surface, 80px 4px 75px 5px / 3px 70px 4px 80px);
26
+ --ui-radius-pill: var(--sketch-radius-pill, 20px 22px 21px 19px / 20px 22px 21px 19px);
27
+ --ui-radius-tight: 11px 1px 7px 2px / 2px 7px 1px 11px;
28
+ --ui-corner-shape: round;
29
+
30
+ --ui-ink: light-dark(var(--color-neutral-950), var(--color-neutral-50));
31
+ /* Controls take the theme's control border rather than the ink, which is the
32
+ primary colour in both themes; see `neobrutalism.css`. */
33
+ --ui-control-ink: var(--color-control-border);
34
+ --ui-rule-ink: initial;
35
+ --ui-border-width: 1px;
36
+ --ui-border-max: 100px;
37
+ --ui-line-style: solid;
38
+ --ui-rule-style: initial;
39
+
40
+ --ui-shadow-ink: 0%;
41
+ /* The foundation depth colour is restated so a sketch region nested inside
42
+ cyber does not inherit cyber's transparent depth. */
43
+ --elevation-color: light-dark(rgb(15 23 42 / 0.08), rgb(0 0 0 / 0.55));
44
+ --ui-shadow-x: 2px;
45
+ --ui-shadow-y: 2px;
46
+ --ui-shadow-blur: 0px;
47
+ --ui-shadow-spread: 0px;
48
+ --ui-shadow-inset: ;
49
+ --ui-shadow-edge: initial;
50
+ --ui-halo-blur: initial;
51
+ --ui-halo-spread: initial;
52
+ --ui-halo-ink: initial;
53
+ --ui-focus-inset: initial;
54
+
55
+ --ui-active-shadow-x: initial;
56
+ --ui-active-shadow-y: initial;
57
+ --ui-active-transform: scale(0.97);
58
+ --ui-active-translate-x: initial;
59
+ --ui-active-translate-y: initial;
60
+ --ui-hover-transform: none;
61
+ --ui-clip: none;
62
+ --ui-clip-tight: none;
63
+ --ui-backdrop: none;
64
+ --ui-surface-image: initial;
65
+ --ui-surface-ground: initial;
66
+ --ui-surface-shadow: initial;
67
+ --ui-bg-alpha: 1;
68
+ --ui-label-weight: initial;
69
+ --ui-label-tracking: initial;
70
+ --ui-label-case: initial;
71
+ --ui-label-shadow: initial;
72
+
73
+ font-family: var(--font-sketch, cursive);
74
+ }
75
+
76
+ /* Rounded variant: bounded elliptical corners, so the top and bottom edges of
77
+ a wide element stay straight instead of bulging into an egg. On the region
78
+ with `.sketch`, or on one component inside it. Knobs follow R8.
79
+
80
+ Never on a solo element, here or in the rotation below:
81
+ `.sketch-solo.sketch-rounded` paints its own outline, and a complete
82
+ radius declared on it would inherit into whatever it holds -- a `.btn`
83
+ inside a solo toast took a sketch outline on a page with no sketch in
84
+ scope. */
85
+ .sketch-rounded:not(.sketch-solo) {
86
+ --ui-radius: var(--sketch-radius-rounded, 26px 10px 24px 11px / 12px 23px 11px 20px);
87
+ --ui-radius-surface: var(--sketch-radius-surface-rounded, 38px 16px 36px 17px / 16px 34px 17px 32px);
88
+ --ui-radius-pill: var(--sketch-radius-pill, 24px 16px 23px 17px / 17px 21px 16px 20px);
89
+ --ui-radius-tight: 9px 3px 8px 4px / 4px 8px 3px 7px;
90
+ }
91
+
92
+ /* One region token gives every element the same outline, so the rotation and
93
+ the dashed accents are written on components, which the registry records.
94
+
95
+ The nearest region decides. A component in another aesthetic nested inside
96
+ a sketch region keeps that aesthetic's material, and one in a sketch region
97
+ nested again inside that rotates. A `:not(.sketch :is(...) *)` exclusion
98
+ cannot tell those two apart, since the re-entered component also sits below
99
+ the other aesthetic, so each region writes private flags instead and
100
+ inheritance hands a component the nearest one's -- the way neobrutalism
101
+ rests its alert:
102
+
103
+ - `--_sketch-on`, `--_sketch-pointed`, `--_sketch-rounded` are space
104
+ toggles: empty is on, and `initial` makes a value reading one invalid at
105
+ computed-value time, which is off. `.sketch` turns on the pointed
106
+ outlines and `.sketch-rounded` the rounded ones; rounded wins where both
107
+ are on, as the modifier does. Another aesthetic turns all three off.
108
+ - `--_sketch-pass-*` is what that other aesthetic declared for each token
109
+ the rotation writes, so a component under it takes the region's value
110
+ back rather than a rotation's -- cyber's whole surface shape included.
111
+ Off, a value is the pass, then the rounded one, then the pointed one; the
112
+ first that is valid wins, and with none the token is unset, as every
113
+ other aesthetic declares it.
114
+
115
+ The other aesthetics are named below and in the flags, and
116
+ `registry.test.ts` fails when one is missing. A region's own element is
117
+ not rotated: it declares the pass from its own tokens, which a rotation
118
+ would then declare from the pass.
119
+
120
+ Rotation is by sibling position, and a field's control takes its field's
121
+ position instead of its own, so stacked rows alternate. It is stable for a
122
+ given DOM order. A knob, when set, is one outline for every position. */
123
+ .sketch,
124
+ .sketch-rounded:not(.sketch-solo) {
125
+ --_sketch-on: ;
126
+ --_sketch-pass-radius: initial;
127
+ --_sketch-pass-radius-surface: initial;
128
+ --_sketch-pass-radius-tight: initial;
129
+ --_sketch-pass-radius-pill: initial;
130
+ --_sketch-pass-line-style: initial;
131
+ --_sketch-pass-rule-style: initial;
132
+ }
133
+
134
+ .sketch {
135
+ --_sketch-pointed: ;
136
+ }
137
+
138
+ .sketch-rounded:not(.sketch-solo) {
139
+ --_sketch-rounded: ;
140
+ }
141
+
142
+ :is(.neobrutalism, .glass, .pixel, .chunky-tile, .cyber) {
143
+ --_sketch-on: initial;
144
+ --_sketch-pointed: initial;
145
+ --_sketch-rounded: initial;
146
+ --_sketch-pass-radius: var(--ui-radius);
147
+ --_sketch-pass-radius-surface: var(--ui-radius-surface);
148
+ --_sketch-pass-radius-tight: var(--ui-radius-tight);
149
+ --_sketch-pass-radius-pill: var(--ui-radius-pill);
150
+ --_sketch-pass-line-style: var(--ui-line-style);
151
+ --_sketch-pass-rule-style: var(--ui-rule-style);
152
+ }
153
+
154
+ :is(.sketch, .sketch-rounded:not(.sketch-solo), :is(.sketch, .sketch-rounded:not(.sketch-solo)) *):not(
155
+ :is(.neobrutalism, .glass, .pixel, .chunky-tile, .cyber)
156
+ ) {
157
+ /* Controls, fields, surfaces, and chips. Each position names its pointed
158
+ outline in `--_sketch-p` and its rounded one in `--_sketch-r`, declared
159
+ with the token, so a position never reads a value inherited from an
160
+ ancestor's. */
161
+ &:is(.btn, .ipt, .textarea, .select, .input-group, .pre, .tooltip-bubble) {
162
+ &:nth-child(4n + 2) {
163
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 18px 240px 15px 255px / 240px 15px 255px 18px);
164
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 11px 25px 12px 24px / 23px 11px 22px 12px);
165
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
166
+ }
167
+
168
+ &:nth-child(4n + 3) {
169
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 245px 220px 15px 18px / 18px 15px 245px 235px);
170
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 24px 12px 26px 10px / 11px 23px 12px 22px);
171
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
172
+ }
173
+
174
+ &:nth-child(4n) {
175
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 18px 250px 225px 15px / 245px 15px 18px 235px);
176
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 12px 24px 10px 25px / 22px 12px 23px 11px);
177
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
178
+ }
179
+ }
180
+
181
+ &:is(.ipt, .textarea, .select, .input-group) {
182
+ .field:nth-child(4n + 1) & {
183
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 255px 15px 225px 15px / 15px 225px 15px 255px);
184
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 26px 10px 24px 11px / 12px 23px 11px 20px);
185
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
186
+ }
187
+
188
+ .field:nth-child(4n + 2) & {
189
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 18px 240px 15px 255px / 240px 15px 255px 18px);
190
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 11px 25px 12px 24px / 23px 11px 22px 12px);
191
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
192
+ }
193
+
194
+ .field:nth-child(4n + 3) & {
195
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 245px 220px 15px 18px / 18px 15px 245px 235px);
196
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 24px 12px 26px 10px / 11px 23px 12px 22px);
197
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
198
+ }
199
+
200
+ .field:nth-child(4n) & {
201
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius, 18px 250px 225px 15px / 245px 15px 18px 235px);
202
+ --_sketch-r: var(--_sketch-rounded) var(--sketch-radius-rounded, 12px 24px 10px 25px / 22px 12px 23px 11px);
203
+ --ui-radius: var(--_sketch-pass-radius, var(--_sketch-r, var(--_sketch-p)));
204
+ }
205
+ }
206
+
207
+ &:is(.card, .panel, .alert, .data-table) {
208
+ &:nth-child(4n + 2) {
209
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius-surface, 4px 75px 5px 80px / 75px 3px 80px 4px);
210
+ --_sketch-r: var(--_sketch-rounded)
211
+ var(--sketch-radius-surface-rounded, 17px 36px 18px 34px / 33px 16px 32px 17px);
212
+ --ui-radius-surface: var(--_sketch-pass-radius-surface, var(--_sketch-r, var(--_sketch-p)));
213
+ }
214
+
215
+ &:nth-child(4n + 3) {
216
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius-surface, 75px 70px 4px 5px / 4px 3px 75px 70px);
217
+ --_sketch-r: var(--_sketch-rounded)
218
+ var(--sketch-radius-surface-rounded, 35px 18px 38px 15px / 17px 32px 16px 34px);
219
+ --ui-radius-surface: var(--_sketch-pass-radius-surface, var(--_sketch-r, var(--_sketch-p)));
220
+ }
221
+
222
+ &:nth-child(4n) {
223
+ --_sketch-p: var(--_sketch-pointed) var(--sketch-radius-surface, 5px 80px 75px 4px / 75px 4px 5px 70px);
224
+ --_sketch-r: var(--_sketch-rounded)
225
+ var(--sketch-radius-surface-rounded, 18px 35px 16px 37px / 31px 17px 34px 16px);
226
+ --ui-radius-surface: var(--_sketch-pass-radius-surface, var(--_sketch-r, var(--_sketch-p)));
227
+ }
228
+ }
229
+
230
+ &:is(.badge, .kbd, .code, .checkbox, .switch, .progress) {
231
+ &:nth-child(4n + 2) {
232
+ --_sketch-p: var(--_sketch-pointed) 2px 8px 1px 10px / 8px 2px 10px 1px;
233
+ --_sketch-r: var(--_sketch-rounded) 4px 8px 3px 9px / 8px 3px 8px 4px;
234
+ --ui-radius-tight: var(--_sketch-pass-radius-tight, var(--_sketch-r, var(--_sketch-p)));
235
+ }
236
+
237
+ &:nth-child(4n + 3) {
238
+ --_sketch-p: var(--_sketch-pointed) 8px 2px 10px 1px / 1px 9px 2px 8px;
239
+ --_sketch-r: var(--_sketch-rounded) 8px 4px 9px 3px / 3px 9px 4px 8px;
240
+ --ui-radius-tight: var(--_sketch-pass-radius-tight, var(--_sketch-r, var(--_sketch-p)));
241
+ }
242
+
243
+ &:nth-child(4n) {
244
+ --_sketch-p: var(--_sketch-pointed) 1px 10px 2px 7px / 9px 1px 8px 2px;
245
+ --_sketch-r: var(--_sketch-rounded) 3px 9px 4px 8px / 9px 4px 8px 3px;
246
+ --ui-radius-tight: var(--_sketch-pass-radius-tight, var(--_sketch-r, var(--_sketch-p)));
247
+ }
248
+ }
249
+
250
+ /* A pill button keeps a rounded pill in either variant, bounded to the
251
+ button's half-height so a wide one keeps flat top and bottom edges. */
252
+ &.btn.pill {
253
+ --ui-radius-pill: var(
254
+ --_sketch-pass-radius-pill,
255
+ var(--_sketch-on) var(--sketch-radius-pill, 24px 16px 23px 17px / 17px 21px 16px 20px)
256
+ );
257
+
258
+ &:nth-child(4n + 2) {
259
+ --ui-radius-pill: var(
260
+ --_sketch-pass-radius-pill,
261
+ var(--_sketch-on) var(--sketch-radius-pill, 17px 23px 16px 24px / 21px 16px 20px 17px)
262
+ );
263
+ }
264
+
265
+ &:nth-child(4n + 3) {
266
+ --ui-radius-pill: var(
267
+ --_sketch-pass-radius-pill,
268
+ var(--_sketch-on) var(--sketch-radius-pill, 23px 17px 24px 16px / 16px 20px 17px 21px)
269
+ );
270
+ }
271
+
272
+ &:nth-child(4n) {
273
+ --ui-radius-pill: var(
274
+ --_sketch-pass-radius-pill,
275
+ var(--_sketch-on) var(--sketch-radius-pill, 16px 24px 17px 23px / 20px 17px 21px 16px)
276
+ );
277
+ }
278
+ }
279
+
280
+ /* Badges, progress bars, and switches take their chip outline where they
281
+ would be fully round. */
282
+ &:is(.badge, .progress, .switch) {
283
+ --ui-radius-pill: var(--_sketch-pass-radius-pill, var(--_sketch-on) var(--ui-radius-tight));
284
+ }
285
+
286
+ /* Radios and the tooltip trigger stay circles, slightly uneven, so a radio
287
+ is never mistaken for a checkbox. */
288
+ &:is(.radio, .tooltip-icon) {
289
+ --ui-radius-pill: var(--_sketch-pass-radius-pill, var(--_sketch-on) 48% 52% 46% 54% / 53% 46% 54% 47%);
290
+ }
291
+
292
+ /* The dashed accents, under `.sketch`; every other line stays solid. The
293
+ bare elements `/native` styles as these components are named beside
294
+ them, in `:where()` so the selector's weight stays the class's. */
295
+ &:is(.checkbox, :where(input[type="checkbox"]:not(.switch, .radio))) {
296
+ --ui-line-style: var(--_sketch-pass-line-style, var(--_sketch-pointed) dashed);
297
+ }
298
+
299
+ &:is(.divider, .data-table, :where(hr, table)) {
300
+ --ui-rule-style: var(--_sketch-pass-rule-style, var(--_sketch-pointed) dashed);
301
+ }
302
+ }
303
+ }
304
+
305
+ /* Solo: the same look painted onto the one element carrying the class, for an
306
+ element the package does not style. See docs/internal/model.md#solo-classes and
307
+ the note on `.glass-solo`: it composes with the element's presentation,
308
+ intent, and elevation, and reads its material from its own knobs and
309
+ foundation tokens with literal fallbacks, never a shared material `--ui-*`
310
+ or `--elevation-color` token. Unlayered, and not for this package's own
311
+ components. */
312
+ .sketch-solo {
313
+ /* The composition, the same in every solo class; `registry.test.ts` holds
314
+ the copies together. See the note on `.glass-solo`. */
315
+ --_solo-intent-color: initial;
316
+ --_solo-intent-contrast: initial;
317
+ --_solo-intent-strong: initial;
318
+ --_solo-intent-border: initial;
319
+ --_solo-intent-fill-max: initial;
320
+ --_solo-color: var(--_solo-intent-color, var(--color-text, light-dark(oklch(14.5% 0 0), oklch(98.5% 0 0))));
321
+ --_solo-contrast: var(
322
+ --_solo-intent-contrast,
323
+ var(--color-text-contrast, light-dark(oklch(98.5% 0 0), oklch(14.5% 0 0)))
324
+ );
325
+ --_solo-strong: var(--_solo-intent-strong, var(--color-text-strong, light-dark(oklch(20.5% 0 0), oklch(97% 0 0))));
326
+ --_solo-capped: min(var(--ui-fill, 0%), var(--_solo-intent-fill-max, 20%));
327
+ --_solo-fill: color-mix(in oklab, var(--_solo-color) var(--_solo-capped), transparent);
328
+ --_solo-on-fill: min(var(--ui-fg-on-fill, 0%), max(0%, calc(var(--_solo-capped) * 2 - 100%)));
329
+ --_solo-fg: color-mix(in oklab, var(--_solo-contrast) var(--_solo-on-fill), var(--_solo-strong));
330
+ /* The line with no intent on the element: this aesthetic's own ink. */
331
+ --_solo-ink: var(
332
+ --_solo-intent-border,
333
+ light-dark(var(--color-neutral-950, oklch(14.5% 0 0)), var(--color-neutral-50, oklch(98.5% 0 0)))
334
+ );
335
+ --_solo-edge: color-mix(in oklab, var(--_solo-ink) var(--ui-border, 100%), var(--_solo-fill));
336
+ --_solo-depth: calc(2px * var(--ui-elevation, 1));
337
+
338
+ border: 1px solid var(--_solo-edge);
339
+ /* The surface shape: the element this exists for is usually a pane. An action
340
+ takes the control shape below. */
341
+ border-radius: var(--sketch-radius-surface, 80px 4px 75px 5px / 3px 70px 4px 80px);
342
+ /* The aesthetic's neutral depth cue, not the ink: the class casts its 2px
343
+ offset in the depth colour, and casting a solo pane in full ink would read
344
+ as a heavier, neobrutalist slab. The depth colour is a literal, for the reason
345
+ `.glass-solo` gives. */
346
+ box-shadow:
347
+ var(--_solo-depth) var(--_solo-depth) 0 0 light-dark(rgb(15 23 42 / 0.08), rgb(0 0 0 / 0.55)),
348
+ inset 0 0 0 100vmax var(--_solo-fill);
349
+ font-family: var(--font-sketch, cursive);
350
+ }
351
+
352
+ /* An intent class on the element colours it, as on a component. Named rather
353
+ than read from `--intent-*` alone: those slots inherit, so a `.success`
354
+ container would colour a solo element where it leaves a component neutral. */
355
+ .sketch-solo:is(.primary, .secondary, .success, .warning, .destructive, .info) {
356
+ --_solo-intent-color: var(--intent-color);
357
+ --_solo-intent-contrast: var(--intent-contrast);
358
+ --_solo-intent-strong: var(--intent-strong);
359
+ --_solo-intent-border: var(--intent-border);
360
+ --_solo-intent-fill-max: var(--intent-fill-max);
361
+ }
362
+
363
+ /* The text colour is written only where a fill or an intent is asked for, on
364
+ the element or by a container's fill class. Anywhere else the element keeps
365
+ its own: a dark toast keeps its light text. */
366
+ .sketch-solo:is(
367
+ .solid,
368
+ .soft,
369
+ .ghost,
370
+ .primary,
371
+ .secondary,
372
+ .success,
373
+ .warning,
374
+ .destructive,
375
+ .info,
376
+ :is(.solid, .soft, .ghost) *
377
+ ) {
378
+ color: var(--_solo-fg);
379
+ }
380
+
381
+ /* An action takes the expressive control shape. */
382
+ .sketch-solo:is(
383
+ button,
384
+ a[href],
385
+ [role="button"],
386
+ summary,
387
+ input[type="button"],
388
+ input[type="submit"],
389
+ input[type="reset"]
390
+ ) {
391
+ border-radius: var(--sketch-radius, 255px 15px 225px 15px / 15px 225px 15px 255px);
392
+ }
393
+
394
+ /* With `.sketch-rounded`, the rounded outlines, through their own knobs. */
395
+ .sketch-solo.sketch-rounded {
396
+ border-radius: var(--sketch-radius-surface-rounded, 38px 16px 36px 17px / 16px 34px 17px 32px);
397
+ }
398
+
399
+ .sketch-solo.sketch-rounded:is(
400
+ button,
401
+ a[href],
402
+ [role="button"],
403
+ summary,
404
+ input[type="button"],
405
+ input[type="submit"],
406
+ input[type="reset"]
407
+ ) {
408
+ border-radius: var(--sketch-radius-rounded, 26px 10px 24px 11px / 12px 23px 11px 20px);
409
+ }
410
+
411
+ /* This entrypoint may be the only package stylesheet loaded, so it cannot rely
412
+ on theme.css's forced-colors material reset. */
413
+ @media (forced-colors: active) {
414
+ .sketch-solo {
415
+ border-style: solid;
416
+ }
417
+ }
@@ -34,6 +34,23 @@
34
34
  specificity, so restating it here is what keeps a nested box reading its
35
35
  own presentation instead of the container's reinterpretation of one. */
36
36
  --_fill-cap: 100%;
37
+ /* What a box rests as when nothing above `@apply box` says otherwise: no
38
+ fill, no line, the ordinary depth. Stated on the element, not left to
39
+ the `var()` fallbacks: `--_d-*` inherit like any custom property, so a
40
+ bare `box` inside a `.btn` rested as the button does -- a full fill and
41
+ the button's line. A component writes its own after `@apply box`, where
42
+ the later declaration wins. See docs/internal/model.md#resting-defaults. */
43
+ --_d-fill: 0%;
44
+ --_d-fg-on-fill: 0%;
45
+ --_d-border: 0%;
46
+ --_d-elevation: 1;
47
+ --_d-holds-ink: none;
48
+
49
+ /* Printed as drawn. A browser leaves backgrounds off paper by default, and
50
+ a filled box prints its label in the contrast colour: white on nothing.
51
+ Inherited, so everything inside keeps its paint too. */
52
+ print-color-adjust: exact;
53
+
37
54
  --_capped: min(var(--ui-fill, var(--_d-fill)), var(--_fill-cap, 100%), var(--intent-fill-max, 100%));
38
55
  /* Whether the intent's cap stopped the fill short, as 0% or 100%. A capped
39
56
  fill is a plate the presentation asked to be full, so it rests on the page
@@ -85,7 +102,26 @@
85
102
  `--intent-contrast` keeps its own meaning -- `--_on-fill` reconciles it with
86
103
  a capped intent -- rather than being bent so neutral's contrast is the ink,
87
104
  which renders a checked neutral checkbox black-on-black. */
88
- --_fg: color-mix(in oklab, var(--intent-contrast) var(--_on-fill), var(--intent-strong));
105
+ --_fg-own: color-mix(in oklab, var(--intent-contrast) var(--_on-fill), var(--intent-strong));
106
+ /* The ink of the plate beneath. Intent does not cascade, so a component with
107
+ none prints the page's ink, and on a filled parent that ink sat on the
108
+ parent's fill: a badge in a primary button read at 1.11:1. A box whose
109
+ fill is a plate hands its own ink down; one with no plate declares these
110
+ invalid, which for a registered property means it inherits them, so the
111
+ ink passes through an input group to the field inside it. `--_through`
112
+ is 100% for a neutral box (its cap is below 100%) that was handed an ink
113
+ and holds none: an intent keeps its own ink, as it keeps its own colour.
114
+ A component that rests on a ground of its own restates all three after
115
+ `@apply box`. See docs/internal/model.md#the-ink-of-the-plate-beneath. */
116
+ --_held-ink: var(--_holds-ink, var(--_d-holds-ink)) var(--_fg-own);
117
+ --_held-on: var(--_holds-ink, var(--_d-holds-ink)) 100%;
118
+ --_own-hold: var(--_holds-ink, var(--_d-holds-ink)) 100%;
119
+ --_through: min(
120
+ var(--_held-on),
121
+ calc(100% - var(--_own-hold)),
122
+ clamp(0%, calc((100% - var(--intent-fill-max, 100%)) * 1000), 100%)
123
+ );
124
+ --_fg: color-mix(in oklab, var(--_held-ink) var(--_through), var(--_fg-own));
89
125
  /* P3: the line fades out as the fill fills in, so a filled box has a seamless
90
126
  edge. It fades toward `transparent`, not toward the plate: the plate
91
127
  already runs under the border (nothing clips the background to the padding
@@ -98,7 +134,29 @@
98
134
  `.edgeless` on the fill colour, which the border box paints as a second
99
135
  coat -- a ring around an element that asked for no edge. See
100
136
  docs/internal/model.md#presentation. */
101
- --_line: color-mix(in oklab, transparent var(--ui-fill, var(--_d-fill)), var(--intent-border));
137
+ /* The neutral line of a box with no fill, where an aesthetic's line cannot
138
+ be seen without one: glass's hairline is a highlight on a plate, and on a
139
+ `.ghost.edged` button there is no plate (1.01:1 on a light page). A
140
+ component that wants the swap names the ink after `@apply box`; cleared
141
+ here so a box nested in one does not inherit it. `--_bare` is 100% for a
142
+ neutral intent (its cap is below 100%) resolving to no fill, stepped from
143
+ the resolved values as `surface`'s `--_quiet` is, so a container's
144
+ `.ghost` counts and an intent's own line is never swapped. */
145
+ --_bare-ink: initial;
146
+ --_bare: min(
147
+ clamp(0%, calc((100% - var(--intent-fill-max, 100%)) * 1000), 100%),
148
+ clamp(0%, calc(100% - var(--ui-fill, var(--_d-fill)) * 1000), 100%)
149
+ );
150
+ --_line-ink: color-mix(
151
+ in oklab,
152
+ var(--_held-ink) var(--_through),
153
+ color-mix(
154
+ in oklab,
155
+ var(--_bare-ink, var(--intent-border, var(--ui-ink, var(--color-border)))) var(--_bare),
156
+ var(--intent-border, var(--ui-ink, var(--color-border)))
157
+ )
158
+ );
159
+ --_line: color-mix(in oklab, transparent var(--ui-fill, var(--_d-fill)), var(--_line-ink));
102
160
  /* How much line there is, as an input rather than a result. A component that
103
161
  must keep its line whatever the edge class says raises `--_edge-floor`
104
162
  instead of rewriting `--_edge`, and the composition above still runs.
@@ -106,7 +164,14 @@
106
164
  Rewriting the result drops every term it was composed from, silently and
107
165
  with nothing to report. Bounding the input leaves the axis live, so
108
166
  `.edged` and `.edgeless` still mean what they say on a component that
109
- floors itself. */
167
+ floors itself.
168
+
169
+ Restated at `0%` -- no floor -- for the reason `--_fill-cap` is restated
170
+ above: the floor inherits, so a field's or a tooltip bubble's `100%` reached
171
+ every box nested inside, and a `.btn.edgeless` clear button in an
172
+ `.input-group` drew a field's line it had asked not to have. Components
173
+ that floor themselves declare theirs after `@apply box`. */
174
+ --_edge-floor: 0%;
110
175
  --_edge-amount: max(var(--ui-border, var(--_d-border)), var(--_edge-floor, 0%));
111
176
  --_edge: color-mix(in oklab, var(--_line) var(--_edge-amount), transparent);
112
177
  --_width: min(var(--ui-border-width, var(--border-width)), var(--ui-border-max, 100px));
@@ -150,7 +215,11 @@
150
215
  mixes where the intent lives). An intent-coloured shadow at full opacity is
151
216
  a smear of the component's hue, not depth; neobrutalism's slab, which *is*
152
217
  ink, asks for it by name. */
153
- --_depth-color: color-mix(in oklab, var(--intent-border) var(--ui-shadow-ink, 0%), var(--elevation-color));
218
+ --_depth-color: color-mix(
219
+ in oklab,
220
+ var(--intent-border, var(--ui-ink, var(--color-border))) var(--ui-shadow-ink, 0%),
221
+ var(--elevation-color)
222
+ );
154
223
  /* Or the shadow *is* the edge. An aesthetic that draws its line as an inset
155
224
  ring (`.pixel`) puts the border where `clip-path` cannot cut it, so that
156
225
  ring must answer the edge axis like a real border -- `--_edge` already does,
@@ -176,7 +245,7 @@
176
245
  --_halo-layer:
177
246
  ,
178
247
  0 0 var(--ui-halo-blur, 0px) var(--ui-halo-spread, 0px)
179
- color-mix(in oklab, var(--intent-border) var(--ui-halo-ink), transparent);
248
+ color-mix(in oklab, var(--intent-border, var(--ui-ink, var(--color-border))) var(--ui-halo-ink), transparent);
180
249
  /* Indirection so a component can substitute a complete value of its own
181
250
  without restating the parts -- `surface` does, for the multi-layer case.
182
251
  There is deliberately no `--ui-shadow` wrapper: a complete value has nothing
@@ -184,7 +253,28 @@
184
253
  on anything that set one. `--ui-surface-shadow` is that escape hatch narrowed
185
254
  to the single case that needs it. */
186
255
  --_shadow: var(--_shadow-parts) var(--_halo-layer,);
187
- --_focus-stack: var(--_shadow), inset 0 0 0 var(--ui-focus-inset) var(--focus-ring);
256
+ /* The inset focus layer an aesthetic that clips asks for, in two tones. The
257
+ ring is the primary colour, so on a `.solid.primary` box it was painted
258
+ over its own colour and a focused button was pixel for pixel a resting
259
+ one. A line of the page colour sits inside it: one of the two always
260
+ differs from the fill, whatever the fill is. Shadows paint first-on-top,
261
+ so the line is listed last and is the two pixels the ring leaves showing. */
262
+ --_focus-stack:
263
+ var(--_shadow),
264
+ inset 0 0 0 var(--ui-focus-inset) var(--focus-ring, color-mix(in srgb, var(--color-primary) 64%, transparent)),
265
+ inset 0 0 0 calc(var(--ui-focus-inset) + 2px) var(--color-background);
266
+ /* The same line of the page colour under the outline `reset.css` draws,
267
+ for the same reason: the outline sits over the box's own edge, and on a
268
+ box filled with the ring's colour that part of it was invisible. Under a
269
+ two-pixel line that left one pixel of ring, which neobrutalism's slab
270
+ covered on two sides. Stepped from the capped fill, so only a box filled
271
+ past half takes it: on an unfilled one the ring already reads against the
272
+ page, and a line of the page colour inside a soft field is a stray mark. */
273
+ --_focus-gap: color-mix(
274
+ in oklab,
275
+ var(--color-background) clamp(0%, calc((var(--_capped) - 50%) * 1000), 100%),
276
+ transparent
277
+ );
188
278
 
189
279
  /* Every box sizes itself as `min-height`/`min-width: var(--control-height)`
190
280
  plus its own padding and the border shorthand above, so its geometry is
@@ -255,7 +345,7 @@
255
345
  non-inherited property is `initial`, that is `none`. Every focused box would
256
346
  lose its shadow rather than keep it. */
257
347
  &:focus-visible {
258
- box-shadow: var(--_focus-stack, var(--_shadow));
348
+ box-shadow: var(--_focus-stack, var(--_shadow), inset 0 0 0 2px var(--_focus-gap));
259
349
  }
260
350
 
261
351
  &:disabled,
@@ -295,7 +385,9 @@
295
385
  component opts in. `btn` and `.card.interactive` both do. The gesture is the
296
386
  aesthetic's -- neobrutalism travels into its offset shadow, chunky-tile drops
297
387
  onto its bar -- and with no aesthetic it is the base `scale(0.97)` from
298
- `theme.css`, dropped under reduced motion. The `--ui-active-shadow-*` slots
388
+ `theme.css`. Reduced motion keeps every press and drops its motion, in
389
+ `box`, since a press is the feedback that a click landed. The
390
+ `--ui-active-shadow-*` slots
299
391
  stay no-ops until an aesthetic sets them.
300
392
 
301
393
  A press that travels into the element's own depth is a translation, given as
@@ -312,7 +404,11 @@
312
404
  @utility box-active {
313
405
  &:active:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]) {
314
406
  --_sx: calc(var(--ui-active-shadow-x, var(--ui-shadow-x, var(--_d-shadow-x, 0px))) * var(--_depth));
315
- --_sy: calc(var(--ui-active-shadow-y, var(--ui-shadow-y, var(--_d-shadow-y, 0px))) * var(--_depth));
407
+ /* The same three slots as the resting offset, `.raised`'s plain step last,
408
+ so with no aesthetic a pressed button keeps the depth it rests on. */
409
+ --_sy: calc(
410
+ var(--ui-active-shadow-y, var(--ui-shadow-y, var(--_d-shadow-y, var(--elevation-y, 0px)))) * var(--_depth)
411
+ );
316
412
 
317
413
  --_press: calc(var(--ui-active-translate-x, 0px) * var(--_depth))
318
414
  calc(var(--ui-active-translate-y, 0px) * var(--_depth));
@@ -0,0 +1,11 @@
1
+ @reference "tailwindcss";
2
+ @import "../theme.css";
3
+ @reference "../box.css";
4
+
5
+ /* The focused entry: what the rules in `button.rules.css` need to compile on their
6
+ own, then the rules. An aggregate entry imports the rules file directly and
7
+ supplies those needs once -- Tailwind stacks a `@utility` each time a file
8
+ that defines it is imported or referenced, so a second route to `box.css`
9
+ doubles every `@apply box`. See docs/internal/model.md (One route to each
10
+ utility). */
11
+ @import "./button.rules.css";