maz-ui 5.0.0 → 5.1.0-beta.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/dist/assets/{MazDropzone.DJ8au25t.css → MazDropzone.BW2grpTi.css} +1 -1
- package/dist/chunks/{MazDrawer.DANxKYxJ.js → MazDrawer.CC8zomfx.js} +2 -2
- package/dist/chunks/{MazDropzone.POH3pmfi.js → MazDropzone.Dez5j0WP.js} +2 -2
- package/dist/components/MazDrawer.js +1 -1
- package/dist/components/MazDropzone.js +1 -1
- package/dist/components/MazDropzone.vue.d.ts +2 -2
- package/dist/components/MazInputPrice.vue.d.ts +1 -1
- package/dist/components/index.js +2 -2
- package/docs/README.md +207 -0
- package/docs/agents/agents-md.md +52 -0
- package/docs/agents/claude-rule.md +52 -0
- package/docs/components/maz-accordion.md +76 -0
- package/docs/components/maz-alert.md +241 -0
- package/docs/components/maz-animated-counter.md +87 -0
- package/docs/components/maz-animated-element.md +46 -0
- package/docs/components/maz-animated-text.md +53 -0
- package/docs/components/maz-avatar.md +193 -0
- package/docs/components/maz-backdrop.md +178 -0
- package/docs/components/maz-badge.md +167 -0
- package/docs/components/maz-bottom-sheet.md +257 -0
- package/docs/components/maz-btn-group.md +316 -0
- package/docs/components/maz-btn.md +423 -0
- package/docs/components/maz-card-spotlight.md +84 -0
- package/docs/components/maz-card.md +321 -0
- package/docs/components/maz-carousel.md +153 -0
- package/docs/components/maz-chart.md +206 -0
- package/docs/components/maz-checkbox.md +138 -0
- package/docs/components/maz-checklist.md +251 -0
- package/docs/components/maz-circular-progress-bar.md +109 -0
- package/docs/components/maz-code-highlight.md +155 -0
- package/docs/components/maz-container.md +241 -0
- package/docs/components/maz-date-picker.md +791 -0
- package/docs/components/maz-dialog-confirm.md +215 -0
- package/docs/components/maz-dialog.md +143 -0
- package/docs/components/maz-drawer.md +106 -0
- package/docs/components/maz-dropdown.md +419 -0
- package/docs/components/maz-dropzone.md +387 -0
- package/docs/components/maz-expand-animation.md +82 -0
- package/docs/components/maz-fullscreen-loader.md +58 -0
- package/docs/components/maz-gallery.md +79 -0
- package/docs/components/maz-icon.md +203 -0
- package/docs/components/maz-input-code.md +73 -0
- package/docs/components/maz-input-number.md +79 -0
- package/docs/components/maz-input-phone-number.md +536 -0
- package/docs/components/maz-input-price.md +68 -0
- package/docs/components/maz-input-tags.md +112 -0
- package/docs/components/maz-input.md +334 -0
- package/docs/components/maz-lazy-img.md +113 -0
- package/docs/components/maz-link.md +146 -0
- package/docs/components/maz-loading-bar.md +38 -0
- package/docs/components/maz-markdown-editor.md +320 -0
- package/docs/components/maz-pagination.md +82 -0
- package/docs/components/maz-popover.md +794 -0
- package/docs/components/maz-pull-to-refresh.md +222 -0
- package/docs/components/maz-radio-buttons.md +313 -0
- package/docs/components/maz-radio.md +119 -0
- package/docs/components/maz-read-more.md +209 -0
- package/docs/components/maz-reading-progress-bar.md +96 -0
- package/docs/components/maz-select-country.md +513 -0
- package/docs/components/maz-select.md +318 -0
- package/docs/components/maz-sidebar-content.md +25 -0
- package/docs/components/maz-sidebar-footer.md +25 -0
- package/docs/components/maz-sidebar-group.md +27 -0
- package/docs/components/maz-sidebar-header.md +25 -0
- package/docs/components/maz-sidebar-menu-button.md +41 -0
- package/docs/components/maz-sidebar-menu-item.md +25 -0
- package/docs/components/maz-sidebar-menu-sub.md +32 -0
- package/docs/components/maz-sidebar-menu.md +25 -0
- package/docs/components/maz-sidebar-separator.md +21 -0
- package/docs/components/maz-sidebar-trigger.md +25 -0
- package/docs/components/maz-sidebar.md +507 -0
- package/docs/components/maz-skeleton.md +226 -0
- package/docs/components/maz-slider.md +165 -0
- package/docs/components/maz-spinner.md +84 -0
- package/docs/components/maz-stepper.md +301 -0
- package/docs/components/maz-switch.md +86 -0
- package/docs/components/maz-table-cell.md +27 -0
- package/docs/components/maz-table-row.md +28 -0
- package/docs/components/maz-table-title.md +27 -0
- package/docs/components/maz-table-virtualizer.md +31 -0
- package/docs/components/maz-table.md +426 -0
- package/docs/components/maz-tabs-bar.md +43 -0
- package/docs/components/maz-tabs-content-item.md +27 -0
- package/docs/components/maz-tabs-content.md +27 -0
- package/docs/components/maz-tabs.md +308 -0
- package/docs/components/maz-textarea.md +255 -0
- package/docs/components/maz-ticker.md +427 -0
- package/docs/components/maz-timeline.md +304 -0
- package/docs/components/maz-ui-provider.md +26 -0
- package/docs/components/maz-window-mockup.md +182 -0
- package/docs/composables/use-aos.md +41 -0
- package/docs/composables/use-breakpoints.md +42 -0
- package/docs/composables/use-dialog.md +58 -0
- package/docs/composables/use-display-names.md +130 -0
- package/docs/composables/use-drag.md +185 -0
- package/docs/composables/use-form-validator.md +1123 -0
- package/docs/composables/use-idle-timeout.md +172 -0
- package/docs/composables/use-pull-to-refresh.md +86 -0
- package/docs/composables/use-reading-time.md +132 -0
- package/docs/composables/use-string-matching.md +41 -0
- package/docs/composables/use-swipe.md +171 -0
- package/docs/composables/use-timer.md +104 -0
- package/docs/composables/use-toast.md +50 -0
- package/docs/composables/use-user-visibility.md +127 -0
- package/docs/composables/use-wait.md +50 -0
- package/docs/composables/use-window-size.md +25 -0
- package/docs/directives/click-outside.md +182 -0
- package/docs/directives/fullscreen-img.md +83 -0
- package/docs/directives/lazy-img.md +182 -0
- package/docs/directives/tooltip.md +298 -0
- package/docs/directives/zoom-img.md +100 -0
- package/docs/ecosystem/eslint-config.md +289 -0
- package/docs/ecosystem/icons/icon-set.md +25 -0
- package/docs/ecosystem/icons/index.md +584 -0
- package/docs/ecosystem/mcp.md +165 -0
- package/docs/ecosystem/node/exec-promise.md +93 -0
- package/docs/ecosystem/node/index.md +53 -0
- package/docs/ecosystem/node/logger.md +152 -0
- package/docs/ecosystem/node/print-banner.md +101 -0
- package/docs/ecosystem/node/setup-agents.md +102 -0
- package/docs/ecosystem/nuxt.md +551 -0
- package/docs/ecosystem/stylelint-config.md +310 -0
- package/docs/ecosystem/themes.md +966 -0
- package/docs/ecosystem/translations.md +1173 -0
- package/docs/ecosystem/utils/camel-case.md +37 -0
- package/docs/ecosystem/utils/capitalize.md +37 -0
- package/docs/ecosystem/utils/check-availability.md +85 -0
- package/docs/ecosystem/utils/cookie.md +86 -0
- package/docs/ecosystem/utils/country-code-to-unicode-flag.md +128 -0
- package/docs/ecosystem/utils/currency.md +53 -0
- package/docs/ecosystem/utils/date.md +53 -0
- package/docs/ecosystem/utils/debounce-callback.md +44 -0
- package/docs/ecosystem/utils/debounce-id.md +75 -0
- package/docs/ecosystem/utils/debounce.md +71 -0
- package/docs/ecosystem/utils/fetch-locale-ip.md +39 -0
- package/docs/ecosystem/utils/format-json.md +39 -0
- package/docs/ecosystem/utils/format-phone-number.md +43 -0
- package/docs/ecosystem/utils/get-browser-locale.md +35 -0
- package/docs/ecosystem/utils/get-country-flag-url.md +67 -0
- package/docs/ecosystem/utils/get-error-message.md +45 -0
- package/docs/ecosystem/utils/idle-timeout.md +96 -0
- package/docs/ecosystem/utils/index.md +57 -0
- package/docs/ecosystem/utils/is-client.md +38 -0
- package/docs/ecosystem/utils/is-equal.md +44 -0
- package/docs/ecosystem/utils/is-ios.md +43 -0
- package/docs/ecosystem/utils/is-server.md +37 -0
- package/docs/ecosystem/utils/is-standalone-mode.md +49 -0
- package/docs/ecosystem/utils/kebab-case.md +42 -0
- package/docs/ecosystem/utils/normalize-string.md +83 -0
- package/docs/ecosystem/utils/number.md +51 -0
- package/docs/ecosystem/utils/pascal-case.md +41 -0
- package/docs/ecosystem/utils/prevent-ios-input-zoom.md +72 -0
- package/docs/ecosystem/utils/script-loader.md +85 -0
- package/docs/ecosystem/utils/sleep.md +65 -0
- package/docs/ecosystem/utils/snake-case.md +42 -0
- package/docs/ecosystem/utils/swipe-handler.md +97 -0
- package/docs/ecosystem/utils/textarea-autogrow.md +47 -0
- package/docs/ecosystem/utils/throttle-id.md +54 -0
- package/docs/ecosystem/utils/throttle.md +63 -0
- package/docs/ecosystem/utils/truthy-filter.md +37 -0
- package/docs/ecosystem/utils/types/deep-key-of.md +54 -0
- package/docs/ecosystem/utils/types/deep-partial.md +48 -0
- package/docs/ecosystem/utils/types/deep-required.md +45 -0
- package/docs/ecosystem/utils/types/flatten-object-keys.md +50 -0
- package/docs/ecosystem/utils/types/generic-instance-type.md +48 -0
- package/docs/ecosystem/utils/types/infer-maybe-ref.md +41 -0
- package/docs/ecosystem/utils/upper-first.md +38 -0
- package/docs/ecosystem/utils/user-visibility.md +75 -0
- package/docs/guide/ai-agents.md +237 -0
- package/docs/guide/browser-support.md +88 -0
- package/docs/guide/getting-started.md +191 -0
- package/docs/guide/global-defaults.md +103 -0
- package/docs/guide/maz-ui-provider.md +231 -0
- package/docs/guide/migration-v5.md +871 -0
- package/docs/guide/resolvers.md +650 -0
- package/docs/guide/tailwind.md +483 -0
- package/docs/guide/vue.md +286 -0
- package/docs/manifest.json +1 -0
- package/docs/plugins/aos.md +312 -0
- package/docs/plugins/dialog.md +269 -0
- package/docs/plugins/toast.md +221 -0
- package/docs/plugins/wait.md +78 -0
- package/docs/reference/icons.md +46 -0
- package/docs/reference/tailwind-tokens.md +191 -0
- package/docs/rules.md +57 -0
- package/package.json +31 -4
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Install maz-ui with Nuxt"
|
|
3
|
+
description: "The ultimate Nuxt module for Maz-UI - zero-config setup with auto-imports, theming, internationalization and powerful features out of the box"
|
|
4
|
+
package: "@maz-ui/nuxt"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/nuxt"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Install maz-ui with Nuxt
|
|
9
|
+
|
|
10
|
+
> The ultimate Nuxt module for Maz-UI - zero-config setup with auto-imports, theming, internationalization and powerful features out of the box
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/nuxt`
|
|
13
|
+
- Web: https://maz-ui.com/ecosystem/nuxt
|
|
14
|
+
|
|
15
|
+
**Maz-UI Nuxt Module** provides zero-configuration setup, intelligent auto-imports, powerful theming capabilities and internationalization.
|
|
16
|
+
|
|
17
|
+
**Tip: Model Context Protocol (MCP)**
|
|
18
|
+
|
|
19
|
+
In development, the module connects the AI coding agents detected in the project (Claude Code, Cursor, Copilot...) to the maz-ui [MCP server](./mcp.md), which gives them the docs and rules of the installed maz-ui. See AI Agents.
|
|
20
|
+
|
|
21
|
+
Check out the documentation of [@maz-ui/mcp](./mcp.md)
|
|
22
|
+
|
|
23
|
+
## Why Choose Maz-UI for Nuxt?
|
|
24
|
+
|
|
25
|
+
- **Zero Configuration** - Works out of the box with sensible defaults
|
|
26
|
+
- **Advanced Theming** - Built-in dark mode, custom themes, and CSS variables
|
|
27
|
+
- **Auto-Import Everything** - Components, composables, and directives automatically available
|
|
28
|
+
- **Performance Optimized** - Tree-shaking, lazy loading, and SSR-friendly CSS injection
|
|
29
|
+
- **Developer Experience** - TypeScript support, DevTools integration, and IntelliSense
|
|
30
|
+
- **Production Ready** - SSR/SSG support with client-side hydration
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash [pnpm]
|
|
35
|
+
pnpm add @maz-ui/nuxt
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash [npm]
|
|
39
|
+
npm install @maz-ui/nuxt
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash [yarn]
|
|
43
|
+
yarn add @maz-ui/nuxt
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash [nuxt]
|
|
47
|
+
pnpx nuxt@latest module add @maz-ui/nuxt
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Add the module to your `nuxt.config.ts`:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
export default defineNuxtConfig({
|
|
54
|
+
modules: ['@maz-ui/nuxt']
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
That's it! 🎉 All components and composables are now auto-imported and ready to use.
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
### Instant Usage
|
|
63
|
+
|
|
64
|
+
No imports needed - everything is auto-imported:
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<script setup>
|
|
68
|
+
// Composables are auto-imported
|
|
69
|
+
const { start, stop, pause, resume, remainingTime } = useTimer({
|
|
70
|
+
timeout: 4000,
|
|
71
|
+
callback: () => console.log('Timeout end')
|
|
72
|
+
})
|
|
73
|
+
const { toggleDarkMode, isDark } = useTheme()
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<div class="bg-surface p-8 text-foreground">
|
|
78
|
+
<!-- Components are auto-imported -->
|
|
79
|
+
<MazBtn color="primary" @click="start">
|
|
80
|
+
Start timer ({{ remainingTime }}ms)
|
|
81
|
+
</MazBtn>
|
|
82
|
+
|
|
83
|
+
<!-- Directives work globally -->
|
|
84
|
+
<MazBtn @click="toggleDarkMode">
|
|
85
|
+
Toggle dark mode ({{ isDark ? '🌙' : '☀️' }})
|
|
86
|
+
</MazBtn>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
### Minimal Setup
|
|
94
|
+
|
|
95
|
+
For most use cases, no configuration is needed:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
export default defineNuxtConfig({
|
|
99
|
+
modules: ['@maz-ui/nuxt']
|
|
100
|
+
// That's it! 🎉
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Advanced Configuration
|
|
105
|
+
|
|
106
|
+
Customize everything to your needs:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
export default defineNuxtConfig({
|
|
110
|
+
modules: ['@maz-ui/nuxt'],
|
|
111
|
+
mazUi: {
|
|
112
|
+
// General Settings
|
|
113
|
+
general: {
|
|
114
|
+
autoImportPrefix: 'Maz', // useMazToast instead of useToast
|
|
115
|
+
defaultMazIconPath: '/icons', // Default path for <MazIcon />
|
|
116
|
+
devtools: true, // Enable DevTools integration
|
|
117
|
+
preventIosInputZoom: true, // No zoom on focused fields on iOS
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
// CSS & Styling
|
|
121
|
+
css: {
|
|
122
|
+
injectCss: true, // Auto-inject Maz-UI styles
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// Theming System
|
|
126
|
+
theme: {
|
|
127
|
+
preset: 'maz-ui', // 'maz-ui' | 'pristine' | 'ocean' | 'obsidian' | 'nova' | custom object
|
|
128
|
+
strategy: 'runtime', // 'runtime' | 'buildtime'
|
|
129
|
+
darkModeStrategy: 'class', // 'class' | 'media'
|
|
130
|
+
darkClass: 'dark', // class on <html> when colorMode === 'dark' (default: 'dark')
|
|
131
|
+
lightClass: 'light', // class on <html> when colorMode === 'light' (default: 'light')
|
|
132
|
+
overrides: {
|
|
133
|
+
colors: {
|
|
134
|
+
light: { primary: 'oklch(0.65 0.19 254)' },
|
|
135
|
+
dark: { primary: 'oklch(0.72 0.18 254)' }
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
mode: 'both', // 'light' | 'dark' | 'both'
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
// Translations
|
|
142
|
+
translations: {
|
|
143
|
+
locales: 'fr',
|
|
144
|
+
fallbackLocale: 'en',
|
|
145
|
+
messages: {
|
|
146
|
+
// override default messages or add new languages
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
// Components
|
|
151
|
+
components: {
|
|
152
|
+
autoImport: true, // All components globally available
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
// Global component defaults (priority: instance prop > defaults[Component] > defaults.global > library default)
|
|
156
|
+
defaults: {
|
|
157
|
+
global: { roundedSize: 'lg' }, // cross-cutting (roundedSize, size)
|
|
158
|
+
MazBtn: { roundedSize: 'full' }, // per-component, wins over global
|
|
159
|
+
MazCard: { bordered: false, elevation: true },
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// Country flags of MazSelectCountry and MazInputPhoneNumber: 'cdn' (default), 'local' (offline) or '/flags/{code}.svg'
|
|
163
|
+
flags: 'local',
|
|
164
|
+
|
|
165
|
+
// Plugins (not enabled by default)
|
|
166
|
+
plugins: {
|
|
167
|
+
aos: true,
|
|
168
|
+
dialog: true,
|
|
169
|
+
toast: true,
|
|
170
|
+
wait: true,
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
// Composables (enabled by default)
|
|
174
|
+
composables: {
|
|
175
|
+
useFormValidator: true,
|
|
176
|
+
useFreezeValue: true,
|
|
177
|
+
useIdleTimeout: false,
|
|
178
|
+
useInstanceUniqId: false,
|
|
179
|
+
useMountComponent: false,
|
|
180
|
+
useReadingTime: false,
|
|
181
|
+
useStringMatching: false,
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
// Directives (not enabled by default)
|
|
185
|
+
directives: {
|
|
186
|
+
vTooltip: true,
|
|
187
|
+
vLazyImg: true,
|
|
188
|
+
vClickOutside: true,
|
|
189
|
+
vFullscreenImg: true,
|
|
190
|
+
vZoomImg: true,
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
// AI coding agents (default: { rules: false, mcp: true }, false to disable)
|
|
194
|
+
agents: { rules: true, mcp: true },
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Complete Configuration Reference
|
|
200
|
+
|
|
201
|
+
### General Configuration
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
const general = {
|
|
205
|
+
// Add prefix to all auto-imported composables
|
|
206
|
+
autoImportPrefix: 'Maz', // only for composables, generates useMazToast, useMazTheme, etc.
|
|
207
|
+
|
|
208
|
+
// Default icon path for <MazIcon icon="..." />
|
|
209
|
+
defaultMazIconPath: '/icons',
|
|
210
|
+
|
|
211
|
+
// Enable Nuxt DevTools integration
|
|
212
|
+
devtools: true,
|
|
213
|
+
|
|
214
|
+
// Stop iOS from zooming the page when a form field gets the focus (default: false)
|
|
215
|
+
// Adds `maximum-scale=1` to the viewport on iOS only, see the preventIosInputZoom helper of @maz-ui/utils
|
|
216
|
+
preventIosInputZoom: false,
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### CSS Configuration
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
const css = {
|
|
224
|
+
// Auto-inject Maz-UI base styles
|
|
225
|
+
injectCss: true,
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Theme System
|
|
230
|
+
|
|
231
|
+
The most powerful theming system for Nuxt applications:
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
const theme = {
|
|
235
|
+
// Use predefined presets or create custom ones
|
|
236
|
+
preset: 'maz-ui', // 'mazUi' | 'dark' | 'ocean' | CustomThemeObject
|
|
237
|
+
|
|
238
|
+
// Override specific parts of the theme
|
|
239
|
+
overrides: {
|
|
240
|
+
colors: {
|
|
241
|
+
light: {
|
|
242
|
+
primary: 'oklch(0.6 0.18 254)',
|
|
243
|
+
secondary: 'oklch(0.96 0.01 254)',
|
|
244
|
+
surface: 'oklch(1 0 0)',
|
|
245
|
+
foreground: 'oklch(0.16 0.02 254)',
|
|
246
|
+
},
|
|
247
|
+
dark: {
|
|
248
|
+
primary: 'oklch(0.72 0.18 254)',
|
|
249
|
+
secondary: 'oklch(0.22 0.02 254)',
|
|
250
|
+
surface: 'oklch(0.16 0.02 254)',
|
|
251
|
+
foreground: 'oklch(0.96 0.005 254)',
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
// Override other theme properties...
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
// Supported color modes to use
|
|
258
|
+
mode: 'both', // 'light' | 'dark' | 'both'
|
|
259
|
+
|
|
260
|
+
// Initial color mode to use (only if mode is 'both')
|
|
261
|
+
colorMode: 'auto', // 'light' | 'dark' | 'auto'
|
|
262
|
+
|
|
263
|
+
// CSS generation strategy
|
|
264
|
+
strategy: 'runtime', // 'runtime' (recommended) | 'buildtime'
|
|
265
|
+
|
|
266
|
+
// Dark mode handling
|
|
267
|
+
darkModeStrategy: 'class', // 'class' | 'media'
|
|
268
|
+
|
|
269
|
+
// Class added to <html> when colorMode === 'dark' (default: 'dark')
|
|
270
|
+
darkClass: 'dark',
|
|
271
|
+
|
|
272
|
+
// Class added to <html> when colorMode === 'light' (default: 'light')
|
|
273
|
+
// Mirror of darkClass - used to force `color-scheme: only light`.
|
|
274
|
+
lightClass: 'light',
|
|
275
|
+
|
|
276
|
+
// Persist the active preset name in the `maz-preset` cookie so the
|
|
277
|
+
// user's last-used theme is restored on reload. Default: true.
|
|
278
|
+
persistPreset: true,
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Global Component Defaults
|
|
283
|
+
|
|
284
|
+
Set default prop values once for every component. Resolution priority, per prop: instance prop > `defaults[Component]` > `defaults.global` > library default. A global default never overrides a prop set on the instance.
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
const defaults = {
|
|
288
|
+
// Cross-cutting tokens applied to every component that exposes them
|
|
289
|
+
global: {
|
|
290
|
+
roundedSize: 'lg', // 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
291
|
+
size: 'sm', // 'mini' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
292
|
+
},
|
|
293
|
+
// Per-component defaults, strongly typed as Partial<ComponentNameProps>, win over `global`
|
|
294
|
+
MazBtn: { roundedSize: 'full' },
|
|
295
|
+
MazCard: { bordered: false, elevation: true },
|
|
296
|
+
MazContainer: { bordered: false },
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
See the [Global component defaults guide](../guide/global-defaults.md) for the full list of globalizable props.
|
|
301
|
+
|
|
302
|
+
### Country Flags
|
|
303
|
+
|
|
304
|
+
Source of the flags of `MazSelectCountry` and `MazInputPhoneNumber`. A `flag-src` set on a component wins.
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
export default defineNuxtConfig({
|
|
308
|
+
mazUi: {
|
|
309
|
+
// 'cdn' (default): flagcdn.com
|
|
310
|
+
// 'local': flags of @maz-ui/icons, one chunk per flag loaded when visible, no request to a third party
|
|
311
|
+
// '/flags/{code}.svg': your own files ({CODE} for uppercase codes)
|
|
312
|
+
flags: 'local',
|
|
313
|
+
},
|
|
314
|
+
})
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Nothing is added to your build unless `flags` is `'local'`. See [MazSelectCountry](../components/maz-select-country.md#flags-source) for the details (Content Security Policy, PWA precache).
|
|
318
|
+
|
|
319
|
+
## Theme Strategies Explained
|
|
320
|
+
|
|
321
|
+
### Runtime (Recommended)
|
|
322
|
+
|
|
323
|
+
The full theme CSS is generated and injected synchronously on first paint:
|
|
324
|
+
|
|
325
|
+
- **No FOUC** - The full stylesheet is rendered in the document head before the first paint
|
|
326
|
+
- **SSR-friendly** - On Nuxt SSR, the CSS is inlined via `useHead` during server rendering and re-used on the client
|
|
327
|
+
- **Dynamic** - `useTheme().updateTheme(...)` re-injects the new CSS on the fly
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
export default defineNuxtConfig({
|
|
331
|
+
mazUi: {
|
|
332
|
+
theme: {
|
|
333
|
+
strategy: 'runtime' // Recommended for most use cases
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Buildtime
|
|
340
|
+
|
|
341
|
+
Build-time CSS generation strategy:
|
|
342
|
+
|
|
343
|
+
- **No runtime injection** - CSS is generated at build time and must be included manually
|
|
344
|
+
- **Consumer responsibility** - You must handle CSS inclusion in your build process and HTML
|
|
345
|
+
- **Optimal performance** - No client-side CSS generation overhead
|
|
346
|
+
- **Static themes only** - Best for applications without dynamic theme switching
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
export default defineNuxtConfig({
|
|
350
|
+
mazUi: {
|
|
351
|
+
theme: {
|
|
352
|
+
strategy: 'buildtime' // For static sites with predefined themes
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Components
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
const components = {
|
|
362
|
+
// Auto-import all 50+ Maz-UI components
|
|
363
|
+
autoImport: true,
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Available Components:**
|
|
368
|
+
`MazBtn`, `MazInput`, `MazSelect`, `MazDialog`, `MazToast`, `MazIcon`, `MazCard`, `MazTable`, `MazChart`, `MazCarousel`, `MazGallery`, and 50+ more!
|
|
369
|
+
|
|
370
|
+
### 🎪 Composables
|
|
371
|
+
|
|
372
|
+
All composables are auto-imported and ready to use:
|
|
373
|
+
|
|
374
|
+
```ts
|
|
375
|
+
const composables = {
|
|
376
|
+
// 🎨 Theming
|
|
377
|
+
useTheme: true, // Theme management and dark mode
|
|
378
|
+
|
|
379
|
+
// 🌐 Translations
|
|
380
|
+
useTranslations: true, // Translation management
|
|
381
|
+
|
|
382
|
+
// 📱 Responsive & Detection
|
|
383
|
+
useWindowSize: true, // Reactive window dimensions
|
|
384
|
+
useBreakpoints: true, // Responsive breakpoints
|
|
385
|
+
useUserVisibility: true, // Page visibility detection
|
|
386
|
+
useIdleTimeout: true, // User idle detection
|
|
387
|
+
|
|
388
|
+
// 🛠️ Utilities
|
|
389
|
+
useTimer: true, // Timer and countdown
|
|
390
|
+
useFormValidator: true, // Form validation
|
|
391
|
+
useStringMatching: true, // String utilities
|
|
392
|
+
useReadingTime: true, // Reading time calculation
|
|
393
|
+
useDisplayNames: true, // Display localized names
|
|
394
|
+
useSwipe: true, // Swipe gestures
|
|
395
|
+
usePullToRefresh: true, // Pull to refresh gesture
|
|
396
|
+
|
|
397
|
+
// 🔧 Advanced
|
|
398
|
+
useFreezeValue: true, // Freeze reactive values
|
|
399
|
+
useInjectStrict: true, // Strict dependency injection
|
|
400
|
+
useInstanceUniqId: true, // Unique IDs generation
|
|
401
|
+
useMountComponent: true, // Dynamic component mounting
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Plugins
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
const plugins = {
|
|
409
|
+
// Animations
|
|
410
|
+
aos: true,
|
|
411
|
+
// 🎭 Display modales without any implementation in template
|
|
412
|
+
dialog: true,
|
|
413
|
+
// 🎭 UI Notifications
|
|
414
|
+
toast: true,
|
|
415
|
+
// 🔄 Loading States
|
|
416
|
+
wait: true,
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Directives
|
|
421
|
+
|
|
422
|
+
Powerful Vue directives for enhanced functionality:
|
|
423
|
+
|
|
424
|
+
```ts
|
|
425
|
+
const directives = {
|
|
426
|
+
// Image directives
|
|
427
|
+
vLazyImg: { threshold: 0.1 }, // Lazy loading with intersection observer
|
|
428
|
+
vZoomImg: true, // Click to zoom images
|
|
429
|
+
vFullscreenImg: true, // Fullscreen image viewer
|
|
430
|
+
|
|
431
|
+
// Interaction directives
|
|
432
|
+
vTooltip: { position: 'top' }, // Flexible tooltips
|
|
433
|
+
vClickOutside: true, // Detect outside clicks
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### AI Agents
|
|
438
|
+
|
|
439
|
+
Connect your AI coding agents (Claude Code, Cursor, GitHub Copilot, Codex, Windsurf...) to maz-ui, version-matched with the installed maz-ui, so they use its components, composables, icons, helpers and theme tokens instead of re-implementing them:
|
|
440
|
+
|
|
441
|
+
```ts
|
|
442
|
+
const agents = {
|
|
443
|
+
// Register the maz-ui MCP server in .mcp.json, .cursor/mcp.json, .vscode/mcp.json (default: true)
|
|
444
|
+
// Its instructions give the maz-ui rules to the agents
|
|
445
|
+
mcp: true,
|
|
446
|
+
// Also write the rules in .claude/rules/maz-ui.md and in AGENTS.md, for agents without MCP (default: false)
|
|
447
|
+
rules: false,
|
|
448
|
+
// 'claude' | 'agents-md' | 'cursor' | 'vscode' (default: the detected agents)
|
|
449
|
+
targets: ['claude', 'agents-md'],
|
|
450
|
+
}
|
|
451
|
+
// agents: true enables mcp and rules, agents: false disables everything
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
The module runs in development only (never in CI nor in tests), only for the agents it detects in the project (`.claude/`, `CLAUDE.md`, `.mcp.json`, `.cursor/`, `.vscode/mcp.json`, `.github/copilot-instructions.md`, `AGENTS.md`, `.codex/`, `.windsurf/`...), and keeps the files up to date when you upgrade maz-ui:
|
|
455
|
+
|
|
456
|
+
- `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`: a `maz-ui` server entry, added only when no maz-ui MCP server is already registered
|
|
457
|
+
- with `rules: true`, `.claude/rules/maz-ui.md`: a Claude Code rule (skipped when Claude reads `AGENTS.md`, i.e. without `CLAUDE.md`)
|
|
458
|
+
- with `rules: true`, `AGENTS.md`: a section delimited by `<!-- BEGIN:maz-ui -->` and `<!-- END:maz-ui -->`, read by Codex, Cursor, Copilot, Windsurf...
|
|
459
|
+
|
|
460
|
+
It never overwrites a file it does not own: your `CLAUDE.md`, your own rules and the other MCP servers are left untouched. Commit the generated files to share them with your team. See the [AI agents guide](../guide/ai-agents.md) for details.
|
|
461
|
+
|
|
462
|
+
## Advanced Theming
|
|
463
|
+
|
|
464
|
+
### Custom Theme Creation
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
import { definePreset } from '@maz-ui/themes'
|
|
468
|
+
|
|
469
|
+
export const customTheme = definePreset({
|
|
470
|
+
base: 'maz-ui',
|
|
471
|
+
overrides: {
|
|
472
|
+
name: 'custom',
|
|
473
|
+
foundation: {
|
|
474
|
+
'base-font-size': '14px',
|
|
475
|
+
'font-family': `Manrope, sans-serif, system-ui, -apple-system`,
|
|
476
|
+
'space': '0.25rem',
|
|
477
|
+
'border-width': '0.0625rem',
|
|
478
|
+
},
|
|
479
|
+
scales: {
|
|
480
|
+
rounded: { md: '0.7rem' },
|
|
481
|
+
},
|
|
482
|
+
colors: {
|
|
483
|
+
light: {
|
|
484
|
+
primary: 'oklch(0.65 0.27 5)', // Custom pink
|
|
485
|
+
secondary: 'oklch(0.96 0.01 5)',
|
|
486
|
+
surface: 'oklch(1 0 0)',
|
|
487
|
+
foreground: 'oklch(0.16 0.02 254)',
|
|
488
|
+
muted: 'oklch(0.6 0.01 254)',
|
|
489
|
+
accent: 'oklch(0.7 0.05 5)',
|
|
490
|
+
destructive: 'oklch(0.6 0.22 27)',
|
|
491
|
+
divider: 'oklch(0.92 0.005 254)',
|
|
492
|
+
},
|
|
493
|
+
dark: {
|
|
494
|
+
primary: 'oklch(0.75 0.22 5)',
|
|
495
|
+
secondary: 'oklch(0.24 0.02 5)',
|
|
496
|
+
surface: 'oklch(0.16 0.02 254)',
|
|
497
|
+
foreground: 'oklch(0.96 0.005 254)',
|
|
498
|
+
muted: 'oklch(0.6 0.01 254)',
|
|
499
|
+
accent: 'oklch(0.3 0.04 5)',
|
|
500
|
+
destructive: 'oklch(0.55 0.2 27)',
|
|
501
|
+
divider: 'oklch(0.3 0.01 254)',
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
})
|
|
506
|
+
|
|
507
|
+
export default defineNuxtConfig({
|
|
508
|
+
modules: ['@maz-ui/nuxt'],
|
|
509
|
+
mazUi: {
|
|
510
|
+
theme: {
|
|
511
|
+
preset: customTheme,
|
|
512
|
+
strategy: 'runtime',
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
})
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
**Tip: Subtree Overrides with MazUiProvider**
|
|
519
|
+
|
|
520
|
+
You can use [`MazUiProvider`](../guide/maz-ui-provider.md) within a Nuxt app to override theme or translations in a specific subtree, while the module handles global defaults.
|
|
521
|
+
|
|
522
|
+
## Troubleshooting
|
|
523
|
+
|
|
524
|
+
### Theme System Issues
|
|
525
|
+
|
|
526
|
+
If you encounter the error `"useTheme must be used within MazUi plugin or MazUiTheme plugin installation"`, ensure that:
|
|
527
|
+
|
|
528
|
+
1. **Enable useTheme composable** in your configuration:
|
|
529
|
+
|
|
530
|
+
```ts
|
|
531
|
+
export default defineNuxtConfig({
|
|
532
|
+
mazUi: {
|
|
533
|
+
composables: {
|
|
534
|
+
useTheme: true,
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
})
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
2. **Theme system is not disabled**:
|
|
541
|
+
|
|
542
|
+
```ts
|
|
543
|
+
export default defineNuxtConfig({
|
|
544
|
+
mazUi: {
|
|
545
|
+
theme: {
|
|
546
|
+
// theme config, not false
|
|
547
|
+
preset: 'maz-ui'
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
})
|
|
551
|
+
```
|