@maz-ui/mcp 5.0.0-beta.6 → 5.0.0-beta.9
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/mcp.mjs +1 -1
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +1 -1
- package/docs/generated-docs/maz-code-highlight.doc.md +11 -0
- package/docs/generated-docs/maz-drawer.doc.md +1 -1
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +5 -5
- package/docs/generated-docs/maz-gallery.doc.md +15 -15
- package/docs/generated-docs/maz-sidebar-content.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-footer.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-group.doc.md +11 -0
- package/docs/generated-docs/maz-sidebar-header.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-menu-button.doc.md +26 -0
- package/docs/generated-docs/maz-sidebar-menu-item.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +16 -0
- package/docs/generated-docs/maz-sidebar-menu.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +11 -0
- package/docs/generated-docs/maz-sidebar.doc.md +33 -0
- package/docs/generated-docs/maz-slider.doc.md +1 -1
- package/docs/generated-docs/maz-spinner.doc.md +4 -4
- package/docs/generated-docs/maz-ticker.doc.md +1 -1
- package/docs/generated-docs/maz-window-mockup.doc.md +23 -0
- package/docs/src/blog/v5.md +1 -3
- package/docs/src/components/maz-code-highlight.md +233 -0
- package/docs/src/components/maz-sidebar.md +621 -0
- package/docs/src/components/maz-timeline.md +60 -0
- package/docs/src/components/maz-window-mockup.md +249 -0
- package/docs/src/directives/click-outside.md +7 -14
- package/docs/src/directives/lazy-img.md +4 -4
- package/docs/src/guide/getting-started.md +13 -11
- package/docs/src/guide/maz-ui-provider.md +6 -3
- package/docs/src/guide/migration-v4.md +7 -3
- package/docs/src/guide/migration-v5.md +67 -12
- package/docs/src/guide/nuxt.md +53 -46
- package/docs/src/guide/tailwind.md +4 -0
- package/docs/src/guide/themes.md +127 -69
- package/docs/src/helpers/capitalize.md +2 -3
- package/docs/src/helpers/currency.md +2 -2
- package/docs/src/helpers/date.md +2 -2
- package/docs/src/helpers/number.md +2 -2
- package/docs/src/plugins/wait.md +1 -1
- package/package.json +3 -3
|
@@ -9,6 +9,21 @@ description: MazTimeline is a step/progress timeline component for Vue 3 with su
|
|
|
9
9
|
|
|
10
10
|
<!--@include: ./../../.vitepress/mixins/getting-started.md-->
|
|
11
11
|
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Control the current step:
|
|
15
|
+
|
|
16
|
+
<MazRadioButtons
|
|
17
|
+
:model-value="currentStep"
|
|
18
|
+
size="sm"
|
|
19
|
+
:options="[
|
|
20
|
+
{ label: 'None', value: -1 },
|
|
21
|
+
...steps.map((step, index) => ({ label: index, value: index })),
|
|
22
|
+
{ label: 'All Completed', value: 99 },
|
|
23
|
+
]"
|
|
24
|
+
@update:model-value="currentStep = $event"
|
|
25
|
+
/>
|
|
26
|
+
|
|
12
27
|
## Basic usage
|
|
13
28
|
|
|
14
29
|
<ComponentDemo>
|
|
@@ -292,6 +307,40 @@ Customize the indicator border radius with the `rounded-size` prop.
|
|
|
292
307
|
</template>
|
|
293
308
|
</ComponentDemo>
|
|
294
309
|
|
|
310
|
+
## Custom Icons
|
|
311
|
+
|
|
312
|
+
<ComponentDemo>
|
|
313
|
+
<MazTimeline :model-value="0" :steps="iconsSteps" direction="horizontal" size="lg" />
|
|
314
|
+
|
|
315
|
+
<template #code>
|
|
316
|
+
|
|
317
|
+
```vue
|
|
318
|
+
<template>
|
|
319
|
+
<MazTimeline
|
|
320
|
+
v-model="currentStep"
|
|
321
|
+
:steps="steps"
|
|
322
|
+
size="lg"
|
|
323
|
+
/>
|
|
324
|
+
</template>
|
|
325
|
+
|
|
326
|
+
<script lang="ts" setup>
|
|
327
|
+
import { MazCommandLine } from '@maz-ui/icons/MazCommandLine'
|
|
328
|
+
import { MazClipboardDocumentList } from '@maz-ui/icons/MazClipboardDocumentList'
|
|
329
|
+
import { MazClipboardDocumentCheck } from '@maz-ui/icons/MazClipboardDocumentCheck'
|
|
330
|
+
import { MazComputerDesktop } from '@maz-ui/icons/MazComputerDesktop'
|
|
331
|
+
|
|
332
|
+
const iconsSteps = [
|
|
333
|
+
{ title: 'PO', subtitle: 'Writing PRD', icon: MazClipboardDocumentList },
|
|
334
|
+
{ title: 'Dev', subtitle: 'Building Code', icon: MazCommandLine },
|
|
335
|
+
{ title: 'Tech Lead', subtitle: 'Review Code', icon: MazComputerDesktop },
|
|
336
|
+
{ title: 'QA', subtitle: 'Testing', icon: MazClipboardDocumentCheck },
|
|
337
|
+
]
|
|
338
|
+
</script>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
</template>
|
|
342
|
+
</ComponentDemo>
|
|
343
|
+
|
|
295
344
|
## Custom slots
|
|
296
345
|
|
|
297
346
|
MazTimeline provides scoped slots for full customization.
|
|
@@ -378,6 +427,10 @@ MazTimeline provides scoped slots for full customization.
|
|
|
378
427
|
|
|
379
428
|
<script lang="ts" setup>
|
|
380
429
|
import { ref } from 'vue'
|
|
430
|
+
import { MazComputerDesktop } from '@maz-ui/icons/MazComputerDesktop'
|
|
431
|
+
import { MazCommandLine } from '@maz-ui/icons/MazCommandLine'
|
|
432
|
+
import { MazClipboardDocumentList } from '@maz-ui/icons/MazClipboardDocumentList'
|
|
433
|
+
import { MazClipboardDocumentCheck } from '@maz-ui/icons/MazClipboardDocumentCheck'
|
|
381
434
|
|
|
382
435
|
const currentStep = ref(1)
|
|
383
436
|
const clickableStep = ref(0)
|
|
@@ -410,6 +463,13 @@ MazTimeline provides scoped slots for full customization.
|
|
|
410
463
|
{ title: 'Complete', subtitle: 'All done!' },
|
|
411
464
|
]
|
|
412
465
|
|
|
466
|
+
const iconsSteps = [
|
|
467
|
+
{ title: 'PO', subtitle: 'Writing PRD', icon: MazClipboardDocumentList },
|
|
468
|
+
{ title: 'Dev', subtitle: 'Building Code', icon: MazCommandLine },
|
|
469
|
+
{ title: 'Tech Lead', subtitle: 'Review Code', icon: MazComputerDesktop },
|
|
470
|
+
{ title: 'QA', subtitle: 'Testing', icon: MazClipboardDocumentCheck },
|
|
471
|
+
]
|
|
472
|
+
|
|
413
473
|
const colors = ['primary', 'secondary', 'info', 'success', 'warning', 'destructive']
|
|
414
474
|
const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
415
475
|
const roundedSizes = ['full', 'lg', 'md', 'sm', 'none']
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MazWindowMockup
|
|
3
|
+
description: MazWindowMockup renders a macOS-style window frame in three variants — browser, terminal, and editor — to showcase content, demos, or code examples in your documentation or UI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
<!--@include: ./../../.vitepress/mixins/getting-started.md-->
|
|
11
|
+
|
|
12
|
+
::: info Optional: shiki for code variants
|
|
13
|
+
When you pass the `code` prop, `MazWindowMockup` mounts `MazCodeHighlight` internally for syntax highlighting. This requires the [`shiki`](https://shiki.style) optional peer dependency to be installed. See the [MazCodeHighlight installation note](/components/maz-code-highlight#installation-requirement).
|
|
14
|
+
:::
|
|
15
|
+
|
|
16
|
+
## Browser variant
|
|
17
|
+
|
|
18
|
+
The default variant. Displays an address bar with the `url` prop and a copy-URL button on the right side of the bar.
|
|
19
|
+
|
|
20
|
+
<ComponentDemo>
|
|
21
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="100px">
|
|
22
|
+
<div style="padding: 1rem; text-align: center;">Browser content goes here</div>
|
|
23
|
+
</MazWindowMockup>
|
|
24
|
+
|
|
25
|
+
<template #code>
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<template>
|
|
29
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="100px">
|
|
30
|
+
<div>Browser content goes here</div>
|
|
31
|
+
</MazWindowMockup>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script lang="ts" setup>
|
|
35
|
+
import MazWindowMockup from 'maz-ui/components/MazWindowMockup'
|
|
36
|
+
</script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
</template>
|
|
40
|
+
</ComponentDemo>
|
|
41
|
+
|
|
42
|
+
### Hide the URL copy button
|
|
43
|
+
|
|
44
|
+
Set `:hide-url-copy="true"` to remove the copy-URL button from the title bar.
|
|
45
|
+
|
|
46
|
+
<ComponentDemo>
|
|
47
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="80px" :hide-url-copy="true" />
|
|
48
|
+
|
|
49
|
+
<template #code>
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<template>
|
|
53
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="80px" :hide-url-copy="true" />
|
|
54
|
+
</template>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
</template>
|
|
58
|
+
</ComponentDemo>
|
|
59
|
+
|
|
60
|
+
### With screenshot
|
|
61
|
+
|
|
62
|
+
Use this variant to display a screenshot of a website.
|
|
63
|
+
|
|
64
|
+
<ComponentDemo>
|
|
65
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="100px">
|
|
66
|
+
<img :src="screenshot" alt="Maz UI Demo Dashboard" width="100%">
|
|
67
|
+
</MazWindowMockup>
|
|
68
|
+
|
|
69
|
+
<template #code>
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="100px">
|
|
74
|
+
<img src="/img/screenshots/maz-ui-home-desktop.webp" alt="Maz UI Demo Dashboard" width="100%">
|
|
75
|
+
</MazWindowMockup>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script lang="ts" setup>
|
|
79
|
+
import MazWindowMockup from 'maz-ui/components/MazWindowMockup'
|
|
80
|
+
</script>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</template>
|
|
84
|
+
</ComponentDemo>
|
|
85
|
+
|
|
86
|
+
## Terminal variant
|
|
87
|
+
|
|
88
|
+
Displays a centered title and a `$` prompt prefix in front of the code (when `code` is provided). The prompt prefix is **not** copied to the clipboard — the copy button only writes the raw `code` value.
|
|
89
|
+
|
|
90
|
+
<ComponentDemo>
|
|
91
|
+
<MazWindowMockup variant="terminal" title="zsh" code="pnpm add maz-ui" language="bash" />
|
|
92
|
+
|
|
93
|
+
<template #code>
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<template>
|
|
97
|
+
<MazWindowMockup variant="terminal" title="zsh" code="pnpm add maz-ui" language="bash" />
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script lang="ts" setup>
|
|
101
|
+
import MazWindowMockup from 'maz-ui/components/MazWindowMockup'
|
|
102
|
+
</script>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
</template>
|
|
106
|
+
</ComponentDemo>
|
|
107
|
+
|
|
108
|
+
### Custom prompt
|
|
109
|
+
|
|
110
|
+
Replace the default `$` with any character via the `prompt` prop.
|
|
111
|
+
|
|
112
|
+
<ComponentDemo>
|
|
113
|
+
<MazWindowMockup variant="terminal" code="git status" language="bash" prompt="❯" />
|
|
114
|
+
|
|
115
|
+
<template #code>
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<template>
|
|
119
|
+
<MazWindowMockup variant="terminal" code="git status" language="bash" prompt="❯" />
|
|
120
|
+
</template>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
</template>
|
|
124
|
+
</ComponentDemo>
|
|
125
|
+
|
|
126
|
+
### Without prompt
|
|
127
|
+
|
|
128
|
+
Hide the default prompt by setting `hide-prompt` to `true`.
|
|
129
|
+
|
|
130
|
+
<ComponentDemo>
|
|
131
|
+
<MazWindowMockup variant="terminal" code="git status" language="bash" :hide-prompt="true" />
|
|
132
|
+
|
|
133
|
+
<template #code>
|
|
134
|
+
|
|
135
|
+
```vue
|
|
136
|
+
<template>
|
|
137
|
+
<MazWindowMockup variant="terminal" code="git status" language="bash" :hide-prompt="true" />
|
|
138
|
+
</template>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
</template>
|
|
142
|
+
</ComponentDemo>
|
|
143
|
+
|
|
144
|
+
## Editor variant
|
|
145
|
+
|
|
146
|
+
Shows a filename tab anchored to the bottom of the title bar — matching the look of real editors like VSCode.
|
|
147
|
+
|
|
148
|
+
<ComponentDemo>
|
|
149
|
+
<MazWindowMockup variant="editor" filename="App.vue" :code="vueCode" language="vue" />
|
|
150
|
+
|
|
151
|
+
<template #code>
|
|
152
|
+
|
|
153
|
+
```vue
|
|
154
|
+
<template>
|
|
155
|
+
<MazWindowMockup variant="editor" filename="App.vue" :code="vueCode" language="vue" />
|
|
156
|
+
</template>
|
|
157
|
+
|
|
158
|
+
<script lang="ts" setup>
|
|
159
|
+
import MazWindowMockup from 'maz-ui/components/MazWindowMockup'
|
|
160
|
+
|
|
161
|
+
const vueCode = `<template>
|
|
162
|
+
<MazBtn>Click me</MazBtn>
|
|
163
|
+
</template>`
|
|
164
|
+
</script>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
</template>
|
|
168
|
+
</ComponentDemo>
|
|
169
|
+
|
|
170
|
+
## With code and language props
|
|
171
|
+
|
|
172
|
+
Pass `code` and `language` to display highlighted source code via `MazCodeHighlight`. The inner highlighter automatically renders with squared corners so it sits flush against the window's border.
|
|
173
|
+
|
|
174
|
+
<ComponentDemo>
|
|
175
|
+
<MazWindowMockup code="import MazBtn from 'maz-ui/components/MazBtn'" language="ts" />
|
|
176
|
+
|
|
177
|
+
<template #code>
|
|
178
|
+
|
|
179
|
+
```vue
|
|
180
|
+
<template>
|
|
181
|
+
<MazWindowMockup code="import MazBtn from 'maz-ui/components/MazBtn'" language="ts" />
|
|
182
|
+
</template>
|
|
183
|
+
|
|
184
|
+
<script lang="ts" setup>
|
|
185
|
+
import MazWindowMockup from 'maz-ui/components/MazWindowMockup'
|
|
186
|
+
</script>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
</template>
|
|
190
|
+
</ComponentDemo>
|
|
191
|
+
|
|
192
|
+
## Empty-state placeholder
|
|
193
|
+
|
|
194
|
+
When neither `code` nor a slot content is provided, the content area renders an empty placeholder. Pass the optional `label` prop to display a centered text inside it.
|
|
195
|
+
|
|
196
|
+
<ComponentDemo>
|
|
197
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="160px" label="Preview" />
|
|
198
|
+
|
|
199
|
+
<template #code>
|
|
200
|
+
|
|
201
|
+
```vue
|
|
202
|
+
<template>
|
|
203
|
+
<MazWindowMockup url="https://maz-ui.com" min-height="160px" label="Preview" />
|
|
204
|
+
</template>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
</template>
|
|
208
|
+
</ComponentDemo>
|
|
209
|
+
|
|
210
|
+
## Custom translations
|
|
211
|
+
|
|
212
|
+
The URL copy button's aria-label and tooltip come from the `@maz-ui/translations` package (`windowMockup.copyUrlToClipboard` / `windowMockup.urlCopiedToClipboard`). Override per-instance with the `translations` prop:
|
|
213
|
+
|
|
214
|
+
<ComponentDemo>
|
|
215
|
+
<MazWindowMockup
|
|
216
|
+
url="https://maz-ui.com"
|
|
217
|
+
min-height="80px"
|
|
218
|
+
:translations="{ copyUrlToClipboard: 'Copier l\'URL', urlCopiedToClipboard: 'URL copiée !' }"
|
|
219
|
+
/>
|
|
220
|
+
|
|
221
|
+
<template #code>
|
|
222
|
+
|
|
223
|
+
```vue
|
|
224
|
+
<template>
|
|
225
|
+
<MazWindowMockup
|
|
226
|
+
url="https://maz-ui.com"
|
|
227
|
+
min-height="80px"
|
|
228
|
+
:translations="{
|
|
229
|
+
copyUrlToClipboard: 'Copier l\'URL',
|
|
230
|
+
urlCopiedToClipboard: 'URL copiée !',
|
|
231
|
+
}"
|
|
232
|
+
/>
|
|
233
|
+
</template>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
</template>
|
|
237
|
+
</ComponentDemo>
|
|
238
|
+
|
|
239
|
+
For app-wide translations, set up the [maz-ui translations plugin](/translations) and the component will pick up your locale automatically.
|
|
240
|
+
|
|
241
|
+
<script lang="ts" setup>
|
|
242
|
+
import screenshot from './../assets/interface-screenshot.png'
|
|
243
|
+
|
|
244
|
+
const vueCode = `<template>
|
|
245
|
+
<MazBtn>Click me</MazBtn>
|
|
246
|
+
</template>`
|
|
247
|
+
</script>
|
|
248
|
+
|
|
249
|
+
<!--@include: ./../../.vitepress/generated-docs/maz-window-mockup.doc.md-->
|
|
@@ -11,8 +11,7 @@ description: vClickOutside is a Vue directive to trigger a function when the use
|
|
|
11
11
|
|
|
12
12
|
<ComponentDemo>
|
|
13
13
|
<div
|
|
14
|
-
|
|
15
|
-
class="maz:flex maz:flex-center maz:rounded-md"
|
|
14
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:p-12 maz:bg-surface-300"
|
|
16
15
|
>
|
|
17
16
|
<MazCard v-click-outside="clikedOutside">
|
|
18
17
|
Click outside me
|
|
@@ -21,8 +20,7 @@ description: vClickOutside is a Vue directive to trigger a function when the use
|
|
|
21
20
|
|
|
22
21
|
<div
|
|
23
22
|
v-if="hasClikedOutside"
|
|
24
|
-
|
|
25
|
-
class="maz:flex maz:flex-center maz:rounded-md"
|
|
23
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:bg-sucess maz:text-success-foreground maz:p-4 maz:mt-4"
|
|
26
24
|
>
|
|
27
25
|
You clicked outside
|
|
28
26
|
</div>
|
|
@@ -44,8 +42,7 @@ function clikedOutside() {
|
|
|
44
42
|
|
|
45
43
|
<template>
|
|
46
44
|
<div
|
|
47
|
-
|
|
48
|
-
class="flex flex-center rounded"
|
|
45
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:p-12 maz:bg-surface-300"
|
|
49
46
|
>
|
|
50
47
|
<MazCard v-click-outside="clikedOutside">
|
|
51
48
|
Click outside me
|
|
@@ -54,8 +51,7 @@ function clikedOutside() {
|
|
|
54
51
|
|
|
55
52
|
<div
|
|
56
53
|
v-if="hasClikedOutside"
|
|
57
|
-
|
|
58
|
-
class="flex flex-center rounded"
|
|
54
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:bg-sucess maz:text-success-foreground maz:p-4 maz:mt-4"
|
|
59
55
|
>
|
|
60
56
|
You clicked outside
|
|
61
57
|
</div>
|
|
@@ -71,8 +67,7 @@ The directive can accept an options object to customize its behavior:
|
|
|
71
67
|
|
|
72
68
|
<ComponentDemo>
|
|
73
69
|
<div
|
|
74
|
-
|
|
75
|
-
class="maz:flex maz:flex-center maz:rounded-md"
|
|
70
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:p-12 maz:bg-surface-300"
|
|
76
71
|
>
|
|
77
72
|
<MazCard v-click-outside="{ callback: clickedOutsideWithIgnore, ignore: ['.ignore-me'] }">
|
|
78
73
|
<div class="maz:p-4">
|
|
@@ -86,8 +81,7 @@ The directive can accept an options object to customize its behavior:
|
|
|
86
81
|
|
|
87
82
|
<div
|
|
88
83
|
v-if="hasClickedOutsideWithIgnore"
|
|
89
|
-
|
|
90
|
-
class="maz:flex maz:flex-center maz:rounded-md"
|
|
84
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:bg-sucess maz:text-success-foreground maz:p-4 maz:mt-4"
|
|
91
85
|
>
|
|
92
86
|
You clicked outside (button clicks are ignored)
|
|
93
87
|
</div>
|
|
@@ -128,8 +122,7 @@ The directive can be configured to trigger only once:
|
|
|
128
122
|
|
|
129
123
|
<ComponentDemo>
|
|
130
124
|
<div
|
|
131
|
-
|
|
132
|
-
class="maz:flex maz:flex-center maz:rounded-md"
|
|
125
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:p-12 maz:bg-surface-300"
|
|
133
126
|
>
|
|
134
127
|
<MazCard v-click-outside="{ callback: clickedOnce, once: true }">
|
|
135
128
|
Click outside me (works only once)
|
|
@@ -10,7 +10,7 @@ description: vLazyImg is a Vue directive to lazy load images with many options.
|
|
|
10
10
|
## Basic usage
|
|
11
11
|
|
|
12
12
|
<img
|
|
13
|
-
style="background-color: var(--maz-surface-300); width: 80%;"
|
|
13
|
+
style="background-color: var(--maz-color-surface-300); width: 80%;"
|
|
14
14
|
class="flex flex-center rounded"
|
|
15
15
|
v-lazy-img="'https://placedog.net/1500/1000'"
|
|
16
16
|
/>
|
|
@@ -23,7 +23,7 @@ import { vLazyImg } from 'maz-ui/directives'
|
|
|
23
23
|
<template>
|
|
24
24
|
<img
|
|
25
25
|
v-lazy-img="'https://placedog.net/1500/1000'"
|
|
26
|
-
style="background-color: var(--maz-surface-300); width: 80%;"
|
|
26
|
+
style="background-color: var(--maz-color-surface-300); width: 80%;"
|
|
27
27
|
class="flex flex-center rounded"
|
|
28
28
|
>
|
|
29
29
|
</template>
|
|
@@ -54,7 +54,7 @@ import { vLazyImg } from 'maz-ui/directives'
|
|
|
54
54
|
> Open the developer console to show logs
|
|
55
55
|
|
|
56
56
|
<img
|
|
57
|
-
style="background-color: var(--maz-surface-300); width: 80%;"
|
|
57
|
+
style="background-color: var(--maz-color-surface-300); width: 80%;"
|
|
58
58
|
class="flex flex-center rounded"
|
|
59
59
|
v-lazy-img="lazyBinding"
|
|
60
60
|
/>
|
|
@@ -83,7 +83,7 @@ const lazyBinding: vLazyImgBindingValue = {
|
|
|
83
83
|
<template>
|
|
84
84
|
<img
|
|
85
85
|
v-lazy-img="lazyBinding"
|
|
86
|
-
style="background-color: var(--maz-surface-300); width: 80%;"
|
|
86
|
+
style="background-color: var(--maz-color-surface-300); width: 80%;"
|
|
87
87
|
class="flex flex-center rounded"
|
|
88
88
|
>
|
|
89
89
|
</template>
|
|
@@ -93,8 +93,9 @@ npm install @maz-ui/themes
|
|
|
93
93
|
|
|
94
94
|
**Features:**
|
|
95
95
|
|
|
96
|
-
- 🎨
|
|
97
|
-
- 🌓 Smart dark mode
|
|
96
|
+
- 🎨 Native `light-dark()` + `color-scheme` + OKLCh scales via relative color syntax
|
|
97
|
+
- 🌓 Smart dark mode — `class` or `media` strategies, with smooth transitions on toggle
|
|
98
|
+
- ✨ Optional animated theme switch via View Transitions (`setColorMode(..., { animate: true })`)
|
|
98
99
|
- ⚡ `runtime` and `buildtime` rendering strategies
|
|
99
100
|
- 🍪 Active preset persisted across reloads (opt-out)
|
|
100
101
|
- 🛡️ Full TypeScript support
|
|
@@ -163,15 +164,6 @@ npm install @maz-ui/icons
|
|
|
163
164
|
Maz-UI v5 is built with tree-shaking in mind. Import only what you need for optimal bundle sizes:
|
|
164
165
|
|
|
165
166
|
```typescript
|
|
166
|
-
/**
|
|
167
|
-
* Utilities
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
// ❌ Avoid importing everything
|
|
171
|
-
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
172
|
-
// ✅ Import from @maz-ui/utils
|
|
173
|
-
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
174
|
-
|
|
175
167
|
/**
|
|
176
168
|
* Components
|
|
177
169
|
*/
|
|
@@ -215,6 +207,16 @@ import { vClickOutside } from 'maz-ui/directives/vClickOutside'
|
|
|
215
207
|
import { MazUi } from 'maz-ui/plugins'
|
|
216
208
|
// ✅✅ Direct plugin import (most optimized)
|
|
217
209
|
import { MazUi } from 'maz-ui/plugins/maz-ui'
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Utilities
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
// ❌ Avoid importing everything
|
|
216
|
+
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
217
|
+
// ✅ Import from @maz-ui/utils
|
|
218
|
+
import { debounce } from '@maz-ui/utils/helpers/debounce'
|
|
219
|
+
import { formatCurrency } from '@maz-ui/utils/helpers/formatCurrency'
|
|
218
220
|
```
|
|
219
221
|
|
|
220
222
|
::: tip Maximum Optimization
|
|
@@ -97,12 +97,15 @@ The entire Maz-UI setup is now code-split into the Dashboard chunk.
|
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
interface ThemeOptions {
|
|
100
|
-
preset: ThemePreset
|
|
101
|
-
overrides?: ThemePresetOverrides
|
|
102
|
-
strategy?: 'runtime' | 'buildtime'
|
|
100
|
+
preset: ThemePreset // Required - Theme preset (mazUi, ocean, pristine, obsidian, nova, or custom)
|
|
101
|
+
overrides?: ThemePresetOverrides // Partial overrides for colors, foundation, etc.
|
|
102
|
+
strategy?: 'runtime' | 'buildtime' // CSS generation strategy (default: 'runtime')
|
|
103
103
|
darkModeStrategy?: 'class' | 'media' // Dark mode handling (default: 'class')
|
|
104
104
|
colorMode?: 'light' | 'dark' | 'auto' // Initial color mode (default: 'auto')
|
|
105
105
|
mode?: 'light' | 'dark' | 'both' // Supported color modes (default: 'both')
|
|
106
|
+
darkClass?: string // Class on <html> when colorMode === 'dark' (default: 'dark')
|
|
107
|
+
lightClass?: string // Class on <html> when colorMode === 'light' (default: 'light')
|
|
108
|
+
persistPreset?: boolean // Persist active preset in cookie (default: true)
|
|
106
109
|
}
|
|
107
110
|
```
|
|
108
111
|
|
|
@@ -41,6 +41,10 @@ v4.0.0 isn't just an update, it's a **complete rebuild** that transforms Maz-UI
|
|
|
41
41
|
- **Dynamic CSS Variables**: Automatic CSS variable generation
|
|
42
42
|
- **Intelligent dark mode**: Configurable strategies for dark mode based on system preferences and user choice stored in cookies
|
|
43
43
|
|
|
44
|
+
::: tip Theming further evolved in v5
|
|
45
|
+
The theme system has been rewritten on top of native `light-dark()` + `color-scheme` + `color-mix(in oklch)` in v5. If you are upgrading past v4, see the dedicated [v5 migration guide](./migration-v5.md#theming-native-css-rewrite-new-non-breaking-by-default) for the full theming changes (new `lightClass`, `Promise<void>` returns, removed JS helpers).
|
|
46
|
+
:::
|
|
47
|
+
|
|
44
48
|
#### Complete Internationalization
|
|
45
49
|
|
|
46
50
|
- **9 supported languages by default**: EN, FR, DE, ES, IT, PT, JA, ZH-CN
|
|
@@ -688,12 +692,12 @@ app.use(MazUi, {
|
|
|
688
692
|
<script setup>
|
|
689
693
|
import { useTheme } from 'maz-ui/composables'
|
|
690
694
|
|
|
691
|
-
const { isDark, toggleDarkMode,
|
|
695
|
+
const { isDark, toggleDarkMode, updateTheme } = useTheme()
|
|
692
696
|
|
|
693
697
|
// Change theme
|
|
694
|
-
|
|
698
|
+
updateTheme('ocean')
|
|
695
699
|
|
|
696
|
-
// Toggle dark mode
|
|
700
|
+
// Toggle dark mode (v5: returns Promise<void>, optional { animate } param)
|
|
697
701
|
toggleDarkMode()
|
|
698
702
|
</script>
|
|
699
703
|
|
|
@@ -23,7 +23,7 @@ npx @maz-ui/upgrade ./ --dry-run
|
|
|
23
23
|
npx @maz-ui/upgrade ./
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
It
|
|
26
|
+
It handles the mechanical part of the migration (CSS subpath imports, prop renames, CSS var renames, Nuxt config keys, custom preset color keys, and `package.json` version bumps)
|
|
27
27
|
|
|
28
28
|
What it can't decide for you: the `MazIcon` API simplification (section 4), `MazBadge` numeric size mapping (section 9), `foundation.radius` → `scales.rounded.md` reshape (section 11) and `MazChart` `update-mode` defaults (section 8). Those are best handled with the MCP server below.
|
|
29
29
|
|
|
@@ -557,7 +557,7 @@ rg "color\s*=\s*['\"]background['\"]" src/
|
|
|
557
557
|
|
|
558
558
|
### Theme colors are now emitted as OKLCh
|
|
559
559
|
|
|
560
|
-
`@maz-ui/themes` now ships its bundled presets (`mazUi`, `ocean`, `pristine`, `obsidian`) in `oklch()` form, and the
|
|
560
|
+
`@maz-ui/themes` now ships its bundled presets (`mazUi`, `ocean`, `pristine`, `obsidian`, `nova`) in `oklch()` form, and the runtime CSS variables (`--maz-primary`, `--maz-primary-100`, …) therefore hold OKLCh colors. The 50–950 scale is derived in CSS via OKLCh relative color syntax — `oklch(from var(--maz-X) clamp(0, calc(l ± offset), 1) calc(c * mult) h)` — perceptually uniform, chroma-preserving, and live-reactive to base color overrides.
|
|
561
561
|
|
|
562
562
|
This is **transparent for consumers**:
|
|
563
563
|
|
|
@@ -568,16 +568,8 @@ This is **transparent for consumers**:
|
|
|
568
568
|
|
|
569
569
|
You only need to do something if you were:
|
|
570
570
|
|
|
571
|
-
- **Reading the channel format** of a color from `--maz-*` in JS — the value used to be an `hsl(...)` string, it's now an `oklch(...)` string. Use `getComputedStyle(...).getPropertyValue(...)` and a CSS color parser if you need channels.
|
|
572
|
-
- **Calling
|
|
573
|
-
|
|
574
|
-
```ts
|
|
575
|
-
// v4: HSL L percentage
|
|
576
|
-
adjustColorLightness('hsl(210 50% 40%)', 20) // → 'hsl(210 50% 60%)'
|
|
577
|
-
|
|
578
|
-
// v5: OKLCh L (0..1)
|
|
579
|
-
adjustColorLightness('hsl(210 50% 40%)', 0.2) // → 'oklch(0.65 0.108 232.62)'
|
|
580
|
-
```
|
|
571
|
+
- **Reading the channel format** of a color from `--maz-*` in JS — the value used to be an `hsl(...)` string, it's now an `oklch(...)` string (and at runtime the base may resolve through `light-dark()`). Use `getComputedStyle(...).getPropertyValue(...)` and a CSS color parser if you need channels.
|
|
572
|
+
- **Calling the legacy JS palette helpers** (`generateColorScale`, `adjustColorLightness`, `getContrastColor`, `parseHSL`) — these exports were removed in v5. See [BREAKING — removed exports](#breaking-removed-exports) for replacements.
|
|
581
573
|
|
|
582
574
|
Why the switch: OKLCh is perceptually uniform, so generated scales (`primary-50` → `primary-950`) ramp consistently across hues — yellow-700 won't look muddy compared to blue-700 anymore. It also unlocks Display P3 colors when you author a vivid preset.
|
|
583
575
|
|
|
@@ -615,6 +607,69 @@ Four bundled presets remain (`mazUi`, `pristine`, `ocean`, `obsidian`) plus a ne
|
|
|
615
607
|
|
|
616
608
|
Switching to one of the bundled presets does not require any code change beyond the preset name. If you depended on the previous (washed-out gray) `secondary` color in a custom theme, override it back via `colors.{light,dark}.secondary` in your preset.
|
|
617
609
|
|
|
610
|
+
### Theming: native CSS rewrite (new — non-breaking by default)
|
|
611
|
+
|
|
612
|
+
The `@maz-ui/themes` CSS pipeline was rewritten to lean on native CSS instead of JS:
|
|
613
|
+
|
|
614
|
+
- Base colors are now emitted as a single `--maz-X: light-dark(L, D)` declaration. The browser resolves it for you.
|
|
615
|
+
- Color scales `--maz-X-50` through `--maz-X-950` are derived via OKLCh relative color syntax at runtime, so any override on the base color cascades through the whole scale automatically (and preserves its chroma).
|
|
616
|
+
- `:root` declares `color-scheme: light dark` so native widgets (scrollbars, native `<select>`, date pickers, autofill) follow the active mode out of the box.
|
|
617
|
+
- A `<meta name="color-scheme">` tag is **automatically injected** at boot (Vue + Nuxt SSR). No user action — prevents the Flash of inAccurate coloR Theme.
|
|
618
|
+
|
|
619
|
+
Consumer-visible CSS surface is unchanged: `var(--maz-primary)`, `--maz-primary-500`, Tailwind utilities `bg-primary/60`, `bg-primary-500`, etc. all keep working.
|
|
620
|
+
|
|
621
|
+
#### `lightClass` (new — optional, default `'light'`)
|
|
622
|
+
|
|
623
|
+
Mirror of `darkClass`. When `colorMode === 'light'` and `darkModeStrategy === 'class'`, this class is added to `<html>` to force `color-scheme: only light`. Default `'light'` — set to `false`/custom string if it clashes with an existing class in your app:
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
app.use(MazUi, {
|
|
627
|
+
theme: {
|
|
628
|
+
preset: mazUi,
|
|
629
|
+
darkClass: 'dark',
|
|
630
|
+
lightClass: 'light', // new
|
|
631
|
+
},
|
|
632
|
+
})
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
Non-breaking: if you never explicitly forced light, nothing changes.
|
|
636
|
+
|
|
637
|
+
#### `setColorMode` / `toggleDarkMode` now return `Promise<void>`
|
|
638
|
+
|
|
639
|
+
Both functions are now async to support the optional `{ animate: true }` parameter (View Transitions). Existing callers that ignored the return value keep working — `await` is only required when you need to chain.
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
const { setColorMode, toggleDarkMode } = useTheme()
|
|
643
|
+
|
|
644
|
+
// Existing v4 call — still works, return value ignored
|
|
645
|
+
setColorMode('dark')
|
|
646
|
+
toggleDarkMode()
|
|
647
|
+
|
|
648
|
+
// v5 — await to chain after the change is applied
|
|
649
|
+
await setColorMode('dark')
|
|
650
|
+
|
|
651
|
+
// v5 — animated full-page switch via document.startViewTransition()
|
|
652
|
+
await toggleDarkMode({ animate: true })
|
|
653
|
+
await setColorMode('dark', { animate: true })
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
The View Transitions glue is lazy-imported — when `animate` is not used, it stays out of your boot bundle. Browsers that don't support the API apply the change immediately with no animation.
|
|
657
|
+
|
|
658
|
+
#### BREAKING — removed exports
|
|
659
|
+
|
|
660
|
+
The JS-based palette generator is gone. The following helpers used to be exported from `@maz-ui/themes` and **no longer exist** in v5:
|
|
661
|
+
|
|
662
|
+
| Removed export | Replacement |
|
|
663
|
+
| --- | --- |
|
|
664
|
+
| `generateColorScale(base, mode)` | The scale is now generated in CSS via `oklch(from var(--maz-X) clamp(0, calc(l ± offset), 1) calc(c * mult) h)`. Read the live value from `--maz-X-{50..950}`, or replicate the formula inline. |
|
|
665
|
+
| `parseHSL(value)` | Use a CSS color parser or `parseColorAsOklch` from `@maz-ui/themes/utils/color-conversions`. |
|
|
666
|
+
| `adjustColorLightness(color, amount)` | Inline with `oklch(from <color> calc(l + N) c h)` to shift lightness while preserving chroma and hue. |
|
|
667
|
+
| `getContrastColor(color)` | Use the preset's `*-foreground` token, which is what components consume internally. |
|
|
668
|
+
|
|
669
|
+
`colorToHex`, `parseColorAsOklch` and `formatAsOklch` are **preserved**, now exported from `@maz-ui/themes/utils/color-conversions`.
|
|
670
|
+
|
|
671
|
+
If you were importing any of the removed helpers from `@maz-ui/themes`, replace them before upgrading.
|
|
672
|
+
|
|
618
673
|
### Preset name persistence (new — opt-out, no breaking change)
|
|
619
674
|
|
|
620
675
|
`@maz-ui/themes` now persists the active preset name in a `maz-preset` cookie (1-year TTL, `SameSite=Lax`) — same shape as the existing `maz-color-mode` cookie:
|