@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/assets/bricks.css CHANGED
@@ -3,11 +3,13 @@
3
3
  * Framework-agnostic CSS utility helpers
4
4
  */
5
5
 
6
- /* Prevent horizontal overflow and scrolling, modern way */
7
-
8
- html,
9
- body {
6
+ html {
7
+ /* Prevent horizontal overflow and scrolling, modern way */
10
8
  overflow-x: clip;
9
+
10
+ /* Font smoothing */
11
+ -webkit-font-smoothing: antialiased;
12
+ -moz-osx-font-smoothing: grayscale;
11
13
  }
12
14
 
13
15
  body {
@@ -17,194 +19,58 @@ body {
17
19
  /* Make the body a flex container with column layout; main fills space */
18
20
  display: flex;
19
21
  flex-direction: column;
20
- }
21
-
22
- body > main {
22
+ > main {
23
23
  flex-grow: 1;
24
24
  }
25
25
 
26
- body {
27
-
28
- -webkit-font-smoothing: antialiased;
29
- -moz-osx-font-smoothing: grayscale;
26
+ /* Hyphenation */
30
27
  hyphens: auto;
31
28
  /* Links and tables are better (safer) without hyphenation */
32
- }
33
-
34
- body a,body table {
29
+ a,
30
+ table {
35
31
  hyphens: none;
36
32
  }
37
-
38
- .prose {
39
- /* Container-like behavior with auto margins */
40
- width: 100%;
41
- margin-inline: auto;
42
-
43
- /* Helper for multi-line subtitles */
44
33
  }
45
34
 
46
- .prose sub {
47
- vertical-align: top;
48
- bottom: -0.05em;
49
- line-height: 1.1;
50
- font-weight: 300;
51
- /* Workaround to prevent underline inside links */
52
- display: inline-block;
53
- width: 100%;
54
- }
55
-
56
- .prose a {
57
- text-underline-offset: 0.1em;
58
- text-decoration-thickness: 1px;
59
- /* Don't underline links that point to anchors */
60
- }
61
-
62
- .prose a[href^="#"] {
63
- text-decoration: none;
64
- }
65
-
66
- .prose a:hover {
67
- text-decoration-thickness: 2px;
68
- }
69
-
70
- /* Helper to insert icons in links */
71
-
72
- .prose a i {
73
- height: 1em;
74
- margin-right: 0.25em;
75
- font-style: normal;
76
- /* Workaround to prevent underline */
77
- display: inline-block;
78
- }
79
-
80
- .prose a i img {
81
- height: 100%;
82
- margin: 0;
83
- position: relative;
84
- bottom: -0.15em;
85
- }
86
-
87
- .prose img:not(:where(.prose > img,.prose > p > img)) {
88
- margin-top: 0;
89
- margin-bottom: 1em;
90
- }
91
-
92
- /* Support for markdown anchors */
93
-
94
- .prose h1,.prose h2,.prose h3,.prose h4,.prose h5,.prose h6 {
95
- position: relative;
96
- }
97
-
98
- .prose h1 .header-anchor,.prose h2 .header-anchor,.prose h3 .header-anchor,.prose h4 .header-anchor,.prose h5 .header-anchor,.prose h6 .header-anchor {
99
- display: none;
100
- position: absolute;
101
- right: 100%;
102
- top: 0;
103
- padding-right: 0.2ch;
104
- color: rgba(0, 0, 0, 0.25);
105
- }
106
-
107
- .prose h1:hover .header-anchor,.prose h2:hover .header-anchor,.prose h3:hover .header-anchor,.prose h4:hover .header-anchor,.prose h5:hover .header-anchor,.prose h6:hover .header-anchor {
108
- display: block;
109
- }
110
-
111
- /* Support for `breakout-css` headings */
112
-
113
- .prose h1:hover::before {
114
- margin-right: 1.5ch !important;
115
- }
116
-
117
- .prose h2:hover::before {
118
- margin-right: 1.5ch !important;
119
- }
120
-
121
- .prose h3:hover::before {
122
- margin-right: 1.5ch !important;
123
- }
124
-
125
- .prose h4:hover::before {
126
- margin-right: 1.5ch !important;
127
- }
128
-
129
- .prose h5:hover::before {
130
- margin-right: 1.5ch !important;
131
- }
132
-
133
- .prose h6:hover::before {
134
- margin-right: 1.5ch !important;
135
- }
136
-
137
- .prose h1 {
138
- margin-bottom: 0.5em !important;
139
- }
35
+ pre {
36
+ padding: 1rem 1.5rem;
37
+ padding-inline-end: 2rem;
140
38
 
141
- .prose h1 sub {
142
- font-size: 50%;
143
- }
144
-
145
- .prose th,.prose td {
146
- /* Keep extra space on the right for better horizontal scroll on mobile */
147
- padding: 1rem 2rem 1rem 0;
148
- vertical-align: top;
149
- /* Workaround to widen particular columns */
39
+ code {
40
+ padding: 0;
150
41
  }
151
42
 
152
- .prose th hr,.prose td hr {
153
- width: 12ch;
154
- height: 0;
155
- margin: 0;
156
- visibility: hidden;
157
- /* &.ch16 {
158
- width: 16ch;
159
- } */
160
- }
161
-
162
- /* Workaround for headings in Markdown tables */
163
-
164
- .prose th big,.prose td big {
165
- font-weight: bold;
166
- }
167
-
168
- .prose th {
169
- vertical-align: bottom;
43
+ @media screen and (max-width: 767px) {
44
+ border-radius: 0;
170
45
  }
46
+ }
171
47
 
172
- .prose blockquote {
173
- font-weight: 300;
48
+ small {
49
+ [role="button"] {
50
+ padding: 0.75em 1em;
51
+ font-size: inherit;
174
52
  }
175
-
176
- .prose blockquote + figcaption {
177
- margin-top: -1em;
178
- text-align: right;
179
- font-style: italic;
180
- font-weight: 300;
181
- }
182
-
183
- .prose blockquote + figcaption::before {
184
- content: "—";
185
- margin-right: 0.25em;
186
- }
187
-
188
- .prose code[data-caption]::before {
189
- content: attr(data-caption);
190
- display: block;
191
- margin-bottom: 1.5em;
192
- opacity: 0.5;
193
- font-style: italic;
194
- }
53
+ }
195
54
 
196
55
  /* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
197
56
 
198
- .breakout {
57
+ .breakout,
58
+ .breakout-all {
199
59
  /* Prepare the container for breakout elements */
200
60
  padding-inline: 10%;
201
61
  max-width: calc(10% + 65ch + 10%);
202
62
 
203
- /* Direct children, or wrapped in <p> for Markdown support */
204
- }
205
-
206
- .breakout > img:not(does-not-exist):not(.does-not-exist),.breakout > picture:not(does-not-exist):not(.does-not-exist),.breakout > figure:not(does-not-exist):not(.does-not-exist),.breakout > canvas:not(does-not-exist):not(.does-not-exist),.breakout > audio:not(does-not-exist):not(.does-not-exist),.breakout > table:not(does-not-exist):not(.does-not-exist),.breakout > pre:not(does-not-exist):not(.does-not-exist),.breakout > iframe:not(does-not-exist):not(.does-not-exist),.breakout > object:not(does-not-exist):not(.does-not-exist),.breakout > embed:not(does-not-exist):not(.does-not-exist),.breakout > video:not(does-not-exist):not(.does-not-exist),.breakout > .breakout-item:not(does-not-exist),.breakout > .breakout-item-max:not(does-not-exist),.breakout > p > img:not(.does-not-exist),.breakout > p > picture:not(.does-not-exist),.breakout > p > figure:not(.does-not-exist),.breakout > p > canvas:not(.does-not-exist),.breakout > p > audio:not(.does-not-exist),.breakout > p > table:not(.does-not-exist),.breakout > p > pre:not(.does-not-exist),.breakout > p > iframe:not(.does-not-exist),.breakout > p > object:not(.does-not-exist),.breakout > p > embed:not(.does-not-exist),.breakout > p > video:not(.does-not-exist),.breakout > p > .breakout-item,.breakout > p > .breakout-item-max {
207
- width: -moz-fit-content;
63
+ /* Breakout direct children only */
64
+ & > * {
65
+ &:is(
66
+ table,
67
+ pre,
68
+ figure, video, iframe, canvas,
69
+ img, picture,
70
+ /* Custom utility classes for other tags that need to be broken out */
71
+ .breakout-item,
72
+ .breakout-item-max
73
+ ) {
208
74
  width: fit-content;
209
75
  min-width: 100%;
210
76
  max-width: 125%;
@@ -212,19 +78,16 @@ body a,body table {
212
78
  transform: translateX(-50%);
213
79
  }
214
80
 
215
- /*** .does-not-exist is used below to avoid !important-s @TODO ***/
216
-
217
- /* Respect inline blocks' min-width */
218
-
219
- .breakout > img:not(does-not-exist):not(.does-not-exist),.breakout > picture:not(does-not-exist):not(.does-not-exist),.breakout > figure:not(does-not-exist):not(.does-not-exist),.breakout > canvas:not(does-not-exist):not(.does-not-exist),.breakout > audio:not(does-not-exist):not(.does-not-exist),.breakout > p > img:not(.does-not-exist),.breakout > p > picture:not(.does-not-exist),.breakout > p > figure:not(.does-not-exist),.breakout > p > canvas:not(.does-not-exist),.breakout > p > audio:not(.does-not-exist) {
81
+ /* Respect img/picture min-width */
82
+ &:is(img, picture) {
220
83
  min-width: auto;
221
84
  }
222
85
 
223
- /* Tables are so special :( */
224
-
225
- .breakout > table:not(does-not-exist):not(.does-not-exist),.breakout > p > table:not(.does-not-exist) {
86
+ /* <!--section:responsive-table-without-wrapper-->
87
+ ### Responsive tables without wrapper
88
+ ```css */
89
+ &:is(table):not(.does-not-exist) {
226
90
  /* Let them full-bleed */
227
- width: -moz-max-content;
228
91
  width: max-content;
229
92
  min-width: auto;
230
93
  max-width: 100vw;
@@ -234,149 +97,226 @@ body a,body table {
234
97
  display: block;
235
98
  overflow-x: auto;
236
99
  -webkit-overflow-scrolling: touch; /* Smooth scroll for iOS */
237
- }
238
100
 
239
- /* Max out the width of the element */
101
+ th,
102
+ td {
103
+ padding-inline-start: 0;
104
+ }
105
+ }
106
+ /*```
107
+ #### Soft-increase selector specificity
108
+ `&:is(table):not(.does-not-exist)` trick (inspired by postcss) is used here to increase specificity against selectors like `&:is(table, .table)`
109
+ <!--section--> */
240
110
 
241
- .breakout > .breakout-item-max:not(does-not-exist),.breakout > p > .breakout-item-max {
111
+ /* Max out the width of the element */
112
+ &.breakout-item-max {
242
113
  width: 125% !important; /* !important is for cases like figure.breakout-item-max @TODO */
243
114
  }
244
-
245
- .breakout-headings h2:not([class]),.breakout-headings h3:not([class]),.breakout-headings h4:not([class]),.breakout-headings hr {
246
- position: relative;
247
115
  }
116
+ }
248
117
 
249
- .breakout-headings h2:not([class])::before {
250
- content: "";
251
- display: block;
252
- position: absolute;
253
- background-color: rgba(0, 0, 0, 5%);
254
- }
255
-
256
- .breakout-headings h3:not([class])::before {
257
- content: "";
258
- display: block;
259
- position: absolute;
260
- background-color: rgba(0, 0, 0, 5%);
261
- }
262
-
263
- .breakout-headings h4:not([class])::before {
264
- content: "";
265
- display: block;
266
- position: absolute;
267
- background-color: rgba(0, 0, 0, 5%);
268
- }
118
+ .breakout-all > * {
119
+ &:is(h2, h3, h4, hr):not([class]) {
120
+ position: relative;
269
121
 
270
- .breakout-headings hr:not(.does-not-exist)::before {
122
+ &::before {
271
123
  content: "";
272
124
  display: block;
273
125
  position: absolute;
274
- background-color: rgba(0, 0, 0, 5%);
275
- }
276
-
277
- .breakout-headings h2:not([class])::before {
278
- width: 10em;
279
- right: 100%;
280
- margin-right: 1rem;
281
- height: 0.3em;
282
- top: 50%;
283
- transform: translateY(-50%);
284
- background: linear-gradient(
285
- to left,
286
- rgba(0, 0, 0, 10%),
287
- rgba(0, 0, 0, 5%) 10%,
288
- transparent
289
- );
126
+ background: gray;
127
+ opacity: 12.5%;
290
128
  }
129
+ }
291
130
 
292
- .breakout-headings h3:not([class])::before {
131
+ &:is(h2, h3, h4):not([class]) {
132
+ &::before {
293
133
  width: 10em;
294
134
  right: 100%;
295
- margin-right: 1rem;
296
- height: 0.3em;
135
+ margin-right: 0.8ch;
136
+ height: 0.25em;
297
137
  top: 50%;
298
138
  transform: translateY(-50%);
299
- background: linear-gradient(
300
- to left,
301
- rgba(0, 0, 0, 10%),
302
- rgba(0, 0, 0, 5%) 10%,
303
- transparent
304
- );
139
+ background: linear-gradient(to left, gray, transparent);
305
140
  }
306
141
 
307
- .breakout-headings h4:not([class])::before {
308
- width: 10em;
309
- right: 100%;
310
- margin-right: 1rem;
311
- height: 0.3em;
312
- top: 50%;
313
- transform: translateY(-50%);
314
- background: linear-gradient(
315
- to left,
316
- rgba(0, 0, 0, 10%),
317
- rgba(0, 0, 0, 5%) 10%,
318
- transparent
319
- );
142
+ /* @TODO: add to tricks-wiki why `*` works here, but `&` fails */
143
+ &:where(hr + *) {
144
+ &::before {
145
+ display: none !important;
146
+ }
320
147
  }
321
-
322
- .breakout-headings hr {
323
- height: 0.75rem;
148
+ }
149
+ &:is(hr) {
150
+ height: 0.5rem;
324
151
  border: none;
325
152
  overflow: visible;
326
- }
327
153
 
328
- .breakout-headings hr::before {
154
+ &::before {
329
155
  width: 100vw;
330
156
  left: 50%;
331
157
  height: 100%;
332
158
  transform: translateX(-50%);
333
159
  }
160
+ }
161
+ }
162
+
163
+ /* Prism.js */
164
+
165
+ .token.treeview-part {
166
+ .entry-line {
167
+ width: 2.5em !important;
168
+ opacity: 25%;
169
+ }
170
+ .entry-name:last-child {
171
+ opacity: 50%;
334
172
 
335
- .breakout-headings hr + h2::before {
173
+ &::before {
336
174
  display: none !important;
337
175
  }
176
+ }
177
+ }
338
178
 
339
- .breakout-headings hr + h3::before {
340
- display: none !important;
179
+ table {
180
+ /* Workaround to widen particular columns @TODO: add to tricks-wiki */
181
+ th {
182
+ hr {
183
+ width: 12ch; /* min ~65/12 = ~5 cols */
184
+ height: 0;
185
+ margin: 0;
186
+ visibility: hidden;
341
187
  }
188
+ }
189
+ }
342
190
 
343
- .breakout-headings hr + h4::before {
344
- display: none !important;
191
+ table.borderless {
192
+ th,
193
+ td {
194
+ border: none;
195
+ }
196
+ }
197
+
198
+ /* Header anchors @TODO: add to tricks-wiki */
199
+
200
+ h1,
201
+ h2,
202
+ h3,
203
+ h4,
204
+ h5,
205
+ h6 {
206
+ position: relative;
207
+
208
+ [data-is-anchor] {
209
+ visibility: hidden;
210
+ position: absolute;
211
+ top: 0;
212
+ right: 100%;
213
+ padding-right: 0.2ch;
214
+ color: silver;
215
+ text-decoration: none;
216
+ }
217
+ &:hover {
218
+ [data-is-anchor] {
219
+ visibility: visible;
345
220
  }
221
+ }
222
+ }
346
223
 
347
- /* after prose to override it */
224
+ /* Helper to handle icons in links */
348
225
 
349
- /* Prism.js */
226
+ a > i {
227
+ display: inline-block;
228
+ margin-inline-end: 0.375ch; /* =3/8 */
229
+ font-style: normal;
230
+ }
350
231
 
351
- .token.treeview-part .entry-line {
352
- width: 2.5em !important;
353
- opacity: 25%;
232
+ /* Favicons in links @TODO: add to tricks-wiki */
233
+
234
+ a[data-has-favicon] {
235
+ display: inline-block;
236
+
237
+ > img {
238
+ max-height: 1.25em;
239
+ margin-top: calc(-0.25em / 2);
240
+ margin-inline-end: 0.375ch; /* =3/8 */
241
+
242
+ /* for tw-typography (.prose) */
243
+ display: inline-block;
244
+ margin-bottom: 0;
354
245
  }
246
+ }
355
247
 
356
- .token.treeview-part .entry-name:last-child {
248
+ code[data-caption] {
249
+ &::before {
250
+ content: attr(data-caption);
251
+ display: block;
252
+ margin-bottom: 1rem;
357
253
  opacity: 50%;
254
+ font-style: italic;
358
255
  }
256
+ }
359
257
 
360
- .token.treeview-part .entry-name:last-child::before {
361
- display: none !important;
362
- }
258
+ /* Tailwind tricks */
363
259
 
364
- /* Utility classes and fixes */
260
+ .invert {
261
+ /* Fix the scrollbar color when inverted */
262
+ ::-webkit-scrollbar {
263
+ filter: invert(1) !important;
264
+ }
265
+ }
365
266
 
366
- /* Fix the scrollbar color when inverted */
267
+ /* Jump to top trick */
367
268
 
368
- .invert ::-webkit-scrollbar {
369
- filter: invert(1) !important;
269
+ [data-jump-to="top"] {
270
+ position: fixed;
271
+ bottom: 0;
272
+ right: 0;
273
+ padding-top: 50vh;
274
+ opacity: 25%;
275
+
276
+ &:hover {
277
+ opacity: 75%;
370
278
  }
279
+ }
371
280
 
372
- /* Workaround for icon to stay with text in links */
281
+ /* Table of contents */
373
282
 
374
- a.whitespace-nowrap {
375
- white-space: nowrap;
376
- /* Fix for Safari :( why Safari, why? */
377
- display: inline-block;
283
+ [data-is-toc] {
284
+ font-size: 87.5%;
285
+
286
+ a {
287
+ text-decoration: none;
288
+ }
289
+ > ul {
290
+ columns: 30ch auto; /* 2 cols max for 65ch container */
291
+ }
292
+ }
293
+
294
+ /* @TODO: to TRICKS */
295
+
296
+ .columns {
297
+ columns: 20ch auto; /* 3 cols max for 65ch container */
298
+ }
299
+
300
+ /* @TODO: to TRICKS */
301
+
302
+ ul,
303
+ ol {
304
+ li[data-marker]::marker {
305
+ content: attr(data-marker) " ";
306
+ }
378
307
  }
379
308
 
380
- a.whitespace-nowrap span {
381
- white-space: normal;
309
+ .faded {
310
+ opacity: 50%;
311
+ &:hover {
312
+ opacity: 87.5%;
382
313
  }
314
+ }
315
+
316
+ @media (prefers-color-scheme: dark) {
317
+ :root:not([data-theme="light"]) {
318
+ .dark-auto {
319
+ filter: invert(100%) hue-rotate(180deg);
320
+ }
321
+ }
322
+ }
@@ -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/bricks.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "bricks"
5
- spec.version = "0.25.0"
5
+ spec.version = "0.27.0-alpha.10"
6
6
  spec.authors = ["Anton Staroverov"]
7
7
 
8
8
  spec.summary = "Framework-agnostic CSS utilities and single-file Liquid 'bricks' for modern web development."
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@anydigital/bricks",
3
- "version": "0.26.0-alpha.2",
3
+ "version": "0.27.0-alpha.10",
4
4
  "description": "Framework-agnostic CSS utilities and single-file Liquid 'bricks' for modern web development.",
5
5
  "style": "./src/bricks.css",
6
6
  "exports": {
7
7
  ".": "./src/bricks.css",
8
+ "./theme": "./src/bricks.theme.css",
9
+ "./unreduce-motion": "./src/_unreduce-motion.css",
8
10
  "./dist": "./dist/bricks.css"
9
11
  },
10
12
  "scripts": {
11
- "postcss": "postcss src/bricks.css -o assets/bricks.css",
12
- "build": "npm run postcss -- --no-map && cp ./node_modules/@anydigital/breakout-css/dist/breakout.css ./assets/",
13
+ "postcss": "postcss './src/!(_)*.css' --dir ./assets",
14
+ "build": "npm run postcss -- --no-map",
13
15
  "start": "npm run postcss -- --watch",
14
16
  "prepublishOnly": "npm run build"
15
17
  },
@@ -30,10 +32,6 @@
30
32
  "postcss": "^8.4.33",
31
33
  "postcss-cli": "^11.0.0",
32
34
  "postcss-import": "^16.1.1",
33
- "postcss-preset-env": "^10.6.0",
34
35
  "prettier-plugin-jinja-template": "^2.1.0"
35
- },
36
- "dependencies": {
37
- "@anydigital/breakout-css": "^0.11.1"
38
36
  }
39
37
  }