@splendidlabz/styles 4.0.0 → 4.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splendidlabz/styles",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "Zell Liew <zellwk@gmail.com>",
@@ -23,10 +23,10 @@
23
23
  "build": "npm run build-styles & npm run build-layouts"
24
24
  },
25
25
  "dependencies": {
26
- "@splendidlabz/utils": "1.5.0"
26
+ "@splendidlabz/utils": "1.6.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@splendidlabz/stylelint-config": "3.0.0",
29
+ "@splendidlabz/stylelint-config": "3.1.0",
30
30
  "@tailwindcss/cli": "^4.1.3",
31
31
  "lightningcss-cli": "^1.29.3",
32
32
  "tailwindcss": "^4.1.3",
@@ -3,13 +3,17 @@
3
3
  --svg-width: 1em;
4
4
  --svg-height: 1lh;
5
5
  display: grid;
6
- grid-template-columns: auto 1fr;
6
+
7
+ /* grid-template-columns: auto 1fr; */
7
8
  column-gap: 0.5em;
8
9
 
9
10
  :where(li) {
10
11
  grid-column: 1 / -1;
11
12
  display: grid;
12
- grid-template-columns: subgrid;
13
+
14
+ /* grid-template-columns: subgrid; */
15
+ grid-template-columns: auto 1fr;
16
+ column-gap: inherit;
13
17
 
14
18
  /* Positions the Emoji */
15
19
 
@@ -19,10 +23,12 @@
19
23
  font-size: 0.75em;
20
24
  line-height: 1lh;
21
25
  }
22
- }
23
- }
24
26
 
25
- .prose & {
26
- margin-left: 0;
27
+ :where(ul) {
28
+ grid-column: 2;
29
+ display: grid;
30
+ column-gap: inherit;
31
+ }
32
+ }
27
33
  }
28
34
  }
@@ -1,56 +1,97 @@
1
+ @utility box {
2
+ @apply card;
3
+ }
4
+
1
5
  @utility card {
2
6
  & {
3
- padding: var(--padding, 1rlh);
4
- border: var(--border-width) var(--border-style) var(--border-color);
5
- border-radius: var(--radius);
7
+ @apply border-scaffold;
8
+ @apply padding-scaffold;
6
9
  }
7
10
  }
8
11
 
9
- @utility card-split {
12
+ @utility card-divided {
10
13
  & {
11
- @apply card;
14
+ @apply border-scaffold;
15
+ position: relative;
12
16
 
13
- > *,
14
- :where(astro-slot, astro-island, astro-content) > * {
15
- @apply nudge;
16
- padding: var(--padding, 1rlh);
17
+ &:is(&) {
18
+ gap: 0;
19
+ padding: 0;
17
20
  }
18
21
 
19
- /* Inner Card Split */
20
- > .card-split {
21
- border: 0;
22
- }
22
+ > *:not(&),
23
+ > :where(astro-slot, astro-island, astro-content) > *:not(&) {
24
+ @apply padding-scaffold;
25
+ --fallback-padding: 1rlh;
23
26
 
24
- &.card-split {
25
- /* Increase specificity to overwrite padding and gap utilities used on card-split. */
26
- overflow: hidden;
27
- gap: 0;
28
- padding: 0;
27
+ /* @apply inner-radius; */
29
28
 
30
- > *,
31
- :where(astro-slot, astro-island, astro-content) > * {
32
- border-radius: calc(var(--radius) - var(--nudge));
29
+ /* Raise for nicer focus ring */
30
+ &:focus-visible {
31
+ z-index: 2;
33
32
  }
34
- }
35
33
 
36
- /* Adjust borders */
37
- &:where(.divider-between-x, .divider-between-horizontal)
38
- > :where(.card-split) {
39
- border-width: 0;
40
- border-top-width: var(--border-width);
34
+ &:not(:focus-visible) {
35
+ --z-index: 1;
36
+ animation: z-index-hack var(--transition-duration)
37
+ var(--transition-delay);
38
+ }
41
39
  }
40
+ }
41
+ }
42
42
 
43
- &:where(.divider-between-y, .divider-between-vertical)
44
- > :where(.card-split) {
45
- border-width: 0;
46
- border-left-width: var(--border-width);
47
- }
43
+ @utility card-divided-horizontal {
44
+ @apply horizontal;
45
+ @apply divider-between-y;
46
+
47
+ > * {
48
+ border-width: 0;
49
+ border-radius: 0;
50
+ }
51
+
52
+ > :where(:not(:first-child)) {
53
+ border-left-width: var(--border-width);
54
+ border-color: var(--_bc, var(--border-color));
55
+ }
56
+
57
+ > :where(:first-child) {
58
+ border-radius: 0;
59
+ border-top-left-radius: var(--radius);
60
+ border-bottom-left-radius: var(--radius);
61
+ }
62
+
63
+ > :where(:last-child) {
64
+ border-radius: 0;
65
+ border-top-right-radius: var(--radius);
66
+ border-bottom-right-radius: var(--radius);
48
67
  }
49
68
  }
50
69
 
51
- /*********************
52
- * Aliases *
53
- *********************/
54
- @utility box {
55
- @apply card;
70
+ @utility card-divided-vertical {
71
+ @apply vertical;
72
+ @apply divider-between-x;
73
+
74
+ > * {
75
+ border-width: 0;
76
+ border-radius: 0;
77
+ }
78
+
79
+ > :where(:not(:first-child)) {
80
+ border-top-width: var(--border-width);
81
+ border-style: var(--border-style);
82
+ }
83
+
84
+ > :first-child {
85
+ border-top-left-radius: var(--radius);
86
+ border-top-right-radius: var(--radius);
87
+ }
88
+
89
+ > :last-child {
90
+ border-bottom-left-radius: var(--radius);
91
+ border-bottom-right-radius: var(--radius);
92
+ }
93
+ }
94
+
95
+ @utility card-split {
96
+ @apply card-divided;
56
97
  }
@@ -4,7 +4,7 @@
4
4
  @utility hero-heading {
5
5
  display: flex;
6
6
  flex-direction: column;
7
- gap: 0.25rem;
7
+ gap: var(--gap, 0.5lh);
8
8
  max-width: 100%;
9
9
 
10
10
  > .eyebrow {
@@ -29,6 +29,7 @@
29
29
  & {
30
30
  @apply hero-heading;
31
31
  align-self: center;
32
+ align-items: center;
32
33
  margin-inline: auto;
33
34
  text-align: center;
34
35
  }
@@ -7,22 +7,20 @@
7
7
 
8
8
  /* Using padding instead of margin, so #targets will leave some whitespace above when scrolling to the component. (We can also use scroll-margin-top + margin-top... but this is simpler). */
9
9
  > * + :where(h2),
10
- > * + :where(astro-island, astro-slot) > :where(:where(h2):first-child) {
10
+ > * + :where(astro-island, astro-slot) > :where(h2):first-child {
11
11
  margin-top: 1.5rlh;
12
12
  scroll-margin-top: 1.5rlh;
13
13
  }
14
14
 
15
15
  > * + :where(h3),
16
- > * + :where(astro-island, astro-slot) > :where(:where(h3):first-child) {
16
+ > * + :where(astro-island, astro-slot) > :where(h3):first-child {
17
17
  margin-top: 1rlh;
18
18
  margin-bottom: -0.5rlh;
19
19
  scroll-margin-top: 1rlh;
20
20
  }
21
21
 
22
22
  > * + :where(h4, h5, h6),
23
- > *
24
- + :where(astro-island, astro-slot)
25
- > :where(:where(h4, h5, h6):first-child) {
23
+ > * + :where(astro-island, astro-slot) > :where(h4, h5, h6):first-child {
26
24
  margin-top: 1rlh;
27
25
  margin-bottom: -1rlh;
28
26
  scroll-margin-top: 1rlh;
@@ -68,5 +66,10 @@
68
66
  border: 1px solid oklch(90% 0 0deg);
69
67
  border-radius: var(--radius);
70
68
  }
69
+
70
+ &.fancylist,
71
+ & .fancylist {
72
+ padding-left: 0;
73
+ }
71
74
  }
72
75
  }
@@ -1,4 +1,16 @@
1
+ @utility accordion-stack {
2
+ @apply card-divided card-divided-vertical;
3
+
4
+ .accordion-button {
5
+ padding: 0;
6
+ }
7
+ }
8
+
1
9
  @utility accordion {
10
+ &:not(.accordion-stack &) {
11
+ @apply border-scaffold;
12
+ }
13
+
2
14
  svg {
3
15
  transition: var(--transition-values);
4
16
  transition-property: var(--transition-props);
@@ -12,6 +24,7 @@
12
24
  @utility accordion-button {
13
25
  & {
14
26
  @apply padding-scaffold;
27
+ --border-width: 0;
15
28
  display: flex;
16
29
  justify-content: space-between;
17
30
  align-items: start;
@@ -33,5 +46,9 @@
33
46
  }
34
47
 
35
48
  @utility accordion-content {
36
- padding: 1rem;
49
+ @apply padding-scaffold;
50
+
51
+ &:not(.accordion-stack &) {
52
+ padding-top: 0;
53
+ }
37
54
  }
@@ -33,7 +33,7 @@
33
33
 
34
34
  .modal,
35
35
  .modal::backdrop {
36
- @apply transition-scaffold;
36
+ @apply transition-scaffold-extended;
37
37
  --transition-duration: 300ms;
38
38
  --transition-easing: ease-in;
39
39
  opacity: 0;
@@ -1,7 +1,7 @@
1
1
  @layer base {
2
2
  [popover] {
3
3
  @apply border-scaffold;
4
- @apply transition-scaffold;
4
+ @apply transition-scaffold-extended;
5
5
  --transition-duration: 300ms;
6
6
  --transition-easing: ease-out;
7
7
  position: absolute;
@@ -9,7 +9,7 @@
9
9
  --text-color: white; */
10
10
  }
11
11
 
12
- @utility fancy-box {
12
+ @utility fancybox {
13
13
  & {
14
14
  @apply border-scaffold;
15
15
  --a: var(--arrow-angle, 90deg);
@@ -28,7 +28,6 @@
28
28
  overflow: visible;
29
29
  position: relative;
30
30
  z-index: 0;
31
- padding: 0.5em; /* To remove */
32
31
  border-width: var(--b);
33
32
  border-color: transparent;
34
33
  color: var(--text-color);
@@ -40,9 +39,9 @@
40
39
  }
41
40
  }
42
41
 
43
- @utility fancy-box-arrow {
42
+ @utility fancybox-arrow {
44
43
  & {
45
- @apply fancy-box;
44
+ @apply fancybox;
46
45
  }
47
46
 
48
47
  &.arrow-top,
@@ -1,6 +1,6 @@
1
1
  @import './elevation.css';
2
2
  @import './gradients.css';
3
- @import './fancy-box.css';
3
+ @import './fancybox.css';
4
4
  @import './highlight.css';
5
5
  @import './shadows.css';
6
6
  @import './text.css';
@@ -31,6 +31,7 @@
31
31
  padding: var(--padding);
32
32
  border-width: 0;
33
33
 
34
+ /* TODO: Remove the following and use 'card-divided-horizontal' and 'card-divided-vertical' instead. Keep padding though */
34
35
  &:where(:not(:first-child, :last-child)) {
35
36
  border-radius: 0;
36
37
  }
@@ -13,6 +13,10 @@
13
13
  text-decoration: none !important;
14
14
  cursor: pointer;
15
15
 
16
+ &[disabled] {
17
+ cursor: default;
18
+ }
19
+
16
20
  * {
17
21
  pointer-events: none;
18
22
  }
@@ -64,30 +64,60 @@
64
64
  *********************/
65
65
  @utility grid-fr-auto {
66
66
  @apply grid-scaffold;
67
- grid-template-columns: minmax(0, 1fr) minmax(0, auto);
67
+ grid-template-columns:
68
+ repeat(calc(var(--cols) - 1), minmax(0, 1fr))
69
+ minmax(0, auto);
68
70
  }
69
71
 
70
72
  @utility grid-auto-fr {
71
73
  @apply grid-scaffold;
72
- grid-template-columns: minmax(0, auto) minmax(0, 1fr);
74
+ grid-template-columns: minmax(0, auto) repeat(
75
+ calc(var(--cols) - 1),
76
+ minmax(0, 1fr)
77
+ );
73
78
  }
74
79
 
75
80
  @utility grid-with-breakout {
76
81
  & {
77
- @apply grid-scaffold;
82
+ display: grid;
78
83
  grid-template-columns:
79
- [breakout-start] 1fr [content-start] repeat(
80
- var(--cols, 1),
81
- minmax(0, 1fr)
82
- )
83
- [content-end] 1fr [breakout-end];
84
-
85
- > *:not([class*='breakout-full']) {
86
- grid-column: content-start / content-end;
84
+ minmax(0, var(--start-width, var(--side-width, 0.25fr)))
85
+ minmax(0, var(--content-width, 1fr))
86
+ minmax(0, var(--end-width, var(--side-width, 0.25fr)));
87
+ gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
88
+ max-width: 100%;
89
+
90
+ > * {
91
+ grid-column: 2 / -2;
92
+ max-width: 100%;
93
+ }
94
+
95
+ > .breakout-small {
96
+ grid-column: auto / span 1;
97
+ }
98
+
99
+ > .breakout-start-only,
100
+ > .breakout-left-only {
101
+ grid-column: 1 / 2;
102
+ }
103
+
104
+ > .breakout-start,
105
+ > .breakout-left {
106
+ grid-column: 1 / -2;
107
+ }
108
+
109
+ > .breakout-end,
110
+ > .breakout-right {
111
+ grid-column: 2 / -1;
112
+ }
113
+
114
+ > .breakout-end-only,
115
+ > .breakout-right-only {
116
+ grid-column: -1 / -2;
87
117
  }
88
118
 
89
- > *:where(.breakout-full) {
90
- grid-column: breakout-start / breakout-end;
119
+ > .breakout-full {
120
+ grid-column: 1 / -1;
91
121
  }
92
122
  }
93
123
  }
@@ -34,6 +34,7 @@
34
34
  @utility divider-y {
35
35
  & {
36
36
  @apply divider-scaffold;
37
+ flex-grow: 0;
37
38
  flex-direction: column;
38
39
 
39
40
  &::before,
@@ -63,9 +64,9 @@
63
64
  row-gap: 0;
64
65
 
65
66
  > * + *,
66
- > * + *:where(astro-island, astro-slot) > * {
67
+ > * + *:where(astro-island, astro-slot):not(:first-of-type) > * {
67
68
  border-top-width: var(--border-width, 1px);
68
- border-color: var(--border-color);
69
+ border-color: var(--_bc, var(--border-color));
69
70
  }
70
71
  }
71
72
  }
@@ -77,7 +78,7 @@
77
78
  > * + *,
78
79
  > * + *:where(astro-island, astro-slot) > * {
79
80
  border-left-width: var(--border-width, 1px);
80
- border-color: var(--border-color);
81
+ border-color: var(--_bc, var(--border-color));
81
82
  }
82
83
  }
83
84
  }
@@ -4,3 +4,4 @@
4
4
  @import './breakout.css';
5
5
  @import './stacking-context.css';
6
6
  @import './scrollable.css';
7
+ @import './inner-spacing.css';
@@ -0,0 +1,39 @@
1
+ /*********************
2
+ * Inner Margin *
3
+ *********************/
4
+ @utility im-* {
5
+ & > * {
6
+ margin: calc(var(--spacing) * --value(integer));
7
+ margin: calc(--value([length]));
8
+ }
9
+ }
10
+
11
+ @utility im-x-* {
12
+ margin-inline: calc(var(--spacing) * --value(integer));
13
+ margin-inline: calc(--value([length]));
14
+ }
15
+
16
+ @utility im-y-* {
17
+ margin-block: calc(var(--spacing) * --value(integer));
18
+ margin-block: calc(--value([length]));
19
+ }
20
+
21
+ /*********************
22
+ * Inner Padding *
23
+ *********************/
24
+ @utility ip-* {
25
+ & > * {
26
+ padding: calc(var(--spacing) * --value(integer));
27
+ padding: calc(--value([length]));
28
+ }
29
+ }
30
+
31
+ @utility ip-x-* {
32
+ padding-inline: calc(var(--spacing) * --value(integer));
33
+ padding-inline: calc(--value([length]));
34
+ }
35
+
36
+ @utility ip-y-* {
37
+ padding-block: calc(var(--spacing) * --value(integer));
38
+ padding-block: calc(--value([length]));
39
+ }
@@ -14,6 +14,7 @@
14
14
  @apply micro;
15
15
  display: flex;
16
16
  flex-direction: row;
17
+ flex-wrap: nowrap;
17
18
  gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
18
19
 
19
20
  > .spacer {
@@ -27,6 +28,7 @@
27
28
  @apply micro;
28
29
  display: flex;
29
30
  flex-direction: column;
31
+ flex-wrap: nowrap;
30
32
  gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
31
33
 
32
34
  > .spacer {