@anyblades/blades 2.4.9 → 3.0.0-alpha.2

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 (60) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +25 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  3. package/.prettierrc.json +6 -0
  4. package/README.md +111 -150
  5. package/_includes/blades/html.njk +1 -1
  6. package/_includes/blades/html.twig +1 -1
  7. package/context7.json +4 -0
  8. package/css/blades.css +436 -153
  9. package/css/blades.min.css +145 -0
  10. package/css/blades.standalone.css +197 -222
  11. package/css/blades.standalone.min.css +37 -0
  12. package/css/{blades.ninja.css → ninja.css} +7 -2
  13. package/css/ninja.min.css +5 -0
  14. package/css/pico.conditional.css +3189 -0
  15. package/css/pico.conditional.min.css +107 -0
  16. package/css/pico.css +3186 -0
  17. package/css/pico.min.css +105 -0
  18. package/css/postcss.config.js +23 -0
  19. package/index.html +63 -0
  20. package/package.json +27 -11
  21. package/src/blades.css +4 -3
  22. package/src/blades.standalone.css +2 -2
  23. package/src/{blades.ninja.css → ninja.css} +7 -2
  24. package/src/pico/_components.css +974 -0
  25. package/src/pico/_content.css +608 -0
  26. package/src/pico/_forms.css +747 -0
  27. package/src/pico/_index.css +12 -0
  28. package/src/pico/_layout.css +128 -0
  29. package/src/pico/_utilities.css +53 -0
  30. package/src/pico/_variables.css +671 -0
  31. package/src/pico.css +1 -0
  32. package/src/standalone/_core.css +32 -0
  33. package/src/{blades.standalone.theme.css → standalone/_theme.css} +2 -2
  34. package/src/{_utilities.css → standalone/_utilities.css} +1 -1
  35. package/src/standalone/_variables.css +20 -0
  36. package/src/{link-icon.css → standalone/components/_icon-helper.css} +0 -2
  37. package/src/{components → standalone/components}/_timeline.css +1 -1
  38. package/src/{content → standalone/content}/_code.css +6 -5
  39. package/src/{content/_typography.css → standalone/content/_list.css} +4 -42
  40. package/src/standalone/content/_typography.css +38 -0
  41. package/src/{float-label.core.css → standalone/forms/_float-label.core.css} +12 -4
  42. package/src/standalone/forms/_float-label.css +2 -0
  43. package/src/{breakout.css → standalone/layout/_breakout.css} +3 -6
  44. package/src/{_layout.css → standalone/layout/_columns.css} +2 -12
  45. package/src/standalone/layout/_scroller.css +10 -0
  46. package/_config.yml +0 -5
  47. package/blades.gemspec +0 -16
  48. package/css/blades.standalone.core.css +0 -712
  49. package/css/blades.standalone.theme.css +0 -143
  50. package/css/breakout.css +0 -125
  51. package/css/float-label.core.css +0 -56
  52. package/css/float-label.css +0 -96
  53. package/css/float-label.theme.css +0 -39
  54. package/css/link-icon.css +0 -59
  55. package/css/responsive-table.css +0 -57
  56. package/src/blades.standalone.core.css +0 -23
  57. package/src/float-label.css +0 -3
  58. /package/src/{responsive-table.css → standalone/content/_table-responsive.css} +0 -0
  59. /package/src/{content → standalone/content}/_table.css +0 -0
  60. /package/src/{float-label.theme.css → standalone/forms/_float-label.theme.css} +0 -0
@@ -1,712 +0,0 @@
1
- /*\3c !--section:code-->```css */
2
-
3
- /* Follows https://github.com/picocss/pico/blob/main/scss/_index.scss */
4
-
5
- /* Layout */
6
-
7
- /*\3c !--section:columns-->
8
-
9
- `.columns` automatically creates columns with at least 30 characters each:
10
-
11
- <article class="columns">
12
- <p>1</p><p>2</p><p>3</p><p>4</p><p>5</p><p>6</p>
13
- </article>
14
-
15
- The smaller the font size, the more columns will be created:
16
-
17
- <article class="columns" style="font-size: 65%">
18
- <p>1</p><p>2</p><p>3</p><p>4</p><p>5</p><p>6</p><p>7</p><p>8</p><p>9</p>
19
- </article>
20
-
21
- Useful for tables of contents and long lists.
22
-
23
- How it works:
24
- ```css */
25
-
26
- .columns {
27
- -moz-columns: 25ch auto;
28
- columns: 25ch auto; /* common container 65ch / 25ch => 2 columns max, with a buffer for list paddings */
29
- }
30
-
31
- /* Avoid breaking inside elements, such as nested lists */
32
-
33
- .columns > * {
34
- -moz-column-break-inside: avoid;
35
- break-inside: avoid;
36
- }
37
-
38
- /*```\3c !--section:jump-->
39
-
40
- `data-jump-to="top"` fixes element to the corner and adds extra top padding to make it easy to click:
41
- ```css */
42
-
43
- [data-jump-to="top"] {
44
- position: fixed;
45
- right: 0;
46
- bottom: 0;
47
- padding-top: 50vh;
48
- }
49
-
50
- /*
51
- \3c !--section:code-->
52
- ```css */
53
-
54
- .breakout,
55
- .breakout-all {
56
- max-width: calc(10% + 65ch + 10%);
57
- /* Prepare the container for breakout elements */
58
- padding-inline: 10%;
59
- }
60
-
61
- @media (width < 768px) {
62
-
63
- .breakout,
64
- .breakout-all {
65
- max-width: calc(1rem + 65ch + 1rem);
66
- padding-inline: 1rem
67
- }
68
- }
69
-
70
- /* Breakout direct children only */
71
-
72
- .breakout > *:is(
73
- table,
74
- pre,
75
- figure, video, iframe, canvas,
76
- img, picture,
77
-
78
- .breakout-item,
79
- .breakout-item-max
80
- ),
81
- .breakout-all > *:is(
82
- table,
83
- pre,
84
- figure, video, iframe, canvas,
85
- img, picture,
86
-
87
- .breakout-item,
88
- .breakout-item-max
89
- ) {
90
- width: -moz-fit-content;
91
- width: fit-content;
92
- min-width: 100%;
93
- max-width: min(125%, 100dvw);
94
- margin-left: 50%;
95
- transform: translateX(-50%);
96
- }
97
-
98
- /* Respect img/picture min-width */
99
-
100
- .breakout > *:is(img, picture):not(.does-not-exist), .breakout-all > *:is(img, picture):not(.does-not-exist) /* soft win specificity over .breakout-item above */ {
101
- min-width: auto;
102
- }
103
-
104
- /* Max out the width of the element */
105
-
106
- .breakout > *.breakout-item-max, .breakout-all > *.breakout-item-max {
107
- width: min(125%, 100dvw) !important; /* !important is for cases like figure.breakout-item-max @TODO */
108
- }
109
-
110
- .breakout-all > *:is(h2, h3, h4, h5, h6, hr):not([class]) {
111
- position: relative;
112
- }
113
-
114
- .breakout-all > *:is(h2, h3, h4, h5, h6, hr):not([class])::before {
115
- display: block;
116
- position: absolute;
117
- background: gray;
118
- content: "";
119
- opacity: 12.5%;
120
- }
121
-
122
- .breakout-all > *:is(h2, h3, h4, h5, h6):not([class])::before {
123
- top: 50%;
124
- right: 100%;
125
- width: 10em;
126
- height: 0.25em;
127
- margin-right: 0.8ch;
128
- transform: translateY(-50%);
129
- background: linear-gradient(to left, gray, transparent);
130
- }
131
-
132
- /* @TODO: add to tricks-wiki why `*` works here, but `&` fails */
133
-
134
- .breakout-all > *:is(h2, h3, h4, h5, h6):not([class]):where(hr + *)::before {
135
- display: none !important;
136
- }
137
-
138
- .breakout-all > *:is(hr) {
139
- height: 0.5rem;
140
- overflow: visible;
141
- border: none;
142
- }
143
-
144
- .breakout-all > *:is(hr)::before {
145
- left: 50%;
146
- width: 100dvw;
147
- height: 100%;
148
- transform: translateX(-50%);
149
- }
150
-
151
- /*```
152
- \3c !--section:summary-->
153
-
154
- The `.breakout` layout allows images, tables, and other figures to automatically extend or bleed beyond their parent container’s width.
155
-
156
- \3c !--section:docs-->
157
-
158
- ### Demo \3c !-- inside parent .breakout -->
159
-
160
- Break out a wide image from the text flow:
161
-
162
- <div>\3c !-- Dummy div to avoid p tag in Markdown --></div><img
163
- src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='3000' height='300'><rect width='100%' height='100%' fill='gray'/></svg>">
164
-
165
- Or table:
166
-
167
- | Imagine<hr> | a<hr> | really<hr> | wide<hr> | table<hr> | here<hr> |
168
- | ----------- | ----- | ---------- | -------- | --------- | -------- |
169
- | ... |
170
-
171
- Or code block:
172
-
173
- ```html
174
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quod. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quod.</p>
175
- ```
176
-
177
- Or anything else:
178
-
179
- <article class="breakout-item-max" data-theme="dark">
180
-
181
- Using `.breakout-item` and `.breakout-item-max` helpers {style=margin:0}
182
- </article>
183
-
184
- <div><hr></div>
185
-
186
- `.breakout-all` also visually breaks out headings and horizontal rules:
187
-
188
- <h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5><h6>Heading 6</h6>
189
- <hr>
190
-
191
- \3c !--section--> */
192
-
193
- /* Content */
194
-
195
- /*\3c !--section:h-anchor-->
196
-
197
- Links with `href="#..."` inside headings are automatically displayed as anchors:
198
-
199
- <article>
200
- <h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a aria-hidden="true" style="visibility: visible">#</a></h2>
201
- </article>
202
-
203
- How it works:
204
- ```css */
205
-
206
- h1,
207
- h2,
208
- h3,
209
- h4,
210
- h5,
211
- h6 {
212
- position: relative;
213
- }
214
-
215
- h1 a[aria-hidden="true"], h2 a[aria-hidden="true"], h3 a[aria-hidden="true"], h4 a[aria-hidden="true"], h5 a[aria-hidden="true"], h6 a[aria-hidden="true"] {
216
- visibility: hidden;
217
- position: absolute;
218
- top: 50%;
219
- right: 100%;
220
- padding-right: 0.2ch;
221
- transform: translateY(-50%);
222
- color: silver;
223
- text-decoration: none;
224
- }
225
-
226
- @media /* to avoid double-tap on touch devices */ (hover: hover) {
227
- h1:hover a[aria-hidden="true"], h2:hover a[aria-hidden="true"], h3:hover a[aria-hidden="true"], h4:hover a[aria-hidden="true"], h5:hover a[aria-hidden="true"], h6:hover a[aria-hidden="true"] {
228
- visibility: visible;
229
- }
230
- }
231
-
232
- /*```
233
-
234
- **PRO** example of automatic anchors for `11ty`+`markdown-it-anchor`: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
235
-
236
- \3c !--section:list-->
237
-
238
- Customize markers using inline `style="--list-marker:..."` on `<ul>/<ol>` or even individual `<li>`:
239
-
240
- <article>
241
-
242
- - you
243
- - can
244
- - make
245
- - really
246
- - cool markers {style="--list-marker:'🧊 '"}
247
- - with
248
- - *Bl*ades {style="--list-marker:'🥷 '"}
249
-
250
- {style="--list-marker:'→ '"}
251
- </article>
252
-
253
- How it works:
254
- ```css */
255
-
256
- ul[style*="--list-marker:"], ol[style*="--list-marker:"] {
257
- list-style-type: var(--list-marker);
258
- }
259
-
260
- ul[style*="--list-marker:"] > li, ol[style*="--list-marker:"] > li {
261
- list-style-type: inherit;
262
- }
263
-
264
- ul li[style*="--list-marker:"], ol li[style*="--list-marker:"] {
265
- list-style-type: var(--list-marker);
266
- }
267
-
268
- ul li[data-marker]::marker, ol li[data-marker]::marker {
269
- content: attr(data-marker) " "; /* ⚠️ Chrome and Firefox only */
270
- }
271
-
272
- /*```
273
-
274
- ### Markerless
275
-
276
- `.markerless` removes markers and reduces padding:
277
-
278
- <article>
279
-
280
- - 1️⃣ so you can use
281
- - 2️⃣ emojis or images
282
- - 3️⃣ instead of bullets
283
-
284
- {.markerless}
285
- </article>
286
-
287
- How it works:
288
- ```css */
289
-
290
- ul.markerless, ol.markerless {
291
- padding-inline-start: 1.25rem;
292
- }
293
-
294
- ul.markerless li, ol.markerless li {
295
- list-style: none;
296
- }
297
-
298
- /*```
299
-
300
- ### Unlist
301
-
302
- `.unlist` removes list styling at all:
303
-
304
- <article>
305
-
306
- - One: <article>1</article>
307
- - Two: <article>2</article>
308
- - Three: <article>3</article>
309
-
310
- {.unlist .grid style=margin:0}
311
- </article>
312
-
313
- `.unlist-all` removes styling from all nested lists too.
314
-
315
- How it works:
316
- ```css */
317
-
318
- ul.unlist,
319
- ul.unlist-all,
320
- .unlist-all ul,
321
- ol.unlist,
322
- ol.unlist-all,
323
- .unlist-all ol {
324
- padding-inline-start: 0;
325
- }
326
-
327
- ul.unlist > li, ul.unlist-all > li, .unlist-all ul > li, ol.unlist > li, ol.unlist-all > li, .unlist-all ol > li {
328
- list-style: none;
329
- }
330
-
331
- /* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
332
- \3c !--section:code-->
333
- ```css */
334
-
335
- /* Use inline flex only if link contains an icon */
336
-
337
- a:not(.does-not-exist):has(> i) {
338
- display: inline-flex;
339
- overflow-y: clip; /* to work in pair with text-underline-offset in Safari */
340
- gap: 0.375ch; /* =3/8 */
341
- text-wrap: balance;
342
- }
343
-
344
- a:not(.does-not-exist) > i {
345
- float: left; /* ✅ Chrome ❌ Safari */
346
- font-style: normal;
347
- text-underline-offset: -2em; /* ❌ Chrome ✅ Safari - to clip it with overflow-y */
348
- }
349
-
350
- /* Favicons */
351
-
352
- a:not(.does-not-exist) > i > img {
353
- display: inline-block; /* for Tailwind CSS Typography */
354
- max-width: none; /* to keep ratio safe */
355
- height: 1.25em;
356
- margin-block-start: calc(-0.25em / 2);
357
- }
358
-
359
- a:not(.does-not-exist) > i[class^="fa-"],
360
- a:not(.does-not-exist) > i[class*=" fa-"] {
361
- line-height: inherit;
362
- --fa-width: auto;
363
- }
364
-
365
- /* Font Awesome */
366
-
367
- a:not(.does-not-exist) > i.fa-lg {
368
- line-height: normal;
369
- }
370
-
371
- /*```
372
- \3c !--section:summary-->
373
-
374
- Use *Bl*ades `<i>`-helper to wrap emojis, favicons, or simply drop Font Awesome icons inside links.
375
- It automatically handles sizing and alignment while preventing underline on icons.
376
-
377
- \3c !--section:docs-->
378
-
379
- <article class="breakout-item">
380
-
381
- | Use `<i>`-helper with | Clean HTML without `<span>ning` |
382
- | ------------------------------------------------------------------------------------- | ------------------------------------ |
383
- | [<i>🥷</i> Emojis](#) | `<a><i>🥷</i> Text</a>` |
384
- | [<i>![](https://www.google.com/s2/favicons?domain=any.digital&sz=64)</i> Favicons](#) | `<a><i><img src="..."></i> Text</a>` |
385
- | [<i class="fa-brands fa-github fa-lg"></i> Font Awesome icons](#) | `<a><i class="fa-..."></i> Text</a>` |
386
- </article>
387
-
388
- Or even for:
389
-
390
- <article>
391
- <a href="#" style="margin: 0 0 0 1rem"><i>🥷</i> very-very-very-very-very-<br>long-multiline-links</a>
392
- </article>
393
-
394
- How we made it: https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e-e111869d5237
395
-
396
- **PRO** example of automatic favicons for `11ty`: https://blades.ninja/build-awesome-11ty/processors/#auto-link-favicons
397
-
398
- \3c !--section--> */
399
-
400
- /*\3c !--section:docs-->
401
-
402
- ## Column expanders
403
-
404
- Place `<hr>` element inside `<th>` column to expand it horizontally:
405
-
406
- <article>
407
-
408
- | Column with `<hr>`<hr> | Same column without `<hr>` | ... {style=width:100%} |
409
- | --- | --- | --- |
410
- | (012) 345-6789 | (012) 345-6789 |
411
- </article>
412
-
413
- Living examples of big tables with `<hr>`-expanders: \3c !--A-Z-->
414
- - https://blades.ninja/ai/ide/
415
- - https://blades.ninja/build-awesome-11ty/starters/
416
- - https://blades.ninja/css/frameworks/
417
- - https://blades.ninja/ssg/
418
-
419
- How it works:
420
- ```css */
421
-
422
- th hr {
423
- visibility: hidden;
424
- width: 12ch; /* min ~65/12 = ~5 cols */
425
- height: 0;
426
- margin: 0;
427
- }
428
-
429
- th hr.lg {
430
- width: 18ch;
431
- }
432
-
433
- th hr.x2 {
434
- width: 24ch;
435
- }
436
-
437
- /*```
438
-
439
- ## Borderless table
440
-
441
- `.borderless` removes all default borders:
442
-
443
- <article>
444
-
445
- | Less | borders |
446
- | ---- | ------- |
447
- | More | fun |
448
-
449
- {.borderless}
450
- </article>
451
-
452
- \3c !--section-->*/
453
-
454
- table.borderless th,
455
- table.borderless td {
456
- border: none;
457
- }
458
-
459
- /*
460
- \3c !--section:code-->
461
- ```css */
462
-
463
- table.responsive,
464
- .breakout > table:not(.does-not-exist),
465
- .breakout-all > table:not(.does-not-exist) {
466
-
467
- /* Let them scroll */
468
- display: block;
469
-
470
- /* Let them full-bleed */
471
- width: -moz-max-content;
472
- width: max-content;
473
- min-width: auto;
474
- max-width: 100dvw;
475
- /* Center horizontally */
476
- margin-left: 50%;
477
- padding-inline: 7.5%;
478
- overflow-x: auto;
479
- transform: translateX(-50%);
480
- -webkit-overflow-scrolling: touch; /* Smooth scroll for iOS */
481
- }
482
-
483
- table.responsive th,
484
- table.responsive td,
485
- .breakout > table:not(.does-not-exist) th,
486
- .breakout > table:not(.does-not-exist) td,
487
- .breakout-all > table:not(.does-not-exist) th,
488
- .breakout-all > table:not(.does-not-exist) td {
489
- padding-inline-start: 0;
490
- }
491
-
492
- /*```
493
- `table:not(.does-not-exist)` trick (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
494
-
495
- \3c !--section:summary-->
496
-
497
- `.responsive` makes a table full-bleed and scroll on mobile, without a need for a redundant wrapper (finally).
498
- Tables inside https://blades.ninja/css/breakout/ are responsive by default.
499
-
500
- \3c !--section:docs-->
501
-
502
- ### Demo table
503
-
504
- | Term | Description <hr class="x2"> | Link |
505
- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
506
- | Responsive design | Approach to web design that aims to make web pages render well on a variety of devices and window or screen sizes from minimum to maximum display size to ensure usability and satisfaction. | https://en.wikipedia.org/wiki/Responsive_web_design |
507
-
508
- {.responsive}
509
-
510
- ---
511
-
512
- Living examples: \3c !--A-Z-->
513
- - https://blades.ninja/ai/ide/
514
- - https://blades.ninja/build-awesome-11ty/starters/
515
- - https://blades.ninja/css/frameworks/
516
- - https://blades.ninja/ssg/
517
-
518
- \3c !--section--> */
519
-
520
- /*\3c !--section:docs-->
521
-
522
- The `<pre><code>` blocks are Prism-compatible and support captions via `data-caption="..."` attribute:
523
-
524
- ```treeview {data-caption="Blades CSS:"}
525
- ./css/
526
- ├── blades.core.css # reusable class-light utilities, unthemed
527
- ├── blades.theme.css # minimal opinionated theme
528
- └── blades.css # above two together
529
- ```
530
-
531
- \3c !--section:code-->
532
- ```css */
533
-
534
- @media (width < 768px) {
535
-
536
- pre {
537
- border-radius: 0
538
- }
539
- }
540
-
541
- /* Code block caption via data-attr (to display filename, etc.) */
542
-
543
- code[data-caption]::before {
544
- display: block;
545
- margin-bottom: 1rem;
546
- content: attr(data-caption);
547
- font-style: italic;
548
- opacity: 50%;
549
- }
550
-
551
- /* Forms */
552
-
553
- /* Sources moved here from https://github.com/anyblades/float-label-css for easier maintenance
554
- \3c !--section:docs-->
555
-
556
- First, we target either:
557
- 1. `<label>` which `:has` inner form inputs (classless approach)
558
- 2. or explicit `.has-float-label` class (explicit approach)
559
-
560
- ```css */
561
-
562
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select),
563
- .has-float-label {
564
- display: block;
565
- position: relative;
566
- }
567
-
568
- /*```
569
- Then, we define the default/fallback state (when the float label should be minimized):
570
- ```css */
571
-
572
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
573
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
574
- .has-float-label > span,
575
- .has-float-label label {
576
- position: absolute;
577
- top: 0;
578
- left: 0;
579
- font-size: 75%;
580
- cursor: text;
581
- }
582
-
583
- /*```
584
- Finally, we detect if placeholder is shown, but not in focus. That means we can safely hide it, and enlarge the float label instead:
585
- ```css */
586
-
587
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:placeholder-shown:not(:focus)::-moz-placeholder, .has-float-label *:placeholder-shown:not(:focus)::-moz-placeholder {
588
- opacity: 0;
589
- }
590
-
591
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:-moz-placeholder:not(:focus)::placeholder, .has-float-label *:-moz-placeholder:not(:focus)::placeholder {
592
- opacity: 0;
593
- }
594
-
595
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:placeholder-shown:not(:focus)::placeholder, .has-float-label *:placeholder-shown:not(:focus)::placeholder {
596
- opacity: 0;
597
- }
598
-
599
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select):has(*:-moz-placeholder:not(:focus)) > span, label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select):has(*:-moz-placeholder:not(:focus)) label, .has-float-label:has(*:-moz-placeholder:not(:focus)) > span, .has-float-label:has(*:-moz-placeholder:not(:focus)) label {
600
- font-size: inherit;
601
- opacity: 50%;
602
- }
603
-
604
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select):has(*:placeholder-shown:not(:focus)) > span,
605
- label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select):has(*:placeholder-shown:not(:focus)) label,
606
- .has-float-label:has(*:placeholder-shown:not(:focus)) > span,
607
- .has-float-label:has(*:placeholder-shown:not(:focus)) label {
608
- font-size: inherit;
609
- opacity: 50%;
610
- }
611
-
612
- /*```
613
-
614
- The `:has(*:placeholder-shown:not(:focus))` trick allows this input state information to *propagate* to the parent level. This enables modern CSS to target inner float label (`<span>` or `<label>`) regardless of its position relative to the input field.
615
-
616
- Historically, this was not possible: the float label had to be placed after the input field to be targeted using the `input:focus + label` selector.
617
-
618
- \3c !--section-->*/
619
-
620
- /* Components */
621
-
622
- /*\3c !--section:docs-->
623
-
624
- Use `dl.timeline` or wrap a `<dl>` with `.has-timeline` to style it as a
625
- vertical timeline — each `<dd>` gets a left border strip acting as the track:
626
-
627
- <article class="has-timeline">
628
-
629
- May 11, 2026
630
- : First Blades CSS stable release (v2.2.0).
631
-
632
- Mar 15, 2025
633
- : Last Pico CSS update (v2.1.1).
634
-
635
- </article>
636
-
637
- \3c !--section:code-->```css */
638
-
639
- dl.timeline dd, .has-timeline > dl dd {
640
- margin-block: 0;
641
- padding: 0.25rem 0 0.75rem 1rem;
642
- border-inline-start: 0.25rem solid gray;
643
- }
644
-
645
- /* Utilities */
646
-
647
- /*\3c !--section:docs-->
648
-
649
- ## Auto-dark
650
-
651
- `.dark-auto` automatically creates a simple dark version of any element:
652
-
653
- <article data-theme="dark">
654
- <p>Look how cool <big class="dark-auto">🔥🕷️🐦‍⬛🐄🦓</big> can look in the dark!</p>
655
- </article>
656
-
657
- How it works:
658
- ```css */
659
-
660
- /* Per https://picocss.com/docs/css-variables#css-variables-for-color-schemes */
661
-
662
- :root {
663
- --blades-dark-filter: invert(100%) hue-rotate(180deg);
664
- }
665
-
666
- .dark-auto {
667
- /* Dark color scheme (Forced) */
668
- }
669
-
670
- /* Dark color scheme (Auto) */
671
-
672
- @media (prefers-color-scheme: dark) {
673
-
674
- .dark-auto {
675
- filter: var(--blades-dark-filter)
676
- }
677
- }
678
-
679
- .dark-auto[data-theme="dark"],
680
- .dark-auto:where([data-theme="dark"] *) {
681
- filter: var(--blades-dark-filter);
682
- }
683
-
684
- /*```
685
-
686
- ## Faded
687
-
688
- `.faded` reduces the opacity of an element:
689
-
690
- <article class="faded">
691
- Hover to unfade me!
692
- </article>
693
-
694
- How it works:
695
- ```css */
696
-
697
- .faded {
698
- opacity: 50%;
699
- }
700
-
701
- .faded:hover {
702
- opacity: 87.5%;
703
- }
704
-
705
- /*```
706
- \3c !--section--> */
707
-
708
- /* Fix the scrollbar color when inverted by https://tailwindcss.com/docs/filter-invert */
709
-
710
- .invert ::-webkit-scrollbar {
711
- filter: invert(1) !important;
712
- }