@maz-ui/mcp 5.0.0-canary.ef64a02.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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-avatar.doc.md +30 -30
- package/docs/generated-docs/maz-bottom-sheet.doc.md +16 -13
- package/docs/generated-docs/maz-btn.doc.md +21 -19
- package/docs/generated-docs/maz-checkbox.doc.md +16 -17
- 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-container.doc.md +1 -0
- 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-dropdown.doc.md +3 -0
- package/docs/generated-docs/maz-expand-animation.doc.md +4 -4
- 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-code.doc.md +16 -16
- package/docs/generated-docs/maz-input-phone-number.doc.md +43 -38
- 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 +33 -33
- 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-markdown-editor.doc.md +65 -0
- package/docs/generated-docs/maz-popover.doc.md +1 -1
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +39 -20
- 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-select-country.doc.md +27 -26
- 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 +27 -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 +5 -0
- package/docs/generated-docs/maz-sidebar.doc.md +36 -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-switch.doc.md +14 -14
- package/docs/generated-docs/maz-table-virtualizer.doc.md +20 -0
- package/docs/generated-docs/maz-table.doc.md +43 -37
- package/docs/generated-docs/maz-tabs-bar.doc.md +20 -9
- package/docs/generated-docs/maz-tabs.doc.md +6 -3
- package/docs/generated-docs/maz-textarea.doc.md +27 -24
- package/docs/generated-docs/maz-ticker.doc.md +1 -1
- package/docs/generated-docs/maz-timeline.doc.md +4 -4
- package/docs/generated-docs/maz-window-mockup.doc.md +23 -0
- package/docs/src/blog/v4.md +1 -1
- package/docs/src/blog/v5.md +5 -7
- package/docs/src/components/maz-avatar.md +52 -4
- package/docs/src/components/maz-badge.md +4 -4
- package/docs/src/components/maz-bottom-sheet.md +304 -169
- package/docs/src/components/maz-btn.md +3 -3
- package/docs/src/components/maz-chart.md +8 -0
- package/docs/src/components/maz-checklist.md +10 -10
- package/docs/src/components/maz-code-highlight.md +233 -0
- package/docs/src/components/maz-container.md +2 -2
- package/docs/src/components/maz-date-picker.md +62 -1
- package/docs/src/components/maz-dialog.md +52 -0
- package/docs/src/components/maz-drawer.md +4 -0
- package/docs/src/components/maz-dropdown.md +36 -16
- package/docs/src/components/maz-icon.md +16 -5
- package/docs/src/components/maz-input-phone-number.md +136 -103
- package/docs/src/components/maz-input.md +4 -0
- package/docs/src/components/maz-lazy-img.md +64 -0
- package/docs/src/components/maz-markdown-editor.md +373 -0
- package/docs/src/components/maz-popover.md +2 -1
- package/docs/src/components/maz-pull-to-refresh.md +176 -17
- package/docs/src/components/maz-radio-buttons.md +6 -0
- package/docs/src/components/maz-select-country.md +138 -1
- package/docs/src/components/maz-select.md +9 -0
- package/docs/src/components/maz-sidebar.md +719 -0
- package/docs/src/components/maz-slider.md +6 -0
- package/docs/src/components/maz-stepper.md +4 -0
- package/docs/src/components/maz-table.md +162 -1
- package/docs/src/components/maz-tabs.md +117 -3
- package/docs/src/components/maz-textarea.md +85 -1
- package/docs/src/components/maz-timeline.md +60 -0
- package/docs/src/components/maz-window-mockup.md +249 -0
- package/docs/src/composables/use-drag.md +239 -0
- package/docs/src/composables/use-form-validator.md +297 -16
- package/docs/src/composables/use-pull-to-refresh.md +79 -0
- package/docs/src/composables/use-swipe.md +26 -11
- package/docs/src/directives/click-outside.md +8 -15
- package/docs/src/directives/fullscreen-img.md +1 -1
- package/docs/src/directives/lazy-img.md +44 -11
- package/docs/src/directives/tooltip.md +24 -1
- package/docs/src/directives/zoom-img.md +1 -1
- package/docs/src/ecosystem/eslint-config.md +189 -8
- 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 +107 -47
- package/docs/src/ecosystem/stylelint-config.md +122 -10
- package/docs/src/{guide → ecosystem}/themes.md +152 -71
- package/docs/src/{guide → ecosystem}/translations.md +1 -1
- package/docs/src/ecosystem/utils/camel-case.md +31 -0
- package/docs/src/{helpers → ecosystem/utils}/capitalize.md +2 -3
- 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-ios.md +37 -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/prevent-ios-input-zoom.md +66 -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 +15 -13
- package/docs/src/guide/global-defaults.md +102 -0
- package/docs/src/guide/maz-ui-provider.md +6 -3
- package/docs/src/guide/migration-v4.md +13 -9
- package/docs/src/guide/migration-v5.md +222 -20
- package/docs/src/guide/resolvers.md +8 -8
- package/docs/src/guide/tailwind.md +4 -0
- package/docs/src/guide/vue.md +4 -4
- package/docs/src/index.md +13 -13
- package/docs/src/plugins/aos.md +1 -1
- package/package.json +15 -11
- 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}/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
|
@@ -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
|
```
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Theming
|
|
3
|
-
description: Modern and performant theme system for Maz-UI
|
|
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
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
14
|
+
- **Native `light-dark()` + `color-scheme`** - Modern CSS theming with zero JS overhead for the light/dark switch
|
|
15
|
+
- **Native widget theming** - `color-scheme` makes scrollbars, native `<select>`, date pickers and autofill follow the active mode automatically
|
|
16
|
+
- **Animated theme switch** - Optional full-page View Transitions via `setColorMode(..., { animate: true })`
|
|
17
|
+
- **Anti-FART** - `<meta name="color-scheme">` injected at boot to prevent any Flash of inAccurate coloR Theme (no setup needed)
|
|
18
|
+
- **Automatic color scales** - `--maz-X-50` through `--maz-X-950` derived via OKLCh relative color syntax — perceptually uniform and chroma-preserving
|
|
17
19
|
- **Performance Strategies** - Runtime injection or build-time generation according to your needs
|
|
18
20
|
- **Strict TypeScript** - Complete types for perfect DX
|
|
19
21
|
- **Zero FOUC** - Pass the preset object up front; the full CSS is injected synchronously on first paint
|
|
@@ -44,13 +46,17 @@ app.use(MazUi, {
|
|
|
44
46
|
darkModeStrategy: 'class', // 'class' | 'media' (only if mode is `both`)
|
|
45
47
|
mode: 'both', // 'light' | 'dark' | 'both' (supported color modes)
|
|
46
48
|
colorMode: 'auto', // 'auto' | 'light' | 'dark' (initial color mode, only if mode is 'both')
|
|
49
|
+
// Class added to <html> when dark mode is forced (default: 'dark')
|
|
50
|
+
darkClass: 'dark',
|
|
51
|
+
// Class added to <html> when light mode is forced (default: 'light')
|
|
52
|
+
lightClass: 'light',
|
|
47
53
|
persistPreset: true, // remember the active preset name across reloads
|
|
48
54
|
}
|
|
49
55
|
})
|
|
50
56
|
```
|
|
51
57
|
|
|
52
58
|
::: tip Alternative: MazUiProvider
|
|
53
|
-
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.
|
|
54
60
|
:::
|
|
55
61
|
|
|
56
62
|
### 2. Setup your CSS to support theme foundation and dark mode
|
|
@@ -89,10 +95,12 @@ const { toggleDarkMode, isDark, updateTheme } = useTheme()
|
|
|
89
95
|
|
|
90
96
|
- `preset`: The theme preset to use
|
|
91
97
|
- `overrides` (optional): Override specific parts of the theme
|
|
92
|
-
- `strategy` (optional): The rendering strategy to use
|
|
93
|
-
- `darkModeStrategy` (optional): The dark mode strategy
|
|
94
|
-
- `mode` (optional): The supported color modes
|
|
95
|
-
- `colorMode` (optional): The initial color mode
|
|
98
|
+
- `strategy` (optional, default `'runtime'`): The rendering strategy to use — `'runtime' | 'buildtime'`
|
|
99
|
+
- `darkModeStrategy` (optional, default `'class'`): The dark mode strategy — `'class' | 'media'`, only if you use mode `both`
|
|
100
|
+
- `mode` (optional, default `'both'`): The supported color modes — `'light' | 'dark' | 'both'`
|
|
101
|
+
- `colorMode` (optional, default `'auto'`): The initial color mode — `'light' | 'dark' | 'auto'` (only if mode is `'both'`)
|
|
102
|
+
- `darkClass` (optional, default `'dark'`): Class added to `<html>` when `colorMode === 'dark'`
|
|
103
|
+
- `lightClass` (optional, default `'light'`): Class added to `<html>` when `colorMode === 'light'` — mirror of `darkClass`
|
|
96
104
|
- `persistPreset` (optional, default `true`): Persist the active preset name in the `maz-preset` cookie so it is restored on reload.
|
|
97
105
|
|
|
98
106
|
### Preset persistence
|
|
@@ -118,6 +126,48 @@ Useful when:
|
|
|
118
126
|
- You want zero theme-related cookies (privacy / regulatory).
|
|
119
127
|
- The active preset is fully driven by the consumer app and no end-user switching is exposed.
|
|
120
128
|
|
|
129
|
+
## Color modes and class toggling
|
|
130
|
+
|
|
131
|
+
`darkClass` and `lightClass` interact with `darkModeStrategy` to control how `<html>` is decorated when the user picks an explicit mode.
|
|
132
|
+
|
|
133
|
+
### `darkModeStrategy: 'class'` (default)
|
|
134
|
+
|
|
135
|
+
- `setColorMode('dark')` adds `darkClass` (default `.dark`) to `<html>` → `color-scheme: only dark`.
|
|
136
|
+
- `setColorMode('light')` adds `lightClass` (default `.light`) to `<html>` → `color-scheme: only light`.
|
|
137
|
+
- `setColorMode('auto')` removes both classes → `color-scheme: light dark` lets the browser follow the system `prefers-color-scheme`.
|
|
138
|
+
|
|
139
|
+
Forcing both classes on the root ensures native widgets (scrollbars, native `<select>`, date pickers, autofill backgrounds, …) match the explicit user choice rather than the OS preference.
|
|
140
|
+
|
|
141
|
+
### `darkModeStrategy: 'media'`
|
|
142
|
+
|
|
143
|
+
- No class is ever added to `<html>`.
|
|
144
|
+
- The browser always follows `prefers-color-scheme` via `color-scheme: light dark`.
|
|
145
|
+
- `setColorMode()` still updates the persisted cookie but does **not** force a visual override.
|
|
146
|
+
|
|
147
|
+
## Animated theme switch
|
|
148
|
+
|
|
149
|
+
For a full-page animated swap (rather than per-variable color tweens), pass `{ animate: true }` to `setColorMode` or `toggleDarkMode`:
|
|
150
|
+
|
|
151
|
+
```vue
|
|
152
|
+
<script setup>
|
|
153
|
+
import { useTheme } from '@maz-ui/themes'
|
|
154
|
+
|
|
155
|
+
const { toggleDarkMode, setColorMode } = useTheme()
|
|
156
|
+
|
|
157
|
+
async function onToggle() {
|
|
158
|
+
await toggleDarkMode({ animate: true })
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function forceDark() {
|
|
162
|
+
await setColorMode('dark', { animate: true })
|
|
163
|
+
}
|
|
164
|
+
</script>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
- Wraps the switch in `document.startViewTransition()` so the browser captures a snapshot of the page before/after and crossfades between them.
|
|
168
|
+
- The View Transition glue is **lazy-imported** — when `animate` is not used, it stays out of the boot bundle.
|
|
169
|
+
- **Graceful degradation:** in browsers that don't support the API, the change is applied immediately with no animation (no error thrown).
|
|
170
|
+
|
|
121
171
|
## Interactive Demo
|
|
122
172
|
|
|
123
173
|
<ComponentDemo title="Real-time theme control">
|
|
@@ -395,14 +445,14 @@ const customTheme = await definePreset({
|
|
|
395
445
|
},
|
|
396
446
|
colors: {
|
|
397
447
|
light: {
|
|
398
|
-
primary: '
|
|
399
|
-
secondary: '
|
|
400
|
-
accent: '
|
|
448
|
+
primary: 'oklch(0.62 0.24 305)',
|
|
449
|
+
secondary: 'oklch(0.94 0.04 320)',
|
|
450
|
+
accent: 'oklch(0.7 0.22 290)'
|
|
401
451
|
},
|
|
402
452
|
dark: {
|
|
403
|
-
primary: '
|
|
404
|
-
secondary: '
|
|
405
|
-
accent: '
|
|
453
|
+
primary: 'oklch(0.72 0.22 305)',
|
|
454
|
+
secondary: 'oklch(0.28 0.06 320)',
|
|
455
|
+
accent: 'oklch(0.78 0.2 290)'
|
|
406
456
|
}
|
|
407
457
|
}
|
|
408
458
|
},
|
|
@@ -449,16 +499,16 @@ const brandTheme = await definePreset({
|
|
|
449
499
|
},
|
|
450
500
|
colors: {
|
|
451
501
|
light: {
|
|
452
|
-
primary: '
|
|
453
|
-
secondary: '
|
|
454
|
-
surface: '
|
|
455
|
-
accent: '
|
|
502
|
+
primary: 'oklch(0.6 0.18 254)',
|
|
503
|
+
secondary: 'oklch(0.96 0.01 254)',
|
|
504
|
+
surface: 'oklch(0.99 0.005 254)',
|
|
505
|
+
accent: 'oklch(0.7 0.22 305)'
|
|
456
506
|
},
|
|
457
507
|
dark: {
|
|
458
|
-
primary: '
|
|
459
|
-
secondary: '
|
|
460
|
-
surface: '
|
|
461
|
-
accent: '
|
|
508
|
+
primary: 'oklch(0.7 0.18 254)',
|
|
509
|
+
secondary: 'oklch(0.22 0.03 254)',
|
|
510
|
+
surface: 'oklch(0.18 0.02 254)',
|
|
511
|
+
accent: 'oklch(0.78 0.2 305)'
|
|
462
512
|
}
|
|
463
513
|
}
|
|
464
514
|
}
|
|
@@ -543,23 +593,58 @@ const surfaceTheme = definePreset({
|
|
|
543
593
|
|
|
544
594
|
Components consume these via `maz:bg-container` / `maz:bg-input` Tailwind utilities, so a single override propagates everywhere — no per-component class hunt.
|
|
545
595
|
|
|
596
|
+
### Dialog sizing
|
|
597
|
+
|
|
598
|
+
`components.dialog` controls the width of [`MazDialog`](./../components/maz-dialog.md) on tablet and up. The two keys are emitted as `--maz-dialog-max-width` / `--maz-dialog-min-width` and consumed by the component through `var(--maz-dialog-max-width, 38rem)` / `var(--maz-dialog-min-width, 32rem)`:
|
|
599
|
+
|
|
600
|
+
```typescript
|
|
601
|
+
const wideDialogTheme = definePreset({
|
|
602
|
+
base: 'maz-ui',
|
|
603
|
+
overrides: {
|
|
604
|
+
name: 'wide-dialogs',
|
|
605
|
+
components: {
|
|
606
|
+
dialog: {
|
|
607
|
+
'max-width': '48rem',
|
|
608
|
+
'min-width': '36rem',
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
},
|
|
612
|
+
})
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
Both values are in `rem`, so they scale with the preset's `base-font-size`. Bundled presets anchored on `14px` use `38rem` / `32rem`; `ocean` (`16px`) ships scaled rem values (`33.25rem` / `28rem`) to keep the same rendered pixel width. The `max-width` / `min-width` props on `MazDialog` still override the preset per instance.
|
|
616
|
+
|
|
546
617
|
## useTheme Composable API
|
|
547
618
|
|
|
548
619
|
```typescript
|
|
549
620
|
const {
|
|
550
621
|
// Reactive state
|
|
622
|
+
preset, // ComputedRef<ThemePreset>
|
|
551
623
|
presetName, // ComputedRef<string>
|
|
552
|
-
colorMode, //
|
|
624
|
+
colorMode, // Ref<'light' | 'dark' | 'auto'> — also accepts assignment (computed setter)
|
|
553
625
|
isDark, // ComputedRef<boolean>
|
|
554
626
|
strategy, // ComputedRef<'runtime' | 'buildtime'>
|
|
627
|
+
mode, // ComputedRef<'light' | 'dark' | 'both'>
|
|
628
|
+
darkModeStrategy, // ComputedRef<'class' | 'media'>
|
|
555
629
|
|
|
556
630
|
// Actions
|
|
557
|
-
updateTheme, // (preset: ThemePreset | ThemePresetOverrides) => void
|
|
558
|
-
setColorMode, // (mode: 'light' | 'dark' | 'auto') => void
|
|
559
|
-
toggleDarkMode // () => void
|
|
631
|
+
updateTheme, // (preset: ThemePreset | ThemePresetName | ThemePresetOverrides) => Promise<void>
|
|
632
|
+
setColorMode, // (mode: 'light' | 'dark' | 'auto', options?: { animate?: boolean }) => Promise<void>
|
|
633
|
+
toggleDarkMode, // (options?: { animate?: boolean }) => Promise<void>
|
|
560
634
|
} = useTheme()
|
|
635
|
+
|
|
636
|
+
// Set the color mode imperatively
|
|
637
|
+
await setColorMode('dark')
|
|
638
|
+
|
|
639
|
+
// Or assign to `colorMode` — it's a computed with a setter
|
|
640
|
+
colorMode.value = 'dark'
|
|
641
|
+
|
|
642
|
+
// Animated full-page switch via View Transitions
|
|
643
|
+
await toggleDarkMode({ animate: true })
|
|
561
644
|
```
|
|
562
645
|
|
|
646
|
+
`setColorMode` and `toggleDarkMode` are **async** (`Promise<void>`). The promise resolves once the change — and the optional View Transition — has been applied. Callers can ignore the return value when no transition is needed.
|
|
647
|
+
|
|
563
648
|
### Advanced Usage Examples
|
|
564
649
|
|
|
565
650
|
```vue
|
|
@@ -623,8 +708,8 @@ const customPreset = definePreset({
|
|
|
623
708
|
overrides: {
|
|
624
709
|
name: 'custom',
|
|
625
710
|
colors: {
|
|
626
|
-
light: { primary: '
|
|
627
|
-
dark: { primary: '
|
|
711
|
+
light: { primary: 'oklch(0.6 0.18 254)' },
|
|
712
|
+
dark: { primary: 'oklch(0.7 0.18 254)' },
|
|
628
713
|
},
|
|
629
714
|
},
|
|
630
715
|
})
|
|
@@ -687,8 +772,8 @@ const customPreset = definePreset({
|
|
|
687
772
|
overrides: {
|
|
688
773
|
name: 'custom',
|
|
689
774
|
colors: {
|
|
690
|
-
light: { primary: '
|
|
691
|
-
dark: { primary: '
|
|
775
|
+
light: { primary: 'oklch(0.6 0.18 254)' },
|
|
776
|
+
dark: { primary: 'oklch(0.7 0.18 254)' },
|
|
692
777
|
},
|
|
693
778
|
},
|
|
694
779
|
})
|
|
@@ -729,8 +814,8 @@ const customPreset = definePreset({
|
|
|
729
814
|
overrides: {
|
|
730
815
|
name: 'custom',
|
|
731
816
|
colors: {
|
|
732
|
-
light: { primary: '
|
|
733
|
-
dark: { primary: '
|
|
817
|
+
light: { primary: 'oklch(0.6 0.18 254)' },
|
|
818
|
+
dark: { primary: 'oklch(0.7 0.18 254)' },
|
|
734
819
|
},
|
|
735
820
|
},
|
|
736
821
|
})
|
|
@@ -819,7 +904,7 @@ const styleTag = createThemeStylesheet(css, {
|
|
|
819
904
|
|
|
820
905
|
## Token Reference
|
|
821
906
|
|
|
822
|
-
Every preset emits the same set of CSS variables on `:root
|
|
907
|
+
Every preset emits the same set of CSS variables on `:root`. With `mode: 'both'`, each base color is a single `light-dark(L, D)` declaration that the browser resolves to the active scheme. Use these names directly in your own CSS — `var(--maz-primary)`, `calc(var(--maz-space) * 4)`, etc.
|
|
823
908
|
|
|
824
909
|
### Foundation
|
|
825
910
|
|
|
@@ -893,16 +978,27 @@ Per-component knobs under `components.<key>`. All optional — omit to fall back
|
|
|
893
978
|
| `btn.font-weight` | `--maz-btn-font-weight` | Font-weight on `.m-btn`. Defaults to `'500'`. |
|
|
894
979
|
| `container.bg.light` / `.dark` | `--maz-container-bg` (per mode) | Background of `Card`, `Container`, `Dialog`, `Popover`, `Drawer`, … Defaults to `var(--maz-surface)`. Bridged to `--color-container`. |
|
|
895
980
|
| `input.bg.light` / `.dark` | `--maz-input-bg` (per mode) | Background of `Input`, `Textarea`, `Select`, `Checkbox`, … Defaults to `var(--maz-surface)` light, `var(--maz-surface-400)` dark. Bridged to `--color-input`. |
|
|
981
|
+
| `dialog.max-width` | `--maz-dialog-max-width` | Max-width of `MazDialog` on tablet and up. Defaults to `38rem` (`33.25rem` on `ocean`). Overridable via the `max-width` prop. |
|
|
982
|
+
| `dialog.min-width` | `--maz-dialog-min-width` | Min-width of `MazDialog` on tablet and up. Defaults to `32rem` (`28rem` on `ocean`). Overridable via the `min-width` prop. |
|
|
896
983
|
|
|
897
984
|
### Sample output
|
|
898
985
|
|
|
986
|
+
Each base color is emitted as a `light-dark()` value; scales `--maz-X-50` through `--maz-X-950` are derived via OKLCh relative color syntax so they automatically follow base color overrides at runtime, preserving chroma at every step.
|
|
987
|
+
|
|
899
988
|
```css
|
|
900
989
|
:root {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
--maz-
|
|
905
|
-
--maz-foreground: oklch(0.
|
|
990
|
+
color-scheme: light dark;
|
|
991
|
+
|
|
992
|
+
/* Base colors — one declaration each, resolved by the browser */
|
|
993
|
+
--maz-primary: light-dark(oklch(0.65 0.19 254), oklch(0.72 0.18 254));
|
|
994
|
+
--maz-primary-foreground: light-dark(oklch(1 0 0), oklch(0.16 0.01 254));
|
|
995
|
+
--maz-surface: light-dark(oklch(1 0 0), oklch(0.18 0.01 254));
|
|
996
|
+
--maz-foreground: light-dark(oklch(0.26 0.01 254), oklch(0.96 0.005 254));
|
|
997
|
+
|
|
998
|
+
/* Auto-generated 50–950 scale — derived via relative color syntax */
|
|
999
|
+
--maz-primary-500: var(--maz-primary);
|
|
1000
|
+
--maz-primary-600: oklch(from var(--maz-primary) clamp(0, calc(l - 0.07), 1) c h);
|
|
1001
|
+
/* ... */
|
|
906
1002
|
|
|
907
1003
|
/* Foundation */
|
|
908
1004
|
--maz-base-font-size: 14px;
|
|
@@ -914,35 +1010,19 @@ Per-component knobs under `components.<key>`. All optional — omit to fall back
|
|
|
914
1010
|
/* Scales */
|
|
915
1011
|
--maz-rounded-md: 0.7rem;
|
|
916
1012
|
--maz-shadow-style-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), …;
|
|
917
|
-
|
|
918
|
-
/* Auto-generated 50–950 scale */
|
|
919
|
-
--maz-primary-500: oklch(…);
|
|
920
|
-
/* ... */
|
|
921
1013
|
}
|
|
922
|
-
```
|
|
923
|
-
|
|
924
|
-
### Dark Mode
|
|
925
1014
|
|
|
926
|
-
|
|
927
|
-
.dark
|
|
928
|
-
|
|
929
|
-
--maz-foreground: 0 0% 85%;
|
|
930
|
-
/* Variables automatically adapted */
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
/* Or with media query */
|
|
934
|
-
@media (prefers-color-scheme: dark) {
|
|
935
|
-
:root {
|
|
936
|
-
--maz-surface: 235 16% 15%;
|
|
937
|
-
--maz-foreground: 0 0% 85%;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
1015
|
+
/* With darkModeStrategy: 'class' — explicit user choice overrides the system */
|
|
1016
|
+
.dark { color-scheme: only dark; }
|
|
1017
|
+
.light { color-scheme: only light; }
|
|
940
1018
|
```
|
|
941
1019
|
|
|
1020
|
+
For deeper detail on the generated CSS contract, see the [`@maz-ui/themes` README](https://github.com/LouisMazel/maz-ui/tree/master/packages/themes#generated-css-variables).
|
|
1021
|
+
|
|
942
1022
|
|
|
943
1023
|
## Usage with Nuxt
|
|
944
1024
|
|
|
945
|
-
For Nuxt users, check the [dedicated Nuxt documentation](/
|
|
1025
|
+
For Nuxt users, check the [dedicated Nuxt documentation](/ecosystem/nuxt) which covers installation and framework-specific configuration.
|
|
946
1026
|
|
|
947
1027
|
## Migration from Legacy System
|
|
948
1028
|
|
|
@@ -965,20 +1045,21 @@ export default defineConfig({
|
|
|
965
1045
|
```typescript [After (@maz-ui/themes)]
|
|
966
1046
|
// main.ts
|
|
967
1047
|
import { definePreset, mazUi } from '@maz-ui/themes'
|
|
1048
|
+
import { MazUiTheme } from '@maz-ui/themes/plugin'
|
|
968
1049
|
|
|
969
1050
|
const myTheme = definePreset({
|
|
970
1051
|
base: mazUi,
|
|
971
1052
|
overrides: {
|
|
972
1053
|
colors: {
|
|
973
1054
|
light: {
|
|
974
|
-
primary: '
|
|
975
|
-
secondary: '
|
|
1055
|
+
primary: 'oklch(0.65 0.19 254)',
|
|
1056
|
+
secondary: 'oklch(0.72 0.16 168)'
|
|
976
1057
|
}
|
|
977
1058
|
}
|
|
978
1059
|
}
|
|
979
1060
|
})
|
|
980
1061
|
|
|
981
|
-
app.use(
|
|
1062
|
+
app.use(MazUiTheme, { preset: myTheme })
|
|
982
1063
|
```
|
|
983
1064
|
|
|
984
1065
|
:::
|
|
@@ -1007,14 +1088,14 @@ const customPreset = await definePreset({
|
|
|
1007
1088
|
name: 'custom-purple',
|
|
1008
1089
|
colors: {
|
|
1009
1090
|
light: {
|
|
1010
|
-
'primary': '
|
|
1011
|
-
'secondary': '
|
|
1012
|
-
'accent': '
|
|
1091
|
+
'primary': 'oklch(0.62 0.24 305)',
|
|
1092
|
+
'secondary': 'oklch(0.94 0.04 320)',
|
|
1093
|
+
'accent': 'oklch(0.7 0.22 290)'
|
|
1013
1094
|
},
|
|
1014
1095
|
dark: {
|
|
1015
|
-
'primary': '
|
|
1016
|
-
'secondary': '
|
|
1017
|
-
'accent': '
|
|
1096
|
+
'primary': 'oklch(0.72 0.22 305)',
|
|
1097
|
+
'secondary': 'oklch(0.28 0.06 320)',
|
|
1098
|
+
'accent': 'oklch(0.78 0.2 290)'
|
|
1018
1099
|
}
|
|
1019
1100
|
}
|
|
1020
1101
|
}
|
|
@@ -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.
|
|
@@ -10,8 +10,7 @@ description: The module capitalize is a function that adds a capital letter to a
|
|
|
10
10
|
<MazInput v-model="stringValue" />
|
|
11
11
|
|
|
12
12
|
<div
|
|
13
|
-
|
|
14
|
-
class="flex flex-center rounded gap-05"
|
|
13
|
+
class="maz:flex maz:flex-center maz:rounded-md maz:gap-0.5 maz:p-4 maz:mt-16 maz:bg-surface-300"
|
|
15
14
|
>
|
|
16
15
|
formatted value: <strong>{{ stringFormatted }}</strong>
|
|
17
16
|
</div>
|
|
@@ -32,7 +31,7 @@ const stringFormatted = computed(() =>
|
|
|
32
31
|
<MazInput v-model="stringValue" />
|
|
33
32
|
|
|
34
33
|
<div
|
|
35
|
-
|
|
34
|
+
class="flex flex-center rounded-md gap-0.5 p-4 mt-16 bg-surface-300"
|
|
36
35
|
>
|
|
37
36
|
{{ stringFormatted }}
|
|
38
37
|
</div>
|