@maz-ui/mcp 5.0.0-beta.17 → 5.0.0-beta.19

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.
Files changed (88) hide show
  1. package/dist/mcp.d.mts +22 -9
  2. package/dist/mcp.d.ts +22 -9
  3. package/dist/mcp.mjs +160 -83
  4. package/docs/src/blog/v4.md +1 -1
  5. package/docs/src/blog/v5.md +4 -4
  6. package/docs/src/components/maz-btn.md +1 -1
  7. package/docs/src/components/maz-date-picker.md +1 -1
  8. package/docs/src/components/maz-icon.md +2 -2
  9. package/docs/src/directives/click-outside.md +1 -1
  10. package/docs/src/directives/fullscreen-img.md +1 -1
  11. package/docs/src/directives/lazy-img.md +1 -1
  12. package/docs/src/directives/tooltip.md +1 -1
  13. package/docs/src/directives/zoom-img.md +1 -1
  14. package/docs/src/{guide/icons.md → ecosystem/icons/index.md} +1 -1
  15. package/docs/src/ecosystem/node/exec-promise.md +87 -0
  16. package/docs/src/ecosystem/node/index.md +53 -0
  17. package/docs/src/ecosystem/node/logger.md +146 -0
  18. package/docs/src/ecosystem/node/print-banner.md +93 -0
  19. package/docs/src/{guide → ecosystem}/nuxt.md +1 -1
  20. package/docs/src/{guide → ecosystem}/themes.md +4 -4
  21. package/docs/src/{guide → ecosystem}/translations.md +1 -1
  22. package/docs/src/ecosystem/utils/camel-case.md +31 -0
  23. package/docs/src/ecosystem/utils/check-availability.md +79 -0
  24. package/docs/src/ecosystem/utils/cookie.md +80 -0
  25. package/docs/src/ecosystem/utils/debounce-callback.md +38 -0
  26. package/docs/src/ecosystem/utils/debounce-id.md +69 -0
  27. package/docs/src/ecosystem/utils/debounce.md +65 -0
  28. package/docs/src/ecosystem/utils/fetch-locale-ip.md +33 -0
  29. package/docs/src/ecosystem/utils/format-json.md +33 -0
  30. package/docs/src/ecosystem/utils/format-phone-number.md +37 -0
  31. package/docs/src/ecosystem/utils/get-browser-locale.md +29 -0
  32. package/docs/src/ecosystem/utils/get-error-message.md +39 -0
  33. package/docs/src/ecosystem/utils/idle-timeout.md +90 -0
  34. package/docs/src/ecosystem/utils/index.md +60 -0
  35. package/docs/src/ecosystem/utils/is-client.md +32 -0
  36. package/docs/src/ecosystem/utils/is-equal.md +38 -0
  37. package/docs/src/ecosystem/utils/is-server.md +31 -0
  38. package/docs/src/ecosystem/utils/is-standalone-mode.md +43 -0
  39. package/docs/src/ecosystem/utils/kebab-case.md +36 -0
  40. package/docs/src/ecosystem/utils/normalize-string.md +77 -0
  41. package/docs/src/ecosystem/utils/pascal-case.md +35 -0
  42. package/docs/src/ecosystem/utils/script-loader.md +77 -0
  43. package/docs/src/ecosystem/utils/sleep.md +59 -0
  44. package/docs/src/ecosystem/utils/snake-case.md +36 -0
  45. package/docs/src/ecosystem/utils/swipe-handler.md +91 -0
  46. package/docs/src/ecosystem/utils/textarea-autogrow.md +41 -0
  47. package/docs/src/ecosystem/utils/throttle-id.md +48 -0
  48. package/docs/src/ecosystem/utils/throttle.md +57 -0
  49. package/docs/src/ecosystem/utils/truthy-filter.md +31 -0
  50. package/docs/src/ecosystem/utils/types/deep-key-of.md +48 -0
  51. package/docs/src/ecosystem/utils/types/deep-partial.md +42 -0
  52. package/docs/src/ecosystem/utils/types/deep-required.md +39 -0
  53. package/docs/src/ecosystem/utils/types/flatten-object-keys.md +44 -0
  54. package/docs/src/ecosystem/utils/types/generic-instance-type.md +42 -0
  55. package/docs/src/ecosystem/utils/types/infer-maybe-ref.md +35 -0
  56. package/docs/src/ecosystem/utils/upper-first.md +32 -0
  57. package/docs/src/ecosystem/utils/user-visibility.md +69 -0
  58. package/docs/src/guide/getting-started.md +2 -2
  59. package/docs/src/guide/migration-v4.md +6 -6
  60. package/docs/src/guide/resolvers.md +7 -7
  61. package/docs/src/guide/vue.md +4 -4
  62. package/docs/src/index.md +12 -12
  63. package/docs/src/plugins/aos.md +1 -1
  64. package/package.json +5 -4
  65. package/docs/src/helpers/camel-case.md +0 -14
  66. package/docs/src/helpers/check-availability.md +0 -14
  67. package/docs/src/helpers/debounce-callback.md +0 -14
  68. package/docs/src/helpers/debounce-id.md +0 -14
  69. package/docs/src/helpers/debounce.md +0 -14
  70. package/docs/src/helpers/is-client.md +0 -14
  71. package/docs/src/helpers/is-equal.md +0 -14
  72. package/docs/src/helpers/is-standalone-mode.md +0 -14
  73. package/docs/src/helpers/kebab-case.md +0 -14
  74. package/docs/src/helpers/normalize-string.md +0 -14
  75. package/docs/src/helpers/pascal-case.md +0 -14
  76. package/docs/src/helpers/script-loader.md +0 -14
  77. package/docs/src/helpers/sleep.md +0 -14
  78. package/docs/src/helpers/snake-case.md +0 -14
  79. package/docs/src/helpers/throttle-id.md +0 -14
  80. package/docs/src/helpers/throttle.md +0 -14
  81. /package/docs/src/{guide → ecosystem/icons}/icon-set.md +0 -0
  82. /package/docs/src/{guide → ecosystem}/mcp.md +0 -0
  83. /package/docs/src/{helpers → ecosystem/utils}/capitalize.md +0 -0
  84. /package/docs/src/{helpers → ecosystem/utils}/country-code-to-unicode-flag.md +0 -0
  85. /package/docs/src/{helpers → ecosystem/utils}/currency.md +0 -0
  86. /package/docs/src/{helpers → ecosystem/utils}/date.md +0 -0
  87. /package/docs/src/{helpers → ecosystem/utils}/get-country-flag-url.md +0 -0
  88. /package/docs/src/{helpers → ecosystem/utils}/number.md +0 -0
@@ -129,7 +129,7 @@ app.mount('#app')
129
129
 
130
130
  ### Nuxt
131
131
 
132
- Please refer to the [Nuxt module documentation](./../guide/nuxt.md) for more information.
132
+ Please refer to the [Nuxt module documentation](./../ecosystem/nuxt.md) for more information.
133
133
 
134
134
  ## Types
135
135
 
@@ -444,7 +444,7 @@ app.mount('#app')
444
444
 
445
445
  ### Nuxt
446
446
 
447
- Please refer to the [Nuxt module documentation](./../guide/nuxt.md) for more information.
447
+ Please refer to the [Nuxt module documentation](./../ecosystem/nuxt.md) for more information.
448
448
 
449
449
  ## Types
450
450
 
@@ -107,7 +107,7 @@ app.mount('#app')
107
107
 
108
108
  ### Nuxt
109
109
 
110
- Please refer to the [Nuxt module documentation](./../guide/nuxt.md) for more information.
110
+ Please refer to the [Nuxt module documentation](./../ecosystem/nuxt.md) for more information.
111
111
 
112
112
  ## Types
113
113
 
@@ -151,7 +151,7 @@ Never worry about imports again with automatic component resolution.
151
151
 
152
152
  ::: warning Troubleshooting
153
153
 
154
- If your are already using [`MazComponentsResolver`](./resolvers.md#mazcomponentsresolver), you should place `MazIconsResolver` before `MazComponentsResolver` in the `resolvers` array.
154
+ If your are already using [`MazComponentsResolver`](../../guide/resolvers.md#mazcomponentsresolver), you should place `MazIconsResolver` before `MazComponentsResolver` in the `resolvers` array.
155
155
 
156
156
  :::
157
157
 
@@ -0,0 +1,87 @@
1
+ ---
2
+ title: execPromise
3
+ description: Promise-based wrapper around `child_process.exec` with structured stdout/stderr/error logging, package-scoped prefixes, and per-call log silencing.
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ## Usage
11
+
12
+ ```ts
13
+ import { execPromise, logger } from '@maz-ui/node'
14
+
15
+ try {
16
+ const { stdout } = await execPromise('npm --version')
17
+ logger.log('npm version:', stdout.trim())
18
+ }
19
+ catch (error) {
20
+ logger.error('Command failed', error)
21
+ }
22
+ ```
23
+
24
+ ## API
25
+
26
+ ```ts
27
+ function execPromise(
28
+ command: string,
29
+ options?: ExecPromiseOptions,
30
+ ): Promise<{ stdout: string, stderr: string }>
31
+
32
+ interface ExecPromiseOptions {
33
+ logger?: CustomLogger
34
+ packageName?: string
35
+ noSuccess?: boolean
36
+ noStdout?: boolean
37
+ noStderr?: boolean
38
+ noError?: boolean
39
+ logLevel?: LogLevel
40
+ cwd?: string
41
+ }
42
+ ```
43
+
44
+ ### Options
45
+
46
+ | Option | Type | Default | Description |
47
+ | ------------- | ------------- | ----------- | --------------------------------------------------------------------------------- |
48
+ | `logger` | `CustomLogger` | built-in | Custom logger (must expose `log`, `error`, `info`, `warn`, `debug` methods). |
49
+ | `packageName` | `string` | — | Prepended to logs as `[name]: ` — useful when many commands share a logger. |
50
+ | `noSuccess` | `boolean` | `false` | Skip the `info` line printed when the command finishes successfully. |
51
+ | `noStdout` | `boolean` | `false` | Don't pipe stdout to the logger (still returned in the promise result). |
52
+ | `noStderr` | `boolean` | `false` | Don't pipe stderr to the logger (still returned in the promise result). |
53
+ | `noError` | `boolean` | `false` | Don't log errors before rejecting. |
54
+ | `logLevel` | `LogLevel` | unchanged | Temporarily sets the default logger's level for this call. |
55
+ | `cwd` | `string` | `process.cwd()` | Working directory for the command. |
56
+
57
+ The returned promise **resolves** with `{ stdout, stderr }` on success and **rejects** with the exec error on failure.
58
+
59
+ ## Examples
60
+
61
+ Run a build silently, only reporting success/failure:
62
+
63
+ ```ts
64
+ await execPromise('npm run build', {
65
+ packageName: 'build',
66
+ noStdout: true,
67
+ noStderr: true,
68
+ })
69
+ ```
70
+
71
+ Use a custom logger for an isolated subsystem:
72
+
73
+ ```ts
74
+ import { createLogger, execPromise } from '@maz-ui/node'
75
+
76
+ const ciLogger = createLogger({ level: 2 })
77
+
78
+ await execPromise('npm test', {
79
+ logger: ciLogger,
80
+ packageName: 'tests',
81
+ })
82
+ ```
83
+
84
+ ## Notes
85
+
86
+ - `execPromise` uses Node's `child_process.exec`, which buffers all output in memory. For commands that produce very large streams, prefer `child_process.spawn` directly.
87
+ - `stdout`/`stderr` are still returned in the promise result even when `noStdout`/`noStderr` are set — the flags only affect logging.
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: '@maz-ui/node'
3
+ description: Lightweight Node.js utilities — promise-based shell execution, an opinionated consola-backed logger, and a banner printer for CLIs.
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ <NpmBadge package="@maz-ui/node" />
11
+
12
+ `@maz-ui/node` powers the CLIs and build scripts inside the maz-ui ecosystem. It's intentionally tiny: an `exec` wrapper that returns a real `Promise`, a colourful logger built on [consola](https://github.com/unjs/consola), and a banner helper using [figlet](https://github.com/patorjk/figlet.js).
13
+
14
+ ## Installation
15
+
16
+ ::: code-group
17
+
18
+ ```bash [pnpm]
19
+ pnpm add @maz-ui/node
20
+ ```
21
+
22
+ ```bash [npm]
23
+ npm install @maz-ui/node
24
+ ```
25
+
26
+ ```bash [yarn]
27
+ yarn add @maz-ui/node
28
+ ```
29
+
30
+ :::
31
+
32
+ ## Basic usage
33
+
34
+ ```ts
35
+ import { execPromise, logger, printBanner } from '@maz-ui/node'
36
+
37
+ printBanner({ name: 'my-cli', version: '1.0.0' })
38
+
39
+ logger.info('Running tests…')
40
+ await execPromise('npm test', { packageName: 'tests' })
41
+ logger.success('Done')
42
+ ```
43
+
44
+ ## What's inside
45
+
46
+ - [`execPromise`](./exec-promise) — Promise-based `child_process.exec` with structured logging.
47
+ - [`logger` / `createLogger`](./logger) — consola-backed logger with semantic log levels and helpers (`box`, `divider`, `brand`, …).
48
+ - [`printBanner`](./print-banner) — ASCII-art banner printer (figlet) with versioning, dividers and clearing.
49
+
50
+ ## Requirements
51
+
52
+ - Node.js >= 18.0.0
53
+ - ESM only — published as `"type": "module"`.
@@ -0,0 +1,146 @@
1
+ ---
2
+ title: logger / createLogger
3
+ description: Opinionated [consola](https://github.com/unjs/consola)-backed logger with semantic levels, status helpers (`success`, `ready`, `fail`), and formatting helpers (`box`, `divider`, `brand`).
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ The default `logger` is a singleton ready to use; `createLogger` builds a fresh instance with its own level and reporters.
11
+
12
+ ## Quick start
13
+
14
+ ```ts
15
+ import { logger } from '@maz-ui/node'
16
+
17
+ logger.info('Build started')
18
+ logger.success('All checks passed')
19
+ logger.warn('Deprecated flag used')
20
+ logger.error('Build failed', errorObject)
21
+ ```
22
+
23
+ ## Default instance
24
+
25
+ ```ts
26
+ import { logger } from '@maz-ui/node'
27
+ ```
28
+
29
+ A pre-configured `Logger` with `level: 'default'` (numeric 3). Suitable for most scripts.
30
+
31
+ ## Custom instances
32
+
33
+ ```ts
34
+ import { createLogger } from '@maz-ui/node'
35
+
36
+ const dev = createLogger({ level: 4 }) // debug
37
+ const ci = createLogger({ level: 2 }) // normal
38
+ const silent = createLogger({ level: Number.NEGATIVE_INFINITY })
39
+ ```
40
+
41
+ ```ts
42
+ function createLogger(options?: LoggerOptions): Logger
43
+
44
+ type LoggerOptions = Partial<ConsolaOptions>
45
+ ```
46
+
47
+ `LoggerOptions` is forwarded directly to [consola's `createConsola()`](https://github.com/unjs/consola#instance-options) — see consola docs for every accepted field (tag, reporters, formatOptions, …).
48
+
49
+ ## API
50
+
51
+ ```ts
52
+ interface Logger {
53
+ // Core
54
+ log(message, ...args): void
55
+ info(message, ...args): void
56
+ warn(message, ...args): void
57
+ error(message, ...args): void
58
+ debug(message, ...args): void
59
+ trace(message, ...args): void
60
+ verbose(message, ...args): void
61
+ silent(message, ...args): void
62
+ fatal(message, ...args): void
63
+
64
+ // Status
65
+ start(message, ...args): void
66
+ ready(message, ...args): void
67
+ success(message, ...args): void
68
+ fail(message, ...args): void
69
+
70
+ // Formatting
71
+ box(message, ...args): void
72
+ brand(message: string): void
73
+ divider(character?: string): void
74
+ eot(): void
75
+ break(count?: number): void
76
+ clear(): void
77
+
78
+ // Reporters
79
+ addReporter(reporter: ConsolaReporter): void
80
+ removeReporter(reporter: ConsolaReporter): void
81
+
82
+ // Level control
83
+ setLevel(level: LogLevel): void
84
+ getLevel(): number
85
+ }
86
+ ```
87
+
88
+ ### Log levels
89
+
90
+ `setLevel()` accepts a semantic name. Anything below the active level is suppressed.
91
+
92
+ | Level | Numeric | Description |
93
+ | ----------- | ----------------- | ---------------------------- |
94
+ | `'silent'` | `-Infinity` | No logs displayed |
95
+ | `'error'` | `0` | Fatal and error only |
96
+ | `'warning'` | `1` | Warnings and above |
97
+ | `'normal'` | `2` | Normal logs and above |
98
+ | `'default'` | `3` (default) | Informational logs |
99
+ | `'debug'` | `4` | Debug logs and above |
100
+ | `'trace'` | `5` | All logs including trace |
101
+ | `'verbose'` | `Infinity` | Maximum verbosity |
102
+
103
+ ```ts
104
+ logger.setLevel('debug')
105
+ logger.debug('Now visible')
106
+
107
+ logger.setLevel('silent')
108
+ logger.error('No longer printed')
109
+ ```
110
+
111
+ ### Formatting helpers
112
+
113
+ | Method | Output |
114
+ | ------------ | ------------------------------------------------------------------- |
115
+ | `box(msg)` | Renders the message inside a bordered box. |
116
+ | `brand(msg)` | Prints in bright blue — used by `printBanner`. |
117
+ | `divider(c)` | Prints a separator line that adapts to the terminal width. |
118
+ | `eot()` | Prints a blank line (end-of-transmission marker). |
119
+ | `break(n)` | Prints `n` blank lines (default: 1). |
120
+
121
+ ## Examples
122
+
123
+ Build script with mixed levels:
124
+
125
+ ```ts
126
+ import { createLogger, execPromise } from '@maz-ui/node'
127
+
128
+ const log = createLogger({ level: 3 })
129
+
130
+ log.box('🚀 Build starting')
131
+ log.divider()
132
+
133
+ await execPromise('npm install', { logger: log, packageName: 'setup' })
134
+ log.ready('Dependencies installed')
135
+
136
+ await execPromise('npm run build', { logger: log, packageName: 'build' })
137
+ log.success('Build complete')
138
+ ```
139
+
140
+ Switch verbosity from an env flag:
141
+
142
+ ```ts
143
+ const log = createLogger({
144
+ level: process.env.CI ? 2 : 4,
145
+ })
146
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ title: printBanner
3
+ description: Print an ASCII-art banner via figlet with optional version, dividers and clearing — handy for CLI entry points.
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ Print an ASCII-art banner (via [figlet](https://github.com/patorjk/figlet.js)) with optional version, dividers and clearing — handy for CLI entry points.
9
+
10
+ ## Usage
11
+
12
+ ```ts
13
+ import { printBanner } from '@maz-ui/node'
14
+
15
+ printBanner({
16
+ name: 'maz-cli',
17
+ version: 'v1.0.0',
18
+ })
19
+ ```
20
+
21
+ Renders:
22
+
23
+ ```text
24
+ ███╗ ███╗ █████╗ ███████╗ ██████╗██╗ ██╗
25
+ ████╗ ████║██╔══██╗╚══███╔╝ ██╔════╝██║ ██║
26
+ ██╔████╔██║███████║ ███╔╝ ██║ ██║ ██║
27
+ ██║╚██╔╝██║██╔══██║ ███╔╝ ██║ ██║ ██║
28
+ ██║ ╚═╝ ██║██║ ██║███████╗ ╚██████╗███████╗██║
29
+ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝╚══════╝╚═╝
30
+
31
+ v1.0.0
32
+ ```
33
+
34
+ ## API
35
+
36
+ ```ts
37
+ function printBanner(args: {
38
+ name: string
39
+ version?: string
40
+ options?: FigletOptions & {
41
+ clear?: boolean
42
+ divider?: boolean
43
+ breakBefore?: boolean
44
+ breakAfter?: boolean
45
+ }
46
+ }): void
47
+ ```
48
+
49
+ | Parameter | Type | Description |
50
+ | --------- | --------- | -------------------------------------------- |
51
+ | `name` | `string` | Text rendered as ASCII art (required). |
52
+ | `version` | `string` | Optional version line printed under the banner. |
53
+ | `options` | `object` | Figlet options + extras (see below). |
54
+
55
+ ### Options
56
+
57
+ | Option | Type | Default | Description |
58
+ | ------------------ | --------- | -------------- | ------------------------------------------------------------------------ |
59
+ | `clear` | `boolean` | `true` | Clear the terminal screen before printing. |
60
+ | `divider` | `boolean` | `false` | Print a separator line after the banner. |
61
+ | `breakBefore` | `boolean` | `true` | Print a blank line before the banner. |
62
+ | `breakAfter` | `boolean` | `true` | Print a blank line after the banner. |
63
+ | `font` | `string` | `'ANSI Shadow'` | Any [figlet font name](https://github.com/patorjk/figlet.js#fonts). |
64
+ | `horizontalLayout` | `string` | `'full'` | Figlet horizontal layout: `'default'`, `'full'`, `'fitted'`, … |
65
+
66
+ All standard [`figlet` options](https://github.com/patorjk/figlet.js#api) are forwarded.
67
+
68
+ ## Examples
69
+
70
+ Minimal banner:
71
+
72
+ ```ts
73
+ printBanner({ name: 'maz-cli' })
74
+ ```
75
+
76
+ Banner with divider, no screen clearing:
77
+
78
+ ```ts
79
+ printBanner({
80
+ name: 'maz-cli',
81
+ version: 'v1.0.0',
82
+ options: { clear: false, divider: true },
83
+ })
84
+ ```
85
+
86
+ Custom font:
87
+
88
+ ```ts
89
+ printBanner({
90
+ name: 'Hi!',
91
+ options: { font: 'Standard', horizontalLayout: 'fitted' },
92
+ })
93
+ ```
@@ -436,7 +436,7 @@ export default defineNuxtConfig({
436
436
  ```
437
437
 
438
438
  ::: tip Subtree Overrides with MazUiProvider
439
- You can use [`MazUiProvider`](./maz-ui-provider.md) within a Nuxt app to override theme or translations in a specific subtree, while the module handles global defaults.
439
+ You can use [`MazUiProvider`](../guide/maz-ui-provider.md) within a Nuxt app to override theme or translations in a specific subtree, while the module handles global defaults.
440
440
  :::
441
441
 
442
442
  ## Troubleshooting
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: Theming
3
- description: Modern and performant theme system for Maz-UI built on native CSS features (`light-dark()`, `color-scheme`, `color-mix(in oklch)`) for v5.
3
+ description: Modern and performant theme system for Maz-UI built on native CSS features (light-dark(), color-scheme, color-mix(in oklch)) for v5.
4
4
  ---
5
5
 
6
6
  # {{ $frontmatter.title }}
7
7
 
8
- {{ $frontmatter.description }}
8
+ Modern and performant theme system for Maz-UI built on native CSS features (`light-dark()`, `color-scheme`, `color-mix(in oklch)`) for v5.
9
9
 
10
10
  <NpmBadge package="@maz-ui/themes"></NpmBadge>
11
11
 
@@ -56,7 +56,7 @@ app.use(MazUi, {
56
56
  ```
57
57
 
58
58
  ::: tip Alternative: MazUiProvider
59
- You can also initialize the theme via the [`MazUiProvider`](./maz-ui-provider.md) component for lazy-loaded pages or subtree-scoped themes.
59
+ You can also initialize the theme via the [`MazUiProvider`](../guide/maz-ui-provider.md) component for lazy-loaded pages or subtree-scoped themes.
60
60
  :::
61
61
 
62
62
  ### 2. Setup your CSS to support theme foundation and dark mode
@@ -999,7 +999,7 @@ For deeper detail on the generated CSS contract, see the [`@maz-ui/themes` READM
999
999
 
1000
1000
  ## Usage with Nuxt
1001
1001
 
1002
- For Nuxt users, check the [dedicated Nuxt documentation](/guide/nuxt) which covers installation and framework-specific configuration.
1002
+ For Nuxt users, check the [dedicated Nuxt documentation](/ecosystem/nuxt) which covers installation and framework-specific configuration.
1003
1003
 
1004
1004
  ## Migration from Legacy System
1005
1005
 
@@ -73,7 +73,7 @@ app.use(MazUi, {
73
73
  ```
74
74
 
75
75
  ::: tip Alternative: MazUiProvider
76
- You can also provide translations via the [`MazUiProvider`](./maz-ui-provider.md) component for lazy-loaded pages or subtree-scoped configurations.
76
+ You can also provide translations via the [`MazUiProvider`](../guide/maz-ui-provider.md) component for lazy-loaded pages or subtree-scoped configurations.
77
77
  :::
78
78
 
79
79
  ## How it works
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: camelCase
3
+ description: Convert a kebab-case string to camelCase by stripping dashes and uppercasing the following letter.
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ ## Usage
11
+
12
+ ```ts
13
+ import { camelCase } from '@maz-ui/utils'
14
+
15
+ camelCase('my-component-name') // → 'myComponentName'
16
+ camelCase('hello-world') // → 'helloWorld'
17
+ ```
18
+
19
+ ## API
20
+
21
+ ```ts
22
+ function camelCase(str: string): string
23
+ ```
24
+
25
+ | Parameter | Type | Description |
26
+ | --------- | -------- | --------------------- |
27
+ | `str` | `string` | The string to convert |
28
+
29
+ ## Notes
30
+
31
+ `camelCase` is intentionally minimal — it only handles `kebab-case` input. For more general normalization (snake_case, spaces, PascalCase), use [`normalizeString`](./normalize-string) with the `case: 'camelCase'` option.
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: checkAvailability
3
+ description: Poll a getter until a value is available (or matches an expected value), then run a callback — with timeout and configurable retry interval.
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ Useful for waiting on a third-party SDK to attach itself to `window`, on a Vue ref to be populated after mount, or on any asynchronously-available value.
11
+
12
+ ## Usage
13
+
14
+ ```ts
15
+ import { checkAvailability } from '@maz-ui/utils'
16
+
17
+ checkAvailability(
18
+ () => window.Stripe,
19
+ (Stripe) => {
20
+ const stripe = Stripe('pk_...')
21
+ },
22
+ )
23
+ ```
24
+
25
+ ## API
26
+
27
+ ```ts
28
+ function checkAvailability<T>(
29
+ getRef: () => T | null | undefined,
30
+ callback: (value: NonNullable<T>) => void,
31
+ options?: {
32
+ maxAttempts?: number
33
+ interval?: number
34
+ expectedValue?: T
35
+ errorMessage?: string
36
+ onError?: (error: Error) => void
37
+ },
38
+ ): void
39
+ ```
40
+
41
+ | Option | Type | Default | Description |
42
+ | --------------- | ---------- | ------- | ---------------------------------------------------------------------- |
43
+ | `maxAttempts` | `number` | `20` | Number of polls before giving up |
44
+ | `interval` | `number` | `100` | Delay between polls, in milliseconds |
45
+ | `expectedValue` | `T` | — | When set, callback fires only when `getRef()` strictly equals this value |
46
+ | `errorMessage` | `string` | — | Custom error message when `maxAttempts` is exceeded |
47
+ | `onError` | `Function` | — | Called with the timeout `Error` instead of throwing |
48
+
49
+ With default options, the helper polls every 100 ms up to 20 times — a 2 second timeout in total.
50
+
51
+ ## Examples
52
+
53
+ Wait for a global SDK with a custom timeout:
54
+
55
+ ```ts
56
+ checkAvailability(
57
+ () => window.gtag,
58
+ (gtag) => {
59
+ gtag('event', 'page_view')
60
+ },
61
+ {
62
+ maxAttempts: 50,
63
+ interval: 200,
64
+ onError: (err) => {
65
+ console.warn('gtag never loaded', err)
66
+ },
67
+ },
68
+ )
69
+ ```
70
+
71
+ Wait for a specific value (e.g. SDK becomes ready):
72
+
73
+ ```ts
74
+ checkAvailability(
75
+ () => window.__SDK_STATE__,
76
+ () => boot(),
77
+ { expectedValue: 'ready' },
78
+ )
79
+ ```
@@ -0,0 +1,80 @@
1
+ ---
2
+ title: cookie
3
+ description: Read, write and delete browser cookies with full attribute support — `path`, `domain`, `maxAge`, `expires`, `secure`, `sameSite`, `partitioned`.
4
+ ---
5
+
6
+ # {{ $frontmatter.title }}
7
+
8
+ {{ $frontmatter.description }}
9
+
10
+ The module exports three functions: `getCookie`, `setCookie`, `deleteCookie`. Reads work both on the client (via `document.cookie`) and on the server (when you pass the raw `Cookie` header).
11
+
12
+ ## getCookie
13
+
14
+ ```ts
15
+ import { getCookie } from '@maz-ui/utils'
16
+
17
+ const theme = getCookie('theme') // 'dark' | null
18
+ ```
19
+
20
+ ```ts
21
+ function getCookie(key: string, cookieHeader?: string): string | null
22
+ ```
23
+
24
+ | Parameter | Type | Description |
25
+ | -------------- | -------- | -------------------------------------------------------------------------------------------- |
26
+ | `key` | `string` | Cookie name |
27
+ | `cookieHeader` | `string` | (Optional) Raw `Cookie` request header — pass during SSR (e.g. from `useSSRContext()` in Nuxt) |
28
+
29
+ Returns the URL-decoded value, or `null` when the cookie is absent.
30
+
31
+ ## setCookie
32
+
33
+ ```ts
34
+ import { setCookie } from '@maz-ui/utils'
35
+
36
+ setCookie('theme', 'dark')
37
+
38
+ setCookie('session', token, {
39
+ maxAge: 60 * 60, // 1 hour
40
+ secure: true,
41
+ sameSite: 'Strict',
42
+ })
43
+ ```
44
+
45
+ ```ts
46
+ function setCookie(key: string, value: string, options?: CookieOptions): void
47
+ ```
48
+
49
+ No-op on the server.
50
+
51
+ ### Options
52
+
53
+ | Option | Type | Default | Description |
54
+ | ------------- | --------- | ---------------- | --------------------------------------------------------------------------------- |
55
+ | `path` | `string` | `'/'` | Path attribute. Pass `null` to omit. |
56
+ | `domain` | `string` | — | Domain attribute. |
57
+ | `maxAge` | `number` | `31_536_000` (1y) | Lifetime in seconds. Pass `null` for a session cookie. |
58
+ | `expires` | `Date` | — | Explicit expiration date. Takes precedence over `maxAge`. |
59
+ | `secure` | `boolean` | — | Restrict to HTTPS. |
60
+ | `sameSite` | `'Lax' \| 'Strict' \| 'None'` | `'Lax'` | Same-site policy. Pass `null` to omit. |
61
+ | `partitioned` | `boolean` | — | Mark the cookie as partitioned (CHIPS). |
62
+
63
+ ::: warning `HttpOnly`
64
+ `HttpOnly` cannot be set from `document.cookie` — browsers reject it. Use a server-set cookie for that.
65
+ :::
66
+
67
+ ## deleteCookie
68
+
69
+ ```ts
70
+ import { deleteCookie } from '@maz-ui/utils'
71
+
72
+ deleteCookie('session')
73
+ deleteCookie('analytics-id', { domain: '.example.com' })
74
+ ```
75
+
76
+ ```ts
77
+ function deleteCookie(key: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void
78
+ ```
79
+
80
+ For the deletion to take effect, `path` and `domain` must match the values used when the cookie was set.