@whatsaaaa/design-system 0.7.0 → 0.8.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/README.md CHANGED
@@ -65,7 +65,7 @@ CI runs on every pull request:
65
65
  - the unit tests, with the contrast of every role pair in both themes, the comments of the stylesheets in the built ones, and Nuxt UI's colors read from tokens outside any layer,
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, and no terminal window or bar of one cuts off its content, 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 numbers of the tabs show only while their keys work and keep their place while the keys load, the path of the status line gives way at every width from 320 px and the theme button switches the theme, a `dark` or `light` class chooses the theme as `data-theme` does, an element for one theme shows only in it, the browser's theme-color follows the theme, a control that takes the focus is not left under the status line and no bar or corner of the window cuts off its focus ring, a radius of the page's own wins over the focus ring's and a button without one takes its small corners, with index.css and with tailwind.css, a state lines up with the text beside it, a prompt that wraps keeps its chevron on its first line at every width from 320 px, assistive technology reads the parts of the path above a page title as words of their own, the first tab starts on the border of the sidebar, the pieces of a form fit every width from 320 px (a segmented control works with the keyboard, stands out at 3:1 and takes the selection colors in forced colors, amounts line up at the right in figures of one width, a number field has no spin buttons and its arrow keys step it, wrapped code hangs and stays inside its block, a long email breaks after its @, and the check icon and the ghost files draw), both fonts draw Serbian Latin, an app built on the Tailwind entry takes its utilities, layers and `dark:` and `light:` from the tokens and their theme, Nuxt UI's colors take the roles of the theme chosen around them, 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, and no terminal window or bar of one cuts off its content, 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 numbers of the tabs show only while their keys work and keep their place while the keys load, the path of the status line gives way at every width from 320 px, its items take less padding on a phone and the theme button switches the theme, the content of a window starts at the gutter where the brand of the tab bar does on a phone, in the docs theme too, a `dark` or `light` class chooses the theme as `data-theme` does, an element for one theme shows only in it, the browser's theme-color follows the theme and the page as it is sent has it for both themes, without JavaScript, 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, a button of the docs theme takes its ring and not the browser's, a code group's language stands in the row of its tabs and off its code, a radius of the page's own wins over the focus ring's and a button without one takes its small corners, with index.css and with tailwind.css, a state lines up with the text beside it, a prompt that wraps keeps its chevron on its first line at every width from 320 px, assistive technology reads the parts of the path above a page title as words of their own, the first tab starts on the border of the sidebar, the pieces of a form fit every width from 320 px (a segmented control works with the keyboard, stands out at 3:1 and takes the selection colors in forced colors, amounts line up at the right in figures of one width, the sections of a review share a term column, two fields share a row from 40rem, a number field has no spin buttons and its arrow keys step it, wrapped code hangs and stays inside its block, a long email breaks after its @, and the icons draw at the icon size and the ghost files draw), both fonts draw Serbian Latin, an app built on the Tailwind entry takes its utilities, layers and `dark:` and `light:` from the tokens and their theme, Nuxt UI's colors take the roles of the theme chosen around them, 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
 
@@ -54,9 +54,9 @@
54
54
  }
55
55
 
56
56
  .ws-callout__title:before {
57
+ width: var(--ws-size-icon);
58
+ height: var(--ws-size-icon);
57
59
  content: "";
58
- width: 1rem;
59
- height: 1rem;
60
60
  -webkit-mask: var(--ws-callout-icon) center / contain no-repeat;
61
61
  mask: var(--ws-callout-icon) center / contain no-repeat;
62
62
  background: currentColor;
@@ -5,9 +5,11 @@
5
5
  */
6
6
 
7
7
  /*
8
- * The one breakpoint of the system. Below it there is one column, the tab bar wraps and
9
- * headings take their compact sizes. Custom properties cannot be used in media queries,
10
- * so in another project write the query out: @media (width < 64rem).
8
+ * The two breakpoints of the system. Below --ws-compact there is one column, the tab bar
9
+ * wraps and headings take their compact sizes. Below --ws-narrow, on a phone, a row of
10
+ * fields has no room and each takes a line of its own: from 40rem up two fields fit side
11
+ * by side. Custom properties cannot be used in media queries, so in another project write
12
+ * the queries out: @media (width < 64rem) and @media (width < 40rem).
11
13
  */
12
14
  ws-ghost {
13
15
  color: var(--ws-color-text);
@@ -1,10 +1,12 @@
1
1
  /*
2
2
  * The few icons the styles draw themselves, as masks, so they take the color of their text
3
- * and need no markup. All are 16 x 16 strokes of 1.5.
3
+ * and need no markup. The icons of the callouts, the tick and the calendar are 16 x 16 strokes
4
+ * of 1.5, drawn at --ws-size-icon, 16 px, the size they are drawn for. The chevron of a
5
+ * prompt and the arrow of a link take the size of their text.
4
6
  *
5
7
  * .done::before {
6
- * width: 1rem;
7
- * height: 1rem;
8
+ * width: var(--ws-size-icon);
9
+ * height: var(--ws-size-icon);
8
10
  * background: currentcolor;
9
11
  * content: '';
10
12
  * mask: var(--ws-icon-check) center / contain no-repeat;
@@ -16,6 +18,7 @@
16
18
  --ws-icon-warning: 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 2.2 14.2 13H1.8ZM8 6.6v3M8 11.3v.2'/%3E%3C/svg%3E");
17
19
  --ws-icon-danger: 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='M5.4 1.8h5.2l3.6 3.6v5.2l-3.6 3.6H5.4l-3.6-3.6V5.4ZM8 5v3.6M8 10.9v.2'/%3E%3C/svg%3E");
18
20
  --ws-icon-check: 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='M3 8.5 6.5 12 13 4.5'/%3E%3C/svg%3E");
21
+ --ws-icon-calendar: 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%3Crect x='1.8' y='3' width='12.4' height='11.2' rx='1.8'/%3E%3Cpath d='M1.8 6.8h12.4M5.2 1.8v2.4M10.8 1.8v2.4'/%3E%3C/svg%3E");
19
22
  --ws-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 2 8 7 2 12'/%3E%3C/svg%3E");
20
23
  --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");
21
24
  }
@@ -10,6 +10,18 @@
10
10
  * <div><dt>Email</dt><dd>ana@<wbr />example.com</dd></div>
11
11
  * </dl>
12
12
  *
13
+ * The sections of one review step, each a list under its own heading, share a term column in
14
+ * ws-pairs-group, so the values of every section line up. The column is as wide as the longest
15
+ * term of them all, at most two fifths of the row. A heading, or anything else in the group,
16
+ * takes a row of its own.
17
+ *
18
+ * <div class="ws-pairs-group">
19
+ * <h3>About you</h3>
20
+ * <dl class="ws-pairs">...</dl>
21
+ * <h3>Your visit</h3>
22
+ * <dl class="ws-pairs">...</dl>
23
+ * </div>
24
+ *
13
25
  * Amounts take ws-pairs--amounts: each value at the right edge, in figures of one width, so
14
26
  * the digits of the rows line up, and the terms take the rest of the row. The total is the
15
27
  * last row, ws-pairs__total.
@@ -47,6 +59,27 @@
47
59
  }
48
60
  }
49
61
 
62
+ /*
63
+ * The group holds the columns, and each list in it takes them as its own. A browser without
64
+ * subgrid sizes the term column of each list apart, as without a group. A list of amounts
65
+ * keeps its own columns: its amounts stand at the right edge.
66
+ */
67
+ .ws-pairs-group {
68
+ column-gap: var(--ws-space-16);
69
+ grid-template-columns: fit-content(40%) minmax(0, 1fr);
70
+ display: grid;
71
+ }
72
+
73
+ .ws-pairs-group > * {
74
+ grid-column: 1 / -1;
75
+ }
76
+
77
+ @supports (grid-template-columns: subgrid) {
78
+ .ws-pairs-group > .ws-pairs:not(.ws-pairs--amounts) {
79
+ grid-template-columns: subgrid;
80
+ }
81
+ }
82
+
50
83
  .ws-pairs dt {
51
84
  color: var(--ws-color-text-secondary);
52
85
  font: var(--ws-text-label);
@@ -5,9 +5,11 @@
5
5
  */
6
6
 
7
7
  /*
8
- * The one breakpoint of the system. Below it there is one column, the tab bar wraps and
9
- * headings take their compact sizes. Custom properties cannot be used in media queries,
10
- * so in another project write the query out: @media (width < 64rem).
8
+ * The two breakpoints of the system. Below --ws-compact there is one column, the tab bar
9
+ * wraps and headings take their compact sizes. Below --ws-narrow, on a phone, a row of
10
+ * fields has no room and each takes a line of its own: from 40rem up two fields fit side
11
+ * by side. Custom properties cannot be used in media queries, so in another project write
12
+ * the queries out: @media (width < 64rem) and @media (width < 40rem).
11
13
  */
12
14
  .ws-prose, .vp-doc {
13
15
  color: var(--ws-color-text);
@@ -4,9 +4,11 @@
4
4
  */
5
5
 
6
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).
7
+ * The two breakpoints of the system. Below --ws-compact there is one column, the tab bar
8
+ * wraps and headings take their compact sizes. Below --ws-narrow, on a phone, a row of
9
+ * fields has no room and each takes a line of its own: from 40rem up two fields fit side
10
+ * by side. Custom properties cannot be used in media queries, so in another project write
11
+ * the queries out: @media (width < 64rem) and @media (width < 40rem).
10
12
  */
11
13
 
12
14
  /*
@@ -427,13 +429,23 @@
427
429
  }
428
430
 
429
431
  /*
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.
432
+ * No room for "~…" between the padding of the path, --ws-space-14 on each side, and
433
+ * --ws-space-10 below 64rem. The padding is written out, as a container query takes no var().
434
+ * The browser test of the path, tests/browser/status-line.spec.ts, holds them together.
433
435
  */
434
- @container ws-status-line-path (width < calc(2ch + 1.75rem)) {
435
- .ws-status-line__file {
436
- display: none;
436
+ @media (width >= 64rem) {
437
+ @container ws-status-line-path (width < calc(2ch + 1.75rem)) {
438
+ .ws-status-line__file {
439
+ display: none;
440
+ }
441
+ }
442
+ }
443
+
444
+ @media (width < 64rem) {
445
+ @container ws-status-line-path (width < calc(2ch + 1.25rem)) {
446
+ .ws-status-line__file {
447
+ display: none;
448
+ }
437
449
  }
438
450
  }
439
451
 
@@ -607,6 +619,11 @@
607
619
  border-right-color: #0000;
608
620
  }
609
621
 
622
+ /* The items are padded less on a phone, so the path keeps room for more of itself. */
623
+ .ws-status-line__mode, .ws-status-line__file, .ws-status-line__item, .ws-status-line__switch, .ws-status-line__theme {
624
+ padding-inline: var(--ws-space-10);
625
+ }
626
+
610
627
  /* The key hints and the wide items do not fit. A key whose hint is hidden does nothing. */
611
628
  :is([data-ws-keys="on"], [data-ws-keys="off"]) .ws-status-line__keys, .ws-status-line__item--wide {
612
629
  display: none;
package/dist/index.css CHANGED
@@ -159,6 +159,7 @@
159
159
  --ws-size-content: 50rem;
160
160
  --ws-size-control: 2.5rem;
161
161
  --ws-size-frame: 90rem;
162
+ --ws-size-icon: 1rem;
162
163
  --ws-size-outline: 15rem;
163
164
  --ws-size-sidebar: 17rem;
164
165
  --ws-size-status-line: 2rem;
@@ -411,11 +412,13 @@
411
412
 
412
413
  /*
413
414
  * 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
+ * and need no markup. The icons of the callouts, the tick and the calendar are 16 x 16 strokes
416
+ * of 1.5, drawn at --ws-size-icon, 16 px, the size they are drawn for. The chevron of a
417
+ * prompt and the arrow of a link take the size of their text.
415
418
  *
416
419
  * .done::before {
417
- * width: 1rem;
418
- * height: 1rem;
420
+ * width: var(--ws-size-icon);
421
+ * height: var(--ws-size-icon);
419
422
  * background: currentcolor;
420
423
  * content: '';
421
424
  * mask: var(--ws-icon-check) center / contain no-repeat;
@@ -427,6 +430,7 @@
427
430
  --ws-icon-warning: 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 2.2 14.2 13H1.8ZM8 6.6v3M8 11.3v.2'/%3E%3C/svg%3E");
428
431
  --ws-icon-danger: 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='M5.4 1.8h5.2l3.6 3.6v5.2l-3.6 3.6H5.4l-3.6-3.6V5.4ZM8 5v3.6M8 10.9v.2'/%3E%3C/svg%3E");
429
432
  --ws-icon-check: 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='M3 8.5 6.5 12 13 4.5'/%3E%3C/svg%3E");
433
+ --ws-icon-calendar: 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%3Crect x='1.8' y='3' width='12.4' height='11.2' rx='1.8'/%3E%3Cpath d='M1.8 6.8h12.4M5.2 1.8v2.4M10.8 1.8v2.4'/%3E%3C/svg%3E");
430
434
  --ws-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 2 8 7 2 12'/%3E%3C/svg%3E");
431
435
  --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");
432
436
  }
@@ -999,9 +1003,9 @@ input[type="number"]::-webkit-outer-spin-button {
999
1003
  }
1000
1004
 
1001
1005
  .ws-callout__title:before {
1006
+ width: var(--ws-size-icon);
1007
+ height: var(--ws-size-icon);
1002
1008
  content: "";
1003
- width: 1rem;
1004
- height: 1rem;
1005
1009
  -webkit-mask: var(--ws-callout-icon) center / contain no-repeat;
1006
1010
  mask: var(--ws-callout-icon) center / contain no-repeat;
1007
1011
  background: currentColor;
@@ -1122,6 +1126,18 @@ input[type="number"]::-webkit-outer-spin-button {
1122
1126
  * <div><dt>Email</dt><dd>ana@<wbr />example.com</dd></div>
1123
1127
  * </dl>
1124
1128
  *
1129
+ * The sections of one review step, each a list under its own heading, share a term column in
1130
+ * ws-pairs-group, so the values of every section line up. The column is as wide as the longest
1131
+ * term of them all, at most two fifths of the row. A heading, or anything else in the group,
1132
+ * takes a row of its own.
1133
+ *
1134
+ * <div class="ws-pairs-group">
1135
+ * <h3>About you</h3>
1136
+ * <dl class="ws-pairs">...</dl>
1137
+ * <h3>Your visit</h3>
1138
+ * <dl class="ws-pairs">...</dl>
1139
+ * </div>
1140
+ *
1125
1141
  * Amounts take ws-pairs--amounts: each value at the right edge, in figures of one width, so
1126
1142
  * the digits of the rows line up, and the terms take the rest of the row. The total is the
1127
1143
  * last row, ws-pairs__total.
@@ -1159,6 +1175,27 @@ input[type="number"]::-webkit-outer-spin-button {
1159
1175
  }
1160
1176
  }
1161
1177
 
1178
+ /*
1179
+ * The group holds the columns, and each list in it takes them as its own. A browser without
1180
+ * subgrid sizes the term column of each list apart, as without a group. A list of amounts
1181
+ * keeps its own columns: its amounts stand at the right edge.
1182
+ */
1183
+ .ws-pairs-group {
1184
+ column-gap: var(--ws-space-16);
1185
+ grid-template-columns: fit-content(40%) minmax(0, 1fr);
1186
+ display: grid;
1187
+ }
1188
+
1189
+ .ws-pairs-group > * {
1190
+ grid-column: 1 / -1;
1191
+ }
1192
+
1193
+ @supports (grid-template-columns: subgrid) {
1194
+ .ws-pairs-group > .ws-pairs:not(.ws-pairs--amounts) {
1195
+ grid-template-columns: subgrid;
1196
+ }
1197
+ }
1198
+
1162
1199
  .ws-pairs dt {
1163
1200
  color: var(--ws-color-text-secondary);
1164
1201
  font: var(--ws-text-label);
@@ -1617,13 +1654,23 @@ input[type="number"]::-webkit-outer-spin-button {
1617
1654
  }
1618
1655
 
1619
1656
  /*
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.
1657
+ * No room for "~…" between the padding of the path, --ws-space-14 on each side, and
1658
+ * --ws-space-10 below 64rem. The padding is written out, as a container query takes no var().
1659
+ * The browser test of the path, tests/browser/status-line.spec.ts, holds them together.
1623
1660
  */
1624
- @container ws-status-line-path (width < calc(2ch + 1.75rem)) {
1625
- .ws-status-line__file {
1626
- display: none;
1661
+ @media (width >= 64rem) {
1662
+ @container ws-status-line-path (width < calc(2ch + 1.75rem)) {
1663
+ .ws-status-line__file {
1664
+ display: none;
1665
+ }
1666
+ }
1667
+ }
1668
+
1669
+ @media (width < 64rem) {
1670
+ @container ws-status-line-path (width < calc(2ch + 1.25rem)) {
1671
+ .ws-status-line__file {
1672
+ display: none;
1673
+ }
1627
1674
  }
1628
1675
  }
1629
1676
 
@@ -1797,6 +1844,11 @@ input[type="number"]::-webkit-outer-spin-button {
1797
1844
  border-right-color: #0000;
1798
1845
  }
1799
1846
 
1847
+ /* The items are padded less on a phone, so the path keeps room for more of itself. */
1848
+ .ws-status-line__mode, .ws-status-line__file, .ws-status-line__item, .ws-status-line__switch, .ws-status-line__theme {
1849
+ padding-inline: var(--ws-space-10);
1850
+ }
1851
+
1800
1852
  /* The key hints and the wide items do not fit. A key whose hint is hidden does nothing. */
1801
1853
  :is([data-ws-keys="on"], [data-ws-keys="off"]) .ws-status-line__keys, .ws-status-line__item--wide {
1802
1854
  display: none;
@@ -1810,9 +1862,11 @@ input[type="number"]::-webkit-outer-spin-button {
1810
1862
  */
1811
1863
 
1812
1864
  /*
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).
1865
+ * The two breakpoints of the system. Below --ws-compact there is one column, the tab bar
1866
+ * wraps and headings take their compact sizes. Below --ws-narrow, on a phone, a row of
1867
+ * fields has no room and each takes a line of its own: from 40rem up two fields fit side
1868
+ * by side. Custom properties cannot be used in media queries, so in another project write
1869
+ * the queries out: @media (width < 64rem) and @media (width < 40rem).
1816
1870
  */
1817
1871
  ws-ghost {
1818
1872
  color: var(--ws-color-text);
@@ -160,6 +160,7 @@
160
160
  --spacing-content: var(--ws-size-content);
161
161
  --spacing-control: var(--ws-size-control);
162
162
  --spacing-frame: var(--ws-size-frame);
163
+ --spacing-icon: var(--ws-size-icon);
163
164
  --spacing-outline: var(--ws-size-outline);
164
165
  --spacing-sidebar: var(--ws-size-sidebar);
165
166
  --spacing-status-line: var(--ws-size-status-line);
@@ -200,7 +201,8 @@
200
201
  --default-transition-timing-function: var(--ws-motion-easing-standard);
201
202
 
202
203
  /*
203
- * The one breakpoint is Tailwind's lg, 64rem: max-lg: is the system's compact width,
204
- * width < 64rem. The other breakpoints stay for code that expects them.
204
+ * The two breakpoints are Tailwind's lg, 64rem, and sm, 40rem: max-lg: is the system's
205
+ * compact width, width < 64rem, and max-sm: its narrow width, width < 40rem, where a row of
206
+ * fields stacks. The other breakpoints stay for code that expects them.
205
207
  */
206
208
  }
@@ -0,0 +1,8 @@
1
+ /** The attributes of one theme-color tag. */
2
+ export interface ThemeColorMeta {
3
+ name: 'theme-color';
4
+ content: string;
5
+ media: string;
6
+ }
7
+ /** The tags as attributes, for a framework that writes the <head> from data. */
8
+ export declare const themeColorMeta: readonly ThemeColorMeta[];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The theme-color tags of the served HTML, for a visitor without JavaScript and for a link
3
+ * preview, which read the page as the server sends it: the background of the dark theme,
4
+ * unless the system asks for light, as the stylesheet chooses with no choice by hand. The
5
+ * head script of the theme module takes them over from the first paint on and gives them the
6
+ * background of the theme shown, a choice by hand included.
7
+ *
8
+ * The dark tag comes first, so a reader that ignores media, such as a link preview, takes the
9
+ * system's default theme. It reads the tokens, so it is for a build or a server, and not for
10
+ * the page's own script: the theme module itself carries no color.
11
+ */
12
+ import { resolver } from '../../dist/tokens.js';
13
+ import { colorHex } from "../color.js";
14
+ const background = (theme) => colorHex(resolver.apply({ theme })['color.bg'].$value);
15
+ /** The tags as attributes, for a framework that writes the <head> from data. */
16
+ export const themeColorMeta = [
17
+ {
18
+ name: 'theme-color',
19
+ content: background('dark'),
20
+ media: 'not all and (prefers-color-scheme: light)',
21
+ },
22
+ { name: 'theme-color', content: background('light'), media: '(prefers-color-scheme: light)' },
23
+ ];
package/dist/tokens.css CHANGED
@@ -128,6 +128,8 @@
128
128
  --ws-size-control: 2.5rem;
129
129
  /* Widest a page frame gets. */
130
130
  --ws-size-frame: 90rem;
131
+ /* An icon next to text, such as a tick, the icon of a callout or a calendar. */
132
+ --ws-size-icon: 1rem;
131
133
  /* Page outline. */
132
134
  --ws-size-outline: 15rem;
133
135
  /* Side navigation. */
package/dist/tokens.d.ts CHANGED
@@ -147,6 +147,7 @@ export interface Tokens {
147
147
  "size.content": Dimension;
148
148
  "size.control": Dimension;
149
149
  "size.frame": Dimension;
150
+ "size.icon": Dimension;
150
151
  "size.outline": Dimension;
151
152
  "size.sidebar": Dimension;
152
153
  "size.status-line": Dimension;
package/dist/tokens.js CHANGED
@@ -121,6 +121,7 @@ export const PERMUTATIONS = {
121
121
  "size.content":{"$type":"dimension","$description":"Widest a column of long-form text gets, padding included.","$value":{"value":50,"unit":"rem"}},
122
122
  "size.control":{"$type":"dimension","$description":"Height of a one-line field, a button and a segmented control.","$value":{"value":2.5,"unit":"rem"}},
123
123
  "size.frame":{"$type":"dimension","$description":"Widest a page frame gets.","$value":{"value":90,"unit":"rem"}},
124
+ "size.icon":{"$type":"dimension","$description":"An icon next to text, such as a tick, the icon of a callout or a calendar.","$value":{"value":1,"unit":"rem"}},
124
125
  "size.outline":{"$type":"dimension","$description":"Page outline.","$value":{"value":15,"unit":"rem"}},
125
126
  "size.sidebar":{"$type":"dimension","$description":"Side navigation.","$value":{"value":17,"unit":"rem"}},
126
127
  "size.status-line":{"$type":"dimension","$description":"Height of the status line.","$value":{"value":2,"unit":"rem"}},
@@ -286,6 +287,7 @@ export const PERMUTATIONS = {
286
287
  "size.content":{"$type":"dimension","$description":"Widest a column of long-form text gets, padding included.","$value":{"value":50,"unit":"rem"}},
287
288
  "size.control":{"$type":"dimension","$description":"Height of a one-line field, a button and a segmented control.","$value":{"value":2.5,"unit":"rem"}},
288
289
  "size.frame":{"$type":"dimension","$description":"Widest a page frame gets.","$value":{"value":90,"unit":"rem"}},
290
+ "size.icon":{"$type":"dimension","$description":"An icon next to text, such as a tick, the icon of a callout or a calendar.","$value":{"value":1,"unit":"rem"}},
289
291
  "size.outline":{"$type":"dimension","$description":"Page outline.","$value":{"value":15,"unit":"rem"}},
290
292
  "size.sidebar":{"$type":"dimension","$description":"Side navigation.","$value":{"value":17,"unit":"rem"}},
291
293
  "size.status-line":{"$type":"dimension","$description":"Height of the status line.","$value":{"value":2,"unit":"rem"}},
@@ -1,6 +1,7 @@
1
1
  import { codeTheme } from "../shiki/index.js";
2
2
  import { keysInitScript } from "../shortcuts/index.js";
3
3
  import { themeColorScript } from "../theme/color.js";
4
+ import { themeColorMeta } from "../theme/meta.js";
4
5
  import { whatsaaaaMarkdown } from "./markdown.js";
5
6
  export { whatsaaaaMarkdown } from "./markdown.js";
6
7
  /**
@@ -23,6 +24,8 @@ export function whatsaaaaConfig() {
23
24
  ['script', { id: 'ws-theme' }, themeScript],
24
25
  // the browser's own bars take the background of the theme shown, as VitePress switches it
25
26
  ['script', { id: 'ws-theme-color' }, themeColorScript],
27
+ // and the served page has their colors, for a visitor without JavaScript and a link preview
28
+ ...themeColorMeta.map((meta) => ['meta', { ...meta }]),
26
29
  // from the first paint the keys are pending, so the numbers of the tabs keep their place
27
30
  // unseen until the module runs, or off where they are remembered so, with no numbers
28
31
  ['script', { id: 'ws-keys' }, keysInitScript],
package/docs/usage.md CHANGED
@@ -18,21 +18,21 @@ One import has everything: fonts, tokens, page defaults and every class.
18
18
 
19
19
  Or take pieces. `tokens.css` and `fonts.css` first, then what you use:
20
20
 
21
- | Import | What it has |
22
- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
23
- | `@whatsaaaa/design-system/tokens.css` | Every token as a CSS variable, for both themes |
24
- | `@whatsaaaa/design-system/fonts.css` | JetBrains Mono and Inter, self-hosted, with Serbian Latin |
25
- | `@whatsaaaa/design-system/css/base.css` | Page defaults. It resets margins and list markers |
26
- | `@whatsaaaa/design-system/css/prose.css` | Long-form text, in a `.ws-prose` container |
27
- | `@whatsaaaa/design-system/css/code.css` | `.ws-code`, a code block with a caption |
28
- | `@whatsaaaa/design-system/css/callout.css` | `.ws-callout` |
29
- | `@whatsaaaa/design-system/css/segmented.css` | `.ws-segmented`, buttons in a row with one pressed |
30
- | `@whatsaaaa/design-system/css/pairs.css` | `.ws-pairs`, terms and their values, such as an order summary |
31
- | `@whatsaaaa/design-system/css/terminal.css` | Tab bar, prompts, status line, key caps, tags. It brings `theme.css` along |
32
- | `@whatsaaaa/design-system/css/theme.css` | `ws-theme-dark` and `ws-theme-light`, for an element of one theme only |
33
- | `@whatsaaaa/design-system/css/ghost.css` | Styles of `<ws-ghost>` |
34
- | `@whatsaaaa/design-system/css/icons.css` | The icons the callouts and prompts draw, and `--ws-icon-check`, the tick of a form. Needed with `callout.css` and `terminal.css`, and for the tick |
35
- | `@whatsaaaa/design-system/css/nuxt-ui.css` | Nuxt UI's colors on the roles. Only in an app on Nuxt UI, after it: see With Tailwind CSS below |
21
+ | Import | What it has |
22
+ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
23
+ | `@whatsaaaa/design-system/tokens.css` | Every token as a CSS variable, for both themes |
24
+ | `@whatsaaaa/design-system/fonts.css` | JetBrains Mono and Inter, self-hosted, with Serbian Latin |
25
+ | `@whatsaaaa/design-system/css/base.css` | Page defaults. It resets margins and list markers |
26
+ | `@whatsaaaa/design-system/css/prose.css` | Long-form text, in a `.ws-prose` container |
27
+ | `@whatsaaaa/design-system/css/code.css` | `.ws-code`, a code block with a caption |
28
+ | `@whatsaaaa/design-system/css/callout.css` | `.ws-callout` |
29
+ | `@whatsaaaa/design-system/css/segmented.css` | `.ws-segmented`, buttons in a row with one pressed |
30
+ | `@whatsaaaa/design-system/css/pairs.css` | `.ws-pairs`, terms and their values, such as an order summary, and `.ws-pairs-group` |
31
+ | `@whatsaaaa/design-system/css/terminal.css` | Tab bar, prompts, status line, key caps, tags. It brings `theme.css` along |
32
+ | `@whatsaaaa/design-system/css/theme.css` | `ws-theme-dark` and `ws-theme-light`, for an element of one theme only |
33
+ | `@whatsaaaa/design-system/css/ghost.css` | Styles of `<ws-ghost>` |
34
+ | `@whatsaaaa/design-system/css/icons.css` | The icons the callouts and prompts draw, and the icons of a form: `--ws-icon-check`, the tick, and `--ws-icon-calendar`. Needed with `callout.css` and `terminal.css`, and for those |
35
+ | `@whatsaaaa/design-system/css/nuxt-ui.css` | Nuxt UI's colors on the roles. Only in an app on Nuxt UI, after it: see With Tailwind CSS below |
36
36
 
37
37
  Everything is prefixed: classes with `ws-`, variables with `--ws-`. Only `nuxt-ui.css` sets variables of another prefix, Nuxt UI's `--ui-*`.
38
38
 
@@ -83,7 +83,7 @@ The tokens are Tailwind's theme, and a utility reads its token where it is used,
83
83
  | `rounded-md` | The radii, by name only, so no bare `rounded`. `rounded-full` is Tailwind's own |
84
84
  | `border-thin` | The border widths. There are no shadow utilities |
85
85
  | `ease-standard`, `transition` | The easings. A transition takes `--ws-motion-duration-fast` |
86
- | `max-lg:` | The one breakpoint: below 64rem |
86
+ | `max-lg:`, `max-sm:` | The two breakpoints: below 64rem and below 40rem |
87
87
 
88
88
  The entry takes out Tailwind's defaults that no token stands behind, as the system colors interface with its roles only and draws edges with borders, not shadows. As classes their utilities compile to nothing, with no error. In `@apply`, in the app's CSS or a component's `<style>` block, one fails the build with `Cannot apply unknown utility class`:
89
89
 
@@ -146,13 +146,14 @@ setTheme('system') // follows the system again
146
146
 
147
147
  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.
148
148
 
149
- A bundler does not copy a plain script out of `node_modules`, so in an app built with Vite inline both head scripts, this one and the one of the keys in section 7, with a plugin. They come from the installed package, so they stay in step with it:
149
+ A bundler does not copy a plain script out of `node_modules`, so in an app built with Vite inline both head scripts, this one and the one of the keys in section 7, with a plugin, and the theme-color tags below with them. They come from the installed package, so they stay in step with it:
150
150
 
151
151
  ```ts
152
152
  // vite.config.ts
153
153
  import { defineConfig, type Plugin } from 'vite'
154
154
  import { keysInitScript } from '@whatsaaaa/design-system/shortcuts'
155
155
  import { themeInitScript } from '@whatsaaaa/design-system/theme'
156
+ import { themeColorMeta } from '@whatsaaaa/design-system/theme/meta'
156
157
 
157
158
  function designSystemHead(): Plugin {
158
159
  return {
@@ -161,6 +162,11 @@ function designSystemHead(): Plugin {
161
162
  // before Vite adds the stylesheet and the app's script to the <head>
162
163
  order: 'pre',
163
164
  handler: () => [
165
+ ...themeColorMeta.map((attrs) => ({
166
+ tag: 'meta',
167
+ attrs: { ...attrs },
168
+ injectTo: 'head' as const,
169
+ })),
164
170
  { tag: 'script', children: themeInitScript, injectTo: 'head' },
165
171
  { tag: 'script', children: keysInitScript, injectTo: 'head' },
166
172
  ],
@@ -173,19 +179,21 @@ export default defineConfig({
173
179
  })
174
180
  ```
175
181
 
176
- The browser's own bars, such as a phone's address bar, take the background of the theme shown, `--ws-color-bg`. The head script keeps `<meta name="theme-color">` at it from the first paint on, when the theme is chosen by hand, with `setTheme`, `toggleTheme` or anything else that sets `data-theme` or the class of `<html>`, and when the system's theme changes. A page that has no theme-color tag gets one, so the head needs no tag of its own and no color in it:
182
+ The browser's own bars, such as a phone's address bar, take the background of the theme shown, `--ws-color-bg`. Put the two theme-color tags in the `<head>` the server sends: the background of the dark theme, and of the light one where the system asks for light, as the stylesheet chooses. So a visitor without JavaScript, and a link preview such as a chat app's, which reads the page as it is sent, get the color too. The dark tag comes first, for a reader that takes the first tag and ignores `media`. The head script then keeps every theme-color tag at the theme shown, from the first paint on, when the theme is chosen by hand, with `setTheme`, `toggleTheme` or anything else that sets `data-theme` or the class of `<html>`, and when the system's theme changes:
177
183
 
178
184
  ```html
179
185
  <head>
180
186
  <meta charset="utf-8" />
181
187
  <meta name="viewport" content="width=device-width, initial-scale=1" />
188
+ <meta name="theme-color" content="#191724" media="not all and (prefers-color-scheme: light)" />
189
+ <meta name="theme-color" content="#faf4ed" media="(prefers-color-scheme: light)" />
182
190
  <script src=".../theme/init.js"></script>
183
191
  <script src=".../shortcuts/init.js"></script>
184
192
  <link rel="stylesheet" href=".../index.css" />
185
193
  </head>
186
194
  ```
187
195
 
188
- 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.
196
+ These are the only colors to write out by hand, as a `<meta>` cannot read a variable. Take them from the package where a build writes the `<head>`: `themeColorMeta` from `@whatsaaaa/design-system/theme/meta` is the attributes of the two tags, as in the Vite plugin above. It reads the tokens, so import it in the build or on the server, not in the page's own script. Without the tags the head script adds one, so a page still gets the color once its script runs. Do not set it from a script of your own. A docs site gets the tags and the script from the base config of the docs theme.
189
197
 
190
198
  An element for one theme only, such as a cut of a mark, takes `ws-theme-dark` or `ws-theme-light`. Put both in the page and the styles show the one of the theme in effect where it stands: the nearest `data-theme` or `dark` or `light` class, on `<html>` or on an element around it, or the system's theme. So the right one shows before any script runs. Do not swap them from a script.
191
199
 
@@ -226,11 +234,12 @@ Do not load other fonts, and do not load these from a CDN. Set `font-variant-lig
226
234
  ## 5. Space, radius, motion
227
235
 
228
236
  - Space: `--ws-space-2` to `--ws-space-64`, named by px, set in rem. Use them for padding, margin and gap.
229
- - Sizes: `--ws-size-control` (40 px) is the height of a one-line field, a button and a segmented control. `--ws-size-check` (20 px) is a checkbox or a radio button and `--ws-size-step` (24 px) the circle of a step number. Use them for those, not a space token.
237
+ - The gutter of a phone is `--ws-space-16`. Below 64rem the tab bar starts its brand that far in from the window's edge, and ends its end that far from the other. Pad what is under it by the same, a pane, a page or a form, and its content starts at the pixel the brand starts at. From 64rem a pane takes the padding of its own design.
238
+ - Sizes: `--ws-size-control` (40 px) is the height of a one-line field, a button and a segmented control. `--ws-size-check` (20 px) is a checkbox or a radio button, `--ws-size-step` (24 px) the circle of a step number and `--ws-size-icon` (16 px) an icon next to text. Use them for those, not a space token.
230
239
  - Radius: `--ws-radius-xs` (key caps), `-sm` (inline code, tags), `-md` (inputs, buttons), `-lg` (blocks, cards), `-xl` (the window), `-full` (dots).
231
240
  - Borders, not shadows: `--ws-border-width-thin`, `-medium`, `-thick`.
232
241
  - Motion: `--ws-motion-duration-fast`, `-base`, `-slow` with `--ws-motion-easing-standard`. Wrap movement in `@media (prefers-reduced-motion: no-preference)`.
233
- - One breakpoint: `@media (width < 64rem)`.
242
+ - Two breakpoints. Below `64rem`, `@media (width < 64rem)`, a page has one column, the tab bar wraps and headings take their compact sizes. Below `40rem`, `@media (width < 40rem)`, a row of fields stacks, one field to a line: from 40rem up two fields fit side by side.
234
243
 
235
244
  ## 6. Classes
236
245
 
@@ -240,7 +249,7 @@ Do not load other fonts, and do not load these from a CDN. Set `font-variant-lig
240
249
  - 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"`. The tabs are optional: a site of one page has nothing to tab to, and a tab that only reloads the page would lose what was typed in it. Its bar is the brand and the end.
241
250
  - The path above a page title: `<p class="ws-crumb"><span>writing</span><span>form-builder</span><span>conditions</span></p>`, right before the `<h1>`. The slashes between the parts are drawn, and assistive technology reads a comma in their place, so the parts come out as words of their own. It comes with `prose.css`.
242
251
  - 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.
243
- - Forms: `ws-segmented` and `ws-pairs`. See [forms](#forms).
252
+ - Forms: `ws-segmented`, `ws-pairs` and `ws-pairs-group`. See [forms](#forms).
244
253
 
245
254
  The markup of each piece is in the comment above its rules, in its stylesheet in `dist/css/` and in `dist/index.css`, and in the style guide.
246
255
 
@@ -262,7 +271,7 @@ The markup of each piece is in the comment above its rules, in its stylesheet in
262
271
  ```
263
272
 
264
273
  - **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`.
265
- - **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.
274
+ - **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. The status line pads its items `--ws-space-14` on each side, and `--ws-space-10` below 64rem, so on a phone the path has more room. A status line without a path puts `<span class="ws-status-line__spacer"></span>` where the path would be.
266
275
  - **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.
267
276
  - 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`.
268
277
  - 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))`.
@@ -272,8 +281,10 @@ The markup of each piece is in the comment above its rules, in its stylesheet in
272
281
  The system draws no fields and no buttons: draw them from the roles, with these.
273
282
 
274
283
  - **One height.** A one-line field, a button and a segmented control are `--ws-size-control` tall. A checkbox or a radio button is `--ws-size-check`, a step number's circle `--ws-size-step`.
284
+ - **Rows of fields.** Fields that belong together, such as a date and a time, may share a row from 40rem up. Below it, `@media (width < 40rem)`, each takes a line of its own.
275
285
  - **The primary button** is filled with `--ws-color-interactive`, its label `--ws-color-on-interactive`. Under the pointer it takes `--ws-color-interactive-hover`, while pressed `--ws-color-interactive-active`. Do not mix a hover color of your own.
276
- - **A tick** is `--ws-icon-check` from `css/icons.css`, a mask like the other icons: a ticked box, a done step, a sent form. Draw it at 1rem in `currentcolor`, or `--ws-color-on-interactive` on a checked box.
286
+ - **A tick** is `--ws-icon-check` from `css/icons.css`, a mask like the other icons: a ticked box, a done step, a sent form. Draw it at `--ws-size-icon` in `currentcolor`, or `--ws-color-on-interactive` on a checked box.
287
+ - **A date** has `--ws-icon-calendar`, such as on the button that opens a date picker, at `--ws-size-icon` in `currentcolor`. Do not draw your own.
277
288
  - **A number field has no spin buttons.** `base.css` hides the browser's own, and the arrow keys still step the value. Without `base.css`, hide them the same way: `appearance: textfield` on the field, and `appearance: none` on its `::-webkit-inner-spin-button` and `::-webkit-outer-spin-button`.
278
289
 
279
290
  A **segmented control** is a few buttons with one pressed, such as a switch between the languages of a page:
@@ -314,6 +325,26 @@ A **segmented control** is a few buttons with one pressed, such as a switch betw
314
325
 
315
326
  - `ws-pairs--amounts` is for money and other numbers: each value at the right edge, in figures of one width, so the digits of the rows line up. Write each amount whole, with its currency and the same number of decimals.
316
327
  - `ws-pairs__total` is the last row: set off by a solid rule, and semibold.
328
+ - **Sections that line up.** A review step of several sections, each a list under its own heading, puts them in one `ws-pairs-group`: the lists share a term column, as wide as the longest term of them all, so the values of every section start at one edge. Each heading, or anything else in the group, takes a row of its own. A list of amounts in the group keeps its own columns.
329
+
330
+ ```html
331
+ <div class="ws-pairs-group">
332
+ <h3>About you</h3>
333
+ <dl class="ws-pairs">
334
+ <div>
335
+ <dt>Name</dt>
336
+ <dd>Milica Đorđević</dd>
337
+ </div>
338
+ </dl>
339
+ <h3>Your visit</h3>
340
+ <dl class="ws-pairs">
341
+ <div>
342
+ <dt>Workshop</dt>
343
+ <dd>Forms that check themselves</dd>
344
+ </div>
345
+ </dl>
346
+ </div>
347
+ ```
317
348
 
318
349
  ### Code blocks
319
350
 
@@ -425,7 +456,7 @@ export default defineConfigWithTheme<ThemeConfig>({
425
456
 
426
457
  Keep the site's nav, sidebar and search config as they are. Do not restyle the theme with `--vp-*` variables: change a token here instead.
427
458
 
428
- From 60rem up the brand has a box as wide as the sidebar, 17rem with the sidebar's padding, and the first tab starts on the sidebar's border, on pages without a sidebar too. With a logo there is room for about 23 characters in the site title, without one about 28. A longer title is cut with an ellipsis: shorten it with `themeConfig.siteTitle`. A short one leaves a gap before the tabs. The labels of the tabs have no such limit: a long one moves the tabs after it. Below 60rem there is no sidebar and the tabs follow the brand, and on a phone they take a row of their own under it.
459
+ From 60rem up the brand has a box as wide as the sidebar, 17rem with the sidebar's padding, and the first tab starts on the sidebar's border, on pages without a sidebar too. With a logo there is room for about 23 characters in the site title, without one about 28. A longer title is cut with an ellipsis: shorten it with `themeConfig.siteTitle`. A short one leaves a gap before the tabs. The labels of the tabs have no such limit: a long one moves the tabs after it. Below 60rem there is no sidebar and the tabs follow the brand, and on a phone they take a row of their own under it. On a phone, below 48rem, the page, the row of its menu and the home page's hero, features and content take the gutter of a phone, as the brand does.
429
460
 
430
461
  ## 11. Data
431
462
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatsaaaa/design-system",
3
- "version": "0.7.0",
3
+ "version": "0.8.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",
@@ -45,6 +45,10 @@
45
45
  "default": "./dist/theme/index.js"
46
46
  },
47
47
  "./theme/init.js": "./dist/theme/init.js",
48
+ "./theme/meta": {
49
+ "types": "./dist/theme/meta.d.ts",
50
+ "default": "./dist/theme/meta.js"
51
+ },
48
52
  "./shortcuts": {
49
53
  "types": "./dist/shortcuts/index.d.ts",
50
54
  "default": "./dist/shortcuts/index.js"
@@ -166,20 +166,32 @@
166
166
  color: var(--ws-code-text);
167
167
  }
168
168
 
169
- /* a group of code blocks shares one frame, and its tabs are the caption */
169
+ /*
170
+ * A group of code blocks shares one frame, and its tabs are the caption: the language and
171
+ * the copy button of the block shown stand at its right end, as in the caption of a block on
172
+ * its own. The tabs end where the language starts, 6rem from the right as the file name of a
173
+ * block does, so a tab never runs under it. The frame draws the caption's background and its
174
+ * rule across the whole width.
175
+ */
170
176
  .vp-doc .vp-code-group {
171
177
  margin-top: var(--ws-space-16);
172
178
  overflow: hidden;
173
179
  border: var(--ws-border-width-thin) solid var(--ws-code-border);
174
180
  border-radius: var(--ws-radius-lg);
181
+ background: var(--ws-code-header-bg);
175
182
  color-scheme: dark;
176
183
  }
177
184
 
178
185
  .vp-doc .vp-code-group .tabs {
179
- margin: 0;
186
+ margin: 0 6rem 0 0;
180
187
  padding: 0 var(--ws-space-8);
181
188
  border-radius: 0;
182
- box-shadow: inset 0 -1px var(--ws-code-border);
189
+ background: none;
190
+ box-shadow: none;
191
+ }
192
+
193
+ .vp-doc .vp-code-group .blocks {
194
+ box-shadow: 0 calc(-1 * var(--ws-border-width-thin)) var(--ws-code-border);
183
195
  }
184
196
 
185
197
  .vp-doc .vp-code-group .tabs label {
@@ -199,6 +211,7 @@
199
211
  .vp-doc .vp-code-group div[class*='language-'] {
200
212
  margin: 0;
201
213
  padding-top: 0;
214
+ overflow: visible;
202
215
  border: 0;
203
216
  border-radius: 0;
204
217
  }
@@ -208,12 +221,13 @@
208
221
  display: none;
209
222
  }
210
223
 
224
+ /* up into the row of the tabs: a caption's height and the rule under the tabs */
211
225
  .vp-doc .vp-code-group div[class*='language-'] > span.lang {
212
- top: var(--ws-space-4);
226
+ top: calc(-1 * (var(--ws-caption) + var(--ws-border-width-thin)));
213
227
  }
214
228
 
215
229
  .vp-doc .vp-code-group div[class*='language-'] > button.copy {
216
- top: var(--ws-space-8);
230
+ top: calc(0.375rem - var(--ws-caption) - var(--ws-border-width-thin));
217
231
  }
218
232
 
219
233
  /* custom blocks: a bar in the status color, a label with an icon, then text */
@@ -266,8 +280,8 @@
266
280
 
267
281
  .vp-doc .custom-block .custom-block-title::before {
268
282
  flex: none;
269
- width: 1rem;
270
- height: 1rem;
283
+ width: var(--ws-size-icon);
284
+ height: var(--ws-size-icon);
271
285
  background: currentcolor;
272
286
  content: '';
273
287
  mask: var(--ws-callout-icon) center / contain no-repeat;
@@ -45,3 +45,21 @@
45
45
  border-radius: var(--ws-radius-md);
46
46
  background: var(--ws-color-raised);
47
47
  }
48
+
49
+ /*
50
+ * The gutter of a phone, as on every page: the hero, the cards of the features and the page's
51
+ * own content start where the brand does. The default theme pads them 24 px there, and 48 px
52
+ * from 40rem.
53
+ */
54
+ @media (width < 48rem) {
55
+ .VPHome .VPHero.VPHero,
56
+ .VPHome .VPFeatures.VPFeatures,
57
+ .VPHome > .vp-doc.container {
58
+ padding-inline: var(--ws-space-16);
59
+ }
60
+
61
+ /* the image of the hero reaches the edges of the window, through the gutter */
62
+ .VPHome .VPHero.VPHero .image {
63
+ margin-inline: calc(-1 * var(--ws-space-16));
64
+ }
65
+ }
@@ -22,7 +22,13 @@ body {
22
22
  color: var(--ws-color-text);
23
23
  }
24
24
 
25
- :focus-visible {
25
+ /*
26
+ * The default theme gives a button the browser's own ring, as button:focus-visible, which
27
+ * weighs more than :focus-visible alone. A button takes the theme's ring too: a tab that opens
28
+ * a menu, the copy button of a code block, the controls of the status line.
29
+ */
30
+ :focus-visible,
31
+ button:focus-visible {
26
32
  outline: var(--ws-border-width-medium) solid var(--ws-color-interactive);
27
33
  outline-offset: 2px;
28
34
  }
@@ -40,11 +46,6 @@ body {
40
46
  height: var(--ws-size-status-line);
41
47
  }
42
48
 
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
-
48
49
  .WsStatusLine .WsStatusLine-pair {
49
50
  gap: var(--ws-space-6);
50
51
  }
@@ -65,6 +66,25 @@ body {
65
66
  font: var(--ws-text-caption);
66
67
  }
67
68
 
69
+ /*
70
+ * The gutter of a phone, 16 px, as in the terminal frame: below 48rem, where the default theme
71
+ * lays out for a phone, the page and the row of the menu start where the brand does and end
72
+ * where the lines of the menu button do. The default theme pads them 24 px.
73
+ */
74
+ @media (width < 48rem) {
75
+ .VPDoc.VPDoc,
76
+ .VPFooter.VPFooter,
77
+ .VPLocalNav.VPLocalNav .menu,
78
+ .WsNotFound.WsNotFound {
79
+ padding-inline: var(--ws-space-16);
80
+ }
81
+
82
+ /* the chevron is drawn 4 px inside its box */
83
+ .VPLocalNav.VPLocalNav .VPLocalNavOutlineDropdown {
84
+ padding-right: var(--ws-space-12);
85
+ }
86
+ }
87
+
68
88
  /* skip link */
69
89
  .VPSkipLink.VPSkipLink {
70
90
  border-radius: var(--ws-radius-md);
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  .VPNav .VPNavBar .wrapper {
21
- padding: 0 var(--ws-space-8) 0 var(--ws-space-16);
21
+ padding: 0 var(--ws-space-16);
22
22
  }
23
23
 
24
24
  .VPNav .VPNavBar .wrapper > .container {
@@ -105,6 +105,17 @@
105
105
  visibility: hidden;
106
106
  }
107
107
 
108
+ /*
109
+ * A tab, the button of a menu and the brand fill the bar from the top edge of the window,
110
+ * which cuts off what crosses it: their ring goes inside them, as in the tab bar of the
111
+ * terminal frame.
112
+ */
113
+ .VPNav .VPNavBarTitle .title:focus-visible,
114
+ .VPNav .VPNavBarMenu .VPNavBarMenuLink:focus-visible,
115
+ .VPNav .VPNavBar .VPFlyout > .button:focus-visible {
116
+ outline-offset: calc(-1 * var(--ws-border-width-medium));
117
+ }
118
+
108
119
  .VPNav .VPNavBarMenu .VPNavBarMenuLink:hover,
109
120
  .VPNav .VPNavBarMenu .VPNavBarMenuGroup:hover .button {
110
121
  color: var(--ws-color-text);
@@ -151,6 +162,16 @@
151
162
  font-family: var(--ws-font-family-mono);
152
163
  }
153
164
 
165
+ /*
166
+ * The default theme gives the search button the browser's ring, by a rule that weighs more than
167
+ * the theme's. On a phone the button fills its row of the bar from the top edge of the window,
168
+ * so its ring goes inside it, as the menu button's does.
169
+ */
170
+ .VPNav .VPNavBarSearch .DocSearch-Button:focus-visible {
171
+ outline: var(--ws-border-width-medium) solid var(--ws-color-interactive);
172
+ outline-offset: calc(-1 * var(--ws-border-width-medium));
173
+ }
174
+
154
175
  .VPNav .DocSearch-Button .DocSearch-Button-Placeholder {
155
176
  margin: 0;
156
177
  padding: 0;
@@ -217,6 +238,19 @@
217
238
  background-color: var(--ws-color-text);
218
239
  }
219
240
 
241
+ /*
242
+ * The menu button is wider than its lines by 16 px on each side: pulled out by that much, its
243
+ * lines end at the gutter, under the end of the page. Its ring goes inside it, at the edge of
244
+ * the window.
245
+ */
246
+ .VPNav .VPNavBarHamburger {
247
+ margin-right: calc(-1 * var(--ws-space-16));
248
+ }
249
+
250
+ .VPNav .VPNavBarHamburger:focus-visible {
251
+ outline-offset: calc(-1 * var(--ws-border-width-medium));
252
+ }
253
+
220
254
  @media (width >= 48rem) {
221
255
  .VPNav .VPNavBar .wrapper,
222
256
  .VPNav .VPNavBar.has-sidebar .wrapper {
@@ -273,7 +307,6 @@
273
307
  /* with the focus it takes the color of the ring, as the field of the search dialog does */
274
308
  .VPNav .VPNavBarSearch .DocSearch-Button:focus-visible {
275
309
  border-color: var(--ws-color-interactive);
276
- outline: var(--ws-border-width-medium) solid var(--ws-color-interactive);
277
310
  outline-offset: 2px;
278
311
  }
279
312
 
@@ -121,6 +121,14 @@
121
121
  padding: 0;
122
122
  }
123
123
 
124
+ /*
125
+ * The row sticks to the top edge of the window as the page scrolls, so the ring of its menu
126
+ * button goes inside it.
127
+ */
128
+ .VPLocalNav .menu:focus-visible {
129
+ outline-offset: calc(-1 * var(--ws-border-width-medium));
130
+ }
131
+
124
132
  .VPLocalNav .VPLocalNavOutlineDropdown .items {
125
133
  border: var(--ws-border-width-thin) solid var(--ws-color-border);
126
134
  border-radius: var(--ws-radius-lg);
@@ -659,6 +659,13 @@
659
659
  "unit": "rem"
660
660
  },
661
661
  "$description": "The number of a step in its circle."
662
+ },
663
+ "icon": {
664
+ "$value": {
665
+ "value": 1,
666
+ "unit": "rem"
667
+ },
668
+ "$description": "An icon next to text, such as a tick, the icon of a callout or a calendar."
662
669
  }
663
670
  },
664
671
  "motion": {