@whatsaaaa/design-system 0.6.0 → 0.7.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.
@@ -1,3 +1,34 @@
1
+ /*
2
+ * The terminal frame: a tab bar on top, prompts as headings, a status line at the bottom.
3
+ * Each piece stands alone, so an app can take the bars without the frame.
4
+ */
5
+
6
+ /*
7
+ * The one breakpoint of the system. Below it there is one column, the tab bar wraps and
8
+ * headings take their compact sizes. Custom properties cannot be used in media queries,
9
+ * so in another project write the query out: @media (width < 64rem).
10
+ */
11
+
12
+ /*
13
+ * An element for one theme only, such as one cut of a mark or the name of the theme.
14
+ *
15
+ * <img class="ws-theme-dark" src="mark-on-dark.svg" alt="whatsaaaa" />
16
+ * <img class="ws-theme-light" src="mark-on-light.svg" alt="whatsaaaa" />
17
+ *
18
+ * Both are in the page and the styles show the one of the theme in effect where it stands:
19
+ * the nearest choice, data-theme or a dark or light class, on <html> or on an element around
20
+ * it, or the system's preference when there is none. So the right one shows before any script
21
+ * runs.
22
+ *
23
+ * It hides with !important because it has to win over whatever else gives the element a
24
+ * display, such as a flex item of the status line. The status line's --dark and --light
25
+ * items are older names of the same two classes.
26
+ */
27
+
28
+ /*
29
+ * The rules are written by the token build, from the same selectors as the theme blocks of the
30
+ * tokens: scripts/lib/theme-selectors.ts.
31
+ */
1
32
  :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))) *) {
2
33
  display: none !important;
3
34
  }
@@ -14,6 +45,7 @@
14
45
  }
15
46
  }
16
47
 
48
+ /* The window: bar, content, bar. Give it a height to make the content scroll inside it. */
17
49
  .ws-term {
18
50
  border: var(--ws-border-width-thin) solid var(--ws-color-border);
19
51
  border-radius: var(--ws-radius-xl);
@@ -25,6 +57,23 @@
25
57
  overflow: hidden;
26
58
  }
27
59
 
60
+ /*
61
+ * Tab bar.
62
+ *
63
+ * <header class="ws-tab-bar">
64
+ * <a class="ws-tab-bar__brand" href="/">...mark... name</a>
65
+ * <nav class="ws-tabs" aria-label="Main">
66
+ * <ul>
67
+ * <li><a href="/" aria-current="page">home</a></li>
68
+ * <li><a href="/projects/">projects</a></li>
69
+ * </ul>
70
+ * </nav>
71
+ * <div class="ws-tab-bar__end">...</div>
72
+ * </header>
73
+ *
74
+ * The tabs are optional. A site of one page has nothing to tab to: its bar is the brand and
75
+ * the end.
76
+ */
28
77
  .ws-tab-bar {
29
78
  align-items: stretch;
30
79
  gap: var(--ws-space-32);
@@ -51,6 +100,7 @@
51
100
  display: flex;
52
101
  }
53
102
 
103
+ /* A brand that is a link fills the bar's height, where the window clips: its ring goes inside. */
54
104
  .ws-tab-bar__brand:focus-visible {
55
105
  outline-offset: calc(-1 * var(--ws-border-width-medium));
56
106
  }
@@ -88,21 +138,28 @@
88
138
  display: flex;
89
139
  }
90
140
 
91
- .ws-tabs a:before {
141
+ /*
142
+ * Tabs are numbered like the windows of a terminal multiplexer. The number names the key that
143
+ * goes to the tab, so it is drawn only while the keys are on: not without the shortcuts
144
+ * module, and not with the keys switched off. While the head script waits for the module,
145
+ * the number keeps its place unseen, so the labels do not move when it shows.
146
+ */
147
+ :is([data-ws-keys="on"], [data-ws-keys="pending"]) .ws-tabs a:before {
92
148
  color: var(--ws-color-text-faint);
93
149
  font-weight: var(--ws-font-weight-bold);
94
150
  content: counter(ws-tab);
95
151
  content: counter(ws-tab) / "";
96
152
  }
97
153
 
98
- [data-ws-keys="off"] .ws-tabs a:before {
99
- content: none;
154
+ [data-ws-keys="pending"] .ws-tabs a:before {
155
+ visibility: hidden;
100
156
  }
101
157
 
102
158
  .ws-tabs a:hover {
103
159
  color: var(--ws-color-text);
104
160
  }
105
161
 
162
+ /* A tab fills the bar from edge to edge, and the window clips there: its ring goes inside it. */
106
163
  .ws-tabs a:focus-visible {
107
164
  outline-offset: calc(-1 * var(--ws-border-width-medium));
108
165
  }
@@ -137,6 +194,7 @@
137
194
  color: var(--ws-color-text);
138
195
  }
139
196
 
197
+ /* An arrow after a link that leaves the site. */
140
198
  .ws-arrow:after {
141
199
  content: "";
142
200
  width: .75em;
@@ -148,8 +206,16 @@
148
206
  display: inline-block;
149
207
  }
150
208
 
209
+ /*
210
+ * A prompt: the chevron, then a command. As a heading it names a section by the command
211
+ * whose output the section is.
212
+ *
213
+ * <h2 class="ws-prompt">ls ~/projects</h2>
214
+ *
215
+ * The chevron is centered on the first line, so a command that wraps keeps it there.
216
+ */
151
217
  .ws-prompt {
152
- align-items: center;
218
+ align-items: flex-start;
153
219
  gap: var(--ws-space-10);
154
220
  color: var(--ws-color-text);
155
221
  font: var(--ws-text-label);
@@ -159,13 +225,15 @@
159
225
  }
160
226
 
161
227
  .ws-prompt:before {
162
- background: var(--ws-color-brand);
163
- content: "";
164
228
  width: .625em;
165
229
  height: .875em;
230
+ margin-top: calc((var(--ws-text-label-line-height) * 1em - .875em) / 2);
231
+ background: var(--ws-color-brand);
232
+ content: "";
166
233
  -webkit-mask: var(--ws-icon-chevron) center / contain no-repeat;
167
234
  mask: var(--ws-icon-chevron) center / contain no-repeat;
168
235
  flex: none;
236
+ margin-top: calc(.5lh - .4375em);
169
237
  }
170
238
 
171
239
  .ws-prompt a {
@@ -176,6 +244,7 @@
176
244
  color: var(--ws-color-text-secondary);
177
245
  }
178
246
 
247
+ /* What a command printed: text set off by a rule on the left. */
179
248
  .ws-output {
180
249
  margin: var(--ws-space-24) 0 0;
181
250
  padding-left: var(--ws-space-16);
@@ -194,6 +263,7 @@
194
263
  font-weight: var(--ws-font-weight-semibold);
195
264
  }
196
265
 
266
+ /* The block cursor after the handle. It does not blink. */
197
267
  .ws-cursor {
198
268
  background: var(--ws-color-brand);
199
269
  border-radius: 2px;
@@ -203,6 +273,7 @@
203
273
  display: inline-block;
204
274
  }
205
275
 
276
+ /* A key cap. */
206
277
  .ws-kbd {
207
278
  min-width: 1.125rem;
208
279
  height: 1.125rem;
@@ -218,6 +289,7 @@
218
289
  display: inline-grid;
219
290
  }
220
291
 
292
+ /* A tag on a tint of the interactive color, or outlined for a plain list such as a stack. */
221
293
  .ws-tag {
222
294
  padding: var(--ws-space-2) var(--ws-space-8);
223
295
  border-radius: var(--ws-radius-sm);
@@ -236,8 +308,14 @@
236
308
  background: none;
237
309
  }
238
310
 
311
+ /*
312
+ * A state as a dot with its word. The word carries the meaning, the dot only repeats it.
313
+ * The word gives the baseline, so a state lines up with the text beside it.
314
+ *
315
+ * <span class="ws-state ws-state--active">active</span>
316
+ */
239
317
  .ws-state {
240
- align-items: center;
318
+ align-items: baseline;
241
319
  gap: var(--ws-space-8);
242
320
  color: var(--ws-color-text-secondary);
243
321
  font: var(--ws-text-caption);
@@ -250,6 +328,7 @@
250
328
  background: var(--ws-color-text-faint);
251
329
  content: "";
252
330
  flex: none;
331
+ align-self: center;
253
332
  width: .4375rem;
254
333
  height: .4375rem;
255
334
  }
@@ -262,6 +341,39 @@
262
341
  background: var(--ws-color-warning);
263
342
  }
264
343
 
344
+ /*
345
+ * Status line.
346
+ *
347
+ * <footer class="ws-status-line">
348
+ * <span class="ws-status-line__mode">NORMAL</span>
349
+ * <span class="ws-status-line__path">
350
+ * <span class="ws-status-line__file"><span>guide/conditions.md</span></span>
351
+ * </span>
352
+ * <span class="ws-status-line__item ws-status-line__item--wide">main</span>
353
+ * <span class="ws-status-line__keys">
354
+ * <button type="button" data-ws-key="t"><kbd class="ws-kbd">t</kbd>theme</button>
355
+ * </span>
356
+ * <button type="button" class="ws-status-line__switch" role="switch"
357
+ * aria-label="Shortcut keys" data-ws-keys-switch>
358
+ * keys
359
+ * <span class="ws-status-line__on" aria-hidden="true">on</span>
360
+ * <span class="ws-status-line__off" aria-hidden="true">off</span>
361
+ * </button>
362
+ * <button type="button" class="ws-status-line__theme">
363
+ * <span class="ws-visually-hidden">Switch theme, now</span>
364
+ * <span class="ws-theme-dark">rose-pine</span>
365
+ * <span class="ws-theme-light">rose-pine-dawn</span>
366
+ * </button>
367
+ * </footer>
368
+ *
369
+ * The mode says whether the key hints work: NORMAL, or INSERT while the focus is in a field.
370
+ * The path takes the room the other items leave, so they always fit.
371
+ * A key hint is the control itself: pressing the key clicks it (see the shortcuts module).
372
+ * Hints stay hidden until that module runs, so a hint is never shown for a key that does nothing.
373
+ * The switch turns the keys off and on again. A status line with key hints carries it.
374
+ * With the keys off the controls stay, without their key caps.
375
+ * The theme button names the theme shown and switches it, at every width.
376
+ */
265
377
  .ws-status-line {
266
378
  min-height: var(--ws-size-status-line);
267
379
  border-top: var(--ws-border-width-thin) solid var(--ws-color-border);
@@ -289,6 +401,12 @@
289
401
  letter-spacing: .04em;
290
402
  }
291
403
 
404
+ /*
405
+ * The room the other items leave, which the path takes: the items after it go to the right
406
+ * edge, as after a spacer. The path gives way to them inside it. It shrinks to its first
407
+ * character and the ellipsis, then goes as a whole, padding and all, so a part of a
408
+ * character never shows.
409
+ */
292
410
  .ws-status-line__path {
293
411
  flex: 1;
294
412
  min-width: 0;
@@ -308,6 +426,11 @@
308
426
  overflow: hidden;
309
427
  }
310
428
 
429
+ /*
430
+ * No room for "~…" between the padding of the path, --ws-space-14 on each side. The padding
431
+ * is written out, as a container query takes no var(). The browser test of the path,
432
+ * tests/browser/status-line.spec.ts, holds the two together.
433
+ */
311
434
  @container ws-status-line-path (width < calc(2ch + 1.75rem)) {
312
435
  .ws-status-line__file {
313
436
  display: none;
@@ -327,14 +450,17 @@
327
450
  display: none;
328
451
  }
329
452
 
330
- [data-ws-keys] .ws-status-line__keys {
453
+ /* The module says on or off once it runs. The head script's pending is not yet a yes. */
454
+ :is([data-ws-keys="on"], [data-ws-keys="off"]) .ws-status-line__keys {
331
455
  display: flex;
332
456
  }
333
457
 
458
+ /* With the keys switched off a control stays and its key cap goes: nothing names a key then. */
334
459
  [data-ws-keys="off"] .ws-status-line__keys .ws-kbd {
335
460
  display: none;
336
461
  }
337
462
 
463
+ /* Without a path and without key hints the items after them still go to the right edge. */
338
464
  .ws-status-line__spacer {
339
465
  flex: 1;
340
466
  }
@@ -345,6 +471,12 @@
345
471
  display: flex;
346
472
  }
347
473
 
474
+ /*
475
+ * A control fills the height of the line, also in a group of hints. Its focus ring is drawn
476
+ * inside it, in padding taken back from the gap between hints with a negative margin, so a
477
+ * hint does not move. The gap in a group has no room for two rings: there a control after
478
+ * another takes nothing back at its start, so it moves over and the two only meet.
479
+ */
348
480
  .ws-status-line__keys :is(button, a) {
349
481
  align-self: stretch;
350
482
  align-items: center;
@@ -364,6 +496,14 @@
364
496
  margin-left: 0;
365
497
  }
366
498
 
499
+ /*
500
+ * The keys switch and the theme button. The switch reads "keys on" or "keys off" from its own
501
+ * state, which the shortcuts module sets, and stays hidden until it has one. Unlike the hints
502
+ * both show at every width: the numbers of the tabs are keys everywhere, and with the keys
503
+ * off the switch is the way to turn them on again. The theme button is the theme switch on
504
+ * a narrow screen, where the hints are hidden. It holds the names of both themes and shows
505
+ * the one of the theme shown, so it keeps the focus when it switches.
506
+ */
367
507
  .ws-status-line__switch, .ws-status-line__theme {
368
508
  align-items: center;
369
509
  gap: var(--ws-space-6);
@@ -391,14 +531,20 @@
391
531
  display: none;
392
532
  }
393
533
 
534
+ /* The status line clips what crosses its edges, so a ring is drawn inside its control. */
394
535
  .ws-status-line__keys :is(button, a):focus-visible, .ws-status-line__switch:focus-visible, .ws-status-line__theme:focus-visible {
395
536
  outline-offset: calc(-1 * var(--ws-border-width-medium));
396
537
  }
397
538
 
539
+ /*
540
+ * The window cuts off its corners, so a ring in one follows the window's curve: that of the
541
+ * last control of the status line, and on a narrow screen that of the brand.
542
+ */
398
543
  .ws-term .ws-status-line > :last-child:focus-visible {
399
544
  border-bottom-right-radius: calc(var(--ws-radius-xl) - var(--ws-border-width-thin));
400
545
  }
401
546
 
547
+ /* Text for assistive technology only, such as the start of the theme button's name. */
402
548
  .ws-visually-hidden {
403
549
  clip-path: inset(50%);
404
550
  white-space: nowrap;
@@ -432,6 +578,7 @@
432
578
  padding-right: var(--ws-space-16);
433
579
  }
434
580
 
581
+ /* The tabs take a row of their own and share it evenly. */
435
582
  .ws-tabs {
436
583
  border-top: var(--ws-border-width-thin) solid var(--ws-color-border);
437
584
  flex-basis: 100%;
@@ -451,6 +598,7 @@
451
598
  justify-content: center;
452
599
  }
453
600
 
601
+ /* The row runs from edge to edge, so the current tab has no border at an end of it. */
454
602
  .ws-tabs li:first-child a[aria-current] {
455
603
  border-left-color: #0000;
456
604
  }
@@ -459,7 +607,8 @@
459
607
  border-right-color: #0000;
460
608
  }
461
609
 
462
- [data-ws-keys] .ws-status-line__keys, .ws-status-line__item--wide {
610
+ /* The key hints and the wide items do not fit. A key whose hint is hidden does nothing. */
611
+ :is([data-ws-keys="on"], [data-ws-keys="off"]) .ws-status-line__keys, .ws-status-line__item--wide {
463
612
  display: none;
464
613
  }
465
614
  }
@@ -1,3 +1,23 @@
1
+ /*
2
+ * An element for one theme only, such as one cut of a mark or the name of the theme.
3
+ *
4
+ * <img class="ws-theme-dark" src="mark-on-dark.svg" alt="whatsaaaa" />
5
+ * <img class="ws-theme-light" src="mark-on-light.svg" alt="whatsaaaa" />
6
+ *
7
+ * Both are in the page and the styles show the one of the theme in effect where it stands:
8
+ * the nearest choice, data-theme or a dark or light class, on <html> or on an element around
9
+ * it, or the system's preference when there is none. So the right one shows before any script
10
+ * runs.
11
+ *
12
+ * It hides with !important because it has to win over whatever else gives the element a
13
+ * display, such as a flex item of the status line. The status line's --dark and --light
14
+ * items are older names of the same two classes.
15
+ */
16
+
17
+ /*
18
+ * The rules are written by the token build, from the same selectors as the theme blocks of the
19
+ * tokens: scripts/lib/theme-selectors.ts.
20
+ */
1
21
  :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))) *) {
2
22
  display: none !important;
3
23
  }