m3ui-mcp 0.3.0 → 0.4.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 +22 -3
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/data/components.json +5716 -3529
- package/data/examples.json +307 -207
- package/data/guidelines.json +202 -202
- package/data/icons.json +2224 -2224
- package/data/locale.json +367 -5
- package/data/manifest.json +26 -26
- package/data/nuxt.json +93 -93
- package/data/recipes.json +437 -338
- package/data/search-index.json +577 -0
- package/data/specs.json +89 -89
- package/data/types.json +168 -1
- package/data/values.json +2442 -1587
- package/dist/categories.js +1 -0
- package/dist/dynamic-slots.js +2 -2
- package/dist/tools/check-template.js +7 -1
- package/package.json +5 -3
package/data/nuxt.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"module": {
|
|
4
4
|
"name": "@m3ui-vue/nuxt",
|
|
5
|
-
"version": "0.8.
|
|
5
|
+
"version": "0.8.2",
|
|
6
6
|
"configKey": "m3ui"
|
|
7
7
|
},
|
|
8
8
|
"options": [
|
|
@@ -398,11 +398,11 @@
|
|
|
398
398
|
"sources": [
|
|
399
399
|
{
|
|
400
400
|
"ref": "pkg:src/composables/_useItemLink.ts:12-18",
|
|
401
|
-
"url": "https://github.com/
|
|
401
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/_useItemLink.ts#L12-L18"
|
|
402
402
|
},
|
|
403
403
|
{
|
|
404
404
|
"ref": "pkg:src/components/MPageProgress.vue:34-44",
|
|
405
|
-
"url": "https://github.com/
|
|
405
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/components/MPageProgress.vue#L34-L44"
|
|
406
406
|
},
|
|
407
407
|
{
|
|
408
408
|
"ref": "nuxt:dist/runtime/plugin.js:15-19",
|
|
@@ -438,10 +438,10 @@
|
|
|
438
438
|
"composables"
|
|
439
439
|
],
|
|
440
440
|
"sections": {
|
|
441
|
-
"summary": "Components are registered globally by their library name (`<MButton>`, `<MDataTable>`) and each one is bundled only where it is used. Composables are registered with a prefix so they cannot clash with other modules: `useTheme` becomes `useM3Theme`. The module reads the list from the library's own `dist/api.json`, so a library update adds new components and composables without a module update (source: nuxt:dist/module.mjs:44-72; nuxt:README.md:55-96; nuxtrepo@
|
|
442
|
-
"details": "### Components\n\nEvery entry of `components` in `api.json` is registered with `addComponent({ name, export: name, filePath: entry })`, where `entry` is the package or subpath the component comes from (source: nuxt:dist/module.mjs:60-63). In library 1.10.2 that is 240 components: 200 from the main entry and 40 from subpaths (source: pkg:dist/api.json).\n\nEntry points whose underlying package is optional are registered only when that package resolves from the app, otherwise the tag is an unknown component instead of a failing import (source: nuxt:dist/module.mjs:5-18; nuxtrepo@
|
|
441
|
+
"summary": "Components are registered globally by their library name (`<MButton>`, `<MDataTable>`) and each one is bundled only where it is used. Composables are registered with a prefix so they cannot clash with other modules: `useTheme` becomes `useM3Theme`. The module reads the list from the library's own `dist/api.json`, so a library update adds new components and composables without a module update (source: nuxt:dist/module.mjs:44-72; nuxt:README.md:55-96; nuxtrepo@3a11195:CHANGELOG.md:47-52).",
|
|
442
|
+
"details": "### Components\n\nEvery entry of `components` in `api.json` is registered with `addComponent({ name, export: name, filePath: entry })`, where `entry` is the package or subpath the component comes from (source: nuxt:dist/module.mjs:60-63). In library 1.10.2 that is 240 components: 200 from the main entry and 40 from subpaths (source: pkg:dist/api.json).\n\nEntry points whose underlying package is optional are registered only when that package resolves from the app, otherwise the tag is an unknown component instead of a failing import (source: nuxt:dist/module.mjs:5-18; nuxtrepo@3a11195:CHANGELOG.md:54-57):\n\n| Entry point | Peer package | Components |\n|---|---|---|\n| `/chart` | `chart.js` | `MChart` |\n| `/code-editor` | `codemirror` | `MCodeEditor`, `MJsonEditor` |\n| `/markdown` | `markdown-it` | `MMarkdown` |\n| `/rich-text-editor` | `@tiptap/vue-3` | `MRichTextEditor` |\n| `/terminal` | `@xterm/xterm` | `MTerminal` |\n| `/qrcode` | `qrcode-generator` | `MQRCode` |\n| `/barcode` | `jsbarcode` | `MBarcode` |\n| `/map` | `maplibre-gl` | `MMap` and the other 16 map components |\n| `/pdf` | `pdfjs-dist` | `MPdfViewer` |\n| `/pdf-sign` | `pdf-lib` | `MPdfSigner` (also loads `pdfjs-dist`, which the module does not check) |\n\nThe subpaths `/media`, `/flow`, `/gantt` and `/draw` have no peer package and are always registered. The module checks only the main package of each entry, while the library declares more optional peers: `MChart` also loads `vue-chartjs`, the rich text editor several `@tiptap/*` extensions, the code editor several `@codemirror/*` packages and the terminal `@xterm/addon-fit` (source: pkg:package.json:127-225; pkg:src/components/MChart.vue:103-106; docs@a6729cf:src/examples/dashboard/README.md:25-27). With only the main package installed the component is registered, and the missing import fails when the component loads (inferred from source: pkg:src/components/MChart.vue:103-106).\n\n### Composables\n\nOnly values whose name matches `use` plus a capital letter are registered, as `use` + prefix + the rest of the name; the default prefix is `M3` (source: nuxt:dist/module.mjs:65-72). In library 1.11.0 that is 31 composables (`useM3Confirm` is new):\n\n| Entry point | Auto-imported as |\n|---|---|\n| main | `useM3Theme`, `useM3ColorPalette`, `useM3Undo`, `useM3Confetti`, `useM3Fireworks`, `useM3Reactions`, `useM3ContainerTransform`, `useM3Toast`, `useM3Confirm`, `useM3FieldBg`, `useM3Locale`, `useM3Device`, `useM3AutoGrow`, `useM3ThemeTokens`, `useM3ScrollReveal`, `useM3WindowSizeClass`, `useM3Notification`, `useM3Debounce`, `useM3PageProgress`, `useM3Spring`, `useM3FloorPlan` |\n| `/map` (needs `maplibre-gl`) | `useM3Map`, `useM3MapLayers`, `useM3MapFilter` |\n| `/pdf` (needs `pdfjs-dist`) | `useM3Pdf` |\n| `/media` | `useM3MediaPlayer` |\n| `/flow` | `useM3Flow`, `useM3FlowNode` |\n| `/gantt` | `useM3Gantt`, `useM3ResourceTimeline` |\n| `/draw` | `useM3Drawing` |\n\n(source: pkg:dist/api.json; nuxt:README.md:73-94; nuxtrepo@3a11195:CHANGELOG.md:34)\n\n### What is not auto-imported\n\nThe other 141 non-directive, non-`use*` values (functions and constants such as `palettes`, `generateScheme`, `seedFromImage`, `motionSprings`, `fireConfetti`, `luhnCheck`, `formatPhone`, `toDrawSvg`, `createM3UI`, `themeInitScript`) and every type must be imported from `@m3ui-vue/m3ui-vue` or its subpath as usual (source: nuxt:README.md:96; nuxt:dist/module.mjs:68-69).\n\nThe eleven directives (`v-ripple`, `v-tooltip`, `v-reveal`, `v-state-layer`, `v-focus-ring`, `v-scroll-elevation`, `v-long-press`, `v-swipe`, `v-click-outside`, `v-skeleton`, `v-sparkle`) are not imports at all: the plugin registers them globally on the Vue app, so they work in any template (source: pkg:src/plugin.ts:152-163; nuxt:dist/runtime/plugin.js:40).\n\n### Switching it off or renaming\n\n- `components: false` registers no components; import them from the package yourself.\n- `composables: false` registers no composables; import `useTheme` and the rest yourself.\n- `composables: { prefix: 'X' }` gives `useXTheme`; an object without `prefix` gives no prefix at all (`useTheme`), while `true` gives `M3`.\n\n(source: nuxt:dist/module.d.mts:31-40; nuxt:dist/module.mjs:60-71)\n\n- When local components are registered with `pathPrefix: false`, avoid naming app components with an `M` + uppercase prefix (e.g. `MButton`), or they may collide with M3UI auto-imports (inferred from source: nuxt:dist/module.mjs:62).",
|
|
443
443
|
"examples": "### Components and a composable without imports\n\n```vue\n<!-- nuxt -->\n<script setup lang=\"ts\">\nconst toast = useM3Toast()\nconst query = ref('')\n</script>\n\n<template>\n <MSearchField v-model=\"query\" />\n <MButton @click=\"toast.success('Saved')\">Save</MButton>\n</template>\n```\n\n### The same in plain Vue, with explicit imports\n\n```vue\n<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { MButton, MSearchField, useToast } from '@m3ui-vue/m3ui-vue'\n\nconst toast = useToast()\nconst query = ref('')\n</script>\n\n<template>\n <MSearchField v-model=\"query\" />\n <MButton @click=\"toast.success('Saved')\">Save</MButton>\n</template>\n```\n\n### Functions are still imported\n\n```vue\n<!-- nuxt -->\n<script setup lang=\"ts\">\nimport { palettes } from '@m3ui-vue/m3ui-vue'\n\nconst ids = palettes.map(palette => palette.id)\n</script>\n\n<template>\n <p>{{ ids.length }} palettes</p>\n</template>\n```",
|
|
444
|
-
"pitfalls": "- A tag of an optional entry (for example `MMap` or `MPdfViewer`) renders as an unknown element when its peer package is missing; install the peer, do not import the component by hand (source: nuxt:dist/module.mjs:52-58).\n- `useM3Pdf`, `useM3Map`, `useM3MapLayers` and `useM3MapFilter` exist only with their peers too (source: nuxt:dist/module.mjs:69; nuxtrepo@
|
|
444
|
+
"pitfalls": "- A tag of an optional entry (for example `MMap` or `MPdfViewer`) renders as an unknown element when its peer package is missing; install the peer, do not import the component by hand (source: nuxt:dist/module.mjs:52-58).\n- `useM3Pdf`, `useM3Map`, `useM3MapLayers` and `useM3MapFilter` exist only with their peers too (source: nuxt:dist/module.mjs:69; nuxtrepo@3a11195:CHANGELOG.md:75).\n- Do not write `useTheme()` in a Nuxt page expecting an auto-import: with the default prefix only `useM3Theme()` exists (source: nuxt:dist/module.mjs:71).\n- Auto-imports are resolved at build time from the installed library's `api.json`; after upgrading the library restart the dev server so the new names appear (inferred from source: nuxt:dist/module.mjs:44-72)."
|
|
445
445
|
},
|
|
446
446
|
"examples": [
|
|
447
447
|
{
|
|
@@ -490,23 +490,23 @@
|
|
|
490
490
|
},
|
|
491
491
|
{
|
|
492
492
|
"ref": "pkg:package.json:127-225",
|
|
493
|
-
"url": "https://github.com/
|
|
493
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/package.json#L127-L225"
|
|
494
494
|
},
|
|
495
495
|
{
|
|
496
496
|
"ref": "pkg:src/components/MChart.vue:103-106",
|
|
497
|
-
"url": "https://github.com/
|
|
497
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/components/MChart.vue#L103-L106"
|
|
498
498
|
},
|
|
499
499
|
{
|
|
500
500
|
"ref": "pkg:src/plugin.ts:152-163",
|
|
501
|
-
"url": "https://github.com/
|
|
501
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L152-L163"
|
|
502
502
|
},
|
|
503
503
|
{
|
|
504
|
-
"ref": "nuxtrepo@
|
|
505
|
-
"url": "https://github.com/
|
|
504
|
+
"ref": "nuxtrepo@3a11195:CHANGELOG.md:47-59",
|
|
505
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/CHANGELOG.md#L47-L59"
|
|
506
506
|
},
|
|
507
507
|
{
|
|
508
|
-
"ref": "docs@
|
|
509
|
-
"url": "https://github.com/
|
|
508
|
+
"ref": "docs@a6729cf:src/examples/dashboard/README.md:25-27",
|
|
509
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-docs/blob/a6729cff7fbc593f6aa7b004e353adb0e874ac86/src/examples/dashboard/README.md#L25-L27"
|
|
510
510
|
}
|
|
511
511
|
],
|
|
512
512
|
"verified": {
|
|
@@ -538,9 +538,9 @@
|
|
|
538
538
|
],
|
|
539
539
|
"sections": {
|
|
540
540
|
"summary": "With `cookies` on (the default), the library keeps the user's theme, palette, contrast level and window size in cookies in addition to `localStorage`, so the server can render with them. The module also inlines a short script in `<head>` (`themeScript`, default on) that applies dark mode, palette and contrast to `<html>` before the first paint (source: nuxt:README.md:138-160; nuxt:dist/module.d.mts:43-61).",
|
|
541
|
-
"details": "### The cookies\n\n| Cookie (no prefix) | Value | Written by |\n|---|---|---|\n| `m3-theme` | `light`, `dark` or `system` | the library, when the choice changes and once at install |\n| `m3-palette` | palette id, or the generated palette marker | the same |\n| `m3-contrast` | `standard`, `medium`, `high` or `system` | the same |\n| `m3-viewport` | `<width>x<height>` | the library, on load and (debounced 300 ms) on resize |\n\nAll are written by script with `Max-Age=31536000` (one year), `Path=/` and `SameSite=Lax`, with the value URI-encoded; none is `HttpOnly` (source: pkg:src/plugin.ts:76-81; pkg:src/composables/_ssrState.ts:52-80; pkg:src/composables/_storageKeys.ts:5-6).\n\nWhen the plugin installs in the browser it copies what `localStorage` already holds into the cookies, so users from before `cookies` get them on their next visit (source: pkg:src/plugin.ts:196-204; lib@
|
|
541
|
+
"details": "### The cookies\n\n| Cookie (no prefix) | Value | Written by |\n|---|---|---|\n| `m3-theme` | `light`, `dark` or `system` | the library, when the choice changes and once at install |\n| `m3-palette` | palette id, or the generated palette marker | the same |\n| `m3-contrast` | `standard`, `medium`, `high` or `system` | the same |\n| `m3-viewport` | `<width>x<height>` | the library, on load and (debounced 300 ms) on resize |\n\nAll are written by script with `Max-Age=31536000` (one year), `Path=/` and `SameSite=Lax`, with the value URI-encoded; none is `HttpOnly` (source: pkg:src/plugin.ts:76-81; pkg:src/composables/_ssrState.ts:52-80; pkg:src/composables/_storageKeys.ts:5-6).\n\nWhen the plugin installs in the browser it copies what `localStorage` already holds into the cookies, so users from before `cookies` get them on their next visit (source: pkg:src/plugin.ts:196-204; lib@ed784d6:CHANGELOG.md:668). A cookie with no stored value (storage cleared, or set by a server) is kept and honored by `useTheme`, `useColorPalette` and the theme script; `localStorage` still wins when it has a value (source: lib@ed784d6:CHANGELOG.md:678; nuxt:README.md:157-160).\n\nYour server may set `m3-theme`, `m3-palette` or `m3-contrast` itself, for instance to apply a theme saved in the user's account (source: nuxt:README.md:158-160).\n\n### storagePrefix\n\n`storagePrefix` is prepended to every cookie and storage key: `'shop'` gives `shop-m3-theme`, `shop-m3-palette`, `shop-m3-contrast`, `shop-m3-viewport` and the same for the library's other stored keys such as recent colors. It exists so apps on one domain under different paths keep separate settings, and the server then reads only its own prefixed cookies (source: nuxt:dist/module.d.mts:24-32; pkg:src/composables/_storageKeys.ts:8-19; nuxtrepo@3a11195:test/prefix.test.ts:12-22). The value may contain letters, digits, `-` and `_`, and needs library 1.2.2 (source: nuxt:dist/module.d.mts:24-32; nuxtrepo@3a11195:CHANGELOG.md:54-62).\n\n### The inline theme script\n\nOn the server only, the plugin adds a `<head>` script with key `m3ui-theme` and critical priority, containing the output of `themeInitScript()` (source: nuxt:dist/runtime/plugin.js:41-49). In the browser it does, before any app code (source: pkg:src/composables/themeInitScript.ts:36-54):\n\n1. read the stored theme (localStorage, then the cookie; default `system`) and toggle the `dark` class on `<html>`, using `prefers-color-scheme` for `system`;\n2. pick the palette (stored one, or the configured default; `persistPalette: false` forces the configured one), insert the cached CSS of a generated palette when it is the active one, and set `data-palette` unless it is `purple`;\n3. pick the contrast level the same way, resolve `system` to `high` with `prefers-contrast: more`, and set `data-contrast` unless it is `standard`.\n\nThe module hands it only `palette`, `contrast`, `persistPalette` and `storagePrefix`. It does not pass `seed`, `seedOptions` or `themeColor`: a generated palette from `seed` appears after the app loads on a first visit, and `themeColor` is synchronized by the library in the browser (source: nuxt:dist/runtime/plugin.js:45; pkg:src/plugin.ts:183-195; pkg:src/composables/themeInitScript.ts:15-26).\n\nStorage access in the script is wrapped in try/catch, so blocked site data does not break the page (source: pkg:src/composables/themeInitScript.ts:36-40).",
|
|
542
542
|
"examples": "### Turning the pieces on or off\n\n```ts\n// nuxt.config.ts\nexport default defineNuxtConfig({\n modules: ['@m3ui-vue/nuxt'],\n m3ui: {\n palette: 'green',\n storagePrefix: 'admin', // cookies: admin-m3-theme, admin-m3-palette, …\n cookies: true, // default\n themeScript: true // default: inline script in <head>\n }\n})\n```\n\n### A server route that applies the account's theme\n\n```ts\n// server/middleware/theme.ts\nexport default defineEventHandler((event) => {\n const saved: { theme?: string } = { theme: 'dark' } // from your own session or database\n if (saved.theme && !getCookie(event, 'admin-m3-theme')) {\n setCookie(event, 'admin-m3-theme', saved.theme, { maxAge: 31536000, path: '/', sameSite: 'lax' })\n }\n})\n```\n\nThe cookie name in this example uses the example's prefix (inferred from source: nuxt:README.md:158-160).",
|
|
543
|
-
"pitfalls": "- With a strict content security policy the inline script needs a nonce, a hash, or `themeScript: false` (inferred from source: nuxt:dist/runtime/plugin.js:41-49).\n- Changing `storagePrefix` later resets every user's theme, palette and contrast, because the old keys are no longer read (inferred from source: pkg:src/composables/_storageKeys.ts:17-19).\n- Two apps on the same origin without a prefix share cookies and `localStorage`, and the server of one reads the other's choice (source: nuxt:dist/module.d.mts:24-32; nuxtrepo@
|
|
543
|
+
"pitfalls": "- With a strict content security policy the inline script needs a nonce, a hash, or `themeScript: false` (inferred from source: nuxt:dist/runtime/plugin.js:41-49).\n- Changing `storagePrefix` later resets every user's theme, palette and contrast, because the old keys are no longer read (inferred from source: pkg:src/composables/_storageKeys.ts:17-19).\n- Two apps on the same origin without a prefix share cookies and `localStorage`, and the server of one reads the other's choice (source: nuxt:dist/module.d.mts:24-32; nuxtrepo@3a11195:test/prefix.test.ts:12-16).\n- The viewport cookie changes on every resize, so a cache keyed on cookies would fragment; keep it out of any cache key (inferred from source: pkg:src/composables/_ssrState.ts:52-65).\n- The first visit of a user with a `seed` configured shows the baseline palette until the app loads; use a named `palette` when that flash matters (source: pkg:src/composables/themeInitScript.ts:15-26).\n- These cookies hold interface preferences and a window size only; no personal data is stored by the library (source: pkg:src/composables/_ssrState.ts:43-80)."
|
|
544
544
|
},
|
|
545
545
|
"examples": [
|
|
546
546
|
{
|
|
@@ -575,35 +575,35 @@
|
|
|
575
575
|
},
|
|
576
576
|
{
|
|
577
577
|
"ref": "pkg:src/plugin.ts:76-124",
|
|
578
|
-
"url": "https://github.com/
|
|
578
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L76-L124"
|
|
579
579
|
},
|
|
580
580
|
{
|
|
581
581
|
"ref": "pkg:src/plugin.ts:170-205",
|
|
582
|
-
"url": "https://github.com/
|
|
582
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L170-L205"
|
|
583
583
|
},
|
|
584
584
|
{
|
|
585
585
|
"ref": "pkg:src/composables/_ssrState.ts:43-80",
|
|
586
|
-
"url": "https://github.com/
|
|
586
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/_ssrState.ts#L43-L80"
|
|
587
587
|
},
|
|
588
588
|
{
|
|
589
589
|
"ref": "pkg:src/composables/_storageKeys.ts:1-34",
|
|
590
|
-
"url": "https://github.com/
|
|
590
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/_storageKeys.ts#L1-L34"
|
|
591
591
|
},
|
|
592
592
|
{
|
|
593
593
|
"ref": "pkg:src/composables/themeInitScript.ts:15-54",
|
|
594
|
-
"url": "https://github.com/
|
|
594
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/themeInitScript.ts#L15-L54"
|
|
595
595
|
},
|
|
596
596
|
{
|
|
597
|
-
"ref": "lib@
|
|
598
|
-
"url": "https://github.com/
|
|
597
|
+
"ref": "lib@ed784d6:CHANGELOG.md:668-678",
|
|
598
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/CHANGELOG.md#L668-L678"
|
|
599
599
|
},
|
|
600
600
|
{
|
|
601
|
-
"ref": "nuxtrepo@
|
|
602
|
-
"url": "https://github.com/
|
|
601
|
+
"ref": "nuxtrepo@3a11195:test/prefix.test.ts:5-31",
|
|
602
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/test/prefix.test.ts#L5-L31"
|
|
603
603
|
},
|
|
604
604
|
{
|
|
605
|
-
"ref": "nuxtrepo@
|
|
606
|
-
"url": "https://github.com/
|
|
605
|
+
"ref": "nuxtrepo@3a11195:CHANGELOG.md:54-62",
|
|
606
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/CHANGELOG.md#L54-L62"
|
|
607
607
|
}
|
|
608
608
|
],
|
|
609
609
|
"verified": {
|
|
@@ -670,15 +670,15 @@
|
|
|
670
670
|
"sources": [
|
|
671
671
|
{
|
|
672
672
|
"ref": "pkg:README.md:33-91",
|
|
673
|
-
"url": "https://github.com/
|
|
673
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/README.md#L33-L91"
|
|
674
674
|
},
|
|
675
675
|
{
|
|
676
676
|
"ref": "pkg:src/styles/theme.css:17-18",
|
|
677
|
-
"url": "https://github.com/
|
|
677
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/styles/theme.css#L17-L18"
|
|
678
678
|
},
|
|
679
679
|
{
|
|
680
680
|
"ref": "pkg:src/styles/theme.css:375-389",
|
|
681
|
-
"url": "https://github.com/
|
|
681
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/styles/theme.css#L375-L389"
|
|
682
682
|
},
|
|
683
683
|
{
|
|
684
684
|
"ref": "nuxt:README.md:52-53",
|
|
@@ -712,10 +712,10 @@
|
|
|
712
712
|
"locale"
|
|
713
713
|
],
|
|
714
714
|
"sections": {
|
|
715
|
-
"summary": "Some components carry text of their own (a pagination \"Next page\", pickers, dialogs, search placeholders, heatmap legends). The module's `locale` option decides which language that text uses. It does not translate your own labels. The library ships presets for Spanish, French, Portuguese, German, Japanese, Chinese, Korean, Arabic and, since library 1.11.0 and module 0.8.0, Polish (`'pl'`, with plural forms); English is built in (source: nuxt:dist/module.d.mts:4-16; nuxt:dist/module.mjs:6; nuxtrepo@
|
|
716
|
-
"details": "### The four forms of `locale`\n\n| Value | Result |\n|---|---|\n| omitted or `'en'` | The built-in English. |\n| `'es'`, `'fr'`, `'pt'`, `'de'`, `'ja'`, `'zh'`, `'ko'`, `'ar'`, `'pl'` | That preset, imported from `@m3ui-vue/m3ui-vue/locales` (`esLocale`, `frLocale`, …). An unknown code logs a warning and uses English. |\n| An object of your own strings (`Partial<M3Locale>`) | Your strings override English key by key. |\n| `'auto'` | Follow `@nuxtjs/i18n`'s current language, on the server and when the user switches it. |\n\n(source: nuxt:dist/module.d.mts:18-23; nuxt:dist/module.mjs:90-92; nuxt:README.md:105)\n\n### How `'auto'` resolves a language\n\nThe plugin computes the strings from the i18n instance on every access: it takes the current locale's language tag (`localeProperties.value.language`, else the locale code), lower-cases it, keeps the part before the first `-`, and looks it up in the presets. Anything not found gives an empty object, which means English (source: nuxt:dist/runtime/plugin.js:35-39). So `es-AR` selects the Spanish preset and `pl-PL` the Polish one (since 0.8.0); a language without a preset shows English (source: nuxtrepo@
|
|
715
|
+
"summary": "Some components carry text of their own (a pagination \"Next page\", pickers, dialogs, search placeholders, heatmap legends). The module's `locale` option decides which language that text uses. It does not translate your own labels. The library ships presets for Spanish, French, Portuguese, German, Japanese, Chinese, Korean, Arabic and, since library 1.11.0 and module 0.8.0, Polish (`'pl'`, with plural forms); English is built in (source: nuxt:dist/module.d.mts:4-16; nuxt:dist/module.mjs:6; nuxtrepo@3a11195:CHANGELOG.md:21-25).",
|
|
716
|
+
"details": "### The four forms of `locale`\n\n| Value | Result |\n|---|---|\n| omitted or `'en'` | The built-in English. |\n| `'es'`, `'fr'`, `'pt'`, `'de'`, `'ja'`, `'zh'`, `'ko'`, `'ar'`, `'pl'` | That preset, imported from `@m3ui-vue/m3ui-vue/locales` (`esLocale`, `frLocale`, …). An unknown code logs a warning and uses English. |\n| An object of your own strings (`Partial<M3Locale>`) | Your strings override English key by key. |\n| `'auto'` | Follow `@nuxtjs/i18n`'s current language, on the server and when the user switches it. |\n\n(source: nuxt:dist/module.d.mts:18-23; nuxt:dist/module.mjs:90-92; nuxt:README.md:105)\n\n### How `'auto'` resolves a language\n\nThe plugin computes the strings from the i18n instance on every access: it takes the current locale's language tag (`localeProperties.value.language`, else the locale code), lower-cases it, keeps the part before the first `-`, and looks it up in the presets. Anything not found gives an empty object, which means English (source: nuxt:dist/runtime/plugin.js:35-39). So `es-AR` selects the Spanish preset and `pl-PL` the Polish one (since 0.8.0); a language without a preset shows English (source: nuxtrepo@3a11195:test/i18n.test.ts:15-17; nuxt:dist/module.d.mts:5-15).\n\nWith `'auto'` all nine presets (`es`, `fr`, `pt`, `de`, `ja`, `zh`, `ko`, `ar`, `pl`) are bundled (the README still quotes about 11 kB gzipped for the seven that existed before `ar`), because the language can change at any time. If `@nuxtjs/i18n` is not installed the module warns and uses English (source: nuxt:README.md:136; nuxt:dist/module.mjs:93-97).\n\n### How the strings are applied\n\nThe library builds the locale object in `useLocale()` by assigning its English defaults first and then the provided object, so a partial object only overrides what it lists and the rest stays English (source: pkg:src/composables/useLocale.ts:1333-1340). The configured locale is also stored for components that mount outside the app: toasts and notifications create their host with an app of their own, where the plugin's provide does not reach (source: pkg:src/composables/useLocale.ts:1320-1331).\n\nThe `lang` key of the object is a BCP-47 tag used by components that format with `Intl`, such as `MRelativeTime`, so a custom locale should set it (source: pkg:src/composables/useLocale.ts:3-5) (inferred from source: pkg:src/components/MRelativeTime.vue:21).\n\nA locale object given in `nuxt.config.ts` is serialized with `JSON.stringify` into a generated file, so it must be plain data (source: nuxt:dist/module.mjs:103).\n\n### Polish\n\n`m3ui: { locale: 'pl' }` gives the complete Polish preset, `plLocale`, with plural forms resolved by `formatMessage` (source: nuxt:dist/module.d.mts:14; pkg:src/locales/pl.ts:1-6). An object of your own still works and is the way to change single strings (untouched keys fall back to English, not to Polish, so copy the preset's values you need); if the file is imported by `nuxt.config.ts`, avoid importing from `@m3ui-vue/m3ui-vue` there so it loads before the app builds.\n\n### Switching the language while the app runs\n\nOnly through `'auto'`: a preset code or an object is fixed at build time, and the injection key the components read is not exported. Since 0.8.0 `'auto'` covers Polish too, so a Polish and English app with `@nuxtjs/i18n` switches both (source: nuxt:dist/runtime/plugin.js:35-40; pkg:src/composables/useLocale.ts:1852).",
|
|
717
717
|
"examples": "### The Polish preset\n\n```ts\n// nuxt.config.ts\nexport default defineNuxtConfig({\n modules: ['@m3ui-vue/nuxt'],\n m3ui: { locale: 'pl' }\n})\n```\n\n### Following @nuxtjs/i18n\n\n```ts\nexport default defineNuxtConfig({\n modules: ['@m3ui-vue/nuxt', '@nuxtjs/i18n'],\n i18n: {\n locales: [{ code: 'en', language: 'en-US' }, { code: 'pl', language: 'pl-PL' }],\n defaultLocale: 'en'\n },\n m3ui: { locale: 'auto' }\n})\n```\n\n(source: nuxt:README.md:125-134)",
|
|
718
|
-
"pitfalls": "- `'auto'` and a custom object are alternatives; you cannot combine your own changed strings with automatic switching through the module option (inferred from source: nuxt:dist/runtime/plugin.js:35-40).\n- A language without a preset silently shows English under `'auto'` (source: nuxt:dist/runtime/plugin.js:38).\n- Placeholders such as `{count}` or `{used}` inside a string must be kept in a translation; the library replaces them (source: pkg:src/composables/useLocale.ts:
|
|
718
|
+
"pitfalls": "- `'auto'` and a custom object are alternatives; you cannot combine your own changed strings with automatic switching through the module option (inferred from source: nuxt:dist/runtime/plugin.js:35-40).\n- A language without a preset silently shows English under `'auto'` (source: nuxt:dist/runtime/plugin.js:38).\n- Placeholders such as `{count}` or `{used}` inside a string must be kept in a translation; the library replaces them (source: pkg:src/composables/useLocale.ts:62; pkg:src/composables/useLocale.ts:271; pkg:src/composables/useLocale.ts:707).\n- New library versions add keys (775 in 1.11.0); an old custom object keeps working but the new strings appear in English until added (source: pkg:src/composables/useLocale.ts:1333-1340).\n- `locale: 'ar'` does not make the page right-to-left. Set `dir: 'rtl'` in the module options (or `app.head.htmlAttrs.dir`) so the server renders the right direction; with `'auto'` the direction does not follow an i18n language switch, so set it from your own code when the language changes (source: pkg:src/locales/ar.ts:4-6; nuxt:dist/module.mjs:38-43)."
|
|
719
719
|
},
|
|
720
720
|
"examples": [
|
|
721
721
|
{
|
|
@@ -753,56 +753,56 @@
|
|
|
753
753
|
"url": "node_modules/@m3ui-vue/nuxt/README.md"
|
|
754
754
|
},
|
|
755
755
|
{
|
|
756
|
-
"ref": "pkg:src/composables/useLocale.ts:
|
|
757
|
-
"url": "https://github.com/
|
|
756
|
+
"ref": "pkg:src/composables/useLocale.ts:1318-1340",
|
|
757
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useLocale.ts#L1318-L1340"
|
|
758
758
|
},
|
|
759
759
|
{
|
|
760
760
|
"ref": "pkg:src/composables/useLocale.ts:3-5",
|
|
761
|
-
"url": "https://github.com/
|
|
761
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useLocale.ts#L3-L5"
|
|
762
762
|
},
|
|
763
763
|
{
|
|
764
|
-
"ref": "pkg:src/composables/useLocale.ts:
|
|
765
|
-
"url": "https://github.com/
|
|
764
|
+
"ref": "pkg:src/composables/useLocale.ts:62",
|
|
765
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useLocale.ts#L62"
|
|
766
766
|
},
|
|
767
767
|
{
|
|
768
|
-
"ref": "pkg:src/composables/useLocale.ts:
|
|
769
|
-
"url": "https://github.com/
|
|
768
|
+
"ref": "pkg:src/composables/useLocale.ts:271",
|
|
769
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useLocale.ts#L271"
|
|
770
770
|
},
|
|
771
771
|
{
|
|
772
|
-
"ref": "pkg:src/composables/useLocale.ts:
|
|
773
|
-
"url": "https://github.com/
|
|
772
|
+
"ref": "pkg:src/composables/useLocale.ts:707",
|
|
773
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useLocale.ts#L707"
|
|
774
774
|
},
|
|
775
775
|
{
|
|
776
776
|
"ref": "pkg:src/components/MRelativeTime.vue:21",
|
|
777
|
-
"url": "https://github.com/
|
|
777
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/components/MRelativeTime.vue#L21"
|
|
778
778
|
},
|
|
779
779
|
{
|
|
780
|
-
"ref": "nuxtrepo@
|
|
781
|
-
"url": "https://github.com/
|
|
780
|
+
"ref": "nuxtrepo@3a11195:test/i18n.test.ts:5-18",
|
|
781
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/test/i18n.test.ts#L5-L18"
|
|
782
782
|
},
|
|
783
783
|
{
|
|
784
|
-
"ref": "nuxtrepo@
|
|
785
|
-
"url": "https://github.com/
|
|
784
|
+
"ref": "nuxtrepo@3a11195:CHANGELOG.md:77-84",
|
|
785
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/CHANGELOG.md#L77-L84"
|
|
786
786
|
},
|
|
787
787
|
{
|
|
788
|
-
"ref": "issue:
|
|
789
|
-
"url": "https://github.com/
|
|
788
|
+
"ref": "issue:m3ui-vue/m3ui-vue#1",
|
|
789
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/issues/1"
|
|
790
790
|
},
|
|
791
791
|
{
|
|
792
792
|
"ref": "pkg:src/locales/ar.ts:4-6",
|
|
793
|
-
"url": "https://github.com/
|
|
793
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/locales/ar.ts#L4-L6"
|
|
794
794
|
},
|
|
795
795
|
{
|
|
796
796
|
"ref": "pkg:src/locales/pl.ts:1-6",
|
|
797
|
-
"url": "https://github.com/
|
|
797
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/locales/pl.ts#L1-L6"
|
|
798
798
|
},
|
|
799
799
|
{
|
|
800
|
-
"ref": "nuxtrepo@
|
|
801
|
-
"url": "https://github.com/
|
|
800
|
+
"ref": "nuxtrepo@3a11195:CHANGELOG.md:21-25",
|
|
801
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/CHANGELOG.md#L21-L25"
|
|
802
802
|
},
|
|
803
803
|
{
|
|
804
|
-
"ref": "pkg:src/composables/useLocale.ts:
|
|
805
|
-
"url": "https://github.com/
|
|
804
|
+
"ref": "pkg:src/composables/useLocale.ts:1852",
|
|
805
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useLocale.ts#L1852"
|
|
806
806
|
}
|
|
807
807
|
],
|
|
808
808
|
"verified": {
|
|
@@ -843,7 +843,7 @@
|
|
|
843
843
|
],
|
|
844
844
|
"sections": {
|
|
845
845
|
"summary": "`@m3ui-vue/nuxt` is configured under the `m3ui` key of `nuxt.config.ts` (source: nuxt:dist/module.mjs:19-24). Its type, `ModuleOptions`, is the library's `M3UIOptions` without `locale`, plus the module's own switches (source: nuxt:dist/module.d.mts:17-89). The module needs `@m3ui-vue/m3ui-vue` installed next to it and declares Nuxt `>=3.0.0` (source: nuxt:dist/module.mjs:19-24; nuxt:dist/module.mjs:44-51).",
|
|
846
|
-
"details": "### What setup does\n\nIn order (source: nuxt:dist/module.mjs:34-127):\n\n0. Sets attributes on `<html>` through `app.head.htmlAttrs`: `data-m3-ripple=\"off\"` when `ripple` is `false`, `data-m3-motion-scheme=\"expressive\"` when `motionScheme` is `'expressive'`, `data-m3-motion=\"reduce\"` when `reducedMotion` is `'always'`, and `dir` when the `dir` option is set. Without the `dir` option, an existing `htmlAttrs.dir` of `rtl` or `ltr` is handed to the plugin instead (source: nuxt:dist/module.mjs:38-43).\n1. Reads `dist/api.json` of the installed library. If it cannot be read the module logs an error and stops: nothing is registered (source: nuxt:dist/module.mjs:44-51).\n2. With `components` on, registers every component of `api.json` under its own name, skipping entry points whose optional peer package is not installed (source: nuxt:dist/module.mjs:59-64).\n3. With `composables` on, registers every `use*` value as `use<prefix><Name>`, by default `useM3Theme` (source: nuxt:dist/module.mjs:65-72).\n4. With `css` on, adds `@m3ui-vue/m3ui-vue/styles` to the page CSS (source: nuxt:dist/module.mjs:73).\n5. With `mapWorker` on and `maplibre-gl` 6 or newer installed, adds a client plugin that calls `setMapWorker()` (source: nuxt:dist/module.mjs:74-89).\n6. Resolves `locale` (preset code, own strings, or `'auto'`), see the `i18n-auto` page (source: nuxt:dist/module.mjs:90-97).\n7. Writes the options to a generated template and installs the runtime plugin (source: nuxt:dist/module.mjs:98-125).\n\nAt runtime the plugin builds `createM3UI({ ...options, locale, cookies, initialState, isHydrating })` and installs it on the Vue app. On the server it also inlines the theme script (source: nuxt:dist/runtime/plugin.js:35-49).\n\n### Defaults and meaning\n\n| Option | Default | Meaning |\n|---|---|---|\n| `components` | `true` | Auto-import the components; each is bundled only where used. |\n| `composables` | `{ prefix: 'M3' }` | Auto-import `use*` values with this prefix; `false` to import them yourself. |\n| `css` | `true` | Add the components' own stylesheet. |\n| `cookies` | `true` | Keep theme, palette, contrast and window size in cookies so the server renders with them. |\n| `viewportHints` | `false` | Ask Chromium for the exact window size with client hints; needs `cookies`. |\n| `themeScript` | `true` | Inline `themeInitScript()` in `<head>`. |\n| `mapWorker` | `true` | Emit and register MapLibre 6's worker for `MMap`. |\n| `locale` | English | A preset code (`es`, `fr`, `pt`, `de`, `ja`, `zh`, `ko`, `ar`, and `pl` since 0.8.0), your own strings, or `'auto'`. |\n| `storagePrefix` | none | Prefix for every cookie and storage key of the library; needs library 1.2.2. |\n| `dir` | none | `'rtl'` or `'ltr'`: written as `dir` on `<html>` and given to the components on the server, so what they place by direction (the edge `MNavigationDrawer` sits on) is right in the server HTML; needs library 1.9.0. |\n| `ripple` | `true` | `false` removes the press ripple everywhere (the state layer stays) by setting `data-m3-ripple=\"off\"` on `<html>` in the server render; needs library 1.10.0. |\n| `motionScheme` | `'standard'` | `'expressive'` switches the components that follow the app's motion scheme to the Expressive springs, from the server render on; needs library 1.11.0 (see `getMotionScheme`). |\n| `reducedMotion` | `'system'` | `'always'` cuts animations down whatever the device says (an in-app setting, a kiosk); needs library 1.11.0. |\n\n(source: nuxt:dist/module.mjs:25-33; nuxt:dist/module.mjs:38-43; nuxt:dist/module.d.mts:17-89; nuxt:README.md:98-115)\n\nThe remaining options are passed unchanged to `createM3UI()`: `palette`, `persistPalette`, `customPalettes`, `seed`, `seedOptions`, `contrast`, `themeColor`, `storagePrefix`, `dir`, `ripple`, `motionScheme` and `reducedMotion`; the module only takes `components`, `composables`, `css`, `cookies`, `viewportHints`, `themeScript`, `mapWorker` and `locale` out of that object (source: nuxt:dist/module.mjs:37; pkg:src/plugin.ts:27-124). Their meaning:\n\n- `palette`: a built-in palette id (the `PaletteId` type) or your own id; only the first-visit default unless `persistPalette` is `false`.\n- `persistPalette: false`: makes `palette` and `contrast` hard defaults that win over anything stored, and stops `useColorPalette().set()` from persisting.\n- `seed` and `seedOptions`: generate the whole scheme from one color instead of using a named palette; `palette` wins when both are set.\n- `contrast`: `standard`, `medium`, `high` or `system`. Built-in palettes need `@m3ui-vue/m3ui-vue/palettes-contrast` imported in your CSS for medium and high.\n- `customPalettes`: extra palettes for pickers; each still needs its own CSS block.\n- `themeColor`: keeps `<meta name=\"theme-color\">` in sync with a color role (`'surface'`, `'primary'`, …). The library then owns that meta tag.\n\n(source: pkg:src/plugin.ts:27-124)\n\n### Constraints on values\n\n- The plugin options and a custom `locale` object are written into a generated file with `JSON.stringify`, so they must be plain JSON data: no functions, no refs (inferred from source: nuxt:dist/module.mjs:98-111).\n- `cookies`, `viewportHints` and `themeScript` are booleans stored in the same generated file and read by the runtime plugin (source: nuxt:dist/module.mjs:107-109; nuxt:dist/runtime/plugin.js:5).\n- `locale` is removed from the pass-through options and handled by the module (source: nuxt:dist/module.mjs:37).\n\n### Version requirements\n\nOptions newer than the module's first release need a matching library: `cookies` 1.0.3, a first-visit device guess 1.2.0, `storagePrefix` 1.2.2, `mapWorker` 1.6.0, `dir` and the `ar` locale 1.9.0, `ripple` 1.10.0, `motionScheme`, `reducedMotion` and the `pl` locale 1.11.0 (source: nuxtrepo@
|
|
846
|
+
"details": "### What setup does\n\nIn order (source: nuxt:dist/module.mjs:34-127):\n\n0. Sets attributes on `<html>` through `app.head.htmlAttrs`: `data-m3-ripple=\"off\"` when `ripple` is `false`, `data-m3-motion-scheme=\"expressive\"` when `motionScheme` is `'expressive'`, `data-m3-motion=\"reduce\"` when `reducedMotion` is `'always'`, and `dir` when the `dir` option is set. Without the `dir` option, an existing `htmlAttrs.dir` of `rtl` or `ltr` is handed to the plugin instead (source: nuxt:dist/module.mjs:38-43).\n1. Reads `dist/api.json` of the installed library. If it cannot be read the module logs an error and stops: nothing is registered (source: nuxt:dist/module.mjs:44-51).\n2. With `components` on, registers every component of `api.json` under its own name, skipping entry points whose optional peer package is not installed (source: nuxt:dist/module.mjs:59-64).\n3. With `composables` on, registers every `use*` value as `use<prefix><Name>`, by default `useM3Theme` (source: nuxt:dist/module.mjs:65-72).\n4. With `css` on, adds `@m3ui-vue/m3ui-vue/styles` to the page CSS (source: nuxt:dist/module.mjs:73).\n5. With `mapWorker` on and `maplibre-gl` 6 or newer installed, adds a client plugin that calls `setMapWorker()` (source: nuxt:dist/module.mjs:74-89).\n6. Resolves `locale` (preset code, own strings, or `'auto'`), see the `i18n-auto` page (source: nuxt:dist/module.mjs:90-97).\n7. Writes the options to a generated template and installs the runtime plugin (source: nuxt:dist/module.mjs:98-125).\n\nAt runtime the plugin builds `createM3UI({ ...options, locale, cookies, initialState, isHydrating })` and installs it on the Vue app. On the server it also inlines the theme script (source: nuxt:dist/runtime/plugin.js:35-49).\n\n### Defaults and meaning\n\n| Option | Default | Meaning |\n|---|---|---|\n| `components` | `true` | Auto-import the components; each is bundled only where used. |\n| `composables` | `{ prefix: 'M3' }` | Auto-import `use*` values with this prefix; `false` to import them yourself. |\n| `css` | `true` | Add the components' own stylesheet. |\n| `cookies` | `true` | Keep theme, palette, contrast and window size in cookies so the server renders with them. |\n| `viewportHints` | `false` | Ask Chromium for the exact window size with client hints; needs `cookies`. |\n| `themeScript` | `true` | Inline `themeInitScript()` in `<head>`. |\n| `mapWorker` | `true` | Emit and register MapLibre 6's worker for `MMap`. |\n| `locale` | English | A preset code (`es`, `fr`, `pt`, `de`, `ja`, `zh`, `ko`, `ar`, and `pl` since 0.8.0), your own strings, or `'auto'`. |\n| `storagePrefix` | none | Prefix for every cookie and storage key of the library; needs library 1.2.2. |\n| `dir` | none | `'rtl'` or `'ltr'`: written as `dir` on `<html>` and given to the components on the server, so what they place by direction (the edge `MNavigationDrawer` sits on) is right in the server HTML; needs library 1.9.0. |\n| `ripple` | `true` | `false` removes the press ripple everywhere (the state layer stays) by setting `data-m3-ripple=\"off\"` on `<html>` in the server render; needs library 1.10.0. |\n| `motionScheme` | `'standard'` | `'expressive'` switches the components that follow the app's motion scheme to the Expressive springs, from the server render on; needs library 1.11.0 (see `getMotionScheme`). |\n| `reducedMotion` | `'system'` | `'always'` cuts animations down whatever the device says (an in-app setting, a kiosk); needs library 1.11.0. |\n\n(source: nuxt:dist/module.mjs:25-33; nuxt:dist/module.mjs:38-43; nuxt:dist/module.d.mts:17-89; nuxt:README.md:98-115)\n\nThe remaining options are passed unchanged to `createM3UI()`: `palette`, `persistPalette`, `customPalettes`, `seed`, `seedOptions`, `contrast`, `themeColor`, `storagePrefix`, `dir`, `ripple`, `motionScheme` and `reducedMotion`; the module only takes `components`, `composables`, `css`, `cookies`, `viewportHints`, `themeScript`, `mapWorker` and `locale` out of that object (source: nuxt:dist/module.mjs:37; pkg:src/plugin.ts:27-124). Their meaning:\n\n- `palette`: a built-in palette id (the `PaletteId` type) or your own id; only the first-visit default unless `persistPalette` is `false`.\n- `persistPalette: false`: makes `palette` and `contrast` hard defaults that win over anything stored, and stops `useColorPalette().set()` from persisting.\n- `seed` and `seedOptions`: generate the whole scheme from one color instead of using a named palette; `palette` wins when both are set.\n- `contrast`: `standard`, `medium`, `high` or `system`. Built-in palettes need `@m3ui-vue/m3ui-vue/palettes-contrast` imported in your CSS for medium and high.\n- `customPalettes`: extra palettes for pickers; each still needs its own CSS block.\n- `themeColor`: keeps `<meta name=\"theme-color\">` in sync with a color role (`'surface'`, `'primary'`, …). The library then owns that meta tag.\n\n(source: pkg:src/plugin.ts:27-124)\n\n### Constraints on values\n\n- The plugin options and a custom `locale` object are written into a generated file with `JSON.stringify`, so they must be plain JSON data: no functions, no refs (inferred from source: nuxt:dist/module.mjs:98-111).\n- `cookies`, `viewportHints` and `themeScript` are booleans stored in the same generated file and read by the runtime plugin (source: nuxt:dist/module.mjs:107-109; nuxt:dist/runtime/plugin.js:5).\n- `locale` is removed from the pass-through options and handled by the module (source: nuxt:dist/module.mjs:37).\n\n### Version requirements\n\nOptions newer than the module's first release need a matching library: `cookies` 1.0.3, a first-visit device guess 1.2.0, `storagePrefix` 1.2.2, `mapWorker` 1.6.0, `dir` and the `ar` locale 1.9.0, `ripple` 1.10.0, `motionScheme`, `reducedMotion` and the `pl` locale 1.11.0 (source: nuxtrepo@3a11195:CHANGELOG.md:21-25; nuxtrepo@3a11195:CHANGELOG.md:33; nuxtrepo@3a11195:CHANGELOG.md:43-45; nuxtrepo@3a11195:CHANGELOG.md:76-79; nuxtrepo@3a11195:CHANGELOG.md:105-126). The installed module 0.8.0 was tested with library 1.11.0 (source: nuxtrepo@3a11195:CHANGELOG.md:27-28).",
|
|
847
847
|
"examples": "### Minimal configuration\n\n```ts\n// nuxt.config.ts\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineNuxtConfig({\n modules: ['@m3ui-vue/nuxt'],\n css: ['~/assets/main.css'],\n vite: { plugins: [tailwindcss()] },\n m3ui: {\n palette: 'red',\n locale: 'es'\n }\n})\n```\n\n(source: nuxt:README.md:25-38)\n\n### Stylesheet order\n\n```css\n/* assets/main.css */\n@import 'tailwindcss';\n@import '@m3ui-vue/m3ui-vue/theme';\n@import '@m3ui-vue/m3ui-vue/palettes';\n/* only if you offer medium or high contrast */\n@import '@m3ui-vue/m3ui-vue/palettes-contrast';\n```\n\n(source: nuxt:README.md:43-50; pkg:src/plugin.ts:53-58)\n\n### Server-rendered theme toggle, no ClientOnly\n\n```vue\n<!-- nuxt -->\n<template>\n <MIconButton :icon=\"theme === 'dark' ? 'dark_mode' : 'light_mode'\" label=\"Theme\" @click=\"cycle\" />\n</template>\n\n<script setup lang=\"ts\">\nconst { theme, cycle } = useM3Theme()\n</script>\n```\n\n(source: nuxt:README.md:145-153)",
|
|
848
848
|
"pitfalls": "- If `@m3ui-vue/m3ui-vue` is missing or its `dist/api.json` cannot be read, the module logs an error and registers nothing, so every `M*` tag later fails as an unknown component (source: nuxt:dist/module.mjs:44-51).\n- `composables: { }` (an object without `prefix`) gives an empty prefix, so the composables are registered as `useTheme`, `useToast` and so on; `composables: true` gives the `M3` prefix (source: nuxt:dist/module.mjs:66-71).\n- Keep `vue` in the app's own dependencies. With pnpm an app that only gets Vue through `nuxt` can load a second copy on the server, which fails to render (source: nuxt:README.md:40-41).\n- The theme and palette CSS belong in your own stylesheet after Tailwind; the module only adds the components' stylesheet (source: nuxt:README.md:43-50; nuxt:dist/module.mjs:73).\n- `seed` cannot be generated before the app loads: a first visit shows the baseline palette until then (source: nuxt:README.md:171-172; pkg:src/composables/themeInitScript.ts:15-26).\n- `locale: 'ar'` (or `'auto'` with an Arabic `@nuxtjs/i18n` locale) only swaps the strings. It does not set the reading direction: add `dir: 'rtl'` yourself, or the server renders left to right and the drawer jumps after hydration (source: pkg:src/locales/ar.ts:4-6; nuxt:dist/module.d.mts:68-73). With `'auto'` the direction does not follow a language switch either; set `dir` on `<html>` from your i18n code.\n- `ripple: false` set in `nuxt.config.ts` is the only way the server HTML carries `data-m3-ripple=\"off\"`; `createM3UI({ ripple: false })` outside the module sets it in the browser only, so the ripple shows until hydration (source: nuxt:dist/module.mjs:39; pkg:src/plugin.ts:164).\n- `customPalettes` registers ids for pickers only. Each id still needs `[data-palette='<id>']` and `[data-palette='<id>'].dark` CSS blocks in your stylesheet; an entry whose `id` equals a built-in one replaces that entry in the shared `palettes` array (source: pkg:src/plugin.ts:38-44; pkg:src/plugin.ts:176-180).\n- The module is marked beta by its author; report hydration warnings upstream (source: nuxt:README.md:13-16)."
|
|
849
849
|
},
|
|
@@ -890,19 +890,19 @@
|
|
|
890
890
|
},
|
|
891
891
|
{
|
|
892
892
|
"ref": "pkg:src/plugin.ts:27-124",
|
|
893
|
-
"url": "https://github.com/
|
|
893
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L27-L124"
|
|
894
894
|
},
|
|
895
895
|
{
|
|
896
896
|
"ref": "pkg:src/composables/themeInitScript.ts:15-54",
|
|
897
|
-
"url": "https://github.com/
|
|
897
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/themeInitScript.ts#L15-L54"
|
|
898
898
|
},
|
|
899
899
|
{
|
|
900
|
-
"ref": "nuxtrepo@
|
|
901
|
-
"url": "https://github.com/
|
|
900
|
+
"ref": "nuxtrepo@3a11195:CHANGELOG.md:30-97",
|
|
901
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/CHANGELOG.md#L30-L97"
|
|
902
902
|
},
|
|
903
903
|
{
|
|
904
904
|
"ref": "pkg:src/locales/ar.ts:4-6",
|
|
905
|
-
"url": "https://github.com/
|
|
905
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/locales/ar.ts#L4-L6"
|
|
906
906
|
}
|
|
907
907
|
],
|
|
908
908
|
"verified": {
|
|
@@ -983,7 +983,7 @@
|
|
|
983
983
|
},
|
|
984
984
|
{
|
|
985
985
|
"ref": "pkg:src/composables/usePdf.ts:107-109",
|
|
986
|
-
"url": "https://github.com/
|
|
986
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/usePdf.ts#L107-L109"
|
|
987
987
|
}
|
|
988
988
|
],
|
|
989
989
|
"verified": {
|
|
@@ -1017,7 +1017,7 @@
|
|
|
1017
1017
|
],
|
|
1018
1018
|
"sections": {
|
|
1019
1019
|
"summary": "The module is small and mostly mechanical, so most problems come from what it quietly does not do. This page lists them, each with the page that explains the mechanism: `module-options`, `auto-imports`, `ssr-and-hydration`, `cookies-and-theme-script`, `i18n-auto`.",
|
|
1020
|
-
"details": "### Setup and versions\n\n- The module is beta according to its author. Report hydration warnings and rendering differences upstream (source: nuxt:README.md:13-16).\n- If `@m3ui-vue/m3ui-vue` is not installed, or its `dist/api.json` is unreadable, the module logs one error and registers nothing (source: nuxt:dist/module.mjs:44-51).\n- Keep `vue` in the app's own dependencies; with pnpm a second copy of Vue can end up on the server (source: nuxt:README.md:40-41).\n- Options need minimum library versions: `cookies` 1.0.3, device guess for the first visit 1.2.0, `storagePrefix` 1.2.2, `mapWorker` 1.6.0, `dir` and the `ar` locale 1.9.0, `ripple` 1.10.0, `motionScheme`, `reducedMotion` and the `pl` locale 1.11.0. Module 0.8.0 was tested with library 1.11.0 (source: nuxtrepo@
|
|
1020
|
+
"details": "### Setup and versions\n\n- The module is beta according to its author. Report hydration warnings and rendering differences upstream (source: nuxt:README.md:13-16).\n- If `@m3ui-vue/m3ui-vue` is not installed, or its `dist/api.json` is unreadable, the module logs one error and registers nothing (source: nuxt:dist/module.mjs:44-51).\n- Keep `vue` in the app's own dependencies; with pnpm a second copy of Vue can end up on the server (source: nuxt:README.md:40-41).\n- Options need minimum library versions: `cookies` 1.0.3, device guess for the first visit 1.2.0, `storagePrefix` 1.2.2, `mapWorker` 1.6.0, `dir` and the `ar` locale 1.9.0, `ripple` 1.10.0, `motionScheme`, `reducedMotion` and the `pl` locale 1.11.0. Module 0.8.0 was tested with library 1.11.0 (source: nuxtrepo@3a11195:CHANGELOG.md:21-28; nuxtrepo@3a11195:CHANGELOG.md:33; nuxtrepo@3a11195:CHANGELOG.md:43-45; nuxtrepo@3a11195:CHANGELOG.md:76-79).\n- The module's development stub types the `m3ui` options loosely (no palette autocompletion); the published build types them properly (source: nuxt:README.md:188-190).\n\n### Components and imports\n\n- The module checks only the main package of an optional entry (for `/chart` that is `chart.js`; for `/pdf-sign` it is `pdf-lib`, though `MPdfSigner` also needs `pdfjs-dist`), so `MChart` is registered even without `vue-chartjs`, which it also loads (source: pkg:src/components/MChart.vue:103-106; nuxt:dist/module.mjs:7-18).\n- A tag of an entry point with an optional peer (map, PDF, charts, editors, QR, barcode, terminal, markdown, rich text) is simply unknown when the peer package is missing (source: nuxt:dist/module.mjs:59-64).\n- The default composable prefix is `M3`; an options object without `prefix` removes it entirely (source: nuxt:dist/module.mjs:66-71).\n- Functions, constants, types and `palettes` are not auto-imported (source: nuxt:README.md:96).\n\n### Theme, CSS and first paint\n\n- Plugin options and a custom `locale` are serialized to JSON; functions and refs are lost (inferred from source: nuxt:dist/module.mjs:103).\n- The theme and palette CSS go into your own stylesheet after Tailwind; medium and high contrast for built-in palettes also need the `palettes-contrast` import (source: nuxt:README.md:43-50; pkg:src/plugin.ts:53-58).\n- A `seed` default cannot be generated before the app loads, so the first visit shows the baseline palette (source: nuxt:README.md:171-172).\n- `themeColor` is applied only in the browser; the server-rendered HTML does not contain it (source: pkg:src/plugin.ts:183-195).\n- `system` theme and contrast are unknown to the server (source: nuxt:README.md:155-158).\n\n### Rendering and caching\n\n- Anything that reads the window while rendering will mismatch; use `useM3WindowSizeClass()` or `onMounted` (inferred from source: nuxt:README.md:162-164).\n- `viewportHints` costs a first visit in Chromium one repeated request and adds `Vary` headers (source: nuxt:README.md:167-169; nuxt:dist/runtime/plugin.js:20-28).\n- Pages that are prerendered or cached for all users do not see per-user cookies (inferred from source: nuxt:dist/runtime/plugin.js:14-34).\n- With `maplibre-gl` 6 the module must register the worker or maps stay blank; with `mapWorker: false` call `setMapWorker()` yourself (source: nuxt:README.md:112).\n\n### Other\n\n- Right-to-left needs two settings: `locale: 'ar'` for the strings and `dir: 'rtl'` (or `app.head.htmlAttrs.dir`) for the direction; the locale does not set `dir`, and without it the server renders left to right (source: nuxt:dist/module.mjs:38-43; nuxt:dist/module.d.mts:68-73; pkg:src/locales/ar.ts:4-6).\n- `ripple: false` in `nuxt.config.ts` is what puts `data-m3-ripple=\"off\"` in the server HTML (source: nuxt:dist/module.mjs:39).\n- No built-in Polish preset exists; pass a `Partial<M3Locale>` object (see `i18n-auto`).\n- With a strict content security policy (`script-src`), the inline theme script (`themeScript: true`) needs `'unsafe-inline'`, a nonce/hash, or disabling (`themeScript: false`) (inferred from source: nuxt:dist/runtime/plugin.js:41-49).\n- Avoid naming local components with `M` + capital letters when Nuxt auto-imports them without a path prefix, so they don't collide with M3UI components (inferred from source: nuxt:dist/module.mjs:62).",
|
|
1021
1021
|
"examples": "### Checking what the module registered\n\n```vue\n<!-- nuxt -->\n<script setup lang=\"ts\">\nconst toast = useM3Toast()\n</script>\n\n<template>\n <MButton @click=\"toast.info('The module is working')\">Test</MButton>\n</template>\n```",
|
|
1022
1022
|
"pitfalls": "- Do not copy examples written for plain Vue into a Nuxt page without checking imports: the Nuxt names are `useM3*` and need no import, while functions still do (source: nuxt:README.md:73-96).\n- When something is unknown after an upgrade, restart the dev server so the module re-reads the library's `api.json` (inferred from source: nuxt:dist/module.mjs:44-72)."
|
|
1023
1023
|
},
|
|
@@ -1060,11 +1060,11 @@
|
|
|
1060
1060
|
},
|
|
1061
1061
|
{
|
|
1062
1062
|
"ref": "pkg:src/plugin.ts:53-58",
|
|
1063
|
-
"url": "https://github.com/
|
|
1063
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L53-L58"
|
|
1064
1064
|
},
|
|
1065
1065
|
{
|
|
1066
1066
|
"ref": "pkg:src/components/MChart.vue:103-106",
|
|
1067
|
-
"url": "https://github.com/
|
|
1067
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/components/MChart.vue#L103-L106"
|
|
1068
1068
|
},
|
|
1069
1069
|
{
|
|
1070
1070
|
"ref": "nuxt:dist/module.mjs:7-18",
|
|
@@ -1072,15 +1072,15 @@
|
|
|
1072
1072
|
},
|
|
1073
1073
|
{
|
|
1074
1074
|
"ref": "pkg:src/plugin.ts:183-195",
|
|
1075
|
-
"url": "https://github.com/
|
|
1075
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L183-L195"
|
|
1076
1076
|
},
|
|
1077
1077
|
{
|
|
1078
|
-
"ref": "nuxtrepo@
|
|
1079
|
-
"url": "https://github.com/
|
|
1078
|
+
"ref": "nuxtrepo@3a11195:CHANGELOG.md:30-97",
|
|
1079
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/CHANGELOG.md#L30-L97"
|
|
1080
1080
|
},
|
|
1081
1081
|
{
|
|
1082
|
-
"ref": "issue:
|
|
1083
|
-
"url": "https://github.com/
|
|
1082
|
+
"ref": "issue:m3ui-vue/m3ui-vue#1",
|
|
1083
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/issues/1"
|
|
1084
1084
|
},
|
|
1085
1085
|
{
|
|
1086
1086
|
"ref": "nuxt:dist/module.d.mts:68-73",
|
|
@@ -1088,7 +1088,7 @@
|
|
|
1088
1088
|
},
|
|
1089
1089
|
{
|
|
1090
1090
|
"ref": "pkg:src/locales/ar.ts:4-6",
|
|
1091
|
-
"url": "https://github.com/
|
|
1091
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/locales/ar.ts#L4-L6"
|
|
1092
1092
|
}
|
|
1093
1093
|
],
|
|
1094
1094
|
"verified": {
|
|
@@ -1150,27 +1150,27 @@
|
|
|
1150
1150
|
"sources": [
|
|
1151
1151
|
{
|
|
1152
1152
|
"ref": "pkg:src/composables/useToast.ts:25-41",
|
|
1153
|
-
"url": "https://github.com/
|
|
1153
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useToast.ts#L25-L41"
|
|
1154
1154
|
},
|
|
1155
1155
|
{
|
|
1156
1156
|
"ref": "pkg:src/composables/useToast.ts:59-91",
|
|
1157
|
-
"url": "https://github.com/
|
|
1157
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useToast.ts#L59-L91"
|
|
1158
1158
|
},
|
|
1159
1159
|
{
|
|
1160
1160
|
"ref": "pkg:src/composables/useNotification.ts:23-37",
|
|
1161
|
-
"url": "https://github.com/
|
|
1161
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/useNotification.ts#L23-L37"
|
|
1162
1162
|
},
|
|
1163
1163
|
{
|
|
1164
1164
|
"ref": "pkg:src/composables/usePageProgress.ts:3-23",
|
|
1165
|
-
"url": "https://github.com/
|
|
1165
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/usePageProgress.ts#L3-L23"
|
|
1166
1166
|
},
|
|
1167
1167
|
{
|
|
1168
1168
|
"ref": "pkg:src/components/MPageProgress.vue:34-44",
|
|
1169
|
-
"url": "https://github.com/
|
|
1169
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/components/MPageProgress.vue#L34-L44"
|
|
1170
1170
|
},
|
|
1171
1171
|
{
|
|
1172
1172
|
"ref": "pkg:src/composables/_ssrState.ts:26-41",
|
|
1173
|
-
"url": "https://github.com/
|
|
1173
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/_ssrState.ts#L26-L41"
|
|
1174
1174
|
},
|
|
1175
1175
|
{
|
|
1176
1176
|
"ref": "https://nuxt.com/docs/api/advanced/hooks",
|
|
@@ -1206,7 +1206,7 @@
|
|
|
1206
1206
|
],
|
|
1207
1207
|
"sections": {
|
|
1208
1208
|
"summary": "Every component renders on the server, and the author says server rendering and the Nuxt module are new and in beta (source: nuxt:README.md:13-16). Two things the server cannot know are bridged by the module: the user's theme choice (through cookies) and the browser window's size (through a cookie, client hints, or a guess from the device). A flag tells the library when the app is still hydrating so the first client frame matches the server's HTML (source: nuxt:README.md:138-172; pkg:src/plugin.ts:69-124).",
|
|
1209
|
-
"details": "### Theme on the server\n\nWith `cookies` on (the default) the plugin reads the cookies `m3-theme`, `m3-palette` and `m3-contrast` (with the `storagePrefix`, if any) and passes them to the library as `initialState` (source: nuxt:dist/runtime/plugin.js:14-34). `useM3Theme()` and `useM3ColorPalette()` then report the user's choice during server rendering and while hydrating, so UI built from them needs no `<ClientOnly>` (source: pkg:src/composables/_ssrState.ts:26-41; nuxt:README.md:140-143).\n\nMissing or invalid cookie values fall back to the plugin's defaults by the same rules as the client: an invalid theme becomes `system`, an invalid contrast is ignored, a missing palette uses `palette`, or the baseline when a `seed` is configured (source: pkg:src/plugin.ts:135-148).\n\nWhat the server cannot know is the operating system's preferences. With the `system` theme the server reports `theme` as `system` (whether the page ends up dark is decided in the browser), and a `system` contrast resolves to `standard` there (source: nuxt:README.md:155-158; lib@
|
|
1209
|
+
"details": "### Theme on the server\n\nWith `cookies` on (the default) the plugin reads the cookies `m3-theme`, `m3-palette` and `m3-contrast` (with the `storagePrefix`, if any) and passes them to the library as `initialState` (source: nuxt:dist/runtime/plugin.js:14-34). `useM3Theme()` and `useM3ColorPalette()` then report the user's choice during server rendering and while hydrating, so UI built from them needs no `<ClientOnly>` (source: pkg:src/composables/_ssrState.ts:26-41; nuxt:README.md:140-143).\n\nMissing or invalid cookie values fall back to the plugin's defaults by the same rules as the client: an invalid theme becomes `system`, an invalid contrast is ignored, a missing palette uses `palette`, or the baseline when a `seed` is configured (source: pkg:src/plugin.ts:135-148).\n\nWhat the server cannot know is the operating system's preferences. With the `system` theme the server reports `theme` as `system` (whether the page ends up dark is decided in the browser), and a `system` contrast resolves to `standard` there (source: nuxt:README.md:155-158; lib@ed784d6:CHANGELOG.md:668).\n\n### Window size and adaptive layouts\n\n`MNavigationSuite`, `MListDetail`, `MSupportingPane` and `useWindowSizeClass()` measure their own size, which the server does not have (source: nuxt:README.md:162-164). The server resolves a size in this order (source: pkg:src/composables/viewportHints.ts:71-81; nuxt:dist/runtime/plugin.js:15-19):\n\n| Order | Source | When it is available |\n|---|---|---|\n| 1 | The `m3-viewport` cookie (`<width>x<height>`), written on load and, debounced, on resize | From the second visit on, with `cookies` |\n| 2 | Client hints `Sec-CH-Viewport-Width` and `Sec-CH-Viewport-Height` | First visit, Chromium, only with `viewportHints` |\n| 3 | A guess for the kind of device (phone, tablet or desktop) from `Sec-CH-UA-Mobile` and the user agent | First visit, library 1.2.0 or later |\n\n(source: nuxt:README.md:162-169; lib@ed784d6:CHANGELOG.md:551; pkg:src/composables/_ssrState.ts:52-65)\n\nThe resolved size is stored with `useState('m3ui-viewport')` so it travels to the client in the payload (source: nuxt:dist/runtime/plugin.js:15-19; nuxtrepo@3a11195:test/basic.test.ts:35-37). On the client, the cookie is read when there is no payload value (source: nuxt:dist/runtime/plugin.js:17-18).\n\nWith `viewportHints: true` the server sends `Accept-CH`, `Critical-CH` and `Vary` for the two hint headers, and Chromium repeats the first request once with them; later visits have the cookie anyway (source: nuxt:dist/runtime/plugin.js:20-28; nuxt:README.md:167-169; nuxtrepo@3a11195:test/basic.test.ts:39-44).\n\n### The hydration rule\n\nThe plugin passes `isHydrating: () => !!nuxtApp.isHydrating` to the library (source: nuxt:dist/runtime/plugin.js:40). While a component is being hydrated:\n\n- the adaptive layouts and `useWindowSizeClass()` render their first frame at the server's size, then adapt once mounted;\n- `useM3Theme()` and `useM3ColorPalette()` return the initial state until the component is mounted, then switch to the live stored value.\n\n(source: pkg:src/plugin.ts:69-75; pkg:src/composables/_ssrState.ts:26-41; pkg:src/composables/_hydration.ts:3-10)\n\nSo when the cookie was missing or the window differs, the layout may change right after hydration instead of producing a mismatch warning (inferred from source: pkg:src/composables/_ssrState.ts:31-41).\n\n### Known server-rendering fixes in the library\n\nThese explain odd advice in older issues and tell you the minimum versions to expect:\n\n- Importing the library used to read `localStorage`, `window` and `document` at module load; since 1.0.2 theme, palette, contrast and theme-color are applied only in the browser (source: lib@ed784d6:CHANGELOG.md:687).\n- A dialog mounted open on the server used to touch `ResizeObserver`; the open watcher now handles the server (source: lib@ed784d6:CHANGELOG.md:622).\n- `MLightbox` open on load opens once mounted while hydrating, and a choice kept only in a cookie is no longer erased (source: lib@ed784d6:CHANGELOG.md:677-678).\n- The module's own tests build fixture apps, check their server-rendered HTML and hydrate one in Chromium, failing on any hydration warning or page error; the browser test is skipped without a Chromium (source: nuxtrepo@3a11195:test/browser.test.ts:9-30; nuxt:README.md:184-186).\n\n### Enabling viewportHints in SSR apps\n\nWith SSR enabled (default in Nuxt) and `viewportHints: true`, a first visit in Chromium renders adaptive layouts (`MNavigationSuite`, `MListDetail`, `MSupportingPane`, `useM3WindowSizeClass()`) at the exact window class without waiting for client hydration. Note that `Critical-CH` / `Vary` headers repeat the first uncached request and split shared CDN caches by viewport headers, so `viewportHints` fits authenticated apps best (source: nuxt:README.md:162-169).",
|
|
1210
1210
|
"examples": "### Layout that follows the window size\n\n```vue\n<!-- nuxt -->\n<script setup lang=\"ts\">\nconst { widthClass } = useM3WindowSizeClass()\nconst wide = computed(() => !['compact', 'medium'].includes(widthClass.value))\n</script>\n\n<template>\n <MNavigationSuite :layout=\"wide ? 'rail-expanded' : 'auto'\" model-value=\"/\" :items=\"[]\">\n <slot />\n </MNavigationSuite>\n</template>\n```\n\n### Theme-dependent label without ClientOnly\n\n```vue\n<!-- nuxt -->\n<script setup lang=\"ts\">\nconst { theme } = useM3Theme()\n</script>\n\n<template>\n <MChip>{{ theme === 'dark' ? 'Dark' : 'Light or system' }}</MChip>\n</template>\n```",
|
|
1211
1211
|
"pitfalls": "- Code of your own that reads `window.innerWidth` or `matchMedia` during setup will not match the server's HTML. Use `useM3WindowSizeClass()` or measure in `onMounted` (inferred from source: pkg:src/composables/_hydration.ts:3-10).\n- A page that is prerendered or cached for everyone cannot read a user's cookies; it renders for whatever size and theme the build or the first request had, and the layout adapts after hydration (inferred from source: nuxt:dist/runtime/plugin.js:14-34).\n- `viewportHints` adds `Vary` headers for the hint names, which can split shared caches in front of the app; use it only where the pages are personalized anyway (inferred from source: nuxt:dist/runtime/plugin.js:20-28).\n- Disabling `cookies` removes the server's knowledge of theme and size: `useM3Theme()` then reports the library defaults on the server, and a theme toggle's icon may differ until hydration (source: nuxt:dist/runtime/plugin.js:29-34; nuxt:README.md:140-143).\n- The `system` theme and `system` contrast cannot be resolved on the server, so the first paint for such users depends on the inline theme script (see `cookies-and-theme-script`) (source: nuxt:README.md:155-158).\n- Optional entry points (maps, PDF, charts, editors) work on the server only when their peer packages are installed; the module does not register them otherwise (source: nuxt:dist/module.mjs:7-18)."
|
|
1212
1212
|
},
|
|
@@ -1247,43 +1247,43 @@
|
|
|
1247
1247
|
},
|
|
1248
1248
|
{
|
|
1249
1249
|
"ref": "pkg:src/plugin.ts:69-148",
|
|
1250
|
-
"url": "https://github.com/
|
|
1250
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/plugin.ts#L69-L148"
|
|
1251
1251
|
},
|
|
1252
1252
|
{
|
|
1253
1253
|
"ref": "pkg:src/composables/_ssrState.ts:26-80",
|
|
1254
|
-
"url": "https://github.com/
|
|
1254
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/_ssrState.ts#L26-L80"
|
|
1255
1255
|
},
|
|
1256
1256
|
{
|
|
1257
1257
|
"ref": "pkg:src/composables/_hydration.ts:3-10",
|
|
1258
|
-
"url": "https://github.com/
|
|
1258
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/_hydration.ts#L3-L10"
|
|
1259
1259
|
},
|
|
1260
1260
|
{
|
|
1261
1261
|
"ref": "pkg:src/composables/viewportHints.ts:71-81",
|
|
1262
|
-
"url": "https://github.com/
|
|
1262
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/src/composables/viewportHints.ts#L71-L81"
|
|
1263
1263
|
},
|
|
1264
1264
|
{
|
|
1265
|
-
"ref": "lib@
|
|
1266
|
-
"url": "https://github.com/
|
|
1265
|
+
"ref": "lib@ed784d6:CHANGELOG.md:551",
|
|
1266
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/CHANGELOG.md#L551"
|
|
1267
1267
|
},
|
|
1268
1268
|
{
|
|
1269
|
-
"ref": "lib@
|
|
1270
|
-
"url": "https://github.com/
|
|
1269
|
+
"ref": "lib@ed784d6:CHANGELOG.md:622",
|
|
1270
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/CHANGELOG.md#L622"
|
|
1271
1271
|
},
|
|
1272
1272
|
{
|
|
1273
|
-
"ref": "lib@
|
|
1274
|
-
"url": "https://github.com/
|
|
1273
|
+
"ref": "lib@ed784d6:CHANGELOG.md:668-684",
|
|
1274
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/CHANGELOG.md#L668-L684"
|
|
1275
1275
|
},
|
|
1276
1276
|
{
|
|
1277
|
-
"ref": "lib@
|
|
1278
|
-
"url": "https://github.com/
|
|
1277
|
+
"ref": "lib@ed784d6:CHANGELOG.md:687",
|
|
1278
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue/blob/ed784d6475d4475a9ddab48da9f76a48c441993c/CHANGELOG.md#L687"
|
|
1279
1279
|
},
|
|
1280
1280
|
{
|
|
1281
|
-
"ref": "nuxtrepo@
|
|
1282
|
-
"url": "https://github.com/
|
|
1281
|
+
"ref": "nuxtrepo@3a11195:test/basic.test.ts:8-45",
|
|
1282
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/test/basic.test.ts#L8-L45"
|
|
1283
1283
|
},
|
|
1284
1284
|
{
|
|
1285
|
-
"ref": "nuxtrepo@
|
|
1286
|
-
"url": "https://github.com/
|
|
1285
|
+
"ref": "nuxtrepo@3a11195:test/browser.test.ts:9-30",
|
|
1286
|
+
"url": "https://github.com/m3ui-vue/m3ui-vue-nuxt/blob/3a11195d9b21d958c0fb871297738c04f857f86f/test/browser.test.ts#L9-L30"
|
|
1287
1287
|
}
|
|
1288
1288
|
],
|
|
1289
1289
|
"verified": {
|