@microphi/styles 1.3.0 → 1.4.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/CHANGELOG.md +12 -0
- package/README.md +106 -9
- package/package.json +2 -2
- package/scss/_display.scss +1 -1
- package/scss/_grid.scss +311 -0
- package/scss/_letter-spacing.scss +22 -0
- package/scss/_min-max-sizing.scss +57 -0
- package/scss/_opacity.scss +30 -0
- package/scss/_text-transform.scss +22 -0
- package/scss/_typography.scss +93 -55
- package/scss/main.scss +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.4.0](https://example.com/compare/@microphi/styles@1.3.1...@microphi/styles@1.4.0) (2026-07-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **microphi:** update styles, debug, and json-db packages ([38118b2](https://example.com/commits/38118b233d2e52a701065b34a889c153107edee5))
|
|
11
|
+
* **styles:** add CSS Grid utilities and documentation 🎉 ([c1b2739](https://example.com/commits/c1b2739a61df448fe52c9ba6c0deb4d7029b6924))
|
|
12
|
+
* **styles:** add opacity, text-transform, letter-spacing & min/max sizing utilities; fix .fx-grid display ✨ ([0c6d75b](https://example.com/commits/0c6d75b00129236dfcc5c674f0fc57c0aeca5b0f))
|
|
13
|
+
|
|
14
|
+
## [1.3.1](https://example.com/compare/@microphi/styles@1.3.0...@microphi/styles@1.3.1) (2025-10-09)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @microphi/styles
|
|
17
|
+
|
|
6
18
|
# [1.3.0](https://example.com/compare/@microphi/styles@1.2.5...@microphi/styles@1.3.0) (2025-09-25)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ We believe in a flex first approach when it comes to layouting. This library is
|
|
|
21
21
|
|
|
22
22
|
- **Modular Architecture:** A well-organized structure with reusable components and utilities.
|
|
23
23
|
- **Flex layout system:** Flex layout system for clear and powerful layouting.
|
|
24
|
+
- **Grid layout system:** Comprehensive CSS Grid utilities for modern layout solutions.
|
|
24
25
|
- **Utility Classes:** Commonly used utility classes for margin, padding, colors, typography, etc.
|
|
25
26
|
# - **Mixins and Functions:** Custom mixins and functions to reduce repetitive CSS and enhance your workflow.
|
|
26
27
|
# - **Theming Support:** Easy customization of themes through variables for colors, typography, and other design elements.
|
|
@@ -49,21 +50,117 @@ This will include the core styles and utilities in your project. You can then st
|
|
|
49
50
|
|
|
50
51
|
### Example Usage
|
|
51
52
|
|
|
52
|
-
Here's a basic example using the
|
|
53
|
+
Here's a basic example using the flex system and utility classes:
|
|
53
54
|
|
|
54
55
|
```html
|
|
55
|
-
<div class="
|
|
56
|
-
<div class="
|
|
57
|
-
<
|
|
58
|
-
<p class="text-primary">This is a column</p>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="col-6">
|
|
61
|
-
<p class="text-secondary">This is another column</p>
|
|
62
|
-
</div>
|
|
56
|
+
<div class="fx-flex fx-justify-center fx-items-center">
|
|
57
|
+
<div class="fx-w-full fx-h-50">
|
|
58
|
+
<p class="text-primary">This is a flex container</p>
|
|
63
59
|
</div>
|
|
64
60
|
</div>
|
|
65
61
|
```
|
|
66
62
|
|
|
63
|
+
### Grid System
|
|
64
|
+
|
|
65
|
+
The library also provides comprehensive CSS Grid utilities for modern layout solutions:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<div class="fx-grid fx-grid-cols-3 fx-gap-4">
|
|
69
|
+
<div class="fx-col-span-2">Main content</div>
|
|
70
|
+
<div>Sidebar</div>
|
|
71
|
+
<div class="fx-col-start-1 fx-col-end-4">Full width footer</div>
|
|
72
|
+
</div>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Grid Container Utilities
|
|
76
|
+
|
|
77
|
+
- `fx-grid` - Sets display: grid
|
|
78
|
+
- `fx-grid-cols-{n}` - Defines grid-template-columns (1-12, none, subgrid)
|
|
79
|
+
- `fx-grid-rows-{n}` - Defines grid-template-rows (1-6, none, subgrid)
|
|
80
|
+
- `fx-grid-flow-{dir}` - Controls grid-auto-flow (row, column, dense, etc.)
|
|
81
|
+
- `fx-gap-{size}` - Sets gap between grid items
|
|
82
|
+
- `fx-gap-col-{size}` - Sets column-gap
|
|
83
|
+
- `fx-gap-row-{size}` - Sets row-gap
|
|
84
|
+
- `fx-justify-content-{alignment}` - Justifies content along the inline axis
|
|
85
|
+
- `fx-content-{alignment}` - Aligns content along the block axis
|
|
86
|
+
- `fx-justify-items-{alignment}` - Justifies grid items along the inline axis
|
|
87
|
+
- `fx-items-{alignment}` - Aligns grid items along the block axis
|
|
88
|
+
- `fx-place-content-{position}` - Sets place-content shorthand
|
|
89
|
+
- `fx-place-items-{position}` - Sets place-items shorthand
|
|
90
|
+
|
|
91
|
+
#### Grid Item Utilities
|
|
92
|
+
|
|
93
|
+
- `fx-col-span-{n}` - Makes item span across n columns (1-12, auto, full)
|
|
94
|
+
- `fx-row-span-{n}` - Makes item span across n rows (1-6, auto, full)
|
|
95
|
+
- `fx-col-start-{n}` - Sets grid-column-start property
|
|
96
|
+
- `fx-col-end-{n}` - Sets grid-column-end property
|
|
97
|
+
- `fx-row-start-{n}` - Sets grid-row-start property
|
|
98
|
+
- `fx-row-end-{n}` - Sets grid-row-end property
|
|
99
|
+
- `fx-area-{value}` - Sets grid-area property
|
|
100
|
+
- `fx-place-self-{position}` - Sets place-self property
|
|
101
|
+
|
|
102
|
+
#### Responsive Grid
|
|
103
|
+
|
|
104
|
+
All grid utilities are responsive and support breakpoints:
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<div class="fx-grid fx-grid-cols-1 sm:fx-grid-cols-2 lg:fx-grid-cols-3 fx-gap-4">
|
|
108
|
+
<div>Responsive grid item</div>
|
|
109
|
+
<div>Responsive grid item</div>
|
|
110
|
+
<div>Responsive grid item</div>
|
|
111
|
+
</div>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Typography System
|
|
115
|
+
|
|
116
|
+
The library provides a flexible typography system that works with the Utopia scale generator. You can customize the typography scale using the Utopia package and map the generated CSS variables to the fx-scss classes.
|
|
117
|
+
|
|
118
|
+
#### Dynamic Font Size Classes
|
|
119
|
+
|
|
120
|
+
The system generates font size classes dynamically based on your Utopia configuration:
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<!-- Generate classes from --fx-typography--6 to --fx-typography-6 based on your scale -->
|
|
124
|
+
<p class="fx-text-3">Larger text using --fx-typography-3 variable</p>
|
|
125
|
+
<p class="fx-text-0">Base text using --fx-typography-0 variable</p>
|
|
126
|
+
<p class="fx-text--2">Smaller text using --fx-typography--2 variable</p>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Semantic Typography Classes
|
|
130
|
+
|
|
131
|
+
The library also provides semantic classes that map to specific scale steps:
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<h1 class="fx-headline-1">Headline 1 using --fx-typography-1</h1>
|
|
135
|
+
<h2 class="fx-headline-2">Headline 2 using --fx-typography-2</h2>
|
|
136
|
+
<p class="fx-title">Title using --fx-typography-1</p>
|
|
137
|
+
<p class="fx-subtitle">Subtitle using --fx-typography-0</p>
|
|
138
|
+
<p class="fx-body-1">Body 1 using --fx-typography--1</p>
|
|
139
|
+
<p class="fx-body-2">Body 2 using --fx-typography--2</p>
|
|
140
|
+
<p class="fx-caption">Caption using --fx-typography--3</p>
|
|
141
|
+
<p class="fx-overline">Overline using --fx-typography--4</p>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Customizing Typography Variables
|
|
145
|
+
|
|
146
|
+
To customize which CSS variables the classes use (e.g., if using a different prefix in Utopia), define a custom `$typography-vars` map before importing fx-scss:
|
|
147
|
+
|
|
148
|
+
```scss
|
|
149
|
+
// Define custom mapping to match your Utopia configuration
|
|
150
|
+
$typography-vars: (
|
|
151
|
+
1: var(--step-typography-1),
|
|
152
|
+
2: var(--step-typography-2),
|
|
153
|
+
3: var(--step-typography-3),
|
|
154
|
+
0: var(--step-typography-0),
|
|
155
|
+
-1: var(--step-typography--1),
|
|
156
|
+
-2: var(--step-typography--2),
|
|
157
|
+
// ... etc for all steps in your scale
|
|
158
|
+
) !default;
|
|
159
|
+
|
|
160
|
+
// Now import fx-scss
|
|
161
|
+
@import 'path/to/fx-scss/main';
|
|
162
|
+
```
|
|
163
|
+
|
|
67
164
|
## Folder Structure
|
|
68
165
|
|
|
69
166
|
The SCSS library follows a clean, modular structure:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microphi/styles",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "helper styles",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"private": false,
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"utopia-core-scss": "^1.2.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "c8a065cd3b4ef94d80ee260f70b1edacc20c8779"
|
|
26
26
|
}
|
package/scss/_display.scss
CHANGED
package/scss/_grid.scss
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
@use "variables" as var;
|
|
2
|
+
@use "mixins" as mix;
|
|
3
|
+
|
|
4
|
+
// Grid utilities map
|
|
5
|
+
$grid-map: (
|
|
6
|
+
// display:grid / inline-grid are emitted as bare .fx-grid / .fx-inline-grid
|
|
7
|
+
// by the display values map in _display.scss.
|
|
8
|
+
"grid-template-columns": (
|
|
9
|
+
property: grid-template-columns,
|
|
10
|
+
shortcut: grid-cols,
|
|
11
|
+
values: (
|
|
12
|
+
1: repeat(1, minmax(0, 1fr)),
|
|
13
|
+
2: repeat(2, minmax(0, 1fr)),
|
|
14
|
+
3: repeat(3, minmax(0, 1fr)),
|
|
15
|
+
4: repeat(4, minmax(0, 1fr)),
|
|
16
|
+
5: repeat(5, minmax(0, 1fr)),
|
|
17
|
+
6: repeat(6, minmax(0, 1fr)),
|
|
18
|
+
7: repeat(7, minmax(0, 1fr)),
|
|
19
|
+
8: repeat(8, minmax(0, 1fr)),
|
|
20
|
+
9: repeat(9, minmax(0, 1fr)),
|
|
21
|
+
10: repeat(10, minmax(0, 1fr)),
|
|
22
|
+
11: repeat(11, minmax(0, 1fr)),
|
|
23
|
+
12: repeat(12, minmax(0, 1fr)),
|
|
24
|
+
none: none,
|
|
25
|
+
subgrid: subgrid
|
|
26
|
+
)
|
|
27
|
+
),
|
|
28
|
+
"grid-template-rows": (
|
|
29
|
+
property: grid-template-rows,
|
|
30
|
+
shortcut: grid-rows,
|
|
31
|
+
values: (
|
|
32
|
+
1: repeat(1, minmax(0, 1fr)),
|
|
33
|
+
2: repeat(2, minmax(0, 1fr)),
|
|
34
|
+
3: repeat(3, minmax(0, 1fr)),
|
|
35
|
+
4: repeat(4, minmax(0, 1fr)),
|
|
36
|
+
5: repeat(5, minmax(0, 1fr)),
|
|
37
|
+
6: repeat(6, minmax(0, 1fr)),
|
|
38
|
+
none: none,
|
|
39
|
+
subgrid: subgrid
|
|
40
|
+
)
|
|
41
|
+
),
|
|
42
|
+
"grid-template-areas": (
|
|
43
|
+
property: grid-template-areas,
|
|
44
|
+
shortcut: grid-areas,
|
|
45
|
+
values: (
|
|
46
|
+
none: none,
|
|
47
|
+
subgrid: subgrid
|
|
48
|
+
)
|
|
49
|
+
),
|
|
50
|
+
"grid-auto-flow": (
|
|
51
|
+
property: grid-auto-flow,
|
|
52
|
+
shortcut: grid-flow,
|
|
53
|
+
values: (
|
|
54
|
+
row: row,
|
|
55
|
+
column: column,
|
|
56
|
+
dense: dense,
|
|
57
|
+
row-dense: row dense,
|
|
58
|
+
col-dense: column dense
|
|
59
|
+
)
|
|
60
|
+
),
|
|
61
|
+
"grid-auto-columns": (
|
|
62
|
+
property: grid-auto-columns,
|
|
63
|
+
shortcut: grid-auto-cols,
|
|
64
|
+
values: (
|
|
65
|
+
auto: auto,
|
|
66
|
+
max: max-content,
|
|
67
|
+
min: min-content
|
|
68
|
+
)
|
|
69
|
+
),
|
|
70
|
+
"grid-auto-rows": (
|
|
71
|
+
property: grid-auto-rows,
|
|
72
|
+
shortcut: grid-auto-rows,
|
|
73
|
+
values: (
|
|
74
|
+
auto: auto,
|
|
75
|
+
max: max-content,
|
|
76
|
+
min: min-content
|
|
77
|
+
)
|
|
78
|
+
),
|
|
79
|
+
"grid-gap": (
|
|
80
|
+
property: gap,
|
|
81
|
+
shortcut: gap,
|
|
82
|
+
values: var.$values
|
|
83
|
+
),
|
|
84
|
+
"grid-column-gap": (
|
|
85
|
+
property: column-gap,
|
|
86
|
+
shortcut: gap-col,
|
|
87
|
+
values: var.$values
|
|
88
|
+
),
|
|
89
|
+
"grid-row-gap": (
|
|
90
|
+
property: row-gap,
|
|
91
|
+
shortcut: gap-row,
|
|
92
|
+
values: var.$values
|
|
93
|
+
),
|
|
94
|
+
"justify-items": (
|
|
95
|
+
property: justify-items,
|
|
96
|
+
shortcut: justify-items,
|
|
97
|
+
values: (
|
|
98
|
+
start: start,
|
|
99
|
+
end: end,
|
|
100
|
+
center: center,
|
|
101
|
+
stretch: stretch
|
|
102
|
+
)
|
|
103
|
+
),
|
|
104
|
+
"align-items": (
|
|
105
|
+
property: align-items,
|
|
106
|
+
shortcut: items,
|
|
107
|
+
values: (
|
|
108
|
+
start: start,
|
|
109
|
+
end: end,
|
|
110
|
+
center: center,
|
|
111
|
+
stretch: stretch
|
|
112
|
+
)
|
|
113
|
+
),
|
|
114
|
+
"justify-content": (
|
|
115
|
+
property: justify-content,
|
|
116
|
+
shortcut: justify-content,
|
|
117
|
+
values: (
|
|
118
|
+
start: start,
|
|
119
|
+
end: end,
|
|
120
|
+
center: center,
|
|
121
|
+
stretch: stretch,
|
|
122
|
+
space-around: space-around,
|
|
123
|
+
space-between: space-between,
|
|
124
|
+
space-evenly: space-evenly
|
|
125
|
+
)
|
|
126
|
+
),
|
|
127
|
+
"align-content": (
|
|
128
|
+
property: align-content,
|
|
129
|
+
shortcut: content,
|
|
130
|
+
values: (
|
|
131
|
+
start: start,
|
|
132
|
+
end: end,
|
|
133
|
+
center: center,
|
|
134
|
+
stretch: stretch,
|
|
135
|
+
space-around: space-around,
|
|
136
|
+
space-between: space-between,
|
|
137
|
+
space-evenly: space-evenly
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
@each $key, $utility in $grid-map {
|
|
143
|
+
@include mix.generate-utilities($utility)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Additional grid utilities for grid column and row spans
|
|
147
|
+
$grid-span-map: (
|
|
148
|
+
"grid-column": (
|
|
149
|
+
property: grid-column,
|
|
150
|
+
shortcut: col-span,
|
|
151
|
+
values: (
|
|
152
|
+
1: span 1,
|
|
153
|
+
2: span 2,
|
|
154
|
+
3: span 3,
|
|
155
|
+
4: span 4,
|
|
156
|
+
5: span 5,
|
|
157
|
+
6: span 6,
|
|
158
|
+
7: span 7,
|
|
159
|
+
8: span 8,
|
|
160
|
+
9: span 9,
|
|
161
|
+
10: span 10,
|
|
162
|
+
11: span 11,
|
|
163
|
+
12: span 12,
|
|
164
|
+
auto: auto,
|
|
165
|
+
full: 1 / -1
|
|
166
|
+
)
|
|
167
|
+
),
|
|
168
|
+
"grid-row": (
|
|
169
|
+
property: grid-row,
|
|
170
|
+
shortcut: row-span,
|
|
171
|
+
values: (
|
|
172
|
+
1: span 1,
|
|
173
|
+
2: span 2,
|
|
174
|
+
3: span 3,
|
|
175
|
+
4: span 4,
|
|
176
|
+
5: span 5,
|
|
177
|
+
6: span 6,
|
|
178
|
+
auto: auto,
|
|
179
|
+
full: 1 / -1
|
|
180
|
+
)
|
|
181
|
+
),
|
|
182
|
+
"grid-column-start": (
|
|
183
|
+
property: grid-column-start,
|
|
184
|
+
shortcut: col-start,
|
|
185
|
+
values: (
|
|
186
|
+
1: 1,
|
|
187
|
+
2: 2,
|
|
188
|
+
3: 3,
|
|
189
|
+
4: 4,
|
|
190
|
+
5: 5,
|
|
191
|
+
6: 6,
|
|
192
|
+
7: 7,
|
|
193
|
+
8: 8,
|
|
194
|
+
9: 9,
|
|
195
|
+
10: 10,
|
|
196
|
+
11: 11,
|
|
197
|
+
12: 12,
|
|
198
|
+
13: 13,
|
|
199
|
+
auto: auto
|
|
200
|
+
)
|
|
201
|
+
),
|
|
202
|
+
"grid-column-end": (
|
|
203
|
+
property: grid-column-end,
|
|
204
|
+
shortcut: col-end,
|
|
205
|
+
values: (
|
|
206
|
+
1: 1,
|
|
207
|
+
2: 2,
|
|
208
|
+
3: 3,
|
|
209
|
+
4: 4,
|
|
210
|
+
5: 5,
|
|
211
|
+
6: 6,
|
|
212
|
+
7: 7,
|
|
213
|
+
8: 8,
|
|
214
|
+
9: 9,
|
|
215
|
+
10: 10,
|
|
216
|
+
11: 11,
|
|
217
|
+
12: 12,
|
|
218
|
+
13: 13,
|
|
219
|
+
auto: auto,
|
|
220
|
+
full: -1
|
|
221
|
+
)
|
|
222
|
+
),
|
|
223
|
+
"grid-row-start": (
|
|
224
|
+
property: grid-row-start,
|
|
225
|
+
shortcut: row-start,
|
|
226
|
+
values: (
|
|
227
|
+
1: 1,
|
|
228
|
+
2: 2,
|
|
229
|
+
3: 3,
|
|
230
|
+
4: 4,
|
|
231
|
+
5: 5,
|
|
232
|
+
6: 6,
|
|
233
|
+
7: 7,
|
|
234
|
+
auto: auto
|
|
235
|
+
)
|
|
236
|
+
),
|
|
237
|
+
"grid-row-end": (
|
|
238
|
+
property: grid-row-end,
|
|
239
|
+
shortcut: row-end,
|
|
240
|
+
values: (
|
|
241
|
+
1: 1,
|
|
242
|
+
2: 2,
|
|
243
|
+
3: 3,
|
|
244
|
+
4: 4,
|
|
245
|
+
5: 5,
|
|
246
|
+
6: 6,
|
|
247
|
+
7: 7,
|
|
248
|
+
auto: auto,
|
|
249
|
+
full: -1
|
|
250
|
+
)
|
|
251
|
+
)
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
@each $key, $utility in $grid-span-map {
|
|
255
|
+
@include mix.generate-utilities($utility)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Additional grid placement utilities
|
|
259
|
+
$grid-placement-map: (
|
|
260
|
+
"grid-area": (
|
|
261
|
+
property: grid-area,
|
|
262
|
+
shortcut: area,
|
|
263
|
+
values: (
|
|
264
|
+
auto: auto,
|
|
265
|
+
span-1: span 1,
|
|
266
|
+
span-2: span 2,
|
|
267
|
+
span-3: span 3,
|
|
268
|
+
span-4: span 4,
|
|
269
|
+
span-5: span 5,
|
|
270
|
+
span-6: span 6
|
|
271
|
+
)
|
|
272
|
+
),
|
|
273
|
+
"place-items": (
|
|
274
|
+
property: place-items,
|
|
275
|
+
shortcut: place-items,
|
|
276
|
+
values: (
|
|
277
|
+
start: start,
|
|
278
|
+
center: center,
|
|
279
|
+
end: end,
|
|
280
|
+
stretch: stretch
|
|
281
|
+
)
|
|
282
|
+
),
|
|
283
|
+
"place-content": (
|
|
284
|
+
property: place-content,
|
|
285
|
+
shortcut: place-content,
|
|
286
|
+
values: (
|
|
287
|
+
start: start,
|
|
288
|
+
center: center,
|
|
289
|
+
end: end,
|
|
290
|
+
stretch: stretch,
|
|
291
|
+
space-around: space-around,
|
|
292
|
+
space-between: space-between,
|
|
293
|
+
space-evenly: space-evenly
|
|
294
|
+
)
|
|
295
|
+
),
|
|
296
|
+
"place-self": (
|
|
297
|
+
property: place-self,
|
|
298
|
+
shortcut: place-self,
|
|
299
|
+
values: (
|
|
300
|
+
auto: auto,
|
|
301
|
+
start: start,
|
|
302
|
+
end: end,
|
|
303
|
+
center: center,
|
|
304
|
+
stretch: stretch
|
|
305
|
+
)
|
|
306
|
+
)
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
@each $key, $utility in $grid-placement-map {
|
|
310
|
+
@include mix.generate-utilities($utility)
|
|
311
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@use "mixins" as mix;
|
|
2
|
+
|
|
3
|
+
// Letter-spacing (tracking) utilities map
|
|
4
|
+
// Generates .fx-tracking-{tighter,tight,normal,wide,wider,widest}
|
|
5
|
+
$letter-spacing-map: (
|
|
6
|
+
"letter-spacing": (
|
|
7
|
+
property: letter-spacing,
|
|
8
|
+
shortcut: tracking,
|
|
9
|
+
values: (
|
|
10
|
+
tighter: -0.05em,
|
|
11
|
+
tight: -0.025em,
|
|
12
|
+
normal: 0,
|
|
13
|
+
wide: 0.025em,
|
|
14
|
+
wider: 0.05em,
|
|
15
|
+
widest: 0.1em
|
|
16
|
+
)
|
|
17
|
+
),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
@each $key, $utility in $letter-spacing-map {
|
|
21
|
+
@include mix.generate-utilities($utility)
|
|
22
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@use "mixins" as mix;
|
|
2
|
+
|
|
3
|
+
// Min/max sizing utilities map
|
|
4
|
+
// Generates .fx-min-w-*, .fx-max-w-*, .fx-min-h-*, .fx-max-h-*
|
|
5
|
+
// The rem scale is shared by the max-* families (3xs..lg); note 2xs = 10rem (~160px).
|
|
6
|
+
$min-max-sizing-map: (
|
|
7
|
+
"min-width": (
|
|
8
|
+
property: min-width,
|
|
9
|
+
shortcut: min-w,
|
|
10
|
+
values: (
|
|
11
|
+
0: 0,
|
|
12
|
+
full: 100%
|
|
13
|
+
)
|
|
14
|
+
),
|
|
15
|
+
"min-height": (
|
|
16
|
+
property: min-height,
|
|
17
|
+
shortcut: min-h,
|
|
18
|
+
values: (
|
|
19
|
+
0: 0,
|
|
20
|
+
full: 100%
|
|
21
|
+
)
|
|
22
|
+
),
|
|
23
|
+
"max-width": (
|
|
24
|
+
property: max-width,
|
|
25
|
+
shortcut: max-w,
|
|
26
|
+
values: (
|
|
27
|
+
0: 0,
|
|
28
|
+
none: none,
|
|
29
|
+
"3xs": 8rem,
|
|
30
|
+
"2xs": 10rem,
|
|
31
|
+
"xs": 12rem,
|
|
32
|
+
"sm": 16rem,
|
|
33
|
+
"md": 24rem,
|
|
34
|
+
"lg": 32rem,
|
|
35
|
+
full: 100%
|
|
36
|
+
)
|
|
37
|
+
),
|
|
38
|
+
"max-height": (
|
|
39
|
+
property: max-height,
|
|
40
|
+
shortcut: max-h,
|
|
41
|
+
values: (
|
|
42
|
+
0: 0,
|
|
43
|
+
none: none,
|
|
44
|
+
"3xs": 8rem,
|
|
45
|
+
"2xs": 10rem,
|
|
46
|
+
"xs": 12rem,
|
|
47
|
+
"sm": 16rem,
|
|
48
|
+
"md": 24rem,
|
|
49
|
+
"lg": 32rem,
|
|
50
|
+
full: 100%
|
|
51
|
+
)
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
@each $key, $utility in $min-max-sizing-map {
|
|
56
|
+
@include mix.generate-utilities($utility)
|
|
57
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@use "mixins" as mix;
|
|
2
|
+
|
|
3
|
+
// Opacity utilities map
|
|
4
|
+
// Generates .fx-opacity-{0..100} for opacity 0.0 to 1.0
|
|
5
|
+
$opacity-map: (
|
|
6
|
+
"opacity": (
|
|
7
|
+
property: opacity,
|
|
8
|
+
shortcut: opacity,
|
|
9
|
+
values: (
|
|
10
|
+
0: 0,
|
|
11
|
+
5: 0.05,
|
|
12
|
+
10: 0.1,
|
|
13
|
+
20: 0.2,
|
|
14
|
+
25: 0.25,
|
|
15
|
+
30: 0.3,
|
|
16
|
+
40: 0.4,
|
|
17
|
+
50: 0.5,
|
|
18
|
+
60: 0.6,
|
|
19
|
+
70: 0.7,
|
|
20
|
+
75: 0.75,
|
|
21
|
+
80: 0.8,
|
|
22
|
+
90: 0.9,
|
|
23
|
+
100: 1
|
|
24
|
+
)
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
@each $key, $utility in $opacity-map {
|
|
29
|
+
@include mix.generate-utilities($utility)
|
|
30
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@use "mixins" as mix;
|
|
2
|
+
|
|
3
|
+
// Text-transform utilities map
|
|
4
|
+
// Uses an empty shortcut so selectors are bare: .fx-uppercase, .fx-lowercase,
|
|
5
|
+
// .fx-capitalize, .fx-normal-case. (The legacy .fx-f-capitalize in _fx-font.scss
|
|
6
|
+
// is intentionally left untouched.)
|
|
7
|
+
$text-transform-map: (
|
|
8
|
+
"text-transform": (
|
|
9
|
+
property: text-transform,
|
|
10
|
+
shortcut: "",
|
|
11
|
+
values: (
|
|
12
|
+
uppercase: uppercase,
|
|
13
|
+
lowercase: lowercase,
|
|
14
|
+
capitalize: capitalize,
|
|
15
|
+
normal-case: none
|
|
16
|
+
)
|
|
17
|
+
),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
@each $key, $utility in $text-transform-map {
|
|
21
|
+
@include mix.generate-utilities($utility)
|
|
22
|
+
}
|
package/scss/_typography.scss
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
@use 'sass:math';
|
|
2
2
|
@use "sass:map";
|
|
3
|
+
@use "sass:list";
|
|
4
|
+
@use "sass:meta";
|
|
3
5
|
|
|
4
6
|
$font-weight-map: (
|
|
5
7
|
font-thin: 100,
|
|
@@ -13,88 +15,124 @@ $font-weight-map: (
|
|
|
13
15
|
font-black: 900
|
|
14
16
|
) !default;
|
|
15
17
|
|
|
16
|
-
|
|
17
18
|
@each $key, $value in $font-weight-map {
|
|
18
19
|
.fx-#{$key} {
|
|
19
20
|
font-weight: #{$value} !important;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
// Define typography scale range - users can override these values
|
|
25
|
+
// This should match the positiveSteps and negativeSteps used in utopia
|
|
26
|
+
$positive-steps: 6 !default; // Number of positive steps (should match utopia positiveSteps)
|
|
27
|
+
$negative-steps: 4 !default; // Number of negative steps (should match utopia negativeSteps)
|
|
28
|
+
|
|
29
|
+
// Create a map of typography variables - users can override this to match their utopia prefix
|
|
30
|
+
// To customize, users can define their own $typography-vars map before importing this file
|
|
31
|
+
// Example:
|
|
32
|
+
// $typography-vars: (
|
|
33
|
+
// 1: var(--step-typography-1),
|
|
34
|
+
// 2: var(--step-typography-2),
|
|
35
|
+
// // ... etc up to positiveSteps and negativeSteps
|
|
36
|
+
// ) !default;
|
|
37
|
+
|
|
38
|
+
// Default map with the most common range of steps
|
|
39
|
+
$typography-vars: (
|
|
40
|
+
0: var(--fx-typography-0),
|
|
41
|
+
1: var(--fx-typography-1),
|
|
42
|
+
2: var(--fx-typography-2),
|
|
43
|
+
3: var(--fx-typography-3),
|
|
44
|
+
4: var(--fx-typography-4),
|
|
45
|
+
5: var(--fx-typography-5),
|
|
46
|
+
6: var(--fx-typography-6),
|
|
47
|
+
7: var(--fx-typography-7),
|
|
48
|
+
8: var(--fx-typography-8),
|
|
49
|
+
-1: var(--fx-typography--1),
|
|
50
|
+
-2: var(--fx-typography--2),
|
|
51
|
+
-3: var(--fx-typography--3),
|
|
52
|
+
-4: var(--fx-typography--4),
|
|
53
|
+
-5: var(--fx-typography--5),
|
|
54
|
+
-6: var(--fx-typography--6),
|
|
55
|
+
-7: var(--fx-typography--7),
|
|
56
|
+
-8: var(--fx-typography--8)
|
|
57
|
+
) !default;
|
|
23
58
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.fx-headline-1 {
|
|
34
|
-
font-size: var(--fx-typography-6);
|
|
35
|
-
/* font-size: project(60px, 112px); */
|
|
36
|
-
font-weight: map.get($font-weight-map, font-semibold);
|
|
37
|
-
line-height: initial;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.fx-headline-2 {
|
|
41
|
-
font-size: var(--fx-typography-5);
|
|
42
|
-
/* font-size: project(40px, 84px); */
|
|
43
|
-
font-weight: map.get($font-weight-map, font-medium);
|
|
44
|
-
line-height: initial;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.fx-headline-3 {
|
|
48
|
-
font-size: var(--fx-typography-4);
|
|
49
|
-
/* font-size: project(30px, 64px); */
|
|
50
|
-
font-weight: map.get($font-weight-map, font-semibold);
|
|
51
|
-
line-height: initial;
|
|
59
|
+
// Function to get the appropriate CSS variable name from the map
|
|
60
|
+
// If the exact index isn't in the map, fall back to default naming
|
|
61
|
+
@function get-typography-var($step) {
|
|
62
|
+
@if map.has-key($typography-vars, $step) {
|
|
63
|
+
@return map.get($typography-vars, $step);
|
|
64
|
+
} @else {
|
|
65
|
+
// Fallback to dynamically generated variable name if not in map
|
|
66
|
+
@return var(--fx-typography-#{$step});
|
|
67
|
+
}
|
|
52
68
|
}
|
|
53
69
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
// Generate font size classes dynamically based on the typography scale
|
|
71
|
+
@for $i from $positive-steps * -1 through $positive-steps {
|
|
72
|
+
@if $i != 0 {
|
|
73
|
+
.fx-text-#{$i} {
|
|
74
|
+
font-size: get-typography-var($i);
|
|
75
|
+
}
|
|
76
|
+
} @else {
|
|
77
|
+
.fx-text-0 {
|
|
78
|
+
font-size: get-typography-var(0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
58
81
|
}
|
|
59
82
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
// Define specific semantic typography classes
|
|
84
|
+
// Headline classes - dynamically generated based on positive steps
|
|
85
|
+
@for $i from 1 through $positive-steps {
|
|
86
|
+
.fx-headline-#{$i} {
|
|
87
|
+
font-size: get-typography-var($i);
|
|
88
|
+
font-weight: if($i <= 3, map.get($font-weight-map, font-semibold), map.get($font-weight-map, font-medium));
|
|
89
|
+
line-height: initial;
|
|
90
|
+
}
|
|
64
91
|
}
|
|
65
92
|
|
|
93
|
+
// Body and other semantic classes
|
|
66
94
|
.fx-title {
|
|
67
|
-
font-size:
|
|
95
|
+
font-size: get-typography-var(1);
|
|
68
96
|
font-weight: map.get($font-weight-map, font-medium);
|
|
69
|
-
line-height: calc(
|
|
97
|
+
line-height: calc(get-typography-var(1) + var(--fx-xs));
|
|
70
98
|
}
|
|
71
99
|
|
|
72
100
|
.fx-subtitle {
|
|
73
|
-
font-size:
|
|
101
|
+
font-size: get-typography-var(0);
|
|
74
102
|
font-weight: map.get($font-weight-map, font-normal);
|
|
75
|
-
line-height: calc(
|
|
103
|
+
line-height: calc(get-typography-var(0) + var(--fx-xs));
|
|
76
104
|
}
|
|
77
105
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
@for $i from 1 through $negative-steps {
|
|
107
|
+
.fx-body-#{$i} {
|
|
108
|
+
font-size: get-typography-var(-$i);
|
|
109
|
+
font-weight: if($i == 1, map.get($font-weight-map, font-normal), map.get($font-weight-map, font-light));
|
|
110
|
+
line-height: calc(get-typography-var(-$i) + var(--fx-xs));
|
|
111
|
+
}
|
|
82
112
|
}
|
|
83
113
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
114
|
+
@for $i from 1 through $negative-steps {
|
|
115
|
+
$caption-index: $i - 1;
|
|
116
|
+
@if $caption-index == 0 {
|
|
117
|
+
.fx-caption {
|
|
118
|
+
font-size: get-typography-var(-$i);
|
|
119
|
+
font-weight: map.get($font-weight-map, font-normal);
|
|
120
|
+
line-height: initial;
|
|
121
|
+
}
|
|
122
|
+
} @else if $caption-index > 0 {
|
|
123
|
+
.fx-caption-#{$caption-index} {
|
|
124
|
+
font-size: get-typography-var(-$i);
|
|
125
|
+
font-weight: map.get($font-weight-map, font-normal);
|
|
126
|
+
line-height: initial;
|
|
127
|
+
}
|
|
88
128
|
}
|
|
89
|
-
|
|
90
|
-
.fx-caption {
|
|
91
|
-
font-size: var(--fx-typography--3);
|
|
92
|
-
font-weight: map.get($font-weight-map, font-normal);
|
|
93
|
-
line-height: initial;
|
|
94
129
|
}
|
|
95
130
|
|
|
96
131
|
.fx-overline {
|
|
97
|
-
font-size: var(
|
|
132
|
+
font-size: get-typography-var(-4);
|
|
98
133
|
font-weight: map.get($font-weight-map, font-light);
|
|
99
134
|
line-height: initial;
|
|
100
135
|
}
|
|
136
|
+
|
|
137
|
+
// Additional utility: helper function for responsive typography if needed
|
|
138
|
+
// The responsive classes will be generated by the existing mixins system
|
package/scss/main.scss
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Variables and Mixins
|
|
2
|
+
@import 'variables';
|
|
3
|
+
@import 'mixins';
|
|
4
|
+
|
|
5
|
+
// Layout Utilities
|
|
6
|
+
@import 'display';
|
|
7
|
+
@import 'flex';
|
|
8
|
+
@import 'grid'; // Added grid utilities
|
|
9
|
+
@import 'sizing';
|
|
10
|
+
@import 'min-max-sizing';
|
|
11
|
+
@import 'spacing';
|
|
12
|
+
@import 'spacing-v2';
|
|
13
|
+
|
|
14
|
+
// Component Utilities
|
|
15
|
+
@import 'border-radius';
|
|
16
|
+
@import 'typography';
|
|
17
|
+
@import 'fx-font';
|
|
18
|
+
@import 'fx-flex';
|
|
19
|
+
@import 'opacity';
|
|
20
|
+
@import 'text-transform';
|
|
21
|
+
@import 'letter-spacing';
|
|
22
|
+
@import 'helpers';
|