@maz-ui/mcp 5.0.0-beta.5 → 5.0.0-beta.51
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/README.md +1 -1
- package/dist/mcp.d.mts +22 -9
- package/dist/mcp.d.ts +22 -9
- package/dist/mcp.mjs +160 -83
- package/docs/generated-docs/maz-avatar.doc.md +30 -30
- package/docs/generated-docs/maz-bottom-sheet.doc.md +16 -13
- package/docs/generated-docs/maz-btn.doc.md +21 -19
- package/docs/generated-docs/maz-checkbox.doc.md +16 -17
- 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-container.doc.md +1 -0
- package/docs/generated-docs/maz-date-picker.doc.md +41 -41
- package/docs/generated-docs/maz-drawer.doc.md +7 -8
- package/docs/generated-docs/maz-dropdown.doc.md +3 -0
- package/docs/generated-docs/maz-expand-animation.doc.md +4 -4
- 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-input-code.doc.md +16 -16
- package/docs/generated-docs/maz-input-phone-number.doc.md +43 -42
- package/docs/generated-docs/maz-input-price.doc.md +14 -14
- package/docs/generated-docs/maz-input-tags.doc.md +16 -16
- package/docs/generated-docs/maz-input.doc.md +33 -33
- package/docs/generated-docs/maz-lazy-img.doc.md +14 -14
- package/docs/generated-docs/maz-loading-bar.doc.md +4 -4
- package/docs/generated-docs/maz-markdown-editor.doc.md +65 -0
- package/docs/generated-docs/maz-popover.doc.md +1 -1
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +39 -20
- package/docs/generated-docs/maz-radio-buttons.doc.md +17 -17
- package/docs/generated-docs/maz-radio.doc.md +16 -16
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +4 -4
- package/docs/generated-docs/maz-select-country.doc.md +27 -26
- 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 +27 -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 +5 -0
- package/docs/generated-docs/maz-sidebar.doc.md +36 -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-switch.doc.md +14 -14
- package/docs/generated-docs/maz-table-virtualizer.doc.md +20 -0
- package/docs/generated-docs/maz-table.doc.md +43 -37
- package/docs/generated-docs/maz-tabs-bar.doc.md +20 -9
- package/docs/generated-docs/maz-tabs.doc.md +6 -3
- package/docs/generated-docs/maz-textarea.doc.md +27 -25
- package/docs/generated-docs/maz-ticker.doc.md +1 -1
- package/docs/generated-docs/maz-timeline.doc.md +4 -4
- package/docs/generated-docs/maz-window-mockup.doc.md +23 -0
- package/docs/src/blog/v4.md +1 -1
- package/docs/src/blog/v5.md +5 -7
- package/docs/src/components/maz-avatar.md +52 -4
- package/docs/src/components/maz-bottom-sheet.md +300 -169
- package/docs/src/components/maz-btn.md +1 -1
- package/docs/src/components/maz-checklist.md +10 -10
- package/docs/src/components/maz-code-highlight.md +233 -0
- package/docs/src/components/maz-date-picker.md +55 -1
- package/docs/src/components/maz-dialog.md +46 -0
- package/docs/src/components/maz-dropdown.md +32 -16
- package/docs/src/components/maz-icon.md +16 -5
- package/docs/src/components/maz-input-phone-number.md +30 -0
- package/docs/src/components/maz-lazy-img.md +64 -0
- package/docs/src/components/maz-markdown-editor.md +369 -0
- package/docs/src/components/maz-pull-to-refresh.md +176 -17
- package/docs/src/components/maz-select-country.md +138 -1
- package/docs/src/components/maz-sidebar.md +719 -0
- package/docs/src/components/maz-table.md +156 -1
- package/docs/src/components/maz-tabs.md +110 -3
- package/docs/src/components/maz-textarea.md +58 -0
- package/docs/src/components/maz-timeline.md +60 -0
- package/docs/src/components/maz-window-mockup.md +249 -0
- package/docs/src/composables/use-drag.md +239 -0
- package/docs/src/composables/use-form-validator.md +297 -16
- package/docs/src/composables/use-pull-to-refresh.md +79 -0
- package/docs/src/composables/use-swipe.md +26 -11
- package/docs/src/directives/click-outside.md +8 -15
- package/docs/src/directives/fullscreen-img.md +1 -1
- package/docs/src/directives/lazy-img.md +44 -11
- package/docs/src/directives/tooltip.md +24 -1
- package/docs/src/directives/zoom-img.md +1 -1
- package/docs/src/ecosystem/eslint-config.md +95 -1
- package/docs/src/{guide/icons.md → ecosystem/icons/index.md} +1 -1
- package/docs/src/ecosystem/node/exec-promise.md +87 -0
- package/docs/src/ecosystem/node/index.md +53 -0
- package/docs/src/ecosystem/node/logger.md +146 -0
- package/docs/src/ecosystem/node/print-banner.md +93 -0
- package/docs/src/{guide → ecosystem}/nuxt.md +102 -47
- package/docs/src/{guide → ecosystem}/themes.md +152 -71
- package/docs/src/{guide → ecosystem}/translations.md +1 -1
- package/docs/src/ecosystem/utils/camel-case.md +31 -0
- package/docs/src/{helpers → ecosystem/utils}/capitalize.md +2 -3
- package/docs/src/ecosystem/utils/check-availability.md +79 -0
- package/docs/src/ecosystem/utils/cookie.md +80 -0
- package/docs/src/ecosystem/utils/debounce-callback.md +38 -0
- package/docs/src/ecosystem/utils/debounce-id.md +69 -0
- package/docs/src/ecosystem/utils/debounce.md +65 -0
- package/docs/src/ecosystem/utils/fetch-locale-ip.md +33 -0
- package/docs/src/ecosystem/utils/format-json.md +33 -0
- package/docs/src/ecosystem/utils/format-phone-number.md +37 -0
- package/docs/src/ecosystem/utils/get-browser-locale.md +29 -0
- package/docs/src/ecosystem/utils/get-error-message.md +39 -0
- package/docs/src/ecosystem/utils/idle-timeout.md +90 -0
- package/docs/src/ecosystem/utils/index.md +60 -0
- package/docs/src/ecosystem/utils/is-client.md +32 -0
- package/docs/src/ecosystem/utils/is-equal.md +38 -0
- package/docs/src/ecosystem/utils/is-server.md +31 -0
- package/docs/src/ecosystem/utils/is-standalone-mode.md +43 -0
- package/docs/src/ecosystem/utils/kebab-case.md +36 -0
- package/docs/src/ecosystem/utils/normalize-string.md +77 -0
- package/docs/src/ecosystem/utils/pascal-case.md +35 -0
- package/docs/src/ecosystem/utils/script-loader.md +77 -0
- package/docs/src/ecosystem/utils/sleep.md +59 -0
- package/docs/src/ecosystem/utils/snake-case.md +36 -0
- package/docs/src/ecosystem/utils/swipe-handler.md +91 -0
- package/docs/src/ecosystem/utils/textarea-autogrow.md +41 -0
- package/docs/src/ecosystem/utils/throttle-id.md +48 -0
- package/docs/src/ecosystem/utils/throttle.md +57 -0
- package/docs/src/ecosystem/utils/truthy-filter.md +31 -0
- package/docs/src/ecosystem/utils/types/deep-key-of.md +48 -0
- package/docs/src/ecosystem/utils/types/deep-partial.md +42 -0
- package/docs/src/ecosystem/utils/types/deep-required.md +39 -0
- package/docs/src/ecosystem/utils/types/flatten-object-keys.md +44 -0
- package/docs/src/ecosystem/utils/types/generic-instance-type.md +42 -0
- package/docs/src/ecosystem/utils/types/infer-maybe-ref.md +35 -0
- package/docs/src/ecosystem/utils/upper-first.md +32 -0
- package/docs/src/ecosystem/utils/user-visibility.md +69 -0
- package/docs/src/guide/getting-started.md +15 -13
- package/docs/src/guide/global-defaults.md +102 -0
- package/docs/src/guide/maz-ui-provider.md +6 -3
- package/docs/src/guide/migration-v4.md +13 -9
- package/docs/src/guide/migration-v5.md +211 -15
- package/docs/src/guide/resolvers.md +8 -8
- package/docs/src/guide/tailwind.md +4 -0
- package/docs/src/guide/vue.md +4 -4
- package/docs/src/index.md +13 -13
- package/docs/src/plugins/aos.md +1 -1
- package/package.json +11 -10
- package/docs/src/helpers/camel-case.md +0 -14
- package/docs/src/helpers/check-availability.md +0 -14
- package/docs/src/helpers/debounce-callback.md +0 -14
- package/docs/src/helpers/debounce-id.md +0 -14
- package/docs/src/helpers/debounce.md +0 -14
- package/docs/src/helpers/is-client.md +0 -14
- package/docs/src/helpers/is-equal.md +0 -14
- package/docs/src/helpers/is-standalone-mode.md +0 -14
- package/docs/src/helpers/kebab-case.md +0 -14
- package/docs/src/helpers/normalize-string.md +0 -14
- package/docs/src/helpers/pascal-case.md +0 -14
- package/docs/src/helpers/script-loader.md +0 -14
- package/docs/src/helpers/sleep.md +0 -14
- package/docs/src/helpers/snake-case.md +0 -14
- package/docs/src/helpers/throttle-id.md +0 -14
- package/docs/src/helpers/throttle.md +0 -14
- /package/docs/src/{guide → ecosystem/icons}/icon-set.md +0 -0
- /package/docs/src/{guide → ecosystem}/mcp.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/country-code-to-unicode-flag.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/currency.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/date.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/get-country-flag-url.md +0 -0
- /package/docs/src/{helpers → ecosystem/utils}/number.md +0 -0
|
@@ -291,6 +291,141 @@ Configure how country/language names are displayed using the `displayNamesOption
|
|
|
291
291
|
</template>
|
|
292
292
|
</ComponentDemo>
|
|
293
293
|
|
|
294
|
+
## Flags source
|
|
295
|
+
|
|
296
|
+
By default, the flags are images of the [flagcdn.com](https://flagcdn.com) CDN: each user's browser requests them from this third party. The `flag-src` prop changes where they come from, in four ways:
|
|
297
|
+
|
|
298
|
+
| Source | `flag-src` | Network |
|
|
299
|
+
| --- | --- | --- |
|
|
300
|
+
| CDN (default) | not set | flagcdn.com |
|
|
301
|
+
| Flags of maz-ui | `loadCountryFlag` from `maz-ui/country-flags` | none (works offline) |
|
|
302
|
+
| Your own files | URL template: `'/flags/{code}.svg'` | your server |
|
|
303
|
+
| Your own function | `(code) => string \| undefined \| Promise<string \| undefined>` | yours |
|
|
304
|
+
|
|
305
|
+
In every case, a flag is only loaded when it becomes visible (the selected country, then the rows of the open list in view), and a code without flag displays the colored badge.
|
|
306
|
+
|
|
307
|
+
### For the whole app
|
|
308
|
+
|
|
309
|
+
Set it once instead of on every component: the `flag-src` of `MazSelectCountry` and `MazInputPhoneNumber` both default to `defaults.global.flagSrc` (see [Global component defaults](../guide/global-defaults.md)). A `flag-src` set on a component always wins.
|
|
310
|
+
|
|
311
|
+
```ts
|
|
312
|
+
// Vue: main.ts
|
|
313
|
+
import { loadCountryFlag } from 'maz-ui/country-flags'
|
|
314
|
+
import { MazUi } from 'maz-ui/plugins/maz-ui'
|
|
315
|
+
|
|
316
|
+
app.use(MazUi, {
|
|
317
|
+
theme: { preset: mazUi },
|
|
318
|
+
defaults: {
|
|
319
|
+
global: { flagSrc: loadCountryFlag }, // or a URL template: '/flags/{code}.svg'
|
|
320
|
+
},
|
|
321
|
+
})
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
// Nuxt: nuxt.config.ts
|
|
326
|
+
export default defineNuxtConfig({
|
|
327
|
+
modules: ['@maz-ui/nuxt'],
|
|
328
|
+
mazUi: {
|
|
329
|
+
flags: 'local', // 'cdn' (default) | 'local' | a URL template: '/flags/{code}.svg'
|
|
330
|
+
},
|
|
331
|
+
})
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Flags of maz-ui, offline
|
|
335
|
+
|
|
336
|
+
`loadCountryFlag` gives the square flag of a code from the 256 flags of `@maz-ui/icons`, as a `data:image/svg+xml` URL: no request to a third party (nothing to allow for flagcdn.com in your Content Security Policy, the user's IP is not sent to it), and the component works offline (hybrid apps with Capacitor or Cordova, PWAs, intranets).
|
|
337
|
+
|
|
338
|
+
<ComponentDemo>
|
|
339
|
+
<div class="maz:flex maz:gap-4 maz:flex-wrap">
|
|
340
|
+
<MazSelectCountry
|
|
341
|
+
v-model="localFlagsExample"
|
|
342
|
+
label="Country (flags of maz-ui)"
|
|
343
|
+
:flag-src="loadCountryFlag"
|
|
344
|
+
/>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
<template #code>
|
|
348
|
+
|
|
349
|
+
```vue
|
|
350
|
+
<script lang="ts" setup>
|
|
351
|
+
import { loadCountryFlag } from 'maz-ui/country-flags'
|
|
352
|
+
import { ref } from 'vue'
|
|
353
|
+
|
|
354
|
+
const selectedCountry = ref('FR')
|
|
355
|
+
</script>
|
|
356
|
+
|
|
357
|
+
<template>
|
|
358
|
+
<MazSelectCountry
|
|
359
|
+
v-model="selectedCountry"
|
|
360
|
+
label="Country (flags of maz-ui)"
|
|
361
|
+
:flag-src="loadCountryFlag"
|
|
362
|
+
/>
|
|
363
|
+
</template>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
</template>
|
|
367
|
+
</ComponentDemo>
|
|
368
|
+
|
|
369
|
+
How it stays light:
|
|
370
|
+
|
|
371
|
+
- Nothing in maz-ui imports `maz-ui/country-flags`: an app that does not import it has **no flag file at all** in its build.
|
|
372
|
+
- Once imported, your bundler emits **one small chunk per flag** (256 files, from a few hundred bytes to a few kilobytes each). None is preloaded: only the flags displayed are downloaded.
|
|
373
|
+
- The loader itself (a table of 256 dynamic imports, about 4 kB gzipped) goes into the chunk that imports it. To keep it out of your entry chunk, import it on demand (the Nuxt option `flags: 'local'` does it for you):
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
const flagSrc = (code: string) => import('maz-ui/country-flags').then(({ loadCountryFlag }) => loadCountryFlag(code))
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
::: tip Content Security Policy
|
|
380
|
+
The flags are `data:` URLs: a strict CSP must allow `img-src data:` (already needed by the lazy images of maz-ui).
|
|
381
|
+
:::
|
|
382
|
+
|
|
383
|
+
::: tip PWA precache
|
|
384
|
+
Once you use `loadCountryFlag`, the 256 flag chunks are part of your build, so a service worker that precaches every `**/*.js` downloads all of them at install. Keep them (every flag available offline) or exclude them and let them load on demand. With Vite, the chunks are named after their module, `MazFlagSquareFR-[hash].js`:
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
// vite-plugin-pwa
|
|
388
|
+
VitePWA({ workbox: { globIgnores: ['**/MazFlagSquare*.js'] } })
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Nuxt names its chunks `_nuxt/[hash].js` only: name the flag chunks yourself to exclude them, e.g. `vite.build.rollupOptions.output.chunkFileNames: chunk => chunk.name.startsWith('MazFlagSquare') ? '_nuxt/flags/[name].[hash].js' : '_nuxt/[hash].js'`, then ignore `**/_nuxt/flags/**`.
|
|
392
|
+
:::
|
|
393
|
+
|
|
394
|
+
### Your own files
|
|
395
|
+
|
|
396
|
+
A URL template, with `{code}` for the lowercase code and `{CODE}` for the uppercase code. The images are lazy loaded like the CDN ones. A missing image displays the badge.
|
|
397
|
+
|
|
398
|
+
```vue
|
|
399
|
+
<template>
|
|
400
|
+
<!-- public/flags/fr.svg, public/flags/de.svg... -->
|
|
401
|
+
<MazSelectCountry v-model="selectedCountry" flag-src="/flags/{code}.svg" />
|
|
402
|
+
|
|
403
|
+
<!-- another host, uppercase codes -->
|
|
404
|
+
<MazSelectCountry v-model="selectedCountry" flag-src="https://assets.example.com/flags/{CODE}.png" />
|
|
405
|
+
</template>
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Your own function
|
|
409
|
+
|
|
410
|
+
A function receives the country code of each flag when it becomes visible, and returns the image source (URL or data URL), or `undefined` to display the badge. It can be async: only the flags displayed are loaded.
|
|
411
|
+
|
|
412
|
+
```vue
|
|
413
|
+
<script lang="ts" setup>
|
|
414
|
+
// One file per flag in your project, loaded on demand (Vite turns this import into one chunk per file)
|
|
415
|
+
function flagSrc(code: string) {
|
|
416
|
+
return import(`./assets/flags/${code.toLowerCase()}.svg?url`)
|
|
417
|
+
.then(module => module.default)
|
|
418
|
+
.catch(() => undefined)
|
|
419
|
+
}
|
|
420
|
+
</script>
|
|
421
|
+
|
|
422
|
+
<template>
|
|
423
|
+
<MazSelectCountry v-model="selectedCountry" :flag-src="flagSrc" />
|
|
424
|
+
</template>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
You can also replace the flags entirely with the `selector-flag` and `country-list-flag` slots.
|
|
428
|
+
|
|
294
429
|
## Without flags
|
|
295
430
|
|
|
296
431
|
Hide country flags using the `hideFlags` prop for a cleaner text-only interface.
|
|
@@ -564,7 +699,7 @@ The `MazSelectCountry` component is built on top of `MazSelect` and leverages th
|
|
|
564
699
|
|
|
565
700
|
- **Automatic localization**: Country and language names are displayed in the user's locale
|
|
566
701
|
- **Built-in search**: Users can quickly find countries by typing
|
|
567
|
-
- **Flag integration**: Automatic flag display using country codes
|
|
702
|
+
- **Flag integration**: Automatic flag display using country codes, from the flagcdn.com CDN, the flags of maz-ui (offline) or your own files
|
|
568
703
|
- **Flexible filtering**: Support for preferred, ignored, or specific country lists
|
|
569
704
|
- **Custom options**: Override default behavior with custom data
|
|
570
705
|
- **Accessibility**: Full keyboard navigation and screen reader support
|
|
@@ -592,6 +727,7 @@ const allCountries = getAllDisplayNames({
|
|
|
592
727
|
This ensures consistent internationalization across your application while providing maximum flexibility for different use cases.
|
|
593
728
|
|
|
594
729
|
<script setup>
|
|
730
|
+
import { loadCountryFlag } from 'maz-ui/country-flags'
|
|
595
731
|
import { ref } from 'vue'
|
|
596
732
|
|
|
597
733
|
// Basic examples
|
|
@@ -613,6 +749,7 @@ const excludeExample = ref()
|
|
|
613
749
|
const shortExample = ref()
|
|
614
750
|
const languageNarrowExample = ref()
|
|
615
751
|
const noFlagsExample = ref()
|
|
752
|
+
const localFlagsExample = ref('FR')
|
|
616
753
|
const frenchExample = ref()
|
|
617
754
|
const spanishExample = ref()
|
|
618
755
|
const successExample = ref()
|