Repository navigation
v5.5.0
🚀 Features
-
themes: Themes now render on the server and follow the theme cookies.
getThemeHead()returns the<html>class, the CSS, thecolor-schememeta and a blocking script for any SSR or SSG server, resolving the preset and color mode from cookies and theSec-CH-Prefers-Color-Schemehint (see server rendering). With the Cookie Store API, a change of themaz-color-modeormaz-presetcookie applies without a reload. The color mode now lives in a singlemaz-color-modecookie, so the saved color mode is reset once. Also fixes the color mode when a host toggles the classes (VitePress) with thebuildtimeandmediastrategies, anduseTheme()no longer shares its state between SSR requests (c26bc8cfd) -
translations: English is now bundled, so the first render and server rendering never show translation keys. Each
createMazUiTranslations()has its own locale and messages, so aMazUiProvideror a server request no longer changes the locale of the whole app. The instance exposes areadypromise to wait for the locale's messages.setLocaleMessageno longer prevents a locale's default messages from loading, the lastsetLocalecall wins, and a failed load is retried on the next explicit call (27b3cc503) -
nuxt: The
translations.messagesoption accepts a file path per locale, with aliases allowed so it works from a layer. Files load on demand, messages no longer go into the payload of every page, and the server renders the page in the right language (92a536b60)export default defineNuxtConfig({ mazUi: { translations: { locale: 'fr', messages: { fr: '~/locales/fr.ts' }, }, }, })
🩹 Fixes
- utils: Handle the equal sign and invalid encodings in getCookie (f5e680306)
- nuxt: Keep the preset and the color mode of the user across reloads: a preset switched with
updateTheme()no longer reverts to the configured one on the second reload, the first paint follows the live system preference, and deleting themaz-color-modecookie restores the configuredcolorMode(892e52640) - maz-ui: Tint shadow-xs with the shadow color of the preset (5a8bb955e)
- maz-ui: Apply the new messages of MazUiProvider after the mount (5ed3c94fd)
- maz-ui: Render the panel of MazPopover in the browser only, which fixes Nuxt hydration mismatches (including
MazSelect,MazSelectCountry,MazDropdown,MazDatePickerandv-tooltip), and a popover open by default now opens right after hydration. Nested popovers are fixed too: a click in the inner one keeps the outer one open, Escape closes the last opened one first,openandcloseare emitted once, the focus trap handles every field and skips disabled ones, hover tooltips also show on keyboard focus, and a disabled popover never shows its panel (638fc7a86)
📖 Documentation
- docs: Document the theme cookies and the server rendering (726b5fa15)
- docs: Follow the active preset in the VitePress theme and fix the dead links (3d52c2ed9)
- docs: Document the loading of the translations, the server rendering and the nested popovers (be54bd708)
❤️ Contributors
- LouisMazel (@LouisMazel)