@filipgutica/design-system 1.0.37 → 1.0.38

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.
@@ -636,19 +636,31 @@
636
636
  .code-head .lang { color: var(--color-muted); }
637
637
  /* Copy is a quiet action; this sets its size and place. */
638
638
  .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; }
639
- /* 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. */
640
- .code .copy { color: var(--color-muted); }
641
- .code .copy[data-copied] { color: var(--color-code-text); }
642
- .code .copy.is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
643
- @media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: var(--color-code-text); } }
639
+ /* Copy and Wrap lines are muted at rest. The code block has its own palette, so on hover, while the tick
640
+ shows, and while Wrap lines is on they take the block's text colour. */
641
+ .code :is(.copy, .wrap-toggle) { color: var(--color-muted); }
642
+ .code :is(.copy[data-copied], .wrap-toggle[aria-pressed="true"]) { color: var(--color-code-text); }
643
+ .code :is(.copy, .wrap-toggle).is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
644
+ @media (hover: hover) { .code :is(.copy, .wrap-toggle):hover:where(:not(:disabled)) { color: var(--color-code-text); } }
645
+ /* The block's actions sit together at the end of the header, or in the corner beside the source. */
646
+ .code-actions { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
647
+ .code-actions > .copy { margin-left: 0; }
648
+ /* Wrap lines is an icon-only quiet action and a toggle: while on it keeps the open-menu tint. */
649
+ .wrap-toggle { flex: none; width: var(--control-md); min-height: var(--control-md); padding: 0; }
650
+ :where(.wrap-toggle[aria-pressed="true"]) { background: color-mix(in srgb, currentColor 6%, transparent); }
651
+ /* Forced colors: a Highlight border and icon mark it on, at rest and on hover. */
652
+ @media (forced-colors: active) { .code .wrap-toggle[aria-pressed="true"] { border-color: Highlight; } .wrap-toggle[aria-pressed="true"] .icon { color: Highlight; } }
644
653
  /* Inset: the code block clips its content. */
645
654
  .code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
646
- .code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
655
+ .code :is(.copy, .wrap-toggle).quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
647
656
  /* The source is an inset panel. It sits --space-1 inside the frame, so its corners are concentric with the frame's. */
648
657
  .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; }
649
658
  /* Each line is a baseline-aligned row, so a prompt or line number sits on the text's baseline. */
650
659
  .code .line { display: flex; align-items: baseline; min-height: 1.65em; }
651
660
  .code .line > span { white-space: pre; }
661
+ /* With Wrap lines on, each line breaks inside the panel, long words and URLs included, and nothing scrolls
662
+ sideways. The line number stays on the first visual line. */
663
+ .code[data-wrap] .line > span:not(.ln) { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
652
664
  .code .ln { min-width: 2.5em; padding-right: 1em; flex: none; text-align: right; color: var(--color-muted); user-select: none; }
653
665
  .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); }
654
666
  .code .f { color: var(--color-syntax-function); } .code .t { color: var(--color-syntax-type); } .code .v { color: var(--color-syntax-variable); } .code .o { color: var(--color-syntax-operator); } .code .p { color: var(--color-syntax-punctuation); } .code .g { color: var(--color-syntax-tag); } .code .a { color: var(--color-syntax-attribute); }
@@ -667,7 +679,7 @@
667
679
  Copy comes first in DOM order and is placed in the source's top right corner. */
668
680
  .example > .code { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; max-width: none; padding: 0; border-width: 1px 0 0; border-radius: 0; background: var(--color-code); box-shadow: none; }
669
681
  .example > .code > pre { grid-row: 1; grid-column: 1; border: 0; border-radius: 0; }
670
- .example > .code > .copy { grid-row: 1; grid-column: 2; margin: var(--space-1); }
682
+ .example > .code > :is(.copy, .code-actions) { grid-row: 1; grid-column: 2; margin: var(--space-1); }
671
683
 
672
684
  /* ================= Identity: terminal folio ================= */
673
685
 
@@ -985,7 +997,8 @@
985
997
  /* Quiet actions in docs components: 32px on desktop, 44px here. */
986
998
  .close { width: var(--control-touch); }
987
999
  .copy { min-width: var(--control-touch); }
988
- .close, .copy, .full, .projects > summary, .page-head .strip a { min-height: var(--control-touch); }
1000
+ .wrap-toggle { width: var(--control-touch); }
1001
+ .close, .copy, .full, .projects > summary, .page-head .strip a, .wrap-toggle { min-height: var(--control-touch); }
989
1002
  .chip { min-height: var(--control-touch); }
990
1003
  /* Touch: the hover toolbar never shows; a tap opens the thread, whose header holds More. */
991
1004
  .msg-tools { display: none; }
@@ -1032,6 +1045,7 @@
1032
1045
  <symbol id="i-close" viewBox="0 0 16 16"><path d="M4 4l8 8M12 4l-8 8"/></symbol>
1033
1046
  <symbol id="i-plus" viewBox="0 0 16 16"><path d="M8 3.5v9M3.5 8h9"/></symbol>
1034
1047
  <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>
1048
+ <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>
1035
1049
  <symbol id="i-chevron-down" viewBox="0 0 16 16"><path d="m4 6 4 4 4-4"/></symbol>
1036
1050
  <symbol id="i-help" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"/><path d="M6.6 6.4a1.5 1.5 0 1 1 2 1.4c-.4.2-.6.5-.6.9M8 10.8v.2"/></symbol>
1037
1051
  <symbol id="i-alert" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"/><path d="M8 5v3.5M8 10.8v.2"/></symbol>
@@ -1773,11 +1787,14 @@ I’ll open a ticket for it.</textarea><button class="btn" type="button" data-si
1773
1787
  <p class="purpose">Source code with an optional header and Copy, and a live example above it.</p>
1774
1788
  <dl class="guidance"><dt>Do</dt><dd>Use a code block for source with no live result. When the reader should see the result too, use the variant with a live example.</dd><dt>Don’t</dt><dd>The same language label on every block of a page. Put useful setup context above the block instead.</dd></dl>
1775
1789
  <div class="row"><h4>Source well</h4><div class="states">
1776
- <div class="state wide"><div class="code"><div class="code-head"><b>monitor.ts</b><span class="lang">TypeScript</span><button class="quiet-action copy" type="button" data-copy="code-src"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div><pre tabindex="0" role="region" aria-label="monitor.ts"><code id="code-src"><span class="line"><span class="ln">1</span><span><span class="k">const</span> <span class="v">threshold</span> <span class="o">=</span> <span class="n">300</span> <span class="c">// ms at p95</span></span></span><span class="line"><span class="ln">2</span><span><span class="k">export const</span> <span class="v">name</span> <span class="o">=</span> <span class="s">'API p95 latency'</span></span></span><span class="line"><span class="ln">3</span><span><span class="k">export function</span> <span class="f">breached</span><span class="p">(</span><span class="v">p95</span><span class="p">:</span> <span class="t">number</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="v">p95</span> <span class="o">&gt;</span> <span class="v">threshold</span> <span class="p">}</span></span></span></code></pre></div><span class="caption">Header, line numbers, and Copy, live</span></div>
1790
+ <div class="state wide"><div class="code"><div class="code-head"><b>monitor.ts</b><span class="lang">TypeScript</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"><svg class="icon" aria-hidden="true"><use href="#i-wrap"/></svg></button><button class="quiet-action copy" type="button" data-copy="code-src"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div></div><pre tabindex="0" role="region" aria-label="monitor.ts"><code id="code-src"><span class="line"><span class="ln">1</span><span><span class="k">const</span> <span class="v">threshold</span> <span class="o">=</span> <span class="n">300</span> <span class="c">// ms at p95</span></span></span><span class="line"><span class="ln">2</span><span><span class="k">export const</span> <span class="v">name</span> <span class="o">=</span> <span class="s">'API p95 latency'</span></span></span><span class="line"><span class="ln">3</span><span><span class="k">export function</span> <span class="f">breached</span><span class="p">(</span><span class="v">p95</span><span class="p">:</span> <span class="t">number</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="v">p95</span> <span class="o">&gt;</span> <span class="v">threshold</span> <span class="p">}</span></span></span></code></pre></div><span class="caption">Header, line numbers, and Copy, live</span></div>
1777
1791
  <div class="state wide" inert><div class="code compact"><pre><code><span class="line"><span>import { threshold } from './monitor'</span></span></code></pre><button class="quiet-action copy is-focus" type="button" aria-label="Copy import"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><span class="caption">Compact, with focus visible on Copy</span></div>
1778
1792
  </div></div>
1793
+ <div class="row"><h4>Wrap lines</h4><div class="states">
1794
+ <div class="state wide"><div class="code"><div class="code-head"><b>alert.ts</b><span class="lang">TypeScript</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"><svg class="icon" aria-hidden="true"><use href="#i-wrap"/></svg></button><button class="quiet-action copy" type="button" data-copy="code-wrap-src"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div></div><pre tabindex="0" role="region" aria-label="alert.ts"><code id="code-wrap-src"><span class="line"><span class="ln">1</span><span><span class="k">export const</span> <span class="v">runbook</span> <span class="o">=</span> <span class="s">'https://docs.example.com/runbooks/api-latency/p95-breach-escalation-and-rollback-steps'</span></span></span><span class="line"><span class="ln">2</span><span><span class="k">export const</span> <span class="v">message</span> <span class="o">=</span> <span class="s">'API p95 latency stayed above the threshold for five minutes, so the on-call engineer is paged'</span></span></span></code></pre></div><span class="caption">Long lines, live: off by default, so they scroll; Wrap lines breaks them inside the panel</span></div>
1795
+ </div></div>
1779
1796
  <div class="row"><h4>With a live example</h4><div class="states">
1780
- <div class="state wide"><figure class="example"><div class="example-stage"><div style="display:flex;gap:var(--space-2);flex-wrap:wrap"><button class="btn secondary" type="button">Cancel</button><button class="btn" type="button">Save monitor</button></div></div><div class="code"><button class="quiet-action copy" type="button" data-copy="example-src" aria-label="Copy code" title="Copy code"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button><pre tabindex="0" role="region" aria-label="Example source"><code id="example-src"><span class="line"><span>&lt;<span class="g">button</span> <span class="a">class</span>=<span class="s">"btn secondary"</span> <span class="a">type</span>=<span class="s">"button"</span>&gt;Cancel&lt;/<span class="g">button</span>&gt;</span></span><span class="line"><span>&lt;<span class="g">button</span> <span class="a">class</span>=<span class="s">"btn"</span> <span class="a">type</span>=<span class="s">"button"</span>&gt;Save monitor&lt;/<span class="g">button</span>&gt;</span></span></code></pre></div></figure><span class="caption">Live: the stage on the page background, the source below one hairline, and Copy in its corner</span></div>
1797
+ <div class="state wide"><figure class="example"><div class="example-stage"><div style="display:flex;gap:var(--space-2);flex-wrap:wrap"><button class="btn secondary" type="button">Cancel</button><button class="btn" type="button">Save monitor</button></div></div><div class="code"><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"><svg class="icon" aria-hidden="true"><use href="#i-wrap"/></svg></button><button class="quiet-action copy" type="button" data-copy="example-src" aria-label="Copy code" title="Copy code"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><pre tabindex="0" role="region" aria-label="Example source"><code id="example-src"><span class="line"><span>&lt;<span class="g">button</span> <span class="a">class</span>=<span class="s">"btn secondary"</span> <span class="a">type</span>=<span class="s">"button"</span>&gt;Cancel&lt;/<span class="g">button</span>&gt;</span></span><span class="line"><span>&lt;<span class="g">button</span> <span class="a">class</span>=<span class="s">"btn"</span> <span class="a">type</span>=<span class="s">"button"</span>&gt;Save monitor&lt;/<span class="g">button</span>&gt;</span></span></code></pre></div></figure><span class="caption">Live: the stage on the page background, the source below one hairline, and Copy in its corner</span></div>
1781
1798
  </div></div>
1782
1799
  <p class="sr-only" role="status" id="copy-status"></p>
1783
1800
  </section>
@@ -1793,7 +1810,7 @@ I’ll open a ticket for it.</textarea><button class="btn" type="button" data-si
1793
1810
  <dl class="guidance"><dt>Do</dt><dd>Use it for a shell command the reader runs, one command per line.</dd><dt>Don’t</dt><dd>A <code>$</code> typed into the command. CSS draws the prompt; a typed one is copied with the command.</dd></dl>
1794
1811
  <div class="row"><h4>Commands</h4><div class="states">
1795
1812
  <div class="state wide"><div class="code command compact"><pre tabindex="0" role="region" aria-label="Install command"><code id="cmd-install"><span class="line"><span>brew install filipgutica/tap/filip-stack</span></span></code></pre><button class="quiet-action copy" type="button" data-copy="cmd-install" aria-label="Copy install command"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><span class="caption">Compact, live; the <code>$</code> is drawn by CSS</span></div>
1796
- <div class="state wide"><div class="code command"><div class="code-head"><b>Set up</b><button class="quiet-action copy" type="button" data-copy="cmd-setup"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div><pre tabindex="0" role="region" aria-label="Set up commands"><code id="cmd-setup"><span class="line"><span>pnpm install --frozen-lockfile</span></span><span class="line"><span>pnpm check</span></span></code></pre></div><span class="caption">With a header, two lines</span></div>
1813
+ <div class="state wide"><div class="code command"><div class="code-head"><b>Set up</b><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"><svg class="icon" aria-hidden="true"><use href="#i-wrap"/></svg></button><button class="quiet-action copy" type="button" data-copy="cmd-setup"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div></div><pre tabindex="0" role="region" aria-label="Set up commands"><code id="cmd-setup"><span class="line"><span>pnpm install --frozen-lockfile</span></span><span class="line"><span>pnpm check</span></span></code></pre></div><span class="caption">With a header, two lines</span></div>
1797
1814
  <div class="state wide" inert><div class="code command compact"><pre><code><span class="line"><span>filip-stack apply</span></span></code></pre><button class="quiet-action copy is-focus" type="button" aria-label="Copy apply command"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><span class="caption">Focus visible on Copy, in <code>--color-focus</code></span></div>
1798
1815
  </div></div>
1799
1816
  </section>
@@ -2109,6 +2126,12 @@ I’ll open a ticket for it.</textarea><button class="btn" type="button" data-si
2109
2126
  button.dataset.copied = '';
2110
2127
  ticks.set(button, setTimeout(restore, 1500));
2111
2128
  };
2129
+ // Wrap lines: a toggle on each multi-line code block. It keeps its name; aria-pressed carries the state.
2130
+ document.querySelectorAll('[data-wrap-toggle]').forEach((button) => button.addEventListener('click', () => {
2131
+ const on = button.getAttribute('aria-pressed') !== 'true';
2132
+ button.setAttribute('aria-pressed', String(on));
2133
+ button.closest('.code').toggleAttribute('data-wrap', on);
2134
+ }));
2112
2135
  document.querySelectorAll('[data-copy]').forEach((button) => button.addEventListener('click', async () => {
2113
2136
  const text = copyText(document.getElementById(button.dataset.copy));
2114
2137
  let ok = true;
@@ -537,16 +537,17 @@ Layer: Core.
537
537
 
538
538
  - **Anatomy.** A frame that holds an optional header and the source panel.
539
539
  - **Frame.** `--color-surface-raised`, a 1px `--color-border-subtle` border, `--radius-panel`, and `--shadow-surface`. Its padding is `0 var(--space-1) var(--space-1)` under a header, and `var(--space-1)` on every side without one.
540
- - **Header.** At least 40px and `--text-xs`, on the frame with no fill and no rule below. It holds the title in semibold, the language in muted text, and a Copy button.
540
+ - **Header.** At least 40px and `--text-xs`, on the frame with no fill and no rule below. It holds the title in semibold, the language in muted text, and, at the end, Wrap lines then Copy, 4px (`--space-1`) apart.
541
541
  - **Source panel.** The `<pre>`: `--color-code`, a transparent 1px border, and `calc(var(--radius-panel) - var(--space-1))` corners (8px), so its curve is concentric with the frame's. It has `--space-4` padding, scrolls in both directions, is at most 32rem tall, and sets `--font-mono` at `--text-code` with a line height of 1.65. Line numbers are muted and right-aligned. Syntax uses the `--color-syntax-*` tokens.
542
542
  - **Compact.** The panel and the Copy button share one row, with no header, and a `--space-1` column gap. The panel fills the row's height, so it sits `--space-1` from the frame and from Copy on every side, and centres its line. Copy centres on the row.
543
+ - **Wrap lines.** Every block with a header, and every live example's source, has a Wrap lines toggle before Copy: an icon-only [quiet action](#quiet-action) (`#i-wrap`), 32×32 (`--control-md`) and 44×44 at tablet width, named "Wrap lines", with `aria-pressed` for its state; the name and title never change. It is off by default, so lines keep their shape and the panel scrolls sideways. On, the block takes `data-wrap`: each line's text breaks inside the panel (`white-space: pre-wrap`, `overflow-wrap: anywhere`, so long words and URLs break too), the line number stays on the first visual line, and Copy still copies the original lines. While on it takes `--color-code-text` and the quiet action's 6% open-menu tint; in forced colors a `Highlight` border and icon mark it, at rest and on hover. A compact block holds one line and has no toggle. The state is per block and is not saved.
543
544
  - **Phone text.** Set `text-size-adjust: 100%` (and `-webkit-text-size-adjust`) on the block, and align each line's items to the baseline, so iOS Safari does not enlarge one line.
544
545
  - **Copy.** Copies the code text only: no line numbers or prompts, and one line per row joined with newlines. A [quiet action](#quiet-action) at least 32×32 (`--control-md`), and 44×44 at tablet width, with an accessible name. It is `--color-muted` at rest (7.09:1 on the frame in light, 6.63:1 in dark), and `--color-code-text` on hover and while the tick shows, which the script marks with `data-copied`. Announce the result in a polite live region; in the compact variant the success message is visually hidden.
545
546
  - **Copy feedback.** This applies to every copy action: the code block's Copy, a token's Copy, and Copy link. On success, the icon turns into a plain tick (`#i-tick`) for 1.5s and then turns back. A second click within the 1.5s restarts the wait. The visible label, such as Copy, and the accessible name do not change, and no "Copied" text appears. The polite live region announces "Copied." or the failure. On failure, the icon does not change and the failure shows as before: a token's Copy shows "Copy failed" in place of its icon. Under reduced motion nothing changes, because the swap has no animation.
546
- - **States.** Rest, and focus-visible on Copy and on the `<pre>` when it scrolls. Copy takes the quiet action states, shows the tick after a copy, and announces "Copied." or a failure.
547
+ - **States.** Rest, Wrap lines on, and focus-visible on Copy, on Wrap lines, and on the `<pre>` when it scrolls. Copy takes the quiet action states, shows the tick after a copy, and announces "Copied." or a failure.
547
548
  - **Do.** Use a code block for source with no live result. When the reader should see the result too, use the variant with a live example.
548
549
  - **Don't.** The same language label on every block of a page. Put useful setup context above the block instead.
549
- - **Keyboard and screen reader.** The `<pre>` is focusable when it scrolls. Its focus ring and the Copy button's ring are inset, because the block clips its content. The `<pre>` ring follows the panel's 8px corners.
550
+ - **Keyboard and screen reader.** The `<pre>` is focusable when it scrolls. With a header, Tab order is Wrap lines, then Copy, then the `<pre>`; a compact block puts the `<pre>` before Copy. The focus rings on Wrap lines, Copy, and the `<pre>` are inset, because the block clips its content. The `<pre>` ring follows the panel's 8px corners.
550
551
  - **Motion.** None: the block is static, and Copy changes as a quiet action does.
551
552
  - **Forced colors.** The shadow drops, and the frame's border and the panel's transparent border draw as system edges. Syntax colours take the system text colour, so code reads as plain text.
552
553
 
@@ -556,9 +557,9 @@ Layer: Core.
556
557
  - **Tokens.** Frame edge `--color-border-subtle` and corners `--radius-panel`. Stage `--color-bg`. Hairline `--color-border-subtle`.
557
558
  - **Stage.** The stage sits on the page background, not in a well or a panel. This is a named exception to the container [depth](DESIGN.md#depth) tier: a preview shows each component on the surface it sits on in a page; see [decisions](decisions.md).
558
559
  - **Source.** Inside the frame the code block has no radius, border, padding, or shadow of its own, and it spans the frame's full width, not `--measure`. It takes `--color-code`, and its panel is flush with no corners, so the source fills the frame below the hairline.
559
- - **Copy.** Icon-only and named "Copy code", in the source's top right corner. It comes before the `<pre>` in DOM order, so the reader reaches it before the code.
560
+ - **Copy.** Icon-only and named "Copy code", in the source's top right corner, after Wrap lines. It comes before the `<pre>` in DOM order, so the reader reaches it before the code.
560
561
  - **States.** The frame has no states. Components on the stage show their own states.
561
- - **Keyboard and screen reader.** Tab order is the stage's controls, then Copy, then the `<pre>`. Name the `<pre>` for its role, for example "Example source", when it scrolls. Focus rings on Copy and the `<pre>` are inset, because the frame clips its content.
562
+ - **Keyboard and screen reader.** Tab order is the stage's controls, then Wrap lines, then Copy, then the `<pre>`. Name the `<pre>` for its role, for example "Example source", when it scrolls. Focus rings on Wrap lines, Copy, and the `<pre>` are inset, because the frame clips its content.
562
563
  - **Motion.** None of its own.
563
564
  - **Responsive.** The frame takes its container's width. The stage stays above the source at every width. On phones the stage padding is `--space-6` by `--space-4`. Wide content scrolls inside the stage or the `<pre>`, never the page.
564
565
  - **Forced colors.** The frame edge and the hairline draw in the system colour.
@@ -46,6 +46,7 @@ Each entry records a choice this language made, the options it rejected, and why
46
46
  | Segmented track inset | Core | The track is the control height and insets its options 2px from its outer edge (its 1px border and 1px of padding), with 2px between options, as Astryx's segmented control does (`SegmentedControl.tsx`: 2px padding and gap; `SegmentedControlItem.tsx`: item height the element height minus 4px, 8px padding at `sm`, 12px at `md` and `lg`). Each option is its own thumb, with `calc(var(--radius-control) - var(--inset))`, 6px, measured from the outer edge because the border is part of the track's visible curve: the one control corner below 8px, a named exception to the row corner. The owner asked for it on 2026-11-22 after the 28px `sm` filter's thumb looked off centre in its 30px track. Options set `line-height: 1`, so the label sits centred: the inherited 1.6 put IBM Plex 1.8px above centre in a 24px `sm` option (Chromium). | A thumb inset 2px inside each full-height option (the rule until 2026-11-22): the track was 2px taller than the control (34px beside a 32px button at `sm`, then 30px beside 28px), and the thumbs sat 4px apart. The mockups' nested 12px track around 8px rows: at 28px tall, a 4px inset leaves a 20px option, which is cramped. Measuring from the padding edge (7px): the visible curve is the border's, so 7px reads as a corner that does not follow the track. | thumb centred and track height equals the same-size button: `tests/catalogue/catalogue.spec.ts`; ui-sdk parity: `tests/react-smoke/ui-sdk.spec.ts` "ui-sdk parts match the catalogue" |
47
47
  | Application density | Core | In an application screen, buttons, fields, and segmented controls are `sm` (28px), the main action included, and chips stay 24px. The main action stands out by its primary fill. The owner dropped the `md` main action on 2026-11-23: `md` felt big beside `sm`. Rows are `--row` tall, with `--text-sm` body text and `--text-xs` metadata. Documentation and product pages keep `md`. At tablet width every touch target grows to `--control-touch`, at every size. The owner chose this on 2026-11-22 from the board mockups. | Toolbar controls alone at `sm`, the rule before: forms and actions inside a pane stayed `md`, so one screen mixed two heights. `md` everywhere: the board read as busy. One `md` main action per screen (the first version of this rule): it felt big next to `sm` controls. | No test yet |
48
48
  | Tab density | Core | A tab has the button's box: at least `--control-md` (32px) tall, 10px inline padding, no block padding, and line height 1; `data-size="sm"` tabs, for app screens, are 28px with 8px padding. Tabs grow to `--control-touch` at tablet width. The list keeps its 4px padding, which keeps the selected tab's shadow whole where the list clips. The owner asked for narrower tabs with less dead space on 2026-11-24. | The tab before: `--space-2` `--space-3` padding with line height 1.6 made a 38px tab, taller than every control beside it, and 84px wide for "Overview". 2px list padding: it clips the selected tab's `--shadow-nav-current`, which reaches 4px below the tab. | heights: `tests/catalogue/catalogue.spec.ts` "renders control sizes" (tabs at their exact control height) |
49
+ | Code wrap toggle | Core | Every multi-line code block (one with a header, or a live example's source) has a Wrap lines toggle before Copy: an icon-only quiet action with a fixed name and `aria-pressed`. It is off by default, per block, and not saved. Astryx offers wrapping only as a caller prop (`CodeBlock` spec: "optional wrapping"); this departs from it with a reader control, as T3 Code's code blocks have. The owner asked for it on 2026-11-24. | Wrapping by default: it would reflow every code block on the five sites, and the spec has the panel scroll. A name that flips between Enable and Disable line wrap, as T3 Code's tooltip does: with `aria-pressed` it would announce the state twice. Saving the choice: one more stored setting for a per-block reading aid. A toggle on compact blocks: they hold one line. | toggle, wrapping, and copy: `tests/catalogue/catalogue.spec.ts` "Wrap lines wraps a code block, and Copy still copies its lines" |
49
50
  | Astryx as the reference system | Core | When a value or behaviour is not decided here, start from Astryx's (`meta/astryx`, MIT, read at `7032abf`), and record any departure in this file. Take the idea and the values, never the code. The identity stays this system's: IBM Plex, the theme hues, quiet depth, and the forced-colors rules. The owner chose this on 2026-11-22 so the system stops re-deciding settled questions; the quiet action fill, the focus ring, field focus, the radius scale, and the compact controls already follow Astryx. React apps keep ui-sdk for behaviour: `ui-sdk.css` draws it. | Astryx's React components in React apps, themed with these tokens: it reverses the board's ui-sdk choice, and the Vue library could not use them. Making the design system a wrapper of ui-sdk: `@filipgutica/ui` (Vue) and the static sites use the design system, ui-sdk is React-only here and in beta, and `ui-sdk.css` already draws ui-sdk's parts. Deciding each value from scratch: it re-decided questions Astryx has answered, and the results drifted toward it anyway. | No test: a working rule for authors |
50
51
  | Conversation components | Core | Message row, message group, hover toolbar, thread panel, composer, tool-call disclosure, mention, and chip are specified here before any app builds them, so the board's React code and any later Vue component draw from one spec. They follow the board mockups (2026-11-22) and Slack, T3 Code, and ChatGPT patterns: flat rows with no bubble; one author's messages within about 5 minutes grouped under one avatar; actions in a hover toolbar that is one Tab stop (`role="toolbar"`, arrow keys between its actions) and never shown on touch; tool output collapsed to one line in a native `<details>`; a composer that is one field with an inline send button; a thread in a side pane, resizable from 20rem to 40rem by drag or arrow keys and full width at tablet width. Conversation sits after Navigation, because its parts reuse the selected row and the overflow menu. A message takes one tag style, `--color-nav-current-text` semibold, only on a message that needs the reader. A mention is static text, not a link. | Bubbles or cards around messages: the board read as busy, and Slack, T3 Code, and ChatGPT use flat rows. A row of buttons on every message: it repeats the same actions down the stream. A toolbar as a `role="group"`: three Tab stops for each message in a long stream. A thread in a dialog: it hides the channel the reader is replying about. Building the components in the board app first: the app's code would become the only definition. | rendered corners by role and the conversation keyboard paths: `tests/catalogue/catalogue.spec.ts`; parts, groups, and states agreement: `tests/component-parts.test.mjs` and `tests/design-foundations.test.mjs` |
51
52
  | Phone header | Core | The family shell, option A, which the owner chose on 2026-11-11: the site's header matches the other family sites. At tablet width the static header has two rows, the project switcher and the appearance control, then the Pages strip. Where both do not fit, as at 320px, the appearance control wraps to its own row at the start, as UiSiteHeader does on PluginBench and Filip Stack, and the project name never truncates. The rule below the header is the family's solid `--color-text` line. Just below it, at the start, the labelled trigger ("Components: By purpose") opens the drawer from the left, the side it sits on. The drawer is titled with the rail's name and holds Find and the rail's groups. `/` opens it with Find focused. Without JavaScript nothing moves. | The Gate M single sticky row with the site name, then icon-only Find and Menu buttons, with the pages and appearance in the Menu drawer: the site had no way to the other family sites, and the Menu button sat at the right while the drawer slid in from the left. Option B, keeping that row and sliding the drawer in from the right: it kept the site apart from the other seven family sites. Truncating the project name at 320px so both controls shared row 1: the family wraps the picker instead, and the name should never truncate. | `tests/site/site.spec.ts` "the switcher and appearance share the first row, then the pages, then the trigger", "the switcher and appearance take a row each, then the pages, then the trigger", "every clipped strip link shows at least 16px", "the trigger opens the drawer from the left edge, titled with the rail and holding Find and the rail only", "the trigger label follows the current section as the page scrolls"; `tests/catalogue/catalogue.spec.ts` "the trigger opens the drawer on the current row, and a link closes it and focuses the target" |
@@ -44,13 +44,13 @@ p { max-width: var(--measure); color: var(--color-muted); font-size: var(--text-
44
44
  /* Copy is a quiet action; this sets its size and place. */
45
45
  .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; }
46
46
  /* 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. */
47
- .code .copy { color: var(--color-muted); }
48
- .code .copy[data-copied] { color: var(--color-code-text); }
49
- .code .copy.is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
50
- @media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: var(--color-code-text); } }
47
+ .code :is(.copy, .wrap-toggle) { color: var(--color-muted); }
48
+ .code :is(.copy[data-copied], .wrap-toggle[aria-pressed="true"]) { color: var(--color-code-text); }
49
+ .code :is(.copy, .wrap-toggle).is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
50
+ @media (hover: hover) { .code :is(.copy, .wrap-toggle):hover:where(:not(:disabled)) { color: var(--color-code-text); } }
51
51
  /* Inset: the code block clips its content. */
52
52
  .code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
53
- .code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
53
+ .code :is(.copy, .wrap-toggle).quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
54
54
  /* The source is an inset panel. It sits --space-1 inside the frame, so its corners are concentric with the frame's. */
55
55
  .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; }
56
56
  /* Each line is a baseline-aligned row, so a prompt or line number sits on the text's baseline. */
@@ -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. */
@@ -427,6 +439,7 @@
427
439
  .btn:not([data-specimen="size"] *), .navlist a, .tab { min-height: var(--control-touch); }
428
440
  .search { height: var(--control-touch); }
429
441
  .copy { min-width: var(--control-touch); min-height: var(--control-touch); }
442
+ .wrap-toggle { width: var(--control-touch); min-height: var(--control-touch); }
430
443
  .check:not([data-specimen="size"] *) { min-height: var(--control-touch); }
431
444
  .shell { grid-template-columns: minmax(0, 1fr); height: auto; }
432
445
  main { overflow: visible; }
@@ -472,6 +485,7 @@
472
485
  <symbol id="i-plus" viewBox="0 0 16 16"><path d="M8 3.5v9M3.5 8h9"/></symbol>
473
486
  <symbol id="i-play" viewBox="0 0 16 16"><path d="M5 3.5v9l7-4.5z"/></symbol>
474
487
  <symbol id="i-arrow-up" viewBox="0 0 16 16"><path d="M8 13V3M4 7l4-4 4 4"/></symbol>
488
+ <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
489
  <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
490
  </svg>
477
491
 
@@ -941,7 +955,7 @@
941
955
  <dt>Metric</dt><dd class="mono">${m.metric}</dd>
942
956
  </dl>
943
957
  <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>
958
+ <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
959
  <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
960
  </div>
947
961
  <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 +975,13 @@
961
975
  copy.dataset.copied = '';
962
976
  wait = setTimeout(restore, 1500);
963
977
  });
978
+ // Wrap lines keeps its name; aria-pressed carries the state.
979
+ const wrap = detail.querySelector('.wrap-toggle');
980
+ wrap.addEventListener('click', () => {
981
+ const on = wrap.getAttribute('aria-pressed') !== 'true';
982
+ wrap.setAttribute('aria-pressed', String(on));
983
+ wrap.closest('.code').toggleAttribute('data-wrap', on);
984
+ });
964
985
  };
965
986
 
966
987
  // The list is one Tab stop: only the selected row is tabbable (roving tabindex), and focus selects.
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.38",
4
4
  "description": "Filip's design language, tokens, and component catalogue for any framework",
5
5
  "type": "module",
6
6
  "sideEffects": [