@whatsaaaa/design-system 0.1.1 → 0.3.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 +5 -5
- package/README.md +10 -10
- package/assets/manifest.json +6 -0
- package/assets/whatsaaaa/profile-banner.png +0 -0
- package/dist/css/terminal.css +73 -28
- package/dist/css/theme.css +19 -0
- package/dist/index.css +73 -28
- package/dist/theme/color.d.ts +14 -0
- package/dist/theme/color.js +16 -0
- package/dist/theme/index.d.ts +2 -5
- package/dist/theme/index.js +6 -2
- package/dist/theme/init.js +2 -2
- package/dist/vitepress-config/index.js +7 -0
- package/docs/usage.md +50 -4
- package/package.json +1 -1
- package/src/vitepress/components/StatusLine.vue +3 -9
- package/src/vitepress/styles/layout.css +5 -0
package/LICENSE
CHANGED
|
@@ -6,11 +6,11 @@ the docs theme among them, are provided under the MIT License that follows.
|
|
|
6
6
|
The Whatsaaaa identity artwork is excluded from the MIT License. It is
|
|
7
7
|
Copyright (c) 2026 Whatsaaaa, all rights reserved. It is the ghost, the
|
|
8
8
|
wordmark, the lockups and marks, the sprite and mark of each project, the README
|
|
9
|
-
headers, the social cards and the favicons, as the generated
|
|
10
|
-
as the drawings encoded in `src/identity/` and `identity/`,
|
|
11
|
-
drawings compiled into the package in `dist/identity/` and
|
|
12
|
-
code that turns those drawings into files and markup is
|
|
13
|
-
the drawings are not.
|
|
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
14
|
|
|
15
15
|
The artwork may be redistributed unmodified as part of this package and of
|
|
16
16
|
builds made with it, as the <ws-ghost> element and the docs theme carry it. It
|
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ The package is [`@whatsaaaa/design-system`](https://www.npmjs.com/package/@whats
|
|
|
8
8
|
|
|
9
9
|
## What is in it
|
|
10
10
|
|
|
11
|
-
| Part | What it is
|
|
12
|
-
| ----------------------- |
|
|
13
|
-
| Identity | The ghost in every cut, the wordmark, six poses, a sprite per project, favicons, README headers and
|
|
14
|
-
| Tokens | Rosé Pine main for dark and Dawn for light, mapped to roles, with type, space, radii and motion
|
|
15
|
-
| Styles | Prose, code blocks, tables, lists, callouts, and the terminal frame: tab bar, prompts, status line
|
|
16
|
-
| The ghost as an element | `<ws-ghost>`, with the easter egg
|
|
17
|
-
| Docs theme | A VitePress theme on top of VitePress's default theme
|
|
18
|
-
| Style guide | A site that shows all of it with real content, in dark and light, and offers the assets for download
|
|
11
|
+
| Part | What it is | Source |
|
|
12
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
|
|
13
|
+
| Identity | The ghost in every cut, the wordmark, six poses, a sprite per project, favicons, README headers, social cards and a profile banner. All generated | `src/identity/ghost.ts`, `identity/` |
|
|
14
|
+
| Tokens | Rosé Pine main for dark and Dawn for light, mapped to roles, with type, space, radii and motion | `tokens/` |
|
|
15
|
+
| Styles | Prose, code blocks, tables, lists, callouts, and the terminal frame: tab bar, prompts, status line | `src/css/` |
|
|
16
|
+
| The ghost as an element | `<ws-ghost>`, with the easter egg | `src/ghost/` |
|
|
17
|
+
| Docs theme | A VitePress theme on top of VitePress's default theme | `src/vitepress/`, `src/vitepress-config/` |
|
|
18
|
+
| Style guide | A site that shows all of it with real content, in dark and light, and offers the assets for download | `styleguide/` |
|
|
19
19
|
|
|
20
20
|
To use it in another project, install it with `pnpm add @whatsaaaa/design-system` and read [docs/usage.md](./docs/usage.md). It is written for coding agents and is short.
|
|
21
21
|
|
|
@@ -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, a control that takes the focus is not left under the status line, 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, 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
|
|
|
@@ -123,7 +123,7 @@ The licenses are in [`licenses/`](./licenses/).
|
|
|
123
123
|
|
|
124
124
|
The code and the styles are [MIT](./LICENSE): the tokens, the stylesheets, the scripts, `<ws-ghost>`, the theme, shortcut and code-theme modules and the docs theme.
|
|
125
125
|
|
|
126
|
-
The Whatsaaaa identity is not: the ghost, the wordmark, the lockups and marks, the sprite and mark of each project, the README headers, the social cards and the favicons, in `assets/`, as drawn in `src/identity/` and `identity/`, and as compiled into `dist/identity/` and `dist/ghost/`, are all rights reserved. [LICENSE](./LICENSE) says which is which.
|
|
126
|
+
The Whatsaaaa identity is not: 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, in `assets/`, as drawn in `src/identity/` and `identity/`, and as compiled into `dist/identity/` and `dist/ghost/`, are all rights reserved. [LICENSE](./LICENSE) says which is which.
|
|
127
127
|
|
|
128
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
129
|
|
package/assets/manifest.json
CHANGED
|
@@ -187,6 +187,12 @@
|
|
|
187
187
|
"width": 1280,
|
|
188
188
|
"height": 640,
|
|
189
189
|
"use": "Social card as an image, the size link previews ask for."
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"file": "profile-banner.png",
|
|
193
|
+
"width": 1280,
|
|
194
|
+
"height": 288,
|
|
195
|
+
"use": "The profile banner as an image, at twice its size. Upload this one to Gravatar."
|
|
190
196
|
}
|
|
191
197
|
],
|
|
192
198
|
"building-blocks": [
|
|
Binary file
|
package/dist/css/terminal.css
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
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"] *) {
|
|
6
|
+
display: none !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@media (prefers-color-scheme: light) {
|
|
10
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media not (prefers-color-scheme: light) {
|
|
16
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
|
|
17
|
+
display: none !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
.ws-term {
|
|
2
22
|
border: var(--ws-border-width-thin) solid var(--ws-color-border);
|
|
3
23
|
border-radius: var(--ws-radius-xl);
|
|
@@ -24,6 +44,8 @@
|
|
|
24
44
|
.ws-tab-bar__brand {
|
|
25
45
|
align-items: center;
|
|
26
46
|
gap: var(--ws-space-10);
|
|
47
|
+
margin-inline: calc(-1 * var(--ws-space-10));
|
|
48
|
+
padding-inline: var(--ws-space-10);
|
|
27
49
|
color: var(--ws-color-text);
|
|
28
50
|
font-weight: var(--ws-font-weight-extrabold);
|
|
29
51
|
letter-spacing: -.02em;
|
|
@@ -33,6 +55,10 @@
|
|
|
33
55
|
display: flex;
|
|
34
56
|
}
|
|
35
57
|
|
|
58
|
+
.ws-tab-bar__brand:focus-visible {
|
|
59
|
+
outline-offset: calc(-1 * var(--ws-border-width-medium));
|
|
60
|
+
}
|
|
61
|
+
|
|
36
62
|
.ws-tab-bar__brand a {
|
|
37
63
|
color: inherit;
|
|
38
64
|
text-decoration: none;
|
|
@@ -81,6 +107,10 @@
|
|
|
81
107
|
color: var(--ws-color-text);
|
|
82
108
|
}
|
|
83
109
|
|
|
110
|
+
.ws-tabs a:focus-visible {
|
|
111
|
+
outline-offset: calc(-1 * var(--ws-border-width-medium));
|
|
112
|
+
}
|
|
113
|
+
|
|
84
114
|
.ws-tabs a[aria-current]:not([aria-current="false"]) {
|
|
85
115
|
border-color: var(--ws-color-border);
|
|
86
116
|
background: var(--ws-color-surface);
|
|
@@ -263,6 +293,13 @@
|
|
|
263
293
|
letter-spacing: .04em;
|
|
264
294
|
}
|
|
265
295
|
|
|
296
|
+
.ws-status-line__path {
|
|
297
|
+
flex: 1;
|
|
298
|
+
min-width: 0;
|
|
299
|
+
display: flex;
|
|
300
|
+
container: ws-status-line-path / inline-size;
|
|
301
|
+
}
|
|
302
|
+
|
|
266
303
|
.ws-status-line__file {
|
|
267
304
|
background: var(--ws-color-raised);
|
|
268
305
|
min-width: 0;
|
|
@@ -275,24 +312,14 @@
|
|
|
275
312
|
overflow: hidden;
|
|
276
313
|
}
|
|
277
314
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
[data-theme="dark"] .ws-status-line__item--light, [data-theme="light"] .ws-status-line__item--dark {
|
|
283
|
-
display: none;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
@media (prefers-color-scheme: light) {
|
|
287
|
-
:root:not([data-theme]) .ws-status-line__item--dark {
|
|
315
|
+
@container ws-status-line-path (width < calc(2ch + 1.75rem)) {
|
|
316
|
+
.ws-status-line__file {
|
|
288
317
|
display: none;
|
|
289
318
|
}
|
|
290
319
|
}
|
|
291
320
|
|
|
292
|
-
|
|
293
|
-
:
|
|
294
|
-
display: none;
|
|
295
|
-
}
|
|
321
|
+
.ws-status-line__item--edge {
|
|
322
|
+
border-left: var(--ws-border-width-thin) solid var(--ws-color-border);
|
|
296
323
|
}
|
|
297
324
|
|
|
298
325
|
.ws-status-line__keys {
|
|
@@ -323,28 +350,25 @@
|
|
|
323
350
|
}
|
|
324
351
|
|
|
325
352
|
.ws-status-line__keys :is(button, a) {
|
|
353
|
+
align-self: stretch;
|
|
326
354
|
align-items: center;
|
|
327
355
|
gap: var(--ws-space-6);
|
|
356
|
+
margin: 0 calc(-1 * var(--ws-space-6));
|
|
357
|
+
padding: 0 var(--ws-space-6);
|
|
328
358
|
color: inherit;
|
|
329
359
|
font: inherit;
|
|
330
360
|
cursor: pointer;
|
|
331
361
|
background: none;
|
|
332
362
|
border: 0;
|
|
333
|
-
margin: 0;
|
|
334
|
-
padding: 0;
|
|
335
363
|
text-decoration: none;
|
|
336
364
|
display: flex;
|
|
337
365
|
}
|
|
338
366
|
|
|
339
|
-
.ws-status-line__keys :is(button, a):
|
|
340
|
-
|
|
367
|
+
.ws-status-line__keys > * > :is(button, a) + :is(button, a) {
|
|
368
|
+
margin-left: 0;
|
|
341
369
|
}
|
|
342
370
|
|
|
343
|
-
.ws-status-
|
|
344
|
-
outline-offset: 2px;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.ws-status-line__switch {
|
|
371
|
+
.ws-status-line__switch, .ws-status-line__theme {
|
|
348
372
|
align-items: center;
|
|
349
373
|
gap: var(--ws-space-6);
|
|
350
374
|
padding: 0 var(--ws-space-14);
|
|
@@ -356,14 +380,14 @@
|
|
|
356
380
|
background: none;
|
|
357
381
|
flex: none;
|
|
358
382
|
margin: 0;
|
|
359
|
-
display:
|
|
383
|
+
display: flex;
|
|
360
384
|
}
|
|
361
385
|
|
|
362
|
-
.ws-status-line__switch[aria-checked] {
|
|
363
|
-
display:
|
|
386
|
+
.ws-status-line__switch:not([aria-checked]) {
|
|
387
|
+
display: none;
|
|
364
388
|
}
|
|
365
389
|
|
|
366
|
-
.ws-status-line__switch:hover, .ws-status-line__on, .ws-status-line__off {
|
|
390
|
+
.ws-status-line__keys :is(button, a):hover, .ws-status-line__switch:hover, .ws-status-line__theme:hover, .ws-status-line__on, .ws-status-line__off {
|
|
367
391
|
color: var(--ws-color-text);
|
|
368
392
|
}
|
|
369
393
|
|
|
@@ -371,10 +395,26 @@
|
|
|
371
395
|
display: none;
|
|
372
396
|
}
|
|
373
397
|
|
|
374
|
-
.ws-status-line__switch:focus-visible {
|
|
398
|
+
.ws-status-line__keys :is(button, a):focus-visible, .ws-status-line__switch:focus-visible, .ws-status-line__theme:focus-visible {
|
|
375
399
|
outline-offset: calc(-1 * var(--ws-border-width-medium));
|
|
376
400
|
}
|
|
377
401
|
|
|
402
|
+
.ws-term .ws-status-line > :last-child:focus-visible {
|
|
403
|
+
border-bottom-right-radius: calc(var(--ws-radius-xl) - var(--ws-border-width-thin));
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.ws-visually-hidden {
|
|
407
|
+
clip-path: inset(50%);
|
|
408
|
+
white-space: nowrap;
|
|
409
|
+
border: 0;
|
|
410
|
+
width: 1px;
|
|
411
|
+
height: 1px;
|
|
412
|
+
margin: -1px;
|
|
413
|
+
padding: 0;
|
|
414
|
+
position: absolute;
|
|
415
|
+
overflow: hidden;
|
|
416
|
+
}
|
|
417
|
+
|
|
378
418
|
@media (width < 64rem) {
|
|
379
419
|
.ws-tab-bar {
|
|
380
420
|
flex-wrap: wrap;
|
|
@@ -385,6 +425,11 @@
|
|
|
385
425
|
.ws-tab-bar__brand {
|
|
386
426
|
min-height: 2.75rem;
|
|
387
427
|
padding-left: var(--ws-space-16);
|
|
428
|
+
margin-left: 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.ws-term .ws-tab-bar__brand:focus-visible {
|
|
432
|
+
border-top-left-radius: calc(var(--ws-radius-xl) - var(--ws-border-width-thin));
|
|
388
433
|
}
|
|
389
434
|
|
|
390
435
|
.ws-tab-bar__end {
|
|
@@ -0,0 +1,19 @@
|
|
|
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"] *) {
|
|
6
|
+
display: none !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@media (prefers-color-scheme: light) {
|
|
10
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media not (prefers-color-scheme: light) {
|
|
16
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
|
|
17
|
+
display: none !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.css
CHANGED
|
@@ -884,6 +884,26 @@ 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"] *) {
|
|
892
|
+
display: none !important;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
@media (prefers-color-scheme: light) {
|
|
896
|
+
:is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
|
|
897
|
+
display: none !important;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
@media not (prefers-color-scheme: light) {
|
|
902
|
+
:is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
|
|
903
|
+
display: none !important;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
887
907
|
.ws-term {
|
|
888
908
|
border: var(--ws-border-width-thin) solid var(--ws-color-border);
|
|
889
909
|
border-radius: var(--ws-radius-xl);
|
|
@@ -910,6 +930,8 @@ code, kbd, samp, pre {
|
|
|
910
930
|
.ws-tab-bar__brand {
|
|
911
931
|
align-items: center;
|
|
912
932
|
gap: var(--ws-space-10);
|
|
933
|
+
margin-inline: calc(-1 * var(--ws-space-10));
|
|
934
|
+
padding-inline: var(--ws-space-10);
|
|
913
935
|
color: var(--ws-color-text);
|
|
914
936
|
font-weight: var(--ws-font-weight-extrabold);
|
|
915
937
|
letter-spacing: -.02em;
|
|
@@ -919,6 +941,10 @@ code, kbd, samp, pre {
|
|
|
919
941
|
display: flex;
|
|
920
942
|
}
|
|
921
943
|
|
|
944
|
+
.ws-tab-bar__brand:focus-visible {
|
|
945
|
+
outline-offset: calc(-1 * var(--ws-border-width-medium));
|
|
946
|
+
}
|
|
947
|
+
|
|
922
948
|
.ws-tab-bar__brand a {
|
|
923
949
|
color: inherit;
|
|
924
950
|
text-decoration: none;
|
|
@@ -967,6 +993,10 @@ code, kbd, samp, pre {
|
|
|
967
993
|
color: var(--ws-color-text);
|
|
968
994
|
}
|
|
969
995
|
|
|
996
|
+
.ws-tabs a:focus-visible {
|
|
997
|
+
outline-offset: calc(-1 * var(--ws-border-width-medium));
|
|
998
|
+
}
|
|
999
|
+
|
|
970
1000
|
.ws-tabs a[aria-current]:not([aria-current="false"]) {
|
|
971
1001
|
border-color: var(--ws-color-border);
|
|
972
1002
|
background: var(--ws-color-surface);
|
|
@@ -1149,6 +1179,13 @@ code, kbd, samp, pre {
|
|
|
1149
1179
|
letter-spacing: .04em;
|
|
1150
1180
|
}
|
|
1151
1181
|
|
|
1182
|
+
.ws-status-line__path {
|
|
1183
|
+
flex: 1;
|
|
1184
|
+
min-width: 0;
|
|
1185
|
+
display: flex;
|
|
1186
|
+
container: ws-status-line-path / inline-size;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1152
1189
|
.ws-status-line__file {
|
|
1153
1190
|
background: var(--ws-color-raised);
|
|
1154
1191
|
min-width: 0;
|
|
@@ -1161,24 +1198,14 @@ code, kbd, samp, pre {
|
|
|
1161
1198
|
overflow: hidden;
|
|
1162
1199
|
}
|
|
1163
1200
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
[data-theme="dark"] .ws-status-line__item--light, [data-theme="light"] .ws-status-line__item--dark {
|
|
1169
|
-
display: none;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
@media (prefers-color-scheme: light) {
|
|
1173
|
-
:root:not([data-theme]) .ws-status-line__item--dark {
|
|
1201
|
+
@container ws-status-line-path (width < calc(2ch + 1.75rem)) {
|
|
1202
|
+
.ws-status-line__file {
|
|
1174
1203
|
display: none;
|
|
1175
1204
|
}
|
|
1176
1205
|
}
|
|
1177
1206
|
|
|
1178
|
-
|
|
1179
|
-
:
|
|
1180
|
-
display: none;
|
|
1181
|
-
}
|
|
1207
|
+
.ws-status-line__item--edge {
|
|
1208
|
+
border-left: var(--ws-border-width-thin) solid var(--ws-color-border);
|
|
1182
1209
|
}
|
|
1183
1210
|
|
|
1184
1211
|
.ws-status-line__keys {
|
|
@@ -1209,28 +1236,25 @@ code, kbd, samp, pre {
|
|
|
1209
1236
|
}
|
|
1210
1237
|
|
|
1211
1238
|
.ws-status-line__keys :is(button, a) {
|
|
1239
|
+
align-self: stretch;
|
|
1212
1240
|
align-items: center;
|
|
1213
1241
|
gap: var(--ws-space-6);
|
|
1242
|
+
margin: 0 calc(-1 * var(--ws-space-6));
|
|
1243
|
+
padding: 0 var(--ws-space-6);
|
|
1214
1244
|
color: inherit;
|
|
1215
1245
|
font: inherit;
|
|
1216
1246
|
cursor: pointer;
|
|
1217
1247
|
background: none;
|
|
1218
1248
|
border: 0;
|
|
1219
|
-
margin: 0;
|
|
1220
|
-
padding: 0;
|
|
1221
1249
|
text-decoration: none;
|
|
1222
1250
|
display: flex;
|
|
1223
1251
|
}
|
|
1224
1252
|
|
|
1225
|
-
.ws-status-line__keys :is(button, a):
|
|
1226
|
-
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
.ws-status-line__keys :is(button, a):focus-visible {
|
|
1230
|
-
outline-offset: 2px;
|
|
1253
|
+
.ws-status-line__keys > * > :is(button, a) + :is(button, a) {
|
|
1254
|
+
margin-left: 0;
|
|
1231
1255
|
}
|
|
1232
1256
|
|
|
1233
|
-
.ws-status-line__switch {
|
|
1257
|
+
.ws-status-line__switch, .ws-status-line__theme {
|
|
1234
1258
|
align-items: center;
|
|
1235
1259
|
gap: var(--ws-space-6);
|
|
1236
1260
|
padding: 0 var(--ws-space-14);
|
|
@@ -1242,14 +1266,14 @@ code, kbd, samp, pre {
|
|
|
1242
1266
|
background: none;
|
|
1243
1267
|
flex: none;
|
|
1244
1268
|
margin: 0;
|
|
1245
|
-
display:
|
|
1269
|
+
display: flex;
|
|
1246
1270
|
}
|
|
1247
1271
|
|
|
1248
|
-
.ws-status-line__switch[aria-checked] {
|
|
1249
|
-
display:
|
|
1272
|
+
.ws-status-line__switch:not([aria-checked]) {
|
|
1273
|
+
display: none;
|
|
1250
1274
|
}
|
|
1251
1275
|
|
|
1252
|
-
.ws-status-line__switch:hover, .ws-status-line__on, .ws-status-line__off {
|
|
1276
|
+
.ws-status-line__keys :is(button, a):hover, .ws-status-line__switch:hover, .ws-status-line__theme:hover, .ws-status-line__on, .ws-status-line__off {
|
|
1253
1277
|
color: var(--ws-color-text);
|
|
1254
1278
|
}
|
|
1255
1279
|
|
|
@@ -1257,10 +1281,26 @@ code, kbd, samp, pre {
|
|
|
1257
1281
|
display: none;
|
|
1258
1282
|
}
|
|
1259
1283
|
|
|
1260
|
-
.ws-status-line__switch:focus-visible {
|
|
1284
|
+
.ws-status-line__keys :is(button, a):focus-visible, .ws-status-line__switch:focus-visible, .ws-status-line__theme:focus-visible {
|
|
1261
1285
|
outline-offset: calc(-1 * var(--ws-border-width-medium));
|
|
1262
1286
|
}
|
|
1263
1287
|
|
|
1288
|
+
.ws-term .ws-status-line > :last-child:focus-visible {
|
|
1289
|
+
border-bottom-right-radius: calc(var(--ws-radius-xl) - var(--ws-border-width-thin));
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
.ws-visually-hidden {
|
|
1293
|
+
clip-path: inset(50%);
|
|
1294
|
+
white-space: nowrap;
|
|
1295
|
+
border: 0;
|
|
1296
|
+
width: 1px;
|
|
1297
|
+
height: 1px;
|
|
1298
|
+
margin: -1px;
|
|
1299
|
+
padding: 0;
|
|
1300
|
+
position: absolute;
|
|
1301
|
+
overflow: hidden;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1264
1304
|
@media (width < 64rem) {
|
|
1265
1305
|
.ws-tab-bar {
|
|
1266
1306
|
flex-wrap: wrap;
|
|
@@ -1271,6 +1311,11 @@ code, kbd, samp, pre {
|
|
|
1271
1311
|
.ws-tab-bar__brand {
|
|
1272
1312
|
min-height: 2.75rem;
|
|
1273
1313
|
padding-left: var(--ws-space-16);
|
|
1314
|
+
margin-left: 0;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
.ws-term .ws-tab-bar__brand:focus-visible {
|
|
1318
|
+
border-top-left-radius: calc(var(--ws-radius-xl) - var(--ws-border-width-thin));
|
|
1274
1319
|
}
|
|
1275
1320
|
|
|
1276
1321
|
.ws-tab-bar__end {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The color of the browser's own bars, such as a phone's address bar: the background of the
|
|
3
|
+
* theme the page shows. It is read from the --ws-color-bg token where the stylesheet sets it,
|
|
4
|
+
* on <html>, so it is the token's value in whatever theme applies, with no copy of it here.
|
|
5
|
+
*
|
|
6
|
+
* Every <meta name="theme-color"> of the page gets it, and a page that has none gets one.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
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 on <html> changes, whoever changes it,
|
|
11
|
+
* and when the system's theme changes. The first paint waits for the stylesheets in the
|
|
12
|
+
* <head>, and so does the first animation frame.
|
|
13
|
+
*/
|
|
14
|
+
export declare const themeColorScript: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The color of the browser's own bars, such as a phone's address bar: the background of the
|
|
3
|
+
* theme the page shows. It is read from the --ws-color-bg token where the stylesheet sets it,
|
|
4
|
+
* on <html>, so it is the token's value in whatever theme applies, with no copy of it here.
|
|
5
|
+
*
|
|
6
|
+
* Every <meta name="theme-color"> of the page gets it, and a page that has none gets one.
|
|
7
|
+
*/
|
|
8
|
+
const TAGS = 'meta[name="theme-color"]';
|
|
9
|
+
const TOKEN = '--ws-color-bg';
|
|
10
|
+
/**
|
|
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 on <html> changes, whoever changes it,
|
|
13
|
+
* and when the system's theme changes. The first paint waits for the stylesheets in the
|
|
14
|
+
* <head>, and so does the first animation frame.
|
|
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)})()`;
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
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
|
-
* This module sets that attribute by hand and remembers the choice.
|
|
5
|
-
*/
|
|
6
1
|
export type Theme = 'dark' | 'light';
|
|
7
2
|
export type ThemeChoice = Theme | 'system';
|
|
8
3
|
/** Where the choice is kept in localStorage. Nothing is stored while it follows the system. */
|
|
@@ -18,6 +13,8 @@ export declare function toggleTheme(): Theme;
|
|
|
18
13
|
/**
|
|
19
14
|
* A script for the <head>, before any stylesheet, that applies a remembered choice before
|
|
20
15
|
* the first paint. Without it a page chosen dark by hand flashes light on a light system.
|
|
16
|
+
* It also keeps <meta name="theme-color"> at the background of the theme shown, from the
|
|
17
|
+
* first paint on, when the theme is chosen by hand and when the system's theme changes.
|
|
21
18
|
*
|
|
22
19
|
* <script>{themeInitScript}</script>
|
|
23
20
|
*/
|
package/dist/theme/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The theme switch. The stylesheet does the work: dark is the default, light applies when
|
|
3
3
|
* the system asks for it, and data-theme="dark" or "light" on <html> overrides both.
|
|
4
|
-
* This module sets that attribute by hand and remembers the choice.
|
|
4
|
+
* This module sets that attribute by hand and remembers the choice. The head script keeps
|
|
5
|
+
* the browser's own bars, such as a phone's address bar, at the background of the theme shown.
|
|
5
6
|
*/
|
|
7
|
+
import { themeColorScript } from "./color.js";
|
|
6
8
|
/** Where the choice is kept in localStorage. Nothing is stored while it follows the system. */
|
|
7
9
|
export const THEME_STORAGE_KEY = 'ws-theme';
|
|
8
10
|
const isTheme = (value) => value === 'dark' || value === 'light';
|
|
@@ -54,7 +56,9 @@ export function toggleTheme() {
|
|
|
54
56
|
/**
|
|
55
57
|
* A script for the <head>, before any stylesheet, that applies a remembered choice before
|
|
56
58
|
* the first paint. Without it a page chosen dark by hand flashes light on a light system.
|
|
59
|
+
* It also keeps <meta name="theme-color"> at the background of the theme shown, from the
|
|
60
|
+
* first paint on, when the theme is chosen by hand and when the system's theme changes.
|
|
57
61
|
*
|
|
58
62
|
* <script>{themeInitScript}</script>
|
|
59
63
|
*/
|
|
60
|
-
export const themeInitScript = `(function(){try{var t=localStorage.getItem(${JSON.stringify(THEME_STORAGE_KEY)});if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})()`;
|
|
64
|
+
export const themeInitScript = `(function(){try{var t=localStorage.getItem(${JSON.stringify(THEME_STORAGE_KEY)});if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})();${themeColorScript}`;
|
package/dist/theme/init.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// Applies a remembered theme before the first paint. 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){}})()
|
|
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)})()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { codeTheme } from "../shiki/index.js";
|
|
2
2
|
import { keysInitScript } from "../shortcuts/index.js";
|
|
3
|
+
import { themeColorScript } from "../theme/color.js";
|
|
3
4
|
import { whatsaaaaMarkdown } from "./markdown.js";
|
|
4
5
|
export { whatsaaaaMarkdown } from "./markdown.js";
|
|
5
6
|
/**
|
|
@@ -19,6 +20,8 @@ export function whatsaaaaConfig() {
|
|
|
19
20
|
return {
|
|
20
21
|
head: [
|
|
21
22
|
['script', { id: 'ws-theme' }, themeScript],
|
|
23
|
+
// the browser's own bars take the background of the theme shown, as VitePress switches it
|
|
24
|
+
['script', { id: 'ws-theme-color' }, themeColorScript],
|
|
22
25
|
// keys that are remembered as off are off from the first paint: no tab shows its number
|
|
23
26
|
['script', { id: 'ws-keys' }, keysInitScript],
|
|
24
27
|
],
|
|
@@ -26,6 +29,10 @@ export function whatsaaaaConfig() {
|
|
|
26
29
|
// one code theme for both page themes: code blocks stay dark
|
|
27
30
|
theme: codeTheme,
|
|
28
31
|
config: whatsaaaaMarkdown,
|
|
32
|
+
// VitePress loads a language when a block of it comes, but the HTML in a Markdown block
|
|
33
|
+
// is not a block of its own. Without this, it has its colors only on a build where an
|
|
34
|
+
// HTML block happened to come first.
|
|
35
|
+
shikiSetup: (highlighter) => highlighter.loadLanguage('html-derivative'),
|
|
29
36
|
},
|
|
30
37
|
vite: {
|
|
31
38
|
// the theme ships as source, so the site's own build compiles it
|
package/docs/usage.md
CHANGED
|
@@ -26,7 +26,8 @@ Or take pieces. `tokens.css` and `fonts.css` first, then what you use:
|
|
|
26
26
|
| `@whatsaaaa/design-system/css/prose.css` | Long-form text, in a `.ws-prose` container |
|
|
27
27
|
| `@whatsaaaa/design-system/css/code.css` | `.ws-code`, a code block with a caption |
|
|
28
28
|
| `@whatsaaaa/design-system/css/callout.css` | `.ws-callout` |
|
|
29
|
-
| `@whatsaaaa/design-system/css/terminal.css` | Tab bar, prompts, status line, key caps, tags
|
|
29
|
+
| `@whatsaaaa/design-system/css/terminal.css` | Tab bar, prompts, status line, key caps, tags. It brings `theme.css` along |
|
|
30
|
+
| `@whatsaaaa/design-system/css/theme.css` | `ws-theme-dark` and `ws-theme-light`, for an element of one theme only |
|
|
30
31
|
| `@whatsaaaa/design-system/css/ghost.css` | Styles of `<ws-ghost>` |
|
|
31
32
|
| `@whatsaaaa/design-system/css/icons.css` | The icons the callouts and prompts draw. Needed with `callout.css` and `terminal.css` |
|
|
32
33
|
|
|
@@ -65,7 +66,7 @@ The pairs that are checked for contrast are in `tokens/contrast.json`. If you ne
|
|
|
65
66
|
|
|
66
67
|
## 3. Theme
|
|
67
68
|
|
|
68
|
-
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.
|
|
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
70
|
|
|
70
71
|
```ts
|
|
71
72
|
import { getTheme, setTheme, toggleTheme, themeInitScript } from '@whatsaaaa/design-system/theme'
|
|
@@ -76,7 +77,28 @@ setTheme('system') // follows the system again
|
|
|
76
77
|
|
|
77
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.
|
|
78
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`, 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
|
+
|
|
82
|
+
```html
|
|
83
|
+
<head>
|
|
84
|
+
<meta charset="utf-8" />
|
|
85
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
86
|
+
<script src=".../theme/init.js"></script>
|
|
87
|
+
<script src=".../shortcuts/init.js"></script>
|
|
88
|
+
<link rel="stylesheet" href=".../index.css" />
|
|
89
|
+
</head>
|
|
90
|
+
```
|
|
91
|
+
|
|
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
|
+
|
|
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`, 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
|
+
|
|
96
|
+
```html
|
|
97
|
+
<img class="ws-theme-dark" src="mark-on-dark.svg" alt="whatsaaaa" width="32" height="32" />
|
|
98
|
+
<img class="ws-theme-light" src="mark-on-light.svg" alt="whatsaaaa" width="32" height="32" />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
On a page with a status line, its theme button is the theme switch at every width: see [the status line](#status-line).
|
|
80
102
|
|
|
81
103
|
`data-theme` also works on any element, to keep a part of a page in one theme.
|
|
82
104
|
|
|
@@ -111,10 +133,33 @@ Do not load other fonts, and do not load these from a CDN. Set `font-variant-lig
|
|
|
111
133
|
- Code block with a caption: `<figure class="ws-code"><figcaption><span>file.ts</span><span>ts</span></figcaption><pre><code>...</code></pre></figure>`. For highlighting, use Shiki with `codeTheme` from `@whatsaaaa/design-system/shiki`.
|
|
112
134
|
- Callout: `<aside class="ws-callout ws-callout--warning"><p class="ws-callout__title">Warning</p><p>...</p></aside>`. Modifiers: `--tip`, `--warning`, `--danger`. None is a note.
|
|
113
135
|
- Terminal frame: `ws-term` (the window), `ws-tab-bar` with `ws-tab-bar__brand`, `ws-tabs` and `ws-tab-bar__end`, `ws-prompt` for headings, `ws-output`, `ws-status-line`. Mark the current tab with `aria-current="page"`.
|
|
114
|
-
- Small pieces: `ws-kbd`, `ws-tag`, `ws-tag--outline`, `ws-state` with `--active` or `--experimental`, `ws-arrow`, `ws-cursor
|
|
136
|
+
- Small pieces: `ws-kbd`, `ws-tag`, `ws-tag--outline`, `ws-state` with `--active` or `--experimental`, `ws-arrow`, `ws-cursor`, and `ws-visually-hidden` for text that only assistive technology reads.
|
|
115
137
|
|
|
116
138
|
The markup of each piece is in the comment at the top of its stylesheet, and in the style guide.
|
|
117
139
|
|
|
140
|
+
### Status line
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<footer class="ws-status-line">
|
|
144
|
+
<span class="ws-status-line__mode">NORMAL</span>
|
|
145
|
+
<span class="ws-status-line__path">
|
|
146
|
+
<span class="ws-status-line__file"><span>~/guide/conditions.md</span></span>
|
|
147
|
+
</span>
|
|
148
|
+
<!-- the key hints and the keys switch, see section 7 -->
|
|
149
|
+
<button type="button" class="ws-status-line__theme">
|
|
150
|
+
<span class="ws-visually-hidden">Switch theme, now</span>
|
|
151
|
+
<span class="ws-theme-dark">rose-pine</span>
|
|
152
|
+
<span class="ws-theme-light">rose-pine-dawn</span>
|
|
153
|
+
</button>
|
|
154
|
+
</footer>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- **The mode** says whether the key hints work. It reads `NORMAL`, and `INSERT` while the focus is in a field, where a key is typed and not a shortcut. Use those two words and no others. `isTyping` from `@whatsaaaa/design-system/shortcuts` tells which: check `isTyping(document.activeElement)` on `focusin` and `focusout`. A page without fields stays `NORMAL`.
|
|
158
|
+
- **The path** goes in `ws-status-line__path`, which takes the room the other items leave and puts the items after it at the right edge. The path gives way to them on its own: it is cut with an ellipsis, and when not even its first character fits, it goes as a whole. Write no breakpoint or width for it. A status line without a path puts `<span class="ws-status-line__spacer"></span>` where the path would be.
|
|
159
|
+
- **The theme button** names the theme shown and switches it, at every width: below 64rem, where the key hints are hidden, it is the only theme switch. Call `toggleTheme` when it is clicked. It holds both names, and the styles show the one of the theme, so the name is right before any script runs and the button keeps the focus when the theme changes. Its name for assistive technology is "Switch theme, now rose-pine". Where the key hints show, keep the theme's `t` hint as well.
|
|
160
|
+
- An item for wide screens only takes `ws-status-line__item--wide`, and one with a border on its left `ws-status-line__item--edge`.
|
|
161
|
+
- A focus ring in the window's bars is drawn inside its control, so neither the bars nor the window's corners cut it off. A control of your own in a bar does the same: `outline-offset: calc(-1 * var(--ws-border-width-medium))`.
|
|
162
|
+
|
|
118
163
|
## 7. Keys
|
|
119
164
|
|
|
120
165
|
A key hint in a status line has to work. Put `data-ws-key` on the control the key presses, give the status line the keys switch, and turn the shortcuts on:
|
|
@@ -180,6 +225,7 @@ Generated files are in `assets/<name>/`, for `whatsaaaa` and for each project. `
|
|
|
180
225
|
| Logo with name | `lockup-dark.svg`, `lockup-light.svg` |
|
|
181
226
|
| Top of a README | `readme-header.svg` |
|
|
182
227
|
| Link preview | `social-card.png` |
|
|
228
|
+
| Gravatar header | `profile-banner.png` (handle only). Profile colors: dark `bg`, `surface`, `interactive` |
|
|
183
229
|
|
|
184
230
|
Copy the files you need into the project. Show a mark at 16, 32, 48 or 64 px, where its pixels are sharp.
|
|
185
231
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whatsaaaa/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -114,15 +114,9 @@ onUnmounted(() => {
|
|
|
114
114
|
Both names are rendered and the styles show the one of the page's theme. The theme is
|
|
115
115
|
not known on the server, so a name rendered from it would differ in the browser.
|
|
116
116
|
-->
|
|
117
|
-
<span
|
|
118
|
-
class="ws-
|
|
119
|
-
|
|
120
|
-
rose-pine
|
|
121
|
-
</span>
|
|
122
|
-
<span
|
|
123
|
-
class="ws-status-line__item ws-status-line__item--edge ws-status-line__item--wide ws-status-line__item--light"
|
|
124
|
-
>
|
|
125
|
-
rose-pine-dawn
|
|
117
|
+
<span class="ws-status-line__item ws-status-line__item--edge ws-status-line__item--wide">
|
|
118
|
+
<span class="ws-theme-dark">rose-pine</span>
|
|
119
|
+
<span class="ws-theme-light">rose-pine-dawn</span>
|
|
126
120
|
</span>
|
|
127
121
|
</footer>
|
|
128
122
|
</template>
|
|
@@ -40,6 +40,11 @@ body {
|
|
|
40
40
|
height: var(--ws-size-status-line);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/* VitePress gives a button the browser's own ring: the status line's controls take the theme's */
|
|
44
|
+
.WsStatusLine button:focus-visible {
|
|
45
|
+
outline: var(--ws-border-width-medium) solid var(--ws-color-interactive);
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
.WsStatusLine .WsStatusLine-pair {
|
|
44
49
|
gap: var(--ws-space-6);
|
|
45
50
|
}
|