@maz-ui/mcp 5.0.0-beta.0 → 5.0.0-beta.11
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.mjs +1 -1
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +1 -1
- package/docs/generated-docs/maz-code-highlight.doc.md +11 -0
- package/docs/generated-docs/maz-drawer.doc.md +1 -1
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +5 -5
- package/docs/generated-docs/maz-gallery.doc.md +15 -15
- package/docs/generated-docs/maz-input-phone-number.doc.md +42 -38
- package/docs/generated-docs/maz-sidebar-content.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-footer.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-group.doc.md +11 -0
- package/docs/generated-docs/maz-sidebar-header.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-menu-button.doc.md +26 -0
- package/docs/generated-docs/maz-sidebar-menu-item.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +16 -0
- package/docs/generated-docs/maz-sidebar-menu.doc.md +5 -0
- package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +11 -0
- package/docs/generated-docs/maz-sidebar.doc.md +33 -0
- package/docs/generated-docs/maz-slider.doc.md +1 -1
- package/docs/generated-docs/maz-spinner.doc.md +4 -4
- package/docs/generated-docs/maz-textarea.doc.md +25 -24
- package/docs/generated-docs/maz-ticker.doc.md +1 -1
- package/docs/generated-docs/maz-window-mockup.doc.md +23 -0
- package/docs/src/blog/v5.md +1 -3
- package/docs/src/components/maz-badge.md +4 -4
- package/docs/src/components/maz-btn.md +2 -2
- package/docs/src/components/maz-code-highlight.md +233 -0
- package/docs/src/components/maz-container.md +2 -2
- package/docs/src/components/maz-icon.md +1 -1
- package/docs/src/components/maz-input-phone-number.md +106 -103
- package/docs/src/components/maz-popover.md +1 -1
- package/docs/src/components/maz-sidebar.md +621 -0
- package/docs/src/components/maz-textarea.md +27 -1
- package/docs/src/components/maz-timeline.md +60 -0
- package/docs/src/components/maz-window-mockup.md +249 -0
- package/docs/src/directives/click-outside.md +7 -14
- package/docs/src/directives/lazy-img.md +4 -4
- package/docs/src/ecosystem/eslint-config.md +189 -8
- package/docs/src/ecosystem/stylelint-config.md +122 -10
- package/docs/src/guide/getting-started.md +13 -11
- package/docs/src/guide/maz-ui-provider.md +6 -3
- package/docs/src/guide/migration-v4.md +7 -3
- package/docs/src/guide/migration-v5.md +67 -12
- package/docs/src/guide/nuxt.md +53 -46
- package/docs/src/guide/tailwind.md +4 -0
- package/docs/src/guide/themes.md +127 -69
- package/docs/src/helpers/capitalize.md +2 -3
- package/docs/src/helpers/currency.md +2 -2
- package/docs/src/helpers/date.md +2 -2
- package/docs/src/helpers/number.md +2 -2
- package/docs/src/plugins/wait.md +1 -1
- package/package.json +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: '@maz-ui/eslint-config'
|
|
3
|
-
description: ESLint flat-config preset for Vue/Nuxt/JS/TS projects, layered on @antfu/eslint-config with SonarJS, Tailwind and a11y add-ons.
|
|
3
|
+
description: ESLint flat-config preset for Vue/Nuxt/JS/TS projects, layered on @antfu/eslint-config with SonarJS, Tailwind v3+v4 and a11y add-ons.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# {{ $frontmatter.title }}
|
|
7
7
|
|
|
8
|
-
`@maz-ui/eslint-config` ships an opinionated ESLint **flat config** for the kind of stack maz-ui itself uses: TypeScript, Vue 3 / Nuxt 3, optional Tailwind CSS, and tests. It is built on top of [`@antfu/eslint-config`](https://github.com/antfu/eslint-config) so you get a battle-tested baseline, then layered with quality rules from [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs) and accessibility rules from [`eslint-plugin-vuejs-accessibility`](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility).
|
|
8
|
+
`@maz-ui/eslint-config` ships an opinionated ESLint **flat config** for the kind of stack maz-ui itself uses: TypeScript, Vue 3 / Nuxt 3, optional Tailwind CSS (v3 or v4), and tests. It is built on top of [`@antfu/eslint-config`](https://github.com/antfu/eslint-config) so you get a battle-tested baseline, then layered with quality rules from [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), Tailwind rules from [`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss), and accessibility rules from [`eslint-plugin-vuejs-accessibility`](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility).
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -13,6 +13,8 @@ description: ESLint flat-config preset for Vue/Nuxt/JS/TS projects, layered on @
|
|
|
13
13
|
pnpm add -D @maz-ui/eslint-config eslint
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
The Tailwind plugin and other peer/transitive dependencies are bundled as direct dependencies, so you don't need to install them yourself.
|
|
17
|
+
|
|
16
18
|
## Basic usage
|
|
17
19
|
|
|
18
20
|
Create `eslint.config.ts` (or `.mjs`/`.js`) at the root of your project:
|
|
@@ -35,7 +37,7 @@ export default defineConfig({
|
|
|
35
37
|
typescript: true, // default
|
|
36
38
|
vue: true, // auto-detected
|
|
37
39
|
sonarjs: true, // default
|
|
38
|
-
tailwindcss: false, //
|
|
40
|
+
tailwindcss: false, // see "Tailwind support" below
|
|
39
41
|
vueAccessibility: false, // optional
|
|
40
42
|
formatters: true, // CSS/HTML/JSON/YAML/Markdown formatting via dprint
|
|
41
43
|
|
|
@@ -50,9 +52,29 @@ export default defineConfig({
|
|
|
50
52
|
'no-console': 'error',
|
|
51
53
|
'vue/custom-event-name-casing': ['error', 'kebab-case'],
|
|
52
54
|
},
|
|
55
|
+
|
|
56
|
+
// Log verbosity — see "Logging" below.
|
|
57
|
+
logLevel: 'default',
|
|
53
58
|
})
|
|
54
59
|
```
|
|
55
60
|
|
|
61
|
+
## Logging
|
|
62
|
+
|
|
63
|
+
The preset prints a titled box summarizing what it resolved (typescript, vue, tailwindcss preset, sonarjs, …) when ESLint loads. Powered by [`@maz-ui/node`](https://www.npmjs.com/package/@maz-ui/node)'s consola-based logger.
|
|
64
|
+
|
|
65
|
+
| `logLevel` | What you see |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `'silent'` | Nothing. |
|
|
68
|
+
| `'default'` *(TTY default)* | A titled box summarizing the resolved feature toggles, with `(auto-detected)` / `(default)` annotations next to each value. |
|
|
69
|
+
| `'debug'` | Adds one line per major block applied (Vue rules, SonarJS preset, vue-a11y, Tailwind plugin, test relaxations, user overrides). |
|
|
70
|
+
| `'verbose'` | Adds the final shape: total block count and ignore-glob count. |
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
defineConfig({ logLevel: 'debug' })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The default is **`'default'` in interactive terminals (TTY) and `'silent'` otherwise** — CI, lint-staged, pipes, and JSON / SARIF formatters all write to stdout, where the box would corrupt machine-readable output. `logLevel` always wins when set explicitly.
|
|
77
|
+
|
|
56
78
|
You can also append raw flat-config items as additional arguments — they merge after the built-in configs:
|
|
57
79
|
|
|
58
80
|
```ts
|
|
@@ -65,32 +87,190 @@ export default defineConfig(
|
|
|
65
87
|
)
|
|
66
88
|
```
|
|
67
89
|
|
|
90
|
+
## Tailwind support
|
|
91
|
+
|
|
92
|
+
Powered by [`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss) — supports both **Tailwind v3 and v4**, and ESLint 7→10.
|
|
93
|
+
|
|
94
|
+
The `tailwindcss` option accepts several shapes:
|
|
95
|
+
|
|
96
|
+
| Value | Behavior |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `false` *(default)* | Disabled. |
|
|
99
|
+
| `true` | Same as `'recommended'` with default settings. |
|
|
100
|
+
| `'recommended'` | Stylistic + correctness rules. |
|
|
101
|
+
| `'stylistic'` | Formatting rules only — class order, line wrapping, no duplicate classes, etc. |
|
|
102
|
+
| `'correctness'` | Validation rules only — `no-unknown-classes`, `no-conflicting-classes`. |
|
|
103
|
+
| `MazTailwindcssOptions` | Pick a preset and pass plugin settings (Tailwind config path, prefix entry point, …). |
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
defineConfig({
|
|
107
|
+
tailwindcss: {
|
|
108
|
+
preset: 'recommended',
|
|
109
|
+
// Tailwind v4 — path to the CSS that does `@import "tailwindcss" prefix(maz)`.
|
|
110
|
+
entryPoint: 'src/main.css',
|
|
111
|
+
// Tailwind v3 instead — path to your config file.
|
|
112
|
+
// tailwindConfig: 'tailwind.config.ts',
|
|
113
|
+
// Tailwind v4: detect custom @layer components classes (cards, btns, …).
|
|
114
|
+
detectComponentClasses: true,
|
|
115
|
+
// Monorepo: directory used to resolve `tailwindcss` and the config file.
|
|
116
|
+
cwd: 'apps/web',
|
|
117
|
+
// Custom `maz/tailwind-no-arbitrary-px` rule — see "Custom rules" below.
|
|
118
|
+
noArbitraryPx: true,
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
::: warning Plugin needs to know your Tailwind setup
|
|
124
|
+
The plugin's correctness rules (`no-unknown-classes`, `no-conflicting-classes`) auto-resolve your Tailwind installation. Without `entryPoint` (v4) or `tailwindConfig` (v3), the plugin falls back to the **default Tailwind config** and won't know about your prefix, custom utilities, or theme tokens — which produces a flood of false positives in non-vanilla setups.
|
|
125
|
+
|
|
126
|
+
If you customize Tailwind in any meaningful way (prefix, extend theme, custom utilities), set `entryPoint` or `tailwindConfig` explicitly. If you hit false positives anyway, downgrade to `'stylistic'` (formatting only) or disable individual rules:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
defineConfig({
|
|
130
|
+
tailwindcss: 'recommended',
|
|
131
|
+
rules: {
|
|
132
|
+
'better-tailwindcss/no-unknown-classes': 'off',
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
```
|
|
136
|
+
:::
|
|
137
|
+
|
|
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.
|
|
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
|
+
|
|
68
225
|
## What it includes
|
|
69
226
|
|
|
70
227
|
- **Antfu base** — TypeScript-aware rules, Stylistic formatting, modern import order.
|
|
71
228
|
- **SonarJS** — code quality and complexity heuristics, with a relaxed set for `*.spec.ts` / `*.test.ts`.
|
|
72
229
|
- **Vue rules** (when Vue/Nuxt is detected) — block-tag order, naming conventions, template a11y.
|
|
73
|
-
- **Tailwind plugin** (opt-in) — class ordering,
|
|
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).
|
|
74
232
|
- **Markdown** — prose linting baseline.
|
|
233
|
+
- **vueAccessibility** (opt-in) — `eslint-plugin-vuejs-accessibility` rules with the AudioWorklet globals fix.
|
|
75
234
|
|
|
76
235
|
## Advanced
|
|
77
236
|
|
|
78
|
-
|
|
237
|
+
### Compose your own config
|
|
79
238
|
|
|
80
239
|
```ts
|
|
81
|
-
import {
|
|
240
|
+
import {
|
|
241
|
+
baseRules,
|
|
242
|
+
mazPlugin,
|
|
243
|
+
sonarjsRules,
|
|
244
|
+
tailwindcssConfigs,
|
|
245
|
+
vueRules,
|
|
246
|
+
} from '@maz-ui/eslint-config'
|
|
82
247
|
|
|
83
248
|
export default [
|
|
84
249
|
{
|
|
250
|
+
plugins: { maz: mazPlugin },
|
|
85
251
|
rules: {
|
|
86
|
-
...baseRules(true),
|
|
252
|
+
...baseRules(true), // production = true → no-console: 'error'
|
|
87
253
|
...sonarjsRules,
|
|
88
|
-
|
|
254
|
+
...vueRules,
|
|
255
|
+
'maz/tailwind-no-arbitrary-px': 'error',
|
|
89
256
|
},
|
|
90
257
|
},
|
|
258
|
+
// Drop in just the Tailwind block, with whatever preset and settings you want.
|
|
259
|
+
...tailwindcssConfigs('stylistic', {
|
|
260
|
+
entryPoint: 'src/main.css',
|
|
261
|
+
noArbitraryPx: { unit: 'em' },
|
|
262
|
+
}),
|
|
91
263
|
]
|
|
92
264
|
```
|
|
93
265
|
|
|
266
|
+
### Auto-detection caveat (monorepos)
|
|
267
|
+
|
|
268
|
+
Auto-detection of Vue / Nuxt reads the `package.json` in `process.cwd()` only. In a monorepo where `vue` is hoisted to the root and missing from a sub-package's `package.json`, detection silently fails. Set `vue: true` explicitly in those cases:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
defineConfig({ vue: true, tailwindcss: { preset: 'recommended', cwd: 'apps/web' } })
|
|
272
|
+
```
|
|
273
|
+
|
|
94
274
|
## Compatibility
|
|
95
275
|
|
|
96
276
|
| Tool | Required version |
|
|
@@ -98,3 +278,4 @@ export default [
|
|
|
98
278
|
| ESLint | `>=9.0.0 <11.0.0` |
|
|
99
279
|
| Node.js | `>=20.19.0` |
|
|
100
280
|
| TypeScript | `^5.0.0` |
|
|
281
|
+
| Tailwind CSS | `^3.3.0 \|\| ^4.0.0` *(when `tailwindcss` is on)* |
|
|
@@ -5,7 +5,7 @@ description: Stylelint preset for Vue/Nuxt/JS/TS projects, with first-class Tail
|
|
|
5
5
|
|
|
6
6
|
# {{ $frontmatter.title }}
|
|
7
7
|
|
|
8
|
-
`@maz-ui/stylelint-config` is the Stylelint counterpart to [`@maz-ui/eslint-config`](./eslint-config.md). It builds on Stylelint's official **standard** config and layers in the conventions used by maz-ui itself: BEM-friendly class patterns, Tailwind v4 at-rule whitelist, RTL-friendly logical properties, optional SCSS support,
|
|
8
|
+
`@maz-ui/stylelint-config` is the Stylelint counterpart to [`@maz-ui/eslint-config`](./eslint-config.md). It builds on Stylelint's official **standard** config and layers in the conventions used by maz-ui itself: BEM-friendly class patterns, Tailwind v4 support (at-rule whitelist + tunable plugin policy), RTL-friendly logical properties, optional SCSS support, Vue/HTML block parsing, and a single `extends` knob to compose extra shareable configs.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ description: Stylelint preset for Vue/Nuxt/JS/TS projects, with first-class Tail
|
|
|
13
13
|
pnpm add -D @maz-ui/stylelint-config stylelint
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
The peer dependencies the preset relies on (`stylelint-config-standard`, `stylelint-config-recommended-vue`, `stylelint-use-logical-spec`, …) are bundled as direct dependencies, so you don't need to install them yourself.
|
|
16
|
+
The peer dependencies the preset relies on (`stylelint-config-standard`, `stylelint-config-recommended-vue`, `stylelint-use-logical-spec`, `stylelint-plugin-tailwindcss`, `stylelint-order`, …) are bundled as direct dependencies, so you don't need to install them yourself.
|
|
17
17
|
|
|
18
18
|
## Basic usage
|
|
19
19
|
|
|
@@ -30,8 +30,16 @@ Vue, Tailwind and SCSS are auto-detected from your `package.json`:
|
|
|
30
30
|
| Detected when… | Enables… |
|
|
31
31
|
| --- | --- |
|
|
32
32
|
| `vue` or `nuxt` is in dependencies | Vue support (`stylelint-config-recommended-vue`, `<style>` block parsing) |
|
|
33
|
-
| `tailwindcss` is in dependencies |
|
|
34
|
-
| `sass`, `sass-embedded` or `node-sass` is in dependencies | SCSS support (`stylelint-config-
|
|
33
|
+
| `tailwindcss` or `@tailwindcss/vite` is in dependencies | At-rule whitelist + Tailwind plugin with the `'minimal'` policy (see [Tailwind](#tailwind-css-v4) below) |
|
|
34
|
+
| `sass`, `sass-embedded` or `node-sass` is in dependencies | SCSS support (`stylelint-config-standard-scss`, `postcss-scss`) |
|
|
35
|
+
|
|
36
|
+
::: warning Monorepo caveat
|
|
37
|
+
Detection only reads the `package.json` in the current working directory. In a monorepo where `tailwindcss`, `vue` or `sass` are hoisted to the root and **not declared** in a sub-package's `package.json`, detection silently fails when Stylelint runs from that sub-package. Set the relevant flags explicitly in those cases:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
defineConfig({ vue: true, tailwind: true, scss: false })
|
|
41
|
+
```
|
|
42
|
+
:::
|
|
35
43
|
|
|
36
44
|
## Configuration
|
|
37
45
|
|
|
@@ -42,6 +50,9 @@ export default defineConfig({
|
|
|
42
50
|
// Each one is also auto-detected — set explicitly to opt in/out.
|
|
43
51
|
vue: true,
|
|
44
52
|
html: false,
|
|
53
|
+
|
|
54
|
+
// `true` → 'minimal' plugin policy. Pass 'recommended' or 'strict' to enforce
|
|
55
|
+
// utility-first authoring conventions. `false` disables Tailwind support.
|
|
45
56
|
tailwind: true,
|
|
46
57
|
scss: false,
|
|
47
58
|
|
|
@@ -52,7 +63,7 @@ export default defineConfig({
|
|
|
52
63
|
|
|
53
64
|
// Property order strategy.
|
|
54
65
|
// 'recess' : Recess-based ordering via stylelint-config-recess-order (default)
|
|
55
|
-
// 'alphabetical' :
|
|
66
|
+
// 'alphabetical' : A→Z ordering via stylelint-order
|
|
56
67
|
// false : Disable ordering rules
|
|
57
68
|
order: 'recess',
|
|
58
69
|
|
|
@@ -72,9 +83,33 @@ export default defineConfig({
|
|
|
72
83
|
rules: { 'no-descending-specificity': null },
|
|
73
84
|
},
|
|
74
85
|
],
|
|
86
|
+
|
|
87
|
+
// Layer extra shareable configs. Appended after the built-ins so they
|
|
88
|
+
// win Stylelint's cascade.
|
|
89
|
+
extends: ['stylelint-config-clean-order'],
|
|
90
|
+
|
|
91
|
+
// Log verbosity — see "Logging" below.
|
|
92
|
+
logLevel: 'default',
|
|
75
93
|
})
|
|
76
94
|
```
|
|
77
95
|
|
|
96
|
+
## Logging
|
|
97
|
+
|
|
98
|
+
The preset can explain what it resolved and which plugins / extends it added — useful when you can't figure out why a rule is on or off. Logging is powered by [`@maz-ui/node`](https://www.npmjs.com/package/@maz-ui/node)'s consola-based logger.
|
|
99
|
+
|
|
100
|
+
| `logLevel` | What you see |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `'silent'` | Nothing. |
|
|
103
|
+
| `'default'` *(default)* | A titled box summarizing the resolved support (vue, tailwind, scss, html, logical, order), with `(auto-detected)` / `(default)` annotations next to each value. |
|
|
104
|
+
| `'debug'` | Adds one line per plugin / extends / overrides addition (`Vue: extended stylelint-config-recommended-vue`, `Tailwind: loaded 2 plugin(s) for "minimal" policy`, `User: extended stylelint-config-clean-order`, …). |
|
|
105
|
+
| `'verbose'` | Adds the final shape: complete `extends` list, plugin / rule / override / ignore counts. |
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
defineConfig({ logLevel: 'debug' })
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The `logLevel` type comes from `@maz-ui/node` and accepts the full set of consola levels (`'silent'`, `'error'`, `'warning'`, `'normal'`, `'default'`, `'debug'`, `'trace'`, `'verbose'`). The four values above are the ones the preset actually produces output for.
|
|
112
|
+
|
|
78
113
|
## Logical properties (RTL-friendly)
|
|
79
114
|
|
|
80
115
|
When `logical: true` (default), the preset enables [`stylelint-use-logical-spec`](https://github.com/Jordan-Hall/stylelint-use-logical-spec) which warns whenever you use a physical CSS property that has a logical equivalent:
|
|
@@ -107,20 +142,91 @@ defineConfig({ logical: false })
|
|
|
107
142
|
|
|
108
143
|
## Tailwind CSS v4
|
|
109
144
|
|
|
110
|
-
When `tailwind
|
|
145
|
+
When `tailwind` is enabled (truthy or auto-detected), the preset:
|
|
111
146
|
|
|
112
147
|
- Whitelists every Tailwind v4 at-rule via `at-rule-no-unknown` (and `scss/at-rule-no-unknown` when SCSS is also on): `@apply`, `@theme`, `@layer`, `@variant`, `@custom-variant`, `@reference`, `@utility`, `@source`, `@screen`, `@starting-style`, `@tailwind`.
|
|
113
148
|
- Sets `at-rule-no-deprecated` to allow `@apply` (Tailwind v4 still ships it as the canonical authoring directive).
|
|
114
149
|
- Forces `import-notation: 'string'` — Tailwind v4 only parses the `prefix(...)` modifier on bare-string `@import` forms, never on `url()`-wrapped imports.
|
|
150
|
+
- Loads [`stylelint-plugin-tailwindcss`](https://github.com/sonofmagic/dev-configs/tree/main/packages/stylelint-plugin-tailwindcss) and applies a curated rule set based on the chosen policy level.
|
|
151
|
+
|
|
152
|
+
### Policy levels
|
|
153
|
+
|
|
154
|
+
The `tailwind` option accepts a strictness level. Pure `true` (or auto-detection) maps to `'minimal'`.
|
|
155
|
+
|
|
156
|
+
| Value | Plugin loaded | What runs |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `true` *(or auto-detected)* | ❌ | Same as `'minimal'`. |
|
|
159
|
+
| `'minimal'` | ❌ | At-rule whitelist + `import-notation: 'string'` + `at-rule-no-deprecated`. **No plugin rules.** |
|
|
160
|
+
| `'recommended'` | ✅ | `'minimal'` + `stylelint-plugin-tailwindcss`'s `recommended` preset (`no-invalid-apply`, `no-invalid-theme-function`, `no-atomic-class`, `no-apply`, `no-arbitrary-value`). |
|
|
161
|
+
| `'strict'` | ✅ | `'recommended'` + architecture-level rules (`no-theme-function`, `no-screen-directive`, `no-tailwind-directive`, `no-import-directive`, `no-css-layer`). |
|
|
162
|
+
| `false` | ❌ | Tailwind support disabled entirely (no at-rule whitelist, no plugin). |
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
defineConfig({ tailwind: 'recommended' })
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
::: warning Plugin rules need to find your Tailwind runtime
|
|
169
|
+
Both `'recommended'` and `'strict'` enable rules from `stylelint-plugin-tailwindcss` that resolve your project's Tailwind installation from each linted file's path. Projects with a Tailwind v4 prefix (`maz:`, `tw:`, …), a non-standard entry CSS, or a monorepo layout where the plugin can't locate Tailwind will produce a flood of false positives (every `@apply maz:flex` flagged as invalid).
|
|
170
|
+
|
|
171
|
+
`'minimal'` is the safe default — it only enables the at-rule whitelist and a couple of CSS-level rules, no runtime Tailwind validation.
|
|
172
|
+
|
|
173
|
+
If you want validation but hit false positives, drop the offending rule:
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
defineConfig({
|
|
177
|
+
tailwind: 'recommended',
|
|
178
|
+
rules: {
|
|
179
|
+
'tailwindcss/no-invalid-apply': null,
|
|
180
|
+
'tailwindcss/no-invalid-theme-function': null,
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
```
|
|
184
|
+
:::
|
|
185
|
+
|
|
186
|
+
The plugin supports both Tailwind v3 and v4.
|
|
187
|
+
|
|
188
|
+
## Property ordering
|
|
189
|
+
|
|
190
|
+
| Value | Behavior |
|
|
191
|
+
| --- | --- |
|
|
192
|
+
| `'recess'` *(default)* | Extends `stylelint-config-recess-order`. Pragmatic, widely adopted, groups related properties. |
|
|
193
|
+
| `'alphabetical'` | Loads `stylelint-order` and enables `order/properties-alphabetical-order`. Strict A→Z. |
|
|
194
|
+
| `false` | No ordering rules. |
|
|
195
|
+
|
|
196
|
+
To swap recess for another shareable order config (e.g. `stylelint-config-clean-order`), disable the built-in strategy and extend yours via the [`extends`](#layering-shareable-configs) option:
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
defineConfig({
|
|
200
|
+
order: false,
|
|
201
|
+
extends: ['stylelint-config-clean-order'],
|
|
202
|
+
})
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Layering shareable configs
|
|
206
|
+
|
|
207
|
+
The `extends` option appends entries **after** the built-ins, so user configs win Stylelint's cascade:
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
defineConfig({
|
|
211
|
+
extends: [
|
|
212
|
+
'stylelint-config-clean-order', // alternative property order
|
|
213
|
+
'@stylistic/stylelint-config', // restore stylistic rules retired from Stylelint core
|
|
214
|
+
],
|
|
215
|
+
})
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Use this to layer additional shareable configs without rewriting the whole `defineConfig` output.
|
|
115
219
|
|
|
116
220
|
## What it includes
|
|
117
221
|
|
|
118
222
|
- **Stylelint Standard** — Idiomatic CSS rules from the official Stylelint config.
|
|
119
|
-
- **Property ordering** (`stylelint-config-recess-order`)
|
|
223
|
+
- **Property ordering** — Recess-based by default (`stylelint-config-recess-order`), alphabetical via `stylelint-order`, or off — see [Property ordering](#property-ordering).
|
|
224
|
+
- **Tailwind v4 support** (opt-in / auto-detected) — at-rule whitelist + `stylelint-plugin-tailwindcss` with three policy levels — see [Tailwind CSS v4](#tailwind-css-v4).
|
|
120
225
|
- **Vue / HTML support** (opt-in / auto-detected) — `<style>` and `<style scoped>` block parsing via `postcss-html`.
|
|
121
|
-
- **SCSS support** (opt-in / auto-detected) —
|
|
122
|
-
- **Logical properties** — RTL-friendly authoring
|
|
226
|
+
- **SCSS support** (opt-in / auto-detected) — `stylelint-config-standard-scss` + native SCSS at-rule whitelist.
|
|
227
|
+
- **Logical properties** — RTL-friendly authoring via `stylelint-use-logical-spec`.
|
|
123
228
|
- **BEM-friendly class patterns** — disables `selector-class-pattern` and `no-descending-specificity` so `m-btn__icon`, `m-btn--ghost` and `:deep(...)` selectors flow naturally.
|
|
229
|
+
- **Layering** — `extends` option to compose additional shareable configs on top of the resolved output.
|
|
124
230
|
|
|
125
231
|
## Advanced
|
|
126
232
|
|
|
@@ -134,6 +240,9 @@ import {
|
|
|
134
240
|
scssRules,
|
|
135
241
|
TAILWIND_AT_RULES,
|
|
136
242
|
tailwindAtRuleNoUnknown,
|
|
243
|
+
tailwindPluginMinimal,
|
|
244
|
+
tailwindPluginRecommended,
|
|
245
|
+
tailwindPluginStrict,
|
|
137
246
|
tailwindRules,
|
|
138
247
|
} from '@maz-ui/stylelint-config'
|
|
139
248
|
|
|
@@ -142,10 +251,13 @@ export default {
|
|
|
142
251
|
...baseRules,
|
|
143
252
|
...tailwindRules,
|
|
144
253
|
...tailwindAtRuleNoUnknown,
|
|
254
|
+
...tailwindPluginMinimal,
|
|
145
255
|
},
|
|
146
256
|
}
|
|
147
257
|
```
|
|
148
258
|
|
|
259
|
+
Each `tailwindPlugin*` constant is the rule object for the corresponding policy level — useful when you compose Stylelint configs by hand instead of going through `defineConfig`.
|
|
260
|
+
|
|
149
261
|
## Migrating from a hand-written `.stylelintrc`
|
|
150
262
|
|
|
151
263
|
If you used the historical maz-ui Stylelint setup, the migration boils down to:
|
|
@@ -177,7 +289,7 @@ If you used the historical maz-ui Stylelint setup, the migration boils down to:
|
|
|
177
289
|
+export default defineConfig({
|
|
178
290
|
+ vue: true,
|
|
179
291
|
+ scss: true,
|
|
180
|
-
+ tailwind: true,
|
|
292
|
+
+ tailwind: true, // 'minimal' | 'recommended' | 'strict' | false also accepted
|
|
181
293
|
+ logical: true,
|
|
182
294
|
+})
|
|
183
295
|
```
|
|
@@ -93,8 +93,9 @@ npm install @maz-ui/themes
|
|
|
93
93
|
|
|
94
94
|
**Features:**
|
|
95
95
|
|
|
96
|
-
- 🎨
|
|
97
|
-
- 🌓 Smart dark mode
|
|
96
|
+
- 🎨 Native `light-dark()` + `color-scheme` + OKLCh scales via relative color syntax
|
|
97
|
+
- 🌓 Smart dark mode — `class` or `media` strategies, with smooth transitions on toggle
|
|
98
|
+
- ✨ Optional animated theme switch via View Transitions (`setColorMode(..., { animate: true })`)
|
|
98
99
|
- ⚡ `runtime` and `buildtime` rendering strategies
|
|
99
100
|
- 🍪 Active preset persisted across reloads (opt-out)
|
|
100
101
|
- 🛡️ Full TypeScript support
|
|
@@ -163,15 +164,6 @@ npm install @maz-ui/icons
|
|
|
163
164
|
Maz-UI v5 is built with tree-shaking in mind. Import only what you need for optimal bundle sizes:
|
|
164
165
|
|
|
165
166
|
```typescript
|
|
166
|
-
/**
|
|
167
|
-
* Utilities
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
// ❌ Avoid importing everything
|
|
171
|
-
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
172
|
-
// ✅ Import from @maz-ui/utils
|
|
173
|
-
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
174
|
-
|
|
175
167
|
/**
|
|
176
168
|
* Components
|
|
177
169
|
*/
|
|
@@ -215,6 +207,16 @@ import { vClickOutside } from 'maz-ui/directives/vClickOutside'
|
|
|
215
207
|
import { MazUi } from 'maz-ui/plugins'
|
|
216
208
|
// ✅✅ Direct plugin import (most optimized)
|
|
217
209
|
import { MazUi } from 'maz-ui/plugins/maz-ui'
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Utilities
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
// ❌ Avoid importing everything
|
|
216
|
+
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
217
|
+
// ✅ Import from @maz-ui/utils
|
|
218
|
+
import { debounce } from '@maz-ui/utils/helpers/debounce'
|
|
219
|
+
import { formatCurrency } from '@maz-ui/utils/helpers/formatCurrency'
|
|
218
220
|
```
|
|
219
221
|
|
|
220
222
|
::: tip Maximum Optimization
|
|
@@ -97,12 +97,15 @@ The entire Maz-UI setup is now code-split into the Dashboard chunk.
|
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
interface ThemeOptions {
|
|
100
|
-
preset: ThemePreset
|
|
101
|
-
overrides?: ThemePresetOverrides
|
|
102
|
-
strategy?: 'runtime' | 'buildtime'
|
|
100
|
+
preset: ThemePreset // Required - Theme preset (mazUi, ocean, pristine, obsidian, nova, or custom)
|
|
101
|
+
overrides?: ThemePresetOverrides // Partial overrides for colors, foundation, etc.
|
|
102
|
+
strategy?: 'runtime' | 'buildtime' // CSS generation strategy (default: 'runtime')
|
|
103
103
|
darkModeStrategy?: 'class' | 'media' // Dark mode handling (default: 'class')
|
|
104
104
|
colorMode?: 'light' | 'dark' | 'auto' // Initial color mode (default: 'auto')
|
|
105
105
|
mode?: 'light' | 'dark' | 'both' // Supported color modes (default: 'both')
|
|
106
|
+
darkClass?: string // Class on <html> when colorMode === 'dark' (default: 'dark')
|
|
107
|
+
lightClass?: string // Class on <html> when colorMode === 'light' (default: 'light')
|
|
108
|
+
persistPreset?: boolean // Persist active preset in cookie (default: true)
|
|
106
109
|
}
|
|
107
110
|
```
|
|
108
111
|
|
|
@@ -41,6 +41,10 @@ v4.0.0 isn't just an update, it's a **complete rebuild** that transforms Maz-UI
|
|
|
41
41
|
- **Dynamic CSS Variables**: Automatic CSS variable generation
|
|
42
42
|
- **Intelligent dark mode**: Configurable strategies for dark mode based on system preferences and user choice stored in cookies
|
|
43
43
|
|
|
44
|
+
::: tip Theming further evolved in v5
|
|
45
|
+
The theme system has been rewritten on top of native `light-dark()` + `color-scheme` + `color-mix(in oklch)` in v5. If you are upgrading past v4, see the dedicated [v5 migration guide](./migration-v5.md#theming-native-css-rewrite-new-non-breaking-by-default) for the full theming changes (new `lightClass`, `Promise<void>` returns, removed JS helpers).
|
|
46
|
+
:::
|
|
47
|
+
|
|
44
48
|
#### Complete Internationalization
|
|
45
49
|
|
|
46
50
|
- **9 supported languages by default**: EN, FR, DE, ES, IT, PT, JA, ZH-CN
|
|
@@ -688,12 +692,12 @@ app.use(MazUi, {
|
|
|
688
692
|
<script setup>
|
|
689
693
|
import { useTheme } from 'maz-ui/composables'
|
|
690
694
|
|
|
691
|
-
const { isDark, toggleDarkMode,
|
|
695
|
+
const { isDark, toggleDarkMode, updateTheme } = useTheme()
|
|
692
696
|
|
|
693
697
|
// Change theme
|
|
694
|
-
|
|
698
|
+
updateTheme('ocean')
|
|
695
699
|
|
|
696
|
-
// Toggle dark mode
|
|
700
|
+
// Toggle dark mode (v5: returns Promise<void>, optional { animate } param)
|
|
697
701
|
toggleDarkMode()
|
|
698
702
|
</script>
|
|
699
703
|
|