lumina-sass 2.0.2 → 2.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/README.md +152 -33
- package/package.json +7 -11
- package/src/mix/_generators.sass +84 -33
- package/src/mix/_media.sass +29 -4
- package/src/mix/_typography.sass +44 -33
package/README.md
CHANGED
|
@@ -22,42 +22,34 @@ This will add `lumina-sass` to your `package.json` file. Do not install the libr
|
|
|
22
22
|
|
|
23
23
|
You can use the library directly in your Sass files using standard `@use` syntax.
|
|
24
24
|
|
|
25
|
-
#### 1. Import
|
|
26
|
-
|
|
25
|
+
#### 1. Import Flexbox Utilities (the only public export)
|
|
26
|
+
|
|
27
|
+
You can import the flexbox utilities directly:
|
|
27
28
|
|
|
28
29
|
```sass
|
|
29
30
|
// In your style.sass or style.scss file:
|
|
30
|
-
@use 'lumina-sass' as
|
|
31
|
+
@use 'lumina-sass/flexbox' as flex;
|
|
31
32
|
|
|
32
|
-
// Now all mixins and classes are available:
|
|
33
|
-
.container
|
|
34
|
-
|
|
33
|
+
// Now all flexbox mixins and classes are available:
|
|
34
|
+
.container {
|
|
35
|
+
@include flex.flexbox-generator('flex');
|
|
36
|
+
}
|
|
35
37
|
```
|
|
36
38
|
|
|
39
|
+
|
|
37
40
|
#### 2. Import Specific Modules
|
|
38
|
-
If you only need certain parts, you can import them individually:
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@use 'lumina-sass/mixins' as mix
|
|
43
|
-
@use 'lumina-sass/utils' as utils
|
|
44
|
-
|
|
45
|
-
// Example usage:
|
|
46
|
-
.social-button
|
|
47
|
-
background-color: $discord-blue
|
|
48
|
-
// $youtube-red-hover now uses rgb(120, 6, 6)
|
|
49
|
-
.container
|
|
50
|
-
@include mix.flex-center // Using mixins
|
|
51
|
-
```
|
|
42
|
+
> The package now exports the `flexbox` sub‑path and other public sub‑paths (`color`, `mix`). Other internal modules (`utils`, `map`, …) remain private.
|
|
43
|
+
|
|
52
44
|
|
|
53
45
|
### Module Breakdown
|
|
54
46
|
|
|
55
47
|
| Module | Description |
|
|
56
48
|
| :--- | :--- |
|
|
57
|
-
| `lumina-sass/
|
|
58
|
-
| `lumina-sass/
|
|
59
|
-
| `lumina-sass/
|
|
60
|
-
|
|
49
|
+
| `lumina-sass/flexbox` | Flexbox utilities and CSS classes. |
|
|
50
|
+
| `lumina-sass/color` | Color variables and palettes. |
|
|
51
|
+
| `lumina-sass/mix` | General mixins (layout, typography, media). |
|
|
52
|
+
|
|
61
53
|
|
|
62
54
|
### Utility Classes
|
|
63
55
|
|
|
@@ -66,21 +58,18 @@ If you prefer to use CSS classes directly in your HTML (like `.flex-center`), pl
|
|
|
66
58
|
### Semantic Media Queries
|
|
67
59
|
For common media queries, you can use these simple helper mixins to make your code more readable.
|
|
68
60
|
|
|
69
|
-
```
|
|
70
|
-
.my-component
|
|
61
|
+
```sass
|
|
62
|
+
.my-component
|
|
71
63
|
// Base styles
|
|
72
|
-
background: white
|
|
64
|
+
background: white
|
|
73
65
|
|
|
74
66
|
// Applies styles for medium screens and smaller
|
|
75
|
-
@include on-breakpoint(md)
|
|
76
|
-
font-size: 0.9rem
|
|
77
|
-
}
|
|
67
|
+
@include on-breakpoint(md)
|
|
68
|
+
font-size: 0.9rem
|
|
78
69
|
|
|
79
70
|
// Applies styles when the user prefers dark mode
|
|
80
|
-
@include on-dark-mode
|
|
81
|
-
background: black
|
|
82
|
-
}
|
|
83
|
-
}
|
|
71
|
+
@include on-dark-mode
|
|
72
|
+
background: black
|
|
84
73
|
```
|
|
85
74
|
|
|
86
75
|
Available helpers:
|
|
@@ -117,6 +106,136 @@ To learn how to contribute or understand the release process, please see:
|
|
|
117
106
|
- [**Development Guide**](docs/developer/development.md) - Project structure and setup rules.
|
|
118
107
|
- [**Releasing & Publishing**](docs/developer/releasing.md) - Details on the release process.
|
|
119
108
|
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
# AI Operations Guide for **lumina-sass**
|
|
112
|
+
|
|
113
|
+
> This document is intended for the Antigravity AI (or any other automated assistant) that contributes to the `lumina-sass` project. It consolidates the repository‑specific conventions, tooling, and policies that enable the AI to work safely, efficiently, and in compliance with the user’s personal rules.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 1️⃣ Project Overview
|
|
118
|
+
- **Name:** `lumina-sass`
|
|
119
|
+
- **Purpose:** Provides design tokens, mixins, and flexbox utilities for Sass‑based web projects.
|
|
120
|
+
- **Primary public entry point:** `lumina-sass/flexbox` (the only sub‑path exported in `package.json`).
|
|
121
|
+
- **Main files:**
|
|
122
|
+
- `src/_index.sass` – default entry (re‑exports flexbox).
|
|
123
|
+
- `src/flexbox/_index.sass` – collection of flexbox mixins and utility classes.
|
|
124
|
+
- `README.md` – user‑facing documentation (kept up‑to‑date with export changes).
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 2️⃣ Development Environment (User‑defined rules)
|
|
129
|
+
- **Node.js version:** Use the latest **Stable LTS** (v24.x) via `fnm`.
|
|
130
|
+
```bash
|
|
131
|
+
fnm use lts # activates the stable LTS version
|
|
132
|
+
```
|
|
133
|
+
- **Package manager:** `npm` (default for this repo).
|
|
134
|
+
- **GPG signing:** All commits must be **GPG‑signed** (`git commit -S`). The AI should stage changes and let the user provide the pass‑phrase; never use `--no-gpg-sign`.
|
|
135
|
+
- **Conventional Commits:** Follow the `type: description.` format, ending with a period. Emphasise *why* a change is made.
|
|
136
|
+
- **Python tools:** When needed, create a virtual environment with `python -m venv .venv` (not required for this repo, but noted for future scripts).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 3️⃣ Repository Layout (important paths)
|
|
141
|
+
```
|
|
142
|
+
lumina-sass/
|
|
143
|
+
├─ src/ # Sass source files
|
|
144
|
+
│ ├─ _index.sass # Default entry point (re‑exports flexbox)
|
|
145
|
+
│ ├─ flexbox/ # Public module – only exported sub‑path
|
|
146
|
+
│ │ ├─ _index.sass
|
|
147
|
+
│ │ └─ …
|
|
148
|
+
│ └─ (other internal directories: color/, mix/, utils/, map/)
|
|
149
|
+
├─ dist/ # Build artefacts (generated by `npm run build`)
|
|
150
|
+
├─ docs/ # Additional documentation
|
|
151
|
+
│ └─ ai_guide.md # **This file** – AI reference guide
|
|
152
|
+
├─ README.md # Consumer‑facing docs – kept in sync with exports
|
|
153
|
+
├─ package.json
|
|
154
|
+
└─ ...
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 4️⃣ Core Tasks for the AI
|
|
160
|
+
| Task | How the AI should perform it | Important notes |
|
|
161
|
+
|------|-----------------------------|----------------|
|
|
162
|
+
| **Edit files** | Use `replace_file_content` for a single contiguous block or `multi_replace_file_content` for multiple non‑adjacent edits. Never overwrite a whole file with `write_to_file` unless explicitly creating a new artifact. | Preserve existing comments and docstrings. |
|
|
163
|
+
| **Stage changes** | `git add <file>` after editing. |
|
|
164
|
+
| **Commit** | `git commit -S -m "<Conventional Commit>"`. The AI must describe the command before execution and ensure GPG signing is enabled. |
|
|
165
|
+
| **Run builds** | `npm run build` (or `npm run dev` if a dev server is needed). Ensure the LTS Node version is active via `fnm`. |
|
|
166
|
+
| **Verify exports** | Test that `import 'lumina-sass/flexbox'` works and that importing any other sub‑path fails with `Package subpath ... is not defined`. |
|
|
167
|
+
| **Update documentation** | Keep `README.md` and any internal docs in sync with code changes, especially the `exports` field. |
|
|
168
|
+
| **Memory synchronization** | Whenever the AI updates a file that is part of the user’s memory (e.g., global or project‑specific memory files), also copy the changes to `/home/kristoffer/Gdrive/Administration/Gemini-Memory-Backup/`. |
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 5️⃣ Export Management (Key AI Responsibility)
|
|
173
|
+
- The `package.json` **exports** block defines the public API. The AI must:
|
|
174
|
+
1. Ensure only the intended sub‑paths are listed (currently `.` and `./flexbox`).
|
|
175
|
+
2. Update the **module breakdown table** in `README.md` to reflect the exported modules.
|
|
176
|
+
3. When new public modules are added, remember to:
|
|
177
|
+
- Add them to `exports`.
|
|
178
|
+
- Update the README table.
|
|
179
|
+
- Adjust the documentation guide.
|
|
180
|
+
- Any attempt to expose internal modules (`color`, `mixins`, `utils`, `map`) must be rejected unless the user explicitly asks for it.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 6️⃣ Testing & Verification Workflow
|
|
185
|
+
1. **Local import test**
|
|
186
|
+
```bash
|
|
187
|
+
node -e "import 'lumina-sass/flexbox'" # should succeed
|
|
188
|
+
node -e "import 'lumina-sass/utils'" # should fail
|
|
189
|
+
```
|
|
190
|
+
2. **Build**
|
|
191
|
+
```bash
|
|
192
|
+
npm run build
|
|
193
|
+
```
|
|
194
|
+
3. **Run demo** (optional) to ensure compiled CSS works:
|
|
195
|
+
```bash
|
|
196
|
+
npm run serve # serves the demo folder via http‑server
|
|
197
|
+
```
|
|
198
|
+
4. **Commit verification**: After committing, run `git log --show-signature -1` to confirm the GPG signature is present.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 7️⃣ Contribution Guidelines (for AI and humans)
|
|
203
|
+
- **Pull‑request workflow:**
|
|
204
|
+
1. Create a feature branch.
|
|
205
|
+
2. Make the required edits.
|
|
206
|
+
3. Run the verification steps above.
|
|
207
|
+
4. Commit with a signed Conventional Commit.
|
|
208
|
+
5. Push and open a PR.
|
|
209
|
+
- **Documentation:** Every public change must be reflected in `README.md` and, if relevant, in the AI guide.
|
|
210
|
+
- **Linting / Formatting:** Keep the repo formatted according to the existing style (Sass indentation, no trailing spaces).
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 8️⃣ Quick Reference Commands (AI‑friendly)
|
|
215
|
+
| Purpose | Command |
|
|
216
|
+
|---------|---------|
|
|
217
|
+
| Activate LTS Node | `fnm use lts` |
|
|
218
|
+
| Install dependencies | `npm install` |
|
|
219
|
+
| Build the package | `npm run build` |
|
|
220
|
+
| Serve demo (optional) | `npm run serve` |
|
|
221
|
+
| Stage a file | `git add <path>` |
|
|
222
|
+
| Signed commit (example) | `git commit -S -m "feat: description of change."` |
|
|
223
|
+
| Verify signature | `git log --show-signature -1` |
|
|
224
|
+
| Test valid import | `node -e "import 'lumina-sass/flexbox'"` |
|
|
225
|
+
| Test invalid import | `node -e "import 'lumina-sass/utils'"` |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 9️⃣ Contact & Further Help
|
|
230
|
+
- For any ambiguity, the AI should ask the user via a clarifying question before proceeding.
|
|
231
|
+
- The AI must always **present a plan before executing** any non‑trivial change (as per user‑global rules).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
*This guide is version‑controlled along with the rest of the repository, ensuring the AI always has an up‑to‑date reference when working on `lumina-sass`.*
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
120
239
|
## License
|
|
121
240
|
|
|
122
241
|
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lumina-sass",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "Lumina Sass design tokens and
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Lumina Sass design tokens, mixins and public sub-modules (flexbox, color, mix).",
|
|
5
5
|
"main": "src/_index.sass",
|
|
6
6
|
"sass": "src/_index.sass",
|
|
7
7
|
"exports": {
|
|
@@ -9,21 +9,17 @@
|
|
|
9
9
|
"sass": "./src/_index.sass",
|
|
10
10
|
"default": "./src/_index.sass"
|
|
11
11
|
},
|
|
12
|
+
"./flexbox": {
|
|
13
|
+
"sass": "./src/flexbox/_index.sass",
|
|
14
|
+
"default": "./src/flexbox/_index.sass"
|
|
15
|
+
},
|
|
12
16
|
"./color": {
|
|
13
17
|
"sass": "./src/color/_index.sass",
|
|
14
18
|
"default": "./src/color/_index.sass"
|
|
15
19
|
},
|
|
16
|
-
"./
|
|
20
|
+
"./mix": {
|
|
17
21
|
"sass": "./src/mix/_index.sass",
|
|
18
22
|
"default": "./src/mix/_index.sass"
|
|
19
|
-
},
|
|
20
|
-
"./utils": {
|
|
21
|
-
"sass": "./src/utils/_flexbox.sass",
|
|
22
|
-
"default": "./src/utils/_flexbox.sass"
|
|
23
|
-
},
|
|
24
|
-
"./map": {
|
|
25
|
-
"sass": "./src/map/_index.sass",
|
|
26
|
-
"default": "./src/map/_index.sass"
|
|
27
23
|
}
|
|
28
24
|
},
|
|
29
25
|
"repository": {
|
package/src/mix/_generators.sass
CHANGED
|
@@ -2,42 +2,93 @@
|
|
|
2
2
|
@use '../map/icons' as icon-map
|
|
3
3
|
@use '../map/tag-theme' as tag-map
|
|
4
4
|
@use '../map/flexbox' as flexbox-mapping
|
|
5
|
-
|
|
5
|
+
@use '../map/inputs' as inputs
|
|
6
|
+
@use "sass:list" as list
|
|
6
7
|
|
|
7
8
|
@mixin icon-generator($name: null, $color: null, $font-family: 'bootstrap-icons')
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@else
|
|
19
|
-
$found: false
|
|
20
|
-
@each $category, $maps in icon-map.$icons
|
|
21
|
-
@if map.has-key($maps, $name)
|
|
22
|
-
$found: true
|
|
23
|
-
$props: map.get($maps, $name)
|
|
24
|
-
.#{$name}
|
|
25
|
-
font-family: $font-family
|
|
26
|
-
&:before
|
|
27
|
-
content: map.get($props, icon)
|
|
28
|
-
@if $color
|
|
29
|
-
color: $color
|
|
30
|
-
|
|
31
|
-
@if not $found
|
|
32
|
-
@warn 'Icon "#{$name}" not found in icon mapping.'
|
|
9
|
+
@if icon-map.$icons
|
|
10
|
+
@if $name == null
|
|
11
|
+
@each $category, $maps in icon-map.$icons
|
|
12
|
+
@each $icon, $props in $maps
|
|
13
|
+
.#{$icon}
|
|
14
|
+
font-family: $font-family
|
|
15
|
+
&::before
|
|
16
|
+
content: map.get($props, icon)
|
|
17
|
+
@if $color
|
|
18
|
+
color: $color
|
|
33
19
|
@else
|
|
34
|
-
|
|
20
|
+
$found: false
|
|
21
|
+
@each $category, $maps in icon-map.$icons
|
|
22
|
+
@if map.has-key($maps, $name)
|
|
23
|
+
$found: true
|
|
24
|
+
$props: map.get($maps, $name)
|
|
25
|
+
.#{$name}
|
|
26
|
+
font-family: $font-family
|
|
27
|
+
&::before
|
|
28
|
+
content: map.get($props, icon)
|
|
29
|
+
@if $color
|
|
30
|
+
color: $color
|
|
31
|
+
@if not $found
|
|
32
|
+
@warn "Icon #{$name} not found in icon mapping."
|
|
33
|
+
@else
|
|
34
|
+
@error "Icon mapping not found."
|
|
35
35
|
|
|
36
36
|
@mixin flexbox-generator($name)
|
|
37
|
-
|
|
37
|
+
$props: map.get(flexbox-mapping.$flexbox, $name)
|
|
38
|
+
@if $props
|
|
39
|
+
@each $property, $value in $props
|
|
40
|
+
#{$property}: $value
|
|
41
|
+
@else
|
|
42
|
+
@error "#{$name} not found in flexbox mapping."
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
@mixin input-generator($name, $placeholder-color: null, $custom: ())
|
|
45
|
+
$props: map.merge(inputs.$default-input-props, $custom)
|
|
46
|
+
|
|
47
|
+
// Determine focus outline (custom overrides default)
|
|
48
|
+
$focus-outline: map.get($custom, 'focus-outline') or rgb(0, 120, 215)
|
|
49
|
+
|
|
50
|
+
@if $name == null
|
|
51
|
+
@each $cat, $list in inputs.$inputs
|
|
52
|
+
@each $input in $list
|
|
53
|
+
input[type="#{$input}"]
|
|
54
|
+
@each $prop, $val in $props
|
|
55
|
+
#{$prop}: $val
|
|
56
|
+
@if $placeholder-color != null
|
|
57
|
+
&::placeholder
|
|
58
|
+
color: $placeholder-color
|
|
59
|
+
&:focus
|
|
60
|
+
outline: $focus-outline
|
|
61
|
+
@else
|
|
62
|
+
$category: null
|
|
63
|
+
@each $cat, $list in inputs.$inputs
|
|
64
|
+
@if list.index($list, $name)
|
|
65
|
+
$category: $cat
|
|
66
|
+
|
|
67
|
+
@if $category == null
|
|
68
|
+
@warn "Input '#{$name}' not found in inputs map. Check inputs/_inputs.sass for valid names."
|
|
69
|
+
|
|
70
|
+
input[type="#{$name}"]
|
|
71
|
+
@each $prop, $val in $props
|
|
72
|
+
#{$prop}: $val
|
|
73
|
+
@if $placeholder-color != null
|
|
74
|
+
&::placeholder
|
|
75
|
+
color: $placeholder-color
|
|
76
|
+
|
|
77
|
+
&:focus
|
|
78
|
+
outline: $focus-outline
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// Range track styling
|
|
82
|
+
&::-webkit-slider-runnable-track
|
|
83
|
+
height: 0.4rem
|
|
84
|
+
background: #ddd
|
|
85
|
+
border-radius: 0.2rem
|
|
86
|
+
|
|
87
|
+
// Range thumb styling
|
|
88
|
+
&::-webkit-slider-thumb
|
|
89
|
+
-webkit-appearance: none
|
|
90
|
+
width: 1rem
|
|
91
|
+
height: 1rem
|
|
92
|
+
background: #0078d7
|
|
93
|
+
border-radius: 50%
|
|
94
|
+
margin-top: -0.3rem
|
package/src/mix/_media.sass
CHANGED
|
@@ -53,17 +53,42 @@
|
|
|
53
53
|
@else
|
|
54
54
|
@error "Invalid orientation `#{$orientation}` – use portrait or landscape."
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
@mixin figure-and-image($object-fit: cover, $size: null, $style: null)
|
|
56
|
+
@mixin figure($object-fit: cover, $size: null, $style: italic, $width: 16, $length: 9, $position: null, $percentage: null)
|
|
58
57
|
figure
|
|
59
|
-
|
|
58
|
+
// Portrait video – forced 9:16 ratio
|
|
59
|
+
video.portrait-media
|
|
60
|
+
max-inline-size: 20em !important
|
|
61
|
+
@include mix.aspect-ratio($width: 9, $length: 16)
|
|
62
|
+
|
|
63
|
+
// Landscape video – default ratio
|
|
64
|
+
video.landscape-media
|
|
65
|
+
object-position: center 35%
|
|
66
|
+
@include mix.aspect-ratio()
|
|
67
|
+
|
|
68
|
+
// Image and picture handling
|
|
69
|
+
picture,
|
|
70
|
+
img
|
|
60
71
|
inline-size: 100%
|
|
61
72
|
object-fit: $object-fit
|
|
73
|
+
@include mix.aspect-ratio($width, $length)
|
|
74
|
+
@if $position != null or $percentage != null
|
|
75
|
+
object-position: $position $percentage
|
|
62
76
|
|
|
77
|
+
// Nested <picture><img> – duplicate settings for readability
|
|
63
78
|
picture
|
|
64
79
|
img
|
|
65
80
|
inline-size: 100%
|
|
66
81
|
object-fit: $object-fit
|
|
82
|
+
@include mix.aspect-ratio($width, $length)
|
|
83
|
+
@if $position != null or $percentage != null
|
|
84
|
+
object-position: $position $percentage
|
|
85
|
+
|
|
86
|
+
// Figcaption styling if size provided
|
|
67
87
|
figcaption
|
|
68
|
-
@if $size != null and $style != null
|
|
69
88
|
@include typo.font($size, $style)
|
|
89
|
+
|
|
90
|
+
@mixin aspect-ratio($width: 16, $length: 9)
|
|
91
|
+
aspect-ratio: calc($width / $length)/ $length
|
|
92
|
+
|
|
93
|
+
@include aspect-ratio(9, 16)
|
|
94
|
+
aspect-ratio: calc($width / $length)/ $length
|
package/src/mix/_typography.sass
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
@use 'sass:list'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
@mixin text-wrap-safe()
|
|
5
|
-
p, h1, h2, h3, h4, h5, h6, figcaption, a, li
|
|
6
|
-
hyphens: auto
|
|
7
|
-
min-inline-size: 0
|
|
8
|
-
word-wrap: anywhere
|
|
9
|
-
white-space: pre-wrap
|
|
10
|
-
overflow-wrap: anywhere
|
|
11
|
-
|
|
12
|
-
@mixin font-style($font, $family: null)
|
|
13
|
-
$sans-serif: ('Roboto', 'Work Sans', 'Nunito')
|
|
14
|
-
|
|
15
|
-
@if list.index($sans-serif, $font)
|
|
16
|
-
$family: sans-serif
|
|
17
|
-
|
|
18
|
-
font-family: $font, $family
|
|
19
|
-
|
|
20
|
-
@mixin font($size: null, $weight: null, $font: null, $family: null, $style: null)
|
|
21
|
-
@if $font != null
|
|
22
|
-
@include font-style($font, $family)
|
|
23
|
-
@else if $family != null
|
|
24
|
-
font-family: $family
|
|
25
|
-
|
|
26
|
-
@if $size != null
|
|
27
|
-
font-size: $size
|
|
28
|
-
|
|
29
|
-
@if $weight != null
|
|
30
|
-
font-weight: $weight
|
|
31
|
-
|
|
32
|
-
@if $style != null
|
|
33
|
-
font-style: $style
|
|
34
1
|
|
|
2
|
+
@use 'sass:map'
|
|
3
|
+
@use 'sass:list'
|
|
4
|
+
@use '../map/fonts' as fonts
|
|
5
|
+
|
|
6
|
+
@mixin text-wrap-safe($inline: 0)
|
|
7
|
+
p, h1, h2, h3, h4, h5, h6, figcaption, a, li
|
|
8
|
+
hyphens: auto
|
|
9
|
+
word-wrap: anywhere
|
|
10
|
+
white-space: pre-wrap
|
|
11
|
+
overflow-wrap: anywhere
|
|
12
|
+
min-inline-size: $inline
|
|
13
|
+
|
|
14
|
+
@mixin font-style($font, $family: null, $line-height: null, $variant: null)
|
|
15
|
+
$detected-family: font-family-of($font)
|
|
16
|
+
@if $detected-family != null
|
|
17
|
+
$family: $detected-family
|
|
18
|
+
@if $line-height != null
|
|
19
|
+
line-height: $line-height
|
|
20
|
+
@if $variant != null
|
|
21
|
+
font-variant: $variant
|
|
22
|
+
// Always include a fallback family.
|
|
23
|
+
font-family: $font, $family
|
|
24
|
+
|
|
25
|
+
@mixin font( $font: null, $size: 1rem, $family: null, $style: normal, $weight: normal)
|
|
26
|
+
@if $font != null
|
|
27
|
+
@include font-style($font, $family)
|
|
28
|
+
|
|
29
|
+
@else if $family != null
|
|
30
|
+
font-family: $family
|
|
31
|
+
|
|
32
|
+
@if $size != null
|
|
33
|
+
font-size: $size
|
|
34
|
+
|
|
35
|
+
@if $weight != null
|
|
36
|
+
font-weight: $weight
|
|
37
|
+
|
|
38
|
+
@if $style != null
|
|
39
|
+
font-style: $style
|
|
40
|
+
|
|
41
|
+
// Helper: return the generic family for a given font name using the fonts map.
|
|
42
|
+
@function font-family-of($font)
|
|
43
|
+
@if map.has-key(fonts.$font-family, $font)
|
|
44
|
+
@return map.get(fonts.$font-family, $font)
|
|
45
|
+
@return null
|