@whatsaaaa/design-system 0.3.1 → 0.5.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/dist/index.css CHANGED
@@ -154,11 +154,14 @@
154
154
  --ws-radius-sm: 4px;
155
155
  --ws-radius-xl: 12px;
156
156
  --ws-radius-xs: 3px;
157
+ --ws-size-check: 1.25rem;
157
158
  --ws-size-content: 50rem;
159
+ --ws-size-control: 2.5rem;
158
160
  --ws-size-frame: 90rem;
159
161
  --ws-size-outline: 15rem;
160
162
  --ws-size-sidebar: 17rem;
161
163
  --ws-size-status-line: 2rem;
164
+ --ws-size-step: 1.5rem;
162
165
  --ws-size-tab-bar: 3rem;
163
166
  --ws-space-2: .125rem;
164
167
  --ws-space-4: .25rem;
@@ -278,9 +281,21 @@
278
281
  --ws-text-overline-font-weight: 700;
279
282
  --ws-text-overline-letter-spacing: .06875rem;
280
283
  --ws-text-overline-line-height: 1.5;
281
- }
282
-
283
- :root, [data-theme="dark"] {
284
+ --ws-text-tagline: var(--ws-text-tagline-font-weight) var(--ws-text-tagline-font-size)/var(--ws-text-tagline-line-height) var(--ws-text-tagline-font-family);
285
+ --ws-text-tagline-compact: var(--ws-text-tagline-compact-font-weight) var(--ws-text-tagline-compact-font-size)/var(--ws-text-tagline-compact-line-height) var(--ws-text-tagline-compact-font-family);
286
+ --ws-text-tagline-compact-font-family: var(--ws-font-family-sans);
287
+ --ws-text-tagline-compact-font-size: 1.125rem;
288
+ --ws-text-tagline-compact-font-weight: 500;
289
+ --ws-text-tagline-compact-letter-spacing: 0rem;
290
+ --ws-text-tagline-compact-line-height: 1.5;
291
+ --ws-text-tagline-font-family: var(--ws-font-family-sans);
292
+ --ws-text-tagline-font-size: 1.25rem;
293
+ --ws-text-tagline-font-weight: 500;
294
+ --ws-text-tagline-letter-spacing: 0rem;
295
+ --ws-text-tagline-line-height: 1.5;
296
+ }
297
+
298
+ :root, [data-theme="dark"], .dark:where(:not([data-theme], .light)) {
284
299
  --lightningcss-light: ;
285
300
  --lightningcss-dark: initial;
286
301
  color-scheme: dark;
@@ -294,6 +309,8 @@
294
309
  --ws-color-danger-tint: #eb6f9217;
295
310
  --ws-color-field-border: var(--ws-palette-main-muted);
296
311
  --ws-color-interactive: var(--ws-palette-main-foam);
312
+ --ws-color-interactive-active: #bcf0f9;
313
+ --ws-color-interactive-hover: #acdfe8;
297
314
  --ws-color-note: var(--ws-palette-main-iris);
298
315
  --ws-color-note-text: var(--ws-palette-main-iris);
299
316
  --ws-color-note-tint: #c4a7e717;
@@ -315,7 +332,7 @@
315
332
  --ws-color-warning-tint: #f6c17717;
316
333
  }
317
334
 
318
- [data-theme="light"] {
335
+ [data-theme="light"], .light:where(:not([data-theme], .dark)) {
319
336
  --lightningcss-light: initial;
320
337
  --lightningcss-dark: ;
321
338
  color-scheme: light;
@@ -329,6 +346,8 @@
329
346
  --ws-color-danger-tint: #b4637a17;
330
347
  --ws-color-field-border: var(--ws-palette-dawn-subtle);
331
348
  --ws-color-interactive: var(--ws-palette-dawn-pine);
349
+ --ws-color-interactive-active: #004d65;
350
+ --ws-color-interactive-hover: #165b74;
332
351
  --ws-color-note: var(--ws-palette-dawn-iris);
333
352
  --ws-color-note-text: var(--ws-palette-dawn-text);
334
353
  --ws-color-note-tint: #907aa917;
@@ -351,7 +370,7 @@
351
370
  }
352
371
 
353
372
  @media (prefers-color-scheme: light) {
354
- :root:not([data-theme]) {
373
+ :root:not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) {
355
374
  --lightningcss-light: initial;
356
375
  --lightningcss-dark: ;
357
376
  color-scheme: light;
@@ -365,6 +384,8 @@
365
384
  --ws-color-danger-tint: #b4637a17;
366
385
  --ws-color-field-border: var(--ws-palette-dawn-subtle);
367
386
  --ws-color-interactive: var(--ws-palette-dawn-pine);
387
+ --ws-color-interactive-active: #004d65;
388
+ --ws-color-interactive-hover: #165b74;
368
389
  --ws-color-note: var(--ws-palette-dawn-iris);
369
390
  --ws-color-note-text: var(--ws-palette-dawn-text);
370
391
  --ws-color-note-tint: #907aa917;
@@ -392,6 +413,7 @@
392
413
  --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");
393
414
  --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");
394
415
  --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");
416
+ --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");
395
417
  --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");
396
418
  --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");
397
419
  }
@@ -436,6 +458,20 @@ code, kbd, samp, pre {
436
458
  font-variant-ligatures: none;
437
459
  }
438
460
 
461
+ input[type="number"] {
462
+ appearance: textfield;
463
+ }
464
+
465
+ input[type="number"]::-webkit-inner-spin-button {
466
+ appearance: none;
467
+ margin: 0;
468
+ }
469
+
470
+ input[type="number"]::-webkit-outer-spin-button {
471
+ appearance: none;
472
+ margin: 0;
473
+ }
474
+
439
475
  :focus-visible {
440
476
  border-radius: var(--ws-radius-sm);
441
477
  outline: var(--ws-border-width-medium) solid var(--ws-color-interactive);
@@ -804,6 +840,24 @@ code, kbd, samp, pre {
804
840
  overflow-x: auto;
805
841
  }
806
842
 
843
+ .ws-code--wrap {
844
+ --ws-code-hang: 0;
845
+ }
846
+
847
+ .ws-code--wrap > pre {
848
+ white-space: pre-wrap;
849
+ overflow-wrap: anywhere;
850
+ overflow-x: visible;
851
+ }
852
+
853
+ .ws-code--wrap .line {
854
+ box-sizing: border-box;
855
+ width: 100%;
856
+ text-indent: calc(var(--ws-code-hang) * -1ch);
857
+ padding-inline-start: calc(var(--ws-code-hang) * 1ch);
858
+ display: inline-block;
859
+ }
860
+
807
861
  .ws-code code {
808
862
  font: inherit;
809
863
  }
@@ -884,22 +938,148 @@ code, kbd, samp, pre {
884
938
  margin: 0;
885
939
  }
886
940
 
887
- :is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"], [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] *), :is(.ws-theme-dark, .ws-status-line__item--dark):where([data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] *):not([data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="light"] [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *) {
888
- display: none !important;
941
+ .ws-segmented {
942
+ max-width: 100%;
943
+ display: inline-flex;
944
+ }
945
+
946
+ .ws-segmented > button {
947
+ min-width: 0;
948
+ min-height: var(--ws-size-control);
949
+ padding: 0 var(--ws-space-16);
950
+ border: var(--ws-border-width-thin) solid var(--ws-color-field-border);
951
+ color: var(--ws-color-text-secondary);
952
+ font: var(--ws-text-label);
953
+ cursor: pointer;
954
+ background: none;
955
+ border-radius: 0;
956
+ margin: 0;
957
+ position: relative;
958
+ }
959
+
960
+ .ws-segmented > button:first-child {
961
+ border-start-start-radius: var(--ws-radius-md);
962
+ border-end-start-radius: var(--ws-radius-md);
963
+ }
964
+
965
+ .ws-segmented > button:last-child {
966
+ border-start-end-radius: var(--ws-radius-md);
967
+ border-end-end-radius: var(--ws-radius-md);
968
+ }
969
+
970
+ .ws-segmented > button + button {
971
+ margin-inline-start: calc(-1 * var(--ws-border-width-thin));
972
+ }
973
+
974
+ .ws-segmented > button:hover {
975
+ z-index: 1;
976
+ border-color: var(--ws-color-text-secondary);
977
+ background: var(--ws-color-raised);
978
+ color: var(--ws-color-text);
979
+ }
980
+
981
+ .ws-segmented > button[aria-pressed="true"] {
982
+ z-index: 2;
983
+ border-color: var(--ws-color-interactive);
984
+ background: var(--ws-color-raised);
985
+ box-shadow: inset 0 0 0 var(--ws-border-width-thin) var(--ws-color-interactive);
986
+ color: var(--ws-color-text);
987
+ cursor: default;
988
+ }
989
+
990
+ .ws-segmented > button:focus-visible {
991
+ z-index: 3;
992
+ }
993
+
994
+ .ws-segmented > button:disabled {
995
+ z-index: 0;
996
+ border-color: var(--ws-color-text-faint);
997
+ color: var(--ws-color-text-faint);
998
+ cursor: not-allowed;
999
+ background: none;
1000
+ }
1001
+
1002
+ @media (forced-colors: active) {
1003
+ .ws-segmented > button[aria-pressed="true"] {
1004
+ box-shadow: none;
1005
+ color: highlighttext;
1006
+ forced-color-adjust: none;
1007
+ background: highlight;
1008
+ border-color: highlight;
1009
+ outline-color: highlight;
1010
+ }
1011
+ }
1012
+
1013
+ .ws-pairs {
1014
+ column-gap: var(--ws-space-16);
1015
+ border-bottom: var(--ws-border-width-thin) dashed var(--ws-color-border);
1016
+ grid-template-columns: fit-content(40%) minmax(0, 1fr);
1017
+ margin: 0;
1018
+ display: grid;
1019
+ }
1020
+
1021
+ .ws-pairs > div {
1022
+ grid-column: 1 / -1;
1023
+ grid-template-columns: inherit;
1024
+ column-gap: inherit;
1025
+ padding-block: var(--ws-space-8);
1026
+ border-top: var(--ws-border-width-thin) dashed var(--ws-color-border);
1027
+ align-items: baseline;
1028
+ display: grid;
1029
+ }
1030
+
1031
+ @supports (grid-template-columns: subgrid) {
1032
+ .ws-pairs > div {
1033
+ grid-template-columns: subgrid;
1034
+ }
1035
+ }
1036
+
1037
+ .ws-pairs dt {
1038
+ color: var(--ws-color-text-secondary);
1039
+ font: var(--ws-text-label);
1040
+ overflow-wrap: anywhere;
889
1041
  }
890
1042
 
891
- :is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"], [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] *), :is(.ws-theme-light, .ws-status-line__item--light):where([data-theme="dark"] [data-theme="light"] [data-theme="dark"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] *):not([data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"], [data-theme="dark"] [data-theme="light"] [data-theme="dark"] [data-theme="light"] *) {
1043
+ .ws-pairs dd {
1044
+ color: var(--ws-color-text);
1045
+ font-family: var(--ws-font-family-sans);
1046
+ font-size: var(--ws-font-size-16);
1047
+ line-height: var(--ws-font-line-height-normal);
1048
+ overflow-wrap: anywhere;
1049
+ margin: 0;
1050
+ }
1051
+
1052
+ .ws-pairs--amounts {
1053
+ grid-template-columns: minmax(0, 1fr) auto;
1054
+ }
1055
+
1056
+ .ws-pairs--amounts dd {
1057
+ font-variant-numeric: tabular-nums;
1058
+ text-align: end;
1059
+ white-space: nowrap;
1060
+ }
1061
+
1062
+ .ws-pairs > .ws-pairs__total {
1063
+ border-top-style: solid;
1064
+ }
1065
+
1066
+ .ws-pairs__total :is(dt, dd) {
1067
+ color: var(--ws-color-text);
1068
+ font-weight: var(--ws-font-weight-semibold);
1069
+ }
1070
+
1071
+ :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *), :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))), :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) :is([data-theme="dark"], .dark:where(:not([data-theme], .light))) :is([data-theme="light"], .light:where(:not([data-theme], .dark))) *) {
892
1072
  display: none !important;
893
1073
  }
894
1074
 
895
1075
  @media (prefers-color-scheme: light) {
896
- :is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], [data-theme] *) {
1076
+ :is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
897
1077
  display: none !important;
898
1078
  }
899
1079
  }
900
1080
 
901
1081
  @media not (prefers-color-scheme: light) {
902
- :is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], [data-theme] *) {
1082
+ :is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
903
1083
  display: none !important;
904
1084
  }
905
1085
  }
@@ -1378,6 +1558,33 @@ ws-ghost {
1378
1558
  display: block;
1379
1559
  }
1380
1560
 
1561
+ @media (width < 64rem) {
1562
+ ws-ghost[compact-px="1"] .ws-ghost__sprite {
1563
+ width: 10px;
1564
+ height: 12px;
1565
+ }
1566
+
1567
+ ws-ghost[compact-px="2"] .ws-ghost__sprite {
1568
+ width: 20px;
1569
+ height: 24px;
1570
+ }
1571
+
1572
+ ws-ghost[compact-px="3"] .ws-ghost__sprite {
1573
+ width: 30px;
1574
+ height: 36px;
1575
+ }
1576
+
1577
+ ws-ghost[compact-px="4"] .ws-ghost__sprite {
1578
+ width: 40px;
1579
+ height: 48px;
1580
+ }
1581
+
1582
+ ws-ghost[compact-px="5"] .ws-ghost__sprite {
1583
+ width: 50px;
1584
+ height: 60px;
1585
+ }
1586
+ }
1587
+
1381
1588
  .ws-ghost__body {
1382
1589
  fill: currentColor;
1383
1590
  }
@@ -18,3 +18,22 @@ export declare const codeTheme: {
18
18
  };
19
19
  }[];
20
20
  };
21
+ /** The part of a Shiki line element the transformer writes to. */
22
+ interface LineElement {
23
+ properties: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * A Shiki transformer for a code block that wraps, `ws-code--wrap`: it gives each line its
27
+ * hanging indent, `--ws-code-hang`, the width of its indent plus two, a tab counted as two as
28
+ * the block sets it. The rest of a wrapped line then starts one level in from the line's own
29
+ * text, so the shape of the code still reads.
30
+ *
31
+ * codeToHtml(code, { lang: 'json', theme: codeTheme, transformers: [hangingIndent()] })
32
+ */
33
+ export declare function hangingIndent(): {
34
+ name: string;
35
+ line(this: {
36
+ source: string;
37
+ }, node: LineElement, line: number): void;
38
+ };
39
+ export {};
@@ -62,3 +62,28 @@ export const codeTheme = {
62
62
  rule(['markup.deleted'], hex('syntax.keyword')),
63
63
  ],
64
64
  };
65
+ /**
66
+ * A Shiki transformer for a code block that wraps, `ws-code--wrap`: it gives each line its
67
+ * hanging indent, `--ws-code-hang`, the width of its indent plus two, a tab counted as two as
68
+ * the block sets it. The rest of a wrapped line then starts one level in from the line's own
69
+ * text, so the shape of the code still reads.
70
+ *
71
+ * codeToHtml(code, { lang: 'json', theme: codeTheme, transformers: [hangingIndent()] })
72
+ */
73
+ export function hangingIndent() {
74
+ let source = '';
75
+ let lines = [];
76
+ return {
77
+ name: 'whatsaaaa:hanging-indent',
78
+ line(node, line) {
79
+ if (this.source !== source) {
80
+ source = this.source;
81
+ lines = source.split(/\r?\n/);
82
+ }
83
+ const indent = /^[\t ]*/.exec(lines[line - 1] ?? '')[0];
84
+ const hang = indent.replaceAll('\t', ' ').length + 2;
85
+ const style = node.properties.style;
86
+ node.properties.style = `${typeof style === 'string' && style ? `${style.replace(/;?$/, ';')}` : ''}--ws-code-hang:${hang}`;
87
+ },
88
+ };
89
+ }
@@ -7,8 +7,8 @@
7
7
  */
8
8
  /**
9
9
  * A script for the <head> that keeps the theme-color tags in step from the first paint on:
10
- * when the stylesheet is there, whenever data-theme on <html> changes, whoever changes it,
11
- * and when the system's theme changes. The first paint waits for the stylesheets in the
12
- * <head>, and so does the first animation frame.
10
+ * when the stylesheet is there, whenever data-theme or the class of <html> changes, whoever
11
+ * changes it, and when the system's theme changes. The first paint waits for the stylesheets
12
+ * in the <head>, and so does the first animation frame.
13
13
  */
14
14
  export declare const themeColorScript: string;
@@ -9,8 +9,8 @@ const TAGS = 'meta[name="theme-color"]';
9
9
  const TOKEN = '--ws-color-bg';
10
10
  /**
11
11
  * A script for the <head> that keeps the theme-color tags in step from the first paint on:
12
- * when the stylesheet is there, whenever data-theme on <html> changes, whoever changes it,
13
- * and when the system's theme changes. The first paint waits for the stylesheets in the
14
- * <head>, and so does the first animation frame.
12
+ * when the stylesheet is there, whenever data-theme or the class of <html> changes, whoever
13
+ * changes it, and when the system's theme changes. The first paint waits for the stylesheets
14
+ * in the <head>, and so does the first animation frame.
15
15
  */
16
- export const themeColorScript = `(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue(${JSON.stringify(TOKEN)}).trim(),m=d.querySelectorAll(${JSON.stringify(TAGS)});if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()`;
16
+ export const themeColorScript = `(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue(${JSON.stringify(TOKEN)}).trim(),m=d.querySelectorAll(${JSON.stringify(TAGS)});if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme','class']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()`;
@@ -2,7 +2,7 @@ export type Theme = 'dark' | 'light';
2
2
  export type ThemeChoice = Theme | 'system';
3
3
  /** Where the choice is kept in localStorage. Nothing is stored while it follows the system. */
4
4
  export declare const THEME_STORAGE_KEY = "ws-theme";
5
- /** The theme chosen by hand, or `system`. */
5
+ /** The theme chosen by hand, with data-theme or a dark or light class, or `system`. */
6
6
  export declare function getThemeChoice(): ThemeChoice;
7
7
  /** The theme the page shows right now. */
8
8
  export declare function getTheme(): Theme;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * The theme switch. The stylesheet does the work: dark is the default, light applies when
3
- * the system asks for it, and data-theme="dark" or "light" on <html> overrides both.
4
- * This module sets that attribute by hand and remembers the choice. The head script keeps
5
- * the browser's own bars, such as a phone's address bar, at the background of the theme shown.
3
+ * the system asks for it, and data-theme="dark" or "light" on <html> overrides both, as does
4
+ * a dark or light class where there is no data-theme. This module sets the attribute by hand
5
+ * and remembers the choice. The head script keeps the browser's own bars, such as a phone's
6
+ * address bar, at the background of the theme shown.
6
7
  */
7
8
  import { themeColorScript } from "./color.js";
8
9
  /** Where the choice is kept in localStorage. Nothing is stored while it follows the system. */
@@ -18,10 +19,21 @@ function stored() {
18
19
  return null;
19
20
  }
20
21
  }
21
- /** The theme chosen by hand, or `system`. */
22
+ /** The theme a dark or light class on <html> chooses, as a color mode library sets it. */
23
+ function classTheme() {
24
+ const { classList } = document.documentElement;
25
+ const dark = classList.contains('dark');
26
+ if (dark === classList.contains('light'))
27
+ return null;
28
+ return dark ? 'dark' : 'light';
29
+ }
30
+ /** The theme chosen by hand, with data-theme or a dark or light class, or `system`. */
22
31
  export function getThemeChoice() {
23
32
  const attribute = document.documentElement.dataset.theme;
24
- return isTheme(attribute) ? attribute : (stored() ?? 'system');
33
+ if (isTheme(attribute))
34
+ return attribute;
35
+ // on one element data-theme wins over the class, as in the stylesheet
36
+ return (attribute === undefined ? classTheme() : null) ?? stored() ?? 'system';
25
37
  }
26
38
  /** The theme the page shows right now. */
27
39
  export function getTheme() {
@@ -1,2 +1,2 @@
1
1
  // Applies a remembered theme before the first paint, and keeps theme-color in step with the theme shown. Generated from src/theme/index.ts.
2
- (function(){try{var t=localStorage.getItem("ws-theme");if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})();(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue("--ws-color-bg").trim(),m=d.querySelectorAll("meta[name=\"theme-color\"]");if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()
2
+ (function(){try{var t=localStorage.getItem("ws-theme");if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})();(function(){var d=document,r=d.documentElement;function p(){var c=getComputedStyle(r).getPropertyValue("--ws-color-bg").trim(),m=d.querySelectorAll("meta[name=\"theme-color\"]");if(!c)return;if(!m.length){m=[d.createElement('meta')];m[0].name='theme-color';d.head.appendChild(m[0])}for(var i=0;i<m.length;i++)m[i].content=c}new MutationObserver(p).observe(r,{attributeFilter:['data-theme','class']});matchMedia('(prefers-color-scheme: light)').addEventListener('change',p);requestAnimationFrame(p);addEventListener('load',p)})()
@@ -0,0 +1,21 @@
1
+ :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *),
2
+ :is(.ws-theme-dark, .ws-status-line__item--dark):where(:is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *):not(:is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *) {
3
+ display: none !important;
4
+ }
5
+
6
+ :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *),
7
+ :is(.ws-theme-light, .ws-status-line__item--light):where(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) *):not(:is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))), :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) :is([data-theme='dark'], .dark:where(:not([data-theme], .light))) :is([data-theme='light'], .light:where(:not([data-theme], .dark))) *) {
8
+ display: none !important;
9
+ }
10
+
11
+ @media (prefers-color-scheme: light) {
12
+ :is(.ws-theme-dark, .ws-status-line__item--dark):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
13
+ display: none !important;
14
+ }
15
+ }
16
+
17
+ @media not (prefers-color-scheme: light) {
18
+ :is(.ws-theme-light, .ws-status-line__item--light):not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark)), :is([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) *) {
19
+ display: none !important;
20
+ }
21
+ }
package/dist/tokens.css CHANGED
@@ -11,6 +11,7 @@
11
11
  *
12
12
  * Dark is the default. Light applies when the system asks for it, and data-theme="dark" or
13
13
  * data-theme="light" on any element overrides both for that element and everything inside it.
14
+ * So does a dark or light class, where the element has no data-theme.
14
15
  */
15
16
 
16
17
  :root {
@@ -119,8 +120,12 @@
119
120
  --ws-radius-xl: 12px;
120
121
  /* Key caps. */
121
122
  --ws-radius-xs: 3px;
123
+ /* A checkbox or a radio button. */
124
+ --ws-size-check: 1.25rem;
122
125
  /* Widest a column of long-form text gets, padding included. */
123
126
  --ws-size-content: 50rem;
127
+ /* Height of a one-line field, a button and a segmented control. */
128
+ --ws-size-control: 2.5rem;
124
129
  /* Widest a page frame gets. */
125
130
  --ws-size-frame: 90rem;
126
131
  /* Page outline. */
@@ -129,6 +134,8 @@
129
134
  --ws-size-sidebar: 17rem;
130
135
  /* Height of the status line. */
131
136
  --ws-size-status-line: 2rem;
137
+ /* The number of a step in its circle. */
138
+ --ws-size-step: 1.5rem;
132
139
  /* Height of the tab bar. */
133
140
  --ws-size-tab-bar: 3rem;
134
141
  --ws-space-2: 0.125rem;
@@ -345,10 +352,35 @@
345
352
  --ws-text-overline-letter-spacing: 0.06875rem;
346
353
  /* Group headings and table heads. Set in uppercase. */
347
354
  --ws-text-overline-line-height: 1.5;
355
+ /* The line under the display name on a home page. */
356
+ --ws-text-tagline: var(--ws-text-tagline-font-weight) var(--ws-text-tagline-font-size)/var(--ws-text-tagline-line-height) var(--ws-text-tagline-font-family);
357
+ /* The tagline on phones. */
358
+ --ws-text-tagline-compact: var(--ws-text-tagline-compact-font-weight) var(--ws-text-tagline-compact-font-size)/var(--ws-text-tagline-compact-line-height) var(--ws-text-tagline-compact-font-family);
359
+ /* The tagline on phones. */
360
+ --ws-text-tagline-compact-font-family: var(--ws-font-family-sans);
361
+ /* The tagline on phones. */
362
+ --ws-text-tagline-compact-font-size: 1.125rem;
363
+ /* The tagline on phones. */
364
+ --ws-text-tagline-compact-font-weight: 500;
365
+ /* The tagline on phones. */
366
+ --ws-text-tagline-compact-letter-spacing: 0rem;
367
+ /* The tagline on phones. */
368
+ --ws-text-tagline-compact-line-height: 1.5;
369
+ /* The line under the display name on a home page. */
370
+ --ws-text-tagline-font-family: var(--ws-font-family-sans);
371
+ /* The line under the display name on a home page. */
372
+ --ws-text-tagline-font-size: 1.25rem;
373
+ /* The line under the display name on a home page. */
374
+ --ws-text-tagline-font-weight: 500;
375
+ /* The line under the display name on a home page. */
376
+ --ws-text-tagline-letter-spacing: 0rem;
377
+ /* The line under the display name on a home page. */
378
+ --ws-text-tagline-line-height: 1.5;
348
379
  }
349
380
 
350
381
  :root,
351
- [data-theme='dark'] {
382
+ [data-theme='dark'],
383
+ .dark:where(:not([data-theme], .light)) {
352
384
  color-scheme: dark;
353
385
  /* Page background. */
354
386
  --ws-color-bg: var(--ws-palette-main-base);
@@ -370,6 +402,10 @@
370
402
  --ws-color-field-border: var(--ws-palette-main-muted);
371
403
  /* Links, the focus ring, checked controls and the primary button fill. */
372
404
  --ws-color-interactive: var(--ws-palette-main-foam);
405
+ /* The interactive fill while it is pressed: 0.1 further from the page in OKLab lightness. */
406
+ --ws-color-interactive-active: #bcf0f9;
407
+ /* The interactive fill under the pointer, such as a hovered primary button: the interactive color 0.05 further from the page in OKLab lightness. */
408
+ --ws-color-interactive-hover: #acdfe8;
373
409
  /* Status note: bar and icon. */
374
410
  --ws-color-note: var(--ws-palette-main-iris);
375
411
  /* Status note: label text. */
@@ -410,7 +446,8 @@
410
446
  --ws-color-warning-tint: #f6c17717;
411
447
  }
412
448
 
413
- [data-theme='light'] {
449
+ [data-theme='light'],
450
+ .light:where(:not([data-theme], .dark)) {
414
451
  color-scheme: light;
415
452
  /* Page background. */
416
453
  --ws-color-bg: var(--ws-palette-dawn-base);
@@ -432,6 +469,10 @@
432
469
  --ws-color-field-border: var(--ws-palette-dawn-subtle);
433
470
  /* Links, the focus ring, checked controls and the primary button fill. */
434
471
  --ws-color-interactive: var(--ws-palette-dawn-pine);
472
+ /* The interactive fill while it is pressed: 0.1 further from the page in OKLab lightness. */
473
+ --ws-color-interactive-active: #004d65;
474
+ /* The interactive fill under the pointer, such as a hovered primary button: the interactive color 0.05 further from the page in OKLab lightness. */
475
+ --ws-color-interactive-hover: #165b74;
435
476
  /* Status note: bar and icon. */
436
477
  --ws-color-note: var(--ws-palette-dawn-iris);
437
478
  /* Status note: label text. */
@@ -473,7 +514,7 @@
473
514
  }
474
515
 
475
516
  @media (prefers-color-scheme: light) {
476
- :root:not([data-theme]) {
517
+ :root:not([data-theme], .dark:where(:not(.light)), .light:where(:not(.dark))) {
477
518
  color-scheme: light;
478
519
  /* Page background. */
479
520
  --ws-color-bg: var(--ws-palette-dawn-base);
@@ -495,6 +536,10 @@
495
536
  --ws-color-field-border: var(--ws-palette-dawn-subtle);
496
537
  /* Links, the focus ring, checked controls and the primary button fill. */
497
538
  --ws-color-interactive: var(--ws-palette-dawn-pine);
539
+ /* The interactive fill while it is pressed: 0.1 further from the page in OKLab lightness. */
540
+ --ws-color-interactive-active: #004d65;
541
+ /* The interactive fill under the pointer, such as a hovered primary button: the interactive color 0.05 further from the page in OKLab lightness. */
542
+ --ws-color-interactive-hover: #165b74;
498
543
  /* Status note: bar and icon. */
499
544
  --ws-color-note: var(--ws-palette-dawn-iris);
500
545
  /* Status note: label text. */
package/dist/tokens.d.ts CHANGED
@@ -51,6 +51,8 @@ export interface Tokens {
51
51
  "color.danger-tint": Color;
52
52
  "color.field-border": Color;
53
53
  "color.interactive": Color;
54
+ "color.interactive-active": Color;
55
+ "color.interactive-hover": Color;
54
56
  "color.note": Color;
55
57
  "color.note-text": Color;
56
58
  "color.note-tint": Color;
@@ -141,11 +143,14 @@ export interface Tokens {
141
143
  "radius.sm": Dimension;
142
144
  "radius.xl": Dimension;
143
145
  "radius.xs": Dimension;
146
+ "size.check": Dimension;
144
147
  "size.content": Dimension;
148
+ "size.control": Dimension;
145
149
  "size.frame": Dimension;
146
150
  "size.outline": Dimension;
147
151
  "size.sidebar": Dimension;
148
152
  "size.status-line": Dimension;
153
+ "size.step": Dimension;
149
154
  "size.tab-bar": Dimension;
150
155
  "space.2": Dimension;
151
156
  "space.4": Dimension;
@@ -185,6 +190,8 @@ export interface Tokens {
185
190
  "text.label-sm": Typography;
186
191
  "text.lead": Typography;
187
192
  "text.overline": Typography;
193
+ "text.tagline": Typography;
194
+ "text.tagline-compact": Typography;
188
195
  }
189
196
 
190
197
  /** Produce a token set from a given input. */