@anyblades/blades 0.28.0-alpha.5 → 0.28.0-alpha.7

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,14 @@ 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:code-->
56
+ ```css */
61
57
 
62
58
  .breakout,
63
59
  .breakout-all {
@@ -141,60 +137,61 @@ Table of contents (`[data-is-toc]`) has auto-columns by default.
141
137
  }
142
138
 
143
139
  /*```
144
- <!--section:docs,summary-->
140
+ <!--section:summary-->
145
141
 
146
- Framework-agnostic utilities for breaking out images and figures beyond their container width.
147
-
148
- Use the `.breakout` class to allow elements to extend beyond their parent container.
142
+ The `.breakout` layout allows images, tables, and other figures to automatically extend or bleed beyond their parent container’s width.
149
143
 
150
144
  <!--section:docs-->
151
145
 
146
+ ### Demo <!-- inside parent .breakout -->
147
+
148
+ Break out a wide image from the text flow:
149
+
150
+ <div><!-- Dummy div to avoid p tag in Markdown --></div><img
151
+ 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>">
152
+
153
+ Or table:
154
+
155
+ | Imagine<hr> | a<hr> | really<hr> | wide<hr> | table<hr> | here<hr> |
156
+ | ----------- | ----- | ---------- | -------- | --------- | -------- |
157
+ | ... |
158
+
159
+ Or code block:
160
+
152
161
  ```html
153
- <div class="breakout">
154
- <img src="image.jpg" alt="Description" />
155
- </div>
162
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quod. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quod.</p>
156
163
  ```
157
164
 
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.
165
+ Or anything else:
159
166
 
160
- <!--section--> */
167
+ <article class="breakout-item-max" data-theme="dark">
161
168
 
162
- /* Content */
169
+ Using `.breakout-item` and `.breakout-item-max` helpers {style=margin:0}
170
+ </article>
163
171
 
164
- /* Extends https://github.com/picocss/pico/blob/main/scss/content/_typography.scss
165
- <!--section:docs-intro-->
172
+ <div><hr></div>
166
173
 
167
- Global styles:
168
- ```css */
174
+ `.breakout-all` also visually breaks out headings and horizontal rules:
169
175
 
170
- html {
171
- /* Enable font smoothing */
172
- -webkit-font-smoothing: antialiased;
173
- -moz-osx-font-smoothing: grayscale;
174
- }
176
+ <h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5><h6>Heading 6</h6>
177
+ <hr>
175
178
 
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
- }
179
+ <!--section--> */
187
180
 
188
- /*```
181
+ /* Content */
182
+
183
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_typography.scss
189
184
  <!--section:docs-->
190
185
 
191
186
  ### Heading anchors
192
187
 
193
- Set `data-is-anchor` attribute on anchors inside headings to position them absolutely, and show only on hover (when supported):
188
+ Links with `href="#..."` inside headings are automatically displayed as anchors:
194
189
 
195
- <article><h2>Heading with anchor <a href="#hwa" data-is-anchor>#</a></h2></article>
190
+ <article>
191
+ <h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a href="#hwa" style="visibility: visible">#</a></h2>
192
+ </article>
196
193
 
197
- How it works:
194
+ <details>How it works:
198
195
  ```css */
199
196
 
200
197
  h1,
@@ -205,7 +202,7 @@ h5,
205
202
  h6 {
206
203
  position: relative;
207
204
 
208
- [data-is-anchor] {
205
+ a[href^="#"] {
209
206
  position: absolute;
210
207
  right: 100%;
211
208
  top: 50%;
@@ -215,10 +212,9 @@ h6 {
215
212
  text-decoration: none;
216
213
  visibility: hidden;
217
214
  }
218
- /* Avoid double-tap on touch devices */
219
- @media (hover: hover) {
215
+ @media /* to avoid double-tap on touch devices */ (hover: hover) {
220
216
  &:hover {
221
- [data-is-anchor] {
217
+ a[href^="#"] {
222
218
  visibility: visible;
223
219
  }
224
220
  }
@@ -226,22 +222,28 @@ h6 {
226
222
  }
227
223
 
228
224
  /*```
229
- > **PRO-TIP** for 11ty + markdown-it-anchor: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
225
+ </details>
226
+
227
+ **PRO** example of automatic anchors for `11ty`+`markdown-it-anchor`: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
230
228
 
231
229
  ### List markers
232
230
 
233
- Use inline `style="--list-marker:'🥷 '"` on `<ul>/<ol>` or even individual `<li>` to customize list markers:
231
+ Customize markers using inline `style="--list-marker:..."` on `<ul>/<ol>` or even individual `<li>`:
232
+
234
233
  <article>
235
234
 
236
- - Customize
237
- - list
238
- - markers
239
- - with [Blades CSS](https://blades.ninja/css/) {style="--list-marker:'🥷 '"}
235
+ - you
236
+ - can
237
+ - make
238
+ - really
239
+ - cool markers {style="--list-marker:'🧊 '"}
240
+ - with
241
+ - *Bl*ades {style="--list-marker:'🥷 '"}
240
242
 
241
- {style="--list-marker:'🧊 '"}
243
+ {style="--list-marker:' '"}
242
244
  </article>
243
245
 
244
- How it works:
246
+ <details>How it works:
245
247
  ```css */
246
248
 
247
249
  ul,
@@ -253,21 +255,33 @@ ol {
253
255
  list-style-type: inherit;
254
256
  }
255
257
  }
256
-
257
258
  li[style*="--list-marker:"] {
258
259
  list-style-type: var(--list-marker);
259
260
  }
260
261
  li[data-marker]::marker {
261
- /* ⚠️ `data-marker` works only in Chrome and Firefox */
262
- content: attr(data-marker) " ";
262
+ content: attr(data-marker) " "; /* ⚠️ Chrome and Firefox only */
263
263
  }
264
264
  }
265
265
 
266
266
  /*```
267
+ </details>
267
268
 
268
269
  ### Unlist
269
270
 
270
- Helper class to remove list styling at all:
271
+ `.unlist` removes list styling:
272
+
273
+ <article>
274
+
275
+ - One: <article>1</article>
276
+ - Two: <article>2</article>
277
+ - Three: <article>3</article>
278
+
279
+ {.unlist .grid style=margin:0}
280
+ </article>
281
+
282
+ `.unlist-all` also removes styling from all nested lists.
283
+
284
+ <details>How it works:
271
285
  ```css */
272
286
 
273
287
  ul,
@@ -284,6 +298,7 @@ ol {
284
298
  }
285
299
 
286
300
  /*```
301
+ </details>
287
302
  <!--section--> */
288
303
 
289
304
  /* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
@@ -323,84 +338,85 @@ a {
323
338
  }
324
339
 
325
340
  /*```
326
- > **PRO-TIP** for 11ty: https://blades.ninja/build-awesome-11ty/processors/#auto-link-favicons
341
+ How we made it: https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e-e111869d5237
327
342
 
328
- <!--section:docs,summary-->
343
+ **PRO** example of automatic favicons for `11ty`: https://blades.ninja/build-awesome-11ty/processors/#auto-link-favicons
329
344
 
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.
345
+ <!--section:summary-->
346
+
347
+ Use *Bl*ades `<i>`-helper to wrap emojis, favicons, or simply drop Font Awesome icons inside links.
348
+ It automatically handles sizing and alignment while preventing underline on icons.
331
349
 
332
350
  <!--section:docs-->
333
351
 
334
- Compare:
352
+ <article class="breakout-item">
335
353
 
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>` |
354
+ | Use `<i>`-helper with | Clean HTML without `<span>ning` |
355
+ | ------------------------------------------------------------------------------------- | ------------------------------------ |
356
+ | [<i>🥷</i> Emojis](#) | `<a><i>🥷</i> Text</a>` |
357
+ | [<i>![](https://www.google.com/s2/favicons?domain=any.digital&sz=64)</i> Favicons](#) | `<a><i><img src="..."></i> Text</a>` |
358
+ | [<i class="fa-brands fa-github fa-lg"></i> Font Awesome icons](#) | `<a><i class="fa-..."></i> Text</a>` |
359
+ </article>
341
360
 
342
- ---
361
+ Or even for:
343
362
 
344
- [How we made it ↗ &nbsp;<small>(on Codepen)</small>](https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e-e111869d5237){role=button .outline}
363
+ <article>
364
+ <a href="#" style="margin: 0 0 0 1rem"><i>🥷</i> very-very-very-very-very-<br>long-multiline-links</a>
365
+ </article>
345
366
 
346
367
  <!--section--> */
347
368
 
348
369
  /* Extends https://github.com/picocss/pico/blob/main/scss/content/_table.scss
349
370
  <!--section:docs-->
350
371
 
351
- ### Horizontal expanders
372
+ ### Column expanders
352
373
 
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>
361
-
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>
366
-
367
- 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
372
-
373
- How it works:
374
+ Place `<hr>` element inside `<th>` column to expand it horizontally:
375
+
376
+ <article>
377
+
378
+ | Column with `<hr>`<hr> | Same column without `<hr>` | ... {style=width:100%} |
379
+ | --- | --- | --- |
380
+ | (012) 345-6789 | (012) 345-6789 |
381
+ </article>
382
+
383
+ Living examples of big tables with `<hr>`-expanders: <!--A-Z-->
384
+ - https://blades.ninja/ai/ide/
385
+ - https://blades.ninja/build-awesome-11ty/starters/
386
+ - https://blades.ninja/css/frameworks/
387
+ - https://blades.ninja/ssg/
388
+
389
+ <details>How it works:
374
390
  ```css */
375
391
 
376
- table {
377
- th {
378
- hr {
379
- width: 12ch; /* min ~65/12 = ~5 cols */
380
- height: 0;
381
- margin: 0;
382
- visibility: hidden;
392
+ th {
393
+ hr {
394
+ width: 12ch; /* min ~65/12 = ~5 cols */
395
+ height: 0;
396
+ margin: 0;
397
+ visibility: hidden;
383
398
 
384
- &.lg {
385
- width: 18ch;
386
- }
387
- &.x2 {
388
- width: 24ch;
389
- }
399
+ &.lg {
400
+ width: 18ch;
401
+ }
402
+ &.x2 {
403
+ width: 24ch;
390
404
  }
391
405
  }
392
406
  }
393
407
 
394
408
  /*```
409
+ </details>
410
+
395
411
  ### Borderless table
396
412
 
397
- `<table class="borderless">` removes all default borders:
413
+ `.borderless` removes all default borders:
398
414
 
399
415
  <article>
400
416
 
401
417
  | Less | borders |
402
418
  | ---- | ------- |
403
- | more | fun |
419
+ | More | fun |
404
420
 
405
421
  {.borderless}
406
422
  </article>
@@ -416,7 +432,8 @@ table.borderless {
416
432
  }
417
433
  }
418
434
 
419
- /* <!--section:code-->
435
+ /*
436
+ <!--section:code-->
420
437
  ```css */
421
438
 
422
439
  table.responsive,
@@ -444,17 +461,17 @@ table.responsive,
444
461
  }
445
462
 
446
463
  /*```
447
- <!--#TODO:css-blade-->
448
- Soft-increase selector specificity trick:
464
+ `table:not(.does-not-exist)` trick (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
449
465
 
450
- `table:not(.does-not-exist)` (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
466
+ <!--section:summary-->
451
467
 
452
- <!--section:docs,summary-->
453
-
454
- `<table class="responsive">` allows a table to full-bleed and scroll on mobile.
468
+ `.responsive` makes a table full-bleed and scroll on mobile, without a need for a redundant wrapper (finally).
469
+ Tables inside https://blades.ninja/css/breakout/ are responsive by default.
455
470
 
456
471
  <!--section:docs-->
457
472
 
473
+ ### Demo table
474
+
458
475
  | Term | Description <hr class="x2"> | Link |
459
476
  | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
460
477
  | 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,27 +480,35 @@ Soft-increase selector specificity trick:
463
480
 
464
481
  ---
465
482
 
466
- Tables inside https://blades.ninja/css/breakout/ are responsive by default.
467
-
468
- Living examples:
469
-
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
483
+ Living examples: <!--A-Z-->
484
+ - https://blades.ninja/ai/ide/
485
+ - https://blades.ninja/build-awesome-11ty/starters/
486
+ - https://blades.ninja/css/frameworks/
487
+ - https://blades.ninja/ssg/
474
488
 
475
489
  <!--section--> */
476
490
 
477
- /* <!--section:docs-->
491
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_code.scss
492
+ <!--section:docs-->
493
+
478
494
  ### Code
479
- Extends https://github.com/picocss/pico/blob/main/scss/content/_code.scss
495
+
496
+ The `<pre><code>` blocks are Prism-compatible and support captions via `data-caption="..."` attribute:
497
+
498
+ ```treeview {data-caption="Blades CSS:"}
499
+ ./assets/
500
+ ├── blades.core.css # reusable class-light utilities, unthemed
501
+ ├── blades.theme.css # minimal opinionated theme
502
+ └── blades.css # above two together
503
+ ```
504
+ <details>How it works:
480
505
  ```css */
481
506
 
482
507
  pre {
483
508
  padding: 1rem 1.5rem;
484
509
  padding-inline-end: 2rem;
485
510
 
486
- @media screen and (max-width: 767px) {
511
+ @media (max-width: 767px) {
487
512
  border-radius: 0;
488
513
  }
489
514
  }
@@ -505,7 +530,7 @@ code {
505
530
  }
506
531
  }
507
532
 
508
- /*** Extends https://github.com/PrismJS/prism/blob/master/plugins/treeview/prism-treeview.css ***/
533
+ /* Extends https://github.com/PrismJS/prism/blob/master/plugins/treeview/prism-treeview.css */
509
534
 
510
535
  .token.treeview-part {
511
536
  .entry-line {
@@ -521,7 +546,9 @@ code {
521
546
  }
522
547
  }
523
548
 
524
- /*``` <!--section--> */
549
+ /*```
550
+ </details>
551
+ <!--section--> */
525
552
 
526
553
  /* Forms */
527
554
 
@@ -574,44 +601,68 @@ Historically, this was not possible: the float label had to be placed after the
574
601
 
575
602
  /* Utilities */
576
603
 
577
- /*
604
+ /* Extends https://github.com/picocss/pico/tree/main/scss/utilities
578
605
  <!--section:docs-->
579
606
 
580
607
  ### Auto-dark
608
+
609
+ `.dark-auto` automatically creates a simple dark version of any element:
610
+
611
+ <article data-theme="dark">
612
+ <p>Look how cool <big class="dark-auto">🔥🕷️🐦‍⬛🐄🦓</big> can look in the dark!</p>
613
+ </article>
614
+
615
+ <details>How it works:
581
616
  ```css */
582
617
 
583
- @media (prefers-color-scheme: dark) {
584
- :root:not([data-theme="light"]) {
585
- .dark-auto {
586
- filter: invert(100%) hue-rotate(180deg);
587
- }
618
+ /* Per https://picocss.com/docs/css-variables#css-variables-for-color-schemes */
619
+
620
+ :root {
621
+ --blades-dark-filter: invert(100%) hue-rotate(180deg);
622
+ }
623
+
624
+ .dark-auto {
625
+ /* Dark color scheme (Auto) */
626
+ @media (prefers-color-scheme: dark) {
627
+ filter: var(--blades-dark-filter);
628
+ }
629
+ /* Dark color scheme (Forced) */
630
+ &[data-theme="dark"],
631
+ &:where([data-theme="dark"] *) {
632
+ filter: var(--blades-dark-filter);
588
633
  }
589
634
  }
590
635
 
591
636
  /*```
637
+ </details>
592
638
 
593
639
  ### Faded
640
+
641
+ `.faded` reduces the opacity of an element:
642
+
643
+ <article class="faded">
644
+ Hover to unfade me!
645
+ </article>
646
+
647
+ <details>How it works:
594
648
  ```css */
595
649
 
596
650
  .faded {
597
651
  opacity: 50%;
652
+
598
653
  &:hover {
599
654
  opacity: 87.5%;
600
655
  }
601
656
  }
602
657
 
603
658
  /*```
659
+ </details>
660
+ <!--section--> */
604
661
 
605
- ### Invert
606
- ```css */
607
-
608
- /* Extends https://tailwindcss.com/docs/filter-invert */
662
+ /* Fix the scrollbar color when inverted by https://tailwindcss.com/docs/filter-invert */
609
663
 
610
664
  .invert {
611
- /* Fix the scrollbar color when inverted */
612
665
  ::-webkit-scrollbar {
613
666
  filter: invert(1) !important;
614
667
  }
615
668
  }
616
-
617
- /*``` <!--section--> */