@codenhub/styles 0.7.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 (121) hide show
  1. package/README.es.md +8 -7
  2. package/README.md +7 -6
  3. package/README.pt-BR.md +8 -7
  4. package/dist/aesthetics/chunky-tile.css +1 -1
  5. package/dist/aesthetics/cyber.css +1 -1
  6. package/dist/aesthetics/glass.css +1 -1
  7. package/dist/aesthetics/index.css +2 -2
  8. package/dist/aesthetics/neobrutalism.css +1 -1
  9. package/dist/aesthetics/sketch.css +1 -1
  10. package/dist/cli.js +189 -0
  11. package/dist/components.css +2 -2
  12. package/dist/index.css +2 -2
  13. package/dist/index.d.ts +1 -0
  14. package/dist/native.css +2 -2
  15. package/dist/palette.css +1 -1
  16. package/dist/theme.css +2 -2
  17. package/docs/accessibility.md +46 -27
  18. package/docs/changelog/0.8.0.md +70 -0
  19. package/docs/changelog/index.md +1 -0
  20. package/docs/es/accessibility.md +47 -28
  21. package/docs/es/index.md +3 -2
  22. package/docs/es/integrating/index.md +38 -10
  23. package/docs/es/integrating/tailwind.md +78 -8
  24. package/docs/es/integrating/without-a-bundler.md +128 -5
  25. package/docs/es/setup.md +42 -34
  26. package/docs/es/usage/aesthetics.md +19 -13
  27. package/docs/es/usage/buttons.md +6 -2
  28. package/docs/es/usage/composing.md +6 -2
  29. package/docs/es/usage/content-and-layout.md +8 -4
  30. package/docs/es/usage/customizing.md +19 -13
  31. package/docs/es/usage/feedback.md +5 -1
  32. package/docs/es/usage/forms.md +29 -4
  33. package/docs/es/usage/index.md +6 -2
  34. package/docs/es/usage/presets.md +92 -0
  35. package/docs/es/usage/solo.md +4 -2
  36. package/docs/es/usage/theming.md +28 -15
  37. package/docs/index.md +2 -1
  38. package/docs/integrating/index.md +38 -10
  39. package/docs/integrating/tailwind.md +77 -7
  40. package/docs/integrating/without-a-bundler.md +127 -4
  41. package/docs/pt-BR/accessibility.md +47 -28
  42. package/docs/pt-BR/index.md +3 -2
  43. package/docs/pt-BR/integrating/index.md +38 -10
  44. package/docs/pt-BR/integrating/tailwind.md +78 -8
  45. package/docs/pt-BR/integrating/without-a-bundler.md +128 -5
  46. package/docs/pt-BR/setup.md +42 -34
  47. package/docs/pt-BR/usage/aesthetics.md +19 -13
  48. package/docs/pt-BR/usage/buttons.md +6 -2
  49. package/docs/pt-BR/usage/composing.md +6 -2
  50. package/docs/pt-BR/usage/content-and-layout.md +8 -4
  51. package/docs/pt-BR/usage/customizing.md +19 -13
  52. package/docs/pt-BR/usage/feedback.md +5 -1
  53. package/docs/pt-BR/usage/forms.md +29 -4
  54. package/docs/pt-BR/usage/index.md +6 -2
  55. package/docs/pt-BR/usage/presets.md +92 -0
  56. package/docs/pt-BR/usage/solo.md +4 -2
  57. package/docs/pt-BR/usage/theming.md +21 -8
  58. package/docs/setup.md +30 -22
  59. package/docs/usage/aesthetics.md +18 -12
  60. package/docs/usage/buttons.md +5 -1
  61. package/docs/usage/composing.md +5 -1
  62. package/docs/usage/content-and-layout.md +7 -3
  63. package/docs/usage/customizing.md +18 -12
  64. package/docs/usage/feedback.md +4 -0
  65. package/docs/usage/forms.md +28 -3
  66. package/docs/usage/index.md +5 -1
  67. package/docs/usage/presets.md +91 -0
  68. package/docs/usage/solo.md +3 -1
  69. package/docs/usage/theming.md +20 -7
  70. package/llms-full.txt +592 -115
  71. package/package.json +113 -63
  72. package/{dist/tw → tw}/aesthetics/chunky-tile.css +39 -19
  73. package/{dist/tw → tw}/aesthetics/cyber.css +15 -24
  74. package/{dist/tw → tw}/aesthetics/glass.css +105 -36
  75. package/{dist/tw → tw}/aesthetics/neobrutalism.css +37 -20
  76. package/{dist/tw → tw}/aesthetics/sketch.css +152 -133
  77. package/{dist/tw → tw}/box.css +89 -12
  78. package/tw/components/button.css +11 -0
  79. package/tw/components/button.rules.css +187 -0
  80. package/tw/components/feedback.css +11 -0
  81. package/{dist/tw/components/feedback.css → tw/components/feedback.rules.css} +134 -30
  82. package/tw/components/form.css +11 -0
  83. package/{dist/tw/components/form.css → tw/components/form.rules.css} +524 -111
  84. package/tw/components/index.css +16 -0
  85. package/tw/components/rules.css +41 -0
  86. package/tw/components/surface.css +11 -0
  87. package/tw/components/surface.rules.css +222 -0
  88. package/tw/components/tooltip.css +11 -0
  89. package/{dist/tw/components/tooltip.css → tw/components/tooltip.rules.css} +43 -27
  90. package/{dist/tw → tw}/corner.css +18 -12
  91. package/{dist/tw → tw}/elevation.css +23 -17
  92. package/{dist/tw → tw}/index.css +11 -9
  93. package/tw/index.d.ts +1 -0
  94. package/tw/intent.css +312 -0
  95. package/tw/modifiers.css +127 -0
  96. package/tw/native.css +320 -0
  97. package/tw/presentation.css +139 -0
  98. package/tw/reset.css +10 -0
  99. package/{dist/tw/reset.css → tw/reset.rules.css} +7 -8
  100. package/tw/size.css +34 -0
  101. package/tw/surface.css +9 -0
  102. package/tw/surface.rules.css +212 -0
  103. package/{dist/tw → tw}/theme.css +92 -28
  104. package/tw/typography.css +8 -0
  105. package/{dist/tw/typography.css → tw/typography.rules.css} +0 -3
  106. package/{dist/tw → tw}/utilities/content.css +183 -63
  107. package/tw/utilities/index.css +11 -0
  108. package/tw/utilities/layout.css +208 -0
  109. package/tw/utilities/rules.css +8 -0
  110. package/dist/tw/components/button.css +0 -139
  111. package/dist/tw/components/index.css +0 -35
  112. package/dist/tw/components/surface.css +0 -184
  113. package/dist/tw/intent.css +0 -229
  114. package/dist/tw/native.css +0 -203
  115. package/dist/tw/palette.css +0 -460
  116. package/dist/tw/presentation.css +0 -68
  117. package/dist/tw/surface.css +0 -61
  118. package/dist/tw/utilities/index.css +0 -6
  119. package/dist/tw/utilities/layout.css +0 -144
  120. /package/{dist/tw → tw}/aesthetics/index.css +0 -0
  121. /package/{dist/tw → tw}/aesthetics/pixel.css +0 -0
@@ -39,6 +39,13 @@
39
39
  on a field's 60% resting line, in light. See
40
40
  docs/internal/model.md#presentation. */
41
41
  --ui-control-ink: light-dark(rgb(0 0 0 / 0.55), rgb(255 255 255 / 0.55));
42
+ /* Buttons and badges keep the hairline, which needs a plate to be seen
43
+ on. Unfilled they have none -- white at 65% on a light page is 1.01:1,
44
+ an edged ghost button with no edge -- so there the neutral line is the
45
+ control one. `box` reads it only for a neutral box resolving to no
46
+ fill; the other aesthetics clear it below, so the nearest region
47
+ decides. */
48
+ --_unfilled-ink: light-dark(rgb(0 0 0 / 0.55), rgb(255 255 255 / 0.55));
42
49
  /* Nor is a line drawn on a plate: the hairline vanishes on a table's light
43
50
  plate, and its default, `.ruled`, and `.ruleless` forms would render as
44
51
  one. A table's frame and rules take the theme's ink at a fifth,
@@ -124,20 +131,41 @@
124
131
  --ui-label-tracking: initial;
125
132
  --ui-label-case: initial;
126
133
  --ui-label-shadow: initial;
134
+
135
+ /* No face of its own, so the theme's, named rather than inherited: a glass
136
+ region nested inside pixel, cyber, sketch, or chunky tile otherwise took
137
+ their face. `--font-default` is the token the reset applies to the page,
138
+ as chunky tile reads it. */
139
+ font-family: var(--font-default, ui-sans-serif, system-ui, sans-serif);
140
+ }
141
+
142
+ /* A region of another aesthetic nested in glass draws its own line. */
143
+ :is(.neobrutalism, .pixel, .chunky-tile, .cyber, .sketch) {
144
+ --_unfilled-ink: initial;
127
145
  }
128
146
 
129
147
  /* Transparency is the whole aesthetic, so the honest degradation is an opaque
130
- surface rather than a softer blur. */
131
- @media (prefers-reduced-transparency: reduce) {
148
+ surface rather than a softer blur.
149
+
150
+ Forced colours take the same branch. They repaint a background in `Canvas`
151
+ but keep its alpha -- measured in Chromium -- so the translucent ground
152
+ stayed translucent over whatever was behind it, and a liquid card's text
153
+ sat at about 2.5:1 over a busy page. An opaque ground is `Canvas` whole. */
154
+ @media (prefers-reduced-transparency: reduce), (forced-colors: active), (prefers-contrast: more) {
132
155
  .glass {
133
156
  --ui-backdrop: none;
134
157
  --ui-surface-ground: var(--color-background);
135
158
  }
136
159
  }
137
160
 
138
- @media (prefers-reduced-motion: reduce) {
161
+ /* More contrast also takes the ground whole, above, and then the white
162
+ hairline has nothing to be seen against: 1.03:1 on an opaque light page.
163
+ The line becomes the theme's control grey, above 4:1 on both grounds.
164
+ Only under this preference: reduced transparency asks for no stronger
165
+ line. See docs/accessibility.md. */
166
+ @media (prefers-contrast: more) {
139
167
  .glass {
140
- --ui-active-transform: none;
168
+ --ui-ink: var(--color-control-border);
141
169
  }
142
170
  }
143
171
 
@@ -209,10 +237,9 @@
209
237
  same element, or on a surface inside a glass region.
210
238
 
211
239
  The backdrop is liquid's lighter blur, for whatever frosts under glass and
212
- takes no layers below: a bare `<table>` under `/native`, a consumer's own
213
- `@apply surface`. The layers' selector list cannot name those, and with
214
- the backdrop cleared here they kept the clearer ground with nothing
215
- blurred behind it. A surface that does take the layers clears its own. */
240
+ takes no layers below: a bare `<table>` under `/native`. With the backdrop
241
+ cleared here it kept the clearer ground with nothing blurred behind it. A
242
+ host of the layers clears its own. */
216
243
  .glass.glass-liquid:not(.glass-solo),
217
244
  .glass .glass-liquid:not(.glass-solo) {
218
245
  --ui-ink: light-dark(rgb(255 255 255 / 0.45), rgb(255 255 255 / 0.16));
@@ -221,7 +248,7 @@
221
248
  --ui-backdrop: var(--_glass-liquid-blur);
222
249
  }
223
250
 
224
- @media (prefers-reduced-transparency: reduce) {
251
+ @media (prefers-reduced-transparency: reduce), (forced-colors: active), (prefers-contrast: more) {
225
252
  .glass.glass-liquid:not(.glass-solo),
226
253
  .glass .glass-liquid:not(.glass-solo) {
227
254
  --ui-surface-ground: var(--color-background);
@@ -234,14 +261,27 @@
234
261
  }
235
262
  }
236
263
 
237
- /* The layers: a treatment no token reaches, so a selector list glass owns and
238
- the registry records. Two pseudo-elements behind the content, the blur
239
- beneath and the lens with the rim and sheen above it. `isolation` keeps
240
- them above the element's own plate, which they then blur with the page;
241
- `position` anchors them, and a component that positions itself -- the
242
- tooltip bubble -- keeps its own. A default or `.soft` table frosts under
243
- glass, so it takes the layers too. Both slots are spent, so a host carries
244
- no `::before` or `::after` of the consumer's; the fields cannot host one.
264
+ @media (prefers-contrast: more) {
265
+ .glass.glass-liquid:not(.glass-solo),
266
+ .glass .glass-liquid:not(.glass-solo) {
267
+ --ui-ink: var(--color-control-border);
268
+ }
269
+ }
270
+
271
+ /* The layers: a treatment no token reaches. Two pseudo-elements behind the
272
+ content, the blur beneath and the lens with the rim and sheen above it.
273
+ `isolation` keeps them above the element's own plate, which they then blur
274
+ with the page; `position` anchors them, and a component that positions
275
+ itself -- the tooltip bubble -- keeps its own. Both slots are spent, so a
276
+ host carries no `::before` or `::after` of the consumer's; the fields
277
+ cannot host one.
278
+
279
+ Surfaces draw them in `surface` itself, from the flag and the values
280
+ below, so every element that applies it takes them: the package's
281
+ surfaces and a consumer's `@apply surface` alike. A selector list here
282
+ reached only the classes it named. The list below is for the two hosts
283
+ that are not surfaces, and the registry records it: a default or `.soft`
284
+ table, which frosts under glass, and a liquid button.
245
285
 
246
286
  The blur is on the layer and not on the host: an element with a backdrop
247
287
  filter of its own is a backdrop root, and a layer inside one sees only that
@@ -249,8 +289,18 @@
249
289
 
250
290
  Surfaces take the layers from a liquid scope. A region of another
251
291
  aesthetic nested inside, or of plain glass, keeps its own material and
252
- takes none; this list names the other aesthetics, and `registry.test.ts`
253
- fails when one is missing.
292
+ takes none, and a liquid region nested again inside that takes them back:
293
+ the nearest region decides. A `:not(.glass-liquid :is(...) *)` exclusion
294
+ cannot tell those two apart, since the re-entered surface also sits below
295
+ the other aesthetic, so each region writes a private flag instead and
296
+ inheritance hands a surface the nearest one's -- the way neobrutalism
297
+ rests its alert. The flag is on only for a liquid region in a glass
298
+ scope, so it alone says whether a surface takes the layers. Off, it
299
+ withholds the layers, the anchor, and the isolation, and a table or a
300
+ button gets back the backdrop the nearest region set. The list below
301
+ names the other aesthetics, and `registry.test.ts` fails when one is
302
+ missing. A region's own element is not a host: it declares the flag's
303
+ backdrop from its own, which a host would then declare from the flag.
254
304
 
255
305
  A button takes them only when it carries `.glass-liquid` itself, in a
256
306
  glass scope. Controls stay solid under a liquid region, for the reason
@@ -261,24 +311,27 @@
261
311
  plate under the rim, and `.soft` and `.ghost` are the clear panes. A
262
312
  disabled one is dimmed by `opacity`, which makes it a backdrop root, so it
263
313
  keeps the ground and the rim and bends nothing. */
314
+ .glass-liquid:not(.glass-solo):is(.glass, .glass *) {
315
+ /* A space toggle: empty is on, and `initial` makes every declaration
316
+ reading it invalid at computed-value time, which is off. */
317
+ --_glass-liquid-on: ;
318
+ --_glass-liquid-backdrop: initial;
319
+ }
320
+
321
+ .glass:not(.glass-liquid),
322
+ :is(.neobrutalism, .pixel, .chunky-tile, .cyber, .sketch) {
323
+ --_glass-liquid-on: initial;
324
+ --_glass-liquid-backdrop: var(--ui-backdrop);
325
+ }
326
+
264
327
  :is(.glass-liquid:not(.glass-solo), .glass-liquid:not(.glass-solo) *):is(.glass, .glass *):is(
265
- .card,
266
- .panel,
267
- .alert,
268
- .tooltip-bubble,
269
- .surface,
270
328
  .data-table:not(.solid, .ghost)
271
- ):not(
272
- .glass-liquid :is(.neobrutalism, .pixel, .chunky-tile, .cyber, .sketch),
273
- .glass-liquid :is(.neobrutalism, .pixel, .chunky-tile, .cyber, .sketch) *,
274
- .glass-liquid .glass:not(.glass-liquid),
275
- .glass-liquid .glass:not(.glass-liquid) *
276
- ),
329
+ ):not(.glass:not(.glass-liquid), :is(.neobrutalism, .pixel, .chunky-tile, .cyber, .sketch)),
277
330
  .btn.glass-liquid:is(.glass, .glass *) {
278
- --ui-backdrop: none;
331
+ --ui-backdrop: var(--_glass-liquid-backdrop, none);
279
332
 
280
- position: relative;
281
- isolation: isolate;
333
+ position: var(--_glass-liquid-on) relative;
334
+ isolation: var(--_glass-liquid-on) isolate;
282
335
 
283
336
  &::before,
284
337
  &::after {
@@ -287,7 +340,7 @@
287
340
  z-index: -1;
288
341
  border-radius: inherit;
289
342
  corner-shape: inherit;
290
- content: "";
343
+ content: var(--_glass-liquid-on) "";
291
344
  pointer-events: none;
292
345
  }
293
346
 
@@ -438,7 +491,8 @@
438
491
  color: var(--_solo-fg);
439
492
  }
440
493
 
441
- @media (prefers-reduced-transparency: reduce) {
494
+ /* Forced colours with it, for the reason the aesthetic class gives. */
495
+ @media (prefers-reduced-transparency: reduce), (forced-colors: active), (prefers-contrast: more) {
442
496
  .glass-solo {
443
497
  --_solo-ground: var(--color-background, light-dark(oklch(98.5% 0 0), oklch(14.5% 0 0)));
444
498
 
@@ -447,6 +501,13 @@
447
501
  }
448
502
  }
449
503
 
504
+ /* The line on an opaque ground, as the aesthetic class draws it. */
505
+ @media (prefers-contrast: more) {
506
+ .glass-solo {
507
+ --_solo-ink: var(--_solo-intent-border, var(--color-control-border, oklch(55.6% 0 0)));
508
+ }
509
+ }
510
+
450
511
  /* With `.glass-liquid`, the liquid pane: its corner and ground, and the same two
451
512
  layers behind the element's content. The element's own blur goes, for the
452
513
  backdrop-root reason the modifier gives. Both pseudo-elements are spent, so a
@@ -498,8 +559,16 @@
498
559
  }
499
560
  }
500
561
 
501
- @media (prefers-reduced-transparency: reduce) {
562
+ @media (prefers-reduced-transparency: reduce), (forced-colors: active), (prefers-contrast: more) {
502
563
  .glass-solo.glass-liquid {
503
564
  --_solo-ground: var(--color-background, light-dark(oklch(98.5% 0 0), oklch(14.5% 0 0)));
504
565
  }
505
566
  }
567
+
568
+ /* After the liquid pane's own ink, which it would otherwise override by source
569
+ order at the same specificity. */
570
+ @media (prefers-contrast: more) {
571
+ .glass-solo.glass-liquid {
572
+ --_solo-ink: var(--_solo-intent-border, var(--color-control-border, oklch(55.6% 0 0)));
573
+ }
574
+ }
@@ -108,6 +108,12 @@
108
108
  --ui-label-tracking: initial;
109
109
  --ui-label-case: initial;
110
110
  --ui-label-shadow: initial;
111
+
112
+ /* No face of its own, so the theme's, named rather than inherited: a
113
+ neobrutalist region nested inside pixel, cyber, sketch, or chunky tile
114
+ otherwise took their face. `--font-default` is the token the reset
115
+ applies to the page, as chunky tile reads it. */
116
+ font-family: var(--font-default, ui-sans-serif, system-ui, sans-serif);
111
117
  }
112
118
  }
113
119
 
@@ -138,7 +144,9 @@
138
144
  --_neo-alert-elevation: initial;
139
145
  }
140
146
 
141
- .neobrutalism .alert {
147
+ /* The class on the alert itself counts as its region, as it does for every
148
+ token: `.card.neobrutalism` takes its slab, and the alert rested flat. */
149
+ :is(.neobrutalism .alert, .alert.neobrutalism) {
142
150
  --_d-elevation: var(--_neo-alert-elevation, 0);
143
151
  }
144
152
  }
@@ -184,9 +192,6 @@
184
192
  box-shadow:
185
193
  var(--_solo-depth) var(--_solo-depth) 0 0 var(--_solo-ink),
186
194
  inset 0 0 0 100vmax var(--_solo-fill);
187
- transition:
188
- box-shadow var(--motion-duration-normal, 200ms) var(--motion-ease, cubic-bezier(0.2, 0, 0, 1)),
189
- transform var(--motion-duration-normal, 200ms) var(--motion-ease, cubic-bezier(0.2, 0, 0, 1));
190
195
  }
191
196
 
192
197
  /* An intent class on the element colours it, as on a component. Named rather
@@ -220,7 +225,33 @@
220
225
 
221
226
  /* The press, only on something pressed: an action, not disabled. A solo
222
227
  container -- a toast clicked to dismiss -- stays put, the way only `.btn` and
223
- an opted-in card press under the aesthetic class. */
228
+ an opted-in card press under the aesthetic class.
229
+
230
+ Only an action takes the press's transition. `transition` is one list, so
231
+ writing it on every solo element replaced a container's own -- a toast's
232
+ fade and height stopped animating. The travel is the independent
233
+ `translate`, so the element's own `transform` stays its own. */
234
+ .neobrutalism-solo:is(
235
+ button,
236
+ a[href],
237
+ [role="button"],
238
+ summary,
239
+ input[type="button"],
240
+ input[type="submit"],
241
+ input[type="reset"]
242
+ ) {
243
+ transition:
244
+ box-shadow var(--motion-duration-normal, 200ms) var(--motion-ease, cubic-bezier(0.2, 0, 0, 1)),
245
+ translate var(--motion-duration-normal, 200ms) var(--motion-ease, cubic-bezier(0.2, 0, 0, 1));
246
+
247
+ /* Reduced motion keeps the press and drops its motion: the element lands in
248
+ its slab at once. The near-zero duration `box` uses, so a `transitionend`
249
+ still fires. */
250
+ @media (prefers-reduced-motion: reduce) {
251
+ transition-duration: 0.01ms;
252
+ }
253
+ }
254
+
224
255
  .neobrutalism-solo:is(
225
256
  button,
226
257
  a[href],
@@ -233,19 +264,5 @@
233
264
  box-shadow:
234
265
  0 0 0 0 var(--_solo-ink),
235
266
  inset 0 0 0 100vmax var(--_solo-fill);
236
- transform: translate(var(--_solo-depth), var(--_solo-depth));
237
- }
238
-
239
- @media (prefers-reduced-motion: reduce) {
240
- .neobrutalism-solo:is(
241
- button,
242
- a[href],
243
- [role="button"],
244
- summary,
245
- input[type="button"],
246
- input[type="submit"],
247
- input[type="reset"]
248
- ):active:not(:disabled, [aria-disabled="true"]) {
249
- transform: none;
250
- }
267
+ translate: var(--_solo-depth) var(--_solo-depth);
251
268
  }