@anydigital/bricks 0.26.0-alpha.2 → 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/README.md +2 -2
- package/_includes/bricks/html.liquid +2 -1
- package/_includes/bricks/html.njk +2 -1
- package/_includes/bricks/nav.liquid +6 -1
- package/assets/breakout.css +54 -97
- package/assets/bricks.css +214 -274
- package/assets/bricks.theme.css +74 -0
- package/bricks.gemspec +1 -1
- package/package.json +5 -7
- package/postcss.config.js +3 -6
- package/src/{_base.css → _classless.css} +27 -5
- package/src/_tricks.css +136 -0
- package/src/_unreduce-motion.css +12 -0
- package/src/breakout.css +107 -0
- package/src/bricks.css +3 -4
- package/src/bricks.theme.css +74 -0
- package/src/_prose.css +0 -136
- package/src/_util.css +0 -19
package/postcss.config.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
body {
|
|
1
|
+
html {
|
|
2
|
+
/* Prevent horizontal overflow and scrolling, modern way */
|
|
4
3
|
overflow-x: clip;
|
|
4
|
+
|
|
5
|
+
/* Font smoothing */
|
|
6
|
+
-webkit-font-smoothing: antialiased;
|
|
7
|
+
-moz-osx-font-smoothing: grayscale;
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
body {
|
|
@@ -15,8 +18,7 @@ body {
|
|
|
15
18
|
flex-grow: 1;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
-moz-osx-font-smoothing: grayscale;
|
|
21
|
+
/* Hyphenation */
|
|
20
22
|
hyphens: auto;
|
|
21
23
|
/* Links and tables are better (safer) without hyphenation */
|
|
22
24
|
a,
|
|
@@ -24,3 +26,23 @@ body {
|
|
|
24
26
|
hyphens: none;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
29
|
+
|
|
30
|
+
pre {
|
|
31
|
+
padding: 1rem 1.5rem;
|
|
32
|
+
padding-inline-end: 2rem;
|
|
33
|
+
|
|
34
|
+
code {
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media screen and (max-width: 767px) {
|
|
39
|
+
border-radius: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
small {
|
|
44
|
+
[role="button"] {
|
|
45
|
+
padding: 0.75em 1em;
|
|
46
|
+
font-size: inherit;
|
|
47
|
+
}
|
|
48
|
+
}
|
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/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
|
+
}
|
package/src/bricks.css
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Framework-agnostic CSS utility helpers
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
@import "./
|
|
7
|
-
@import "./
|
|
8
|
-
@import "@anydigital/breakout-css"; /* after prose to override it */
|
|
6
|
+
@import "./_classless";
|
|
7
|
+
@import "./breakout";
|
|
9
8
|
@import "./_prism";
|
|
10
|
-
@import "./
|
|
9
|
+
@import "./_tricks";
|
|
@@ -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/_prose.css
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
.prose {
|
|
2
|
-
/* Container-like behavior with auto margins */
|
|
3
|
-
width: 100%;
|
|
4
|
-
margin-inline: auto;
|
|
5
|
-
|
|
6
|
-
/* Helper for multi-line subtitles */
|
|
7
|
-
sub {
|
|
8
|
-
vertical-align: top;
|
|
9
|
-
bottom: -0.05em;
|
|
10
|
-
line-height: 1.1;
|
|
11
|
-
font-weight: 300;
|
|
12
|
-
/* Workaround to prevent underline inside links */
|
|
13
|
-
display: inline-block;
|
|
14
|
-
width: 100%;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
a {
|
|
18
|
-
text-underline-offset: 0.1em;
|
|
19
|
-
text-decoration-thickness: 1px;
|
|
20
|
-
/* Don't underline links that point to anchors */
|
|
21
|
-
&[href^="#"] {
|
|
22
|
-
text-decoration: none;
|
|
23
|
-
}
|
|
24
|
-
&:hover {
|
|
25
|
-
text-decoration-thickness: 2px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* Helper to insert icons in links */
|
|
29
|
-
i {
|
|
30
|
-
height: 1em;
|
|
31
|
-
margin-right: 0.25em;
|
|
32
|
-
font-style: normal;
|
|
33
|
-
/* Workaround to prevent underline */
|
|
34
|
-
display: inline-block;
|
|
35
|
-
|
|
36
|
-
img {
|
|
37
|
-
height: 100%;
|
|
38
|
-
margin: 0;
|
|
39
|
-
position: relative;
|
|
40
|
-
bottom: -0.15em;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
img {
|
|
46
|
-
&:not(:where(.prose > img, .prose > p > img)) {
|
|
47
|
-
margin-top: 0;
|
|
48
|
-
margin-bottom: 1em;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/* Support for markdown anchors */
|
|
53
|
-
h1,
|
|
54
|
-
h2,
|
|
55
|
-
h3,
|
|
56
|
-
h4,
|
|
57
|
-
h5,
|
|
58
|
-
h6 {
|
|
59
|
-
position: relative;
|
|
60
|
-
|
|
61
|
-
.header-anchor {
|
|
62
|
-
display: none;
|
|
63
|
-
position: absolute;
|
|
64
|
-
right: 100%;
|
|
65
|
-
top: 0;
|
|
66
|
-
padding-right: 0.2ch;
|
|
67
|
-
color: rgba(0, 0, 0, 0.25);
|
|
68
|
-
}
|
|
69
|
-
&:hover {
|
|
70
|
-
.header-anchor {
|
|
71
|
-
display: block;
|
|
72
|
-
}
|
|
73
|
-
/* Support for `breakout-css` headings */
|
|
74
|
-
&::before {
|
|
75
|
-
margin-right: 1.5ch !important;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
h1 {
|
|
80
|
-
margin-bottom: 0.5em !important;
|
|
81
|
-
|
|
82
|
-
sub {
|
|
83
|
-
font-size: 50%;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
th,
|
|
88
|
-
td {
|
|
89
|
-
/* Keep extra space on the right for better horizontal scroll on mobile */
|
|
90
|
-
padding: 1rem 2rem 1rem 0;
|
|
91
|
-
vertical-align: top;
|
|
92
|
-
/* Workaround to widen particular columns */
|
|
93
|
-
hr {
|
|
94
|
-
width: 12ch;
|
|
95
|
-
height: 0;
|
|
96
|
-
margin: 0;
|
|
97
|
-
visibility: hidden;
|
|
98
|
-
/* &.ch16 {
|
|
99
|
-
width: 16ch;
|
|
100
|
-
} */
|
|
101
|
-
}
|
|
102
|
-
/* Workaround for headings in Markdown tables */
|
|
103
|
-
big {
|
|
104
|
-
font-weight: bold;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
th {
|
|
108
|
-
vertical-align: bottom;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
blockquote {
|
|
112
|
-
font-weight: 300;
|
|
113
|
-
|
|
114
|
-
+ figcaption {
|
|
115
|
-
margin-top: -1em;
|
|
116
|
-
text-align: right;
|
|
117
|
-
font-style: italic;
|
|
118
|
-
font-weight: 300;
|
|
119
|
-
|
|
120
|
-
&::before {
|
|
121
|
-
content: "—";
|
|
122
|
-
margin-right: 0.25em;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
code[data-caption] {
|
|
128
|
-
&::before {
|
|
129
|
-
content: attr(data-caption);
|
|
130
|
-
display: block;
|
|
131
|
-
margin-bottom: 1.5em;
|
|
132
|
-
opacity: 0.5;
|
|
133
|
-
font-style: italic;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
package/src/_util.css
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* Utility classes and fixes */
|
|
2
|
-
|
|
3
|
-
.invert {
|
|
4
|
-
/* Fix the scrollbar color when inverted */
|
|
5
|
-
::-webkit-scrollbar {
|
|
6
|
-
filter: invert(1) !important;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Workaround for icon to stay with text in links */
|
|
11
|
-
a.whitespace-nowrap {
|
|
12
|
-
white-space: nowrap;
|
|
13
|
-
/* Fix for Safari :( why Safari, why? */
|
|
14
|
-
display: inline-block;
|
|
15
|
-
|
|
16
|
-
span {
|
|
17
|
-
white-space: normal;
|
|
18
|
-
}
|
|
19
|
-
}
|