@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.
@@ -0,0 +1,54 @@
1
+ /*** Extends https://github.com/picocss/pico/blob/main/scss/content/_typography.scss ***/
2
+ html {
3
+ /* Enable font smoothing */
4
+ -webkit-font-smoothing: antialiased;
5
+ -moz-osx-font-smoothing: grayscale;
6
+ }
7
+
8
+ body {
9
+ /* Enable global hyphenation */
10
+ hyphens: auto;
11
+ /* ... except for links and tables which are better (safer) without hyphenation */
12
+ a,
13
+ table {
14
+ hyphens: none;
15
+ }
16
+ }
17
+ /*
18
+ <!--section:docs-->
19
+ ## Heading anchors
20
+ ```css */
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
+
46
+ ## List markers
47
+ ```css */
48
+ ul,
49
+ ol {
50
+ li[data-marker]::marker {
51
+ content: attr(data-marker) " ";
52
+ }
53
+ }
54
+ /*``` <!--section--> */
@@ -1,4 +1,6 @@
1
- /* @TODO: tricks-wiki */
1
+ /* <!--section:docs-->
2
+ Overrides for https://github.com/picocss/pico/blob/main/scss/utilities/_reduce-motion.scss
3
+ ```css */
2
4
  @utility unreduce-animation-* {
3
5
  @media (prefers-reduced-motion: reduce) {
4
6
  &:not([aria-busy="true"]) {
@@ -8,5 +10,4 @@
8
10
  }
9
11
  }
10
12
  }
11
-
12
- /* Overrides https://github.com/picocss/pico/blob/main/scss/utilities/_reduce-motion.scss */
13
+ /*``` <!--section--> */
@@ -0,0 +1,72 @@
1
+ /* <!--section:docs-->
2
+
3
+ ## Jump to top
4
+ ```css */
5
+ [data-jump-to="top"] {
6
+ position: fixed;
7
+ bottom: 0;
8
+ right: 0;
9
+ padding-top: 50vh;
10
+ opacity: 25%;
11
+
12
+ &:hover {
13
+ opacity: 75%;
14
+ }
15
+ }
16
+ /*```
17
+
18
+ ## Table of contents
19
+ ```css */
20
+ [data-is-toc] {
21
+ font-size: 87.5%;
22
+
23
+ a {
24
+ text-decoration: none;
25
+ }
26
+ > ul {
27
+ columns: 30ch auto; /* 2 cols max for 65ch container */
28
+ }
29
+ }
30
+
31
+ /*```
32
+
33
+ ## Auto-columns
34
+ ```css */
35
+ .columns {
36
+ columns: 20ch auto; /* 3 cols max for 65ch container */
37
+
38
+ /* Avoid breaking inside elements, such as nested lists */
39
+ > * {
40
+ break-inside: avoid;
41
+ }
42
+ }
43
+ /*```
44
+
45
+ ## Auto-dark
46
+ ```css */
47
+ @media (prefers-color-scheme: dark) {
48
+ :root:not([data-theme="light"]) {
49
+ .dark-auto {
50
+ filter: invert(100%) hue-rotate(180deg);
51
+ }
52
+ }
53
+ }
54
+ /*```
55
+
56
+ ## Other
57
+ ```css */
58
+ .faded {
59
+ opacity: 50%;
60
+ &:hover {
61
+ opacity: 87.5%;
62
+ }
63
+ }
64
+
65
+ /* Extends https://tailwindcss.com/docs/filter-invert */
66
+ .invert {
67
+ /* Fix the scrollbar color when inverted */
68
+ ::-webkit-scrollbar {
69
+ filter: invert(1) !important;
70
+ }
71
+ }
72
+ /*``` <!--section--> */
package/src/blades.css CHANGED
@@ -1,18 +1,15 @@
1
- /**
2
- * Follows the structure of https://github.com/picocss/pico/blob/main/scss/_index.scss
3
- */
4
-
5
- @import "./_classless";
1
+ /*** Follows https://github.com/picocss/pico/blob/main/scss/_index.scss ***/
6
2
 
7
3
  /* Layout */
4
+ @import "./_layout";
8
5
  @import "./breakout";
9
6
 
10
7
  /* Content */
8
+ @import "./_typography";
9
+ @import "./_link";
11
10
  @import "./_table";
12
11
  @import "./responsive-table";
12
+ @import "./_code";
13
13
 
14
14
  /* Utilities */
15
- @import "./_tricks";
16
-
17
- /* 3rd-party */
18
- @import "./_prism";
15
+ @import "./_utilities";
package/src/breakout.css CHANGED
@@ -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,11 +28,6 @@
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 */
@@ -85,3 +79,16 @@
85
79
  }
86
80
  }
87
81
  }
82
+ /*```<!--section:docs-->
83
+ Framework-agnostic utilities for breaking out images and figures beyond their container width.
84
+
85
+ Use the `.breakout` class to allow elements to extend beyond their parent container:
86
+
87
+ ```html
88
+ <div class="breakout">
89
+ <img src="image.jpg" alt="Description" />
90
+ </div>
91
+ ```
92
+
93
+ 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.
94
+ <!--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 |
@@ -1,48 +0,0 @@
1
- html {
2
- /* Prevent horizontal overflow and scrolling, modern way */
3
- overflow-x: clip;
4
-
5
- /* Font smoothing */
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
9
-
10
- body {
11
- /* Ensures body takes at least the full height of the viewport (using dynamic viewport height for better mobile support) */
12
- min-height: 100dvh;
13
-
14
- /* Make the body a flex container with column layout; main fills space */
15
- display: flex;
16
- flex-direction: column;
17
- > main {
18
- flex-grow: 1;
19
- }
20
-
21
- /* Hyphenation */
22
- hyphens: auto;
23
- /* Links and tables are better (safer) without hyphenation */
24
- a,
25
- table {
26
- hyphens: none;
27
- }
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/_prism.css DELETED
@@ -1,14 +0,0 @@
1
- /* Prism.js */
2
- .token.treeview-part {
3
- .entry-line {
4
- width: 2.5em !important;
5
- opacity: 25%;
6
- }
7
- .entry-name:last-child {
8
- opacity: 50%;
9
-
10
- &::before {
11
- display: none !important;
12
- }
13
- }
14
- }
package/src/_tricks.css DELETED
@@ -1,117 +0,0 @@
1
- /* Header anchors @TODO: add to tricks-wiki */
2
- h1,
3
- h2,
4
- h3,
5
- h4,
6
- h5,
7
- h6 {
8
- position: relative;
9
-
10
- [data-is-anchor] {
11
- visibility: hidden;
12
- position: absolute;
13
- top: 0;
14
- right: 100%;
15
- padding-right: 0.2ch;
16
- color: silver;
17
- text-decoration: none;
18
- }
19
- &:hover {
20
- [data-is-anchor] {
21
- visibility: visible;
22
- }
23
- }
24
- }
25
-
26
- /* Helper to handle icons in links */
27
- a > i {
28
- display: inline-block;
29
- /* margin-inline-end: 0.375ch; safer to use &nbsp;? */ /* =3/8 */
30
- font-style: normal;
31
- }
32
-
33
- /* Favicons in links @TODO: add to tricks-wiki */
34
- a[data-has-favicon] {
35
- display: inline-block;
36
-
37
- > img {
38
- max-height: 1.25em;
39
- margin-top: calc(-0.25em / 2);
40
- margin-inline-end: 0.375ch; /* =3/8 */
41
-
42
- /* for tw-typography (.prose) */
43
- display: inline-block;
44
- margin-bottom: 0;
45
- }
46
- }
47
-
48
- code[data-caption] {
49
- &::before {
50
- content: attr(data-caption);
51
- display: block;
52
- margin-bottom: 1rem;
53
- opacity: 50%;
54
- font-style: italic;
55
- }
56
- }
57
-
58
- /* Tailwind tricks */
59
- .invert {
60
- /* Fix the scrollbar color when inverted */
61
- ::-webkit-scrollbar {
62
- filter: invert(1) !important;
63
- }
64
- }
65
-
66
- /* Jump to top trick */
67
- [data-jump-to="top"] {
68
- position: fixed;
69
- bottom: 0;
70
- right: 0;
71
- padding-top: 50vh;
72
- opacity: 25%;
73
-
74
- &:hover {
75
- opacity: 75%;
76
- }
77
- }
78
-
79
- /* Table of contents */
80
- [data-is-toc] {
81
- font-size: 87.5%;
82
-
83
- a {
84
- text-decoration: none;
85
- }
86
- > ul {
87
- columns: 30ch auto; /* 2 cols max for 65ch container */
88
- }
89
- }
90
-
91
- /* @TODO: to TRICKS */
92
- .columns {
93
- columns: 20ch auto; /* 3 cols max for 65ch container */
94
- }
95
-
96
- /* @TODO: to TRICKS */
97
- ul,
98
- ol {
99
- li[data-marker]::marker {
100
- content: attr(data-marker) " ";
101
- }
102
- }
103
-
104
- .faded {
105
- opacity: 50%;
106
- &:hover {
107
- opacity: 87.5%;
108
- }
109
- }
110
-
111
- @media (prefers-color-scheme: dark) {
112
- :root:not([data-theme="light"]) {
113
- .dark-auto {
114
- filter: invert(100%) hue-rotate(180deg);
115
- }
116
- }
117
- }