nuvio 0.0.3 → 1.2.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/LICENSE +1 -1
- package/README.md +337 -6
- package/dist/nuvio-base-dark.css +1497 -0
- package/dist/nuvio-base-dark.min.css +1 -0
- package/dist/nuvio-base-light.css +1497 -0
- package/dist/nuvio-base-light.min.css +1 -0
- package/dist/nuvio-base-prefer.css +1549 -0
- package/dist/nuvio-base-prefer.min.css +1 -0
- package/dist/nuvio-base.css +1655 -0
- package/dist/nuvio-base.min.css +1 -0
- package/dist/nuvio-dark.css +9755 -0
- package/dist/nuvio-dark.min.css +1 -0
- package/dist/nuvio-light.css +9755 -0
- package/dist/nuvio-light.min.css +1 -0
- package/dist/nuvio-prefer.css +9876 -0
- package/dist/nuvio-prefer.min.css +1 -0
- package/dist/nuvio.css +10104 -17
- package/dist/nuvio.min.css +1 -1
- package/package.json +37 -22
- package/src/_config-base.scss +6 -0
- package/src/_includes-base.scss +10 -0
- package/src/_includes-full.scss +44 -0
- package/src/base/_index.scss +295 -0
- package/src/config/_index.scss +322 -0
- package/src/config/_layers.scss +27 -0
- package/src/config/themes.scss +308 -0
- package/src/config/utilities.scss +106 -0
- package/src/elements/accordion.scss +65 -0
- package/src/elements/block.scss +14 -0
- package/src/elements/box.scss +66 -0
- package/src/elements/dropdown.scss +149 -0
- package/src/elements/footer.scss +9 -0
- package/src/elements/icon.scss +63 -0
- package/src/elements/image.scss +36 -0
- package/src/elements/modal.scss +123 -0
- package/src/elements/navbar.scss +463 -0
- package/src/elements/notification.scss +53 -0
- package/src/elements/placeholder.scss +55 -0
- package/src/elements/progress.scss +85 -0
- package/src/elements/table.scss +149 -0
- package/src/elements/tag.scss +88 -0
- package/src/forms/button.scss +415 -0
- package/src/forms/checkbox-radio.scss +38 -0
- package/src/forms/controls.scss +181 -0
- package/src/forms/file.scss +237 -0
- package/src/forms/form-utilities.scss +109 -0
- package/src/forms/input.scss +27 -0
- package/src/forms/range.scss +96 -0
- package/src/forms/segmented.scss +130 -0
- package/src/forms/select.scss +100 -0
- package/src/forms/textarea.scss +26 -0
- package/src/forms/toggle.scss +106 -0
- package/src/layout/border.scss +34 -0
- package/src/layout/container.scss +36 -0
- package/src/layout/flexbox-base.scss +204 -0
- package/src/layout/flexbox-shorthands.scss +48 -0
- package/src/layout/grid.scss +72 -0
- package/src/layout/overflow.scss +23 -0
- package/src/layout/position.scss +16 -0
- package/src/layout/spacing.scss +70 -0
- package/src/layout/visibility.scss +50 -0
- package/src/main-base-auto.scss +4 -0
- package/src/main-base-dark.scss +4 -0
- package/src/main-base-light.scss +4 -0
- package/src/main-base-prefer.scss +4 -0
- package/src/main-full-auto.scss +4 -0
- package/src/main-full-dark.scss +6 -0
- package/src/main-full-light.scss +6 -0
- package/src/main-full-prefer.scss +6 -0
- package/src/typography/color.scss +25 -0
- package/src/typography/content.scss +185 -0
- package/src/typography/interaction.scss +20 -0
- package/src/typography/text.scss +71 -0
- package/src/typography/title.scss +76 -0
- package/src/_buttons.scss +0 -19
- package/src/_reset.scss +0 -5
- package/src/_typography.scss +0 -13
- package/src/_variables.scss +0 -5
- package/src/main.scss +0 -3
package/LICENSE
CHANGED
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,19 +1,350 @@
|
|
|
1
1
|
# ☁️ Nuvio CSS Framework
|
|
2
2
|
|
|
3
|
-
*Nuvio
|
|
3
|
+
*Nuvio – like "nuvola" (cloud), light foundation*
|
|
4
4
|
|
|
5
5
|
## Motivation
|
|
6
6
|
|
|
7
|
-
Modern and lightweight CSS framework providing a good but small foundation for all types of web applications using the Flexible Box Layout module (Flexbox).
|
|
7
|
+
Modern and lightweight CSS framework providing *a good but small foundation for all types of web applications* using the Flexible Box Layout module (Flexbox).
|
|
8
8
|
|
|
9
|
-
We provide ready-to-use frontend components and layout helpers that are easily combinable to build responsive web applications. Light and dark mode agnostic designs are supported out of the box.
|
|
9
|
+
We provide *ready-to-use frontend components and layout helpers* that are easily combinable to build responsive web applications. *Light and dark mode agnostic designs* are supported out of the box.
|
|
10
10
|
|
|
11
|
-
The framework is free to use and optimized for size and load speed. All color and typography choices are easily customizable to your needs
|
|
11
|
+
The framework is free to use and optimized for size and load speed. *All color and typography choices are easily customizable to your needs.*
|
|
12
12
|
|
|
13
|
-
There is no Javascript
|
|
13
|
+
*There is no mandatory Javascript.* Only specific components in specific use cases need small snippets that can easily be implemented in the application technology of your choice, including vanilla.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
**HTML – link a pre-built file directly:**
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<link rel="stylesheet" href="https://unpkg.com/nuvio/dist/nuvio.min.css" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**npm:**
|
|
16
24
|
|
|
17
25
|
```bash
|
|
18
26
|
npm install nuvio
|
|
19
27
|
```
|
|
28
|
+
|
|
29
|
+
Then link the stylesheet from your `node_modules`, or import it inside your JS/CSS entry point (see [Framework integration](#framework-integration) below).
|
|
30
|
+
|
|
31
|
+
## Bundles
|
|
32
|
+
|
|
33
|
+
Nuvio ships 16 pre-built CSS files – pick the one that fits your needs.
|
|
34
|
+
|
|
35
|
+
| File | Theme Mode | Component Set |
|
|
36
|
+
|------|------------|----------|
|
|
37
|
+
| **`nuvio.css` / `.min.css`** – *the usual choice* | **`auto`** | **Full** |
|
|
38
|
+
| `nuvio-prefer.css` / `.min.css` | `prefer` | Full |
|
|
39
|
+
| `nuvio-light.css` / `.min.css` | `light` | Full |
|
|
40
|
+
| `nuvio-dark.css` / `.min.css` | `dark` | Full |
|
|
41
|
+
| `nuvio-base.css` / `.min.css` | `auto` | Base |
|
|
42
|
+
| `nuvio-base-prefer.css` / `.min.css` | `prefer` | Base |
|
|
43
|
+
| `nuvio-base-light.css` / `.min.css` | `light` | Base |
|
|
44
|
+
| `nuvio-base-dark.css` / `.min.css` | `dark` | Base |
|
|
45
|
+
|
|
46
|
+
### Theme Modes
|
|
47
|
+
|
|
48
|
+
| Mode | Behavior |
|
|
49
|
+
|------|-----------|
|
|
50
|
+
| `auto` | Includes both light & dark mode, automatically switches using `prefers-color-scheme`, mode can also be forced via `<html class="is-light">` / `<html class="is-dark">` or, with no JavaScript at all, by a checked `.theme-light` / `.theme-dark` control (see [Theme switching](#theme-switching-without-javascript)) |
|
|
51
|
+
| `prefer` | Includes both light & dark mode, automatically switches using `prefers-color-scheme`, mode cannot be forced (saves ~6 KB uncompressed) |
|
|
52
|
+
| `light` / `dark` | Includes light or dark mode only (saves ~10 KB uncompressed) |
|
|
53
|
+
|
|
54
|
+
### Component Sets
|
|
55
|
+
|
|
56
|
+
| Set | Includes | Gzipped Size |
|
|
57
|
+
|------|-----------|-|
|
|
58
|
+
| Full | All components: layout, 24-column grid, typography, elements (box, notification, tag, table, dropdown, navbar, modal, accordion, progress, placeholder, image, icon, …), and forms (input, textarea, select, button, checkbox, radio, toggle, range, file upload, segmented control, …), 9 semantic colors | ~23 KB |
|
|
59
|
+
| Base | Minimal subset: layout, 12-column grid, spacing, box, notification, 4 semantic colors (`link`, `success`, `warning`, `danger`). Suitable for email, widgets, or server-rendered pages that only need basic structure.| ~4 KB |
|
|
60
|
+
|
|
61
|
+
## Components & Utilities
|
|
62
|
+
|
|
63
|
+
**Layout** – `.container`, `.container.is-fluid`, `.container.is-max-[sm|md|lg|xl]`, 24-column flex grid (`.row` / `.col`, `.is-{1–24}`, `.has-offset-{1–24}`, responsive suffixes `-sm/-md/-lg/-xl`), spacing helpers (`mt-*`, `mb-*`, `mx-*`, `py-*`, `ms-*`, `pe-*`, …), flexbox utilities and shorthands (`.row-spaced`, `.cols-leading`, …), border, radius, overflow, position and visibility helpers.
|
|
64
|
+
|
|
65
|
+
**Elements** – `.box`, `.notification`, `.tag`, `.progress`, `.button`, `.dropdown`, `.navbar`, `.icon` / `.icon.is-glyph`, `.image`, `.placeholder`, `.modal` (native `<dialog>`), `.accordion` (native `<details>`).
|
|
66
|
+
|
|
67
|
+
**Forms** – `.input`, `.textarea`, `.select`, `.checkbox`, `.radio`, `.toggle`, `.range`, `.file`, `.segmented`, plus `.field` / `.control` layout.
|
|
68
|
+
|
|
69
|
+
**Typography** – `.title`, `.subtitle`, headings (`.is-level-1` through `.is-level-6`), rich-text wrapper (`.content`), color helpers, interaction utilities.
|
|
70
|
+
|
|
71
|
+
**Renamed in 0.0.4:** the icon-in-text modifier is `.icon.is-glyph`. It used to be `.icon.is-inline`, which collided with the `.is-inline` display utility and lost its own `display: inline-flex` to it – so the glyph sat low wherever the parent was a flex container. There is no alias; update the markup.
|
|
72
|
+
|
|
73
|
+
Most components support semantic color modifiers (`.is-primary`, `.is-success`, `.is-danger`, …) and size modifiers (`.is-small`, `.is-medium`, `.is-large`) where applicable – `.checkbox` and `.radio` deliberately have neither, so they keep the native control rendering. Buttons additionally support `.is-outlined`, `.is-ghost`, `.is-pill`, `.is-static`, `.is-fullwidth`, `.is-loading`, `.is-hoverless`, `.is-icon-only` and `.has-icon-trailing`; `.is-light` and `.is-dark` produce tinted variants and require a semantic color alongside them.
|
|
74
|
+
|
|
75
|
+
## Framework Integration
|
|
76
|
+
|
|
77
|
+
Import the pre-built CSS in your framework's entry point. All examples below use the full auto-mode bundle; swap the filename for any variant listed above.
|
|
78
|
+
|
|
79
|
+
### React / Vite
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
// src/main.jsx (or main.tsx)
|
|
83
|
+
import 'nuvio/dist/nuvio.css'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Vue 3 / Vite
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
// src/main.js (or main.ts)
|
|
90
|
+
import 'nuvio/dist/nuvio.css'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Next.js
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
// app/layout.tsx (App Router)
|
|
97
|
+
import 'nuvio/dist/nuvio.css'
|
|
98
|
+
|
|
99
|
+
// – or – pages/_app.tsx (Pages Router)
|
|
100
|
+
import 'nuvio/dist/nuvio.css'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Nuxt 3
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
// nuxt.config.ts
|
|
107
|
+
export default defineNuxtConfig({
|
|
108
|
+
css: ['nuvio/dist/nuvio.css'],
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Angular
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
// angular.json → projects.<name>.architect.build.options.styles
|
|
116
|
+
"styles": [
|
|
117
|
+
"node_modules/nuvio/dist/nuvio.css"
|
|
118
|
+
]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### SvelteKit
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
// src/routes/+layout.svelte
|
|
125
|
+
<script>
|
|
126
|
+
import 'nuvio/dist/nuvio.css'
|
|
127
|
+
</script>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Customization
|
|
131
|
+
|
|
132
|
+
For deeper control – custom colors, different breakpoints, reduced output – import the SCSS sources directly instead of a pre-built file. This requires `sass` as a dev dependency.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npm install nuvio sass
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Create your own entry point:
|
|
139
|
+
|
|
140
|
+
```scss
|
|
141
|
+
// src/styles/nuvio.scss
|
|
142
|
+
|
|
143
|
+
@use "nuvio/src/config" with (
|
|
144
|
+
$output-mode: "auto",
|
|
145
|
+
|
|
146
|
+
// Base palette
|
|
147
|
+
$light-bg: hsl(240, 10%, 97%),
|
|
148
|
+
$light-text: hsl(240, 10%, 15%),
|
|
149
|
+
$dark-bg: hsl(240, 10%, 8%),
|
|
150
|
+
$dark-text: hsl(240, 10%, 80%),
|
|
151
|
+
|
|
152
|
+
// Brand colors – add or override individual semantic colors
|
|
153
|
+
$semantic-color-additions: (
|
|
154
|
+
"primary": (light: hsl(258, 75%, 55%), dark: hsl(258, 75%, 65%), text-light: #fff, text-dark: #fff),
|
|
155
|
+
"link": (light: hsl(258, 75%, 55%), dark: hsl(258, 75%, 65%), text-light: #fff, text-dark: #fff),
|
|
156
|
+
),
|
|
157
|
+
|
|
158
|
+
// Remove colors you don't need
|
|
159
|
+
$semantic-color-excludes: ("secondary", "bright", "dim"),
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
@use "nuvio/src/config/themes";
|
|
163
|
+
@use "nuvio/src/base";
|
|
164
|
+
@use "nuvio/src/layout/container";
|
|
165
|
+
@use "nuvio/src/layout/grid";
|
|
166
|
+
// ... add only the component layers you use
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Then import this file in place of the pre-built CSS in your framework entry point.
|
|
170
|
+
|
|
171
|
+
### Available Semantic Colors
|
|
172
|
+
|
|
173
|
+
Nine colors ship by default: `primary`, `secondary`, `link`, `info`, `success`, `warning`, `danger`, `bright`, `dim`. Each generates component modifier classes (`.is-primary`, `.is-danger`, …) and CSS custom properties (`--nv-fill-primary`, `--nv-ink-primary`, `--nv-tint-primary`, …).
|
|
174
|
+
|
|
175
|
+
Use `$semantic-color-additions` to add or override individual colors without rewriting the full map. Use `$semantic-color-excludes` to drop colors you don't need – excluded colors generate no tokens and no classes.
|
|
176
|
+
|
|
177
|
+
### Pinning Colors Exactly (No Derivations)
|
|
178
|
+
|
|
179
|
+
By default Nuvio derives most theme tokens from a small set of inputs – hover and active fills are darkened from the base fill by a fixed lightness offset, surface levels are stepped down (or up) from `bg`, tints are mixed with the base text/background, and so on. The defaults are tuned to keep custom palettes feeling cohesive, but every derived value can be pinned to an exact color in light and dark mode.
|
|
180
|
+
|
|
181
|
+
Two mechanisms cooperate:
|
|
182
|
+
|
|
183
|
+
1. **Theme surfaces** (`bg`, `surface-1..4`, `surface-N-hover`, `border`, `text`, `text-muted`, `text-highlight`, `control-*`) are exposed as `!default` SCSS variables. Override any of them at the entry point and the framework emits your value verbatim – no further adjustment.
|
|
184
|
+
|
|
185
|
+
2. **Semantic-color derivatives** (`hover`, `active`, `ink`, `tint-light`, `tint-light-text`, `tint-dark`, `tint-dark-text`) accept optional override sub-maps inside each `$semantic-colors` entry. Each sub-map takes the same `(light: ..., dark: ...)` shape as the required four keys. When present, the value is emitted as-is; when absent, the framework derives it.
|
|
186
|
+
|
|
187
|
+
Partial pinning is supported – supply only the keys you want to control, the rest stay derived.
|
|
188
|
+
|
|
189
|
+
```scss
|
|
190
|
+
// src/styles/nuvio.scss
|
|
191
|
+
|
|
192
|
+
@use "nuvio/src/config" with (
|
|
193
|
+
$output-mode: "auto",
|
|
194
|
+
|
|
195
|
+
// Base palette – verbatim
|
|
196
|
+
$light-bg: #f7f9fc,
|
|
197
|
+
$light-text: #1b2330,
|
|
198
|
+
$light-border: #d6dee8,
|
|
199
|
+
$light-text-muted: #5a6478,
|
|
200
|
+
|
|
201
|
+
// Surface levels – verbatim, no auto-stepping
|
|
202
|
+
$light-surface-1: #eef2f7,
|
|
203
|
+
$light-surface-2: #e2e8f0,
|
|
204
|
+
$light-surface-3: #d6dee8,
|
|
205
|
+
$light-surface-4: #c8d2df,
|
|
206
|
+
|
|
207
|
+
$dark-bg: #0a0e16,
|
|
208
|
+
$dark-text: #cbd2dd,
|
|
209
|
+
$dark-border: #2a3142,
|
|
210
|
+
$dark-text-muted: #7a8295,
|
|
211
|
+
$dark-surface-1: #11161f,
|
|
212
|
+
$dark-surface-2: #19202c,
|
|
213
|
+
$dark-surface-3: #232b3a,
|
|
214
|
+
$dark-surface-4: #2d3648,
|
|
215
|
+
|
|
216
|
+
// Semantic colors – every derived value pinned
|
|
217
|
+
$semantic-color-additions: (
|
|
218
|
+
"brand": (
|
|
219
|
+
light: #2752ff, dark: #4a78ff,
|
|
220
|
+
text-light: #ffffff, text-dark: #ffffff,
|
|
221
|
+
|
|
222
|
+
hover: (light: #2143cc, dark: #6090ff),
|
|
223
|
+
active: (light: #1932a0, dark: #80a8ff),
|
|
224
|
+
ink: (light: #1932a0, dark: #b8cfff),
|
|
225
|
+
tint-light: (light: #eef2ff, dark: #1c2438),
|
|
226
|
+
tint-light-text: (light: #1932a0, dark: #b8cfff),
|
|
227
|
+
tint-dark: (light: #0a1846, dark: #0a1846),
|
|
228
|
+
tint-dark-text: (light: #eef2ff, dark: #c8d6ff),
|
|
229
|
+
),
|
|
230
|
+
),
|
|
231
|
+
);
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Reference of what derives what, and which knob pins it exactly:
|
|
235
|
+
|
|
236
|
+
| `--nv-*` token | Default derivation | Pin exactly via |
|
|
237
|
+
|----------------|--------------------|-----------------|
|
|
238
|
+
| `bg` | base input | `$light-bg` / `$dark-bg` |
|
|
239
|
+
| `surface-1..4` | `$bg` ± `$surface-step-*` × N | `$light-surface-1..4` / `$dark-surface-1..4` |
|
|
240
|
+
| `surface-1..4-hover` | `$bg` ± (step × N + `$surface-hover-step`) | `$light-surface-N-hover` / `$dark-surface-N-hover` |
|
|
241
|
+
| `border` | `$bg` adjusted by `$border-*-lightness-offset` + saturation | `$light-border` / `$dark-border` |
|
|
242
|
+
| `text` | base input | `$light-text` / `$dark-text` |
|
|
243
|
+
| `text-muted` | `$text` adjusted by `$text-muted-*-offset` | `$light-text-muted` / `$dark-text-muted` |
|
|
244
|
+
| `text-highlight` | `$text` adjusted by `$text-highlight-*-offset` | `$light-text-highlight` / `$dark-text-highlight` |
|
|
245
|
+
| `control-bg/-border/-text/-hover` | derived from `$bg` / `$border` | `$light-control-*` / `$dark-control-*` |
|
|
246
|
+
| `focus-ring` | semantic `link` color | `$focus-ring-color-light` / `$focus-ring-color-dark` |
|
|
247
|
+
| `fill-{N}` | semantic-color entry | `light:` / `dark:` (required keys) |
|
|
248
|
+
| `fill-text-{N}` | semantic-color entry | `text-light:` / `text-dark:` (required keys) |
|
|
249
|
+
| `fill-{N}-hover` | `fill` darkened by `$hover-lightness-offset` | `hover: (light: …, dark: …)` |
|
|
250
|
+
| `fill-{N}-active` | `fill` darkened by `$active-lightness-offset` | `active: (light: …, dark: …)` |
|
|
251
|
+
| `ink-{N}` | `fill` with lightness clamped to readable range | `ink: (light: …, dark: …)` |
|
|
252
|
+
| `tint-light-{N}` | mix of `fill` with `surface-1` / `light-bg` | `tint-light: (light: …, dark: …)` |
|
|
253
|
+
| `tint-light-text-{N}` | mix of `ink` with `text` | `tint-light-text: (light: …, dark: …)` |
|
|
254
|
+
| `tint-dark-{N}` | mix of `fill` with `#000` / `dark-bg` | `tint-dark: (light: …, dark: …)` |
|
|
255
|
+
| `tint-dark-text-{N}` | `light-bg` (light block) / `tint-light-text` (dark block) | `tint-dark-text: (light: …, dark: …)` |
|
|
256
|
+
|
|
257
|
+
### Navbar Colors
|
|
258
|
+
|
|
259
|
+
The navbar reads three CSS custom properties that you can override per-scope to brand it:
|
|
260
|
+
|
|
261
|
+
```css
|
|
262
|
+
:root {
|
|
263
|
+
--nv-navbar-bg: hsl(216, 98%, 44%);
|
|
264
|
+
--nv-navbar-text: hsl(216, 98%, 95%);
|
|
265
|
+
--nv-navbar-hover: hsl(216, 98%, 36%);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@media (prefers-color-scheme: dark) {
|
|
269
|
+
:root {
|
|
270
|
+
--nv-navbar-bg: hsl(216, 40%, 14%);
|
|
271
|
+
--nv-navbar-text: hsl(216, 20%, 88%);
|
|
272
|
+
--nv-navbar-hover: hsl(216, 40%, 20%);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Tuning Icons for Your Icon Font
|
|
278
|
+
|
|
279
|
+
Different icon fonts (Lucide, Phosphor, FontAwesome, …) draw their glyphs at slightly different vertical baselines and optical weights. Nuvio exposes three small SCSS variables and a set of per-icon utility classes so you can adapt the framework to whichever icon set you ship – without rewriting any component styles.
|
|
280
|
+
|
|
281
|
+
| Variable | Default | Effect |
|
|
282
|
+
|----------|---------|--------|
|
|
283
|
+
| `$button-icon-y-compensation` | `.5px` | Vertical `translateY` applied to `.button .icon`. Implemented as `transform`, so it never affects button height. |
|
|
284
|
+
| `$text-icon-y-compensation` | `0` | Vertical `translateY` applied to `.icon.is-glyph` – icons sitting in flowing text or headings. Separate from the button knob because the optical center for inline text icons differs from buttons. |
|
|
285
|
+
| `$button-icon-x-compensation` | `0` | Added to the negative horizontal margins that pull an `.icon` toward its `.button` edge (leading, trailing, `.is-icon-only` and `.is-pill` variants alike). Knob for icon fonts whose glyphs carry more or less intrinsic side-bearing. Implemented as `margin`, so it does not change `.button` padding. |
|
|
286
|
+
|
|
287
|
+
Override at the entry point:
|
|
288
|
+
|
|
289
|
+
```scss
|
|
290
|
+
@use "nuvio/src/config" with (
|
|
291
|
+
$button-icon-y-compensation: 0,
|
|
292
|
+
$text-icon-y-compensation: -.5px,
|
|
293
|
+
$button-icon-x-compensation: 1px,
|
|
294
|
+
);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
For the rare case where a single glyph sits off-baseline, add a `.yc-up{1,2,3}` or `.yc-down{1,2,3}` class to that specific `.icon` – ±0.5px, ±1px, or ±1.5px respectively. Layers on top of the relevant compensation variable.
|
|
298
|
+
|
|
299
|
+
```html
|
|
300
|
+
<span class="icon yc-up1"><i class="my-icon-quirky"></i></span>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Tuning Label Alignment for Your Body Font
|
|
304
|
+
|
|
305
|
+
The same problem exists for text. A font reserves more room below the baseline than its glyphs actually use, so a label centered by metrics inside a fixed-height control renders slightly *low* – noticeably so once you compare it against a button edge or a full-height logo in a navbar.
|
|
306
|
+
|
|
307
|
+
`$control-label-y-compensation` shifts the label of `.button`, `.tag`, `.navbar-item` / `.navbar-link` and `.segmented > label` back onto its optical center. It is applied as asymmetric `padding-block`, so control heights are unchanged, and it is expressed in `em`, so it follows the size modifiers.
|
|
308
|
+
|
|
309
|
+
```scss
|
|
310
|
+
@use "nuvio/src/config" with (
|
|
311
|
+
$control-label-y-compensation: 0, // pure metric centering
|
|
312
|
+
);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Cascade Layers (Opt-In)
|
|
316
|
+
|
|
317
|
+
Set `$css-layers: true` to wrap all output in cascade layers, declared in this order:
|
|
318
|
+
|
|
319
|
+
```scss
|
|
320
|
+
@use "nuvio/src/config" with ($css-layers: true);
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
```css
|
|
324
|
+
@layer nuvio.tokens, nuvio.reset, nuvio.components, nuvio.utilities;
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Your own unlayered CSS then beats every Nuvio rule regardless of selector specificity – no `!important`, no `.foo.foo.foo` escalation. This is source-only: the pre-built `dist/` files are compiled with the flag off, so nothing changes for consumers who use them.
|
|
328
|
+
|
|
329
|
+
One caveat worth knowing before you flip it. Inside a layer, `!important` precedence is *reversed* – layered `!important` declarations outrank unlayered ones. Nuvio's utility helpers (`mt-*`, `is-hidden`, `has-text-*`, …) are all `!important`, so with layers enabled your unlayered `!important` no longer overrides them. Override from a layer of your own declared after Nuvio's instead:
|
|
330
|
+
|
|
331
|
+
```css
|
|
332
|
+
@layer nuvio.tokens, nuvio.reset, nuvio.components, nuvio.utilities, app;
|
|
333
|
+
|
|
334
|
+
@layer app {
|
|
335
|
+
.my-thing { margin-top: 0 !important; }
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Palette Generator
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npm run palette # random harmonious palette – outputs ready-to-paste SCSS
|
|
343
|
+
npm run palette -- --seed=42 # reproducible result
|
|
344
|
+
npm run palette -- --harmony=triadic # triadic | split-comp | analogous | complementary
|
|
345
|
+
npm run palette -- --write # also write to generated-palette.scss
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
|
|
350
|
+
MIT
|