@maz-ui/mcp 4.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/bin/maz-ui-mcp.mjs +7 -0
- package/dist/mcp.d.mts +13 -0
- package/dist/mcp.d.ts +13 -0
- package/dist/mcp.mjs +586 -0
- package/docs/generated-docs/maz-accordion.doc.md +21 -0
- package/docs/generated-docs/maz-animated-counter.doc.md +17 -0
- package/docs/generated-docs/maz-animated-element.doc.md +14 -0
- package/docs/generated-docs/maz-animated-text.doc.md +14 -0
- package/docs/generated-docs/maz-avatar.doc.md +44 -0
- package/docs/generated-docs/maz-backdrop.doc.md +61 -0
- package/docs/generated-docs/maz-badge.doc.md +16 -0
- package/docs/generated-docs/maz-bottom-sheet.doc.md +21 -0
- package/docs/generated-docs/maz-btn.doc.md +30 -0
- package/docs/generated-docs/maz-card-spotlight.doc.md +16 -0
- package/docs/generated-docs/maz-card.doc.md +39 -0
- package/docs/generated-docs/maz-carousel.doc.md +16 -0
- package/docs/generated-docs/maz-chart.doc.md +10 -0
- package/docs/generated-docs/maz-checkbox.doc.md +34 -0
- package/docs/generated-docs/maz-checklist.doc.md +30 -0
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +27 -0
- package/docs/generated-docs/maz-date-picker.doc.md +52 -0
- package/docs/generated-docs/maz-dialog-confirm.doc.md +24 -0
- package/docs/generated-docs/maz-dialog.doc.md +22 -0
- package/docs/generated-docs/maz-drawer.doc.md +26 -0
- package/docs/generated-docs/maz-dropdown.doc.md +42 -0
- package/docs/generated-docs/maz-dropzone.doc.md +82 -0
- package/docs/generated-docs/maz-expand-animation.doc.md +12 -0
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +13 -0
- package/docs/generated-docs/maz-gallery.doc.md +17 -0
- package/docs/generated-docs/maz-icon.doc.md +18 -0
- package/docs/generated-docs/maz-input-code.doc.md +25 -0
- package/docs/generated-docs/maz-input-number.doc.md +31 -0
- package/docs/generated-docs/maz-input-phone-number.doc.md +56 -0
- package/docs/generated-docs/maz-input-price.doc.md +26 -0
- package/docs/generated-docs/maz-input-tags.doc.md +24 -0
- package/docs/generated-docs/maz-input.doc.md +54 -0
- package/docs/generated-docs/maz-lazy-img.doc.md +31 -0
- package/docs/generated-docs/maz-link.doc.md +31 -0
- package/docs/generated-docs/maz-loading-bar.doc.md +6 -0
- package/docs/generated-docs/maz-pagination.doc.md +22 -0
- package/docs/generated-docs/maz-popover.doc.md +70 -0
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +31 -0
- package/docs/generated-docs/maz-radio-buttons.doc.md +33 -0
- package/docs/generated-docs/maz-radio.doc.md +33 -0
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +18 -0
- package/docs/generated-docs/maz-select-country.doc.md +44 -0
- package/docs/generated-docs/maz-select.doc.md +65 -0
- package/docs/generated-docs/maz-slider.doc.md +20 -0
- package/docs/generated-docs/maz-spinner.doc.md +6 -0
- package/docs/generated-docs/maz-stepper.doc.md +29 -0
- package/docs/generated-docs/maz-switch.doc.md +31 -0
- package/docs/generated-docs/maz-table-cell.doc.md +5 -0
- package/docs/generated-docs/maz-table-row.doc.md +11 -0
- package/docs/generated-docs/maz-table-title.doc.md +5 -0
- package/docs/generated-docs/maz-table.doc.md +66 -0
- package/docs/generated-docs/maz-tabs-bar.doc.md +18 -0
- package/docs/generated-docs/maz-tabs-content-item.doc.md +11 -0
- package/docs/generated-docs/maz-tabs-content.doc.md +5 -0
- package/docs/generated-docs/maz-tabs.doc.md +17 -0
- package/docs/generated-docs/maz-textarea.doc.md +41 -0
- package/docs/src/components/index.md +8 -0
- package/docs/src/components/maz-accordion.md +80 -0
- package/docs/src/components/maz-animated-counter.md +124 -0
- package/docs/src/components/maz-animated-element.md +36 -0
- package/docs/src/components/maz-animated-text.md +36 -0
- package/docs/src/components/maz-avatar.md +179 -0
- package/docs/src/components/maz-backdrop.md +16 -0
- package/docs/src/components/maz-badge.md +222 -0
- package/docs/src/components/maz-bottom-sheet.md +398 -0
- package/docs/src/components/maz-btn.md +526 -0
- package/docs/src/components/maz-card-spotlight.md +163 -0
- package/docs/src/components/maz-card.md +447 -0
- package/docs/src/components/maz-carousel.md +127 -0
- package/docs/src/components/maz-chart.md +346 -0
- package/docs/src/components/maz-checkbox.md +168 -0
- package/docs/src/components/maz-checklist.md +414 -0
- package/docs/src/components/maz-circular-progress-bar.md +147 -0
- package/docs/src/components/maz-date-picker.md +1078 -0
- package/docs/src/components/maz-dialog-confirm.md +240 -0
- package/docs/src/components/maz-dialog.md +208 -0
- package/docs/src/components/maz-drawer.md +177 -0
- package/docs/src/components/maz-dropdown.md +650 -0
- package/docs/src/components/maz-dropzone.md +442 -0
- package/docs/src/components/maz-expand-animation.md +99 -0
- package/docs/src/components/maz-fullscreen-loader.md +58 -0
- package/docs/src/components/maz-gallery.md +85 -0
- package/docs/src/components/maz-icon.md +85 -0
- package/docs/src/components/maz-input-code.md +61 -0
- package/docs/src/components/maz-input-number.md +81 -0
- package/docs/src/components/maz-input-phone-number.md +867 -0
- package/docs/src/components/maz-input-price.md +58 -0
- package/docs/src/components/maz-input-tags.md +114 -0
- package/docs/src/components/maz-input.md +453 -0
- package/docs/src/components/maz-lazy-img.md +24 -0
- package/docs/src/components/maz-link.md +156 -0
- package/docs/src/components/maz-loading-bar.md +26 -0
- package/docs/src/components/maz-pagination.md +81 -0
- package/docs/src/components/maz-popover.md +1414 -0
- package/docs/src/components/maz-pull-to-refresh.md +49 -0
- package/docs/src/components/maz-radio-buttons.md +456 -0
- package/docs/src/components/maz-radio.md +141 -0
- package/docs/src/components/maz-reading-progress-bar.md +74 -0
- package/docs/src/components/maz-select-country.md +636 -0
- package/docs/src/components/maz-select.md +439 -0
- package/docs/src/components/maz-slider.md +191 -0
- package/docs/src/components/maz-spinner.md +93 -0
- package/docs/src/components/maz-stepper.md +418 -0
- package/docs/src/components/maz-switch.md +92 -0
- package/docs/src/components/maz-table.md +571 -0
- package/docs/src/components/maz-tabs.md +231 -0
- package/docs/src/components/maz-textarea.md +218 -0
- package/docs/src/composables/use-aos.md +34 -0
- package/docs/src/composables/use-breakpoints.md +35 -0
- package/docs/src/composables/use-dialog.md +88 -0
- package/docs/src/composables/use-display-names.md +174 -0
- package/docs/src/composables/use-form-validator.md +1149 -0
- package/docs/src/composables/use-idle-timeout.md +256 -0
- package/docs/src/composables/use-reading-time.md +168 -0
- package/docs/src/composables/use-string-matching.md +63 -0
- package/docs/src/composables/use-swipe.md +223 -0
- package/docs/src/composables/use-timer.md +130 -0
- package/docs/src/composables/use-toast.md +71 -0
- package/docs/src/composables/use-user-visibility.md +169 -0
- package/docs/src/composables/use-wait.md +62 -0
- package/docs/src/composables/use-window-size.md +18 -0
- package/docs/src/demo/DemoAuthPage.vue +178 -0
- package/docs/src/demo/DemoDashboardPage.vue +298 -0
- package/docs/src/demo/DemoProductPage.vue +135 -0
- package/docs/src/directives/click-outside.md +275 -0
- package/docs/src/directives/fullscreen-img.md +101 -0
- package/docs/src/directives/lazy-img.md +184 -0
- package/docs/src/directives/tooltip.md +458 -0
- package/docs/src/directives/zoom-img.md +127 -0
- package/docs/src/guide/cli.md +144 -0
- package/docs/src/guide/getting-started.md +284 -0
- package/docs/src/guide/icon-set.md +60 -0
- package/docs/src/guide/icons.md +481 -0
- package/docs/src/guide/mcp.md +210 -0
- package/docs/src/guide/migration-v4.md +898 -0
- package/docs/src/guide/nuxt.md +411 -0
- package/docs/src/guide/resolvers.md +697 -0
- package/docs/src/guide/themes.md +789 -0
- package/docs/src/guide/translations.md +1173 -0
- package/docs/src/guide/vue.md +243 -0
- package/docs/src/helpers/camel-case.md +14 -0
- package/docs/src/helpers/capitalize.md +51 -0
- package/docs/src/helpers/check-availability.md +14 -0
- package/docs/src/helpers/country-code-to-unicode-flag.md +213 -0
- package/docs/src/helpers/currency.md +67 -0
- package/docs/src/helpers/date.md +67 -0
- package/docs/src/helpers/debounce-callback.md +14 -0
- package/docs/src/helpers/debounce-id.md +14 -0
- package/docs/src/helpers/debounce.md +14 -0
- package/docs/src/helpers/get-country-flag-url.md +156 -0
- package/docs/src/helpers/is-client.md +14 -0
- package/docs/src/helpers/is-equal.md +14 -0
- package/docs/src/helpers/is-standalone-mode.md +14 -0
- package/docs/src/helpers/kebab-case.md +14 -0
- package/docs/src/helpers/normalize-string.md +14 -0
- package/docs/src/helpers/number.md +65 -0
- package/docs/src/helpers/pascal-case.md +14 -0
- package/docs/src/helpers/script-loader.md +14 -0
- package/docs/src/helpers/sleep.md +14 -0
- package/docs/src/helpers/snake-case.md +14 -0
- package/docs/src/helpers/throttle-id.md +14 -0
- package/docs/src/helpers/throttle.md +14 -0
- package/docs/src/index.md +555 -0
- package/docs/src/made-with-maz-ui.md +58 -0
- package/docs/src/plugins/aos.md +347 -0
- package/docs/src/plugins/dialog.md +411 -0
- package/docs/src/plugins/toast.md +349 -0
- package/docs/src/plugins/wait.md +109 -0
- package/package.json +84 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Toast
|
|
3
|
+
description: A powerful toast notification system for Vue.js that displays user-friendly messages with customizable positioning, styling, and behavior options
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
::: tip
|
|
11
|
+
This plugin has a composable for easier use, after installing it you can use [useToast](./../composables/use-toast.md)
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
::: code-group
|
|
17
|
+
|
|
18
|
+
```ts [Vue]
|
|
19
|
+
import { ToastPlugin } from 'maz-ui/plugins/toast'
|
|
20
|
+
import { createApp } from 'vue'
|
|
21
|
+
|
|
22
|
+
const app = createApp(App)
|
|
23
|
+
|
|
24
|
+
const toastOptions: ToastOptions = {
|
|
25
|
+
position: 'bottom-right',
|
|
26
|
+
timeout: 10_000,
|
|
27
|
+
persistent: false,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
app.use(ToastPlugin, toastOptions)
|
|
31
|
+
app.mount('#app')
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```ts [Nuxt]
|
|
35
|
+
export default defineNuxtConfig({
|
|
36
|
+
modules: ['@maz-ui/nuxt'],
|
|
37
|
+
mazUi: {
|
|
38
|
+
composables: {
|
|
39
|
+
useToast: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
## Basic usage
|
|
48
|
+
|
|
49
|
+
<ComponentDemo expanded>
|
|
50
|
+
<div class="maz-flex maz-flex-wrap maz-gap-2">
|
|
51
|
+
<MazBtn color="contrast" @click="toast.message('Message text')">
|
|
52
|
+
Message
|
|
53
|
+
</MazBtn>
|
|
54
|
+
<MazBtn color="info" @click="toast.info('Info message', { position: 'top', button: { href: 'https://www.loicmazuel.com' } })">
|
|
55
|
+
Info toast on top
|
|
56
|
+
</MazBtn>
|
|
57
|
+
<MazBtn color="destructive" @click="toast.error('Error message', { position: 'bottom', timeout: 1000 })">
|
|
58
|
+
Error toast on bottom with 1s timeout
|
|
59
|
+
</MazBtn>
|
|
60
|
+
<MazBtn color="warning" @click="toast.warning('Warning message', { position: 'top-right' })">
|
|
61
|
+
Warning toast on top right
|
|
62
|
+
</MazBtn>
|
|
63
|
+
<MazBtn color="contrast" @click="toast.message(`<ul><li>Item <b>1</b></li><li>Item <b>2</b></li><li>Item <b>3</b></li></ul>`, { position: 'bottom-left', html: true })">
|
|
64
|
+
Toast with html content
|
|
65
|
+
</MazBtn>
|
|
66
|
+
<MazBtn color="contrast" @click="toast.message('No timeout toast', { timeout: false })">
|
|
67
|
+
Persistent with no timeout
|
|
68
|
+
</MazBtn>
|
|
69
|
+
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<template #code>
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<script lang="ts" setup>
|
|
76
|
+
import { useToast } from 'maz-ui/composables/useToast'
|
|
77
|
+
|
|
78
|
+
const toast = useToast()
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<template>
|
|
82
|
+
<MazBtn color="contrast" @click="toast.message('Message text')">
|
|
83
|
+
Message
|
|
84
|
+
</MazBtn>
|
|
85
|
+
<MazBtn color="info" @click="toast.info('Info message', { position: 'top', button: { href: 'https://www.loicmazuel.com' } })">
|
|
86
|
+
Info toast on top
|
|
87
|
+
</MazBtn>
|
|
88
|
+
<MazBtn color="destructive" @click="toast.error('Error message', { position: 'bottom', timeout: 1000 })">
|
|
89
|
+
Error toast on bottom with 1s timeout
|
|
90
|
+
</MazBtn>
|
|
91
|
+
<MazBtn color="warning" @click="toast.warning('Warning message', { position: 'top-right' })">
|
|
92
|
+
Warning toast on top right
|
|
93
|
+
</MazBtn>
|
|
94
|
+
<MazBtn color="contrast" @click="toast.message(`<ul><li>Item <b>1</b></li><li>Item <b>2</b></li><li>Item <b>3</b></li></ul>`, { position: 'bottom-left', html: true })">
|
|
95
|
+
Toast with html content
|
|
96
|
+
</MazBtn>
|
|
97
|
+
<MazBtn color="contrast" @click="toast.message('No timeout toast', { timeout: false })">
|
|
98
|
+
Persistent with no timeout
|
|
99
|
+
</MazBtn>
|
|
100
|
+
</template>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
</ComponentDemo>
|
|
106
|
+
|
|
107
|
+
### Action and link
|
|
108
|
+
|
|
109
|
+
Toast can have a link or an action
|
|
110
|
+
|
|
111
|
+
<ComponentDemo>
|
|
112
|
+
<div class="maz-flex maz-flex-wrap maz-gap-2">
|
|
113
|
+
<MazBtn color="info" @click="showInfoWithLink">
|
|
114
|
+
Toast with link
|
|
115
|
+
</MazBtn>
|
|
116
|
+
<MazBtn color="warning" @click="showInfoWithExternalLink">
|
|
117
|
+
Toast with blank link
|
|
118
|
+
</MazBtn>
|
|
119
|
+
<MazBtn color="destructive" @click="showInfoWithAction">
|
|
120
|
+
Toast with action
|
|
121
|
+
</MazBtn>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<template #code>
|
|
125
|
+
|
|
126
|
+
```vue
|
|
127
|
+
<script lang="ts" setup>
|
|
128
|
+
import { useToast } from 'maz-ui/composables/useToast'
|
|
129
|
+
|
|
130
|
+
const toast = useToast()
|
|
131
|
+
|
|
132
|
+
function showInfoWithLink() {
|
|
133
|
+
toast.info('Toast with link, click -->', {
|
|
134
|
+
button: {
|
|
135
|
+
href: 'https://www.loicmazuel.com',
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function showInfoWithExternalLink() {
|
|
141
|
+
toast.warning('Toast with link', {
|
|
142
|
+
button: {
|
|
143
|
+
href: 'https://www.loicmazuel.com',
|
|
144
|
+
target: '_blank',
|
|
145
|
+
closeToast: true,
|
|
146
|
+
text: 'Follow link'
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function showInfoWithAction() {
|
|
152
|
+
toast.error('Toast with action', {
|
|
153
|
+
button: {
|
|
154
|
+
onClick: () => new Promise((resolve) => {
|
|
155
|
+
sleep(3000)
|
|
156
|
+
resolve()
|
|
157
|
+
toast.success('Promise executed')
|
|
158
|
+
}),
|
|
159
|
+
text: 'Exec promise',
|
|
160
|
+
closeToast: true,
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<template>
|
|
167
|
+
<MazBtn color="info" @click="showInfoWithLink">
|
|
168
|
+
Toast with link
|
|
169
|
+
</MazBtn>
|
|
170
|
+
<MazBtn color="warning" @click="showInfoWithExternalLink">
|
|
171
|
+
Toast with blank link
|
|
172
|
+
</MazBtn>
|
|
173
|
+
<MazBtn color="destructive" @click="showInfoWithAction">
|
|
174
|
+
Toast with action
|
|
175
|
+
</MazBtn>
|
|
176
|
+
</template>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
</template>
|
|
180
|
+
</ComponentDemo>
|
|
181
|
+
|
|
182
|
+
## Close toast programmatically
|
|
183
|
+
|
|
184
|
+
You can close a toast programmatically by using the `close` method returned by the `toast` function
|
|
185
|
+
|
|
186
|
+
<div class="maz-flex maz-flex-wrap maz-gap-2">
|
|
187
|
+
<MazBtn color="primary" @click="showToastAutoCLose">
|
|
188
|
+
Show toast
|
|
189
|
+
</MazBtn>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
function showToast() {
|
|
194
|
+
const toastMessage = toast.message('Toast message closed by code')
|
|
195
|
+
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
toastMessage.close()
|
|
198
|
+
}, 2000)
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Type
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
interface ToastOptions {
|
|
206
|
+
/**
|
|
207
|
+
* The position of the toast on the screen
|
|
208
|
+
* @default 'bottom-right'
|
|
209
|
+
*/
|
|
210
|
+
position?: ToastPosition
|
|
211
|
+
/**
|
|
212
|
+
* The timeout is in ms, it's the time before the toast is automatically closed
|
|
213
|
+
* if set to `false`, the toast will not be closed automatically
|
|
214
|
+
* @default 10000
|
|
215
|
+
*/
|
|
216
|
+
timeout?: number | boolean
|
|
217
|
+
/**
|
|
218
|
+
* If the toast is persistent, it can't be closed by user interaction (only on timeout or programmatically)
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
persistent?: boolean
|
|
222
|
+
/**
|
|
223
|
+
* Display an icon in the toast
|
|
224
|
+
* @default true
|
|
225
|
+
*/
|
|
226
|
+
icon?: boolean
|
|
227
|
+
/**
|
|
228
|
+
* The action will be displayed as a button in the toast
|
|
229
|
+
* @default undefined
|
|
230
|
+
*/
|
|
231
|
+
button?: MazBtnProps & {
|
|
232
|
+
text: string
|
|
233
|
+
onClick: () => unknown
|
|
234
|
+
href?: string
|
|
235
|
+
text?: string
|
|
236
|
+
/** @default _self */
|
|
237
|
+
target?: string
|
|
238
|
+
/** @default false */
|
|
239
|
+
closeToast?: boolean
|
|
240
|
+
}
|
|
241
|
+
buttons?: (MazBtnProps & {
|
|
242
|
+
text: string
|
|
243
|
+
onClick: () => unknown
|
|
244
|
+
href?: string
|
|
245
|
+
text?: string
|
|
246
|
+
/** @default _self */
|
|
247
|
+
target?: string
|
|
248
|
+
/** @default false */
|
|
249
|
+
closeToast?: boolean
|
|
250
|
+
})[]
|
|
251
|
+
/**
|
|
252
|
+
* If the toast is queued, it will be displayed in the order of the toasts
|
|
253
|
+
* @default false
|
|
254
|
+
*/
|
|
255
|
+
queue?: boolean
|
|
256
|
+
/**
|
|
257
|
+
* The maximum number of toasts to display
|
|
258
|
+
* @default false
|
|
259
|
+
*/
|
|
260
|
+
maxToasts?: number | boolean
|
|
261
|
+
/**
|
|
262
|
+
* If the toast is paused on hover, it will be paused when the mouse is over the toast
|
|
263
|
+
* @default true
|
|
264
|
+
*/
|
|
265
|
+
pauseOnHover?: boolean
|
|
266
|
+
/**
|
|
267
|
+
* If the message is HTML
|
|
268
|
+
* @default false
|
|
269
|
+
*/
|
|
270
|
+
html?: boolean
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
<script lang="ts" setup>
|
|
275
|
+
import { useToast } from 'maz-ui/composables/useToast'
|
|
276
|
+
import { sleep } from 'maz-ui'
|
|
277
|
+
|
|
278
|
+
const toast = useToast()
|
|
279
|
+
|
|
280
|
+
function showToastAutoCLose () {
|
|
281
|
+
const toastMessage = toast.message('Toast message closed by code')
|
|
282
|
+
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
toastMessage.close()
|
|
285
|
+
}, 3000)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function showMessage () {
|
|
289
|
+
const t = toast.message('Message text')
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function showInfo () {
|
|
293
|
+
toast.info('Info message', {
|
|
294
|
+
position: 'top',
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function showError () {
|
|
299
|
+
toast.error('Error message', {
|
|
300
|
+
position: 'bottom',
|
|
301
|
+
timeout: 1000,
|
|
302
|
+
})
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function showWarning () {
|
|
306
|
+
toast.warning('Warning message', {
|
|
307
|
+
position: 'top-right',
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function showSuccess () {
|
|
312
|
+
toast.success('Success message', {
|
|
313
|
+
position: 'bottom-left',
|
|
314
|
+
persistent: true,
|
|
315
|
+
})
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function showInfoWithLink () {
|
|
319
|
+
toast.info('Toast with link, click -->', {
|
|
320
|
+
button: {
|
|
321
|
+
href: 'https://www.loicmazuel.com',
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function showInfoWithExternalLink () {
|
|
327
|
+
toast.warning('Toast with link', {
|
|
328
|
+
button: {
|
|
329
|
+
href: 'https://www.loicmazuel.com',
|
|
330
|
+
target: '_blank',
|
|
331
|
+
closeToast: true,
|
|
332
|
+
text: 'Follow link'
|
|
333
|
+
}
|
|
334
|
+
})
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function showInfoWithAction () {
|
|
338
|
+
toast.error('Toast with action', {
|
|
339
|
+
button: {
|
|
340
|
+
onClick: () => new Promise(async (resolve) => {
|
|
341
|
+
await sleep(3000)
|
|
342
|
+
resolve()
|
|
343
|
+
}),
|
|
344
|
+
text: 'Exec promise',
|
|
345
|
+
closeToast: true
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
</script>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: wait
|
|
3
|
+
description: A comprehensive loading state management plugin for Vue.js that provides easy-to-use utilities for handling async operations, loading indicators, and user feedback during data processing or any other async operation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# {{ $frontmatter.title }}
|
|
7
|
+
|
|
8
|
+
{{ $frontmatter.description }}
|
|
9
|
+
|
|
10
|
+
::: tip
|
|
11
|
+
This plugin has a composable for easier use, after installing it you can use [useWait](./../composables/use-wait.md)
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
::: code-group
|
|
17
|
+
|
|
18
|
+
```ts [Vue]
|
|
19
|
+
import { WaitPlugin } from 'maz-ui/plugins/wait'
|
|
20
|
+
import { createApp } from 'vue'
|
|
21
|
+
|
|
22
|
+
const app = createApp(App)
|
|
23
|
+
|
|
24
|
+
app.use(WaitPlugin)
|
|
25
|
+
app.mount('#app')
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ts [Nuxt]
|
|
29
|
+
export default defineNuxtConfig({
|
|
30
|
+
modules: ['@maz-ui/nuxt'],
|
|
31
|
+
mazUi: {
|
|
32
|
+
composables: {
|
|
33
|
+
useWait: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
## Basic usage
|
|
42
|
+
|
|
43
|
+
<MazBtn @click="submitData" :loading="wait.isLoading('DATA_SUBMITTING')">
|
|
44
|
+
Submit Data
|
|
45
|
+
</MazBtn>
|
|
46
|
+
|
|
47
|
+
<br />
|
|
48
|
+
|
|
49
|
+
<div v-if="submitted" style="padding: 20px; background-color: hsl(var(--maz-background-300)); border-radius: 10px; margin-top: 1rem;">
|
|
50
|
+
Data Submitted
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<script lang="ts" setup>
|
|
55
|
+
import { useWait } from 'maz-ui/composables'
|
|
56
|
+
import { ref } from 'vue'
|
|
57
|
+
|
|
58
|
+
const wait = useWait()
|
|
59
|
+
|
|
60
|
+
const submitted = ref(false)
|
|
61
|
+
|
|
62
|
+
function sleep(ms: number) {
|
|
63
|
+
return new Promise(resolve => setTimeout(resolve, ms))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function submitData() {
|
|
67
|
+
submitted.value = false
|
|
68
|
+
wait.start('DATA_SUBMITTING')
|
|
69
|
+
|
|
70
|
+
await sleep(2000)
|
|
71
|
+
|
|
72
|
+
submitted.value = true
|
|
73
|
+
wait.stop('DATA_SUBMITTING')
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<MazBtn :loading="wait.isLoading('DATA_SUBMITTING')" @click="submitData">
|
|
79
|
+
Submit Data
|
|
80
|
+
</MazBtn>
|
|
81
|
+
|
|
82
|
+
<div v-if="submitted">
|
|
83
|
+
Data Submitted
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<script lang="ts" setup>
|
|
89
|
+
import { ref } from 'vue'
|
|
90
|
+
import { useWait } from 'maz-ui/composables/useWait'
|
|
91
|
+
|
|
92
|
+
const wait = useWait()
|
|
93
|
+
|
|
94
|
+
const submitted = ref(false)
|
|
95
|
+
|
|
96
|
+
function sleep(ms: number) {
|
|
97
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const submitData = async () => {
|
|
101
|
+
submitted.value = false
|
|
102
|
+
wait.start('DATA_SUBMITTING')
|
|
103
|
+
|
|
104
|
+
await sleep(2000)
|
|
105
|
+
|
|
106
|
+
submitted.value = true
|
|
107
|
+
wait.stop('DATA_SUBMITTING')
|
|
108
|
+
}
|
|
109
|
+
</script>
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maz-ui/mcp",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "4.0.0-beta.26",
|
|
5
|
+
"description": "Maz-UI ModelContextProtocol Client",
|
|
6
|
+
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/LouisMazel/maz-ui.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/LouisMazel/maz-ui/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"maz-ui",
|
|
15
|
+
"modelcontextprotocol",
|
|
16
|
+
"client"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/mcp.d.ts",
|
|
25
|
+
"import": "./dist/mcp.mjs",
|
|
26
|
+
"module": "./dist/mcp.mjs",
|
|
27
|
+
"default": "./dist/mcp.mjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/mcp.mjs",
|
|
31
|
+
"module": "./dist/mcp.mjs",
|
|
32
|
+
"types": "./dist/mcp.d.ts",
|
|
33
|
+
"bin": {
|
|
34
|
+
"maz-ui-mcp": "./bin/maz-ui-mcp.mjs"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"LICENSE",
|
|
38
|
+
"README.md",
|
|
39
|
+
"bin",
|
|
40
|
+
"dist",
|
|
41
|
+
"docs"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"generate:docs": "pnpm generate:components-docs && pnpm copy-docs",
|
|
45
|
+
"copy-docs": "tsx scripts/copy-docs.ts",
|
|
46
|
+
"generate:components-docs": "pnpm -F cli cli generate-components-docs",
|
|
47
|
+
"build": "pnpm generate:docs && unbuild",
|
|
48
|
+
"build:watch": "pnpm generate:docs && unbuild --watch",
|
|
49
|
+
"dev": "tsx src/mcp.ts",
|
|
50
|
+
"dev:inspector": "mcp-inspector",
|
|
51
|
+
"preview": "node dist/mcp.mjs",
|
|
52
|
+
"lint": "cross-env NODE_ENV=production eslint .",
|
|
53
|
+
"lint:fix": "pnpm lint --fix",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"pre-commit": "lint-staged",
|
|
56
|
+
"test:unit": "pnpm generate:docs && vitest run",
|
|
57
|
+
"test:unit:watch": "pnpm generate:docs && vitest watch",
|
|
58
|
+
"test:unit:coverage": "pnpm generate:docs && vitest run --coverage"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@maz-ui/node": "4.0.0-beta.26",
|
|
62
|
+
"@maz-ui/utils": "4.0.0-beta.25",
|
|
63
|
+
"@modelcontextprotocol/sdk": "^1.17.1"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@maz-ui/eslint-config": "4.0.0-beta.25",
|
|
67
|
+
"@modelcontextprotocol/inspector": "^0.16.2",
|
|
68
|
+
"@swc/core": "1.13.3",
|
|
69
|
+
"@types/node": "^24.2.0",
|
|
70
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
71
|
+
"eslint": "^9.26.0",
|
|
72
|
+
"lint-staged": "^16.1.4",
|
|
73
|
+
"prettier": "^3.5.3",
|
|
74
|
+
"ts-node-maintained": "^10.9.5",
|
|
75
|
+
"tsx": "^4.20.3",
|
|
76
|
+
"typescript": "^5.9.2",
|
|
77
|
+
"unbuild": "^3.6.0",
|
|
78
|
+
"vitest": "^3.2.4"
|
|
79
|
+
},
|
|
80
|
+
"lint-staged": {
|
|
81
|
+
"*.{js,ts,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"
|
|
82
|
+
},
|
|
83
|
+
"gitHead": "bfbe28abf5a3c3aae95b64833c681ff6cbe5bd42"
|
|
84
|
+
}
|