@kevinmarrec/vite-plugin-dark-mode 1.3.0 → 1.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.
Files changed (2) hide show
  1. package/dist/index.mjs +8 -11
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,21 +1,18 @@
1
1
  //#region src/index.ts
2
2
  var src_default = () => ({
3
3
  name: "@kevinmarrec/vite-plugin-dark-mode",
4
- transformIndexHtml(html) {
5
- return {
6
- html,
7
- tags: [{
8
- tag: "script",
9
- injectTo: "head",
10
- children: `\
4
+ transformIndexHtml() {
5
+ return [{
6
+ tag: "script",
7
+ injectTo: "head",
8
+ children: `\
11
9
  (function () {
12
- const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
10
+ const prefersDark = matchMedia('(prefers-color-scheme: dark)').matches
13
11
  const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
14
12
  if (setting === 'dark' || (prefersDark && setting !== 'light'))
15
- document.documentElement.classList.toggle('dark', true)
13
+ document.documentElement.classList.add('dark')
16
14
  })()`
17
- }]
18
- };
15
+ }];
19
16
  }
20
17
  });
21
18
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kevinmarrec/vite-plugin-dark-mode",
3
3
  "type": "module",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "packageManager": "bun@1.3.10",
6
6
  "description": "Vite plugin to set initial color scheme based on user preferences.",
7
7
  "author": "Kevin Marrec <kevin@marrec.io>",