emily-css 1.2.0-alpha.0 → 1.2.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/CHANGELOG.md +16 -0
- package/bin/emilyui.js +22 -15
- package/package.json +1 -1
- package/src/constants.js +65 -0
- package/src/doctor.js +1 -22
- package/src/generators/accessibility.js +40 -0
- package/src/generators/animation.js +31 -0
- package/src/generators/background.js +36 -0
- package/src/generators/code.js +31 -0
- package/src/generators/display.js +46 -0
- package/src/generators/effects.js +218 -0
- package/src/generators/forms.js +25 -0
- package/src/generators/index.js +45 -0
- package/src/generators/layout.js +138 -0
- package/src/generators/overflow.js +36 -0
- package/src/generators/positioning.js +58 -0
- package/src/generators/rings.js +41 -0
- package/src/generators/sizing.js +111 -0
- package/src/generators/svg.js +38 -0
- package/src/generators/transforms.js +61 -0
- package/src/generators.js +2 -883
- package/src/index.js +8 -7
- package/src/init.js +2 -36
- package/src/manifest.js +4 -19
- package/src/migrate.js +150 -24
- package/src/purge.js +1 -22
- package/src/watch.js +32 -40
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function objectUtilities() {
|
|
4
|
+
return `/* Object Fit & Position */
|
|
5
|
+
.object-contain { object-fit: contain; }
|
|
6
|
+
.object-cover { object-fit: cover; }
|
|
7
|
+
.object-fill { object-fit: fill; }
|
|
8
|
+
.object-none { object-fit: none; }
|
|
9
|
+
.object-scale-down { object-fit: scale-down; }
|
|
10
|
+
.object-center { object-position: center; }
|
|
11
|
+
.object-top { object-position: top; }
|
|
12
|
+
.object-bottom { object-position: bottom; }
|
|
13
|
+
.object-left { object-position: left; }
|
|
14
|
+
.object-right { object-position: right; }
|
|
15
|
+
.object-top-left { object-position: top left; }
|
|
16
|
+
.object-top-right { object-position: top right; }
|
|
17
|
+
.object-bottom-left { object-position: bottom left; }
|
|
18
|
+
.object-bottom-right { object-position: bottom right; }
|
|
19
|
+
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function tableListUtilities() {
|
|
24
|
+
return `/* Tables & Lists */
|
|
25
|
+
.border-collapse { border-collapse: collapse; }
|
|
26
|
+
.border-separate { border-collapse: separate; }
|
|
27
|
+
.table-auto { table-layout: auto; }
|
|
28
|
+
.table-fixed { table-layout: fixed; }
|
|
29
|
+
.caption-top { caption-side: top; }
|
|
30
|
+
.caption-bottom { caption-side: bottom; }
|
|
31
|
+
.list-none { list-style-type: none; }
|
|
32
|
+
.list-disc { list-style-type: disc; }
|
|
33
|
+
.list-decimal { list-style-type: decimal; }
|
|
34
|
+
.list-inside { list-style-position: inside; }
|
|
35
|
+
.list-outside { list-style-position: outside; }
|
|
36
|
+
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function verticalAlignUtilities() {
|
|
41
|
+
return `/* Vertical Align */
|
|
42
|
+
.align-baseline { vertical-align: baseline; }
|
|
43
|
+
.align-top { vertical-align: top; }
|
|
44
|
+
.align-middle { vertical-align: middle; }
|
|
45
|
+
.align-bottom { vertical-align: bottom; }
|
|
46
|
+
.align-text-top { vertical-align: text-top; }
|
|
47
|
+
.align-text-bottom { vertical-align: text-bottom; }
|
|
48
|
+
.align-sub { vertical-align: sub; }
|
|
49
|
+
.align-super { vertical-align: super; }
|
|
50
|
+
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function contentScrollUtilities() {
|
|
55
|
+
return `/* Content Visibility & Scroll */
|
|
56
|
+
.content-normal { content-visibility: normal; }
|
|
57
|
+
.content-hidden { content-visibility: hidden; }
|
|
58
|
+
.content-auto { content-visibility: auto; }
|
|
59
|
+
.scroll-auto { scroll-behavior: auto; }
|
|
60
|
+
.scroll-smooth { scroll-behavior: smooth; }
|
|
61
|
+
.scroll-m-0 { scroll-margin: 0; }
|
|
62
|
+
.snap-none { scroll-snap-type: none; }
|
|
63
|
+
.snap-x { scroll-snap-type: x var(--emily-scroll-snap-strictness); }
|
|
64
|
+
.snap-y { scroll-snap-type: y var(--emily-scroll-snap-strictness); }
|
|
65
|
+
.snap-both { scroll-snap-type: both var(--emily-scroll-snap-strictness); }
|
|
66
|
+
.snap-mandatory { --emily-scroll-snap-strictness: mandatory; }
|
|
67
|
+
.snap-proximity { --emily-scroll-snap-strictness: proximity; }
|
|
68
|
+
.snap-start { scroll-snap-align: start; }
|
|
69
|
+
.snap-center { scroll-snap-align: center; }
|
|
70
|
+
.snap-end { scroll-snap-align: end; }
|
|
71
|
+
.snap-align-none { scroll-snap-align: none; }
|
|
72
|
+
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function containerUtilities() {
|
|
77
|
+
return `/* Container Queries */
|
|
78
|
+
.container-type-inline { container-type: inline-size; }
|
|
79
|
+
.container-type-size { container-type: size; }
|
|
80
|
+
.container-type-normal { container-type: normal; }
|
|
81
|
+
.container-name-none { container-name: none; }
|
|
82
|
+
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function spaceUtilities(spacing) {
|
|
87
|
+
let css = `/* Space Between */\n`;
|
|
88
|
+
Object.entries(spacing).forEach(([key, value]) => {
|
|
89
|
+
const escaped = key.replace(/\./g, '\\.');
|
|
90
|
+
css += `.space-x-${escaped} > * + * { margin-left: ${value}; }\n`;
|
|
91
|
+
css += `.space-y-${escaped} > * + * { margin-top: ${value}; }\n`;
|
|
92
|
+
css += `.-space-x-${escaped} > * + * { margin-left: -${value}; }\n`;
|
|
93
|
+
css += `.-space-y-${escaped} > * + * { margin-top: -${value}; }\n`;
|
|
94
|
+
});
|
|
95
|
+
css += `.space-x-auto > * + * { margin-left: auto; }\n`;
|
|
96
|
+
css += `.space-y-auto > * + * { margin-top: auto; }\n`;
|
|
97
|
+
css += `\n`;
|
|
98
|
+
return css;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function divideUtilities(spacing, colours) {
|
|
102
|
+
let css = `/* Divide */\n`;
|
|
103
|
+
// Widths
|
|
104
|
+
css += `.divide-x > * + * { border-left-width: 1px; border-left-style: solid; }\n`;
|
|
105
|
+
css += `.divide-y > * + * { border-top-width: 1px; border-top-style: solid; }\n`;
|
|
106
|
+
css += `.divide-x-0 > * + * { border-left-width: 0px; }\n`;
|
|
107
|
+
css += `.divide-y-0 > * + * { border-top-width: 0px; }\n`;
|
|
108
|
+
css += `.divide-x-2 > * + * { border-left-width: 2px; border-left-style: solid; }\n`;
|
|
109
|
+
css += `.divide-y-2 > * + * { border-top-width: 2px; border-top-style: solid; }\n`;
|
|
110
|
+
css += `.divide-x-4 > * + * { border-left-width: 4px; border-left-style: solid; }\n`;
|
|
111
|
+
css += `.divide-y-4 > * + * { border-top-width: 4px; border-top-style: solid; }\n`;
|
|
112
|
+
// Styles
|
|
113
|
+
css += `.divide-solid > * + * { border-style: solid; }\n`;
|
|
114
|
+
css += `.divide-dashed > * + * { border-style: dashed; }\n`;
|
|
115
|
+
css += `.divide-dotted > * + * { border-style: dotted; }\n`;
|
|
116
|
+
css += `.divide-none > * + * { border-style: none; }\n`;
|
|
117
|
+
// Colours
|
|
118
|
+
Object.entries(colours).forEach(([colourName, shades]) => {
|
|
119
|
+
Object.entries(shades).forEach(([shade]) => {
|
|
120
|
+
css += `.divide-${colourName}-${shade} > * + * { border-color: var(--color-${colourName}-${shade}); }\n`;
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
css += `.divide-white > * + * { border-color: #FAFAFA; }\n`;
|
|
124
|
+
css += `.divide-black > * + * { border-color: #111110; }\n`;
|
|
125
|
+
css += `.divide-transparent > * + * { border-color: transparent; }\n`;
|
|
126
|
+
css += `\n`;
|
|
127
|
+
return css;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = {
|
|
131
|
+
objectUtilities,
|
|
132
|
+
tableListUtilities,
|
|
133
|
+
verticalAlignUtilities,
|
|
134
|
+
contentScrollUtilities,
|
|
135
|
+
containerUtilities,
|
|
136
|
+
spaceUtilities,
|
|
137
|
+
divideUtilities,
|
|
138
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function overflowUtilities() {
|
|
4
|
+
return `/* Overflow & Clipping */
|
|
5
|
+
.overflow-auto { overflow: auto; }
|
|
6
|
+
.overflow-hidden { overflow: hidden; }
|
|
7
|
+
.overflow-clip { overflow: clip; }
|
|
8
|
+
.overflow-visible { overflow: visible; }
|
|
9
|
+
.overflow-scroll { overflow: scroll; }
|
|
10
|
+
.overflow-x-auto { overflow-x: auto; }
|
|
11
|
+
.overflow-x-hidden { overflow-x: hidden; }
|
|
12
|
+
.overflow-x-clip { overflow-x: clip; }
|
|
13
|
+
.overflow-x-visible { overflow-x: visible; }
|
|
14
|
+
.overflow-x-scroll { overflow-x: scroll; }
|
|
15
|
+
.overflow-y-auto { overflow-y: auto; }
|
|
16
|
+
.overflow-y-hidden { overflow-y: hidden; }
|
|
17
|
+
.overflow-y-clip { overflow-y: clip; }
|
|
18
|
+
.overflow-y-visible { overflow-y: visible; }
|
|
19
|
+
.overflow-y-scroll { overflow-y: scroll; }
|
|
20
|
+
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
21
|
+
.text-ellipsis { text-overflow: ellipsis; }
|
|
22
|
+
.text-clip { text-overflow: clip; }
|
|
23
|
+
.line-clamp-none { overflow: visible; display: block; -webkit-box-orient: horizontal; -webkit-line-clamp: unset; }
|
|
24
|
+
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
|
|
25
|
+
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
26
|
+
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
|
27
|
+
.line-clamp-4 { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
|
|
28
|
+
.line-clamp-5 { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
|
|
29
|
+
.line-clamp-6 { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
|
|
30
|
+
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
overflowUtilities,
|
|
36
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function escapeClassName(key) {
|
|
4
|
+
return key.replace(/\./g, '\\.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function positioningUtilities(spacing) {
|
|
8
|
+
let css = `/* Positioning */\n`;
|
|
9
|
+
|
|
10
|
+
css += `.static { position: static; }\n`;
|
|
11
|
+
css += `.relative { position: relative; }\n`;
|
|
12
|
+
css += `.absolute { position: absolute; }\n`;
|
|
13
|
+
css += `.fixed { position: fixed; }\n`;
|
|
14
|
+
css += `.sticky { position: sticky; }\n`;
|
|
15
|
+
|
|
16
|
+
Object.entries(spacing).forEach(([key, value]) => {
|
|
17
|
+
const escaped = escapeClassName(key);
|
|
18
|
+
css += `.top-${escaped} { top: ${value}; }\n`;
|
|
19
|
+
css += `.right-${escaped} { right: ${value}; }\n`;
|
|
20
|
+
css += `.bottom-${escaped} { bottom: ${value}; }\n`;
|
|
21
|
+
css += `.left-${escaped} { left: ${value}; }\n`;
|
|
22
|
+
css += `.inset-${escaped} { inset: ${value}; }\n`;
|
|
23
|
+
css += `.inset-x-${escaped} { left: ${value}; right: ${value}; }\n`;
|
|
24
|
+
css += `.inset-y-${escaped} { top: ${value}; bottom: ${value}; }\n`;
|
|
25
|
+
if (value !== '0' && value !== '0px') {
|
|
26
|
+
css += `.-top-${escaped} { top: -${value}; }\n`;
|
|
27
|
+
css += `.-right-${escaped} { right: -${value}; }\n`;
|
|
28
|
+
css += `.-bottom-${escaped} { bottom: -${value}; }\n`;
|
|
29
|
+
css += `.-left-${escaped} { left: -${value}; }\n`;
|
|
30
|
+
css += `.-inset-${escaped} { inset: -${value}; }\n`;
|
|
31
|
+
css += `.-inset-x-${escaped} { left: -${value}; right: -${value}; }\n`;
|
|
32
|
+
css += `.-inset-y-${escaped} { top: -${value}; bottom: -${value}; }\n`;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
css += `.inset-auto { inset: auto; }\n`;
|
|
37
|
+
css += `.inset-x-auto { left: auto; right: auto; }\n`;
|
|
38
|
+
css += `.inset-y-auto { top: auto; bottom: auto; }\n`;
|
|
39
|
+
css += `.top-auto { top: auto; }\n`;
|
|
40
|
+
css += `.right-auto { right: auto; }\n`;
|
|
41
|
+
css += `.bottom-auto { bottom: auto; }\n`;
|
|
42
|
+
css += `.left-auto { left: auto; }\n`;
|
|
43
|
+
|
|
44
|
+
const zIndices = {
|
|
45
|
+
'auto': 'auto', '0': '0', '10': '10', '20': '20', '30': '30', '40': '40', '50': '50',
|
|
46
|
+
'dropdown': '1000', 'sticky': '1020', 'fixed': '1030', 'modal': '1040', 'popover': '1060', 'tooltip': '1070'
|
|
47
|
+
};
|
|
48
|
+
Object.entries(zIndices).forEach(([name, value]) => {
|
|
49
|
+
css += `.z-${name} { z-index: ${value}; }\n`;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
css += `\n`;
|
|
53
|
+
return css;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
positioningUtilities,
|
|
58
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function ringUtilities(colours) {
|
|
4
|
+
let css = `/* Rings & Outlines */\n`;
|
|
5
|
+
|
|
6
|
+
css += `.ring-0 { --ring-offset-width: 0px; --ring-offset-color: #fff; --ring-color: currentColor; box-shadow: 0 0 0 var(--ring-offset-width, 0px) var(--ring-offset-color, #fff), 0 0 0 var(--ring-offset-width, 0px) transparent; }\n`;
|
|
7
|
+
css += `.ring-1 { --ring-offset-width: 0px; --ring-offset-color: #fff; --ring-color: currentColor; box-shadow: 0 0 0 var(--ring-offset-width, 0px) var(--ring-offset-color, #fff), 0 0 0 calc(1px + var(--ring-offset-width, 0px)) var(--ring-color, currentColor); }\n`;
|
|
8
|
+
css += `.ring-2 { --ring-offset-width: 0px; --ring-offset-color: #fff; --ring-color: currentColor; box-shadow: 0 0 0 var(--ring-offset-width, 0px) var(--ring-offset-color, #fff), 0 0 0 calc(2px + var(--ring-offset-width, 0px)) var(--ring-color, currentColor); }\n`;
|
|
9
|
+
|
|
10
|
+
css += `.ring-offset-0 { --ring-offset-width: 0px; }\n`;
|
|
11
|
+
css += `.ring-offset-2 { --ring-offset-width: 2px; }\n`;
|
|
12
|
+
css += `.ring-offset-4 { --ring-offset-width: 4px; }\n`;
|
|
13
|
+
css += `.ring-offset-white { --ring-offset-color: #fff; }\n`;
|
|
14
|
+
css += `.ring-offset-black { --ring-offset-color: #000; }\n`;
|
|
15
|
+
|
|
16
|
+
// Ring colours
|
|
17
|
+
Object.entries(colours).forEach(([colourName, shades]) => {
|
|
18
|
+
Object.entries(shades).forEach(([shade]) => {
|
|
19
|
+
css += `.ring-${colourName}-${shade} { --ring-color: var(--color-${colourName}-${shade}); }\n`;
|
|
20
|
+
css += `.ring-offset-${colourName}-${shade} { --ring-offset-color: var(--color-${colourName}-${shade}); }\n`;
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
css += `.outline-none { outline: 2px solid transparent; outline-offset: 2px; }\n`;
|
|
25
|
+
css += `.outline { outline: 1px solid currentColor; }\n`;
|
|
26
|
+
css += `.outline-0 { outline-width: 0; }\n`;
|
|
27
|
+
css += `.outline-1 { outline-width: 1px; }\n`;
|
|
28
|
+
css += `.outline-2 { outline-width: 2px; }\n`;
|
|
29
|
+
css += `.outline-offset-0 { outline-offset: 0px; }\n`;
|
|
30
|
+
css += `.outline-offset-1 { outline-offset: 1px; }\n`;
|
|
31
|
+
css += `.outline-offset-2 { outline-offset: 2px; }\n`;
|
|
32
|
+
css += `.outline-offset-4 { outline-offset: 4px; }\n`;
|
|
33
|
+
css += `.outline-offset-8 { outline-offset: 8px; }\n`;
|
|
34
|
+
|
|
35
|
+
css += `\n`;
|
|
36
|
+
return css;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
ringUtilities,
|
|
41
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function escapeClassName(key) {
|
|
4
|
+
return key.replace(/\./g, '\\.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function sizingUtilities(spacing) {
|
|
8
|
+
let css = `/* Sizing */\n`;
|
|
9
|
+
|
|
10
|
+
Object.entries(spacing).forEach(([key, value]) => {
|
|
11
|
+
const escaped = escapeClassName(key);
|
|
12
|
+
css += `.w-${escaped} { width: ${value}; }\n`;
|
|
13
|
+
css += `.h-${escaped} { height: ${value}; }\n`;
|
|
14
|
+
css += `.size-${escaped} { width: ${value}; height: ${value}; }\n`;
|
|
15
|
+
css += `.min-w-${escaped} { min-width: ${value}; }\n`;
|
|
16
|
+
css += `.min-h-${escaped} { min-height: ${value}; }\n`;
|
|
17
|
+
css += `.max-w-${escaped} { max-width: ${value}; }\n`;
|
|
18
|
+
css += `.max-h-${escaped} { max-height: ${value}; }\n`;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const fractions = {
|
|
22
|
+
'1\\/2': '50%', '1\\/3': '33.333333%', '2\\/3': '66.666667%',
|
|
23
|
+
'1\\/4': '25%', '2\\/4': '50%', '3\\/4': '75%',
|
|
24
|
+
'1\\/5': '20%', '2\\/5': '40%', '3\\/5': '60%', '4\\/5': '80%',
|
|
25
|
+
'1\\/6': '16.666667%', '2\\/6': '33.333333%', '3\\/6': '50%', '4\\/6': '66.666667%', '5\\/6': '83.333333%',
|
|
26
|
+
'1\\/12': '8.333333%', '2\\/12': '16.666667%', '3\\/12': '25%', '4\\/12': '33.333333%', '5\\/12': '41.666667%', '6\\/12': '50%', '7\\/12': '58.333333%', '8\\/12': '66.666667%', '9\\/12': '75%', '10\\/12': '83.333333%', '11\\/12': '91.666667%'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
Object.entries(fractions).forEach(([name, value]) => {
|
|
30
|
+
css += `.w-${name} { width: ${value}; }\n`;
|
|
31
|
+
css += `.h-${name} { height: ${value}; }\n`;
|
|
32
|
+
css += `.size-${name} { width: ${value}; height: ${value}; }\n`;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
css += `.w-auto { width: auto; }\n`;
|
|
36
|
+
css += `.h-auto { height: auto; }\n`;
|
|
37
|
+
css += `.size-auto { width: auto; height: auto; }\n`;
|
|
38
|
+
css += `.w-full { width: 100%; }\n`;
|
|
39
|
+
css += `.h-full { height: 100%; }\n`;
|
|
40
|
+
css += `.size-full { width: 100%; height: 100%; }\n`;
|
|
41
|
+
css += `.w-screen { width: 100vw; }\n`;
|
|
42
|
+
css += `.h-screen { height: 100vh; }\n`;
|
|
43
|
+
css += `.w-svw { width: 100svw; }\n`;
|
|
44
|
+
css += `.h-svh { height: 100svh; }\n`;
|
|
45
|
+
css += `.w-lvw { width: 100lvw; }\n`;
|
|
46
|
+
css += `.h-lvh { height: 100lvh; }\n`;
|
|
47
|
+
css += `.w-dvw { width: 100dvw; }\n`;
|
|
48
|
+
css += `.h-dvh { height: 100dvh; }\n`;
|
|
49
|
+
css += `.w-min { width: min-content; }\n`;
|
|
50
|
+
css += `.w-max { width: max-content; }\n`;
|
|
51
|
+
css += `.w-fit { width: fit-content; }\n`;
|
|
52
|
+
css += `.h-min { height: min-content; }\n`;
|
|
53
|
+
css += `.h-max { height: max-content; }\n`;
|
|
54
|
+
css += `.h-fit { height: fit-content; }\n`;
|
|
55
|
+
|
|
56
|
+
css += `.min-w-0 { min-width: 0; }\n`;
|
|
57
|
+
css += `.min-w-full { min-width: 100%; }\n`;
|
|
58
|
+
css += `.min-w-min { min-width: min-content; }\n`;
|
|
59
|
+
css += `.min-w-max { min-width: max-content; }\n`;
|
|
60
|
+
css += `.min-w-fit { min-width: fit-content; }\n`;
|
|
61
|
+
css += `.min-h-0 { min-height: 0; }\n`;
|
|
62
|
+
css += `.min-h-full { min-height: 100%; }\n`;
|
|
63
|
+
css += `.min-h-screen { min-height: 100vh; }\n`;
|
|
64
|
+
css += `.min-h-svh { min-height: 100svh; }\n`;
|
|
65
|
+
css += `.min-h-lvh { min-height: 100lvh; }\n`;
|
|
66
|
+
css += `.min-h-dvh { min-height: 100dvh; }\n`;
|
|
67
|
+
css += `.min-h-min { min-height: min-content; }\n`;
|
|
68
|
+
css += `.min-h-max { min-height: max-content; }\n`;
|
|
69
|
+
css += `.min-h-fit { min-height: fit-content; }\n`;
|
|
70
|
+
|
|
71
|
+
css += `.max-w-0 { max-width: 0; }\n`;
|
|
72
|
+
css += `.max-w-none { max-width: none; }\n`;
|
|
73
|
+
css += `.max-w-full { max-width: 100%; }\n`;
|
|
74
|
+
css += `.max-w-min { max-width: min-content; }\n`;
|
|
75
|
+
css += `.max-w-max { max-width: max-content; }\n`;
|
|
76
|
+
css += `.max-w-fit { max-width: fit-content; }\n`;
|
|
77
|
+
css += `.max-h-0 { max-height: 0; }\n`;
|
|
78
|
+
css += `.max-h-full { max-height: 100%; }\n`;
|
|
79
|
+
css += `.max-h-screen { max-height: 100vh; }\n`;
|
|
80
|
+
css += `.max-h-svh { max-height: 100svh; }\n`;
|
|
81
|
+
css += `.max-h-lvh { max-height: 100lvh; }\n`;
|
|
82
|
+
css += `.max-h-dvh { max-height: 100dvh; }\n`;
|
|
83
|
+
css += `.max-h-min { max-height: min-content; }\n`;
|
|
84
|
+
css += `.max-h-max { max-height: max-content; }\n`;
|
|
85
|
+
css += `.max-h-fit { max-height: fit-content; }\n`;
|
|
86
|
+
|
|
87
|
+
const maxWidths = {
|
|
88
|
+
xs: '20rem', sm: '24rem', md: '28rem', lg: '32rem', xl: '36rem',
|
|
89
|
+
'2xl': '42rem', '3xl': '48rem', '4xl': '56rem', '5xl': '64rem',
|
|
90
|
+
'6xl': '72rem', '7xl': '80rem', prose: '65ch', screen: '100vw',
|
|
91
|
+
'screen-sm': '640px', 'screen-md': '768px', 'screen-lg': '1024px',
|
|
92
|
+
'screen-xl': '1280px', 'screen-2xl': '1536px'
|
|
93
|
+
};
|
|
94
|
+
Object.entries(maxWidths).forEach(([name, value]) => {
|
|
95
|
+
css += `.max-w-${name} { max-width: ${value}; }\n`;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
css += `.aspect-auto { aspect-ratio: auto; }\n`;
|
|
99
|
+
css += `.aspect-square { aspect-ratio: 1; }\n`;
|
|
100
|
+
css += `.aspect-video { aspect-ratio: 16 / 9; }\n`;
|
|
101
|
+
css += `.aspect-3\\/2 { aspect-ratio: 3 / 2; }\n`;
|
|
102
|
+
css += `.aspect-4\\/3 { aspect-ratio: 4 / 3; }\n`;
|
|
103
|
+
css += `.aspect-16\\/9 { aspect-ratio: 16 / 9; }\n`;
|
|
104
|
+
|
|
105
|
+
css += `\n`;
|
|
106
|
+
return css;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
module.exports = {
|
|
110
|
+
sizingUtilities,
|
|
111
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function svgUtilities(colours) {
|
|
4
|
+
let css = `/* SVG */\n`;
|
|
5
|
+
|
|
6
|
+
css += `.fill-current { fill: currentColor; }\n`;
|
|
7
|
+
css += `.stroke-current { stroke: currentColor; }\n`;
|
|
8
|
+
css += `.fill-white { fill: #FAFAFA; }\n`;
|
|
9
|
+
css += `.fill-black { fill: #111110; }\n`;
|
|
10
|
+
css += `.fill-transparent { fill: transparent; }\n`;
|
|
11
|
+
css += `.stroke-white { stroke: #FAFAFA; }\n`;
|
|
12
|
+
css += `.stroke-black { stroke: #111110; }\n`;
|
|
13
|
+
css += `.stroke-transparent { stroke: transparent; }\n`;
|
|
14
|
+
css += `.stroke-0 { stroke-width: 0; }\n`;
|
|
15
|
+
css += `.stroke-1 { stroke-width: 1; }\n`;
|
|
16
|
+
css += `.stroke-2 { stroke-width: 2; }\n`;
|
|
17
|
+
|
|
18
|
+
// Fill colours
|
|
19
|
+
Object.entries(colours).forEach(([colourName, shades]) => {
|
|
20
|
+
Object.entries(shades).forEach(([shade]) => {
|
|
21
|
+
css += `.fill-${colourName}-${shade} { fill: var(--color-${colourName}-${shade}); }\n`;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Stroke colours
|
|
26
|
+
Object.entries(colours).forEach(([colourName, shades]) => {
|
|
27
|
+
Object.entries(shades).forEach(([shade]) => {
|
|
28
|
+
css += `.stroke-${colourName}-${shade} { stroke: var(--color-${colourName}-${shade}); }\n`;
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
css += `\n`;
|
|
33
|
+
return css;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
svgUtilities,
|
|
38
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function escapeClassName(key) {
|
|
4
|
+
return key.replace(/\./g, '\\.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function transformUtilities(spacing) {
|
|
8
|
+
let css = `/* Transforms */\n`;
|
|
9
|
+
const composedTransform = 'translate(var(--translate-x, 0), var(--translate-y, 0)) rotate(var(--rotate, 0)) skewX(var(--skew-x, 0)) skewY(var(--skew-y, 0)) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1))';
|
|
10
|
+
|
|
11
|
+
css += `.transform { transform: translateZ(0); }\n`;
|
|
12
|
+
css += `.transform-gpu { transform: translate3d(0, 0, 0); }\n`;
|
|
13
|
+
css += `.transform-none { transform: none; }\n`;
|
|
14
|
+
|
|
15
|
+
// Translate
|
|
16
|
+
Object.entries(spacing).forEach(([key, value]) => {
|
|
17
|
+
const escaped = escapeClassName(key);
|
|
18
|
+
css += `.translate-x-${escaped} { --translate-x: ${value}; transform: ${composedTransform}; }\n`;
|
|
19
|
+
css += `.translate-y-${escaped} { --translate-y: ${value}; transform: ${composedTransform}; }\n`;
|
|
20
|
+
css += `.-translate-x-${escaped} { --translate-x: -${value}; transform: ${composedTransform}; }\n`;
|
|
21
|
+
css += `.-translate-y-${escaped} { --translate-y: -${value}; transform: ${composedTransform}; }\n`;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Rotate
|
|
25
|
+
const rotations = [0, 1, 2, 3, 6, 12, 45, 90, 180];
|
|
26
|
+
rotations.forEach(deg => {
|
|
27
|
+
css += `.rotate-${deg} { --rotate: ${deg}deg; transform: ${composedTransform}; }\n`;
|
|
28
|
+
if (deg > 0) css += `.-rotate-${deg} { --rotate: -${deg}deg; transform: ${composedTransform}; }\n`;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Scale
|
|
32
|
+
const scales = [0, 50, 75, 90, 95, 100, 110, 125, 150];
|
|
33
|
+
scales.forEach(scale => {
|
|
34
|
+
css += `.scale-${scale} { --scale-x: ${scale / 100}; --scale-y: ${scale / 100}; transform: ${composedTransform}; }\n`;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Skew
|
|
38
|
+
const skews = [0, 1, 2, 3];
|
|
39
|
+
skews.forEach(sk => {
|
|
40
|
+
css += `.skew-x-${sk} { --skew-x: ${sk}deg; transform: ${composedTransform}; }\n`;
|
|
41
|
+
css += `.skew-y-${sk} { --skew-y: ${sk}deg; transform: ${composedTransform}; }\n`;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Transform origin
|
|
45
|
+
css += `.origin-center { transform-origin: center; }\n`;
|
|
46
|
+
css += `.origin-top { transform-origin: top; }\n`;
|
|
47
|
+
css += `.origin-top-right { transform-origin: top right; }\n`;
|
|
48
|
+
css += `.origin-right { transform-origin: right; }\n`;
|
|
49
|
+
css += `.origin-bottom-right { transform-origin: bottom right; }\n`;
|
|
50
|
+
css += `.origin-bottom { transform-origin: bottom; }\n`;
|
|
51
|
+
css += `.origin-bottom-left { transform-origin: bottom left; }\n`;
|
|
52
|
+
css += `.origin-left { transform-origin: left; }\n`;
|
|
53
|
+
css += `.origin-top-left { transform-origin: top left; }\n`;
|
|
54
|
+
|
|
55
|
+
css += `\n`;
|
|
56
|
+
return css;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = {
|
|
60
|
+
transformUtilities,
|
|
61
|
+
};
|