@maz-ui/mcp 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/README.md +61 -228
- package/bin/maz-ui-mcp.mjs +2 -5
- package/dist/cli.d.mts +7 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.mjs +14 -0
- package/dist/index.d.mts +340 -0
- package/dist/index.d.ts +340 -0
- package/dist/index.mjs +14 -0
- package/dist/shared/mcp.DzqVbCaL.mjs +2346 -0
- 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/{src/components → components}/maz-alert.md +31 -164
- 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/{src/components → components}/maz-badge.md +26 -67
- package/docs/components/maz-bottom-sheet.md +257 -0
- package/docs/{src/components → components}/maz-btn-group.md +26 -189
- package/docs/{src/components → components}/maz-btn.md +60 -245
- package/docs/components/maz-card-spotlight.md +84 -0
- package/docs/{src/components → components}/maz-card.md +67 -192
- package/docs/components/maz-carousel.md +153 -0
- package/docs/{src/components → components}/maz-chart.md +17 -161
- 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/{src/components → components}/maz-code-highlight.md +15 -93
- package/docs/components/maz-container.md +241 -0
- package/docs/{src/components → components}/maz-date-picker.md +85 -454
- 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/{src/components → components}/maz-dropzone.md +80 -221
- 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/{src/components → components}/maz-icon.md +32 -83
- 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/{src/components → components}/maz-input.md +74 -221
- 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/{src/components → components}/maz-markdown-editor.md +72 -125
- package/docs/components/maz-pagination.md +82 -0
- package/docs/components/maz-popover.md +794 -0
- package/docs/{src/components → components}/maz-pull-to-refresh.md +59 -45
- package/docs/components/maz-radio-buttons.md +313 -0
- package/docs/components/maz-radio.md +119 -0
- package/docs/{src/components → components}/maz-read-more.md +31 -122
- package/docs/components/maz-reading-progress-bar.md +96 -0
- package/docs/{src/components → components}/maz-select-country.md +80 -340
- package/docs/{src/components → components}/maz-select.md +76 -206
- 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/{src/components → components}/maz-sidebar.md +117 -329
- package/docs/{src/components → components}/maz-skeleton.md +27 -156
- package/docs/{src/components → components}/maz-slider.md +33 -66
- package/docs/components/maz-spinner.md +84 -0
- package/docs/{src/components → components}/maz-stepper.md +43 -185
- 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/{src/components → components}/maz-tabs.md +89 -126
- 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/{src/components → components}/maz-window-mockup.md +38 -105
- 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/{src/composables → composables}/use-display-names.md +12 -59
- package/docs/{src/composables → composables}/use-drag.md +14 -68
- package/docs/{src/composables → composables}/use-form-validator.md +22 -696
- package/docs/{src/composables → composables}/use-idle-timeout.md +13 -97
- package/docs/{src/composables → composables}/use-pull-to-refresh.md +14 -7
- package/docs/{src/composables → composables}/use-reading-time.md +20 -56
- package/docs/composables/use-string-matching.md +41 -0
- package/docs/{src/composables → composables}/use-swipe.md +14 -81
- package/docs/{src/composables → composables}/use-timer.md +12 -38
- package/docs/composables/use-toast.md +50 -0
- package/docs/{src/composables → composables}/use-user-visibility.md +14 -56
- package/docs/composables/use-wait.md +50 -0
- package/docs/composables/use-window-size.md +25 -0
- package/docs/{src/directives → directives}/click-outside.md +13 -99
- package/docs/{src/directives → directives}/fullscreen-img.md +10 -28
- package/docs/{src/directives → directives}/lazy-img.md +14 -49
- package/docs/{src/directives → directives}/tooltip.md +12 -217
- package/docs/{src/directives → directives}/zoom-img.md +11 -38
- package/docs/{src/ecosystem → ecosystem}/eslint-config.md +37 -29
- package/docs/ecosystem/icons/icon-set.md +25 -0
- package/docs/{src/ecosystem → ecosystem}/icons/index.md +22 -16
- package/docs/ecosystem/mcp.md +165 -0
- package/docs/{src/ecosystem → ecosystem}/node/exec-promise.md +12 -6
- package/docs/ecosystem/node/index.md +53 -0
- package/docs/{src/ecosystem → ecosystem}/node/logger.md +12 -6
- package/docs/{src/ecosystem → ecosystem}/node/print-banner.md +12 -4
- package/docs/ecosystem/node/setup-agents.md +102 -0
- package/docs/{src/ecosystem → ecosystem}/nuxt.md +46 -19
- package/docs/{src/ecosystem → ecosystem}/stylelint-config.md +33 -25
- package/docs/{src/ecosystem → ecosystem}/themes.md +72 -235
- package/docs/{src/ecosystem → ecosystem}/translations.md +25 -23
- package/docs/ecosystem/utils/camel-case.md +37 -0
- package/docs/ecosystem/utils/capitalize.md +37 -0
- package/docs/{src/ecosystem → ecosystem}/utils/check-availability.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/cookie.md +18 -12
- package/docs/ecosystem/utils/country-code-to-unicode-flag.md +128 -0
- package/docs/{src/ecosystem → ecosystem}/utils/currency.md +12 -26
- package/docs/{src/ecosystem → ecosystem}/utils/date.md +10 -24
- package/docs/ecosystem/utils/debounce-callback.md +44 -0
- package/docs/{src/ecosystem → ecosystem}/utils/debounce-id.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/debounce.md +14 -8
- package/docs/ecosystem/utils/fetch-locale-ip.md +39 -0
- package/docs/{src/ecosystem → ecosystem}/utils/format-json.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/format-phone-number.md +12 -6
- package/docs/ecosystem/utils/get-browser-locale.md +35 -0
- package/docs/ecosystem/utils/get-country-flag-url.md +67 -0
- package/docs/{src/ecosystem → ecosystem}/utils/get-error-message.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/idle-timeout.md +15 -9
- package/docs/{src/ecosystem → ecosystem}/utils/index.md +10 -13
- package/docs/{src/ecosystem → ecosystem}/utils/is-client.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/is-equal.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/is-ios.md +12 -6
- package/docs/ecosystem/utils/is-server.md +37 -0
- package/docs/ecosystem/utils/is-standalone-mode.md +49 -0
- package/docs/{src/ecosystem → ecosystem}/utils/kebab-case.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/normalize-string.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/number.md +10 -24
- package/docs/{src/ecosystem → ecosystem}/utils/pascal-case.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/prevent-ios-input-zoom.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/script-loader.md +16 -8
- package/docs/{src/ecosystem → ecosystem}/utils/sleep.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/snake-case.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/swipe-handler.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/textarea-autogrow.md +12 -6
- package/docs/{src/ecosystem → ecosystem}/utils/throttle-id.md +13 -7
- package/docs/{src/ecosystem → ecosystem}/utils/throttle.md +14 -8
- package/docs/ecosystem/utils/truthy-filter.md +37 -0
- package/docs/{src/ecosystem → ecosystem}/utils/types/deep-key-of.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/types/deep-partial.md +10 -4
- package/docs/ecosystem/utils/types/deep-required.md +45 -0
- package/docs/ecosystem/utils/types/flatten-object-keys.md +50 -0
- package/docs/{src/ecosystem → ecosystem}/utils/types/generic-instance-type.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/types/infer-maybe-ref.md +10 -4
- package/docs/ecosystem/utils/upper-first.md +38 -0
- package/docs/{src/ecosystem → ecosystem}/utils/user-visibility.md +12 -6
- package/docs/guide/ai-agents.md +237 -0
- package/docs/{src/guide → guide}/browser-support.md +22 -15
- package/docs/{src/guide → guide}/getting-started.md +34 -139
- package/docs/{src/guide → guide}/global-defaults.md +12 -11
- package/docs/{src/guide → guide}/maz-ui-provider.md +17 -16
- package/docs/{src/guide → guide}/migration-v5.md +95 -88
- package/docs/{src/guide → guide}/resolvers.md +33 -100
- package/docs/guide/tailwind.md +483 -0
- package/docs/{src/guide → guide}/vue.md +33 -39
- package/docs/manifest.json +1 -0
- package/docs/{src/plugins → plugins}/aos.md +20 -55
- package/docs/{src/plugins → plugins}/dialog.md +14 -161
- 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 +84 -22
- package/dist/mcp.d.mts +0 -153
- package/dist/mcp.d.ts +0 -153
- package/dist/mcp.mjs +0 -1511
- package/docs/generated-docs/maz-accordion.doc.md +0 -21
- package/docs/generated-docs/maz-alert.doc.md +0 -20
- package/docs/generated-docs/maz-animated-counter.doc.md +0 -17
- package/docs/generated-docs/maz-animated-element.doc.md +0 -14
- package/docs/generated-docs/maz-animated-text.doc.md +0 -17
- package/docs/generated-docs/maz-avatar.doc.md +0 -45
- package/docs/generated-docs/maz-backdrop.doc.md +0 -55
- package/docs/generated-docs/maz-badge.doc.md +0 -16
- package/docs/generated-docs/maz-bottom-sheet.doc.md +0 -24
- package/docs/generated-docs/maz-btn-group.doc.md +0 -20
- package/docs/generated-docs/maz-btn.doc.md +0 -33
- package/docs/generated-docs/maz-card-spotlight.doc.md +0 -16
- package/docs/generated-docs/maz-card.doc.md +0 -39
- package/docs/generated-docs/maz-carousel.doc.md +0 -17
- package/docs/generated-docs/maz-chart.doc.md +0 -10
- package/docs/generated-docs/maz-checkbox.doc.md +0 -33
- package/docs/generated-docs/maz-checklist.doc.md +0 -30
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +0 -27
- package/docs/generated-docs/maz-code-highlight.doc.md +0 -11
- package/docs/generated-docs/maz-container.doc.md +0 -26
- package/docs/generated-docs/maz-date-picker.doc.md +0 -56
- package/docs/generated-docs/maz-dialog-confirm.doc.md +0 -24
- package/docs/generated-docs/maz-dialog.doc.md +0 -22
- package/docs/generated-docs/maz-drawer.doc.md +0 -25
- package/docs/generated-docs/maz-dropdown.doc.md +0 -45
- package/docs/generated-docs/maz-dropzone.doc.md +0 -82
- package/docs/generated-docs/maz-expand-animation.doc.md +0 -12
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +0 -13
- package/docs/generated-docs/maz-gallery.doc.md +0 -17
- package/docs/generated-docs/maz-icon.doc.md +0 -16
- package/docs/generated-docs/maz-input-code.doc.md +0 -25
- package/docs/generated-docs/maz-input-number.doc.md +0 -33
- package/docs/generated-docs/maz-input-phone-number.doc.md +0 -62
- package/docs/generated-docs/maz-input-price.doc.md +0 -26
- package/docs/generated-docs/maz-input-tags.doc.md +0 -24
- package/docs/generated-docs/maz-input.doc.md +0 -54
- package/docs/generated-docs/maz-lazy-img.doc.md +0 -49
- package/docs/generated-docs/maz-link.doc.md +0 -31
- package/docs/generated-docs/maz-loading-bar.doc.md +0 -6
- package/docs/generated-docs/maz-markdown-editor.doc.md +0 -65
- package/docs/generated-docs/maz-pagination.doc.md +0 -21
- package/docs/generated-docs/maz-popover.doc.md +0 -79
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +0 -50
- package/docs/generated-docs/maz-radio-buttons.doc.md +0 -34
- package/docs/generated-docs/maz-radio.doc.md +0 -33
- package/docs/generated-docs/maz-read-more.doc.md +0 -18
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +0 -18
- package/docs/generated-docs/maz-select-country.doc.md +0 -45
- package/docs/generated-docs/maz-select.doc.md +0 -32
- package/docs/generated-docs/maz-sidebar-content.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-footer.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-group.doc.md +0 -11
- package/docs/generated-docs/maz-sidebar-header.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-menu-button.doc.md +0 -27
- package/docs/generated-docs/maz-sidebar-menu-item.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +0 -16
- package/docs/generated-docs/maz-sidebar-menu.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar.doc.md +0 -36
- package/docs/generated-docs/maz-skeleton.doc.md +0 -12
- package/docs/generated-docs/maz-slider.doc.md +0 -20
- package/docs/generated-docs/maz-spinner.doc.md +0 -6
- package/docs/generated-docs/maz-stepper.doc.md +0 -30
- package/docs/generated-docs/maz-switch.doc.md +0 -31
- package/docs/generated-docs/maz-table-cell.doc.md +0 -5
- package/docs/generated-docs/maz-table-row.doc.md +0 -12
- package/docs/generated-docs/maz-table-title.doc.md +0 -5
- package/docs/generated-docs/maz-table-virtualizer.doc.md +0 -20
- package/docs/generated-docs/maz-table.doc.md +0 -72
- package/docs/generated-docs/maz-tabs-bar.doc.md +0 -29
- package/docs/generated-docs/maz-tabs-content-item.doc.md +0 -11
- package/docs/generated-docs/maz-tabs-content.doc.md +0 -5
- package/docs/generated-docs/maz-tabs.doc.md +0 -20
- package/docs/generated-docs/maz-textarea.doc.md +0 -46
- package/docs/generated-docs/maz-ticker.doc.md +0 -25
- package/docs/generated-docs/maz-timeline.doc.md +0 -32
- package/docs/generated-docs/maz-ui-provider.doc.md +0 -12
- package/docs/generated-docs/maz-window-mockup.doc.md +0 -23
- package/docs/src/blog/v4.md +0 -276
- package/docs/src/blog/v5.md +0 -184
- package/docs/src/changelog.md +0 -7
- package/docs/src/components/index.md +0 -8
- package/docs/src/components/maz-accordion.md +0 -80
- package/docs/src/components/maz-animated-counter.md +0 -124
- package/docs/src/components/maz-animated-element.md +0 -36
- package/docs/src/components/maz-animated-text.md +0 -36
- package/docs/src/components/maz-avatar.md +0 -227
- package/docs/src/components/maz-backdrop.md +0 -250
- package/docs/src/components/maz-bottom-sheet.md +0 -533
- package/docs/src/components/maz-card-spotlight.md +0 -163
- package/docs/src/components/maz-carousel.md +0 -231
- package/docs/src/components/maz-checkbox.md +0 -168
- package/docs/src/components/maz-checklist.md +0 -414
- package/docs/src/components/maz-circular-progress-bar.md +0 -145
- package/docs/src/components/maz-container.md +0 -363
- package/docs/src/components/maz-dialog-confirm.md +0 -240
- package/docs/src/components/maz-dialog.md +0 -164
- package/docs/src/components/maz-drawer.md +0 -181
- package/docs/src/components/maz-dropdown.md +0 -691
- package/docs/src/components/maz-expand-animation.md +0 -99
- package/docs/src/components/maz-fullscreen-loader.md +0 -58
- package/docs/src/components/maz-gallery.md +0 -85
- package/docs/src/components/maz-input-code.md +0 -61
- package/docs/src/components/maz-input-number.md +0 -81
- package/docs/src/components/maz-input-phone-number.md +0 -942
- package/docs/src/components/maz-input-price.md +0 -67
- package/docs/src/components/maz-input-tags.md +0 -114
- package/docs/src/components/maz-lazy-img.md +0 -88
- package/docs/src/components/maz-link.md +0 -178
- package/docs/src/components/maz-loading-bar.md +0 -26
- package/docs/src/components/maz-pagination.md +0 -79
- package/docs/src/components/maz-popover.md +0 -1416
- package/docs/src/components/maz-radio-buttons.md +0 -462
- package/docs/src/components/maz-radio.md +0 -142
- package/docs/src/components/maz-reading-progress-bar.md +0 -74
- package/docs/src/components/maz-spinner.md +0 -93
- package/docs/src/components/maz-switch.md +0 -92
- package/docs/src/components/maz-table.md +0 -732
- package/docs/src/components/maz-textarea.md +0 -400
- package/docs/src/components/maz-ticker.md +0 -692
- package/docs/src/components/maz-timeline.md +0 -478
- package/docs/src/composables/use-aos.md +0 -34
- package/docs/src/composables/use-breakpoints.md +0 -35
- package/docs/src/composables/use-dialog.md +0 -88
- package/docs/src/composables/use-string-matching.md +0 -63
- package/docs/src/composables/use-toast.md +0 -71
- package/docs/src/composables/use-wait.md +0 -62
- package/docs/src/composables/use-window-size.md +0 -18
- package/docs/src/ecosystem/icons/icon-set.md +0 -123
- package/docs/src/ecosystem/mcp.md +0 -210
- package/docs/src/ecosystem/node/index.md +0 -53
- package/docs/src/ecosystem/utils/camel-case.md +0 -31
- package/docs/src/ecosystem/utils/capitalize.md +0 -50
- package/docs/src/ecosystem/utils/country-code-to-unicode-flag.md +0 -213
- package/docs/src/ecosystem/utils/debounce-callback.md +0 -38
- package/docs/src/ecosystem/utils/fetch-locale-ip.md +0 -33
- package/docs/src/ecosystem/utils/get-browser-locale.md +0 -29
- package/docs/src/ecosystem/utils/get-country-flag-url.md +0 -156
- package/docs/src/ecosystem/utils/is-server.md +0 -31
- package/docs/src/ecosystem/utils/is-standalone-mode.md +0 -43
- package/docs/src/ecosystem/utils/truthy-filter.md +0 -31
- package/docs/src/ecosystem/utils/types/deep-required.md +0 -39
- package/docs/src/ecosystem/utils/types/flatten-object-keys.md +0 -44
- package/docs/src/ecosystem/utils/upper-first.md +0 -32
- package/docs/src/guide/cli.md +0 -144
- package/docs/src/guide/migration-v4.md +0 -925
- package/docs/src/guide/tailwind.md +0 -158
- package/docs/src/index.md +0 -603
- package/docs/src/made-with-maz-ui.md +0 -58
- package/docs/src/plugins/toast.md +0 -349
- package/docs/src/plugins/wait.md +0 -109
- package/docs/src/theme-editor.md +0 -21
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "getBrowserLocale"
|
|
3
|
+
description: "Read the user's browser language tag (e.g. `'fr-FR'`, `'en-US'`) - returns `undefined` on the server."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/get-browser-locale"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# getBrowserLocale
|
|
9
|
+
|
|
10
|
+
> Read the user's browser language tag (e.g. `'fr-FR'`, `'en-US'`) - returns `undefined` on the server.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { getBrowserLocale } from '@maz-ui/utils/helpers/getBrowserLocale'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/get-browser-locale
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { getBrowserLocale } from '@maz-ui/utils'
|
|
20
|
+
|
|
21
|
+
const locale = getBrowserLocale() // 'fr-FR' | 'en-US' | … | undefined
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
function getBrowserLocale(): string | undefined
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Returns `navigator.language` on the client. On the server (no `navigator`), returns `undefined`.
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- For IP-based country detection instead of the browser-declared locale, see [`fetchLocaleIp`](./fetch-locale-ip.md).
|
|
35
|
+
- The returned tag follows [BCP 47](https://www.rfc-editor.org/info/bcp47).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "getCountryFlagUrl"
|
|
3
|
+
description: "Get country flag from flagcdn.com with a simple function call"
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/get-country-flag-url"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# getCountryFlagUrl
|
|
9
|
+
|
|
10
|
+
> Get country flag from flagcdn.com with a simple function call
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { getCountryFlagUrl } from '@maz-ui/utils/helpers/getCountryFlagUrl'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/get-country-flag-url
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<template>
|
|
20
|
+
<img :src="flagSrc" alt="Flag of France" />
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts" setup >
|
|
24
|
+
import { getCountryFlagUrl } from '@maz-ui/utils'
|
|
25
|
+
|
|
26
|
+
const flagSrc = getCountryFlagUrl('FR')
|
|
27
|
+
</script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Sizing
|
|
31
|
+
|
|
32
|
+
**Details: Show full code**
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<template>
|
|
36
|
+
<img
|
|
37
|
+
v-for="{ src, size, countryCode } in sizedFlags"
|
|
38
|
+
:key="src"
|
|
39
|
+
:src="src"
|
|
40
|
+
:alt="`${countryCode} Flag`"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts" setup>
|
|
45
|
+
import { computed } from 'vue'
|
|
46
|
+
import { getCountryFlagUrl } from '@maz-ui/utils'
|
|
47
|
+
|
|
48
|
+
const countryCode = ref('FR')
|
|
49
|
+
|
|
50
|
+
const sizedFlags = computed(() => {
|
|
51
|
+
const sizes: Size[] = [
|
|
52
|
+
'16x12',
|
|
53
|
+
'20x15',
|
|
54
|
+
'24x18',
|
|
55
|
+
'80x60',
|
|
56
|
+
'h80',
|
|
57
|
+
'w160',
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
return sizes.map(size => ({
|
|
61
|
+
src: getCountryFlagUrl(countryCode.value, size),
|
|
62
|
+
size: size,
|
|
63
|
+
countryCode: countryCode.value
|
|
64
|
+
}))
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: getErrorMessage
|
|
3
|
-
description: Extract a human-readable message from anything thrown
|
|
2
|
+
title: "getErrorMessage"
|
|
3
|
+
description: "Extract a human-readable message from anything thrown - `Error`, `string`, `{ message }` objects, or arbitrary values."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/get-error-message"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# getErrorMessage
|
|
7
9
|
|
|
8
|
-
{
|
|
10
|
+
> Extract a human-readable message from anything thrown - `Error`, `string`, `{ message }` objects, or arbitrary values.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { getErrorMessage } from '@maz-ui/utils/helpers/getErrorMessage'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/get-error-message
|
|
9
15
|
|
|
10
16
|
Especially useful inside `catch` blocks where the caught value is typed `unknown`.
|
|
11
17
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: IdleTimeout
|
|
3
|
-
description: Detect user inactivity (mouse, keyboard, touch, scroll) and run a callback when the user becomes idle.
|
|
2
|
+
title: "IdleTimeout"
|
|
3
|
+
description: "Detect user inactivity (mouse, keyboard, touch, scroll) and run a callback when the user becomes idle."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/idle-timeout"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# IdleTimeout
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Detect user inactivity (mouse, keyboard, touch, scroll) and run a callback when the user becomes idle.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { IdleTimeout } from '@maz-ui/utils/helpers/idleTimeout'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/idle-timeout
|
|
9
15
|
|
|
10
16
|
`IdleTimeout` listens for a range of user-input events (`mousedown`, `keydown`, `touchstart`, `wheel`, …) on a target element. When none of them fire for `timeout` ms, the user is considered idle and your callback is invoked.
|
|
11
17
|
|
|
@@ -65,10 +71,10 @@ type IdleTimeoutCallback = (payload: {
|
|
|
65
71
|
|
|
66
72
|
### Methods
|
|
67
73
|
|
|
68
|
-
- **`start()`**
|
|
69
|
-
- **`pause()` / `resume()`**
|
|
70
|
-
- **`reset()`**
|
|
71
|
-
- **`destroy()`**
|
|
74
|
+
- **`start()`** - Attach listeners and (re)start the timer. The constructor calls this automatically on the client.
|
|
75
|
+
- **`pause()` / `resume()`** - Freeze and unfreeze the countdown without losing the elapsed time.
|
|
76
|
+
- **`reset()`** - Restart the timer from scratch.
|
|
77
|
+
- **`destroy()`** - Detach all listeners. The watcher cannot be reused after destroy.
|
|
72
78
|
|
|
73
79
|
## Examples
|
|
74
80
|
|
|
@@ -87,4 +93,4 @@ const idle = new IdleTimeout(
|
|
|
87
93
|
|
|
88
94
|
## Related
|
|
89
95
|
|
|
90
|
-
- [`UserVisibility`](./user-visibility)
|
|
96
|
+
- [`UserVisibility`](./user-visibility.md) - track tab focus / visibility instead of in-page activity.
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description: Lightweight, tree-shakeable utility functions and TypeScript helpers for Vue, Nuxt and any JavaScript/TypeScript project.
|
|
2
|
+
title: "@maz-ui/utils"
|
|
3
|
+
description: "Lightweight, tree-shakeable utility functions and TypeScript helpers for Vue, Nuxt and any JavaScript/TypeScript project."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# @maz-ui/utils
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Lightweight, tree-shakeable utility functions and TypeScript helpers for Vue, Nuxt and any JavaScript/TypeScript project.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Web: https://maz-ui.com/ecosystem/utils/
|
|
11
14
|
|
|
12
|
-
`@maz-ui/utils` ships the runtime helpers and TypeScript type utilities that power maz-ui internally, packaged as a standalone, framework-agnostic library. No Vue dependency, no global side effects
|
|
15
|
+
`@maz-ui/utils` ships the runtime helpers and TypeScript type utilities that power maz-ui internally, packaged as a standalone, framework-agnostic library. No Vue dependency, no global side effects - just import what you need.
|
|
13
16
|
|
|
14
17
|
## Installation
|
|
15
18
|
|
|
16
|
-
::: code-group
|
|
17
|
-
|
|
18
19
|
```bash [pnpm]
|
|
19
20
|
pnpm add @maz-ui/utils
|
|
20
21
|
```
|
|
@@ -27,8 +28,6 @@ npm install @maz-ui/utils
|
|
|
27
28
|
yarn add @maz-ui/utils
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
:::
|
|
31
|
-
|
|
32
31
|
## Basic usage
|
|
33
32
|
|
|
34
33
|
```ts
|
|
@@ -43,11 +42,9 @@ await sleep(500)
|
|
|
43
42
|
|
|
44
43
|
## What's inside
|
|
45
44
|
|
|
46
|
-
<UtilsCatalogue />
|
|
47
|
-
|
|
48
45
|
## Tree-shaking
|
|
49
46
|
|
|
50
|
-
The package is published with `"sideEffects": false`. Named imports
|
|
47
|
+
The package is published with `"sideEffects": false`. Named imports - `import { sleep } from '@maz-ui/utils'` - are statically analysed by Vite, Rollup, esbuild and webpack: any helper you don't reference is dropped from your bundle.
|
|
51
48
|
|
|
52
49
|
For granular bundling you can also import a single helper through its dedicated subpath:
|
|
53
50
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: isClient
|
|
3
|
-
description: Check whether the code is running in a browser environment (has a `document`).
|
|
2
|
+
title: "isClient"
|
|
3
|
+
description: "Check whether the code is running in a browser environment (has a `document`)."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/is-client"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# isClient
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Check whether the code is running in a browser environment (has a `document`).
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { isClient } from '@maz-ui/utils/helpers/isClient'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/is-client
|
|
9
15
|
|
|
10
16
|
## Usage
|
|
11
17
|
|
|
@@ -27,6 +33,6 @@ Returns `true` if `document` is defined, `false` otherwise (e.g. SSR, Node.js, W
|
|
|
27
33
|
|
|
28
34
|
## Notes
|
|
29
35
|
|
|
30
|
-
- The opposite is [`isServer`](./is-server).
|
|
36
|
+
- The opposite is [`isServer`](./is-server.md).
|
|
31
37
|
- Implemented as a one-liner: `typeof document !== 'undefined'`.
|
|
32
38
|
- Prefer this over checking `process.client` (Nuxt) or `import.meta.env.SSR` (Vite) when you want a framework-agnostic check.
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: isEqual
|
|
3
|
-
description: Deep structural equality check for primitives, arrays, plain objects and Dates.
|
|
2
|
+
title: "isEqual"
|
|
3
|
+
description: "Deep structural equality check for primitives, arrays, plain objects and Dates."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/is-equal"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# isEqual
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Deep structural equality check for primitives, arrays, plain objects and Dates.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { isEqual } from '@maz-ui/utils/helpers/isEqual'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/is-equal
|
|
9
15
|
|
|
10
16
|
## Usage
|
|
11
17
|
|
|
@@ -31,8 +37,8 @@ function isEqual(a: unknown, b: unknown): boolean
|
|
|
31
37
|
|
|
32
38
|
## Behaviour
|
|
33
39
|
|
|
34
|
-
- **Primitives** (`null`, `undefined`, `string`, `number`, `boolean`, `symbol`, `bigint`)
|
|
35
|
-
- **Dates**
|
|
36
|
-
- **Arrays**
|
|
37
|
-
- **Plain objects**
|
|
40
|
+
- **Primitives** (`null`, `undefined`, `string`, `number`, `boolean`, `symbol`, `bigint`) - compared with `===`.
|
|
41
|
+
- **Dates** - compared by `getTime()`.
|
|
42
|
+
- **Arrays** - same length and every element deeply equal.
|
|
43
|
+
- **Plain objects** - same set of keys and every value deeply equal.
|
|
38
44
|
- **Anything else** (Maps, Sets, class instances, functions) is not specifically handled; comparisons fall back to `===`.
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: isIos
|
|
3
|
-
description: Check whether the page runs on iOS or iPadOS, including iPads that report a desktop Mac user agent.
|
|
2
|
+
title: "isIos"
|
|
3
|
+
description: "Check whether the page runs on iOS or iPadOS, including iPads that report a desktop Mac user agent."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/is-ios"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# isIos
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Check whether the page runs on iOS or iPadOS, including iPads that report a desktop Mac user agent.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { isIos } from '@maz-ui/utils/helpers/isIos'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/is-ios
|
|
9
15
|
|
|
10
16
|
## Usage
|
|
11
17
|
|
|
@@ -32,6 +38,6 @@ The check returns `true` when **either**:
|
|
|
32
38
|
- the user agent contains `iPhone`, `iPad` or `iPod`;
|
|
33
39
|
- the user agent contains `Macintosh` and the device has touch support (`navigator.maxTouchPoints > 1`) - iPadOS 13+ reports a desktop Mac user agent by default.
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
**Tip:**
|
|
42
|
+
|
|
36
43
|
Prefer feature detection when it exists (`CSS.supports`, `matchMedia`...). Use `isIos` for behaviors that are specific to the platform, like [preventIosInputZoom](./prevent-ios-input-zoom.md).
|
|
37
|
-
:::
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "isServer"
|
|
3
|
+
description: "Check whether the code is running on the server (no `window` or `document`)."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/is-server"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# isServer
|
|
9
|
+
|
|
10
|
+
> Check whether the code is running on the server (no `window` or `document`).
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { isServer } from '@maz-ui/utils/helpers/isServer'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/is-server
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { isServer } from '@maz-ui/utils'
|
|
20
|
+
|
|
21
|
+
if (isServer()) {
|
|
22
|
+
return placeholder
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
function isServer(): boolean
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Returns `true` when either `document` or `window` is undefined - covers Node.js, Bun, Deno, Edge runtimes and Web Workers.
|
|
33
|
+
|
|
34
|
+
## Notes
|
|
35
|
+
|
|
36
|
+
- The opposite is [`isClient`](./is-client.md).
|
|
37
|
+
- Useful for guarding `window`-dependent code from SSR errors.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "isStandaloneMode"
|
|
3
|
+
description: "Check whether the app is running as an installed Progressive Web App (PWA) rather than inside a browser tab."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/is-standalone-mode"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# isStandaloneMode
|
|
9
|
+
|
|
10
|
+
> Check whether the app is running as an installed Progressive Web App (PWA) rather than inside a browser tab.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { isStandaloneMode } from '@maz-ui/utils/helpers/isStandaloneMode'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/is-standalone-mode
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { isStandaloneMode } from '@maz-ui/utils'
|
|
20
|
+
|
|
21
|
+
if (isStandaloneMode()) {
|
|
22
|
+
console.log('Running as installed PWA')
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
function isStandaloneMode(): boolean
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Returns `true` if the page is rendered in standalone display mode, `false` otherwise (including during SSR).
|
|
33
|
+
|
|
34
|
+
## Detection rules
|
|
35
|
+
|
|
36
|
+
The check returns `true` when **either**:
|
|
37
|
+
|
|
38
|
+
- `window.matchMedia('(display-mode: standalone)').matches` - covers Chrome, Edge, Firefox, etc.
|
|
39
|
+
- `navigator.standalone` is truthy - iOS Safari's legacy property.
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
Hide install prompts when already installed:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
if (!isStandaloneMode()) {
|
|
47
|
+
showInstallBanner()
|
|
48
|
+
}
|
|
49
|
+
```
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: kebabCase
|
|
3
|
-
description: Convert any common string casing to kebab-case
|
|
2
|
+
title: "kebabCase"
|
|
3
|
+
description: "Convert any common string casing to kebab-case - handles camelCase, PascalCase, snake_case, spaces and consecutive capitals."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/kebab-case"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# kebabCase
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Convert any common string casing to kebab-case - handles camelCase, PascalCase, snake_case, spaces and consecutive capitals.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { kebabCase } from '@maz-ui/utils/helpers/kebabCase'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/kebab-case
|
|
9
15
|
|
|
10
16
|
## Usage
|
|
11
17
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: normalizeString
|
|
3
|
-
description: Powerful string normalizer
|
|
2
|
+
title: "normalizeString"
|
|
3
|
+
description: "Powerful string normalizer - strip accents, normalize whitespace, remove special characters, change case, and apply Unicode normalization forms."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/normalize-string"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# normalizeString
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Powerful string normalizer - strip accents, normalize whitespace, remove special characters, change case, and apply Unicode normalization forms.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { normalizeString } from '@maz-ui/utils/helpers/normalizeString'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/normalize-string
|
|
9
15
|
|
|
10
16
|
The Swiss-army knife for turning user input into a safe, comparable, slug-ready string.
|
|
11
17
|
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: formatNumber
|
|
3
|
-
description: The module formatNumber is a function that formats numbers with the native api [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) from browsers and Node.js
|
|
2
|
+
title: "formatNumber"
|
|
3
|
+
description: "The module formatNumber is a function that formats numbers with the native api [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) from browsers and Node.js"
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/number"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# formatNumber
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> The module formatNumber is a function that formats numbers with the native api [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) from browsers and Node.js
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { formatNumber } from '@maz-ui/utils/helpers/formatNumber'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/number
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
style="padding: 16px; margin-top: 16px; background-color: var(--maz-surface-300);"
|
|
16
|
-
class="maz:flex maz:flex-center maz:rounded-md maz:gap-0.5"
|
|
17
|
-
>
|
|
18
|
-
formatted value: <strong>{{ numberFormatted }}</strong>
|
|
19
|
-
</div>
|
|
16
|
+
> This module uses the native api [Intl.NumberFormat](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) from browsers
|
|
20
17
|
|
|
21
18
|
```vue
|
|
22
19
|
<script lang="ts" setup>
|
|
@@ -52,14 +49,3 @@ const DEFAULT_OPTIONS: Intl.NumberFormatOptions = {
|
|
|
52
49
|
minimumFractionDigits: 2,
|
|
53
50
|
}
|
|
54
51
|
```
|
|
55
|
-
|
|
56
|
-
<script lang="ts" setup>
|
|
57
|
-
import { formatNumber } from '@maz-ui/utils'
|
|
58
|
-
import { ref, computed } from 'vue'
|
|
59
|
-
|
|
60
|
-
const numberValue = ref(69)
|
|
61
|
-
|
|
62
|
-
const numberFormatted = computed(() =>
|
|
63
|
-
formatNumber(numberValue.value, 'en-US'),
|
|
64
|
-
)
|
|
65
|
-
</script>
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: pascalCase
|
|
3
|
-
description: Convert any common string casing
|
|
2
|
+
title: "pascalCase"
|
|
3
|
+
description: "Convert any common string casing - kebab, snake, space-separated, camelCase or UPPERCASE - to PascalCase."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/pascal-case"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# pascalCase
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Convert any common string casing - kebab, snake, space-separated, camelCase or UPPERCASE - to PascalCase.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { pascalCase } from '@maz-ui/utils/helpers/pascalCase'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/pascal-case
|
|
9
15
|
|
|
10
16
|
## Usage
|
|
11
17
|
|
|
@@ -32,4 +38,4 @@ function pascalCase(str: string): string
|
|
|
32
38
|
|
|
33
39
|
- Detects `-`, `_` and space separators automatically.
|
|
34
40
|
- Handles ALL-CAPS inputs by lowercasing before re-capitalizing.
|
|
35
|
-
- For fine-grained control, use [`normalizeString`](./normalize-string) with `{ case: 'PascalCase' }`.
|
|
41
|
+
- For fine-grained control, use [`normalizeString`](./normalize-string.md) with `{ case: 'PascalCase' }`.
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: preventIosInputZoom
|
|
3
|
-
description: Stop iOS from zooming the page when a form field gets the focus, without changing the design of the fields.
|
|
2
|
+
title: "preventIosInputZoom"
|
|
3
|
+
description: "Stop iOS from zooming the page when a form field gets the focus, without changing the design of the fields."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/prevent-ios-input-zoom"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# preventIosInputZoom
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Stop iOS from zooming the page when a form field gets the focus, without changing the design of the fields.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { addViewportMaximumScale, preventIosInputZoom } from '@maz-ui/utils/helpers/preventIosInputZoom'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/prevent-ios-input-zoom
|
|
9
15
|
|
|
10
16
|
## Why
|
|
11
17
|
|
|
@@ -27,11 +33,12 @@ import { preventIosInputZoom } from '@maz-ui/utils'
|
|
|
27
33
|
preventIosInputZoom()
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
**Tip: Nuxt**
|
|
37
|
+
|
|
31
38
|
With [@maz-ui/nuxt](../nuxt.md), enable the `general.preventIosInputZoom` option instead.
|
|
32
|
-
:::
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
**Warning: Head managers**
|
|
41
|
+
|
|
35
42
|
If your viewport is managed by a head manager (`@unhead/vue`, `@vueuse/head`...), it can overwrite a direct change of the DOM on its next render. Set the viewport through it with `addViewportMaximumScale` instead:
|
|
36
43
|
|
|
37
44
|
```ts
|
|
@@ -44,7 +51,6 @@ useHead({
|
|
|
44
51
|
meta: [{ name: 'viewport', content: isIos() ? addViewportMaximumScale(viewport) : viewport }],
|
|
45
52
|
})
|
|
46
53
|
```
|
|
47
|
-
:::
|
|
48
54
|
|
|
49
55
|
## API
|
|
50
56
|
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: ScriptLoader
|
|
3
|
-
description: Class to inject and cache a <script> tag in document head, with an awaitable load promise
|
|
2
|
+
title: "ScriptLoader"
|
|
3
|
+
description: "Class to inject and cache a <script> tag in document head, with an awaitable load promise - ideal for third-party SDKs."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/script-loader"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# ScriptLoader
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Class to inject and cache a <script> tag in document head, with an awaitable load promise - ideal for third-party SDKs.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { ScriptLoader } from '@maz-ui/utils/helpers/scriptLoader'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/script-loader
|
|
15
|
+
|
|
16
|
+
Class to inject and cache a tag in document head, with an awaitable load promise - ideal for third-party SDKs.
|
|
9
17
|
|
|
10
18
|
`ScriptLoader` handles deduplication (won't inject the same script twice), error reporting, and optional one-time loading semantics.
|
|
11
19
|
|
|
@@ -43,16 +51,16 @@ interface ScriptLoaderOptions {
|
|
|
43
51
|
|
|
44
52
|
| Option | Type | Default | Description |
|
|
45
53
|
| ------------ | --------- | ------- | ---------------------------------------------------------------------------- |
|
|
46
|
-
| `identifier` | `string` |
|
|
47
|
-
| `src` | `string` |
|
|
54
|
+
| `identifier` | `string` | - | Unique key used to deduplicate the script across calls (set as `data-identifier`) |
|
|
55
|
+
| `src` | `string` | - | Script URL |
|
|
48
56
|
| `once` | `boolean` | `true` | When `true`, skip injection if a script with the same identifier already loaded |
|
|
49
57
|
| `async` | `boolean` | `true` | Sets the `async` attribute on the `<script>` tag |
|
|
50
58
|
| `defer` | `boolean` | `true` | Sets the `defer` attribute on the `<script>` tag |
|
|
51
59
|
|
|
52
60
|
### Methods
|
|
53
61
|
|
|
54
|
-
- **`load()`**
|
|
55
|
-
- **`removeTag(tag)`**
|
|
62
|
+
- **`load()`** - Inject the script (or resolve immediately if cached) and return a promise that resolves to the load `Event` once the script is ready.
|
|
63
|
+
- **`removeTag(tag)`** - Remove an injected `<script>` tag by element reference or identifier string.
|
|
56
64
|
|
|
57
65
|
## Errors
|
|
58
66
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: sleep
|
|
3
|
-
description: Pause execution for a given number of milliseconds. Returns a promise that resolves after the delay.
|
|
2
|
+
title: "sleep"
|
|
3
|
+
description: "Pause execution for a given number of milliseconds. Returns a promise that resolves after the delay."
|
|
4
|
+
package: "@maz-ui/utils"
|
|
5
|
+
url: "https://maz-ui.com/ecosystem/utils/sleep"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# sleep
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Pause execution for a given number of milliseconds. Returns a promise that resolves after the delay.
|
|
11
|
+
|
|
12
|
+
- Package: `@maz-ui/utils`
|
|
13
|
+
- Import: `import { sleep } from '@maz-ui/utils/helpers/sleep'`
|
|
14
|
+
- Web: https://maz-ui.com/ecosystem/utils/sleep
|
|
9
15
|
|
|
10
16
|
## Usage
|
|
11
17
|
|