@whatsaaaa/design-system 0.6.0 → 0.6.1

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/dist/index.css CHANGED
@@ -1,3 +1,4 @@
1
+ /* Everything: fonts, tokens, page defaults and every component. */
1
2
  @font-face {
2
3
  font-family: JetBrains Mono;
3
4
  font-style: normal;
@@ -408,6 +409,18 @@
408
409
  }
409
410
  }
410
411
 
412
+ /*
413
+ * The few icons the styles draw themselves, as masks, so they take the color of their text
414
+ * and need no markup. All are 16 x 16 strokes of 1.5.
415
+ *
416
+ * .done::before {
417
+ * width: 1rem;
418
+ * height: 1rem;
419
+ * background: currentcolor;
420
+ * content: '';
421
+ * mask: var(--ws-icon-check) center / contain no-repeat;
422
+ * }
423
+ */
411
424
  :root {
412
425
  --ws-icon-note: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='6.2'/%3E%3Cpath d='M8 7.4v3.4M8 5.1v.2'/%3E%3C/svg%3E");
413
426
  --ws-icon-tip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.8a4.3 4.3 0 0 0-2.3 7.9v1.5h4.6V9.7A4.3 4.3 0 0 0 8 1.8ZM6.4 13.6h3.2'/%3E%3C/svg%3E");
@@ -418,6 +431,11 @@
418
431
  --ws-icon-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9 9 3M4.25 3H9v4.75'/%3E%3C/svg%3E");
419
432
  }
420
433
 
434
+ /*
435
+ * Page defaults for a site that is all this system: box sizing, the page colors, the body
436
+ * face, links, number fields, focus and selection. It resets margins and list markers, so
437
+ * content that should read as a document goes in a .ws-prose container.
438
+ */
421
439
  *, :before, :after {
422
440
  box-sizing: border-box;
423
441
  }
@@ -453,11 +471,16 @@ a {
453
471
  text-decoration-thickness: 1px;
454
472
  }
455
473
 
474
+ /* A mono face with ligatures turns => and != into single shapes, which code should not do. */
456
475
  code, kbd, samp, pre {
457
476
  font-family: var(--ws-font-family-mono);
458
477
  font-variant-ligatures: none;
459
478
  }
460
479
 
480
+ /*
481
+ * A number field is typed, and stepped with the arrow keys. The system draws no spin buttons,
482
+ * and the browser's own have no look of its, so they go.
483
+ */
461
484
  input[type="number"] {
462
485
  appearance: textfield;
463
486
  }
@@ -473,16 +496,31 @@ input[type="number"]::-webkit-outer-spin-button {
473
496
  }
474
497
 
475
498
  :focus-visible {
476
- border-radius: var(--ws-radius-sm);
477
499
  outline: var(--ws-border-width-medium) solid var(--ws-color-interactive);
478
500
  outline-offset: 3px;
479
501
  }
480
502
 
503
+ /*
504
+ * A ring follows the corners of what it rings. What has no corners of its own, such as a
505
+ * link, takes small ones while it is focused. The rule weighs no more than an element, so a
506
+ * class of the page's own, such as a round radio button's, always wins, wherever it is
507
+ * written. A form control weighs as an element here, to win over Tailwind's preflight, which
508
+ * squares its corners at that weight before base.css in the same layer.
509
+ */
510
+ :where(:focus-visible), :is(button, input, select, optgroup, textarea):where(:focus-visible) {
511
+ border-radius: var(--ws-radius-sm);
512
+ }
513
+
481
514
  ::selection {
482
515
  background: var(--ws-color-selection);
483
516
  color: var(--ws-color-text);
484
517
  }
485
518
 
519
+ /*
520
+ * Long-form text: headings, paragraphs, links, lists, inline code, tables and the small
521
+ * things around them. Put rendered Markdown in a .ws-prose container.
522
+ * The same rules style VitePress pages, whose content container is .vp-doc.
523
+ */
486
524
  .ws-prose, .vp-doc {
487
525
  color: var(--ws-color-text);
488
526
  font: var(--ws-text-body);
@@ -770,6 +808,7 @@ input[type="number"]::-webkit-outer-spin-button {
770
808
  }
771
809
  }
772
810
 
811
+ /* A plain code block in prose. Dark in both themes, like every code block. */
773
812
  .ws-prose pre {
774
813
  margin: var(--ws-space-16) 0 0;
775
814
  padding: var(--ws-space-16);
@@ -787,6 +826,13 @@ input[type="number"]::-webkit-outer-spin-button {
787
826
  font: inherit;
788
827
  }
789
828
 
829
+ /*
830
+ * The path above a page title. The slashes between its parts are drawn. Assistive technology
831
+ * reads a comma in their place, so the parts come out as words of their own.
832
+ *
833
+ * <p class="ws-crumb"><span>writing</span><span>form-builder</span><span>conditions</span></p>
834
+ * <h1>Conditions</h1>
835
+ */
790
836
  .ws-crumb {
791
837
  color: var(--ws-color-text-secondary);
792
838
  font: var(--ws-text-caption);
@@ -797,13 +843,35 @@ input[type="number"]::-webkit-outer-spin-button {
797
843
  margin-inline: var(--ws-space-4);
798
844
  color: var(--ws-color-text-faint);
799
845
  content: "/";
800
- content: "/" / "";
846
+ content: "/" / ", ";
801
847
  }
802
848
 
803
849
  .ws-crumb + h1 {
804
850
  margin-top: var(--ws-space-12);
805
851
  }
806
852
 
853
+ /*
854
+ * A code block with a caption: the file name on the left, the language on the right.
855
+ *
856
+ * <figure class="ws-code">
857
+ * <figcaption><span>conditions.ts</span><span>ts</span></figcaption>
858
+ * <pre><code>...</code></pre>
859
+ * </figure>
860
+ *
861
+ * Code blocks stay on the dark palette in both themes: on dawn no syntax color except
862
+ * pine reaches AA on the surface.
863
+ *
864
+ * A block scrolls sideways. ws-code--wrap wraps its lines instead, for text a person typed,
865
+ * such as a long value, which a phone would cut off. When each line is a .line with
866
+ * --ws-code-hang, its indent in characters plus two, as the hangingIndent transformer of
867
+ * @whatsaaaa/design-system/shiki gives it, the rest of a wrapped line hangs one level in from
868
+ * the line's own text, so the shape of the code still reads.
869
+ *
870
+ * <figure class="ws-code ws-code--wrap">
871
+ * <figcaption><span>order.json</span><span>json</span></figcaption>
872
+ * <pre><code><span class="line" style="--ws-code-hang: 4"> "note": "..."</span></code></pre>
873
+ * </figure>
874
+ */
807
875
  .ws-code {
808
876
  margin: var(--ws-space-16) 0 0;
809
877
  border: var(--ws-border-width-thin) solid var(--ws-code-border);
@@ -850,6 +918,7 @@ input[type="number"]::-webkit-outer-spin-button {
850
918
  overflow-x: visible;
851
919
  }
852
920
 
921
+ /* A line is a box of its own, so its rest can hang. The line break after it stays text. */
853
922
  .ws-code--wrap .line {
854
923
  box-sizing: border-box;
855
924
  width: 100%;
@@ -867,12 +936,23 @@ input[type="number"]::-webkit-outer-spin-button {
867
936
  color: var(--ws-code-text);
868
937
  }
869
938
 
939
+ /* The scrollbar of a code block belongs to the dark block, whatever the page theme is. */
870
940
  .ws-code > pre, .ws-prose pre {
871
941
  --lightningcss-light: ;
872
942
  --lightningcss-dark: initial;
873
943
  color-scheme: dark;
874
944
  }
875
945
 
946
+ /*
947
+ * A callout: a bar in the status color, a label with an icon, then text.
948
+ * The status is never carried by color alone. On the light theme the label and icon take the
949
+ * text color, because the status hues miss AA as text there, and the hue stays on the bar.
950
+ *
951
+ * <aside class="ws-callout ws-callout--warning">
952
+ * <p class="ws-callout__title">Warning</p>
953
+ * <p>...</p>
954
+ * </aside>
955
+ */
876
956
  .ws-callout {
877
957
  --ws-callout-tone: var(--ws-color-note);
878
958
  --ws-callout-label: var(--ws-color-note-text);
@@ -938,6 +1018,19 @@ input[type="number"]::-webkit-outer-spin-button {
938
1018
  margin: 0;
939
1019
  }
940
1020
 
1021
+ /*
1022
+ * A segmented control: buttons in a row that share their edges, one of them pressed, such as
1023
+ * the switch between the languages of a page.
1024
+ *
1025
+ * <div class="ws-segmented" role="group" aria-label="Language">
1026
+ * <button type="button" aria-pressed="true">en</button>
1027
+ * <button type="button" aria-pressed="false">sr</button>
1028
+ * </div>
1029
+ *
1030
+ * The pressed segment is raised, in the text color, with an edge of the interactive color
1031
+ * that is twice as thick as the others, at least 3:1 on the page and on the raised fill. It is
1032
+ * not filled: next to a primary button a filled segment would be as loud as the button.
1033
+ */
941
1034
  .ws-segmented {
942
1035
  max-width: 100%;
943
1036
  display: inline-flex;
@@ -967,6 +1060,7 @@ input[type="number"]::-webkit-outer-spin-button {
967
1060
  border-end-end-radius: var(--ws-radius-md);
968
1061
  }
969
1062
 
1063
+ /* The edge two segments share is one line: the hovered or pressed one draws it, over the other. */
970
1064
  .ws-segmented > button + button {
971
1065
  margin-inline-start: calc(-1 * var(--ws-border-width-thin));
972
1066
  }
@@ -999,6 +1093,12 @@ input[type="number"]::-webkit-outer-spin-button {
999
1093
  background: none;
1000
1094
  }
1001
1095
 
1096
+ /*
1097
+ * In forced colors the browser paints every fill in the page's color, so the pressed segment
1098
+ * takes the system's colors of a selection. It keeps them as they are, as the browser would
1099
+ * otherwise put a plate of the page's color behind its text. Kept colors keep the shadow too,
1100
+ * so it drops the shadow itself: the fill already shows the segment is pressed.
1101
+ */
1002
1102
  @media (forced-colors: active) {
1003
1103
  .ws-segmented > button[aria-pressed="true"] {
1004
1104
  box-shadow: none;
@@ -1010,6 +1110,28 @@ input[type="number"]::-webkit-outer-spin-button {
1010
1110
  }
1011
1111
  }
1012
1112
 
1113
+ /*
1114
+ * Terms and their values, a row each: the answers of a form on its review step, or what an
1115
+ * order costs. A term is in the voice of a label, its value in the face of a field, and the
1116
+ * two share a baseline. The terms share a column as wide as the longest of them, at most two
1117
+ * fifths of the row, so the values line up and have the rest of it. A long email or URL takes
1118
+ * a <wbr /> after its @ or a /, so it breaks there and not in a word.
1119
+ *
1120
+ * <dl class="ws-pairs">
1121
+ * <div><dt>Name</dt><dd>Ana Petrović</dd></div>
1122
+ * <div><dt>Email</dt><dd>ana@<wbr />example.com</dd></div>
1123
+ * </dl>
1124
+ *
1125
+ * Amounts take ws-pairs--amounts: each value at the right edge, in figures of one width, so
1126
+ * the digits of the rows line up, and the terms take the rest of the row. The total is the
1127
+ * last row, ws-pairs__total.
1128
+ *
1129
+ * <dl class="ws-pairs ws-pairs--amounts">
1130
+ * <div><dt>Subtotal</dt><dd>€48.00</dd></div>
1131
+ * <div><dt>Shipping</dt><dd>€4.00</dd></div>
1132
+ * <div class="ws-pairs__total"><dt>Total</dt><dd>€52.00</dd></div>
1133
+ * </dl>
1134
+ */
1013
1135
  .ws-pairs {
1014
1136
  column-gap: var(--ws-space-16);
1015
1137
  border-bottom: var(--ws-border-width-thin) dashed var(--ws-color-border);
@@ -1018,6 +1140,9 @@ input[type="number"]::-webkit-outer-spin-button {
1018
1140
  display: grid;
1019
1141
  }
1020
1142
 
1143
+ /* Each row takes the columns and the gap of the list, so a browser without subgrid (Chrome
1144
+ before 117) still sets a term beside its value; only the terms of different rows may differ
1145
+ in width. */
1021
1146
  .ws-pairs > div {
1022
1147
  grid-column: 1 / -1;
1023
1148
  grid-template-columns: inherit;
@@ -1059,6 +1184,7 @@ input[type="number"]::-webkit-outer-spin-button {
1059
1184
  white-space: nowrap;
1060
1185
  }
1061
1186
 
1187
+ /* The total: set off by a solid rule, and both of its parts in the text color, semibold. */
1062
1188
  .ws-pairs > .ws-pairs__total {
1063
1189
  border-top-style: solid;
1064
1190
  }
@@ -1068,6 +1194,31 @@ input[type="number"]::-webkit-outer-spin-button {
1068
1194
  font-weight: var(--ws-font-weight-semibold);
1069
1195
  }
1070
1196
 
1197
+ /*
1198
+ * The terminal frame: a tab bar on top, prompts as headings, a status line at the bottom.
1199
+ * Each piece stands alone, so an app can take the bars without the frame.
1200
+ */
1201
+
1202
+ /*
1203
+ * An element for one theme only, such as one cut of a mark or the name of the theme.
1204
+ *
1205
+ * <img class="ws-theme-dark" src="mark-on-dark.svg" alt="whatsaaaa" />
1206
+ * <img class="ws-theme-light" src="mark-on-light.svg" alt="whatsaaaa" />
1207
+ *
1208
+ * Both are in the page and the styles show the one of the theme in effect where it stands:
1209
+ * the nearest choice, data-theme or a dark or light class, on <html> or on an element around
1210
+ * it, or the system's preference when there is none. So the right one shows before any script
1211
+ * runs.
1212
+ *
1213
+ * It hides with !important because it has to win over whatever else gives the element a
1214
+ * display, such as a flex item of the status line. The status line's --dark and --light
1215
+ * items are older names of the same two classes.
1216
+ */
1217
+
1218
+ /*
1219
+ * The rules are written by the token build, from the same selectors as the theme blocks of the
1220
+ * tokens: scripts/lib/theme-selectors.ts.
1221
+ */
1071
1222
  :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))) *) {
1072
1223
  display: none !important;
1073
1224
  }
@@ -1084,6 +1235,7 @@ input[type="number"]::-webkit-outer-spin-button {
1084
1235
  }
1085
1236
  }
1086
1237
 
1238
+ /* The window: bar, content, bar. Give it a height to make the content scroll inside it. */
1087
1239
  .ws-term {
1088
1240
  border: var(--ws-border-width-thin) solid var(--ws-color-border);
1089
1241
  border-radius: var(--ws-radius-xl);
@@ -1095,6 +1247,23 @@ input[type="number"]::-webkit-outer-spin-button {
1095
1247
  overflow: hidden;
1096
1248
  }
1097
1249
 
1250
+ /*
1251
+ * Tab bar.
1252
+ *
1253
+ * <header class="ws-tab-bar">
1254
+ * <a class="ws-tab-bar__brand" href="/">...mark... name</a>
1255
+ * <nav class="ws-tabs" aria-label="Main">
1256
+ * <ul>
1257
+ * <li><a href="/" aria-current="page">home</a></li>
1258
+ * <li><a href="/projects/">projects</a></li>
1259
+ * </ul>
1260
+ * </nav>
1261
+ * <div class="ws-tab-bar__end">...</div>
1262
+ * </header>
1263
+ *
1264
+ * The tabs are optional. A site of one page has nothing to tab to: its bar is the brand and
1265
+ * the end.
1266
+ */
1098
1267
  .ws-tab-bar {
1099
1268
  align-items: stretch;
1100
1269
  gap: var(--ws-space-32);
@@ -1121,6 +1290,7 @@ input[type="number"]::-webkit-outer-spin-button {
1121
1290
  display: flex;
1122
1291
  }
1123
1292
 
1293
+ /* A brand that is a link fills the bar's height, where the window clips: its ring goes inside. */
1124
1294
  .ws-tab-bar__brand:focus-visible {
1125
1295
  outline-offset: calc(-1 * var(--ws-border-width-medium));
1126
1296
  }
@@ -1158,21 +1328,28 @@ input[type="number"]::-webkit-outer-spin-button {
1158
1328
  display: flex;
1159
1329
  }
1160
1330
 
1161
- .ws-tabs a:before {
1331
+ /*
1332
+ * Tabs are numbered like the windows of a terminal multiplexer. The number names the key that
1333
+ * goes to the tab, so it is drawn only while the keys are on: not without the shortcuts
1334
+ * module, and not with the keys switched off. While the head script waits for the module,
1335
+ * the number keeps its place unseen, so the labels do not move when it shows.
1336
+ */
1337
+ :is([data-ws-keys="on"], [data-ws-keys="pending"]) .ws-tabs a:before {
1162
1338
  color: var(--ws-color-text-faint);
1163
1339
  font-weight: var(--ws-font-weight-bold);
1164
1340
  content: counter(ws-tab);
1165
1341
  content: counter(ws-tab) / "";
1166
1342
  }
1167
1343
 
1168
- [data-ws-keys="off"] .ws-tabs a:before {
1169
- content: none;
1344
+ [data-ws-keys="pending"] .ws-tabs a:before {
1345
+ visibility: hidden;
1170
1346
  }
1171
1347
 
1172
1348
  .ws-tabs a:hover {
1173
1349
  color: var(--ws-color-text);
1174
1350
  }
1175
1351
 
1352
+ /* A tab fills the bar from edge to edge, and the window clips there: its ring goes inside it. */
1176
1353
  .ws-tabs a:focus-visible {
1177
1354
  outline-offset: calc(-1 * var(--ws-border-width-medium));
1178
1355
  }
@@ -1207,6 +1384,7 @@ input[type="number"]::-webkit-outer-spin-button {
1207
1384
  color: var(--ws-color-text);
1208
1385
  }
1209
1386
 
1387
+ /* An arrow after a link that leaves the site. */
1210
1388
  .ws-arrow:after {
1211
1389
  content: "";
1212
1390
  width: .75em;
@@ -1218,8 +1396,16 @@ input[type="number"]::-webkit-outer-spin-button {
1218
1396
  display: inline-block;
1219
1397
  }
1220
1398
 
1399
+ /*
1400
+ * A prompt: the chevron, then a command. As a heading it names a section by the command
1401
+ * whose output the section is.
1402
+ *
1403
+ * <h2 class="ws-prompt">ls ~/projects</h2>
1404
+ *
1405
+ * The chevron is centered on the first line, so a command that wraps keeps it there.
1406
+ */
1221
1407
  .ws-prompt {
1222
- align-items: center;
1408
+ align-items: flex-start;
1223
1409
  gap: var(--ws-space-10);
1224
1410
  color: var(--ws-color-text);
1225
1411
  font: var(--ws-text-label);
@@ -1229,13 +1415,15 @@ input[type="number"]::-webkit-outer-spin-button {
1229
1415
  }
1230
1416
 
1231
1417
  .ws-prompt:before {
1232
- background: var(--ws-color-brand);
1233
- content: "";
1234
1418
  width: .625em;
1235
1419
  height: .875em;
1420
+ margin-top: calc((var(--ws-text-label-line-height) * 1em - .875em) / 2);
1421
+ background: var(--ws-color-brand);
1422
+ content: "";
1236
1423
  -webkit-mask: var(--ws-icon-chevron) center / contain no-repeat;
1237
1424
  mask: var(--ws-icon-chevron) center / contain no-repeat;
1238
1425
  flex: none;
1426
+ margin-top: calc(.5lh - .4375em);
1239
1427
  }
1240
1428
 
1241
1429
  .ws-prompt a {
@@ -1246,6 +1434,7 @@ input[type="number"]::-webkit-outer-spin-button {
1246
1434
  color: var(--ws-color-text-secondary);
1247
1435
  }
1248
1436
 
1437
+ /* What a command printed: text set off by a rule on the left. */
1249
1438
  .ws-output {
1250
1439
  margin: var(--ws-space-24) 0 0;
1251
1440
  padding-left: var(--ws-space-16);
@@ -1264,6 +1453,7 @@ input[type="number"]::-webkit-outer-spin-button {
1264
1453
  font-weight: var(--ws-font-weight-semibold);
1265
1454
  }
1266
1455
 
1456
+ /* The block cursor after the handle. It does not blink. */
1267
1457
  .ws-cursor {
1268
1458
  background: var(--ws-color-brand);
1269
1459
  border-radius: 2px;
@@ -1273,6 +1463,7 @@ input[type="number"]::-webkit-outer-spin-button {
1273
1463
  display: inline-block;
1274
1464
  }
1275
1465
 
1466
+ /* A key cap. */
1276
1467
  .ws-kbd {
1277
1468
  min-width: 1.125rem;
1278
1469
  height: 1.125rem;
@@ -1288,6 +1479,7 @@ input[type="number"]::-webkit-outer-spin-button {
1288
1479
  display: inline-grid;
1289
1480
  }
1290
1481
 
1482
+ /* A tag on a tint of the interactive color, or outlined for a plain list such as a stack. */
1291
1483
  .ws-tag {
1292
1484
  padding: var(--ws-space-2) var(--ws-space-8);
1293
1485
  border-radius: var(--ws-radius-sm);
@@ -1306,8 +1498,14 @@ input[type="number"]::-webkit-outer-spin-button {
1306
1498
  background: none;
1307
1499
  }
1308
1500
 
1501
+ /*
1502
+ * A state as a dot with its word. The word carries the meaning, the dot only repeats it.
1503
+ * The word gives the baseline, so a state lines up with the text beside it.
1504
+ *
1505
+ * <span class="ws-state ws-state--active">active</span>
1506
+ */
1309
1507
  .ws-state {
1310
- align-items: center;
1508
+ align-items: baseline;
1311
1509
  gap: var(--ws-space-8);
1312
1510
  color: var(--ws-color-text-secondary);
1313
1511
  font: var(--ws-text-caption);
@@ -1320,6 +1518,7 @@ input[type="number"]::-webkit-outer-spin-button {
1320
1518
  background: var(--ws-color-text-faint);
1321
1519
  content: "";
1322
1520
  flex: none;
1521
+ align-self: center;
1323
1522
  width: .4375rem;
1324
1523
  height: .4375rem;
1325
1524
  }
@@ -1332,6 +1531,39 @@ input[type="number"]::-webkit-outer-spin-button {
1332
1531
  background: var(--ws-color-warning);
1333
1532
  }
1334
1533
 
1534
+ /*
1535
+ * Status line.
1536
+ *
1537
+ * <footer class="ws-status-line">
1538
+ * <span class="ws-status-line__mode">NORMAL</span>
1539
+ * <span class="ws-status-line__path">
1540
+ * <span class="ws-status-line__file"><span>guide/conditions.md</span></span>
1541
+ * </span>
1542
+ * <span class="ws-status-line__item ws-status-line__item--wide">main</span>
1543
+ * <span class="ws-status-line__keys">
1544
+ * <button type="button" data-ws-key="t"><kbd class="ws-kbd">t</kbd>theme</button>
1545
+ * </span>
1546
+ * <button type="button" class="ws-status-line__switch" role="switch"
1547
+ * aria-label="Shortcut keys" data-ws-keys-switch>
1548
+ * keys
1549
+ * <span class="ws-status-line__on" aria-hidden="true">on</span>
1550
+ * <span class="ws-status-line__off" aria-hidden="true">off</span>
1551
+ * </button>
1552
+ * <button type="button" class="ws-status-line__theme">
1553
+ * <span class="ws-visually-hidden">Switch theme, now</span>
1554
+ * <span class="ws-theme-dark">rose-pine</span>
1555
+ * <span class="ws-theme-light">rose-pine-dawn</span>
1556
+ * </button>
1557
+ * </footer>
1558
+ *
1559
+ * The mode says whether the key hints work: NORMAL, or INSERT while the focus is in a field.
1560
+ * The path takes the room the other items leave, so they always fit.
1561
+ * A key hint is the control itself: pressing the key clicks it (see the shortcuts module).
1562
+ * Hints stay hidden until that module runs, so a hint is never shown for a key that does nothing.
1563
+ * The switch turns the keys off and on again. A status line with key hints carries it.
1564
+ * With the keys off the controls stay, without their key caps.
1565
+ * The theme button names the theme shown and switches it, at every width.
1566
+ */
1335
1567
  .ws-status-line {
1336
1568
  min-height: var(--ws-size-status-line);
1337
1569
  border-top: var(--ws-border-width-thin) solid var(--ws-color-border);
@@ -1359,6 +1591,12 @@ input[type="number"]::-webkit-outer-spin-button {
1359
1591
  letter-spacing: .04em;
1360
1592
  }
1361
1593
 
1594
+ /*
1595
+ * The room the other items leave, which the path takes: the items after it go to the right
1596
+ * edge, as after a spacer. The path gives way to them inside it. It shrinks to its first
1597
+ * character and the ellipsis, then goes as a whole, padding and all, so a part of a
1598
+ * character never shows.
1599
+ */
1362
1600
  .ws-status-line__path {
1363
1601
  flex: 1;
1364
1602
  min-width: 0;
@@ -1378,6 +1616,11 @@ input[type="number"]::-webkit-outer-spin-button {
1378
1616
  overflow: hidden;
1379
1617
  }
1380
1618
 
1619
+ /*
1620
+ * No room for "~…" between the padding of the path, --ws-space-14 on each side. The padding
1621
+ * is written out, as a container query takes no var(). The browser test of the path,
1622
+ * tests/browser/status-line.spec.ts, holds the two together.
1623
+ */
1381
1624
  @container ws-status-line-path (width < calc(2ch + 1.75rem)) {
1382
1625
  .ws-status-line__file {
1383
1626
  display: none;
@@ -1397,14 +1640,17 @@ input[type="number"]::-webkit-outer-spin-button {
1397
1640
  display: none;
1398
1641
  }
1399
1642
 
1400
- [data-ws-keys] .ws-status-line__keys {
1643
+ /* The module says on or off once it runs. The head script's pending is not yet a yes. */
1644
+ :is([data-ws-keys="on"], [data-ws-keys="off"]) .ws-status-line__keys {
1401
1645
  display: flex;
1402
1646
  }
1403
1647
 
1648
+ /* With the keys switched off a control stays and its key cap goes: nothing names a key then. */
1404
1649
  [data-ws-keys="off"] .ws-status-line__keys .ws-kbd {
1405
1650
  display: none;
1406
1651
  }
1407
1652
 
1653
+ /* Without a path and without key hints the items after them still go to the right edge. */
1408
1654
  .ws-status-line__spacer {
1409
1655
  flex: 1;
1410
1656
  }
@@ -1415,6 +1661,12 @@ input[type="number"]::-webkit-outer-spin-button {
1415
1661
  display: flex;
1416
1662
  }
1417
1663
 
1664
+ /*
1665
+ * A control fills the height of the line, also in a group of hints. Its focus ring is drawn
1666
+ * inside it, in padding taken back from the gap between hints with a negative margin, so a
1667
+ * hint does not move. The gap in a group has no room for two rings: there a control after
1668
+ * another takes nothing back at its start, so it moves over and the two only meet.
1669
+ */
1418
1670
  .ws-status-line__keys :is(button, a) {
1419
1671
  align-self: stretch;
1420
1672
  align-items: center;
@@ -1434,6 +1686,14 @@ input[type="number"]::-webkit-outer-spin-button {
1434
1686
  margin-left: 0;
1435
1687
  }
1436
1688
 
1689
+ /*
1690
+ * The keys switch and the theme button. The switch reads "keys on" or "keys off" from its own
1691
+ * state, which the shortcuts module sets, and stays hidden until it has one. Unlike the hints
1692
+ * both show at every width: the numbers of the tabs are keys everywhere, and with the keys
1693
+ * off the switch is the way to turn them on again. The theme button is the theme switch on
1694
+ * a narrow screen, where the hints are hidden. It holds the names of both themes and shows
1695
+ * the one of the theme shown, so it keeps the focus when it switches.
1696
+ */
1437
1697
  .ws-status-line__switch, .ws-status-line__theme {
1438
1698
  align-items: center;
1439
1699
  gap: var(--ws-space-6);
@@ -1461,14 +1721,20 @@ input[type="number"]::-webkit-outer-spin-button {
1461
1721
  display: none;
1462
1722
  }
1463
1723
 
1724
+ /* The status line clips what crosses its edges, so a ring is drawn inside its control. */
1464
1725
  .ws-status-line__keys :is(button, a):focus-visible, .ws-status-line__switch:focus-visible, .ws-status-line__theme:focus-visible {
1465
1726
  outline-offset: calc(-1 * var(--ws-border-width-medium));
1466
1727
  }
1467
1728
 
1729
+ /*
1730
+ * The window cuts off its corners, so a ring in one follows the window's curve: that of the
1731
+ * last control of the status line, and on a narrow screen that of the brand.
1732
+ */
1468
1733
  .ws-term .ws-status-line > :last-child:focus-visible {
1469
1734
  border-bottom-right-radius: calc(var(--ws-radius-xl) - var(--ws-border-width-thin));
1470
1735
  }
1471
1736
 
1737
+ /* Text for assistive technology only, such as the start of the theme button's name. */
1472
1738
  .ws-visually-hidden {
1473
1739
  clip-path: inset(50%);
1474
1740
  white-space: nowrap;
@@ -1502,6 +1768,7 @@ input[type="number"]::-webkit-outer-spin-button {
1502
1768
  padding-right: var(--ws-space-16);
1503
1769
  }
1504
1770
 
1771
+ /* The tabs take a row of their own and share it evenly. */
1505
1772
  .ws-tabs {
1506
1773
  border-top: var(--ws-border-width-thin) solid var(--ws-color-border);
1507
1774
  flex-basis: 100%;
@@ -1521,6 +1788,7 @@ input[type="number"]::-webkit-outer-spin-button {
1521
1788
  justify-content: center;
1522
1789
  }
1523
1790
 
1791
+ /* The row runs from edge to edge, so the current tab has no border at an end of it. */
1524
1792
  .ws-tabs li:first-child a[aria-current] {
1525
1793
  border-left-color: #0000;
1526
1794
  }
@@ -1529,11 +1797,23 @@ input[type="number"]::-webkit-outer-spin-button {
1529
1797
  border-right-color: #0000;
1530
1798
  }
1531
1799
 
1532
- [data-ws-keys] .ws-status-line__keys, .ws-status-line__item--wide {
1800
+ /* The key hints and the wide items do not fit. A key whose hint is hidden does nothing. */
1801
+ :is([data-ws-keys="on"], [data-ws-keys="off"]) .ws-status-line__keys, .ws-status-line__item--wide {
1533
1802
  display: none;
1534
1803
  }
1535
1804
  }
1536
1805
 
1806
+ /*
1807
+ * The ghost as an element: <ws-ghost>. See the ghost module for its markup and behavior.
1808
+ * The body takes the text color and the tongue the brand color, so the free ghost follows
1809
+ * the theme.
1810
+ */
1811
+
1812
+ /*
1813
+ * The one breakpoint of the system. Below it there is one column, the tab bar wraps and
1814
+ * headings take their compact sizes. Custom properties cannot be used in media queries,
1815
+ * so in another project write the query out: @media (width < 64rem).
1816
+ */
1537
1817
  ws-ghost {
1538
1818
  color: var(--ws-color-text);
1539
1819
  vertical-align: middle;
@@ -1558,6 +1838,13 @@ ws-ghost {
1558
1838
  display: block;
1559
1839
  }
1560
1840
 
1841
+ /*
1842
+ * A ghost that is large on a wide screen, such as the one next to the display name, takes a
1843
+ * smaller size on a phone with compact-px: the size of one sprite pixel below 64rem, a whole
1844
+ * number from 1 to 5. The ghost is 10 by 12 sprite pixels.
1845
+ *
1846
+ * <ws-ghost px="6" compact-px="4"></ws-ghost>
1847
+ */
1561
1848
  @media (width < 64rem) {
1562
1849
  ws-ghost[compact-px="1"] .ws-ghost__sprite {
1563
1850
  width: 10px;
@@ -1593,6 +1880,10 @@ ws-ghost {
1593
1880
  fill: var(--ws-color-brand);
1594
1881
  }
1595
1882
 
1883
+ /*
1884
+ * The speech bubble. It is a popover, so it shows above everything and no container clips
1885
+ * it. The script places it next to the ghost and keeps it inside the window.
1886
+ */
1596
1887
  .ws-ghost__bubble {
1597
1888
  z-index: 1000;
1598
1889
  pointer-events: none;
@@ -1623,6 +1914,7 @@ ws-ghost {
1623
1914
  fill: var(--ws-color-bg);
1624
1915
  }
1625
1916
 
1917
+ /* The bubble pops in four frames, like a sprite. With reduced motion it is just there. */
1626
1918
  @media (prefers-reduced-motion: no-preference) {
1627
1919
  .ws-ghost__bubble svg {
1628
1920
  transform-origin: 0 100%;
@@ -1641,6 +1933,7 @@ ws-ghost {
1641
1933
  }
1642
1934
  }
1643
1935
 
1936
+ /* The shout for screen readers. */
1644
1937
  .ws-ghost__live {
1645
1938
  clip-path: inset(50%);
1646
1939
  white-space: nowrap;