Skip to content

Commit 491bb7f

Browse files
fix: preserve light-dark() in the built playground so theme switching works
1 parent 925ae21 commit 491bb7f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎docs/Installation.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import "@query-kit/themes/default";
3636

3737
The default theme uses CSS custom variables for easy customization and supports dark mode via `prefers-color-scheme`.
3838

39+
> **Switching light/dark manually?** The theme colors use the CSS `light-dark()` function, which follows the OS automatically. If you instead toggle the scheme by setting the `color-scheme` property yourself, make sure your build keeps `light-dark()` intact: with conservative browser targets (such as Vite's default `baseline-widely-available`), it is rewritten to a `prefers-color-scheme` fallback that only follows the OS, and manual toggling silently stops working. Set your build's CSS target to browsers that support it natively (Chrome 123+, Firefox 120+, Safari 17.5+). For Vite, this is the `build.cssTarget` option.
40+
3941
3. To use the built-in theme icons, pass `'default'` to the `icons` option:
4042
```js
4143
app.use(plugin, {
@@ -53,6 +55,7 @@ import {
5355
plugin, // Vue plugin to install via app.use()
5456
locale, // Ref<string> for runtime locale switching
5557
InputComponent, // Wrapper to attach settings to a custom input component
58+
computeFilter, // Build a server-ready filter from a raw filter
5659
getEntitySchema,
5760
getEntityTranslation,
5861
getPropertyTranslation,

‎packages/vue/vite.playground.config.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ export default defineConfig(({ mode }) => ({
1515
root: './playground',
1616
resolve,
1717
build: {
18+
// Preserve light-dark() in the theme CSS. Vite 8's default target
19+
// ('baseline-widely-available') makes lightningcss lower light-dark() into a
20+
// prefers-color-scheme polyfill, which only follows the OS and ignores the
21+
// `color-scheme` the theme switcher forces. Targeting browsers that support
22+
// light-dark() natively keeps it intact so manual light/dark switching works
23+
// in the built site.
24+
cssTarget: ['chrome123', 'firefox120', 'safari17.5'],
1825
outDir: '../dist-playground',
1926
emptyOutDir: true,
2027
},

0 commit comments

Comments
 (0)