@anydigital/blades 0.27.0-alpha.16 → 0.27.0-beta.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.
package/assets/blades.css CHANGED
@@ -1,59 +1,76 @@
1
- /**
2
- * Follows the structure of https://github.com/picocss/pico/blob/main/scss/_index.scss
3
- */
1
+ /*** Follows https://github.com/picocss/pico/blob/main/scss/_index.scss ***/
2
+
3
+ /* Layout */
4
+
5
+ /*
6
+ <!--section:docs-->
7
+
8
+ ### Document
9
+ Extends https://github.com/picocss/pico/blob/main/scss/layout/_document.scss
10
+
11
+ Prevent horizontal overflow and scrolling, modern way:
12
+ ```css */
4
13
 
5
14
  html {
6
- /* Prevent horizontal overflow and scrolling, modern way */
7
15
  overflow-x: clip;
8
-
9
- /* Font smoothing */
10
- -webkit-font-smoothing: antialiased;
11
- -moz-osx-font-smoothing: grayscale;
12
16
  }
13
17
 
18
+ /*```
19
+
20
+ ### Landmarks
21
+ Extends https://github.com/picocss/pico/blob/main/scss/layout/_landmarks.scss
22
+
23
+ 1. Ensure `body` takes at least the full height of the viewport (using dynamic viewport height for better mobile support).
24
+ 2. Make the `body` a flex container with column layout, and `main` to automatically fill available space. This is useful for creating sticky footers and full-height layouts.
25
+ ```css */
26
+
14
27
  body {
15
- /* Ensures body takes at least the full height of the viewport (using dynamic viewport height for better mobile support) */
16
28
  min-height: 100dvh;
17
29
 
18
- /* Make the body a flex container with column layout; main fills space */
19
30
  display: flex;
20
31
  flex-direction: column;
21
32
  > main {
22
33
  flex-grow: 1;
23
34
  }
24
-
25
- /* Hyphenation */
26
- hyphens: auto;
27
- /* Links and tables are better (safer) without hyphenation */
28
- a,
29
- table {
30
- hyphens: none;
31
- }
32
35
  }
33
36
 
34
- pre {
35
- padding: 1rem 1.5rem;
36
- padding-inline-end: 2rem;
37
+ /*```
37
38
 
38
- code {
39
- padding: 0;
40
- }
39
+ ### Table of contents
40
+ ```css */
41
41
 
42
- @media screen and (max-width: 767px) {
43
- border-radius: 0;
42
+ [data-is-toc] {
43
+ font-size: 87.5%;
44
+
45
+ a {
46
+ text-decoration: none;
47
+ }
48
+ > ul {
49
+ columns: 30ch auto; /* 2 cols max for 65ch container */
44
50
  }
45
51
  }
46
52
 
47
- small {
48
- [role="button"] {
49
- padding: 0.75em 1em;
50
- font-size: inherit;
53
+ /*```
54
+
55
+ ### Jump to top
56
+ ```css */
57
+
58
+ [data-jump-to="top"] {
59
+ position: fixed;
60
+ bottom: 0;
61
+ right: 0;
62
+ padding-top: 50vh;
63
+ opacity: 25%;
64
+
65
+ &:hover {
66
+ opacity: 75%;
51
67
  }
52
68
  }
53
69
 
54
- /* Layout */
70
+ /*```
71
+ <!--section--> */
55
72
 
56
- /* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
73
+ /* <!--section:code-->```css */
57
74
 
58
75
  .breakout,
59
76
  .breakout-all {
@@ -136,9 +153,125 @@ small {
136
153
  }
137
154
  }
138
155
 
156
+ /*```<!--section:docs-->
157
+ Framework-agnostic utilities for breaking out images and figures beyond their container width.
158
+
159
+ Use the `.breakout` class to allow elements to extend beyond their parent container:
160
+
161
+ ```html
162
+ <div class="breakout">
163
+ <img src="image.jpg" alt="Description" />
164
+ </div>
165
+ ```
166
+
167
+ 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.
168
+ <!--section--> */
169
+
139
170
  /* Content */
140
171
 
141
- /* <!--section:docs-->
172
+ /*** Extends https://github.com/picocss/pico/blob/main/scss/content/_typography.scss ***/
173
+
174
+ html {
175
+ /* Enable font smoothing */
176
+ -webkit-font-smoothing: antialiased;
177
+ -moz-osx-font-smoothing: grayscale;
178
+ }
179
+
180
+ body {
181
+ /* Enable global hyphenation */
182
+ hyphens: auto;
183
+ /* ... except for links and tables which are better (safer) without hyphenation */
184
+ a,
185
+ table {
186
+ hyphens: none;
187
+ }
188
+ }
189
+
190
+ /*
191
+ <!--section:docs-->
192
+ ### Heading anchors
193
+ ```css */
194
+
195
+ h1,
196
+ h2,
197
+ h3,
198
+ h4,
199
+ h5,
200
+ h6 {
201
+ position: relative;
202
+
203
+ [data-is-anchor] {
204
+ visibility: hidden;
205
+ position: absolute;
206
+ top: 0;
207
+ right: 100%;
208
+ padding-right: 0.2ch;
209
+ color: silver;
210
+ text-decoration: none;
211
+ }
212
+ &:hover {
213
+ [data-is-anchor] {
214
+ visibility: visible;
215
+ }
216
+ }
217
+ }
218
+
219
+ /*```
220
+
221
+ ### List markers
222
+ ```css */
223
+
224
+ ul,
225
+ ol {
226
+ li[data-marker]::marker {
227
+ content: attr(data-marker) " ";
228
+ }
229
+
230
+ &.unlist {
231
+ padding-inline-start: 0;
232
+
233
+ > li {
234
+ list-style: none;
235
+ }
236
+ }
237
+ }
238
+
239
+ /*``` <!--section--> */
240
+
241
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
242
+ <!--section:code-->```css */
243
+
244
+ a {
245
+ /* Helper to handle icons in links */
246
+ > i {
247
+ display: inline-block;
248
+ font-style: normal;
249
+ }
250
+
251
+ /* Helper for favicons in links */
252
+ &[data-has-favicon] {
253
+ display: inline-block;
254
+
255
+ > img {
256
+ max-height: 1.25em;
257
+ margin-top: calc(-0.25em / 2);
258
+ margin-inline-end: 0.375ch; /* =3/8 */
259
+
260
+ /* for tw-typography (.prose) */
261
+ display: inline-block;
262
+ margin-bottom: 0;
263
+ }
264
+ }
265
+ }
266
+
267
+ /*```
268
+ <!--section:docs-->
269
+ ### Link [fav]icons
270
+ <!--section--> */
271
+
272
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_table.scss
273
+ <!--section:docs-->
274
+
142
275
  ### Horizontal expanders
143
276
 
144
277
  Simply insert `<hr>` inside `<th>` to forcibly widen too narrow columns (especially useful in markdown):
@@ -177,17 +310,13 @@ table {
177
310
  ---
178
311
  ### Borderless table
179
312
 
180
- `.borderless` removes all default borders:
181
- | Less | | Borders |
182
- | ---- | ---------- | ------- |
183
- | | ↗<br>↙ | |
184
- | More | | Fun |
313
+ `<table class="borderless">` removes all default borders:
314
+ | Less | | Borders |
315
+ | ---- | --- | ------- |
316
+ | More | | Fun |
185
317
 
186
318
  {.borderless}
187
319
 
188
- ```html
189
- <table class="borderless">...</table>
190
- ```
191
320
  Living example: https://bladeswitch.com/#minimal-dependencies table
192
321
  <!--section--> */
193
322
 
@@ -225,13 +354,13 @@ table.responsive,
225
354
  }
226
355
  }
227
356
 
228
- /*```<!--#TODO:css-blade-->
357
+ /*```
358
+ <!--#TODO:css-blade-->
229
359
  Soft-increase selector specificity trick:
230
360
 
231
361
  `table:not(.does-not-exist)` (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
232
362
  <!--section:docs-->
233
- ### Responsive table without wrapper
234
- `.responsive` allows a table to full-bleed and scroll on mobile:
363
+ `<table class="responsive">` allows a table to full-bleed and scroll on mobile:
235
364
  <div>
236
365
 
237
366
  | Term | Description <hr class="x2"> | Link |
@@ -244,125 +373,76 @@ Soft-increase selector specificity trick:
244
373
  Tables inside `.breakout[-all]` are responsive by default.
245
374
  <!--section--> */
246
375
 
247
- /* Utilities */
248
-
249
- /* Header anchors @TODO: add to tricks-wiki */
376
+ /* <!--section:docs-->
377
+ ### Code
378
+ Extends https://github.com/picocss/pico/blob/main/scss/content/_code.scss
379
+ ```css */
250
380
 
251
- h1,
252
- h2,
253
- h3,
254
- h4,
255
- h5,
256
- h6 {
257
- position: relative;
381
+ pre {
382
+ padding: 1rem 1.5rem;
383
+ padding-inline-end: 2rem;
258
384
 
259
- [data-is-anchor] {
260
- visibility: hidden;
261
- position: absolute;
262
- top: 0;
263
- right: 100%;
264
- padding-right: 0.2ch;
265
- color: silver;
266
- text-decoration: none;
267
- }
268
- &:hover {
269
- [data-is-anchor] {
270
- visibility: visible;
271
- }
385
+ @media screen and (max-width: 767px) {
386
+ border-radius: 0;
272
387
  }
273
388
  }
274
389
 
275
- /* Helper to handle icons in links */
276
-
277
- a > i {
278
- display: inline-block;
279
- /* margin-inline-end: 0.375ch; safer to use &nbsp;? */ /* =3/8 */
280
- font-style: normal;
281
- }
282
-
283
- /* Favicons in links @TODO: add to tricks-wiki */
284
-
285
- a[data-has-favicon] {
286
- display: inline-block;
287
-
288
- > img {
289
- max-height: 1.25em;
290
- margin-top: calc(-0.25em / 2);
291
- margin-inline-end: 0.375ch; /* =3/8 */
292
-
293
- /* for tw-typography (.prose) */
294
- display: inline-block;
295
- margin-bottom: 0;
390
+ code {
391
+ /* Code block caption via data-attr (to display filename, etc.) */
392
+ &[data-caption] {
393
+ &::before {
394
+ content: attr(data-caption);
395
+ display: block;
396
+ margin-bottom: 1rem;
397
+ opacity: 50%;
398
+ font-style: italic;
399
+ }
296
400
  }
297
- }
298
401
 
299
- code[data-caption] {
300
- &::before {
301
- content: attr(data-caption);
302
- display: block;
303
- margin-bottom: 1rem;
304
- opacity: 50%;
305
- font-style: italic;
402
+ &:where(pre > *) {
403
+ padding: 0;
306
404
  }
307
405
  }
308
406
 
309
- /* Tailwind tricks */
407
+ /*** Extends https://github.com/PrismJS/prism/blob/master/plugins/treeview/prism-treeview.css ***/
310
408
 
311
- .invert {
312
- /* Fix the scrollbar color when inverted */
313
- ::-webkit-scrollbar {
314
- filter: invert(1) !important;
409
+ .token.treeview-part {
410
+ .entry-line {
411
+ width: 2.5em !important;
412
+ opacity: 25%;
315
413
  }
316
- }
317
-
318
- /* Jump to top trick */
319
-
320
- [data-jump-to="top"] {
321
- position: fixed;
322
- bottom: 0;
323
- right: 0;
324
- padding-top: 50vh;
325
- opacity: 25%;
414
+ .entry-name:last-child {
415
+ opacity: 50%;
326
416
 
327
- &:hover {
328
- opacity: 75%;
417
+ &::before {
418
+ display: none !important;
419
+ }
329
420
  }
330
421
  }
331
422
 
332
- /* Table of contents */
423
+ /*``` <!--section--> */
333
424
 
334
- [data-is-toc] {
335
- font-size: 87.5%;
425
+ /* Utilities */
336
426
 
337
- a {
338
- text-decoration: none;
339
- }
340
- > ul {
341
- columns: 30ch auto; /* 2 cols max for 65ch container */
342
- }
343
- }
427
+ /*
428
+ <!--section:docs-->
344
429
 
345
- /* @TODO: to TRICKS */
430
+ ### Auto-columns
431
+ ```css */
346
432
 
347
433
  .columns {
348
- columns: 20ch auto; /* 3 cols max for 65ch container */
349
- }
434
+ columns: 30ch auto; /* 2 cols max for 65ch container */
350
435
 
351
- /* @TODO: to TRICKS */
352
-
353
- ul,
354
- ol {
355
- li[data-marker]::marker {
356
- content: attr(data-marker) " ";
436
+ /* Avoid breaking inside elements, such as nested lists */
437
+ > * {
438
+ break-inside: avoid;
357
439
  }
358
440
  }
359
441
 
360
- .faded {
361
- opacity: 50%;
362
- &:hover {
363
- opacity: 87.5%;
364
- }
365
- }
442
+ /*```
443
+
444
+ ### Auto-dark
445
+ ```css */
366
446
 
367
447
  @media (prefers-color-scheme: dark) {
368
448
  :root:not([data-theme="light"]) {
@@ -372,20 +452,25 @@ ol {
372
452
  }
373
453
  }
374
454
 
375
- /* 3rd-party */
455
+ /*```
376
456
 
377
- /* Prism.js */
457
+ ### Misc
458
+ ```css */
378
459
 
379
- .token.treeview-part {
380
- .entry-line {
381
- width: 2.5em !important;
382
- opacity: 25%;
460
+ .faded {
461
+ opacity: 50%;
462
+ &:hover {
463
+ opacity: 87.5%;
383
464
  }
384
- .entry-name:last-child {
385
- opacity: 50%;
465
+ }
386
466
 
387
- &::before {
388
- display: none !important;
389
- }
467
+ /* Extends https://tailwindcss.com/docs/filter-invert */
468
+
469
+ .invert {
470
+ /* Fix the scrollbar color when inverted */
471
+ ::-webkit-scrollbar {
472
+ filter: invert(1) !important;
390
473
  }
391
474
  }
475
+
476
+ /*``` <!--section--> */
@@ -1,5 +1,4 @@
1
- /* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
2
-
1
+ /* <!--section:code-->```css */
3
2
  .breakout,
4
3
  .breakout-all {
5
4
  /* Prepare the container for breakout elements */
@@ -35,7 +34,6 @@
35
34
  }
36
35
  }
37
36
  }
38
-
39
37
  .breakout-all > * {
40
38
  &:is(h2, h3, h4, h5, h6, hr):not([class]) {
41
39
  position: relative;
@@ -80,3 +78,16 @@
80
78
  }
81
79
  }
82
80
  }
81
+ /*```<!--section:docs-->
82
+ Framework-agnostic utilities for breaking out images and figures beyond their container width.
83
+
84
+ Use the `.breakout` class to allow elements to extend beyond their parent container:
85
+
86
+ ```html
87
+ <div class="breakout">
88
+ <img src="image.jpg" alt="Description" />
89
+ </div>
90
+ ```
91
+
92
+ 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.
93
+ <!--section--> */
@@ -23,13 +23,13 @@ table.responsive,
23
23
  padding-inline-start: 0;
24
24
  }
25
25
  }
26
- /*```<!--#TODO:css-blade-->
26
+ /*```
27
+ <!--#TODO:css-blade-->
27
28
  Soft-increase selector specificity trick:
28
29
 
29
30
  `table:not(.does-not-exist)` (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
30
31
  <!--section:docs-->
31
- ### Responsive table without wrapper
32
- `.responsive` allows a table to full-bleed and scroll on mobile:
32
+ `<table class="responsive">` allows a table to full-bleed and scroll on mobile:
33
33
  <div>
34
34
 
35
35
  | Term | Description <hr class="x2"> | Link |
package/blades.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "blades"
5
- spec.version = "0.27.0-alpha.16"
5
+ spec.version = "0.27.0-beta.2"
6
6
  spec.authors = ["Anton Staroverov"]
7
7
 
8
8
  spec.summary = "Framework-agnostic CSS utilities and single-file Liquid 'blades' for modern web development."
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@anydigital/blades",
3
- "version": "0.27.0-alpha.16",
3
+ "version": "0.27.0-beta.2",
4
4
  "description": "Framework-agnostic CSS utilities and single-file Liquid 'blades' for modern web development.",
5
- "style": "./src/blades.css",
5
+ "style": "./assets/blades.css",
6
6
  "exports": {
7
7
  ".": "./src/blades.css",
8
8
  "./theme": "./src/blades.theme.css",
9
- "./unreduce-motion": "./src/_unreduce-motion.css",
10
- "./dist": "./dist/blades.css"
9
+ "./unreduce-motion": "./src/_unreduce-motion.css"
11
10
  },
12
11
  "scripts": {
13
12
  "postcss": "postcss './src/!(_)*.css' --dir ./assets",
package/src/_code.css ADDED
@@ -0,0 +1,45 @@
1
+ /* <!--section:docs-->
2
+ ### Code
3
+ Extends https://github.com/picocss/pico/blob/main/scss/content/_code.scss
4
+ ```css */
5
+ pre {
6
+ padding: 1rem 1.5rem;
7
+ padding-inline-end: 2rem;
8
+
9
+ @media screen and (max-width: 767px) {
10
+ border-radius: 0;
11
+ }
12
+ }
13
+
14
+ code {
15
+ /* Code block caption via data-attr (to display filename, etc.) */
16
+ &[data-caption] {
17
+ &::before {
18
+ content: attr(data-caption);
19
+ display: block;
20
+ margin-bottom: 1rem;
21
+ opacity: 50%;
22
+ font-style: italic;
23
+ }
24
+ }
25
+
26
+ &:where(pre > *) {
27
+ padding: 0;
28
+ }
29
+ }
30
+
31
+ /*** Extends https://github.com/PrismJS/prism/blob/master/plugins/treeview/prism-treeview.css ***/
32
+ .token.treeview-part {
33
+ .entry-line {
34
+ width: 2.5em !important;
35
+ opacity: 25%;
36
+ }
37
+ .entry-name:last-child {
38
+ opacity: 50%;
39
+
40
+ &::before {
41
+ display: none !important;
42
+ }
43
+ }
44
+ }
45
+ /*``` <!--section--> */
@@ -0,0 +1,59 @@
1
+ /*
2
+ <!--section:docs-->
3
+
4
+ ### Document
5
+ Extends https://github.com/picocss/pico/blob/main/scss/layout/_document.scss
6
+
7
+ Prevent horizontal overflow and scrolling, modern way:
8
+ ```css */
9
+ html {
10
+ overflow-x: clip;
11
+ }
12
+ /*```
13
+
14
+ ### Landmarks
15
+ Extends https://github.com/picocss/pico/blob/main/scss/layout/_landmarks.scss
16
+
17
+ 1. Ensure `body` takes at least the full height of the viewport (using dynamic viewport height for better mobile support).
18
+ 2. Make the `body` a flex container with column layout, and `main` to automatically fill available space. This is useful for creating sticky footers and full-height layouts.
19
+ ```css */
20
+ body {
21
+ min-height: 100dvh;
22
+
23
+ display: flex;
24
+ flex-direction: column;
25
+ > main {
26
+ flex-grow: 1;
27
+ }
28
+ }
29
+ /*```
30
+
31
+ ### Table of contents
32
+ ```css */
33
+ [data-is-toc] {
34
+ font-size: 87.5%;
35
+
36
+ a {
37
+ text-decoration: none;
38
+ }
39
+ > ul {
40
+ columns: 30ch auto; /* 2 cols max for 65ch container */
41
+ }
42
+ }
43
+ /*```
44
+
45
+ ### Jump to top
46
+ ```css */
47
+ [data-jump-to="top"] {
48
+ position: fixed;
49
+ bottom: 0;
50
+ right: 0;
51
+ padding-top: 50vh;
52
+ opacity: 25%;
53
+
54
+ &:hover {
55
+ opacity: 75%;
56
+ }
57
+ }
58
+ /*```
59
+ <!--section--> */
package/src/_link.css ADDED
@@ -0,0 +1,28 @@
1
+ /* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
2
+ <!--section:code-->```css */
3
+ a {
4
+ /* Helper to handle icons in links */
5
+ > i {
6
+ display: inline-block;
7
+ font-style: normal;
8
+ }
9
+
10
+ /* Helper for favicons in links */
11
+ &[data-has-favicon] {
12
+ display: inline-block;
13
+
14
+ > img {
15
+ max-height: 1.25em;
16
+ margin-top: calc(-0.25em / 2);
17
+ margin-inline-end: 0.375ch; /* =3/8 */
18
+
19
+ /* for tw-typography (.prose) */
20
+ display: inline-block;
21
+ margin-bottom: 0;
22
+ }
23
+ }
24
+ }
25
+ /*```
26
+ <!--section:docs-->
27
+ ### Link [fav]icons
28
+ <!--section--> */