@anyblades/blades 0.28.0-alpha.4 → 0.28.0-alpha.6

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.
@@ -1,32 +1,30 @@
1
- /*** Follows https://github.com/picocss/pico/blob/main/scss/_index.scss ***/
1
+ /* Follows https://github.com/picocss/pico/blob/main/scss/_index.scss */
2
2
 
3
3
  /* Layout */
4
4
 
5
5
  /* Extends https://github.com/picocss/pico/blob/main/scss/layout/
6
- <!--section:docs-intro-->
6
+ <!--section:docs-->
7
7
 
8
- Global styles:
9
- ```css */
8
+ ### Auto-columns
10
9
 
11
- html {
12
- /* Prevent horizontal overflow and scrolling, modern way. */
13
- overflow-x: clip;
14
- }
10
+ `.columns` automatically creates columns with at least 30 characters each:
15
11
 
16
- body {
17
- /* Ensure `body` takes at least the full height of the viewport (using dynamic viewport height for better mobile support). */
18
- min-height: 100dvh;
19
- }
12
+ <article class="columns">
13
+ <p>1</p><p>2</p><p>3</p><p>4</p><p>5</p><p>6</p>
14
+ </article>
20
15
 
21
- /*```
22
- <!--section:docs-->
16
+ The smaller the font size, the more columns will be created:
23
17
 
24
- ### Auto-columns
18
+ <article class="columns" style="font-size: 65%">
19
+ <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>
20
+ </article>
21
+
22
+ Useful for tables of contents and long lists.
23
+
24
+ <details>How it works:
25
25
  ```css */
26
26
 
27
- .columns,
28
- [data-is-toc] > ul,
29
- [data-is-toc] > ol {
27
+ .columns {
30
28
  columns: 30ch auto; /* 2 cols max for 65ch container */
31
29
 
32
30
  /* Avoid breaking inside elements, such as nested lists */
@@ -36,10 +34,11 @@ body {
36
34
  }
37
35
 
38
36
  /*```
39
-
40
- Table of contents (`[data-is-toc]`) has auto-columns by default.
37
+ </details>
41
38
 
42
39
  ### Jump to top
40
+
41
+ `data-jump-to="top"` fixes element to the corner and adds extra top padding to make it easy to click:
43
42
  ```css */
44
43
 
45
44
  [data-jump-to="top"] {
@@ -47,17 +46,15 @@ Table of contents (`[data-is-toc]`) has auto-columns by default.
47
46
  bottom: 0;
48
47
  right: 0;
49
48
  padding-top: 50vh;
50
- opacity: 25%;
51
-
52
- &:hover {
53
- opacity: 75%;
54
- }
55
49
  }
56
50
 
57
51
  /*```
58
52
  <!--section--> */
59
53
 
60
- /* <!--section:code-->```css */
54
+ /*
55
+ <!--section:how-->
56
+ <details>How it works:
57
+ ```css */
61
58
 
62
59
  .breakout,
63
60
  .breakout-all {
@@ -141,60 +138,67 @@ Table of contents (`[data-is-toc]`) has auto-columns by default.
141
138
  }
142
139
 
143
140
  /*```
144
- <!--section:docs,summary-->
141
+ </details>
145
142
 
146
- Framework-agnostic utilities for breaking out images and figures beyond their container width.
143
+ <!--section:summary-->
147
144
 
148
- Use the `.breakout` class to allow elements to extend beyond their parent container.
145
+ The `.breakout` layout allows images, tables, and other figures to automatically extend or bleed beyond their parent container’s width.
149
146
 
150
147
  <!--section:docs-->
151
148
 
149
+ ### Demo <!-- inside parent .breakout -->
150
+
151
+ Break out a wide image from the text flow:
152
+
153
+ <div><!-- Dummy div to avoid p tag in Markdown --></div><img
154
+ 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>">
155
+
156
+ Or table:
157
+
158
+ | Imagine<hr> | a<hr> | really<hr> | wide<hr> | table<hr> | here<hr> |
159
+ | ----------- | ----- | ---------- | -------- | --------- | -------- |
160
+ | ... |
161
+
162
+ Or code block:
163
+
152
164
  ```html
153
- <div class="breakout">
154
- <img src="image.jpg" alt="Description" />
155
- </div>
165
+ <p>
166
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quod. Lorem ipsum dolor sit amet consectetur
167
+ adipisicing elit. Quisquam, quod.
168
+ </p>
156
169
  ```
157
170
 
158
- The breakout container has `10%` inline padding and a max-width of `calc(10% + 65ch + 10%)`. The breakout utilities support images, pictures, figures, canvas, audio, video, tables, pre, iframe, and other media elements. Tables inside `.breakout` are specifically enhanced for horizontal scrolling and full-bleed mobile display. This is automatically included when you import the stylesheet.
171
+ Or anything else:
159
172
 
160
- <!--section--> */
173
+ <article class="breakout-item-max" data-theme="dark">
161
174
 
162
- /* Content */
175
+ Using `.breakout-item` and `.breakout-item-max` helpers {style=margin:0}
163
176
 
164
- /* Extends https://github.com/picocss/pico/blob/main/scss/content/_typography.scss
165
- <!--section:docs-intro-->
177
+ </article>
166
178
 
167
- Global styles:
168
- ```css */
179
+ <div><hr></div>
169
180
 
170
- html {
171
- /* Enable font smoothing */
172
- -webkit-font-smoothing: antialiased;
173
- -moz-osx-font-smoothing: grayscale;
174
- }
181
+ `.breakout-all` also visually breaks out headings and horizontal rules:
175
182
 
176
- body {
177
- /* Evaluates the last ~4 lines of text blocks to prevent a single word from sitting on the final line. */
178
- text-wrap: pretty;
179
- /* Enable global hyphenation */
180
- hyphens: auto;
181
- /* ... except for links and tables which are better (safer) without hyphenation */
182
- a,
183
- table {
184
- hyphens: none;
185
- }
186
- }
183
+ <h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5><h6>Heading 6</h6>
184
+ <hr>
187
185
 
188
- /*```
186
+ <!--section--> */
187
+
188
+ /* Content */
189
+
190
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_typography.scss
189
191
  <!--section:docs-->
190
192
 
191
193
  ### Heading anchors
192
194
 
193
- Set `data-is-anchor` attribute on anchors inside headings to position them absolutely, and show only on hover (when supported):
195
+ Links with `href="#..."` inside headings are automatically displayed as anchors:
194
196
 
195
- <article><h2>Heading with anchor <a href="#hwa" data-is-anchor>#</a></h2></article>
197
+ <article>
198
+ <h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a href="#hwa" style="visibility: visible">#</a></h2>
199
+ </article>
196
200
 
197
- How it works:
201
+ <details>How it works:
198
202
  ```css */
199
203
 
200
204
  h1,
@@ -205,7 +209,7 @@ h5,
205
209
  h6 {
206
210
  position: relative;
207
211
 
208
- [data-is-anchor] {
212
+ a[href^="#"] {
209
213
  position: absolute;
210
214
  right: 100%;
211
215
  top: 50%;
@@ -215,10 +219,9 @@ h6 {
215
219
  text-decoration: none;
216
220
  visibility: hidden;
217
221
  }
218
- /* Avoid double-tap on touch devices */
219
- @media (hover: hover) {
222
+ @media /* to avoid double-tap on touch devices */ (hover: hover) {
220
223
  &:hover {
221
- [data-is-anchor] {
224
+ a[href^="#"] {
222
225
  visibility: visible;
223
226
  }
224
227
  }
@@ -226,22 +229,28 @@ h6 {
226
229
  }
227
230
 
228
231
  /*```
229
- > **PRO-TIP** for 11ty + markdown-it-anchor: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
232
+ </details>
233
+
234
+ **PRO** example of automatic anchors for `11ty`+`markdown-it-anchor`: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
230
235
 
231
236
  ### List markers
232
237
 
233
- Use inline `style="--list-marker:'🥷 '"` on `<ul>/<ol>` or even individual `<li>` to customize list markers:
238
+ Customize markers using inline `style="--list-marker:..."` on `<ul>/<ol>` or even individual `<li>`:
239
+
234
240
  <article>
235
241
 
236
- - Customize
237
- - list
238
- - markers
239
- - with [Blades CSS](https://blades.ninja/css/) {style="--list-marker:'🥷 '"}
242
+ - you
243
+ - can
244
+ - make
245
+ - really
246
+ - cool markers {style="--list-marker:'🧊 '"}
247
+ - with
248
+ - *Bl*ades {style="--list-marker:'🥷 '"}
240
249
 
241
- {style="--list-marker:'🧊 '"}
250
+ {style="--list-marker:' '"}
242
251
  </article>
243
252
 
244
- How it works:
253
+ <details>How it works:
245
254
  ```css */
246
255
 
247
256
  ul,
@@ -264,10 +273,22 @@ ol {
264
273
  }
265
274
 
266
275
  /*```
276
+ </details>
267
277
 
268
278
  ### Unlist
269
279
 
270
280
  Helper class to remove list styling at all:
281
+
282
+ <article>
283
+
284
+ - One: <article>1</article>
285
+ - Two: <article>2</article>
286
+ - Three: <article>3</article>
287
+
288
+ {.unlist .grid style=margin:0}
289
+ </article>
290
+
291
+ <details>How it works:
271
292
  ```css */
272
293
 
273
294
  ul,
@@ -284,10 +305,12 @@ ol {
284
305
  }
285
306
 
286
307
  /*```
308
+ </details>
287
309
  <!--section--> */
288
310
 
289
311
  /* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
290
- <!--section:code-->
312
+ <!--section:how-->
313
+ <details>How it works:
291
314
  ```css */
292
315
 
293
316
  a {
@@ -323,54 +346,58 @@ a {
323
346
  }
324
347
 
325
348
  /*```
326
- > **PRO-TIP** for 11ty: https://blades.ninja/build-awesome-11ty/processors/#auto-link-favicons
349
+ </details>
350
+
351
+ How we made it: https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e-e111869d5237
352
+
353
+ **PRO** example of automatic favicons for `11ty`: https://blades.ninja/build-awesome-11ty/processors/#auto-link-favicons
327
354
 
328
- <!--section:docs,summary-->
355
+ <!--section:summary-->
329
356
 
330
- Use Blades' `<i>`-helper to wrap emojis, favicons, or simply drop Font Awesome icons inside links. It automatically handles sizing and alignment while preventing underline on icons.
357
+ Use *Bl*ades `<i>`-helper to wrap emojis, favicons, or simply drop Font Awesome icons inside links. It automatically handles sizing and alignment while preventing underline on icons.
331
358
 
332
359
  <!--section:docs-->
333
360
 
334
- Compare:
361
+ <article class="breakout-item">
335
362
 
336
- | Without Blades <hr class="lg"> | With Blades' `<i>`-helper <hr class="lg"> | Clean HTML without `<span>ning` <hr class="x2"> |
337
- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
338
- | [🥷 Link with emoji](#) | [<i>🥷</i> Link with emoji](#) | `<a><i>🥷</i> Text</a>` |
339
- | [![](https://www.google.com/s2/favicons?domain=any.digital&sz=64) Multi-line link <br> with favicon](#) | [<i>![](https://www.google.com/s2/favicons?domain=any.digital&sz=64)</i> Multi-line link <br> with favicon](#) | `<a><i><img src="..."></i> Text</a>` |
340
- | [<b class="fa-brands fa-github fa-lg"></b> Link with Font Awesome icon](#) | [<i class="fa-brands fa-github fa-lg"></i> Link with Font Awesome icon](#) | `<a><i class="fa-..."></i> Text</a>` |
363
+ | Use `<i>`-helper with | Clean HTML without `<span>ning` |
364
+ | ------------------------------------------------------------------------------------- | ------------------------------------ |
365
+ | [<i>🥷</i> Emojis](#) | `<a><i>🥷</i> Text</a>` |
366
+ | [<i>![](https://www.google.com/s2/favicons?domain=any.digital&sz=64)</i> Favicons](#) | `<a><i><img src="..."></i> Text</a>` |
367
+ | [<i class="fa-brands fa-github fa-lg"></i> Font Awesome icons](#) | `<a><i class="fa-..."></i> Text</a>` |
368
+ </article>
341
369
 
342
- ---
370
+ Or even:
343
371
 
344
- [How we made it ↗ &nbsp;<small>(on Codepen)</small>](https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e-e111869d5237){role=button .outline}
372
+ <article>
373
+ <a href="#" style="margin: 0 0 0 1rem"><i>🥷</i> very-very-very-very-very-<br>long-multiline-links</a>
374
+ </article>
345
375
 
346
376
  <!--section--> */
347
377
 
348
378
  /* Extends https://github.com/picocss/pico/blob/main/scss/content/_table.scss
349
379
  <!--section:docs-->
350
380
 
351
- ### Horizontal expanders
381
+ ### Column expanders
352
382
 
353
- Simply insert `<hr>` inside `<th>` to forcibly widen too narrow columns (especially useful in markdown):
354
- ```html
355
- <th>Col <hr></th>
356
- ```
357
- Example table before:
358
- <article class="overflow-auto"><table>
359
- <tr><th>Wide tables</th><th>with many</th><th>columns might</th><th>get collapsed</th><th>and be really</th><th>hard to read!</th></tr>
360
- </table></article>
383
+ Place `<hr>` element inside `<th>` column to expand it horizontally:
384
+
385
+ <article>
386
+
387
+ | Column with `<hr>` <hr> | Same column without `<hr>` |
388
+ | --- | --- |
389
+ | (012) 345-6789 | (012) 345-6789 |
361
390
 
362
- Same table after adding `<hr>`-expanders:
363
- <article class="overflow-auto"><table>
364
- <tr><th>Wide tables <hr></th><th>with many <hr></th><th>columns might <hr></th><th>get collapsed <hr></th><th>and be really <hr></th><th>hard to read! <hr></th></tr>
365
- </table></article>
391
+ {style=max-width:30ch}
392
+ </article>
366
393
 
367
394
  Living examples of big tables with `<hr>`-expanders:
368
- - https://any.digital/insights/ai-ide/
369
- - https://any.digital/insights/css-frameworks/
370
- - https://any.digital/insights/ssg/
371
- - https://blades.ninja/build-awesome-11ty/#min-starters
395
+ - https://blades.ninja/ai/ide/
396
+ - https://blades.ninja/build-awesome-11ty/starters/
397
+ - https://blades.ninja/css/frameworks/
398
+ - https://blades.ninja/ssg/
372
399
 
373
- How it works:
400
+ <details>How it works:
374
401
  ```css */
375
402
 
376
403
  table {
@@ -392,9 +419,11 @@ table {
392
419
  }
393
420
 
394
421
  /*```
422
+ </details>
423
+
395
424
  ### Borderless table
396
425
 
397
- `<table class="borderless">` removes all default borders:
426
+ `.borderless` removes all default borders:
398
427
 
399
428
  <article>
400
429
 
@@ -416,7 +445,9 @@ table.borderless {
416
445
  }
417
446
  }
418
447
 
419
- /* <!--section:code-->
448
+ /*
449
+ <!--section:how-->
450
+ <details>How it works:
420
451
  ```css */
421
452
 
422
453
  table.responsive,
@@ -444,17 +475,20 @@ table.responsive,
444
475
  }
445
476
 
446
477
  /*```
447
- <!--#TODO:css-blade-->
448
- Soft-increase selector specificity trick:
478
+ </details>
449
479
 
450
- `table:not(.does-not-exist)` (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
480
+ `table:not(.does-not-exist)` trick (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
451
481
 
452
- <!--section:docs,summary-->
482
+ <!--section:summary-->
453
483
 
454
- `<table class="responsive">` allows a table to full-bleed and scroll on mobile.
484
+ `.responsive` makes a table full-bleed and scroll on mobile, without a need for a redundant wrapper (finally).
485
+
486
+ Tables inside https://blades.ninja/css/breakout/ are responsive by default.
455
487
 
456
488
  <!--section:docs-->
457
489
 
490
+ ### Demo table
491
+
458
492
  | Term | Description <hr class="x2"> | Link |
459
493
  | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
460
494
  | 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 |
@@ -463,20 +497,29 @@ Soft-increase selector specificity trick:
463
497
 
464
498
  ---
465
499
 
466
- Tables inside https://blades.ninja/css/breakout/ are responsive by default.
467
-
468
- Living examples:
500
+ Living examples: <!--A-Z-->
469
501
 
470
- - https://any.digital/insights/ai-ide/
471
- - https://any.digital/insights/css-frameworks/
472
- - https://any.digital/insights/ssg/
473
- - https://blades.ninja/build-awesome-11ty/#min-starters
502
+ - https://blades.ninja/ai/ide/
503
+ - https://blades.ninja/build-awesome-11ty/starters/
504
+ - https://blades.ninja/css/frameworks/
505
+ - https://blades.ninja/ssg/
474
506
 
475
507
  <!--section--> */
476
508
 
477
- /* <!--section:docs-->
509
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_code.scss
510
+ <!--section:docs-->
511
+
478
512
  ### Code
479
- Extends https://github.com/picocss/pico/blob/main/scss/content/_code.scss
513
+
514
+ The `<pre><code>` blocks are Prism-compatible and support captions via `data-caption="..."` attribute:
515
+
516
+ ```treeview {data-caption="Key Blades CSS files:"}
517
+ ├── blades.core.css # reusable class-light utilities, unthemed
518
+ ├── blades.theme.css # minimal opinionated theme
519
+ └── blades.css # above two together
520
+ ```
521
+
522
+ <details>How it works:
480
523
  ```css */
481
524
 
482
525
  pre {
@@ -505,7 +548,7 @@ code {
505
548
  }
506
549
  }
507
550
 
508
- /*** Extends https://github.com/PrismJS/prism/blob/master/plugins/treeview/prism-treeview.css ***/
551
+ /* Extends https://github.com/PrismJS/prism/blob/master/plugins/treeview/prism-treeview.css */
509
552
 
510
553
  .token.treeview-part {
511
554
  .entry-line {
@@ -521,7 +564,9 @@ code {
521
564
  }
522
565
  }
523
566
 
524
- /*``` <!--section--> */
567
+ /*```
568
+ </details>
569
+ <!--section--> */
525
570
 
526
571
  /* Forms */
527
572
 
@@ -574,44 +619,68 @@ Historically, this was not possible: the float label had to be placed after the
574
619
 
575
620
  /* Utilities */
576
621
 
577
- /*
622
+ /* Extends https://github.com/picocss/pico/tree/main/scss/utilities
578
623
  <!--section:docs-->
579
624
 
580
625
  ### Auto-dark
626
+
627
+ `.dark-auto` automatically creates a simple dark version of any element:
628
+
629
+ <article data-theme="dark">
630
+ <p>Look how cool <big class="dark-auto">🔥🕷️🐦‍⬛🐄🦓</big> can look in the dark!</p>
631
+ </article>
632
+
633
+ <details>How it works:
581
634
  ```css */
582
635
 
583
- @media (prefers-color-scheme: dark) {
584
- :root:not([data-theme="light"]) {
585
- .dark-auto {
586
- filter: invert(100%) hue-rotate(180deg);
587
- }
636
+ /* Per https://picocss.com/docs/css-variables#css-variables-for-color-schemes */
637
+
638
+ :root {
639
+ --blades-dark-filter: invert(100%) hue-rotate(180deg);
640
+ }
641
+
642
+ .dark-auto {
643
+ /* Dark color scheme (Auto) */
644
+ @media (prefers-color-scheme: dark) {
645
+ filter: var(--blades-dark-filter);
646
+ }
647
+ /* Dark color scheme (Forced) */
648
+ &[data-theme="dark"],
649
+ &:where([data-theme="dark"] *) {
650
+ filter: var(--blades-dark-filter);
588
651
  }
589
652
  }
590
653
 
591
654
  /*```
655
+ </details>
592
656
 
593
657
  ### Faded
658
+
659
+ `.faded` reduces the opacity of an element:
660
+
661
+ <article class="faded">
662
+ Hover to unfade me!
663
+ </article>
664
+
665
+ <details>How it works:
594
666
  ```css */
595
667
 
596
668
  .faded {
597
669
  opacity: 50%;
670
+
598
671
  &:hover {
599
672
  opacity: 87.5%;
600
673
  }
601
674
  }
602
675
 
603
676
  /*```
677
+ </details>
678
+ <!--section--> */
604
679
 
605
- ### Invert
606
- ```css */
607
-
608
- /* Extends https://tailwindcss.com/docs/filter-invert */
680
+ /* Fix the scrollbar color when inverted by https://tailwindcss.com/docs/filter-invert */
609
681
 
610
682
  .invert {
611
- /* Fix the scrollbar color when inverted */
612
683
  ::-webkit-scrollbar {
613
684
  filter: invert(1) !important;
614
685
  }
615
686
  }
616
-
617
- /*``` <!--section--> */