@maz-ui/mcp 5.0.0-beta.2 → 5.0.0-beta.24

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 (142) hide show
  1. package/README.md +1 -1
  2. package/dist/mcp.d.mts +22 -9
  3. package/dist/mcp.d.ts +22 -9
  4. package/dist/mcp.mjs +160 -83
  5. package/docs/generated-docs/maz-avatar.doc.md +25 -25
  6. package/docs/generated-docs/maz-btn.doc.md +1 -1
  7. package/docs/generated-docs/maz-checkbox.doc.md +16 -17
  8. package/docs/generated-docs/maz-circular-progress-bar.doc.md +1 -1
  9. package/docs/generated-docs/maz-code-highlight.doc.md +11 -0
  10. package/docs/generated-docs/maz-date-picker.doc.md +41 -41
  11. package/docs/generated-docs/maz-drawer.doc.md +7 -8
  12. package/docs/generated-docs/maz-expand-animation.doc.md +4 -4
  13. package/docs/generated-docs/maz-fullscreen-loader.doc.md +5 -5
  14. package/docs/generated-docs/maz-gallery.doc.md +15 -15
  15. package/docs/generated-docs/maz-input-code.doc.md +16 -16
  16. package/docs/generated-docs/maz-input-phone-number.doc.md +42 -38
  17. package/docs/generated-docs/maz-input-price.doc.md +14 -14
  18. package/docs/generated-docs/maz-input-tags.doc.md +16 -16
  19. package/docs/generated-docs/maz-input.doc.md +33 -33
  20. package/docs/generated-docs/maz-lazy-img.doc.md +14 -14
  21. package/docs/generated-docs/maz-loading-bar.doc.md +4 -4
  22. package/docs/generated-docs/maz-pull-to-refresh.doc.md +10 -10
  23. package/docs/generated-docs/maz-radio-buttons.doc.md +17 -17
  24. package/docs/generated-docs/maz-radio.doc.md +16 -16
  25. package/docs/generated-docs/maz-reading-progress-bar.doc.md +4 -4
  26. package/docs/generated-docs/maz-sidebar-content.doc.md +5 -0
  27. package/docs/generated-docs/maz-sidebar-footer.doc.md +5 -0
  28. package/docs/generated-docs/maz-sidebar-group.doc.md +11 -0
  29. package/docs/generated-docs/maz-sidebar-header.doc.md +5 -0
  30. package/docs/generated-docs/maz-sidebar-menu-button.doc.md +27 -0
  31. package/docs/generated-docs/maz-sidebar-menu-item.doc.md +5 -0
  32. package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +16 -0
  33. package/docs/generated-docs/maz-sidebar-menu.doc.md +5 -0
  34. package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
  35. package/docs/generated-docs/maz-sidebar-trigger.doc.md +5 -0
  36. package/docs/generated-docs/maz-sidebar.doc.md +36 -0
  37. package/docs/generated-docs/maz-slider.doc.md +1 -1
  38. package/docs/generated-docs/maz-spinner.doc.md +4 -4
  39. package/docs/generated-docs/maz-switch.doc.md +14 -14
  40. package/docs/generated-docs/maz-table.doc.md +5 -5
  41. package/docs/generated-docs/maz-textarea.doc.md +25 -24
  42. package/docs/generated-docs/maz-ticker.doc.md +1 -1
  43. package/docs/generated-docs/maz-window-mockup.doc.md +23 -0
  44. package/docs/src/blog/v4.md +1 -1
  45. package/docs/src/blog/v5.md +5 -7
  46. package/docs/src/components/maz-btn.md +1 -1
  47. package/docs/src/components/maz-code-highlight.md +233 -0
  48. package/docs/src/components/maz-container.md +2 -2
  49. package/docs/src/components/maz-date-picker.md +1 -1
  50. package/docs/src/components/maz-dialog.md +46 -0
  51. package/docs/src/components/maz-icon.md +2 -2
  52. package/docs/src/components/maz-input-phone-number.md +106 -103
  53. package/docs/src/components/maz-sidebar.md +719 -0
  54. package/docs/src/components/maz-textarea.md +27 -1
  55. package/docs/src/components/maz-timeline.md +60 -0
  56. package/docs/src/components/maz-window-mockup.md +249 -0
  57. package/docs/src/directives/click-outside.md +8 -15
  58. package/docs/src/directives/fullscreen-img.md +1 -1
  59. package/docs/src/directives/lazy-img.md +5 -5
  60. package/docs/src/directives/tooltip.md +24 -1
  61. package/docs/src/directives/zoom-img.md +1 -1
  62. package/docs/src/ecosystem/eslint-config.md +95 -1
  63. package/docs/src/{guide/icons.md → ecosystem/icons/index.md} +1 -1
  64. package/docs/src/ecosystem/node/exec-promise.md +87 -0
  65. package/docs/src/ecosystem/node/index.md +53 -0
  66. package/docs/src/ecosystem/node/logger.md +146 -0
  67. package/docs/src/ecosystem/node/print-banner.md +93 -0
  68. package/docs/src/{guide → ecosystem}/nuxt.md +81 -47
  69. package/docs/src/{guide → ecosystem}/themes.md +153 -72
  70. package/docs/src/{guide → ecosystem}/translations.md +1 -1
  71. package/docs/src/ecosystem/utils/camel-case.md +31 -0
  72. package/docs/src/{helpers → ecosystem/utils}/capitalize.md +2 -3
  73. package/docs/src/ecosystem/utils/check-availability.md +79 -0
  74. package/docs/src/ecosystem/utils/cookie.md +80 -0
  75. package/docs/src/{helpers → ecosystem/utils}/currency.md +2 -2
  76. package/docs/src/{helpers → ecosystem/utils}/date.md +2 -2
  77. package/docs/src/ecosystem/utils/debounce-callback.md +38 -0
  78. package/docs/src/ecosystem/utils/debounce-id.md +69 -0
  79. package/docs/src/ecosystem/utils/debounce.md +65 -0
  80. package/docs/src/ecosystem/utils/fetch-locale-ip.md +33 -0
  81. package/docs/src/ecosystem/utils/format-json.md +33 -0
  82. package/docs/src/ecosystem/utils/format-phone-number.md +37 -0
  83. package/docs/src/ecosystem/utils/get-browser-locale.md +29 -0
  84. package/docs/src/ecosystem/utils/get-error-message.md +39 -0
  85. package/docs/src/ecosystem/utils/idle-timeout.md +90 -0
  86. package/docs/src/ecosystem/utils/index.md +60 -0
  87. package/docs/src/ecosystem/utils/is-client.md +32 -0
  88. package/docs/src/ecosystem/utils/is-equal.md +38 -0
  89. package/docs/src/ecosystem/utils/is-server.md +31 -0
  90. package/docs/src/ecosystem/utils/is-standalone-mode.md +43 -0
  91. package/docs/src/ecosystem/utils/kebab-case.md +36 -0
  92. package/docs/src/ecosystem/utils/normalize-string.md +77 -0
  93. package/docs/src/{helpers → ecosystem/utils}/number.md +2 -2
  94. package/docs/src/ecosystem/utils/pascal-case.md +35 -0
  95. package/docs/src/ecosystem/utils/script-loader.md +77 -0
  96. package/docs/src/ecosystem/utils/sleep.md +59 -0
  97. package/docs/src/ecosystem/utils/snake-case.md +36 -0
  98. package/docs/src/ecosystem/utils/swipe-handler.md +91 -0
  99. package/docs/src/ecosystem/utils/textarea-autogrow.md +41 -0
  100. package/docs/src/ecosystem/utils/throttle-id.md +48 -0
  101. package/docs/src/ecosystem/utils/throttle.md +57 -0
  102. package/docs/src/ecosystem/utils/truthy-filter.md +31 -0
  103. package/docs/src/ecosystem/utils/types/deep-key-of.md +48 -0
  104. package/docs/src/ecosystem/utils/types/deep-partial.md +42 -0
  105. package/docs/src/ecosystem/utils/types/deep-required.md +39 -0
  106. package/docs/src/ecosystem/utils/types/flatten-object-keys.md +44 -0
  107. package/docs/src/ecosystem/utils/types/generic-instance-type.md +42 -0
  108. package/docs/src/ecosystem/utils/types/infer-maybe-ref.md +35 -0
  109. package/docs/src/ecosystem/utils/upper-first.md +32 -0
  110. package/docs/src/ecosystem/utils/user-visibility.md +69 -0
  111. package/docs/src/guide/getting-started.md +15 -13
  112. package/docs/src/guide/global-defaults.md +101 -0
  113. package/docs/src/guide/maz-ui-provider.md +6 -3
  114. package/docs/src/guide/migration-v4.md +13 -9
  115. package/docs/src/guide/migration-v5.md +67 -12
  116. package/docs/src/guide/resolvers.md +7 -7
  117. package/docs/src/guide/tailwind.md +4 -0
  118. package/docs/src/guide/vue.md +4 -4
  119. package/docs/src/index.md +12 -12
  120. package/docs/src/plugins/aos.md +1 -1
  121. package/docs/src/plugins/wait.md +1 -1
  122. package/package.json +6 -5
  123. package/docs/src/helpers/camel-case.md +0 -14
  124. package/docs/src/helpers/check-availability.md +0 -14
  125. package/docs/src/helpers/debounce-callback.md +0 -14
  126. package/docs/src/helpers/debounce-id.md +0 -14
  127. package/docs/src/helpers/debounce.md +0 -14
  128. package/docs/src/helpers/is-client.md +0 -14
  129. package/docs/src/helpers/is-equal.md +0 -14
  130. package/docs/src/helpers/is-standalone-mode.md +0 -14
  131. package/docs/src/helpers/kebab-case.md +0 -14
  132. package/docs/src/helpers/normalize-string.md +0 -14
  133. package/docs/src/helpers/pascal-case.md +0 -14
  134. package/docs/src/helpers/script-loader.md +0 -14
  135. package/docs/src/helpers/sleep.md +0 -14
  136. package/docs/src/helpers/snake-case.md +0 -14
  137. package/docs/src/helpers/throttle-id.md +0 -14
  138. package/docs/src/helpers/throttle.md +0 -14
  139. /package/docs/src/{guide → ecosystem/icons}/icon-set.md +0 -0
  140. /package/docs/src/{guide → ecosystem}/mcp.md +0 -0
  141. /package/docs/src/{helpers → ecosystem/utils}/country-code-to-unicode-flag.md +0 -0
  142. /package/docs/src/{helpers → ecosystem/utils}/get-country-flag-url.md +0 -0
@@ -114,6 +114,8 @@ defineConfig({
114
114
  detectComponentClasses: true,
115
115
  // Monorepo: directory used to resolve `tailwindcss` and the config file.
116
116
  cwd: 'apps/web',
117
+ // Custom `maz/tailwind-no-arbitrary-px` rule — see "Custom rules" below.
118
+ noArbitraryPx: true,
117
119
  },
118
120
  })
119
121
  ```
@@ -135,12 +137,98 @@ defineConfig({
135
137
 
136
138
  The plugin recognizes the most common class-name utilities out of the box (`clsx`, `cn`, `tw-merge`, `cva`, `tv`, …); see the [plugin docs](https://github.com/schoero/eslint-plugin-better-tailwindcss) for the full list and how to register your own.
137
139
 
140
+ ## Custom rules
141
+
142
+ `@maz-ui/eslint-config` ships its own ESLint plugin under the **`maz/*`** namespace. Rules are grouped by category — `maz/tailwind-*` today, with room for `maz/js-*` and others as they get added.
143
+
144
+ ### `maz/tailwind-no-arbitrary-px`
145
+
146
+ Forbids `px` units inside Tailwind arbitrary value classes (`w-[16px]`, `m-[-16px]`, `[gap:24px]`, …) and **autofixes** them to `rem` (or `em`) using your project's root font-size. Whitespace inside brackets (e.g. `[up to 100px]`) is left alone, so plain prose is never rewritten by accident.
147
+
148
+ ::: info Registered only when `tailwindcss` is enabled
149
+ The `maz` plugin and the `maz/tailwind-*` rules are only added to the flat-config when `tailwindcss` is set to anything other than `false`. With `tailwindcss: false` *(default)*, neither the plugin nor the rule appear in the resolved config — keeping the preset zero-cost for non-Tailwind projects. To use the rule without opting into the full Tailwind preset, register `mazPlugin` manually (see [Use the plugin directly](#use-the-plugin-directly)).
150
+ :::
151
+
152
+ When `tailwindcss` is on, the rule is enabled with defaults. You can tune it two ways:
153
+
154
+ **Standard ESLint override** *(idiomatic, max control)*
155
+
156
+ ```ts
157
+ defineConfig({
158
+ tailwindcss: 'recommended',
159
+ rules: {
160
+ 'maz/tailwind-no-arbitrary-px': ['error', { baseFontSize: 10, unit: 'em' }],
161
+ },
162
+ })
163
+ ```
164
+
165
+ User `rules` overrides are applied in a *trailing* flat-config block, so they win over the defaults wired in by `tailwindcssConfigs`.
166
+
167
+ **Ergonomic shortcut** *(set defaults via `tailwindcss.noArbitraryPx`)*
168
+
169
+ ```ts
170
+ defineConfig({
171
+ tailwindcss: {
172
+ preset: 'recommended',
173
+ noArbitraryPx: {
174
+ baseFontSize: 16, // default — divide px by this to get rem
175
+ unit: 'rem', // default — output unit ('rem' | 'em')
176
+ severity: 'error', // default — 'off' | 'warn' | 'error'
177
+ },
178
+ },
179
+ })
180
+ ```
181
+
182
+ | `noArbitraryPx` value | Behavior |
183
+ | ---------------------------------- | --------------------------------------------------- |
184
+ | `true` *(default)* | Enabled with defaults (`baseFontSize: 16`, `rem`). |
185
+ | `false` | Disabled. |
186
+ | `{ baseFontSize, unit, severity }` | Override any subset of the defaults. |
187
+
188
+ If both are set, the standard `rules` override wins (it's the last block applied).
189
+
190
+ What the autofix does (with `baseFontSize: 16`):
191
+
192
+ | Before | After |
193
+ | ----------------------- | ------------------------ |
194
+ | `w-[16px]` | `w-[1rem]` |
195
+ | `m-[-16px]` | `m-[-1rem]` |
196
+ | `tracking-[.5px]` | `tracking-[0.03125rem]` |
197
+ | `p-[16px_8px]` | `p-[1rem_0.5rem]` |
198
+ | `[gap:24px]` | `[gap:1.5rem]` |
199
+ | `w-[calc(100%-16px)]` | `w-[calc(100%-1rem)]` |
200
+ | `md:hover:w-[16px]` | `md:hover:w-[1rem]` |
201
+
202
+ The rule fires on:
203
+
204
+ - JSX `className` strings and template literals
205
+ - Vue SFC static `class="…"` attributes (via `vue-eslint-parser`)
206
+ - Vue dynamic `:class` bindings, including string literals inside arrays / objects
207
+ - Function-call arguments and tagged template literals (`clsx`, `cn`, `cva`, `tw`, …)
208
+
209
+ ### Use the plugin directly
210
+
211
+ If you don't want the full Tailwind preset (or just prefer wiring rules yourself), import `mazPlugin` and register it in your own flat-config block. This is also the way to use `maz/tailwind-*` rules **without** enabling `tailwindcss` in `defineConfig`:
212
+
213
+ ```ts
214
+ import { mazPlugin } from '@maz-ui/eslint-config'
215
+
216
+ export default [{
217
+ files: ['**/*.{ts,tsx,vue}'],
218
+ plugins: { maz: mazPlugin },
219
+ rules: {
220
+ 'maz/tailwind-no-arbitrary-px': ['error', { baseFontSize: 16, unit: 'rem' }],
221
+ },
222
+ }]
223
+ ```
224
+
138
225
  ## What it includes
139
226
 
140
227
  - **Antfu base** — TypeScript-aware rules, Stylistic formatting, modern import order.
141
228
  - **SonarJS** — code quality and complexity heuristics, with a relaxed set for `*.spec.ts` / `*.test.ts`.
142
229
  - **Vue rules** (when Vue/Nuxt is detected) — block-tag order, naming conventions, template a11y.
143
230
  - **Tailwind plugin** (opt-in) — class ordering, duplicate / deprecated / unknown / conflicting class detection — see [Tailwind support](#tailwind-support).
231
+ - **`maz/*` custom rules** — namespaced ESLint plugin shipped with the preset; see [Custom rules](#custom-rules).
144
232
  - **Markdown** — prose linting baseline.
145
233
  - **vueAccessibility** (opt-in) — `eslint-plugin-vuejs-accessibility` rules with the AudioWorklet globals fix.
146
234
 
@@ -151,6 +239,7 @@ The plugin recognizes the most common class-name utilities out of the box (`clsx
151
239
  ```ts
152
240
  import {
153
241
  baseRules,
242
+ mazPlugin,
154
243
  sonarjsRules,
155
244
  tailwindcssConfigs,
156
245
  vueRules,
@@ -158,14 +247,19 @@ import {
158
247
 
159
248
  export default [
160
249
  {
250
+ plugins: { maz: mazPlugin },
161
251
  rules: {
162
252
  ...baseRules(true), // production = true → no-console: 'error'
163
253
  ...sonarjsRules,
164
254
  ...vueRules,
255
+ 'maz/tailwind-no-arbitrary-px': 'error',
165
256
  },
166
257
  },
167
258
  // Drop in just the Tailwind block, with whatever preset and settings you want.
168
- ...tailwindcssConfigs('stylistic', { entryPoint: 'src/main.css' }),
259
+ ...tailwindcssConfigs('stylistic', {
260
+ entryPoint: 'src/main.css',
261
+ noArbitraryPx: { unit: 'em' },
262
+ }),
169
263
  ]
170
264
  ```
171
265
 
@@ -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
+ ```