@filipgutica/design-system 1.0.37 → 1.0.39

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.
Files changed (43) hide show
  1. package/README.md +9 -8
  2. package/dist/theme-inputs.json +75 -0
  3. package/dist/themes/catppuccin.css +29 -2
  4. package/dist/themes/copper.css +7 -2
  5. package/dist/themes/fern.css +7 -2
  6. package/dist/themes/github.css +27 -0
  7. package/dist/themes/graphite-indigo.css +3 -2
  8. package/dist/themes/iris.css +7 -2
  9. package/dist/themes/lagoon.css +7 -2
  10. package/dist/themes/lapis.css +7 -2
  11. package/dist/tokens.d.ts +2 -1
  12. package/dist/tokens.js +92 -76
  13. package/dist/tokens.json +92 -76
  14. package/fonts/{OFL-IBM-Plex-Sans.txt → OFL-Inter.txt} +1 -1
  15. package/fonts/{OFL-IBM-Plex-Mono.txt → OFL-JetBrains-Mono.txt} +1 -1
  16. package/fonts/fonts.css +13 -13
  17. package/fonts/inter-latin-400-normal.woff2 +0 -0
  18. package/fonts/inter-latin-500-normal.woff2 +0 -0
  19. package/fonts/inter-latin-600-normal.woff2 +0 -0
  20. package/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
  21. package/fonts/jetbrains-mono-latin-500-normal.woff2 +0 -0
  22. package/fonts/jetbrains-mono-latin-600-normal.woff2 +0 -0
  23. package/language/DESIGN.md +10 -9
  24. package/language/components.html +49 -28
  25. package/language/components.md +12 -11
  26. package/language/decisions.md +11 -6
  27. package/language/docs.html +7 -10
  28. package/language/product.html +0 -3
  29. package/language/reference.html +42 -22
  30. package/language/tokens.css +151 -13
  31. package/language/ui-sdk.css +2 -2
  32. package/package.json +2 -1
  33. package/theme-mapper/core.js +9 -8
  34. package/theme-mapper/engine.d.ts +37 -2
  35. package/theme-mapper/engine.js +49 -4
  36. package/theme-mapper/index.d.ts +5 -0
  37. package/theme-mapper/index.js +15 -0
  38. package/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  39. package/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  40. package/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  41. package/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  42. package/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  43. package/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
@@ -12,7 +12,7 @@
12
12
  /* Other page formats use docs.html and product.html. This specimen shows an app. */
13
13
  /* App shell */
14
14
  /* The main pane scrolls; the sidebar stays full height. */
15
- .shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); height: 100dvh; }
15
+ .shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100dvh; }
16
16
  .sidebar { border-right: 1px solid var(--color-border-subtle); background: var(--color-surface); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-4); min-height: 0; }
17
17
  .workspace { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); font-weight: var(--weight-semibold); }
18
18
  .workspace .mark { width: 20px; height: 20px; border-radius: var(--radius-inline); background: var(--color-text); color: var(--color-bg); display: grid; place-items: center; font-size: var(--text-xs); }
@@ -128,7 +128,7 @@
128
128
  .segmented[data-size="sm"] button { padding: 0 var(--space-2); }
129
129
  .segmented[data-size="lg"] { --item: var(--control-lg); font-size: var(--text-lg); }
130
130
  /* Line height 1 comes after the font shorthand, which would reset it: the label then sits centred in the option. */
131
- .segmented button { --depth: none; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: calc(var(--item) - 2 * var(--inset)); padding: 0 var(--space-3); border: 0; border-radius: calc(var(--radius-control) - var(--inset)); background: transparent; color: var(--color-muted); font: inherit; line-height: 1; cursor: pointer; }
131
+ .segmented button { --depth: none; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: calc(var(--item) - 2 * var(--inset)); padding: 0 var(--space-3); border: 0; border-radius: calc(var(--radius-control) - var(--inset)); background: transparent; color: var(--color-muted); font: inherit; line-height: normal; cursor: pointer; }
132
132
  .segmented[data-icon-only] button { width: calc(var(--item) - 2 * var(--inset)); padding: 0; }
133
133
  /* Icon-only: a pill track with round options, concentric with it. A px radius keeps the thumb a pill while it glides. */
134
134
  .segmented[data-icon-only] { border-radius: var(--radius-pill); }
@@ -289,19 +289,31 @@
289
289
  .code-head .lang { color: var(--color-muted); }
290
290
  /* Copy is a quiet action; this sets its size and place. */
291
291
  .copy { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-width: var(--control-md); min-height: var(--control-md); margin-left: auto; padding: 0 0.375rem; color: inherit; }
292
- /* Copy is muted at rest. The code block has its own palette, so on hover and while the tick shows it takes the block's text colour. */
293
- .code .copy { color: var(--color-muted); }
294
- .code .copy[data-copied] { color: var(--color-code-text); }
295
- .code .copy.is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
296
- @media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: var(--color-code-text); } }
292
+ /* Copy and Wrap lines are muted at rest. The code block has its own palette, so on hover, while the tick
293
+ shows, and while Wrap lines is on they take the block's text colour. */
294
+ .code :is(.copy, .wrap-toggle) { color: var(--color-muted); }
295
+ .code :is(.copy[data-copied], .wrap-toggle[aria-pressed="true"]) { color: var(--color-code-text); }
296
+ .code :is(.copy, .wrap-toggle).is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
297
+ @media (hover: hover) { .code :is(.copy, .wrap-toggle):hover:where(:not(:disabled)) { color: var(--color-code-text); } }
298
+ /* The block's actions sit together at the end of the header, or in the corner beside the source. */
299
+ .code-actions { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
300
+ .code-actions > .copy { margin-left: 0; }
301
+ /* Wrap lines is an icon-only quiet action and a toggle: while on it keeps the open-menu tint. */
302
+ .wrap-toggle { flex: none; width: var(--control-md); min-height: var(--control-md); padding: 0; }
303
+ :where(.wrap-toggle[aria-pressed="true"]) { background: color-mix(in srgb, currentColor 6%, transparent); }
304
+ /* Forced colors: a Highlight border and icon mark it on, at rest and on hover. */
305
+ @media (forced-colors: active) { .code .wrap-toggle[aria-pressed="true"] { border-color: Highlight; } .wrap-toggle[aria-pressed="true"] .icon { color: Highlight; } }
297
306
  /* Inset: the code block clips its content. */
298
307
  .code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
299
- .code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
308
+ .code :is(.copy, .wrap-toggle).quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
300
309
  /* The source is an inset panel. It sits --space-1 inside the frame, so its corners are concentric with the frame's. */
301
310
  .code pre { margin: 0; padding: var(--space-4); overflow: auto; max-height: 32rem; border: 1px solid transparent; border-radius: calc(var(--radius-panel) - var(--space-1)); background: var(--color-code); font-size: var(--text-code); line-height: 1.65; tab-size: 2; }
302
311
  /* Each line is a baseline-aligned row, so a prompt or line number sits on the text's baseline. */
303
312
  .code .line { display: flex; align-items: baseline; min-height: 1.65em; }
304
313
  .code .line > span { white-space: pre; }
314
+ /* With Wrap lines on, each line breaks inside the panel, long words and URLs included, and nothing scrolls
315
+ sideways. The line number stays on the first visual line. */
316
+ .code[data-wrap] .line > span:not(.ln) { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
305
317
  .code .ln { min-width: 2.5em; padding-right: 1em; flex: none; text-align: right; color: var(--color-muted); user-select: none; }
306
318
  .code .k { color: var(--color-syntax-keyword); } .code .s { color: var(--color-syntax-string); } .code .n { color: var(--color-syntax-number); } .code .c { color: var(--color-syntax-comment); }
307
319
  /* The panel fills the row beside Copy, so it sits --space-1 from the frame and from Copy on every side, and centres its line. */
@@ -367,14 +379,12 @@
367
379
  .value { font-family: var(--font-mono); color: var(--color-muted); overflow-wrap: anywhere; }
368
380
  .use { color: var(--color-muted); }
369
381
  .spec-sample { min-width: 0; overflow-wrap: anywhere; }
370
- .t-display, .t-doc-title, .t-section { font-family: var(--font-mono); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
382
+ .t-display, .t-doc-title, .t-section { font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
371
383
  .t-display { font-size: var(--text-display); }
372
384
  .t-doc-title { font-size: var(--text-3xl); }
373
385
  /* Application titles are sans, as the toolbar title is. */
374
386
  .t-app-title { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
375
- /* The ## mark is decorative: the empty alt text after the slash keeps screen readers from reading it. */
376
387
  .t-section { font-size: var(--text-xl); padding-top: var(--space-4); border-top: 1px solid var(--color-border-subtle); }
377
- .t-section::before { content: "## " / ""; color: var(--color-accent); }
378
388
  .t-sub { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-tight); }
379
389
  .t-reading { font-size: var(--text-reading); line-height: var(--leading); max-width: var(--measure); }
380
390
  .t-secondary { font-size: var(--text-sm); color: var(--color-muted); }
@@ -414,7 +424,7 @@
414
424
 
415
425
 
416
426
  .mobile-only { display: none; }
417
- /* The detail column collapses at main's own width (876px is a 1100px viewport minus --sidebar), not at a third viewport breakpoint. */
427
+ /* The detail column collapses at main's own width (876px is a 1100px viewport minus --sidebar-width), not at a third viewport breakpoint. */
418
428
  main { container-type: inline-size; }
419
429
  @container (max-width: 876px) {
420
430
  .content { grid-template-columns: 1fr; }
@@ -427,6 +437,7 @@
427
437
  .btn:not([data-specimen="size"] *), .navlist a, .tab { min-height: var(--control-touch); }
428
438
  .search { height: var(--control-touch); }
429
439
  .copy { min-width: var(--control-touch); min-height: var(--control-touch); }
440
+ .wrap-toggle { width: var(--control-touch); min-height: var(--control-touch); }
430
441
  .check:not([data-specimen="size"] *) { min-height: var(--control-touch); }
431
442
  .shell { grid-template-columns: minmax(0, 1fr); height: auto; }
432
443
  main { overflow: visible; }
@@ -472,6 +483,7 @@
472
483
  <symbol id="i-plus" viewBox="0 0 16 16"><path d="M8 3.5v9M3.5 8h9"/></symbol>
473
484
  <symbol id="i-play" viewBox="0 0 16 16"><path d="M5 3.5v9l7-4.5z"/></symbol>
474
485
  <symbol id="i-arrow-up" viewBox="0 0 16 16"><path d="M8 13V3M4 7l4-4 4 4"/></symbol>
486
+ <symbol id="i-wrap" viewBox="0 0 16 16"><path d="M2.5 4h11M2.5 8h9a2 2 0 0 1 0 4H8.5M10 10.5 8.5 12l1.5 1.5M2.5 12h3"/></symbol>
475
487
  <symbol id="i-copy" viewBox="0 0 16 16"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M10.5 5.5V3.5a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2"/></symbol>
476
488
  </svg>
477
489
 
@@ -546,21 +558,21 @@
546
558
 
547
559
  <section class="foundation" id="typography" aria-labelledby="typography-title">
548
560
  <h3 id="typography-title">Typography</h3>
549
- <p class="note">Mono carries identity and structure; sans carries prose and controls. <code>fonts.css</code> self-hosts IBM Plex. A standalone page without the font installed, such as this one, shows the system fallback.</p>
561
+ <p class="note">Sans carries prose, headings, and controls; mono carries code, identifiers, keys, and terminal captures. <code>fonts.css</code> self-hosts Inter and JetBrains Mono. A standalone page without the font installed, such as this one, shows the system fallback.</p>
550
562
 
551
563
  <h4>Families</h4>
552
564
  <ul class="specs">
553
- <li class="spec" data-token="--font-mono"><div class="spec-meta"><code>--font-mono</code><span class="value"></span><span class="use">Identity, documentation and product page titles and section headings, navigation rails, metadata, captions, code, identifiers, and keys</span></div><p class="spec-sample" style="font-family:var(--font-mono);font-size:var(--text-xl)">~/filip-stack 0123456789</p></li>
554
- <li class="spec" data-token="--font-ui"><div class="spec-meta"><code>--font-ui</code><span class="value"></span><span class="use">Prose, h3 and below, application section headings, labels, and controls</span></div><p class="spec-sample" style="font-family:var(--font-ui);font-size:var(--text-xl)">Quiet surfaces, clear hierarchy</p></li>
565
+ <li class="spec" data-token="--font-mono"><div class="spec-meta"><code>--font-mono</code><span class="value"></span><span class="use">Code, identifiers, keys, and terminal captures, and the identity layer's small marks: the ~/name header, metadata, step numbers, and the footer</span></div><p class="spec-sample" style="font-family:var(--font-mono);font-size:var(--text-xl)">~/filip-stack 0123456789</p></li>
566
+ <li class="spec" data-token="--font-ui"><div class="spec-meta"><code>--font-ui</code><span class="value"></span><span class="use">Prose, every heading, labels, and controls</span></div><p class="spec-sample" style="font-family:var(--font-ui);font-size:var(--text-xl)">Quiet surfaces, clear hierarchy</p></li>
555
567
  </ul>
556
568
 
557
569
  <h4>Size scale</h4>
558
570
  <ul class="specs">
559
- <li class="spec" data-token="--text-display"><div class="spec-meta"><code>--text-display</code><span class="value"></span><span class="use">Product page and tool home title, in mono</span></div><p class="spec-sample t-display">Terminal folio</p></li>
571
+ <li class="spec" data-token="--text-display"><div class="spec-meta"><code>--text-display</code><span class="value"></span><span class="use">Product page and tool home title</span></div><p class="spec-sample t-display">Terminal folio</p></li>
560
572
  <li class="spec" data-token="--text-display-sm"><div class="spec-meta"><code>--text-display-sm</code><span class="value"></span><span class="use">The display title on phones</span></div><p class="spec-sample t-display" style="font-size:var(--text-display-sm)">Terminal folio</p></li>
561
- <li class="spec" data-token="--text-3xl"><div class="spec-meta"><code>--text-3xl</code><span class="value"></span><span class="use">Documentation title, in mono</span></div><p class="spec-sample t-doc-title">Design language</p></li>
573
+ <li class="spec" data-token="--text-3xl"><div class="spec-meta"><code>--text-3xl</code><span class="value"></span><span class="use">Documentation title</span></div><p class="spec-sample t-doc-title">Design language</p></li>
562
574
  <li class="spec" data-token="--text-2xl"><div class="spec-meta"><code>--text-2xl</code><span class="value"></span><span class="use">Largest application title</span></div><p class="spec-sample" style="font-size:var(--text-2xl)">Quiet surfaces, clear hierarchy</p></li>
563
- <li class="spec" data-token="--text-xl"><div class="spec-meta"><code>--text-xl</code><span class="value"></span><span class="use">Documentation section heading, in mono</span></div><p class="spec-sample" style="font-size:var(--text-xl)">Quiet surfaces, clear hierarchy</p></li>
575
+ <li class="spec" data-token="--text-xl"><div class="spec-meta"><code>--text-xl</code><span class="value"></span><span class="use">Documentation section heading</span></div><p class="spec-sample" style="font-size:var(--text-xl)">Quiet surfaces, clear hierarchy</p></li>
564
576
  <li class="spec" data-token="--text-lg"><div class="spec-meta"><code>--text-lg</code><span class="value"></span><span class="use">Subheadings (h3 and below) and large controls</span></div><p class="spec-sample" style="font-size:var(--text-lg)">Quiet surfaces, clear hierarchy</p></li>
565
577
  <li class="spec" data-token="--text-reading"><div class="spec-meta"><code>--text-reading</code><span class="value"></span><span class="use">Paragraphs and article text, with <code>--leading</code> and <code>--measure</code></span></div><p class="spec-sample" style="font-size:var(--text-reading)">Quiet surfaces, clear hierarchy</p></li>
566
578
  <li class="spec" data-token="--text-md"><div class="spec-meta"><code>--text-md</code><span class="value"></span><span class="use">Controls and dense application content</span></div><p class="spec-sample" style="font-size:var(--text-md)">Quiet surfaces, clear hierarchy</p></li>
@@ -581,8 +593,8 @@
581
593
 
582
594
  <h4>Roles</h4>
583
595
  <ul class="specs">
584
- <li class="spec"><div class="spec-meta"><span>Documentation title</span><code>--font-mono --text-3xl</code></div><p class="spec-sample t-doc-title">Design language</p></li>
585
- <li class="spec"><div class="spec-meta"><span>Section heading</span><code>--font-mono --text-xl</code><span class="use">Documentation, CLI tool, article, and product pages: a <code>##</code> mark in <code>--color-accent</code> and a <code>--color-border-subtle</code> rule above</span></div><p class="spec-sample t-section">Typography</p></li>
596
+ <li class="spec"><div class="spec-meta"><span>Documentation title</span><code>--font-ui --text-3xl</code></div><p class="spec-sample t-doc-title">Design language</p></li>
597
+ <li class="spec"><div class="spec-meta"><span>Section heading</span><code>--font-ui --text-xl</code><span class="use">Documentation, CLI tool, article, and product pages: a <code>--color-border-subtle</code> rule above</span></div><p class="spec-sample t-section">Typography</p></li>
586
598
  <li class="spec"><div class="spec-meta"><span>Application title</span><code>--font-ui --text-2xl</code><span class="use">Or smaller; the toolbar title on this page uses <code>--text-md</code></span></div><p class="spec-sample t-app-title">Monitors</p></li>
587
599
  <li class="spec"><div class="spec-meta"><span>Application section heading</span><code>--font-ui --text-lg</code><span class="use">Up to <code>--text-xl</code>, or smaller in a dense panel. No mark and no rule</span></div><p class="spec-sample t-sub">Alerting monitors</p></li>
588
600
  <li class="spec"><div class="spec-meta"><span>Subheading (h3 and below)</span><code>--font-ui --text-lg</code></div><p class="spec-sample t-sub">Install the command line tool</p></li>
@@ -715,7 +727,7 @@
715
727
  <li class="spec" data-token="--measure"><div class="spec-meta"><code>--measure</code><span class="value"></span></div><span class="use">Bounds reading text</span></li>
716
728
  <li class="spec" data-token="--page-max"><div class="spec-meta"><code>--page-max</code><span class="value"></span></div><span class="use">Documentation frame</span></li>
717
729
  <li class="spec" data-token="--page-wide"><div class="spec-meta"><code>--page-wide</code><span class="value"></span></div><span class="use">Product page frame</span></li>
718
- <li class="spec" data-token="--sidebar"><div class="spec-meta"><code>--sidebar</code><span class="value"></span></div><span class="use">This page's sidebar</span></li>
730
+ <li class="spec" data-token="--sidebar-width"><div class="spec-meta"><code>--sidebar-width</code><span class="value"></span></div><span class="use">This page's sidebar</span></li>
719
731
  <li class="spec" data-token="--row"><div class="spec-meta"><code>--row</code><span class="value"></span><span class="use">Navigation and list rows</span></div><i class="height-bar" style="height:var(--row)"></i></li>
720
732
  </ul>
721
733
 
@@ -732,6 +744,7 @@
732
744
  <h3 id="shape-title">Shape</h3>
733
745
  <p class="note">One 8px corner for rows, buttons, and fields, 12px for containers, 4px for small marks, and pills for state marks. Cards never take a pill.</p>
734
746
  <ul class="specs">
747
+ <li class="spec" data-token="--radius-base"><div class="spec-meta"><code>--radius-base</code><span class="value"></span><span class="use">The base corner: rows, actions, and fields take it, small marks half of it, and containers one and a half times it</span></div><i class="shape-box" style="border-radius:var(--radius-base)"></i></li>
735
748
  <li class="spec" data-token="--radius-inline"><div class="spec-meta"><code>--radius-inline</code><span class="value"></span><span class="use">Places and picked rows: navigation rows, tabs, list rows, menu rows, and breadcrumb links</span></div><i class="shape-box" style="border-radius:var(--radius-inline)"></i></li>
736
749
  <li class="spec" data-token="--radius-field"><div class="spec-meta"><code>--radius-field</code><span class="value"></span><span class="use">Typed fields, controls whose label wraps, and one-line controls that are not actions: inputs, selects, textareas, toggle cards, pager links, the project-menu trigger, the labelled contents trigger and its no-JavaScript summary, and the skip link</span></div><i class="shape-box" style="border-radius:var(--radius-field)"></i></li>
737
750
  <li class="spec" data-token="--radius-control"><div class="spec-meta"><code>--radius-control</code><span class="value"></span><span class="use">Rounded rectangles that act, or set a value in place with every option shown: buttons with a text label other than the labelled contents trigger, quiet actions other than the project-menu trigger, icon-only ones included, and text segmented controls; a segmented option takes this radius minus the track's 2px inset</span></div><i class="shape-box" style="border-radius:var(--radius-control)"></i></li>
@@ -941,7 +954,7 @@
941
954
  <dt>Metric</dt><dd class="mono">${m.metric}</dd>
942
955
  </dl>
943
956
  <div class="code">
944
- <div class="code-head"><b>Sample query</b><span class="lang">JSON</span><button class="quiet-action copy" type="button">${icon('i-copy')}<span>Copy</span></button></div>
957
+ <div class="code-head"><b>Sample query</b><span class="lang">JSON</span><div class="code-actions"><button class="quiet-action wrap-toggle" type="button" data-wrap-toggle aria-pressed="false" aria-label="Wrap lines" title="Wrap lines">${icon('i-wrap')}</button><button class="quiet-action copy" type="button">${icon('i-copy')}<span>Copy</span></button></div></div>
945
958
  <pre tabindex="0" role="region" aria-label="Sample query"><code>${code.split('\n').map((line) => `<span class="line"><span>${highlight(line)}</span></span>`).join('')}</code></pre>
946
959
  </div>
947
960
  <div class="cluster"><button class="btn secondary" type="button" data-size="sm">Open in explorer</button><button class="btn ghost" type="button" data-size="sm">Mute</button></div>`;
@@ -961,6 +974,13 @@
961
974
  copy.dataset.copied = '';
962
975
  wait = setTimeout(restore, 1500);
963
976
  });
977
+ // Wrap lines keeps its name; aria-pressed carries the state.
978
+ const wrap = detail.querySelector('.wrap-toggle');
979
+ wrap.addEventListener('click', () => {
980
+ const on = wrap.getAttribute('aria-pressed') !== 'true';
981
+ wrap.setAttribute('aria-pressed', String(on));
982
+ wrap.closest('.code').toggleAttribute('data-wrap', on);
983
+ });
964
984
  };
965
985
 
966
986
  // The list is one Tab stop: only the selected row is tabbable (roving tabindex), and focus selects.
@@ -5,7 +5,7 @@
5
5
  * DESIGN.md names these tokens; it never repeats their values.
6
6
  *
7
7
  * Two layers. The identity block at the top of :root is the theme's own: its hue
8
- * pair and fonts. This file carries the default theme. Another theme keeps this file
8
+ * pair, fonts, and base radius. This file carries the default theme. Another theme keeps this file
9
9
  * unchanged and loads its themes/<id>.css after it, on :root; that file may also set
10
10
  * the theme's neutrals. A new project can set the identity lines on :root in its own
11
11
  * stylesheet the same way. The dark blocks switch --color-project to
@@ -13,25 +13,34 @@
13
13
  * --color-nav-current-text, and --color-segmented-current-text at 4.5:1 on the new hue
14
14
  * and override them when they fall short. A theme file sets the last two for you; its
15
15
  * hue must carry --color-accent-text itself, which the contrast tests check.
16
- * The terminal plate tokens also belong to the identity layer; every other line is core.
16
+ * The terminal plate tokens draw the identity layer's captures but stay core: a theme
17
+ * does not set them. dist/theme-inputs.json lists every token a theme may set.
17
18
  *
18
19
  * Standalone HTML: import or inline this file.
19
20
  * Inline visuals: inherit the host font and theme variables; see DESIGN.md.
20
21
  * Repos: map these names onto the repository's own token system.
21
22
  *
22
23
  * Theme states: bare :root is light. prefers-color-scheme picks dark unless
23
- * data-theme="light" is set. data-theme="dark" forces dark.
24
+ * data-theme="light" is set. data-theme="dark" forces dark. data-theme="dark" or
25
+ * "light" on any element below <html>, or a .dark class on <html> or below it,
26
+ * themes that subtree; the subtree blocks at the end redeclare what each mode
27
+ * changes, and the subtree takes its mode's text colour. data-theme="light" wins over
28
+ * .dark on one element. A theme written by hand repeats its light values on
29
+ * :root [data-theme="light"] and its dark values on the dark subtree block's selectors,
30
+ * so they hold in a subtree too. A theme file does this for you.
24
31
  */
25
32
 
26
33
  :root {
27
34
  color-scheme: light;
28
35
 
29
- /* Identity layer: a project swaps these four lines. --color-project is the light-theme hue;
30
- --color-project-dark is the dark-theme hue, also used on terminal captures in both themes. */
36
+ /* Identity layer: a project swaps these five lines. --color-project is the light-theme hue;
37
+ --color-project-dark is the dark-theme hue, also used on terminal captures in both themes.
38
+ --radius-base sets every corner but the pill and the circle. */
31
39
  --color-project: #4b45d1;
32
40
  --color-project-dark: #a5a1ff;
33
- --font-ui: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
34
- --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
41
+ --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
42
+ --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
43
+ --radius-base: 8px;
35
44
 
36
45
  /* Core roles: only the identity lines above feed them. Neutral paper and graphite surfaces. */
37
46
  --color-bg: #f4f5f6;
@@ -170,14 +179,14 @@
170
179
  --measure: 68ch;
171
180
  --page-max: 960px;
172
181
  --page-wide: 1120px;
173
- --sidebar: 224px;
182
+ --sidebar-width: 224px;
174
183
 
175
184
  /* Shape */
176
- --radius-inline: 8px;
177
- --radius-control: 8px;
178
- --radius-panel: 12px;
179
- --radius-field: 8px;
180
- --radius-mark: 4px;
185
+ --radius-inline: var(--radius-base);
186
+ --radius-control: var(--radius-base);
187
+ --radius-panel: calc(var(--radius-base) * 1.5);
188
+ --radius-field: var(--radius-base);
189
+ --radius-mark: calc(var(--radius-base) * 0.5);
181
190
  --radius-pill: 999px;
182
191
  --radius-circle: 999px;
183
192
 
@@ -278,6 +287,133 @@
278
287
  --shadow-nav-current: var(--shadow-nav-current-dark);
279
288
  }
280
289
 
290
+ /* Subtree themes: data-theme="dark" or "light" on an element below <html>, or a .dark class on <html> or
291
+ below it, themes that subtree. Each block redeclares every token that differs between the modes or follows
292
+ one that does, so the tokens derived from them resolve again inside the subtree. The element paints its own
293
+ background, such as background: var(--color-bg). */
294
+
295
+ :root.dark:not(:where([data-theme="light"])), :root [data-theme="dark"], :root .dark:not(:where([data-theme="light"])) {
296
+ color-scheme: dark;
297
+ --color-project: var(--color-project-dark);
298
+ --color-bg: #0d1012;
299
+ --color-surface: #13171a;
300
+ --color-surface-raised: #181d21;
301
+ --color-surface-muted: #20262b;
302
+ --color-well: color-mix(in srgb, var(--color-bg) 87.5%, black);
303
+ --color-field-bg: var(--color-well);
304
+ --color-field-edge: var(--color-border-subtle);
305
+ --shadow-field: var(--shadow-sink);
306
+ --color-control-thumb: color-mix(in srgb, var(--color-surface-raised) 88%, white);
307
+ --color-nav-current: color-mix(in srgb, var(--color-accent) 20%, transparent);
308
+ --color-nav-current-text: var(--color-accent);
309
+ --color-segmented-current-text: var(--color-accent);
310
+ --color-row-hover: #20262b;
311
+ --color-row-selected: var(--color-surface-raised);
312
+ --color-border-subtle: #262d33;
313
+ --color-border: #78818a;
314
+ --color-text: #e6e9eb;
315
+ --color-muted: #9aa3ab;
316
+ --color-overlay: rgb(0 0 0 / 62%);
317
+ --color-accent: var(--color-project);
318
+ --color-accent-text: var(--color-bg);
319
+ --color-accent-hover: var(--color-text);
320
+ --color-button-hover: color-mix(in srgb, var(--color-accent) 85%, var(--color-text));
321
+ --color-link: #67c1df;
322
+ --color-focus: var(--color-accent);
323
+ --color-success: #4cc38a;
324
+ --color-warning: #e2a54b;
325
+ --color-error: #f0776c;
326
+ --color-info: #84adff;
327
+ --color-success-surface: #172d25;
328
+ --color-warning-surface: #2f281b;
329
+ --color-error-surface: #312020;
330
+ --color-info-surface: #202938;
331
+ --color-status-ink: var(--color-text);
332
+ --color-command-bg: var(--color-code);
333
+ --color-command-border: var(--color-border-subtle);
334
+ --color-code: var(--color-surface);
335
+ --color-code-text: var(--color-text);
336
+ --color-syntax-keyword: #d8c2a5;
337
+ --color-syntax-string: #a8bd9c;
338
+ --color-syntax-number: #d5b98c;
339
+ --color-syntax-comment: #a0a6b1;
340
+ --color-syntax-function: var(--color-syntax-keyword);
341
+ --color-syntax-type: var(--color-syntax-number);
342
+ --color-syntax-variable: var(--color-code-text);
343
+ --color-syntax-operator: var(--color-muted);
344
+ --color-syntax-punctuation: var(--color-muted);
345
+ --color-syntax-tag: var(--color-syntax-keyword);
346
+ --color-syntax-attribute: var(--color-syntax-number);
347
+ --shadow-raise: inset 0 1px 0 rgb(255 255 255 / 7%), 0 1px 2px rgb(0 0 0 / 45%);
348
+ --shadow-surface: 0 0 0 1px rgb(255 255 255 / 6%);
349
+ --shadow-sink: inset 1.2px 1.2px 3.6px rgb(0 0 0 / 55%), inset -1.2px -1.2px 3.6px rgb(255 255 255 / 5%);
350
+ --shadow-dialog: 0 8px 24px rgb(0 0 0 / 45%), 0 0 0 1px var(--color-border-subtle);
351
+ --shadow-nav-current: var(--shadow-nav-current-dark);
352
+ --shadow-field-focus: inset 0 0 0 2px color-mix(in srgb, var(--color-accent) 18%, transparent);
353
+ --shadow-field-focus-invalid: inset 0 0 0 2px color-mix(in srgb, var(--color-error) 18%, transparent);
354
+ }
355
+
356
+ :root [data-theme="light"] {
357
+ color-scheme: light;
358
+ --color-project: #4b45d1;
359
+ --color-bg: #f4f5f6;
360
+ --color-surface: #e9ebed;
361
+ --color-surface-raised: #fbfbfc;
362
+ --color-surface-muted: #e2e5e8;
363
+ --color-well: var(--color-surface-muted);
364
+ --color-field-bg: var(--color-surface-raised);
365
+ --color-field-edge: var(--color-border-subtle);
366
+ --shadow-field: none;
367
+ --color-control-thumb: var(--color-surface-raised);
368
+ --color-nav-current: color-mix(in srgb, var(--color-accent) 14%, var(--color-surface-raised));
369
+ --color-nav-current-text: var(--color-accent);
370
+ --color-segmented-current-text: var(--color-accent);
371
+ --color-row-hover: #e2e5e8;
372
+ --color-row-selected: var(--color-surface-raised);
373
+ --color-border-subtle: #d3d8dd;
374
+ --color-border: #6d747b;
375
+ --color-text: #101315;
376
+ --color-muted: #50575e;
377
+ --color-overlay: rgb(0 0 0 / 42%);
378
+ --color-accent: var(--color-project);
379
+ --color-accent-text: var(--color-bg);
380
+ --color-accent-hover: var(--color-text);
381
+ --color-button-hover: color-mix(in srgb, var(--color-accent) 85%, var(--color-text));
382
+ --color-link: #0b5f7c;
383
+ --color-focus: var(--color-accent);
384
+ --color-success: #157249;
385
+ --color-warning: #86532e;
386
+ --color-error: #bd342b;
387
+ --color-info: #175cd3;
388
+ --color-success-surface: #d9e5e1;
389
+ --color-warning-surface: #e7e2de;
390
+ --color-error-surface: #efe4e4;
391
+ --color-info-surface: #d9e3f2;
392
+ --color-status-ink: black;
393
+ --color-command-bg: var(--color-code);
394
+ --color-command-border: var(--color-border-subtle);
395
+ --color-code: var(--color-surface);
396
+ --color-code-text: var(--color-text);
397
+ --color-syntax-keyword: #715b42;
398
+ --color-syntax-string: #346347;
399
+ --color-syntax-number: #86532e;
400
+ --color-syntax-comment: #626772;
401
+ --color-syntax-function: var(--color-syntax-keyword);
402
+ --color-syntax-type: var(--color-syntax-number);
403
+ --color-syntax-variable: var(--color-code-text);
404
+ --color-syntax-operator: var(--color-muted);
405
+ --color-syntax-punctuation: var(--color-muted);
406
+ --color-syntax-tag: var(--color-syntax-keyword);
407
+ --color-syntax-attribute: var(--color-syntax-number);
408
+ --shadow-raise: 0 1px 2px rgb(16 24 40 / 12%), 0 0 0 1px rgb(16 24 40 / 6%);
409
+ --shadow-surface: 0 1px 2px rgb(16 24 40 / 6%), 0 0 0 1px rgb(16 24 40 / 6%);
410
+ --shadow-sink: inset 1.2px 1.2px 3.6px rgb(130 142 158 / 35%), inset -1.2px -1.2px 3.6px rgb(255 255 255 / 80%);
411
+ --shadow-dialog: 0 8px 24px rgb(16 16 24 / 12%), 0 0 0 1px var(--color-border-subtle);
412
+ --shadow-nav-current: 0 1px 3px rgb(130 142 158 / 40%);
413
+ --shadow-field-focus: inset 0 0 0 2px color-mix(in srgb, var(--color-accent) 18%, transparent);
414
+ --shadow-field-focus-invalid: inset 0 0 0 2px color-mix(in srgb, var(--color-error) 18%, transparent);
415
+ }
416
+
281
417
  /* Minimal base. Component styles live in components.html. The base sits in a layer, so any
282
418
  page or component rule outranks it whatever its specificity. A layered !important outranks an
283
419
  unlayered one, so reduced-motion exceptions belong here too. */
@@ -288,6 +424,8 @@ body { background: var(--color-bg); color: var(--color-text); }
288
424
  @layer base {
289
425
  *, *::before, *::after { box-sizing: border-box; }
290
426
  [hidden] { display: none !important; }
427
+ /* A subtree theme takes its mode's text colour, as the body does; the page paints its background. */
428
+ :where(:root.dark, :root [data-theme="dark"], :root [data-theme="light"], :root .dark) { color: var(--color-text); }
291
429
  body {
292
430
  margin: 0;
293
431
  font: var(--weight-regular) var(--text-md) / var(--leading) var(--font-ui);
@@ -199,7 +199,7 @@
199
199
  [data-slot="segmented-control"][data-orientation="horizontal"][data-size="sm"] > [data-slot="segmented-control-item"] { padding: 0 var(--space-2); }
200
200
  [data-slot="segmented-control"][data-orientation="horizontal"][data-size="lg"] { --item: var(--control-lg); font-size: var(--text-lg); }
201
201
  /* Line height 1 comes after the font shorthand, which would reset it: the label then sits centred in the item. */
202
- [data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"] { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: calc(var(--item) - 2 * var(--inset)); padding: 0 var(--space-3); border: 0; border-radius: calc(var(--radius-control) - var(--inset)); background: transparent; color: var(--color-muted); font: inherit; line-height: 1; cursor: pointer; }
202
+ [data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"] { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: calc(var(--item) - 2 * var(--inset)); padding: 0 var(--space-3); border: 0; border-radius: calc(var(--radius-control) - var(--inset)); background: transparent; color: var(--color-muted); font: inherit; line-height: normal; cursor: pointer; }
203
203
  [data-slot="segmented-control"][data-orientation="horizontal"][data-icon-only] > [data-slot="segmented-control-item"] { width: calc(var(--item) - 2 * var(--inset)); padding: 0; }
204
204
  /* Icon-only: a pill track with round options and thumb, concentric with it. A px radius keeps the thumb a pill while it moves. */
205
205
  [data-slot="segmented-control"][data-orientation="horizontal"][data-icon-only] { border-radius: var(--radius-pill); }
@@ -271,7 +271,7 @@
271
271
  The content holds a <header> (the title, then the close button) and a body that scrolls on its own.
272
272
  A top or bottom sheet is unsupported. */
273
273
  [data-slot="drawer-backdrop"] { position: fixed; inset: 0; background: var(--color-overlay); }
274
- [data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) { display: flex; flex-direction: column; width: min(calc(var(--sidebar) + var(--space-12)), calc(100vw - var(--space-12))); height: 100%; overflow: hidden; border: 1px solid transparent; background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); }
274
+ [data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) { display: flex; flex-direction: column; width: min(calc(var(--sidebar-width) + var(--space-12)), calc(100vw - var(--space-12))); height: 100%; overflow: hidden; border: 1px solid transparent; background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); }
275
275
  [data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) > header { display: flex; flex: none; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border-subtle); }
276
276
  [data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) > :not(header) { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: var(--space-4); }
277
277
  [data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) > header > [data-slot="drawer-title"] { margin: 0; font-size: var(--text-md); font-weight: var(--weight-medium); letter-spacing: 0; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/design-system",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "Filip's design language, tokens, and component catalogue for any framework",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -16,6 +16,7 @@
16
16
  "./themes/*.css": "./dist/themes/*.css",
17
17
  "./themes/*.tokens.json": "./dist/themes/*.tokens.json",
18
18
  "./tokens.json": "./dist/tokens.json",
19
+ "./theme-inputs.json": "./dist/theme-inputs.json",
19
20
  "./theme-mapper": {
20
21
  "types": "./theme-mapper/index.d.ts",
21
22
  "default": "./theme-mapper/index.js"
@@ -7,8 +7,9 @@ export const core = {
7
7
  "tokens": {
8
8
  "color-project": null,
9
9
  "color-project-dark": null,
10
- "font-ui": "\"IBM Plex Sans\", -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"Segoe UI\", system-ui, sans-serif",
11
- "font-mono": "\"IBM Plex Mono\", ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, Consolas, monospace"
10
+ "font-ui": "\"Inter\", -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"Segoe UI\", system-ui, sans-serif",
11
+ "font-mono": "\"JetBrains Mono\", ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, Consolas, monospace",
12
+ "radius-base": "8px"
12
13
  }
13
14
  },
14
15
  {
@@ -238,16 +239,16 @@ export const core = {
238
239
  "measure": "68ch",
239
240
  "page-max": "960px",
240
241
  "page-wide": "1120px",
241
- "sidebar": "224px"
242
+ "sidebar-width": "224px"
242
243
  }
243
244
  },
244
245
  {
245
246
  "tokens": {
246
- "radius-inline": "8px",
247
- "radius-control": "8px",
248
- "radius-panel": "12px",
249
- "radius-field": "8px",
250
- "radius-mark": "4px",
247
+ "radius-inline": "{radius-base}",
248
+ "radius-control": "{radius-base}",
249
+ "radius-panel": "calc({radius-base} * 1.5)",
250
+ "radius-field": "{radius-base}",
251
+ "radius-mark": "calc({radius-base} * 0.5)",
251
252
  "radius-pill": "999px",
252
253
  "radius-circle": "999px"
253
254
  }
@@ -8,13 +8,21 @@
8
8
  */
9
9
  /** @typedef {{ light: string, dark: string }} ModePair */
10
10
  /**
11
- * One theme's inputs, for light and for dark. Fonts and neutrals stay core unless the theme names its own.
11
+ * One theme's inputs, for light and for dark. Fonts, the base radius, and neutrals stay core unless the theme
12
+ * names its own.
12
13
  * @typedef {object} ThemeInputs
13
14
  * @property {ModePair} hue The hue, `--color-project` in light and `--color-project-dark`.
14
15
  * @property {{ ui?: string, mono?: string }} [fonts] The two font stacks.
16
+ * @property {string} [radius] The base radius, `--radius-base`, as a CSS length.
15
17
  * @property {{ light: Record<string, string>, dark: Record<string, string> }} [neutrals] Every NEUTRALS token, per mode.
16
18
  * @property {{ light?: Record<string, string>, dark?: Record<string, string> }} [syntax] Syntax colours by SYNTAX_ROLES
17
19
  * role, per mode. A role a theme leaves out stays core.
20
+ * @property {{ light?: Record<string, string>, dark?: Record<string, string> }} [textOnHue] The text on the hue's
21
+ * fills, by TEXT_ON_HUE_TOKENS name, per mode, for a theme that sets its own. Each value is `#rrggbb`, `white`,
22
+ * `black`, or a token reference such as `{color-bg}`; for example `{ light: { 'color-accent-text': '#ffffff' } }`.
23
+ * A token a theme leaves out keeps its default: `color-accent-text` stays `{color-bg}`, which a pale hue can fail,
24
+ * and the selected-fill text tokens take the first candidate that reaches 4.5:1, or the accent when none does.
25
+ * Run checkTheme on the result.
18
26
  */
19
27
  /**
20
28
  * Every token's resolved value in light and in dark, as getComputedStyle reports it.
@@ -48,6 +56,16 @@ export const SYNTAX_ROLES: string[];
48
56
  export const SURFACES: string[];
49
57
  /** The selected-fill text tokens, which take their readable value from the theme. */
50
58
  export const TEXT_ON_FILL_TOKENS: string[];
59
+ /** The text on the hue's fills, which a theme may set: the primary label and the selected-fill text. */
60
+ export const TEXT_ON_HUE_TOKENS: string[];
61
+ export function themeInputNames(data: TokenSource): {
62
+ hue: string[];
63
+ textOnHue: string[];
64
+ fonts: string[];
65
+ radius: string[];
66
+ neutrals: string[];
67
+ syntax: string[];
68
+ };
51
69
  export function applyTheme<Data extends TokenSource>(core: Data, theme: ThemeInputs): Data;
52
70
  /**
53
71
  * The contrast checks each theme must pass, in both modes.
@@ -75,7 +93,8 @@ export type ModePair = {
75
93
  dark: string;
76
94
  };
77
95
  /**
78
- * One theme's inputs, for light and for dark. Fonts and neutrals stay core unless the theme names its own.
96
+ * One theme's inputs, for light and for dark. Fonts, the base radius, and neutrals stay core unless the theme
97
+ * names its own.
79
98
  */
80
99
  export type ThemeInputs = {
81
100
  /**
@@ -89,6 +108,10 @@ export type ThemeInputs = {
89
108
  ui?: string;
90
109
  mono?: string;
91
110
  } | undefined;
111
+ /**
112
+ * The base radius, `--radius-base`, as a CSS length.
113
+ */
114
+ radius?: string | undefined;
92
115
  /**
93
116
  * Every NEUTRALS token, per mode.
94
117
  */
@@ -104,6 +127,18 @@ export type ThemeInputs = {
104
127
  light?: Record<string, string>;
105
128
  dark?: Record<string, string>;
106
129
  } | undefined;
130
+ /**
131
+ * The text on the hue's
132
+ * fills, by TEXT_ON_HUE_TOKENS name, per mode, for a theme that sets its own. Each value is `#rrggbb`, `white`,
133
+ * `black`, or a token reference such as `{color-bg}`; for example `{ light: { 'color-accent-text': '#ffffff' } }`.
134
+ * A token a theme leaves out keeps its default: `color-accent-text` stays `{color-bg}`, which a pale hue can fail,
135
+ * and the selected-fill text tokens take the first candidate that reaches 4.5:1, or the accent when none does.
136
+ * Run checkTheme on the result.
137
+ */
138
+ textOnHue?: {
139
+ light?: Record<string, string>;
140
+ dark?: Record<string, string>;
141
+ } | undefined;
107
142
  };
108
143
  /**
109
144
  * Every token's resolved value in light and in dark, as getComputedStyle reports it.