@anydigital/blades 0.27.0-alpha.10
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/.prettierrc.json +12 -0
- package/LICENSE +20 -0
- package/README.md +323 -0
- package/_config.yml +5 -0
- package/_includes/blades/gtm.liquid +23 -0
- package/_includes/blades/gtm.njk +22 -0
- package/_includes/blades/html.liquid +36 -0
- package/_includes/blades/html.njk +36 -0
- package/_includes/blades/nav.liquid +14 -0
- package/assets/blades.css +322 -0
- package/assets/blades.theme.css +74 -0
- package/assets/breakout.css +107 -0
- package/blades.gemspec +16 -0
- package/package.json +37 -0
- package/postcss.config.js +5 -0
- package/src/_classless.css +48 -0
- package/src/_prism.css +14 -0
- package/src/_tricks.css +136 -0
- package/src/_unreduce-motion.css +12 -0
- package/src/blades.css +9 -0
- package/src/blades.theme.css +74 -0
- package/src/breakout.css +107 -0
package/src/_tricks.css
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
table {
|
|
2
|
+
/* Workaround to widen particular columns @TODO: add to tricks-wiki */
|
|
3
|
+
th {
|
|
4
|
+
hr {
|
|
5
|
+
width: 12ch; /* min ~65/12 = ~5 cols */
|
|
6
|
+
height: 0;
|
|
7
|
+
margin: 0;
|
|
8
|
+
visibility: hidden;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
table.borderless {
|
|
14
|
+
th,
|
|
15
|
+
td {
|
|
16
|
+
border: none;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Header anchors @TODO: add to tricks-wiki */
|
|
21
|
+
h1,
|
|
22
|
+
h2,
|
|
23
|
+
h3,
|
|
24
|
+
h4,
|
|
25
|
+
h5,
|
|
26
|
+
h6 {
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
[data-is-anchor] {
|
|
30
|
+
visibility: hidden;
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
right: 100%;
|
|
34
|
+
padding-right: 0.2ch;
|
|
35
|
+
color: silver;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
}
|
|
38
|
+
&:hover {
|
|
39
|
+
[data-is-anchor] {
|
|
40
|
+
visibility: visible;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Helper to handle icons in links */
|
|
46
|
+
a > i {
|
|
47
|
+
display: inline-block;
|
|
48
|
+
margin-inline-end: 0.375ch; /* =3/8 */
|
|
49
|
+
font-style: normal;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Favicons in links @TODO: add to tricks-wiki */
|
|
53
|
+
a[data-has-favicon] {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
|
|
56
|
+
> img {
|
|
57
|
+
max-height: 1.25em;
|
|
58
|
+
margin-top: calc(-0.25em / 2);
|
|
59
|
+
margin-inline-end: 0.375ch; /* =3/8 */
|
|
60
|
+
|
|
61
|
+
/* for tw-typography (.prose) */
|
|
62
|
+
display: inline-block;
|
|
63
|
+
margin-bottom: 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
code[data-caption] {
|
|
68
|
+
&::before {
|
|
69
|
+
content: attr(data-caption);
|
|
70
|
+
display: block;
|
|
71
|
+
margin-bottom: 1rem;
|
|
72
|
+
opacity: 50%;
|
|
73
|
+
font-style: italic;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Tailwind tricks */
|
|
78
|
+
.invert {
|
|
79
|
+
/* Fix the scrollbar color when inverted */
|
|
80
|
+
::-webkit-scrollbar {
|
|
81
|
+
filter: invert(1) !important;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Jump to top trick */
|
|
86
|
+
[data-jump-to="top"] {
|
|
87
|
+
position: fixed;
|
|
88
|
+
bottom: 0;
|
|
89
|
+
right: 0;
|
|
90
|
+
padding-top: 50vh;
|
|
91
|
+
opacity: 25%;
|
|
92
|
+
|
|
93
|
+
&:hover {
|
|
94
|
+
opacity: 75%;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Table of contents */
|
|
99
|
+
[data-is-toc] {
|
|
100
|
+
font-size: 87.5%;
|
|
101
|
+
|
|
102
|
+
a {
|
|
103
|
+
text-decoration: none;
|
|
104
|
+
}
|
|
105
|
+
> ul {
|
|
106
|
+
columns: 30ch auto; /* 2 cols max for 65ch container */
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* @TODO: to TRICKS */
|
|
111
|
+
.columns {
|
|
112
|
+
columns: 20ch auto; /* 3 cols max for 65ch container */
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* @TODO: to TRICKS */
|
|
116
|
+
ul,
|
|
117
|
+
ol {
|
|
118
|
+
li[data-marker]::marker {
|
|
119
|
+
content: attr(data-marker) " ";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.faded {
|
|
124
|
+
opacity: 50%;
|
|
125
|
+
&:hover {
|
|
126
|
+
opacity: 87.5%;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (prefers-color-scheme: dark) {
|
|
131
|
+
:root:not([data-theme="light"]) {
|
|
132
|
+
.dark-auto {
|
|
133
|
+
filter: invert(100%) hue-rotate(180deg);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* @TODO: tricks-wiki */
|
|
2
|
+
@utility unreduce-animation-* {
|
|
3
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4
|
+
&:not([aria-busy="true"]) {
|
|
5
|
+
animation-duration: --value([ *]) !important;
|
|
6
|
+
animation-delay: 0 !important;
|
|
7
|
+
animation-iteration-count: infinite !important;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Overrides https://github.com/picocss/pico/blob/main/scss/utilities/_reduce-motion.scss */
|
package/src/blades.css
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
a {
|
|
2
|
+
&:not([href^="#"]) {
|
|
3
|
+
text-decoration-thickness: 1px;
|
|
4
|
+
&:hover {
|
|
5
|
+
text-decoration-thickness: 2px;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
h1 {
|
|
11
|
+
font-size: 2.5em; /* for pico.css & tw-typography */
|
|
12
|
+
margin-bottom: 1rem; /* for tw-typography */
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
hr {
|
|
16
|
+
margin-block: 2em; /* for pico.css & tw-typography */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ul {
|
|
20
|
+
ul {
|
|
21
|
+
font-size: 87.5%;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pre {
|
|
26
|
+
small {
|
|
27
|
+
opacity: 75%;
|
|
28
|
+
font-weight: lighter;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
table {
|
|
33
|
+
th {
|
|
34
|
+
vertical-align: bottom;
|
|
35
|
+
font-weight: bold;
|
|
36
|
+
}
|
|
37
|
+
td {
|
|
38
|
+
vertical-align: top;
|
|
39
|
+
}
|
|
40
|
+
pre {
|
|
41
|
+
margin-bottom: 0.25rem;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-jump-to="top"] {
|
|
46
|
+
> i {
|
|
47
|
+
display: inline-block;
|
|
48
|
+
padding: 0.25rem;
|
|
49
|
+
margin: 0.5rem;
|
|
50
|
+
font-size: 0.75rem;
|
|
51
|
+
color: black;
|
|
52
|
+
border-color: black;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[data-is-toc] {
|
|
57
|
+
> ul > * > a {
|
|
58
|
+
font-weight: 500;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.breakout,
|
|
63
|
+
.breakout-all {
|
|
64
|
+
> img,
|
|
65
|
+
> figure {
|
|
66
|
+
margin-bottom: 1rem;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.faded {
|
|
71
|
+
a {
|
|
72
|
+
text-decoration-style: dotted;
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/breakout.css
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
|
|
2
|
+
|
|
3
|
+
.breakout,
|
|
4
|
+
.breakout-all {
|
|
5
|
+
/* Prepare the container for breakout elements */
|
|
6
|
+
padding-inline: 10%;
|
|
7
|
+
max-width: calc(10% + 65ch + 10%);
|
|
8
|
+
|
|
9
|
+
/* Breakout direct children only */
|
|
10
|
+
& > * {
|
|
11
|
+
&:is(
|
|
12
|
+
table,
|
|
13
|
+
pre,
|
|
14
|
+
figure, video, iframe, canvas,
|
|
15
|
+
img, picture,
|
|
16
|
+
/* Custom utility classes for other tags that need to be broken out */
|
|
17
|
+
.breakout-item,
|
|
18
|
+
.breakout-item-max
|
|
19
|
+
) {
|
|
20
|
+
width: fit-content;
|
|
21
|
+
min-width: 100%;
|
|
22
|
+
max-width: 125%;
|
|
23
|
+
margin-left: 50%;
|
|
24
|
+
transform: translateX(-50%);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Respect img/picture min-width */
|
|
28
|
+
&:is(img, picture) {
|
|
29
|
+
min-width: auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* <!--section:responsive-table-without-wrapper-->
|
|
33
|
+
### Responsive tables without wrapper
|
|
34
|
+
```css */
|
|
35
|
+
&:is(table):not(.does-not-exist) {
|
|
36
|
+
/* Let them full-bleed */
|
|
37
|
+
width: max-content;
|
|
38
|
+
min-width: auto;
|
|
39
|
+
max-width: 100vw;
|
|
40
|
+
padding-inline: 7.5%;
|
|
41
|
+
|
|
42
|
+
/* Let them scroll */
|
|
43
|
+
display: block;
|
|
44
|
+
overflow-x: auto;
|
|
45
|
+
-webkit-overflow-scrolling: touch; /* Smooth scroll for iOS */
|
|
46
|
+
|
|
47
|
+
th,
|
|
48
|
+
td {
|
|
49
|
+
padding-inline-start: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/*```
|
|
53
|
+
#### Soft-increase selector specificity
|
|
54
|
+
`&:is(table):not(.does-not-exist)` trick (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
|
|
55
|
+
<!--section--> */
|
|
56
|
+
|
|
57
|
+
/* Max out the width of the element */
|
|
58
|
+
&.breakout-item-max {
|
|
59
|
+
width: 125% !important; /* !important is for cases like figure.breakout-item-max @TODO */
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.breakout-all > * {
|
|
65
|
+
&:is(h2, h3, h4, hr):not([class]) {
|
|
66
|
+
position: relative;
|
|
67
|
+
|
|
68
|
+
&::before {
|
|
69
|
+
content: "";
|
|
70
|
+
display: block;
|
|
71
|
+
position: absolute;
|
|
72
|
+
background: gray;
|
|
73
|
+
opacity: 12.5%;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&:is(h2, h3, h4):not([class]) {
|
|
78
|
+
&::before {
|
|
79
|
+
width: 10em;
|
|
80
|
+
right: 100%;
|
|
81
|
+
margin-right: 0.8ch;
|
|
82
|
+
height: 0.25em;
|
|
83
|
+
top: 50%;
|
|
84
|
+
transform: translateY(-50%);
|
|
85
|
+
background: linear-gradient(to left, gray, transparent);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* @TODO: add to tricks-wiki why `*` works here, but `&` fails */
|
|
89
|
+
&:where(hr + *) {
|
|
90
|
+
&::before {
|
|
91
|
+
display: none !important;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
&:is(hr) {
|
|
96
|
+
height: 0.5rem;
|
|
97
|
+
border: none;
|
|
98
|
+
overflow: visible;
|
|
99
|
+
|
|
100
|
+
&::before {
|
|
101
|
+
width: 100vw;
|
|
102
|
+
left: 50%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
transform: translateX(-50%);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|