@splendidlabz/styles 4.2.1 → 4.3.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.2.1",
3
+ "version": "4.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "Zell Liew <zellwk@gmail.com>",
@@ -23,7 +23,7 @@
23
23
  "build": "npm run build-styles & npm run build-layouts"
24
24
  },
25
25
  "dependencies": {
26
- "@splendidlabz/utils": "1.8.0"
26
+ "@splendidlabz/utils": "*"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@splendidlabz/stylelint-config": "3.1.1",
@@ -44,47 +44,46 @@
44
44
  }
45
45
 
46
46
  @utility indentlist-guides {
47
- & {
48
- @apply indentlist-scaffold;
47
+ @apply indentlist-scaffold;
48
+
49
+ li {
50
+ position: relative;
51
+ margin-block: 0;
52
+ margin-inline-start: 0;
53
+ padding-inline-start: var(--indent, 1em);
54
+ list-style-type: none;
49
55
 
50
- li {
56
+ a {
51
57
  position: relative;
52
- margin-inline-start: 0;
53
- margin-block: 0;
58
+ margin-inline-start: calc(var(--indent, 1em) * -2);
54
59
  padding-inline-start: var(--indent, 1em);
60
+ }
61
+
62
+ li::before,
63
+ a::before {
64
+ content: '';
65
+ position: absolute;
66
+ top: 0;
67
+ bottom: 0;
68
+ left: 0;
69
+ width: var(--guide-width, 1px);
70
+ background-color: var(--guide-color, transparent);
71
+ }
72
+
73
+ a:hover::before {
74
+ background-color: var(--guide-hover-color, var(--guide-color));
75
+ }
55
76
 
56
- a {
57
- position: relative;
58
- margin-inline-start: calc(var(--indent, 1em) * -2);
59
- padding-inline-start: var(--indent, 1em);
60
- }
61
-
62
- &::before,
63
- a::before {
64
- content: '';
65
- position: absolute;
66
- top: 0;
67
- bottom: 0;
68
- left: 0;
69
- width: var(--guide-width, 1px);
70
- background-color: var(--guide-color, transparent);
71
- }
72
-
73
- a:hover::before {
74
- background-color: var(--guide-hover-color, var(--guide-color));
75
- }
76
-
77
- a:focus::before {
78
- background-color: var(
79
- --guide-focus-color,
80
- var(--guide-hover-color, var(--guide-color))
81
- );
82
- }
77
+ a:focus::before {
78
+ background-color: var(
79
+ --guide-focus-color,
80
+ var(--guide-hover-color, var(--guide-color))
81
+ );
83
82
  }
84
83
  }
85
84
 
86
85
  li li a {
87
- margin-inline-start: calc(var(--indent, 1em) * -3);
86
+ margin-inline-start: calc(var(--indent, 1em) * -2);
88
87
  }
89
88
  }
90
89
 
@@ -3,6 +3,7 @@
3
3
  @import './hero-heading.css';
4
4
  @import './indent-list.css';
5
5
  @import './prose.css';
6
+ @import './prose-div.css';
6
7
  @import './shapes.css';
7
8
  @import './simple-svg.css';
8
9
  @import './table.css';
@@ -0,0 +1,78 @@
1
+ /* Same as prose (as much as possible), but without flexbox */
2
+ @utility prose-div {
3
+ & {
4
+ max-width: 100%;
5
+
6
+ > * + * {
7
+ margin-block: 1lh;
8
+ }
9
+
10
+ /* 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). */
11
+ > * + :where(h2),
12
+ > * + :where(astro-island, astro-slot) > :where(h2):first-child {
13
+ margin-top: calc(var(--spacing) * 6);
14
+ scroll-margin-top: calc(var(--spacing) * 6);
15
+ }
16
+
17
+ > * + :where(h3),
18
+ > * + :where(astro-island, astro-slot) > :where(h3):first-child {
19
+ margin-top: calc(var(--spacing) * 4);
20
+ margin-bottom: calc(var(--spacing) * -2);
21
+ scroll-margin-top: calc(var(--spacing) * 4);
22
+ }
23
+
24
+ > * + :where(h4, h5, h6),
25
+ > * + :where(astro-island, astro-slot) > :where(h4, h5, h6):first-child {
26
+ margin-top: calc(var(--spacing) * 4);
27
+ margin-bottom: calc(var(--spacing) * -4);
28
+ scroll-margin-top: calc(var(--spacing) * 4);
29
+ }
30
+
31
+ :where(ul) {
32
+ list-style-type: initial;
33
+ }
34
+
35
+ /* Basic list styles */
36
+ :where(ul, ol),
37
+ > :where(astro-island, astro-slot) :where(ul, ol) {
38
+ list-style-position: outside;
39
+ margin-left: 2em;
40
+
41
+ :where(ul, ol) {
42
+ margin-left: 0;
43
+ padding-left: 2em;
44
+ }
45
+
46
+ li {
47
+ font-variant-numeric: lining-nums;
48
+ }
49
+
50
+ li + li {
51
+ margin-top: calc(var(--spacing));
52
+ }
53
+
54
+ li:has(li) + li {
55
+ margin-top: calc(var(--spacing) * 2);
56
+ }
57
+
58
+ li > :where(ul, ol) {
59
+ margin-top: calc(var(--spacing));
60
+ }
61
+ }
62
+
63
+ :where(a) {
64
+ text-decoration: underline;
65
+ }
66
+
67
+ > img,
68
+ figure img {
69
+ border: 1px solid oklch(90% 0 0deg);
70
+ border-radius: var(--radius);
71
+ }
72
+
73
+ &.fancylist,
74
+ & .fancylist {
75
+ padding-left: 0;
76
+ }
77
+ }
78
+ }
@@ -46,7 +46,7 @@
46
46
  }
47
47
 
48
48
  @utility accordion-content {
49
- @apply padding-scaffold;
49
+ /* @apply padding-scaffold; */
50
50
 
51
51
  &:not(.accordion-stack &) {
52
52
  padding-top: 0;
@@ -15,6 +15,7 @@
15
15
  border-start-start-radius: 0;
16
16
  border-end-start-radius: 0;
17
17
  }
18
+
18
19
  &.fixed-rightfull {
19
20
  border-start-end-radius: 0;
20
21
  border-end-end-radius: 0;
@@ -20,7 +20,7 @@
20
20
 
21
21
  /* Base/Closing Style */
22
22
  .modal-content {
23
- @apply border-scaffold;
23
+ /* @apply border-scaffold; */
24
24
  margin: auto;
25
25
  padding: 1lh;
26
26
  color: var(--text-color);
@@ -29,13 +29,20 @@
29
29
  @utility gradient {
30
30
  & {
31
31
  @apply tw-gradient;
32
- background: linear-gradient(
32
+ background-image: linear-gradient(
33
33
  var(--gradient-angle) in var(--color-space) var(--hue-interpolation),
34
34
  var(--gradient, var(--tw-gradient))
35
35
  );
36
36
  }
37
37
  }
38
38
 
39
+ @function --linear-gradient(--gradient) {
40
+ result: linear-gradient(
41
+ var(--gradient-angle) in var(--color-space) var(--hue-interpolation),
42
+ var(--gradient)
43
+ );
44
+ }
45
+
39
46
  @utility linear-gradient {
40
47
  @apply gradient;
41
48
  }
@@ -62,6 +69,7 @@
62
69
 
63
70
  @utility text-gradient {
64
71
  & {
72
+ @apply gradient;
65
73
  display: inline-flex;
66
74
  -webkit-text-fill-color: transparent;
67
75
  background-clip: text;
@@ -33,14 +33,15 @@
33
33
  & {
34
34
  display: grid;
35
35
  gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
36
- /* width: 100%; */
36
+ width: 100%;
37
+ max-width: 100%;
37
38
 
38
39
  > *,
39
40
  > *:where(.contents) > *,
40
41
  > *:where(astro-island, astro-slot) > * {
41
42
  grid-column: var(--colstart) / var(--colend, span var(--span));
42
43
  grid-row: var(--rowstart) / var(--rowend, span var(--rowspan));
43
- /* width: 100%; */
44
+ max-width: 100%;
44
45
  }
45
46
  }
46
47
  }
@@ -85,11 +86,9 @@
85
86
  minmax(0, var(--content-width, 1fr))
86
87
  minmax(0, var(--end-width, var(--side-width, 0.25fr)));
87
88
  gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
88
- max-width: 100%;
89
89
 
90
90
  > * {
91
91
  grid-column: 2 / -2;
92
- max-width: 100%;
93
92
  }
94
93
 
95
94
  > .breakout-small {
@@ -2,5 +2,5 @@
2
2
  * Wrap *
3
3
  *********************/
4
4
  @utility wrap {
5
- padding-inline: var(--wrap-padding, 1rlh);
5
+ padding-inline: var(--wrap-padding, calc(var(--spacing) * 4));
6
6
  }
@@ -353,7 +353,7 @@
353
353
  --tx: -50%;
354
354
  --ty: 0%;
355
355
  --_tx: calc(var(--tx) * -1);
356
- --_ty: calc(var(--ty) * -1);
356
+ --_ty: calc(var(--ty));
357
357
  }
358
358
 
359
359
  @utility edge-adjust-righttop-start {
@@ -1,34 +1,18 @@
1
- /* // Potential improvements fro flexibility with Style Queries or CSS IF in the future. */
1
+ /* Potential improvements for flexibility with Style Queries or CSS IF in the future. */
2
2
  @utility shell-grid {
3
+ @apply shell-body;
4
+
3
5
  & {
4
- display: grid;
5
- grid-template-columns:
6
- minmax(0, var(--lsb-width, auto))
7
- minmax(0, 1fr);
8
- gap: var(--gap, 0);
6
+ /* Seems to be ok to use inherit too? Test it out. If that's ok, remove this and just use shell-body */
7
+ /* height: inherit; */
9
8
  height: 100dvh;
10
9
  }
11
10
 
12
- &:has(> header) {
11
+ &:has(> .header) {
13
12
  grid-template-rows: auto 1fr;
14
13
  }
15
14
 
16
- &:has(> .right-sidebar) {
17
- grid-template-columns:
18
- minmax(0, var(--lsb-width, auto))
19
- minmax(0, var(--content-width, 1fr))
20
- minmax(0, var(--rsb-width, auto));
21
- }
22
-
23
- & > :is(header, footer, .full) {
15
+ & > :is(.header, .footer, .full) {
24
16
  grid-column: 1 / -1;
25
17
  }
26
-
27
- > .left-sidebar,
28
- > .right-sidebar,
29
- > .content {
30
- overflow: auto;
31
- grid-column-end: span var(--span, 1);
32
- height: auto;
33
- }
34
18
  }
@@ -13,3 +13,29 @@
13
13
  }
14
14
  }
15
15
  }
16
+
17
+ @utility shell-body {
18
+ & {
19
+ display: grid;
20
+ grid-template-columns:
21
+ minmax(0, var(--lsb-width, auto))
22
+ minmax(0, 1fr);
23
+ gap: var(--gap, 0);
24
+ height: inherit;
25
+ }
26
+
27
+ &:has(> .right-sidebar) {
28
+ grid-template-columns:
29
+ minmax(0, var(--lsb-width, auto))
30
+ minmax(0, var(--content-width, 1fr))
31
+ minmax(0, var(--rsb-width, auto));
32
+ }
33
+
34
+ > .left-sidebar,
35
+ > .right-sidebar,
36
+ > .content {
37
+ overflow: auto;
38
+ grid-column-end: span var(--span, 1);
39
+ height: auto;
40
+ }
41
+ }
@@ -1,4 +1,4 @@
1
1
  /* Returns a color with alpha value */
2
- @function --color(--color, --alpha) {
2
+ @function --alpha(--color, --alpha) {
3
3
  result: oklch(from var(--color) l c h / var(--alpha));
4
4
  }
@@ -1,8 +1,9 @@
1
+ /* Temp rework. Have to really figure this one out first... */
1
2
  @utility object-background {
2
- position: absolute;
3
+ /* position: absolute;
3
4
  inset: 0;
4
5
  z-index: -1;
5
6
  width: 100%;
6
- height: 100%;
7
+ height: 100%; */
7
8
  object-fit: cover;
8
9
  }
@@ -98,14 +98,8 @@ Usage with the Fill System
98
98
 
99
99
  @utility pigment-active-svg-scaffold {
100
100
  &:active {
101
- --_fc: var(--fill-active-color, var(--fill-color, transparent));
102
- --_sc: var(
103
- --stroke-active-color,
104
- var(
105
- --text-active-color,
106
- var(--stroke-color, var(--text-color, currentcolor))
107
- )
108
- );
101
+ --_fc: var(--fill-active-color, var(--fill-color, revert-layer));
102
+ --_sc: var(--stroke-active-color, var(--_tc));
109
103
  }
110
104
  }
111
105
 
@@ -129,14 +123,8 @@ Usage with the Fill System
129
123
  &[aria-selected='true'],
130
124
  &[aria-pressed='true'],
131
125
  &[aria-expanded='true'] {
132
- --_fc: var(--fill-selected-color, var(--fill-color, transparent));
133
- --_sc: var(
134
- --stroke-selected-color,
135
- var(
136
- --text-selected-color,
137
- var(--stroke-color, var(--text-color, currentcolor))
138
- )
139
- );
126
+ --_fc: var(--fill-selected-color, var(--fill-color, revert-layer));
127
+ --_sc: var(--stroke-selected-color, var(--_tc));
140
128
  }
141
129
  }
142
130
 
@@ -22,9 +22,9 @@
22
22
  --radius: calc(var(--spacing) * --value(integer));
23
23
  }
24
24
 
25
- @utility rounded-* {
25
+ /* @utility rounded-* {
26
26
  border-radius: calc(var(--spacing) --value(integer));
27
- }
27
+ } */
28
28
 
29
29
  @utility rounded-t-* {
30
30
  border-top-left-radius: calc(var(--spacing) --value(integer));
@@ -0,0 +1,88 @@
1
+ // Variable Font Support.
2
+ // Used for Adobe Fonts... because they mess up font weight
3
+ // Seems to be a problem... maybe can build a Youtube Video or TikTok video?
4
+ // To be used together with Splendid Type for the best effects. Can be used directly with CSS though.
5
+
6
+ import plugin from 'tailwindcss/plugin'
7
+
8
+ export const variableFont = plugin(config => {
9
+ const { matchUtilities, theme } = config
10
+
11
+ // Font Weight
12
+ // Use wght
13
+ matchUtilities(
14
+ {
15
+ 'font-weight': value => ({ '--font-weight': value }),
16
+ },
17
+ {
18
+ values: theme('fontWeight'),
19
+ },
20
+ )
21
+
22
+ matchUtilities({
23
+ // Standard axes
24
+ 'font-width': value => ({ '--font-width': value }), // wdth
25
+ 'font-stretch': value => ({ '--font-width': value }), // wdth
26
+ 'font-slant': value => ({ '--font-slant': value }), // slnt
27
+ 'font-opsz': value => ({ '--font-optical-size': value }), // opsz
28
+ 'font-contrast': value => ({ '--font-contrast': value }), // CNTR
29
+
30
+ // Parametric Axes
31
+ 'font-thick-stroke': value => ({ '--font-thick-stroke': value }), // XOPQ
32
+ 'font-thin-stroke': value => ({ '--font-thin-stroke': value }), // YOPQ
33
+ 'font-counter-width': value => ({ '--font-counter-width': value }), // XTRA
34
+ 'font-uppercase-height': value => ({ '--font-uppercase-height': value }), // YTUC
35
+ 'font-lowercase-height': value => ({ '--font-lowercase-height': value }), // YTLC
36
+ 'font-ascender-height': value => ({ '--font-ascender-height': value }), // YTAS
37
+ 'font-descender-depth': value => ({ '--font-descender-depth': value }), // YTDE
38
+ 'font-figure-height': value => ({ '--font-figure-height': value }), // YTFI
39
+ })
40
+ })
41
+
42
+ export function fontVariationSettings({
43
+ // Standard axes
44
+ weight,
45
+ width,
46
+ slant,
47
+ italics,
48
+ opticalSize,
49
+ contrast,
50
+
51
+ // Parametric Axes
52
+ thickStroke,
53
+ thinStroke,
54
+ counterWidth,
55
+ uppercaseHeight,
56
+ lowercaseHeight,
57
+ ascenderHeight,
58
+ descenderDepth,
59
+ figureHeight,
60
+ } = {}) {
61
+ const ret = []
62
+
63
+ // Standard axes
64
+ if (weight) ret.push(`"wght" var(--font-weight, ${weight})`)
65
+ if (width) ret.push(`"wdth" var(--font-width, ${width})`)
66
+ if (slant) ret.push(`"slnt" var(--font-slant, ${slant})`)
67
+ if (italics) ret.push(`"ital" var(--font-italics, ${italics})`)
68
+ if (opticalSize) ret.push(`"opsz" var(--font-optical-size, ${opticalSize})`)
69
+ if (contrast) ret.push(`"CNTR" var(--font-contrast, ${contrast})`)
70
+
71
+ // Parametric Axes
72
+ if (thickStroke) ret.push(`"XOPQ" var(--font-thick-stroke, ${thickStroke})`)
73
+ if (thinStroke) ret.push(`"YOPQ" var(--font-counter-width, ${thinStroke})`)
74
+ if (counterWidth)
75
+ ret.push(`"XTRA" var(--font-counter-width, ${counterWidth})`)
76
+ if (uppercaseHeight)
77
+ ret.push(`"YTUC" var(--font-uppercase-height, ${uppercaseHeight})`)
78
+ if (lowercaseHeight)
79
+ ret.push(`"YTLC" var(--font-lowercase-height, ${lowercaseHeight})`)
80
+ if (ascenderHeight)
81
+ ret.push(`"YTAS" var(--font-ascender-height, ${ascenderHeight})`)
82
+ if (descenderDepth)
83
+ ret.push(`"YTDE" var(--font-descender-depth, ${descenderDepth})`)
84
+ if (figureHeight)
85
+ ret.push(`"YTFI" var(--font-figure-height, ${figureHeight})`)
86
+
87
+ return ret.join(', ')
88
+ }