@whatsaaaa/design-system 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/LICENSE +0 -30
- package/README.md +4 -29
- package/dist/css/terminal.css +3 -7
- package/dist/css/theme.css +3 -7
- package/dist/index.css +6 -10
- package/dist/theme/color.d.ts +3 -3
- package/dist/theme/color.js +4 -4
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.js +17 -5
- package/dist/theme/init.js +1 -1
- package/dist/theme-rules.css +21 -0
- package/dist/tokens.css +6 -3
- package/dist/vitepress-config/index.js +2 -1
- package/docs/usage.md +12 -4
- package/licenses/README.md +2 -0
- package/package.json +2 -2
- package/src/vitepress/Layout.vue +2 -1
package/LICENSE
CHANGED
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
Except for the Whatsaaaa identity artwork and the third-party material named
|
|
2
|
-
below, the contents of this repository, the design tokens, the stylesheets, the
|
|
3
|
-
scripts, the <ws-ghost> element, the theme, shortcut and code-theme modules and
|
|
4
|
-
the docs theme among them, are provided under the MIT License that follows.
|
|
5
|
-
|
|
6
|
-
The Whatsaaaa identity artwork is excluded from the MIT License. It is
|
|
7
|
-
Copyright (c) 2026 Whatsaaaa, all rights reserved. It is the ghost, the
|
|
8
|
-
wordmark, the lockups and marks, the sprite and mark of each project, the README
|
|
9
|
-
headers, the social cards, the profile banner and the favicons, as the generated
|
|
10
|
-
files in `assets/`, as the drawings encoded in `src/identity/` and `identity/`,
|
|
11
|
-
and as those drawings compiled into the package in `dist/identity/` and
|
|
12
|
-
`dist/ghost/`. The code that turns those drawings into files and markup is
|
|
13
|
-
under the MIT License; the drawings are not.
|
|
14
|
-
|
|
15
|
-
The artwork may be redistributed unmodified as part of this package and of
|
|
16
|
-
builds made with it, as the <ws-ghost> element and the docs theme carry it. It
|
|
17
|
-
may not be displayed, used as a logo or mark, or used to identify anything other
|
|
18
|
-
than Whatsaaaa and its projects. The MIT License covers the code of <ws-ghost>
|
|
19
|
-
and of the docs theme, not the ghost they draw. A site that is not Whatsaaaa's
|
|
20
|
-
own and uses either of them makes sure the ghost is not shown on it: it puts
|
|
21
|
-
neither <ws-ghost> nor the output of `ghostSvg` or `ghostMarkup` on its pages,
|
|
22
|
-
and in the docs theme it replaces the theme's `NavGhost.vue` and `NotFound.vue`
|
|
23
|
-
with its own components, the way VitePress overrides an internal component of a
|
|
24
|
-
theme, with a Vite alias.
|
|
25
|
-
|
|
26
|
-
Third-party material keeps its own license: the Rosé Pine palette (MIT) and the
|
|
27
|
-
Departure Mono glyphs (SIL Open Font License 1.1), in `licenses/`, and the
|
|
28
|
-
JetBrains Mono and Inter fonts (SIL Open Font License 1.1), whose licenses the
|
|
29
|
-
build copies next to them in `dist/fonts/`.
|
|
30
|
-
|
|
31
1
|
MIT License
|
|
32
2
|
|
|
33
3
|
Copyright (c) 2026 Whatsaaaa
|
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ CI runs on every pull request:
|
|
|
65
65
|
- the unit tests, with the contrast of every role pair in both themes,
|
|
66
66
|
- that `assets/` is what the sources produce,
|
|
67
67
|
- that the package and the style guide build,
|
|
68
|
-
- the browser tests: no page overflows sideways at phone, tablet and desktop width in either theme, no page logs an error when it loads, the easter egg works with the mouse, the keyboard and reduced motion, the keys of the status line work and their switch turns them off, the path of the status line gives way at every width from 320 px and the theme button switches the theme, an element for one theme shows only in it, the browser's theme-color follows the theme, a control that takes the focus is not left under the status line and no bar or corner of the window cuts off its focus ring, the first tab starts on the border of the sidebar, both fonts draw Serbian Latin, and the pages of the style guide look like their stored screenshots.
|
|
68
|
+
- the browser tests: no page overflows sideways at phone, tablet and desktop width in either theme, no page logs an error when it loads, the easter egg works with the mouse, the keyboard and reduced motion, the keys of the status line work and their switch turns them off, the path of the status line gives way at every width from 320 px and the theme button switches the theme, a `dark` or `light` class chooses the theme as `data-theme` does, an element for one theme shows only in it, the browser's theme-color follows the theme, a control that takes the focus is not left under the status line and no bar or corner of the window cuts off its focus ring, the first tab starts on the border of the sidebar, both fonts draw Serbian Latin, and the pages of the style guide look like their stored screenshots.
|
|
69
69
|
|
|
70
70
|
The screenshots are in `tests/browser/__screenshots__/` and are taken on Linux, in the Playwright container, so they are the same on every machine. After a change that is meant to be seen, update them:
|
|
71
71
|
|
|
@@ -121,31 +121,6 @@ The licenses are in [`licenses/`](./licenses/).
|
|
|
121
121
|
|
|
122
122
|
## License
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
The
|
|
127
|
-
|
|
128
|
-
The artwork may be redistributed unmodified as part of this package and of builds made with it. It may not be shown, used as a logo or mark, or used to identify anything other than Whatsaaaa and its projects. That covers the ghost that `<ws-ghost>` and the docs theme draw: the MIT License covers their code, not the ghost. A site that is not Whatsaaaa's own makes sure the ghost is not shown on it. It puts neither `<ws-ghost>` nor the output of `ghostSvg` or `ghostMarkup` on its pages, and with the docs theme it replaces the theme's `NavGhost.vue` and `NotFound.vue`, the way VitePress [overrides an internal component](https://vitepress.dev/guide/extending-default-theme#overriding-internal-components):
|
|
129
|
-
|
|
130
|
-
```ts
|
|
131
|
-
// .vitepress/config.ts
|
|
132
|
-
import { fileURLToPath, URL } from 'node:url'
|
|
133
|
-
|
|
134
|
-
export default defineConfigWithTheme<ThemeConfig>({
|
|
135
|
-
extends: whatsaaaaConfig(),
|
|
136
|
-
vite: {
|
|
137
|
-
resolve: {
|
|
138
|
-
alias: [
|
|
139
|
-
{
|
|
140
|
-
find: /^.*\/components\/NavGhost\.vue$/,
|
|
141
|
-
replacement: fileURLToPath(new URL('./theme/SiteMark.vue', import.meta.url)),
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
find: /^.*\/components\/NotFound\.vue$/,
|
|
145
|
-
replacement: fileURLToPath(new URL('./theme/SiteNotFound.vue', import.meta.url)),
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
})
|
|
151
|
-
```
|
|
124
|
+
Everything made for Whatsaaaa here is [MIT](./LICENSE), the identity artwork included: the tokens, the stylesheets, the scripts, `<ws-ghost>`, the theme, shortcut and code-theme modules, the docs theme, and the ghost, the wordmark, the lockups and marks, the sprite and mark of each project, the README headers, the social cards, the profile banner and the favicons.
|
|
125
|
+
|
|
126
|
+
The third-party material in the [credits](#credits) keeps its own license: the Rosé Pine palette is MIT, and the Departure Mono glyph outlines and the JetBrains Mono and Inter fonts are under the SIL Open Font License 1.1.
|
package/dist/css/terminal.css
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
:is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"], [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] *), :is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *) {
|
|
2
|
-
display: none !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
:is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"], [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] *), :is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"] *) {
|
|
1
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *) {
|
|
6
2
|
display: none !important;
|
|
7
3
|
}
|
|
8
4
|
|
|
9
5
|
@media (prefers-color-scheme: light) {
|
|
10
|
-
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
|
|
6
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
11
7
|
display: none !important;
|
|
12
8
|
}
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
@media not (prefers-color-scheme: light) {
|
|
16
|
-
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
|
|
12
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
17
13
|
display: none !important;
|
|
18
14
|
}
|
|
19
15
|
}
|
package/dist/css/theme.css
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
:is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"], [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] *), :is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *) {
|
|
2
|
-
display: none !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
:is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"], [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] *), :is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"] *) {
|
|
1
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *) {
|
|
6
2
|
display: none !important;
|
|
7
3
|
}
|
|
8
4
|
|
|
9
5
|
@media (prefers-color-scheme: light) {
|
|
10
|
-
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
|
|
6
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
11
7
|
display: none !important;
|
|
12
8
|
}
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
@media not (prefers-color-scheme: light) {
|
|
16
|
-
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
|
|
12
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
17
13
|
display: none !important;
|
|
18
14
|
}
|
|
19
15
|
}
|
package/dist/index.css
CHANGED
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
--ws-text-overline-line-height: 1.5;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
:root, [data-theme="dark"] {
|
|
283
|
+
:root, [data-theme="dark"], .dark:where(:not([data-theme], .light)) {
|
|
284
284
|
--lightningcss-light: ;
|
|
285
285
|
--lightningcss-dark: initial;
|
|
286
286
|
color-scheme: dark;
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
--ws-color-warning-tint: #f6c17717;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
[data-theme="light"] {
|
|
318
|
+
[data-theme="light"], .light:where(:not([data-theme], .dark)) {
|
|
319
319
|
--lightningcss-light: initial;
|
|
320
320
|
--lightningcss-dark: ;
|
|
321
321
|
color-scheme: light;
|
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
@media (prefers-color-scheme: light) {
|
|
354
|
-
:root:not([data-theme]) {
|
|
354
|
+
:root:not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) {
|
|
355
355
|
--lightningcss-light: initial;
|
|
356
356
|
--lightningcss-dark: ;
|
|
357
357
|
color-scheme: light;
|
|
@@ -884,22 +884,18 @@ code, kbd, samp, pre {
|
|
|
884
884
|
margin: 0;
|
|
885
885
|
}
|
|
886
886
|
|
|
887
|
-
:is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"], [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] *), :is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *) {
|
|
888
|
-
display: none !important;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
:is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"], [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] *), :is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"] *) {
|
|
887
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *) {
|
|
892
888
|
display: none !important;
|
|
893
889
|
}
|
|
894
890
|
|
|
895
891
|
@media (prefers-color-scheme: light) {
|
|
896
|
-
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
|
|
892
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
897
893
|
display: none !important;
|
|
898
894
|
}
|
|
899
895
|
}
|
|
900
896
|
|
|
901
897
|
@media not (prefers-color-scheme: light) {
|
|
902
|
-
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
|
|
898
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
903
899
|
display: none !important;
|
|
904
900
|
}
|
|
905
901
|
}
|
package/dist/theme/color.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* A script for the <head> that keeps the theme-color tags in step from the first paint on:
|
|
10
|
-
* when the stylesheet is there, whenever data-theme
|
|
11
|
-
* and when the system's theme changes. The first paint waits for the stylesheets
|
|
12
|
-
* <head>, and so does the first animation frame.
|
|
10
|
+
* when the stylesheet is there, whenever data-theme or the class of <html> changes, whoever
|
|
11
|
+
* changes it, and when the system's theme changes. The first paint waits for the stylesheets
|
|
12
|
+
* in the <head>, and so does the first animation frame.
|
|
13
13
|
*/
|
|
14
14
|
export declare const themeColorScript: string;
|
package/dist/theme/color.js
CHANGED
|
@@ -9,8 +9,8 @@ const TAGS = 'meta[name="theme-color"]';
|
|
|
9
9
|
const TOKEN = '--ws-color-bg';
|
|
10
10
|
/**
|
|
11
11
|
* A script for the <head> that keeps the theme-color tags in step from the first paint on:
|
|
12
|
-
* when the stylesheet is there, whenever data-theme
|
|
13
|
-
* and when the system's theme changes. The first paint waits for the stylesheets
|
|
14
|
-
* <head>, and so does the first animation frame.
|
|
12
|
+
* when the stylesheet is there, whenever data-theme or the class of <html> changes, whoever
|
|
13
|
+
* changes it, and when the system's theme changes. The first paint waits for the stylesheets
|
|
14
|
+
* in the <head>, and so does the first animation frame.
|
|
15
15
|
*/
|
|
16
|
-
export const themeColorScript = `(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue(${JSON.stringify(TOKEN)}).trim(),m=d.querySelectorAll(${JSON.stringify(TAGS)});if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()`;
|
|
16
|
+
export const themeColorScript = `(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue(${JSON.stringify(TOKEN)}).trim(),m=d.querySelectorAll(${JSON.stringify(TAGS)});if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme','class']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()`;
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type Theme = 'dark' | 'light';
|
|
|
2
2
|
export type ThemeChoice = Theme | 'system';
|
|
3
3
|
/** Where the choice is kept in localStorage. Nothing is stored while it follows the system. */
|
|
4
4
|
export declare const THEME_STORAGE_KEY = "ws-theme";
|
|
5
|
-
/** The theme chosen by hand, or `system`. */
|
|
5
|
+
/** The theme chosen by hand, with data-theme or a dark or light class, or `system`. */
|
|
6
6
|
export declare function getThemeChoice(): ThemeChoice;
|
|
7
7
|
/** The theme the page shows right now. */
|
|
8
8
|
export declare function getTheme(): Theme;
|
package/dist/theme/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The theme switch. The stylesheet does the work: dark is the default, light applies when
|
|
3
|
-
* the system asks for it, and data-theme="dark" or "light" on <html> overrides both
|
|
4
|
-
*
|
|
5
|
-
* the browser's own bars, such as a phone's
|
|
3
|
+
* the system asks for it, and data-theme="dark" or "light" on <html> overrides both, as does
|
|
4
|
+
* a dark or light class where there is no data-theme. This module sets the attribute by hand
|
|
5
|
+
* and remembers the choice. The head script keeps the browser's own bars, such as a phone's
|
|
6
|
+
* address bar, at the background of the theme shown.
|
|
6
7
|
*/
|
|
7
8
|
import { themeColorScript } from "./color.js";
|
|
8
9
|
/** Where the choice is kept in localStorage. Nothing is stored while it follows the system. */
|
|
@@ -18,10 +19,21 @@ function stored() {
|
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
/** The theme
|
|
22
|
+
/** The theme a dark or light class on <html> chooses, as a color mode library sets it. */
|
|
23
|
+
function classTheme() {
|
|
24
|
+
const { classList } = document.documentElement;
|
|
25
|
+
const dark = classList.contains('dark');
|
|
26
|
+
if (dark === classList.contains('light'))
|
|
27
|
+
return null;
|
|
28
|
+
return dark ? 'dark' : 'light';
|
|
29
|
+
}
|
|
30
|
+
/** The theme chosen by hand, with data-theme or a dark or light class, or `system`. */
|
|
22
31
|
export function getThemeChoice() {
|
|
23
32
|
const attribute = document.documentElement.dataset.theme;
|
|
24
|
-
|
|
33
|
+
if (isTheme(attribute))
|
|
34
|
+
return attribute;
|
|
35
|
+
// on one element data-theme wins over the class, as in the stylesheet
|
|
36
|
+
return (attribute === undefined ? classTheme() : null) ?? stored() ?? 'system';
|
|
25
37
|
}
|
|
26
38
|
/** The theme the page shows right now. */
|
|
27
39
|
export function getTheme() {
|
package/dist/theme/init.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Applies a remembered theme before the first paint, and keeps theme-color in step with the theme shown. Generated from src/theme/index.ts.
|
|
2
|
-
(function(){try{var t=localStorage.getItem("ws-theme");if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})();(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue("--ws-color-bg").trim(),m=d.querySelectorAll("meta[name=\"theme-color\"]");if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()
|
|
2
|
+
(function(){try{var t=localStorage.getItem("ws-theme");if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})();(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue("--ws-color-bg").trim(),m=d.querySelectorAll("meta[name=\"theme-color\"]");if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme','class']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *),
|
|
2
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *) {
|
|
3
|
+
display: none !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *),
|
|
7
|
+
:is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *) {
|
|
8
|
+
display: none !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (prefers-color-scheme: light) {
|
|
12
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
13
|
+
display: none !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@media not (prefers-color-scheme: light) {
|
|
18
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
|
|
19
|
+
display: none !important;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/tokens.css
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Dark is the default. Light applies when the system asks for it, and data-theme="dark" or
|
|
13
13
|
* data-theme="light" on any element overrides both for that element and everything inside it.
|
|
14
|
+
* So does a dark or light class, where the element has no data-theme.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
:root {
|
|
@@ -348,7 +349,8 @@
|
|
|
348
349
|
}
|
|
349
350
|
|
|
350
351
|
:root,
|
|
351
|
-
[data-theme='dark']
|
|
352
|
+
[data-theme='dark'],
|
|
353
|
+
.dark:where(:not([data-theme], .light)) {
|
|
352
354
|
color-scheme: dark;
|
|
353
355
|
/* Page background. */
|
|
354
356
|
--ws-color-bg: var(--ws-palette-main-base);
|
|
@@ -410,7 +412,8 @@
|
|
|
410
412
|
--ws-color-warning-tint: #f6c17717;
|
|
411
413
|
}
|
|
412
414
|
|
|
413
|
-
[data-theme='light']
|
|
415
|
+
[data-theme='light'],
|
|
416
|
+
.light:where(:not([data-theme], .dark)) {
|
|
414
417
|
color-scheme: light;
|
|
415
418
|
/* Page background. */
|
|
416
419
|
--ws-color-bg: var(--ws-palette-dawn-base);
|
|
@@ -473,7 +476,7 @@
|
|
|
473
476
|
}
|
|
474
477
|
|
|
475
478
|
@media (prefers-color-scheme: light) {
|
|
476
|
-
:root:not([data-theme]) {
|
|
479
|
+
:root:not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) {
|
|
477
480
|
color-scheme: light;
|
|
478
481
|
/* Page background. */
|
|
479
482
|
--ws-color-bg: var(--ws-palette-dawn-base);
|
|
@@ -5,7 +5,8 @@ import { whatsaaaaMarkdown } from "./markdown.js";
|
|
|
5
5
|
export { whatsaaaaMarkdown } from "./markdown.js";
|
|
6
6
|
/**
|
|
7
7
|
* Sets data-theme before the first paint, from the choice VitePress remembers.
|
|
8
|
-
* VitePress itself only sets its `dark` class, which the tokens
|
|
8
|
+
* VitePress itself only sets its `dark` class, and no class for light, which the tokens would
|
|
9
|
+
* read as the system's theme.
|
|
9
10
|
* Where storage is blocked nothing is remembered, and the page follows the system.
|
|
10
11
|
*/
|
|
11
12
|
const themeScript = `;(() => {
|
package/docs/usage.md
CHANGED
|
@@ -66,7 +66,7 @@ The pairs that are checked for contrast are in `tokens/contrast.json`. If you ne
|
|
|
66
66
|
|
|
67
67
|
## 3. Theme
|
|
68
68
|
|
|
69
|
-
Dark is the default. Light applies when the system asks for it. `data-theme="dark"` or `data-theme="light"` on `<html>` overrides the system. Do not write your own `prefers-color-scheme` rules: the tokens already switch, and an element that has to differ by theme takes a class.
|
|
69
|
+
Dark is the default. Light applies when the system asks for it. `data-theme="dark"` or `data-theme="light"` on `<html>` overrides the system, and so does a `dark` or `light` class, as Nuxt UI and VueUse's `useColorMode` set it. A library that marks light only by leaving `dark` off, such as the toggle script in Tailwind's docs or VueUse's `useDark`, needs a `light` class kept in step with it: on when light is chosen, off for dark or the system. For Tailwind's script that is `classList.toggle('light', localStorage.theme === 'light')` next to its toggle of `dark`. With no class the system decides. Do not write your own `prefers-color-scheme` rules: the tokens already switch, and an element that has to differ by theme takes a class.
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
72
|
import { getTheme, setTheme, toggleTheme, themeInitScript } from '@whatsaaaa/design-system/theme'
|
|
@@ -77,7 +77,7 @@ setTheme('system') // follows the system again
|
|
|
77
77
|
|
|
78
78
|
Run the head script before the stylesheet, so a remembered choice applies before the first paint. Inline `themeInitScript` in a `<script>`, or load it as a file: `<script src=".../theme/init.js"></script>`. It is a plain script, not a module.
|
|
79
79
|
|
|
80
|
-
The browser's own bars, such as a phone's address bar, take the background of the theme shown, `--ws-color-bg`. The head script keeps `<meta name="theme-color">` at it from the first paint on, when the theme is chosen by hand, with `setTheme`, `toggleTheme` or anything else that sets `data-theme
|
|
80
|
+
The browser's own bars, such as a phone's address bar, take the background of the theme shown, `--ws-color-bg`. The head script keeps `<meta name="theme-color">` at it from the first paint on, when the theme is chosen by hand, with `setTheme`, `toggleTheme` or anything else that sets `data-theme` or the class of `<html>`, and when the system's theme changes. A page that has no theme-color tag gets one, so the head needs no tag of its own and no color in it:
|
|
81
81
|
|
|
82
82
|
```html
|
|
83
83
|
<head>
|
|
@@ -91,7 +91,7 @@ The browser's own bars, such as a phone's address bar, take the background of th
|
|
|
91
91
|
|
|
92
92
|
A theme-color tag that is there, with or without `media`, takes the theme's color too. Do not set it from a script of your own. A docs site gets the same script from the base config of the docs theme.
|
|
93
93
|
|
|
94
|
-
An element for one theme only, such as a cut of a mark, takes `ws-theme-dark` or `ws-theme-light`. Put both in the page and the styles show the one of the theme in effect where it stands: the nearest `data-theme
|
|
94
|
+
An element for one theme only, such as a cut of a mark, takes `ws-theme-dark` or `ws-theme-light`. Put both in the page and the styles show the one of the theme in effect where it stands: the nearest `data-theme` or `dark` or `light` class, on `<html>` or on an element around it, or the system's theme. So the right one shows before any script runs. Do not swap them from a script.
|
|
95
95
|
|
|
96
96
|
```html
|
|
97
97
|
<img class="ws-theme-dark" src="mark-on-dark.svg" alt="whatsaaaa" width="32" height="32" />
|
|
@@ -100,7 +100,15 @@ An element for one theme only, such as a cut of a mark, takes `ws-theme-dark` or
|
|
|
100
100
|
|
|
101
101
|
On a page with a status line, its theme button is the theme switch at every width: see [the status line](#status-line).
|
|
102
102
|
|
|
103
|
-
`data-theme` also works on any element, to keep a part of a page in one theme.
|
|
103
|
+
`data-theme` also works on any element, to keep a part of a page in one theme, and so does the class. Where they meet:
|
|
104
|
+
|
|
105
|
+
- On one element, `data-theme` wins over the class. An element with both the `dark` and the `light` class chooses nothing.
|
|
106
|
+
- The nearest choice around an element holds for it, made either way: a `light` part in a page with `data-theme="dark"` is light.
|
|
107
|
+
- Any choice, the attribute or the class, wins over the system's theme.
|
|
108
|
+
|
|
109
|
+
So a `dark` or `light` class you give an element for something else puts what is inside it in that theme. Use another name for it.
|
|
110
|
+
|
|
111
|
+
`setTheme` and `toggleTheme` write `data-theme`, and `getTheme` reads it, then the class of `<html>`. In an app whose color mode library owns the class, such as Nuxt UI or `useColorMode`, switch the theme with the library and leave `data-theme` alone: do not call `setTheme` or `toggleTheme`, because the attribute they write wins over the library's class from then on. Keep the head script for the browser's bars. With nothing remembered under `ws-theme` it sets no `data-theme`, and it follows the class. So do not give the library that storage key. An app that called `setTheme` or `toggleTheme` before, such as from a script that bridged the two, has visitors with a choice still remembered there. Remove it before the head script runs, with `localStorage.removeItem('ws-theme')`, or the `data-theme` the head script sets from it wins over the library's class on every load.
|
|
104
112
|
|
|
105
113
|
## 4. Type
|
|
106
114
|
|
package/licenses/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Licenses of what the system builds on
|
|
2
2
|
|
|
3
|
+
The design system is under the MIT License, in [`LICENSE`](../LICENSE). The third-party material below keeps its own license.
|
|
4
|
+
|
|
3
5
|
| What | License | Where it is used | File |
|
|
4
6
|
| --- | --- | --- | --- |
|
|
5
7
|
| Rosé Pine palette, from `@rose-pine/palette` | MIT, Copyright (c) mvllow | The color values in `tokens/palette.tokens.json` and everything built from them | `rose-pine-palette.LICENSE` |
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whatsaaaa/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Whatsaaaa's design system: brand identity, design tokens, typography, docs theme and asset kit",
|
|
5
5
|
"homepage": "https://github.com/whatsaaaa/design-system#readme",
|
|
6
6
|
"bugs": "https://github.com/whatsaaaa/design-system/issues",
|
|
7
|
-
"license": "
|
|
7
|
+
"license": "(MIT AND OFL-1.1)",
|
|
8
8
|
"author": "Whatsaaaa",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
package/src/vitepress/Layout.vue
CHANGED
|
@@ -14,7 +14,8 @@ const { isDark } = useData()
|
|
|
14
14
|
/** The slots this layout fills itself. A site's content for them goes inside, next to the theme's. */
|
|
15
15
|
const OWN_SLOTS = ['nav-bar-content-after', 'doc-before', 'not-found', 'layout-bottom']
|
|
16
16
|
|
|
17
|
-
// VitePress marks dark with a class on <html
|
|
17
|
+
// VitePress marks dark with a dark class on <html> and light with no class, which the tokens
|
|
18
|
+
// read as the system's theme. So data-theme says both.
|
|
18
19
|
watchEffect(() => {
|
|
19
20
|
if (inBrowser) document.documentElement.dataset.theme = isDark.value ? 'dark' : 'light'
|
|
20
21
|
})
|