@splendidlabz/styles 4.2.2 → 4.3.1
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 +4 -3
- package/src/components/css/card.css +0 -2
- package/src/components/css/indent-list.css +32 -33
- package/src/components/css/index.css +1 -0
- package/src/components/css/prose-div.css +78 -0
- package/src/components/css/table.css +2 -2
- package/src/components/svelte/accordion.css +1 -1
- package/src/components/svelte/drawer.css +2 -0
- package/src/components/svelte/modal.css +4 -9
- package/src/components/svelte/popover.css +3 -4
- package/src/effects/gradients.css +24 -2
- package/src/layouts/macro/grid.css +3 -4
- package/src/layouts/macro/wrap.css +1 -1
- package/src/layouts/micro/micro.css +2 -1
- package/src/layouts/position/edge.css +1 -1
- package/src/layouts/shell/shell-grid.css +7 -23
- package/src/layouts/shell/shell-simple.css +26 -0
- package/src/tools/color.css +1 -1
- package/src/tools/object.css +1 -3
- package/src/tools/pigment.css +4 -16
- package/src/tools/scaffolds.css +2 -2
- package/src/tools/transitions.css +6 -0
- package/src/type/font.css +18 -0
- package/src/variable-font.js +88 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splendidlabz/styles",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Zell Liew <zellwk@gmail.com>",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
".": "./src/styles.css",
|
|
13
13
|
"./components": "./src/components/index.css",
|
|
14
14
|
"./layouts/no-tw": "./dist/no-tw/styles.css",
|
|
15
|
-
"./scripts": "./scripts/index.js"
|
|
15
|
+
"./scripts": "./scripts/index.js",
|
|
16
|
+
"./scripts/*": "./scripts/*.js"
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
18
19
|
"lint": "stylelint '**/*.{css,scss}' --fix",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
"build": "npm run build-styles & npm run build-layouts"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@splendidlabz/utils": "
|
|
27
|
+
"@splendidlabz/utils": "*"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@splendidlabz/stylelint-config": "3.1.1",
|
|
@@ -44,47 +44,46 @@
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
@utility indentlist-guides {
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
56
|
+
a {
|
|
51
57
|
position: relative;
|
|
52
|
-
margin-inline-start:
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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) * -
|
|
86
|
+
margin-inline-start: calc(var(--indent, 1em) * -2);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
|
|
@@ -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-top: calc(var(--spacing) * 4);
|
|
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: var(--h2-margin-top, calc(var(--spacing) * 6));
|
|
14
|
+
scroll-margin-top: var(--h2-margin-top, calc(var(--spacing) * 6));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
> * + :where(h3),
|
|
18
|
+
> * + :where(astro-island, astro-slot) > :where(h3):first-child {
|
|
19
|
+
margin-top: var(--h3-margin-top, calc(var(--spacing) * 4));
|
|
20
|
+
margin-bottom: var(--h3-margin-bottom, calc(var(--spacing) * -2));
|
|
21
|
+
scroll-margin-top: var(--h3-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
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/* // Note to self: */
|
|
9
9
|
/* // Need to create another Class to contain default z-index for Absolute Drawers — so this doesn't show above it. */
|
|
10
|
+
|
|
10
11
|
@utility drawer-content {
|
|
11
12
|
overflow-y: auto;
|
|
12
13
|
z-index: 100;
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
border-start-start-radius: 0;
|
|
16
17
|
border-end-start-radius: 0;
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
&.fixed-rightfull {
|
|
19
21
|
border-start-end-radius: 0;
|
|
20
22
|
border-end-end-radius: 0;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* Prevent scroll when modal is open */
|
|
3
3
|
html:has(.modal-content) {
|
|
4
4
|
@apply transition-scaffold;
|
|
5
|
-
|
|
5
|
+
transition-property: overflow;
|
|
6
6
|
transition-duration: 300ms;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -20,11 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
/* Base/Closing Style */
|
|
22
22
|
.modal-content {
|
|
23
|
-
@apply border-scaffold;
|
|
24
23
|
margin: auto;
|
|
25
|
-
padding: 1lh;
|
|
26
|
-
color: var(--text-color);
|
|
27
|
-
background: var(--bg-color, white);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
.modal-content::backdrop {
|
|
@@ -34,17 +30,16 @@
|
|
|
34
30
|
.modal-content,
|
|
35
31
|
.modal-content::backdrop {
|
|
36
32
|
@apply transition-scaffold-extended;
|
|
37
|
-
--transition-duration: 300ms;
|
|
38
|
-
--transition-easing: ease-in;
|
|
39
33
|
opacity: 0;
|
|
40
|
-
transition-
|
|
34
|
+
transition-duration: 300ms;
|
|
35
|
+
transition-timing-function: ease-in;
|
|
41
36
|
}
|
|
42
37
|
|
|
43
38
|
/* Opened Style */
|
|
44
39
|
.modal-content[open],
|
|
45
40
|
.modal-content[open]::backdrop {
|
|
46
|
-
--transition-easing: ease-out;
|
|
47
41
|
opacity: 1;
|
|
42
|
+
transition-timing-function: ease-out;
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
.modal-content[open]::backdrop {
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
[popover] {
|
|
3
3
|
@apply border-scaffold;
|
|
4
4
|
@apply transition-scaffold-extended;
|
|
5
|
-
--transition-duration: 300ms;
|
|
6
|
-
--transition-easing: ease-out;
|
|
7
5
|
position: absolute;
|
|
8
6
|
max-width: 100%;
|
|
9
|
-
padding: 1rem;
|
|
10
7
|
color: var(--text-color);
|
|
11
8
|
background: var(--bg-color, white);
|
|
12
9
|
opacity: 0;
|
|
10
|
+
transition-duration: 300ms;
|
|
11
|
+
transition-timing-function: ease-out;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
[popover]:not(:popover-open) {
|
|
@@ -17,8 +16,8 @@
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
[popover]:popover-open {
|
|
20
|
-
--transition-easing: ease-in;
|
|
21
19
|
opacity: 1;
|
|
20
|
+
transition-timing-function: ease-in;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
@starting-style {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/* These don't work in Tailwind 4 and we need to adjust them */
|
|
22
|
-
|
|
23
22
|
@utility tw-gradient {
|
|
24
23
|
--tw-gradient:
|
|
25
24
|
var(--tw-gradient-from) var(--tw-gradient-from-position),
|
|
@@ -29,13 +28,20 @@
|
|
|
29
28
|
@utility gradient {
|
|
30
29
|
& {
|
|
31
30
|
@apply tw-gradient;
|
|
32
|
-
background: linear-gradient(
|
|
31
|
+
background-image: linear-gradient(
|
|
33
32
|
var(--gradient-angle) in var(--color-space) var(--hue-interpolation),
|
|
34
33
|
var(--gradient, var(--tw-gradient))
|
|
35
34
|
);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
38
|
+
@function --linear-gradient(--gradient) {
|
|
39
|
+
result: linear-gradient(
|
|
40
|
+
var(--gradient-angle) in var(--color-space) var(--hue-interpolation),
|
|
41
|
+
var(--gradient)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
@utility linear-gradient {
|
|
40
46
|
@apply gradient;
|
|
41
47
|
}
|
|
@@ -62,6 +68,7 @@
|
|
|
62
68
|
|
|
63
69
|
@utility text-gradient {
|
|
64
70
|
& {
|
|
71
|
+
@apply gradient;
|
|
65
72
|
display: inline-flex;
|
|
66
73
|
-webkit-text-fill-color: transparent;
|
|
67
74
|
background-clip: text;
|
|
@@ -108,3 +115,18 @@
|
|
|
108
115
|
);
|
|
109
116
|
}
|
|
110
117
|
}
|
|
118
|
+
|
|
119
|
+
/*********************
|
|
120
|
+
* Functional Utiliites for Gradients *
|
|
121
|
+
*********************/
|
|
122
|
+
@utility gradient-angle-* {
|
|
123
|
+
--gradient-angle: --value([angle]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* @utility gradient-position-* {
|
|
127
|
+
--gradient-position: --value([position]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@utility gradient-shape-* {
|
|
131
|
+
--gradient-shape: --value([shape]);
|
|
132
|
+
} */
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
& {
|
|
34
34
|
display: grid;
|
|
35
35
|
gap: var(--gap-y, var(--gap)) var(--gap-x, var(--gap));
|
|
36
|
-
|
|
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
|
-
|
|
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 {
|
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
/*
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
+
}
|
package/src/tools/color.css
CHANGED
package/src/tools/object.css
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
/* Object doesn't work correctly in Safari unless height is given. https://stackoverflow.com/questions/60192601/object-fit-cover-not-working-correctly-on-safari */
|
|
1
2
|
@utility object-background {
|
|
2
|
-
position: absolute;
|
|
3
|
-
inset: 0;
|
|
4
|
-
z-index: -1;
|
|
5
3
|
width: 100%;
|
|
6
4
|
height: 100%;
|
|
7
5
|
object-fit: cover;
|
package/src/tools/pigment.css
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
|
package/src/tools/scaffolds.css
CHANGED
|
@@ -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,18 @@
|
|
|
1
|
+
@property --font-weight {
|
|
2
|
+
syntax: '<integer> | auto';
|
|
3
|
+
initial-value: 400;
|
|
4
|
+
inherits: true;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
@property --font-opsz {
|
|
9
|
+
syntax: '<integer> | auto';
|
|
10
|
+
initial-value: 25;
|
|
11
|
+
inherits: true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@property --font-width {
|
|
15
|
+
syntax: '<integer> | auto';
|
|
16
|
+
initial-value: 100;
|
|
17
|
+
inherits: true;
|
|
18
|
+
} */
|
|
@@ -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
|
+
}
|