@venix-sistemas/jade 1.1.0 โ†’ 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.
Files changed (55) hide show
  1. package/README.md +339 -222
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +25 -11
  4. package/dist/runtime/components/VenixThemeSwitcher.d.vue.ts +1 -1
  5. package/dist/runtime/components/VenixThemeSwitcher.vue +242 -99
  6. package/dist/runtime/components/VenixThemeSwitcher.vue.d.ts +1 -1
  7. package/dist/runtime/composables/useThemeColors.d.ts +6 -0
  8. package/dist/runtime/composables/useThemeColors.js +24 -9
  9. package/dist/runtime/composables/useThemeCookies.d.ts +9 -2
  10. package/dist/runtime/composables/useThemeCookies.js +24 -6
  11. package/dist/runtime/composables/useThemeLocale.d.ts +5 -0
  12. package/dist/runtime/composables/useThemeLocale.js +2 -2
  13. package/dist/runtime/composables/useThemeSeasonal.d.ts +2 -2
  14. package/dist/runtime/composables/useThemeSeasonal.js +1 -1
  15. package/dist/runtime/composables/useVenixTheme.d.ts +20 -0
  16. package/dist/runtime/composables/useVenixTheme.js +168 -108
  17. package/dist/runtime/nitro/theme-init.js +8 -5
  18. package/dist/runtime/plugins/theme-init.server.js +7 -12
  19. package/dist/runtime/plugins/vuetify-theme.js +8 -11
  20. package/dist/runtime/scripts/theme-init.d.ts +23 -10
  21. package/dist/runtime/scripts/theme-init.js +42 -88
  22. package/dist/shared/constants.d.ts +18 -3
  23. package/dist/shared/constants.js +6 -1
  24. package/dist/shared/css/cursor.js +9 -2
  25. package/dist/shared/css/index.d.ts +1 -7
  26. package/dist/shared/css/index.js +5 -5
  27. package/dist/shared/css/transition.d.ts +1 -1
  28. package/dist/shared/theme.json +302 -192
  29. package/dist/shared/types/color-options.d.ts +26 -2
  30. package/dist/shared/types/colors.d.ts +64 -12
  31. package/dist/shared/types/index.d.ts +1 -1
  32. package/dist/shared/types/runtime-config.d.ts +4 -2
  33. package/dist/shared/utils/icon-refs.d.ts +7 -3
  34. package/dist/shared/utils/icon.d.ts +4 -2
  35. package/dist/shared/utils/icon.js +6 -2
  36. package/dist/shared/utils/index.d.ts +5 -4
  37. package/dist/shared/utils/index.js +12 -6
  38. package/dist/shared/utils/inline-script.d.ts +6 -0
  39. package/dist/shared/utils/inline-script.js +3 -0
  40. package/dist/shared/utils/load.d.ts +0 -1
  41. package/dist/shared/utils/load.js +5 -12
  42. package/dist/shared/utils/merge-themes.d.ts +39 -9
  43. package/dist/shared/utils/merge-themes.js +101 -5
  44. package/dist/shared/utils/normalize.d.ts +0 -11
  45. package/dist/shared/utils/normalize.js +0 -12
  46. package/dist/shared/utils/theme-config.d.ts +13 -4
  47. package/dist/shared/utils/theme-config.js +28 -15
  48. package/dist/shared/utils/theme-resolve.d.ts +15 -23
  49. package/dist/shared/utils/theme-resolve.js +18 -67
  50. package/dist/shared/utils/theme-resolver.d.ts +46 -0
  51. package/dist/shared/utils/theme-resolver.js +139 -0
  52. package/package.json +13 -10
  53. package/README-default.md +0 -84
  54. package/dist/runtime/plugin.d.ts +0 -2
  55. package/dist/runtime/plugin.js +0 -3
package/README.md CHANGED
@@ -1,35 +1,43 @@
1
- <p align="center">
2
- <img src="./docs/images/jade-transparent.png" alt="Jade logo" width="200">
3
- </p>
4
-
5
- <h1 align="center">Jade</h1>
6
-
7
- <p align="center">
8
- <code>@venix-sistemas/jade</code>
9
- </p>
10
-
11
- <p align="center">
12
- <a href="https://www.npmjs.com/package/@venix-sistemas/jade"><img src="https://badge.fury.io/js/@venix-sistemas%2Fjade.svg" alt="npm version"></a>
13
- <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
14
- </p>
15
-
16
- A complete centralized theming system for Nuxt applications: colors, typography, cursor, scrollbar, internationalization and seasonal themes, with UnoCSS, Vuetify and Iconify integrations.
17
-
18
- ## Features
19
-
20
- * ๐Ÿ“ **Typography and font faces customization**
21
- * ๐Ÿ–ฑ๏ธ **Cursor customization**
22
- * ๐Ÿ“œ **Scrollbar customization**
23
- * ๐ŸŽจ **Color customization**, with dark and light themes included
24
- * ๐Ÿ–ฅ๏ธ **System theme preference detection**, including seasonal overrides
25
- * ๐ŸŽƒ **Seasonal themes**: Carnival, Halloween, Christmas and more
26
- * ๐Ÿ’พ **Cookie-consent-aware persistence**: nothing is written until the user opts in
27
- * ๐ŸŒ **i18n**: internationalization and locale detection for theme names and your own strings
28
- * โšก **Nuxt-native integration**
29
- * ๐ŸŽฏ **UnoCSS preset** for the theme's color variables
30
- * ๐ŸŽญ **Vuetify 4** theme auto-configuration, kept in sync with live theme changes
31
- * โœจ **Unified icons**: emoji, Iconify (animated `line-md`, `mdi`, both bundled and tree-shaken offline) or inline SVG through one component
32
-
1
+ <p align="center">
2
+ <img src="./docs/images/jade-transparent.png" alt="Jade logo" width="200">
3
+ </p>
4
+
5
+ <h1 align="center">Jade</h1>
6
+
7
+ <p align="center">
8
+ <code>@venix-sistemas/jade</code>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@venix-sistemas/jade"><img src="https://badge.fury.io/js/@venix-sistemas%2Fjade.svg" alt="npm version"></a>
13
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ The UI foundation for Nuxt applications, in a single module: color themes (including seasonal ones),<br>
18
+ typography, scrollbar, cursor, icons and interface translations, with UnoCSS and Vuetify integrations.
19
+ </p>
20
+
21
+ <p align="center">
22
+ <img src="./docs/images/readme/theme-switcher.webp" alt="VenixThemeSwitcher going through the dark themes (Carnival, Easter, Christmas, Halloween, Ocean), then light mode and back" width="800">
23
+ </p>
24
+
25
+ ## Features
26
+
27
+ * ๐Ÿ“ **Typography and font faces customization**
28
+ * ๐Ÿ–ฑ๏ธ **Cursor customization**
29
+ * ๐Ÿ“œ **Scrollbar customization**
30
+ * ๐ŸŽจ **Color customization**, with dark and light themes included
31
+ * ๐ŸŒ— **Theme and mode picked separately**: any theme (Venix Sistemas, Carnival, Christmasโ€ฆ) in light or dark, each following the system or fixed
32
+ * ๐Ÿ–ฅ๏ธ **System preference detection**, including seasonal themes by date
33
+ * ๐ŸŽƒ **Seasonal themes**: Carnival, Halloween, Christmas and more
34
+ * ๐Ÿ’พ **Cookie-consent-aware persistence**: nothing is written until the user opts in
35
+ * ๐ŸŒ **i18n**: internationalization and locale detection for theme names and your own strings
36
+ * โšก **Nuxt-native integration**
37
+ * ๐ŸŽฏ **UnoCSS preset** for the theme's color variables
38
+ * ๐ŸŽญ **Vuetify 4** theme auto-configuration, kept in sync with live theme changes
39
+ * โœจ **Unified icons**: emoji, Iconify (animated `line-md`, `mdi`, both bundled and tree-shaken offline) or inline SVG through one component
40
+
33
41
  ## Installation
34
42
 
35
43
  ```bash
@@ -59,189 +67,317 @@ export default defineNuxtConfig({
59
67
  })
60
68
  ```
61
69
 
62
- Every feature except Vuetify is on by default with built-in values, so you only configure what you want to change โ€” the example above just swaps the dark theme's primary color. See [Configuration](#configuration) for every option.
70
+ Every module except Vuetify is on by default with built-in values, so you only configure what you want to change โ€” the example above just swaps the dark theme's primary color. See [Modules](#modules) for what each one does.
63
71
 
64
72
  ### 2. Use the theme
65
73
 
66
74
  The auto-imported `useVenixTheme()` composable gives access to the theme. It isn't called `useTheme` to avoid colliding with UI libraries (like Vuetify) that auto-import a composable with that name.
67
75
 
76
+ The **theme** (Venix Sistemas, Carnival, Christmasโ€ฆ) and the **mode** (light or dark) are chosen independently; the applied colors are the theme's variant for that mode. Either can be `'system'`: an automatic theme follows the calendar ([seasonal themes](#seasonal-themes)), an automatic mode follows the OS.
77
+
68
78
  ```vue
69
79
  <template>
70
- <button @click="theme.toggle('dark')">Dark</button>
71
- <button @click="theme.toggle('light')">Light</button>
80
+ <button @click="mode.set('dark')">Dark</button>
81
+ <button @click="mode.set('light')">Light</button>
82
+ <button @click="theme.set('natal')">Christmas</button>
72
83
  </template>
73
84
 
74
85
  <script setup lang="ts">
75
- const { theme } = useVenixTheme()
86
+ const { theme, mode } = useVenixTheme()
76
87
  </script>
77
88
  ```
78
89
 
79
- It returns four groups:
90
+ It returns:
80
91
 
81
- - `theme` โ€” state and controls:
82
- - `value`: the applied theme (e.g. `'dark'` when the preference is `'system'`)
83
- - `preference`: the user's raw choice, including `'system'`
84
- - `data`: the active theme's `{ value, name, icon }`
85
- - `toggle(name?)`: switches to `name`, or between `light` and `dark` when called without one
92
+ - `theme` โ€” the theme choice:
93
+ - `preference`: the chosen theme (`'system'`, `'venix'`, `'carnaval'`โ€ฆ)
94
+ - `value`: the variant actually applied, as in `data-theme` (e.g. `'natal-light'`, or `'dark'` for Venix Sistemas in dark mode)
95
+ - `data`: the chosen theme's `{ value, name, icon }`
96
+ - `set(name)`: picks a theme, keeping the mode
97
+ - `toggle(name?)`: kept for compatibility โ€” without a name switches the mode; `'dark'`/`'light'` select Venix Sistemas in that mode; `'system'` makes both theme and mode automatic
86
98
  - `isSeasonalActive`, `activeSeasonalTheme`: whether a [seasonal theme](#seasonal-themes) is currently in effect, and which one
87
- - `shouldApplyColors`, `colors`: whether the module applies colors, and the raw color config
88
- - `themes` โ€” every selectable theme, ready to render a picker (see [Theme icons](#theme-icons)).
89
- - `locale` โ€” `current`, `set()` and `translate()` (see [Internationalization](#internationalization)).
90
- - `persistence` โ€” cookie consent controls (see [Cookie Consent](#cookie-consent)).
99
+ - `shouldApplyColors`, `colors`: whether the module applies colors, and the resolved color config
100
+ - `themes` โ€” every selectable theme as `{ value, name, icon, custom }`, ready to render a picker (see [Theme icons](#theme-icons)); `custom` is `true` for themes your project added in `color.themes`.
101
+ - `mode` โ€” the mode choice: `preference` (`'system'`, `'light'`, `'dark'`), `value` (the mode applied, `'light'` or `'dark'`), `data`, `set(mode)` and `toggle()`.
102
+ - `modes` โ€” the three mode options with names and icons, ready to render.
103
+ - `locale` โ€” `current`, `set()` and `translate()` (see [Translation](#translation)).
104
+ - `persistence` โ€” cookie consent controls (see [Saving the theme](#saving-the-theme-cookie-consent)).
91
105
 
92
106
  The state is shared app-wide (via Nuxt's `useState`): every component calling `useVenixTheme()` reads and writes the same theme, so they never go out of sync.
93
107
 
94
108
  ### 3. Ready-made component
95
109
 
96
- `<VenixThemeSwitcher>` is an auto-imported dropdown for picking a theme, with no dependency on Vuetify or any other UI kit:
110
+ `<VenixThemeSwitcher>` is an auto-imported dropdown with a **Mode** section (Automatic, Dark, Light) and a **Theme** section (Automatic, Venix Sistemas and the seasonal themes), followed, below a divider, by the themes your project adds itself. It has no dependency on Vuetify or any other UI kit:
111
+
112
+ <p align="center">
113
+ <picture>
114
+ <source media="(prefers-color-scheme: light)" srcset="./docs/images/readme/switcher-light.png">
115
+ <img src="./docs/images/readme/switcher-dark.png" alt="VenixThemeSwitcher open next to the page: Mode, Theme and Custom theme sections" width="800">
116
+ </picture>
117
+ </p>
97
118
 
98
119
  ```vue
99
120
  <template>
100
- <VenixThemeSwitcher label="Color theme" />
121
+ <VenixThemeSwitcher label="Website color" />
101
122
  </template>
102
123
  ```
103
124
 
104
125
  | Prop | Type | Default | Description |
105
126
  | ----------- | --------- | ----------------------- | --------------------------------------------------- |
106
127
  | `label` | `string` | translated, per locale | Accessible label for the button and the menu |
107
- | `showLabel` | `boolean` | `false` | Show the active theme's name next to the icon |
128
+ | `showLabel` | `boolean` | `false` | Show the theme and mode names next to the icon |
108
129
 
109
130
  - **Accessible:** arrow keys, Home/End and Esc navigate the menu, focus returns to the button on close, and each change is announced to screen readers.
110
131
  - **Always legible:** the menu uses fixed neutral colors (dark surface, light text) instead of the active theme's, so every option stays readable whatever theme is applied. The button itself follows the active theme.
111
- - **Lively:** animated icons (e.g. `line-md`) replay on every switch, and the button fades in on mount.
112
-
113
- It ships with minimal CSS of its own. To restyle it, target `.venix-theme-switcher`, `.venix-theme-switcher__trigger`, `.venix-theme-switcher__menu` and `.venix-theme-switcher__item` (see [`VenixThemeSwitcher.vue`](./src/runtime/components/VenixThemeSwitcher.vue)).
114
-
115
- ### Theme transition
116
-
117
- Every theme switch โ€” manual, through the switcher, or an automatic system/seasonal change โ€” cross-fades using the browser's native [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API), with no setup. Browsers without support switch instantly, and the animation is skipped for users with `prefers-reduced-motion: reduce`.
132
+ - **Lively:** animated icons (e.g. `line-md`) replay on every switch, and the button fades in on mount. The button shows the mode's icon on the base theme, and the theme's own icon when a seasonal or other theme is in effect.
133
+ - **Quick:** picking a mode keeps the menu open, so mode and theme can be set in one go; picking a theme closes it.
118
134
 
119
- ## Configuration
135
+ It ships with minimal CSS of its own. To restyle it, target `.venix-theme-switcher`, `.venix-theme-switcher__trigger`, `.venix-theme-switcher__menu`, `.venix-theme-switcher__subheading` and `.venix-theme-switcher__item` (`--mode` for the mode buttons) (see [`VenixThemeSwitcher.vue`](./src/runtime/components/VenixThemeSwitcher.vue)).
120
136
 
121
- ### Module Options
122
-
123
- Each option accepts `false` (disable), `true` (enable with defaults) or an object (enable and customize):
124
-
125
- | Option | Default | Description |
126
- | ------------- | ------- | --------------------------------------------------------------------------- |
127
- | `translation` | `true` | Locale detection for theme names โ€” see [`translation`](#translation-object) |
128
- | `color` | `true` | Color themes โ€” see [`color`](#color-object) and [Themes](#themes) |
129
- | `scrollbar` | `true` | Custom scrollbar โ€” see [`scrollbar`, `cursor`, `typography`](#scrollbar-cursor-and-typography) |
130
- | `cursor` | `true` | Custom cursor images |
131
- | `typography` | `true` | Base font family, font size and `@font-face` rules |
132
- | `icon` | `true` | Installs `@nuxt/icon` and registers `<VenixIcon>` โ€” see [Icons](#icons) |
133
- | `vuetify` | `false` | Vuetify theme auto-configuration โ€” see [Vuetify](#vuetify-integration) |
134
-
135
- #### `translation` object
136
-
137
- | Property | Type | Default | Description |
138
- | ---------------- | --------- | ------------------- | -------------------------------------------------------- |
139
- | `locale` | `string` | โ€” | Force a locale, skipping detection |
140
- | `defaultLocale` | `string` | `'en-US'` | Fallback when no locale can be detected |
141
- | `cookieSync` | `string` | `'i18n_redirected'` | Cookie the locale is read from (and written by `locale.set()`) |
142
- | `manageHtmlLang` | `boolean` | `false` | Keep `<html lang>` in sync โ€” see [Internationalization](#internationalization) |
137
+ ## Modules
143
138
 
144
- With `translation: false`, detection is off: theme names and the switcher's strings always use `defaultLocale`, and `locale.set()` never writes the cookie.
139
+ Jade is a set of independent modules, each configured under its own key in `venixTheme`. Every key accepts `false` (disable), `true` (enable with defaults) or an object (enable and customize):
145
140
 
146
- #### `color` object
141
+ | Module | Key | Default | What it does |
142
+ | --------------------------- | ------------- | ------- | --------------------------------------------------------------------- |
143
+ | [Colors](#colors) | `color` | `true` | Color themes (built-in, seasonal, custom) in light and dark mode, saved per user, as CSS variables and a UnoCSS preset |
144
+ | [Translation](#translation) | `translation` | `true` | Detects the user's locale and translates theme names and your own strings |
145
+ | [Icons](#icons) | `icon` | `true` | `<VenixIcon>`: emoji, Iconify (bundled offline) or inline SVG through one component |
146
+ | [Typography](#typography) | `typography` | `true` | Base font family, font size and `@font-face` rules |
147
+ | [Scrollbar](#scrollbar) | `scrollbar` | `true` | A custom scrollbar that follows the active theme |
148
+ | [Cursor](#cursor) | `cursor` | `true` | Custom cursor images |
149
+ | [Vuetify](#vuetify) | `vuetify` | `false` | Registers the color themes with Vuetify and keeps it in sync |
147
150
 
148
- | Property | Type | Default | Description |
149
- | -------------- | --------------------------- | -------- | ------------------------------------------------------------- |
150
- | `apply` | `boolean` | `true` | Apply the resolved theme to `<html>` (`data-theme` and class) |
151
- | `defaultColor` | `string` | `'dark'` | Theme used when there's no preference yet |
152
- | `themes` | `object` | `{}` | Override or add themes โ€” see [Themes](#themes) |
153
- | `iconFormat` | `'emote' \| 'css' \| 'svg'` | `'svg'` | Preferred theme icon variant โ€” see [Theme icons](#theme-icons) |
151
+ ## Colors
154
152
 
155
- #### `scrollbar`, `cursor` and `typography`
153
+ Every theme has a light and a dark palette, exposed as CSS variables (`--color-primary`, `--color-background2`โ€ฆ):
156
154
 
157
- ```typescript
158
- venixTheme: {
159
- scrollbar: {
160
- width: 'auto',
161
- borderRadius: '8px',
162
- borderWidth: '3px',
163
- // A theme color name (follows the active theme) or any CSS color
164
- colors: { thumb: 'primary', thumbHover: 'secondary', track: 'background2', border: 'background3' },
165
- },
166
- cursor: {
167
- // Images served from `public/`; `hotspot` is the click point ("x y")
168
- cursors: {
169
- default: { path: '/cursors/default.png', hotspot: '0 0' },
170
- pointer: { path: '/cursors/pointer.png', hotspot: '0 0' },
171
- text: { path: '/cursors/text.png', hotspot: '0 0' },
172
- },
173
- },
174
- typography: {
175
- defaultFonts: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
176
- fontSize: '16px',
177
- customFonts: [
178
- { name: 'MyFont', sources: { woff2: '/fonts/MyFont.woff2' }, weight: 'normal', style: 'normal' },
179
- ],
180
- },
181
- }
182
- ```
155
+ <p align="center">
156
+ <img src="./docs/images/readme/palettes.png" alt="Color palettes: Venix Sistemas dark and light, Halloween dark, Christmas light" width="800">
157
+ </p>
183
158
 
184
- The values shown for `scrollbar` and `typography.defaultFonts`/`fontSize` are the defaults. Custom fonts come first in `--font-family-base` (also applied to Vuetify's `--v-font-body`/`--v-font-heading`), with `defaultFonts` as the fallback.
159
+ | Option | Type | Default | Description |
160
+ | ---------------- | --------------------------- | -------- | ------------------------------------------------------------- |
161
+ | `apply` | `boolean` | `true` | Apply the resolved theme to `<html>` (`data-theme` and class) |
162
+ | `defaultColor` | `string` | `'dark'` | Initial choice with no saved preference: a theme (mode follows the OS), a variant id like `'dark'` (that theme in that mode) or `'system'` |
163
+ | `themes` | `object` | `{}` | Override or add themes โ€” see [Themes](#themes) |
164
+ | `iconFormat` | `'emote' \| 'css' \| 'svg'` | `'svg'` | Preferred theme icon variant โ€” see [Theme icons](#theme-icons) |
165
+ | `requireConsent` | `boolean` | `true` | Only save the chosen theme after cookie consent โ€” see [Saving the theme](#saving-the-theme-cookie-consent) |
166
+ | `seasonal` | `boolean` | `true` | Seasonal themes โ€” `false` removes them entirely, see [Seasonal themes](#seasonal-themes) |
185
167
 
186
- ## Themes
168
+ ### Themes
187
169
 
188
- The module ships with `dark`, `light` and the [seasonal themes](#seasonal-themes). `color.themes` extends that set:
170
+ Each theme has a `light` and a `dark` variant, plus a name (`translations`) and an `icon` shared by both. The module ships with **Venix Sistemas** (`venix`) and the [seasonal themes](#seasonal-themes), all in both modes. `color.themes` extends that set:
189
171
 
190
- - An **existing** name overrides only the properties you set; the rest of the theme (other colors, translations, icon) stays as shipped.
191
- - A **new** name adds a theme that works like a built-in one: its own CSS variables, an entry in `useVenixTheme().themes` (so it appears in `<VenixThemeSwitcher>`), and UnoCSS/Vuetify support when enabled. New themes are dark unless you set `dark: false`.
172
+ - An **existing** name overrides only the properties you set; the rest of the theme (the other variant, other colors, translations, icon) stays as shipped.
173
+ - A **new** name adds a theme that works like a built-in one: its own CSS variables, an entry in `useVenixTheme().themes` (so it appears in `<VenixThemeSwitcher>`), and UnoCSS/Vuetify support when enabled. A theme with only one variant uses it in both modes.
192
174
 
193
175
  ```typescript
194
176
  color: {
195
177
  themes: {
196
- // Overrides only `primary` of the built-in dark theme
197
- dark: {
198
- primary: '#FF6B6B',
178
+ // Overrides only `primary` of the built-in theme in dark mode
179
+ venix: {
180
+ dark: { primary: '#FF6B6B' },
199
181
  },
200
182
 
201
183
  // Adds a project-specific theme
202
184
  summerSale: {
203
- dark: false,
204
- primary: '#FF8A00',
205
- background: '#FFF8EE',
185
+ translations: { 'en-US': 'Summer sale', 'pt-BR': 'Liquidaรงรฃo de verรฃo' },
186
+ icon: '๐Ÿ–๏ธ',
187
+ light: { primary: '#FF8A00', background: '#FFF8EE' },
188
+ dark: { primary: '#FFB04C', background: '#1A1206' },
206
189
  },
207
190
  },
208
191
  }
209
192
  ```
210
193
 
211
- Available colors: `primary`, `secondary`, `accent`, `error`, `info`, `success`, `warning`, `background`, `background2`, `background3`. Each becomes a `--color-<name>` CSS variable, plus `--color-inverse` (white on dark themes, black on light ones).
194
+ Available colors: `primary`, `secondary`, `accent`, `error`, `info`, `success`, `warning`, `background`, `background2`, `background3`. Each becomes a `--color-<name>` CSS variable, plus `--color-inverse` (white on dark variants, black on light ones).
195
+
196
+ Each variant is applied as `<html data-theme="<id>">`, and the id is also its Vuetify theme name. It defaults to `<theme>-<mode>` (`summerSale-light`); set `id` on a variant to choose it. The built-in themes keep the ids they had before light/dark became separate: `dark` and `light` for Venix Sistemas, `carnaval`, `natal` and `halloween` for the dark seasonal variants (their light ones are `carnaval-light` and so on). Easter, added later, uses the default `pascoa-light` and `pascoa-dark`.
197
+
198
+ #### Flat format (deprecated)
199
+
200
+ Before themes had two variants, each one was a single flat set of colors with a `dark` flag (`summerSale: { dark: false, primary: '#FF8A00' }`), and built-in themes were overridden by variant name (`dark: { primary: '#FF6B6B' }`). Both still work: a flat theme becomes a theme with only that variant (same `data-theme` id as before), and an override by variant name lands on that variant. Each one logs a `[jade]` warning at build time pointing at the new format; the flat format will be removed in 2.0.
212
201
 
213
- ### Seasonal Themes
202
+ ### Seasonal themes
214
203
 
215
- Built in: ๐ŸŽญ Carnival, ๐ŸŽƒ Halloween and ๐ŸŽ„ Christmas. While the preference is `'system'` and today is inside a seasonal theme's `dateRange`, it replaces `dark` or `light` โ€” whichever matches its own `dark` flag and the user's system mode.
204
+ Built in: ๐ŸŽญ Carnival, ๐Ÿฐ Easter, ๐ŸŽƒ Halloween and ๐ŸŽ„ Christmas, each in light and dark. While the theme is `'system'` (Automatic) and today is inside a seasonal theme's `dateRange`, it replaces the base theme, in the variant matching the mode. Seasonal themes can also be picked directly, any day.
216
205
 
217
- Add your own with `seasonal: true` and a `dateRange`. Seasonal themes aren't directly selectable; they only appear through `'system'`. The range is inclusive and wraps across the new year when `end` comes before `start`. Each bound is a fixed `MM-DD` date or, for movable holidays, a number of days relative to Easter Sunday (`easter`, `easter-47`, `easter+1`):
206
+ Add your own with `seasonal: true` and a `dateRange`. The range is inclusive and wraps across the new year when `end` comes before `start`. Each bound is a fixed `MM-DD` date or, for movable holidays, a number of days relative to Easter Sunday (`easter`, `easter-47`, `easter+1`):
218
207
 
219
208
  ```typescript
220
209
  color: {
221
210
  themes: {
222
211
  blackFriday: {
223
- dark: true,
224
212
  seasonal: true,
225
213
  dateRange: { start: '11-24', end: '11-30' },
226
- primary: '#111111',
227
- background: '#000000',
214
+ dark: { primary: '#FFD400', background: '#000000' },
215
+ light: { primary: '#111111', background: '#FFF8D6' },
228
216
  },
229
- pascoa: {
230
- dark: false,
217
+ corpusChristi: {
231
218
  seasonal: true,
232
- dateRange: { start: 'easter-6', end: 'easter' }, // Holy Week, every year
233
- primary: '#F4A6C0',
234
- background: '#FFF8F0',
219
+ dateRange: { start: 'easter+60', end: 'easter+60' }, // a single day, every year
220
+ light: { primary: '#B8860B', background: '#FFFBEF' },
221
+ dark: { primary: '#F2C94C', background: '#17130A' },
235
222
  },
236
223
  },
237
224
  }
238
225
  ```
239
226
 
240
- The built-in Carnival theme uses `easter-65` to `easter-46`: 20 days, from the pre-Carnival weeks up to Ash Wednesday.
227
+ A seasonal theme with a single variant only takes over automatically when the mode matches it.
228
+
229
+ To turn seasonal themes off, set `color.seasonal: false`. All of them, built-in and custom, are removed: they get no CSS, aren't listed in pickers and never take over by date. "Automatic" then always means the base theme, so it's left out of the theme list too.
230
+
231
+ The built-in Carnival theme uses `easter-65` to `easter-46`: 20 days, from the pre-Carnival weeks up to Ash Wednesday. Easter uses `easter-7` to `easter+1`: from Palm Sunday to Easter Monday.
232
+
233
+ ### Theme transition
234
+
235
+ Every theme switch โ€” manual, through the switcher, or an automatic system/seasonal change โ€” cross-fades using the browser's native [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API), with no setup. Browsers without support switch instantly, and the animation is skipped for users with `prefers-reduced-motion: reduce`.
236
+
237
+ ### Saving the theme (cookie consent)
238
+
239
+ Three cookies remember the user's choice between visits, for a year:
240
+
241
+ | Cookie | Stores |
242
+ | ------------------------ | ------------------------------------------------------------------------------------------------------- |
243
+ | `venix-theme-preference` | The chosen theme (`'system'`, `'venix'`, a custom themeโ€ฆ) |
244
+ | `venix-theme-mode` | The chosen mode (`'system'`, `'light'`, `'dark'`) |
245
+ | `venix-theme-resolved` | The variant last applied (e.g. `'natal-light'`) โ€” lets SSR guess light or dark when the mode is `'system'` |
246
+
247
+ The theme itself is always recomputed from the first two (with `'system'`, by today's date and the OS color scheme), so a saved seasonal theme never outlives its season.
248
+
249
+ Choices saved before theme and mode were separate (e.g. a theme cookie of `'dark'`) are read as the equivalent theme and mode, so users keep their theme.
250
+
251
+ By default, none of them is written without consent. Switching themes always works; without consent it just isn't remembered on the next visit. In development, the first unsaved theme change logs a `[jade]` warning in the console, so a missing consent setup doesn't go unnoticed.
252
+
253
+ Consent is read from `localStorage['venix-cookie-consent']`, a JSON object with a `functionality: boolean` field โ€” the "functional cookies" category most consent banners already use. The module never writes this key by itself. For a minimal banner, use the built-in helpers:
254
+
255
+ ```vue
256
+ <script setup lang="ts">
257
+ const { persistence } = useVenixTheme()
258
+ </script>
259
+
260
+ <template>
261
+ <p>Cookies: {{ persistence.hasConsent.value ? 'allowed' : 'not allowed' }}</p>
262
+ <button @click="persistence.grant()">Allow cookies</button>
263
+ <button @click="persistence.revoke()">Revoke cookies</button>
264
+ </template>
265
+ ```
266
+
267
+ - `persistence.hasConsent` โ€” reactive `Ref<boolean>`, shared app-wide.
268
+ - `persistence.grant()` โ€” records consent and saves the current theme to the cookies right away.
269
+ - `persistence.revoke()` โ€” records the refusal and deletes the theme cookies right away.
270
+ - `persistence.enable()` / `persistence.disable()` โ€” lower-level: write or delete the cookies directly (`enable()` still does nothing without consent).
271
+
272
+ If you already have a consent banner or CMP, have it write the same key and then dispatch `venix-cookie-preferences-updated` on `window`, so the module re-syncs immediately:
273
+
274
+ ```ts
275
+ localStorage.setItem('venix-cookie-consent', JSON.stringify({ functionality: true }))
276
+ window.dispatchEvent(new Event('venix-cookie-preferences-updated'))
277
+ ```
278
+
279
+ For apps without a consent banner โ€” e.g. an internal tool โ€” turn the requirement off, and the theme is always saved:
280
+
281
+ ```typescript
282
+ venixTheme: {
283
+ color: {
284
+ requireConsent: false,
285
+ },
286
+ }
287
+ ```
288
+
289
+ Consent is then ignored for the theme cookies and for the locale cookie written by `locale.set()` (see [Translation](#translation)): `persistence.revoke()` no longer deletes them. Whether that's acceptable is a decision for each app.
290
+
291
+ ### Content-Security-Policy
292
+
293
+ To avoid a wrong-theme flash, a small inline script in `<head>` applies the theme before the page renders. Under a strict CSP that blocks inline scripts, it needs the request's nonce: with [`nuxt-security`](https://nuxt-security.vercel.app) and nonces enabled, the module adds it automatically (from `event.context.security.nonce`).
294
+
295
+ ### UnoCSS preset
296
+
297
+ Add the preset to your `uno.config.ts` to use the theme colors as utilities (`text-primary`, `bg-background2`, `border-accent`, โ€ฆ):
298
+
299
+ ```typescript
300
+ // uno.config.ts
301
+ import { defineConfig } from 'unocss'
302
+ import { venixUnoPreset } from '@venix-sistemas/jade/unocss'
303
+
304
+ export default defineConfig({
305
+ presets: [
306
+ venixUnoPreset(),
307
+ // ...your other presets
308
+ ],
309
+ })
310
+ ```
311
+
312
+ It maps every [theme color](#themes), plus `inverse`, to its CSS variable (`primary: 'var(--color-primary)'`, โ€ฆ), so utilities follow the active theme. Colors you define yourself in `uno.config.ts` take precedence.
313
+
314
+ The preset has to be added by hand: `@unocss/nuxt` re-reads `uno.config.ts` from disk and discards a `theme` injected by other modules whenever your file declares its own `theme` key. As a preset in your own file, the colors survive that.
315
+
316
+ ## Translation
317
+
318
+ Detects the user's locale to translate the theme names (each theme's `translations`), `<VenixThemeSwitcher>`'s own strings and, optionally, your own strings.
319
+
320
+ | Option | Type | Default | Description |
321
+ | ---------------- | --------- | ------------------- | -------------------------------------------------------- |
322
+ | `locale` | `string` | โ€” | Force a locale, skipping detection |
323
+ | `defaultLocale` | `string` | `'en-US'` | Fallback when no locale can be detected |
324
+ | `cookieSync` | `string` | `'i18n_redirected'` | Cookie the locale is read from (and written by `locale.set()`) |
325
+ | `manageHtmlLang` | `boolean` | `false` | Keep `<html lang>` in sync โ€” see [below](#integrating-with-a-routing-based-i18n-module-eg-nuxtjsi18n) |
326
+
327
+ The locale is detected in this order:
328
+
329
+ 1. `translation.locale`, if set (skips every other step)
330
+ 2. The locale cookie (`translation.cookieSync`)
331
+ 3. The URL's locale prefix (e.g. `/en/...`), if a theme has a translation for it
332
+ 4. The `Accept-Language` header (SSR) or `navigator.language` (client)
333
+ 5. `translation.defaultLocale`
334
+
335
+ With `translation: false`, detection is off: theme names and the switcher's strings always use `defaultLocale`, and `locale.set()` never writes the cookie. When it's on, `locale.set()` only writes the cookie after [cookie consent](#saving-the-theme-cookie-consent), unless `color.requireConsent` is `false`.
336
+
337
+ ### Using your own translations
338
+
339
+ `locale.translate()` applies the same matching and fallbacks to your own strings:
340
+
341
+ ```ts
342
+ const { locale } = useVenixTheme()
343
+
344
+ locale.translate({ 'en-US': 'Hello', 'pt-BR': 'Olรก' }, 'Hello') // second argument: fallback
345
+ ```
346
+
347
+ ### Integrating with a routing-based i18n module (e.g. `@nuxtjs/i18n`)
348
+
349
+ `translation.cookieSync` defaults to `'i18n_redirected'`, the same cookie `@nuxtjs/i18n` uses, so theme names follow your app's locale with no extra setup. If you renamed the cookie on either side, point `cookieSync` at the same name.
350
+
351
+ `<html lang>` isn't touched by default. If your app has **no** routing i18n module, turn on `manageHtmlLang` so `lang` reflects the resolved locale (WCAG 3.1.1 โ€” screen readers pronounce the theme names correctly):
352
+
353
+ ```ts
354
+ venixTheme: {
355
+ translation: {
356
+ manageHtmlLang: true,
357
+ },
358
+ }
359
+ ```
360
+
361
+ Keep it off with `@nuxtjs/i18n` or similar: that module follows the current route and should own `lang`, while this module's detection can briefly disagree with it (e.g. right after navigating to a localized route) and the two would fight over the attribute.
241
362
 
242
363
  ## Icons
243
364
 
244
- `jade` installs and configures [`@nuxt/icon`](https://github.com/nuxt/icon) and registers `<VenixIcon>` (and the matching `useVenixIcon()` composable). A single `icon` value accepts three formats:
365
+ <p align="center">
366
+ <img src="./docs/images/readme/icons.png" alt="VenixIcon rendering an animated Iconify icon, an emoji, inline SVG and aliases" width="800">
367
+ </p>
368
+
369
+ Installs and configures [`@nuxt/icon`](https://github.com/nuxt/icon), so every [Iconify](https://icon-sets.iconify.design/) icon is available in your app.
370
+
371
+ **For regular icons, use `@nuxt/icon`'s own `<Icon>`** โ€” Jade doesn't replace it, and the Iconify aliases from `icon.aliases` work there too:
372
+
373
+ ```vue
374
+ <template>
375
+ <Icon name="mdi:home" />
376
+ <Icon name="line-md:home" mode="svg" /> <!-- `mode="svg"` is needed for line-md's animations -->
377
+ </template>
378
+ ```
379
+
380
+ **For special cases, use `<VenixIcon>`** (or the matching `useVenixIcon()` composable): when the same value may be an Iconify name, an emoji or an inline SVG โ€” for example an icon that comes from configuration or data, like the [theme icons](#theme-icons):
245
381
 
246
382
  ```vue
247
383
  <template>
@@ -251,10 +387,17 @@ The built-in Carnival theme uses `easter-65` to `easter-46`: 20 days, from the p
251
387
  </template>
252
388
  ```
253
389
 
254
- - **Iconify name** โ€” `collection:name` (e.g. `line-md:home`, `mdi:home`), including [`line-md`](https://icon-sets.iconify.design/line-md/)'s animated icons.
390
+ - **Iconify name** โ€” `collection:name` (e.g. `line-md:home`, `mdi:home`), rendered with `<Icon>` in CSS mode by default (lighter, but never animated); pass `mode="svg"` for a real `<svg>`, needed for animations.
255
391
  - **Inline SVG** โ€” a string starting with `<svg`, rendered with `v-html`. It isn't sanitized, so only pass SVGs you control, never user input.
256
392
  - **Emoji or text** โ€” anything else.
257
393
 
394
+ | Option | Type | Default | Description |
395
+ | ------------- | ------------------------ | ------------- | -------------------------------------------------- |
396
+ | `collections` | `string[]` | `['line-md']` | Iconify collections bundled whole โ€” see [below](#offline-icon-collections) |
397
+ | `aliases` | `Record<string, string>` | `{}` | Short names for any icon value โ€” see [below](#aliases) |
398
+
399
+ Set `icon: false` to skip `@nuxt/icon` entirely, e.g. if your project already configures it. `<VenixIcon>` isn't registered then, and theme icons always use their emoji (`emote`), so `<VenixThemeSwitcher>` keeps working.
400
+
258
401
  ### Aliases
259
402
 
260
403
  `icon.aliases` gives short names to any of the three formats:
@@ -281,7 +424,7 @@ Icons are bundled at build time, so they work offline instead of being fetched f
281
424
 
282
425
  - **`line-md`** is bundled whole by default.
283
426
  - **Icons used in theme `icon`s or in `icon.aliases`** are detected automatically, and only those icons are bundled, not their whole collection. That's how the built-in themes' `mdi` icons are included. The collection is looked up in this module's dependencies first, then in your project's `node_modules`.
284
- - **To use any icon of a collection anywhere in your app**, install its `@iconify-json/<collection>` package and list it in `icon.collections` to bundle it whole. Keep `line-md` in the list if you still want it:
427
+ - **To use any icon of a collection anywhere in your app**, install its `@iconify-json/<collection>` package and list it in `icon.collections` to bundle it whole. The list replaces the default, so keep `line-md` in it if you still want it:
285
428
 
286
429
  ```typescript
287
430
  venixTheme: {
@@ -291,18 +434,18 @@ venixTheme: {
291
434
  }
292
435
  ```
293
436
 
294
- If a referenced collection can't be found, `@nuxt/icon` fetches it from the Iconify API at runtime, which needs internet. Set `icon: false` to skip `@nuxt/icon` entirely, e.g. if your project already configures it.
437
+ If a referenced collection can't be found, `@nuxt/icon` fetches it from the Iconify API at runtime, which needs internet.
295
438
 
296
439
  ### Theme icons
297
440
 
298
441
  A theme's `icon` (shown by pickers such as `<VenixThemeSwitcher>`) is either a plain emoji, like `"icon": "๐ŸŒ™"`, or an object with up to three variants:
299
442
 
300
443
  ```json
301
- "light": {
444
+ "natal": {
302
445
  "icon": {
303
- "emote": "โ˜€๏ธ",
304
- "css": "mdi:sun-compass",
305
- "svg": "line-md:sunny-filled-loop"
446
+ "emote": "๐ŸŽ„",
447
+ "css": "mdi:pine-tree-variant",
448
+ "svg": "line-md:star-filled"
306
449
  }
307
450
  }
308
451
  ```
@@ -311,7 +454,7 @@ A theme's `icon` (shown by pickers such as `<VenixThemeSwitcher>`) is either a p
311
454
  - `css` โ€” an Iconify name rendered in CSS mode: lighter, but never animated.
312
455
  - `svg` โ€” an Iconify name rendered as a real `<svg>`, needed for animated icons like `line-md`'s.
313
456
 
314
- `color.iconFormat` picks the variant for every theme (default `'svg'`), falling back to `emote` when a theme doesn't define it. `useVenixTheme().themes` already resolves it to `{ format, value }`, ready for `<VenixIcon>`:
457
+ `color.iconFormat` picks the variant for every theme (default `'svg'`, so the built-in `line-md` icons animate). When a theme doesn't define it, the other Iconify variant is tried before the emoji: `svg` โ†’ `css` โ†’ `emote` (or `css` โ†’ `svg` โ†’ `emote`). The mode options (Automatic, Light, Dark) use the same formats. `useVenixTheme().themes` and `.modes` already resolve it to `{ format, value }`, ready for `<VenixIcon>`:
315
458
 
316
459
  ```vue
317
460
  <VenixIcon
@@ -321,101 +464,75 @@ A theme's `icon` (shown by pickers such as `<VenixThemeSwitcher>`) is either a p
321
464
  />
322
465
  ```
323
466
 
324
- ## Cookie Consent
325
-
326
- Two cookies remember the user's choice between visits:
327
-
328
- | Cookie | Stores |
329
- | ------------------------ | ----------------------------------------------------------------------------------- |
330
- | `venix-theme-preference` | The user's raw choice (`'dark'`, `'system'`, a custom themeโ€ฆ) |
331
- | `venix-theme-resolved` | The theme actually applied (e.g. `'dark'` for `'system'`), so SSR renders it with no flash |
467
+ ## Typography
332
468
 
333
- Neither is written without consent. Switching themes always works; without consent it just isn't remembered on the next visit. (The locale cookie is covered in [Integrating with a routing-based i18n module](#integrating-with-a-routing-based-i18n-module-eg-nuxtjsi18n).)
469
+ Sets the base font for the whole app: `--font-family-base` and `--font-size-base` on `:root`, plus an `@font-face` rule for each custom font.
334
470
 
335
- Consent is read from `localStorage['venix-cookie-consent']`, a JSON object with a `functionality: boolean` field โ€” the "functional cookies" category most consent banners already use. The module never writes this key by itself. For a minimal banner, use the built-in helpers:
336
-
337
- ```vue
338
- <script setup lang="ts">
339
- const { persistence } = useVenixTheme()
340
- </script>
471
+ <p align="center">
472
+ <img src="./docs/images/readme/typography.png" alt="The Iceberg font at several sizes" width="800">
473
+ </p>
341
474
 
342
- <template>
343
- <p>Cookies: {{ persistence.hasConsent.value ? 'allowed' : 'not allowed' }}</p>
344
- <button @click="persistence.grant()">Allow cookies</button>
345
- <button @click="persistence.revoke()">Revoke cookies</button>
346
- </template>
347
- ```
348
-
349
- - `persistence.hasConsent` โ€” reactive `Ref<boolean>`, shared app-wide.
350
- - `persistence.grant()` โ€” records consent and saves the current theme to the cookies right away.
351
- - `persistence.revoke()` โ€” records the refusal and deletes both cookies right away.
352
- - `persistence.enable()` / `persistence.disable()` โ€” lower-level: write or delete the cookies directly (`enable()` still does nothing without consent).
353
-
354
- If you already have a consent banner or CMP, have it write the same key and then dispatch `venix-cookie-preferences-updated` on `window`, so the module re-syncs immediately:
355
-
356
- ```ts
357
- localStorage.setItem('venix-cookie-consent', JSON.stringify({ functionality: true }))
358
- window.dispatchEvent(new Event('venix-cookie-preferences-updated'))
475
+ ```typescript
476
+ venixTheme: {
477
+ typography: {
478
+ defaultFonts: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", // default
479
+ fontSize: '16px', // default
480
+ customFonts: [
481
+ { name: 'MyFont', sources: { woff2: '/fonts/MyFont.woff2' }, weight: 'normal', style: 'normal' },
482
+ ],
483
+ },
484
+ }
359
485
  ```
360
486
 
361
- ## Internationalization
362
-
363
- The resolved locale translates the theme names (each theme's `translations`) and `<VenixThemeSwitcher>`'s own strings. It's detected in this order:
487
+ Custom fonts come first in `--font-family-base`, with `defaultFonts` as the fallback. The same font list also goes to Vuetify's `--v-font-body`/`--v-font-heading`, since Vuetify components don't inherit `font-family` from the page.
364
488
 
365
- 1. `translation.locale`, if set (skips every other step)
366
- 2. The locale cookie (`translation.cookieSync`)
367
- 3. The URL's locale prefix (e.g. `/en/...`), if a theme has a translation for it
368
- 4. The `Accept-Language` header (SSR) or `navigator.language` (client)
369
- 5. `translation.defaultLocale`
489
+ ## Scrollbar
370
490
 
371
- ### Using your own translations
491
+ A custom scrollbar whose colors follow the active theme. The values below are the defaults:
372
492
 
373
- `locale.translate()` applies the same matching and fallbacks to your own strings:
493
+ <p align="center">
494
+ <img src="./docs/images/readme/scrollbar.png" alt="Vertical and horizontal scrollbars in the theme colors" width="800">
495
+ </p>
374
496
 
375
- ```ts
376
- const { locale } = useVenixTheme()
377
-
378
- locale.translate({ 'en-US': 'Hello', 'pt-BR': 'Olรก' }, 'Hello') // second argument: fallback
379
- ```
380
-
381
- ### Integrating with a routing-based i18n module (e.g. `@nuxtjs/i18n`)
382
-
383
- `translation.cookieSync` defaults to `'i18n_redirected'`, the same cookie `@nuxtjs/i18n` uses, so theme names follow your app's locale with no extra setup. If you renamed the cookie on either side, point `cookieSync` at the same name.
384
-
385
- `<html lang>` isn't touched by default. If your app has **no** routing i18n module, turn on `manageHtmlLang` so `lang` reflects the resolved locale (WCAG 3.1.1 โ€” screen readers pronounce the theme names correctly):
386
-
387
- ```ts
497
+ ```typescript
388
498
  venixTheme: {
389
- translation: {
390
- manageHtmlLang: true,
499
+ scrollbar: {
500
+ width: 'auto',
501
+ borderRadius: '8px',
502
+ borderWidth: '3px',
503
+ // A theme color name (follows the active theme) or any CSS color
504
+ colors: { thumb: 'primary', thumbHover: 'secondary', track: 'background2', border: 'background3' },
391
505
  },
392
506
  }
393
507
  ```
394
508
 
395
- Keep it off with `@nuxtjs/i18n` or similar: that module follows the current route and should own `lang`, while this module's detection can briefly disagree with it (e.g. right after navigating to a localized route) and the two would fight over the attribute.
509
+ ## Cursor
396
510
 
397
- ## UnoCSS integration
511
+ Replaces the default, pointer and text cursors with images. On by default, using the module's own cursor images; point it at yours to customize, or set `cursor: false` to keep the browser's cursors:
398
512
 
399
- Add the preset to your `uno.config.ts` to use the theme colors as utilities (`text-primary`, `bg-background2`, `border-accent`, โ€ฆ):
513
+ <p align="center">
514
+ <img src="./docs/images/readme/cursor.png" alt="The default, pointer and text cursors" width="800">
515
+ </p>
400
516
 
401
517
  ```typescript
402
- // uno.config.ts
403
- import { defineConfig } from 'unocss'
404
- import { venixUnoPreset } from '@venix-sistemas/jade/unocss'
405
-
406
- export default defineConfig({
407
- presets: [
408
- venixUnoPreset(),
409
- // ...your other presets
410
- ],
411
- })
518
+ venixTheme: {
519
+ cursor: {
520
+ // Images served from `public/`; `hotspot` is the click point ("x y")
521
+ cursors: {
522
+ default: { path: '/cursors/default.png', hotspot: '0 0' },
523
+ pointer: { path: '/cursors/pointer.png', hotspot: '0 0' },
524
+ text: { path: '/cursors/text.png', hotspot: '0 0' },
525
+ },
526
+ },
527
+ }
412
528
  ```
413
529
 
414
- It maps every [theme color](#themes), plus `inverse`, to its CSS variable (`primary: 'var(--color-primary)'`, โ€ฆ), so utilities follow the active theme. Colors you define yourself in `uno.config.ts` take precedence.
415
-
416
- The preset has to be added by hand: `@unocss/nuxt` re-reads `uno.config.ts` from disk and discards a `theme` injected by other modules whenever your file declares its own `theme` key. As a preset in your own file, the colors survive that.
530
+ > [!NOTE]
531
+ > Keep cursor images at **32ร—32 pixels or smaller**. Browsers accept larger cursors (Chromium up to 128ร—128), but Chromium falls back to the system cursor whenever a cursor larger than 32ร—32 would overlap the browser UI, so it flickers near the edges of the window.
532
+ >
533
+ > Browser-drawn UI ignores the CSS `cursor` property and always shows the system cursor. That includes native scrollbars, `<select>` dropdowns, date and color pickers, and the `<textarea>` resize handle.
417
534
 
418
- ## Vuetify integration
535
+ ## Vuetify
419
536
 
420
537
  With [`vuetify-nuxt-module`](https://nuxt.vuetifyjs.com) installed, `vuetify: true` registers every color theme with Vuetify and keeps its active theme in sync โ€” no hand-written `theme.themes` mapping:
421
538
 
@@ -434,7 +551,7 @@ export default defineNuxtConfig({
434
551
  - **Order matters:** the themes are registered through Vuetify's [`vuetify:registerModule`](https://nuxt.vuetifyjs.com/guide/advanced/layers-and-hooks.html) hook, which only sees modules listed before Vuetify.
435
552
  - **Real colors:** Vuetify computes contrast and `on-*` colors in JavaScript, so it receives the actual hex values, not `var(...)`. `background2` also fills Vuetify's `surface` slot (cards, toolbars, โ€ฆ).
436
553
  - **Your values win:** anything you set in `vuetify.vuetifyOptions.theme.themes` is merged per color on top of the generated themes.
437
- - **Always in sync:** a small runtime plugin picks Vuetify's initial theme from the same cookies (so the first paint is right, with or without SSR) and applies every later switch with `theme.change()`, inside the same View Transition as the rest of the page.
554
+ - **Always in sync:** a small runtime plugin starts Vuetify on the same theme the page gets (so the first paint is right, with or without SSR) and applies every later switch with `theme.change()`, inside the same View Transition as the rest of the page.
438
555
  - **No flash in SPA mode** (`ssr: false`): Vuetify's theme stylesheet only reaches the DOM after the first render there, so the plugin writes a temporary copy into `<head>` before mount and removes it once Vuetify's own arrives.
439
556
 
440
557
  It's opt-in because it adds a runtime plugin, and it does nothing if `vuetify-nuxt-module` isn't installed. Tested with Vuetify `^4.2.1` and `vuetify-nuxt-module@1.0.0-rc.6`; that module is still pre-1.0, so its hooks may change.