@anydigital/blades 0.27.0-alpha.15 → 0.27.0-beta

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