@maz-ui/nuxt 5.0.0-beta.3 → 5.0.0-beta.31

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 CHANGED
@@ -182,6 +182,13 @@ export default defineNuxtConfig({
182
182
  autoImport: true, // Auto-import all components globally
183
183
  },
184
184
 
185
+ // Global component defaults (instance prop > defaults[Component] > defaults.global > library default)
186
+ defaults: {
187
+ global: { roundedSize: 'lg' }, // cross-cutting (roundedSize, size)
188
+ MazBtn: { roundedSize: 'full' }, // per-component, wins over global
189
+ MazCard: { bordered: false, elevation: true },
190
+ },
191
+
185
192
  // Composables (customize what you need)
186
193
  composables: {
187
194
  useTheme: true,
@@ -264,7 +271,7 @@ This module is built specifically for Nuxt with perfect SSR and SSG support:
264
271
 
265
272
  ## Learn More
266
273
 
267
- - **[Full Documentation](https://maz-ui.com/guide/nuxt)**
274
+ - **[Full Documentation](https://maz-ui.com/ecosystem/nuxt)**
268
275
  - **[Report Issues](https://github.com/LouisMazel/maz-ui/issues)**
269
276
  - **[Discussions](https://github.com/LouisMazel/maz-ui/discussions)**
270
277
 
package/dist/module.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { MazUiThemeOptions, ThemePreset, ThemePresetName } from '@maz-ui/themes';
3
3
  import { MazUiTranslationsOptions } from '@maz-ui/translations';
4
+ import { MazUiDefaultsOptions } from 'maz-ui/composables/useGlobalConfig';
4
5
  import { VLazyImgOptions, VFullscreenImgOptions, VTooltipOptions } from 'maz-ui/directives';
5
6
  import { AosOptions, DialogOptions, ToastOptions } from 'maz-ui/plugins';
6
7
 
@@ -55,6 +56,19 @@ interface MazUiNuxtOptions {
55
56
  * }
56
57
  */
57
58
  translations?: MazUiTranslationsOptions;
59
+ /**
60
+ * Global default prop values for components
61
+ * @description Set default prop values once for every component, with the priority:
62
+ * instance prop > `defaults[Component]` > `defaults.global` > library default.
63
+ * A global default never wins over a prop set on the component instance.
64
+ * @default {}
65
+ * @example {
66
+ * global: { roundedSize: 'lg' },
67
+ * MazBtn: { roundedSize: 'full' },
68
+ * MazCard: { bordered: false, elevation: true },
69
+ * }
70
+ */
71
+ defaults?: MazUiDefaultsOptions;
58
72
  /**
59
73
  * CSS and styles configuration
60
74
  */
package/dist/module.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "5.0.0-beta.3",
7
+ "version": "5.0.0-beta.31",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
- "unbuild": "3.6.1"
10
+ "unbuild": "unknown"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -25,6 +25,7 @@ const COMPONENT_NAMES = {
25
25
  MazChecklist: true,
26
26
  MazContainer: true,
27
27
  MazCircularProgressBar: true,
28
+ MazCodeHighlight: true,
28
29
  MazDialog: true,
29
30
  MazDialogConfirm: true,
30
31
  MazDrawer: true,
@@ -43,6 +44,7 @@ const COMPONENT_NAMES = {
43
44
  MazLazyImg: true,
44
45
  MazLink: true,
45
46
  MazLoadingBar: true,
47
+ MazMarkdownEditor: true,
46
48
  MazPagination: true,
47
49
  MazDatePicker: true,
48
50
  MazPullToRefresh: true,
@@ -57,6 +59,17 @@ const COMPONENT_NAMES = {
57
59
  MazSpinner: true,
58
60
  MazStepper: true,
59
61
  MazSwitch: true,
62
+ MazSidebar: true,
63
+ MazSidebarMenu: true,
64
+ MazSidebarMenuItem: true,
65
+ MazSidebarMenuSub: true,
66
+ MazSidebarFooter: true,
67
+ MazSidebarHeader: true,
68
+ MazSidebarContent: true,
69
+ MazSidebarGroup: true,
70
+ MazSidebarMenuButton: true,
71
+ MazSidebarSeparator: true,
72
+ MazSidebarTrigger: true,
60
73
  MazTable: true,
61
74
  MazTableCell: true,
62
75
  MazTableRow: true,
@@ -69,6 +82,7 @@ const COMPONENT_NAMES = {
69
82
  MazTimeline: true,
70
83
  MazTextarea: true,
71
84
  MazUiProvider: true,
85
+ MazWindowMockup: true,
72
86
  MazPopover: true
73
87
  };
74
88
  const _dirname = dirname(fileURLToPath(import.meta.url));
@@ -93,7 +107,8 @@ const mazUiComposables = {
93
107
  useInstanceUniqId: true,
94
108
  useMountComponent: true,
95
109
  useSwipe: true,
96
- useMutationObserver: true
110
+ useMutationObserver: true,
111
+ useSidebar: true
97
112
  };
98
113
  const defaults = {
99
114
  general: {
@@ -116,6 +131,7 @@ const defaults = {
116
131
  fallbackLocale: "en",
117
132
  preloadFallback: true
118
133
  },
134
+ defaults: {},
119
135
  components: {
120
136
  autoImport: true
121
137
  },
@@ -173,6 +189,9 @@ const module$1 = defineNuxtModule({
173
189
  addPlugin(resolve(_dirname, "./runtime/plugins/theme"));
174
190
  addPlugin(resolve(_dirname, "./runtime/plugins/translations"));
175
191
  addPlugin(resolve(_dirname, "./runtime/plugins/maz-link-component"));
192
+ if (Object.keys(moduleOptions.defaults).length > 0) {
193
+ addPlugin(resolve(_dirname, "./runtime/plugins/defaults"));
194
+ }
176
195
  if (moduleOptions.components.autoImport) {
177
196
  for (const name of Object.keys(COMPONENT_NAMES)) {
178
197
  addComponent({
@@ -0,0 +1,2 @@
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { GLOBAL_CONFIG_INJECTION_KEY } from "maz-ui/composables/useGlobalConfig";
2
+ import { defineNuxtPlugin } from "nuxt/app";
3
+ export default defineNuxtPlugin(({ vueApp, $config }) => {
4
+ const defaults = $config.public.mazUi?.defaults;
5
+ if (defaults && Object.keys(defaults).length > 0) {
6
+ vueApp.provide(GLOBAL_CONFIG_INJECTION_KEY, defaults);
7
+ }
8
+ });
@@ -1,5 +1,5 @@
1
1
  import { MazUiTheme } from "@maz-ui/themes/plugin";
2
- import { CSS_ID, generateCSS, getPreset, mergePresets } from "@maz-ui/themes/utils";
2
+ import { CSS_ID, generateCSS, getPreset, mergePresets, resolveColorSchemeContent } from "@maz-ui/themes/utils";
3
3
  import { getSystemColorMode } from "@maz-ui/themes/utils/get-color-mode";
4
4
  import { defineNuxtPlugin, useCookie, useHead, useRequestHeaders } from "nuxt/app";
5
5
  function getSavedColorMode() {
@@ -50,7 +50,8 @@ function injectThemeCSS(config) {
50
50
  mode: config.mode,
51
51
  darkSelectorStrategy: config.darkModeStrategy,
52
52
  prefix: "maz",
53
- darkClass: config.darkClass
53
+ darkClass: config.darkClass,
54
+ lightClass: config.lightClass
54
55
  });
55
56
  useHead({
56
57
  style: [{
@@ -95,6 +96,7 @@ export default defineNuxtPlugin(async ({ vueApp, $config }) => {
95
96
  const config = {
96
97
  strategy: "runtime",
97
98
  darkClass: "dark",
99
+ lightClass: "light",
98
100
  darkModeStrategy: "class",
99
101
  mode: "both",
100
102
  overrides: {},
@@ -104,15 +106,22 @@ export default defineNuxtPlugin(async ({ vueApp, $config }) => {
104
106
  preset
105
107
  };
106
108
  const isDark = config.colorMode === "auto" && config.mode === "both" ? getInitialColorMode() === "dark" : config.colorMode === "dark" || config.mode === "dark";
107
- if (isDark && config.darkModeStrategy === "class") {
108
- useHead({
109
- htmlAttrs: {
110
- class: config.darkClass
111
- }
112
- });
113
- }
114
109
  if (import.meta.server) {
110
+ if (isDark && config.darkModeStrategy === "class") {
111
+ useHead({
112
+ htmlAttrs: {
113
+ class: config.darkClass
114
+ }
115
+ });
116
+ }
115
117
  injectThemeCSS(config);
118
+ useHead({
119
+ meta: [{
120
+ name: "color-scheme",
121
+ content: resolveColorSchemeContent(config.mode, config.colorMode),
122
+ id: "maz-color-scheme"
123
+ }]
124
+ });
116
125
  if (config.colorMode === "auto" && config.mode === "both" && config.darkModeStrategy === "class") {
117
126
  useHead({
118
127
  script: [{ innerHTML: getColorModeBlockingScript(config), tagPosition: "head", id: "maz-color-mode-blocking" }],
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@maz-ui/nuxt",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.3",
4
+ "version": "5.0.0-beta.31",
5
5
  "description": "Nuxt module for Maz-UI",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",
8
- "homepage": "https://maz-ui.com/guide/nuxt",
8
+ "homepage": "https://maz-ui.com/ecosystem/nuxt",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/LouisMazel/maz-ui.git"
@@ -33,7 +33,8 @@
33
33
  "exports": {
34
34
  ".": {
35
35
  "types": "./dist/types.d.mts",
36
- "import": "./dist/module.mjs"
36
+ "import": "./dist/module.mjs",
37
+ "default": "./dist/module.mjs"
37
38
  }
38
39
  },
39
40
  "main": "./dist/module.mjs",
@@ -48,19 +49,20 @@
48
49
  },
49
50
  "dependencies": {
50
51
  "@nuxt/devtools-kit": "^3.2.3",
51
- "@nuxt/kit": "^4.4.4",
52
+ "@nuxt/kit": "^4.4.8",
52
53
  "defu": "^6.1.7",
53
- "maz-ui": "5.0.0-beta.3",
54
- "@maz-ui/translations": "5.0.0-beta.3",
55
- "@maz-ui/utils": "5.0.0-beta.3",
56
- "@maz-ui/themes": "5.0.0-beta.3"
54
+ "@maz-ui/translations": "5.0.0-beta.28",
55
+ "maz-ui": "5.0.0-beta.31",
56
+ "@maz-ui/utils": "5.0.0-beta.28",
57
+ "@maz-ui/themes": "5.0.0-beta.28"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@nuxt/devtools": "^3.2.3",
60
61
  "@nuxt/module-builder": "^1.0.2",
61
- "@nuxt/schema": "^4.4.4",
62
+ "@nuxt/schema": "^4.4.8",
62
63
  "@nuxt/test-utils": "^4.0.3",
63
- "nuxt": "^4.4.4"
64
+ "nuxt": "^4.4.8",
65
+ "@maz-ui/eslint-config": "5.0.0-beta.28"
64
66
  },
65
67
  "lint-staged": {
66
68
  "*.{js,ts,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"