@maz-ui/mcp 5.0.0-beta.11 → 5.0.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp.d.mts +22 -9
- package/dist/mcp.d.ts +22 -9
- package/dist/mcp.mjs +160 -83
- package/docs/generated-docs/maz-checkbox.doc.md +16 -17
- 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-expand-animation.doc.md +4 -4
- package/docs/generated-docs/maz-input-code.doc.md +16 -16
- 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 +14 -14
- 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-pull-to-refresh.doc.md +10 -10
- 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-sidebar-menu-button.doc.md +12 -11
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +5 -5
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +0 -6
- package/docs/generated-docs/maz-sidebar.doc.md +12 -9
- package/docs/generated-docs/maz-switch.doc.md +14 -14
- package/docs/generated-docs/maz-table.doc.md +5 -5
- package/docs/generated-docs/maz-textarea.doc.md +25 -25
- package/docs/src/blog/v4.md +1 -1
- package/docs/src/blog/v5.md +4 -4
- package/docs/src/components/maz-btn.md +1 -1
- package/docs/src/components/maz-date-picker.md +1 -1
- package/docs/src/components/maz-icon.md +2 -2
- package/docs/src/components/maz-sidebar.md +100 -47
- package/docs/src/directives/click-outside.md +1 -1
- package/docs/src/directives/fullscreen-img.md +1 -1
- package/docs/src/directives/lazy-img.md +1 -1
- package/docs/src/directives/tooltip.md +24 -1
- package/docs/src/directives/zoom-img.md +1 -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 +1 -1
- package/docs/src/{guide → ecosystem}/themes.md +4 -4
- package/docs/src/{guide → ecosystem}/translations.md +1 -1
- package/docs/src/ecosystem/utils/camel-case.md +31 -0
- 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 +2 -2
- package/docs/src/guide/migration-v4.md +6 -6
- package/docs/src/guide/resolvers.md +7 -7
- package/docs/src/guide/vue.md +4 -4
- package/docs/src/index.md +12 -12
- package/docs/src/plugins/aos.md +1 -1
- package/package.json +4 -4
- 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}/capitalize.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
|
@@ -400,6 +400,29 @@ The `offset` (in px) option allows you to adjust the position of the tooltip rel
|
|
|
400
400
|
</template>
|
|
401
401
|
</ComponentDemo>
|
|
402
402
|
|
|
403
|
+
## Conditionally disable
|
|
404
|
+
|
|
405
|
+
Pass `false`, `null` or `undefined` as the binding value to silently disable the tooltip — no popover instance is created, no listeners are attached, and no warning is logged. This is the recommended way to skip the tooltip on the fly without conditionally rendering two different elements:
|
|
406
|
+
|
|
407
|
+
```vue
|
|
408
|
+
<script lang="ts" setup>
|
|
409
|
+
import { vTooltip } from 'maz-ui/directives'
|
|
410
|
+
import { computed, ref } from 'vue'
|
|
411
|
+
|
|
412
|
+
const label = ref<string>('')
|
|
413
|
+
const tooltipBinding = computed(() => label.value ? { text: label.value } : false)
|
|
414
|
+
</script>
|
|
415
|
+
|
|
416
|
+
<template>
|
|
417
|
+
<!-- When label is empty the directive becomes a no-op -->
|
|
418
|
+
<MazBtn v-tooltip="tooltipBinding">
|
|
419
|
+
Hover me
|
|
420
|
+
</MazBtn>
|
|
421
|
+
</template>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
If the binding switches back to a valid value later, the tooltip mounts as expected. Toggling the value off again destroys the existing popover instance.
|
|
425
|
+
|
|
403
426
|
## Global install
|
|
404
427
|
|
|
405
428
|
### Vue
|
|
@@ -421,7 +444,7 @@ app.mount('#app')
|
|
|
421
444
|
|
|
422
445
|
### Nuxt
|
|
423
446
|
|
|
424
|
-
Please refer to the [Nuxt module documentation](./../
|
|
447
|
+
Please refer to the [Nuxt module documentation](./../ecosystem/nuxt.md) for more information.
|
|
425
448
|
|
|
426
449
|
## Types
|
|
427
450
|
|
|
@@ -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`](
|
|
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`](
|
|
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 (
|
|
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
|
-
|
|
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`](
|
|
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](/
|
|
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`](
|
|
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
|
+
```
|