@filipgutica/design-system 1.0.21 → 1.0.22

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.
@@ -159,6 +159,7 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
159
159
  [`components.md`](components.md) specifies each component and [`components.html`](components.html) shows its states. These composition rules apply across them:
160
160
 
161
161
  - Build each control from the owning library's component or class, and style a link that acts as a button with the button's classes. A page adds layout only: size, spacing, and position. A local copy of a control drifts from the library, even when it uses the same tokens.
162
+ - A page's own element rules, such as its heading, paragraph, and image type, go in `@layer base`, so a component's rules outrank them. An unlayered `h2` rule outranks every layered rule and restyles the title of a dialog, drawer, or viewer as a page heading.
162
163
  - One clearly primary action per visible decision group, filled with the hue. Other actions are secondary, ghost, or text buttons.
163
164
  - Use a segmented control for two to five short options that apply at once, a select for longer lists, and radio cards for options that need descriptions.
164
165
  - Callouts carry a real caveat, not decorative emphasis.
@@ -166,7 +167,7 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
166
167
  - Figures: number them when the prose refers to any of them, and then number them all. Place a figure beside the paragraph that explains it, once the terms it uses have been introduced.
167
168
  - Source code sits in a theme-matched panel with syntax colours, inset in the code block's frame; multiline samples may have a small descriptive header and Copy action. Put useful setup context above a command; omit repeated language labels.
168
169
  - Examples: show a live component on a stage above its code, in one frame, with Copy in the code's corner. The stage sits on the page background. See [code block with a live example](components.md#with-a-live-example).
169
- - A screenshot opens at full size when clicked; use a native accessible trigger and restore its focus on close.
170
+ - A screenshot opens at full size in a [viewer](components.md#viewer) when clicked; use a native accessible trigger and restore its focus on close.
170
171
 
171
172
  ### Navigation
172
173
 
@@ -545,9 +545,14 @@
545
545
  /* Without JavaScript each capture keeps its heading, and panels after the first take a rule. */
546
546
  .capture .tabs-heading { margin: 0; padding: var(--space-3) var(--space-4); font-family: var(--font-mono); font-size: var(--text-sm); }
547
547
  .capture:not([data-enhanced]) .tabpanel + .tabpanel { border-top: 1px solid var(--color-border-subtle); }
548
- dialog.capture-viewer { width: min(960px, calc(100% - var(--space-8))); }
549
- .capture-viewer .dialog-head h4 { font-family: var(--font-mono); }
550
- .capture-viewer .dialog-body { padding: 0; }
548
+ /* A viewer is as wide and tall as its content allows, and its body scrolls both ways. */
549
+ dialog.viewer { width: fit-content; max-width: calc(100% - var(--space-8)); max-height: calc(100dvh - var(--space-8)); }
550
+ .viewer .dialog-head { align-items: center; }
551
+ .viewer .dialog-body { overscroll-behavior: contain; }
552
+ /* Inset: the dialog clips the body's edges. */
553
+ .viewer .dialog-body:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
554
+ /* The plate grows with its text, so the body scrolls the dark background with it. */
555
+ .viewer .screen { width: max-content; min-width: 100%; overflow: visible; }
551
556
  /* The full-size viewer clones the screen outside .capture, so it carries its own plate focus. */
552
557
  .screen { --color-focus: var(--color-project-dark); margin: 0; padding: var(--space-4); overflow-x: auto; background: var(--color-terminal); color: var(--color-terminal-text); font-size: var(--text-code); line-height: 1.5; }
553
558
  /* Inset: the capture and the viewer body clip the screen's edges. */
@@ -809,6 +814,7 @@
809
814
  @media (max-width: 640px) {
810
815
  /* Phones: a dialog becomes a bottom sheet with rounded top corners. */
811
816
  dialog.dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
817
+ dialog.viewer { max-height: calc(100dvh - var(--space-4)); }
812
818
  /* A trail of three or more crumbs shows only the parent, as a back link; a two-crumb trail fits in full. */
813
819
  .crumbs ol:has(> li:nth-child(3)) > li:not(:nth-last-child(2)) { display: none; }
814
820
  .crumbs ol:has(> li:nth-child(3)) > li::before { content: none; }
@@ -1528,9 +1534,9 @@
1528
1534
  <div class="dialog-body">API p95 latency stops alerting at once. Escape closes this dialog and returns focus to its trigger.</div>
1529
1535
  <form class="dialog-foot" method="dialog"><button class="btn secondary" type="submit">Cancel</button><button class="btn danger" type="submit">Delete</button></form>
1530
1536
  </dialog>
1531
- <dialog class="dialog capture-viewer" id="capture-viewer" aria-labelledby="capture-viewer-title">
1537
+ <dialog class="dialog viewer" id="capture-viewer" aria-labelledby="capture-viewer-title">
1532
1538
  <div class="dialog-head"><h4 id="capture-viewer-title">Capture</h4><form method="dialog"><button class="quiet-action close" type="submit" aria-label="Close full size capture"><svg class="icon" aria-hidden="true"><use href="#i-close"/></svg></button></form></div>
1533
- <div class="dialog-body" id="capture-viewer-body"></div>
1539
+ <div class="dialog-body" id="capture-viewer-body" tabindex="0" role="region" aria-labelledby="capture-viewer-title"></div>
1534
1540
  </dialog>
1535
1541
  <dialog class="drawer" id="live-drawer" aria-labelledby="live-drawer-title">
1536
1542
  <div class="drawer-head"><h4 id="live-drawer-title">Contents</h4><form method="dialog"><button class="quiet-action close" type="submit" aria-label="Close drawer"><svg class="icon" aria-hidden="true"><use href="#i-close"/></svg></button></form></div>
@@ -1708,9 +1714,10 @@
1708
1714
  document.querySelectorAll('[data-full-size]').forEach((button) => button.addEventListener('click', () => {
1709
1715
  const panel = button.closest('.capture').querySelector('.tabpanel:not([hidden])');
1710
1716
  const name = panel.querySelector('.tabs-heading').textContent;
1711
- document.getElementById('capture-viewer-title').textContent = `${name} capture, full size`;
1717
+ document.getElementById('capture-viewer-title').textContent = `${name} capture`;
1718
+ // The viewer's body is the scroll region, so the copy drops the screen's own.
1712
1719
  const screen = panel.querySelector('.screen').cloneNode(true);
1713
- screen.setAttribute('aria-label', `${name} capture, full size`);
1720
+ ['tabindex', 'role', 'aria-label'].forEach((name) => screen.removeAttribute(name));
1714
1721
  document.getElementById('capture-viewer-body').replaceChildren(screen, panel.querySelector('.capture-caption').cloneNode(true));
1715
1722
  button.focus({ preventScroll: true });
1716
1723
  viewer.showModal();
@@ -283,6 +283,17 @@ Layer: Core.
283
283
  - **Motion.** None: it opens and closes at once. Only the drawer slides, because it enters from an edge.
284
284
  - **Forced colors.** The shadow drops and the transparent border draws as the system edge, so the dialog keeps its outline over the page.
285
285
 
286
+ ### Viewer
287
+
288
+ - **Anatomy.** A dialog that shows one screenshot, terminal capture, or figure at full size. It is a named exception to the dialog's task rule: the reader opened it to look, so it has no footer, and its header's close button, Escape, and the backdrop close it. The header holds only the title, in the dialog's 18px semibold `--font-ui` type, centred on the close button. The body is one scroll region with `--space-4` padding. The viewer is as wide as its content, up to the viewport minus `--space-8`, and as tall, up to the dynamic viewport height (`dvh`) minus `--space-8`.
289
+ - **Size.** Full size is the content's own CSS size, such as a 2x screenshot at half its pixel width. The content scales down to fit the body's width only while it keeps at least 70% of that size; below 70% its text is too small to read, so it stays at full size and the body scrolls in both directions. A terminal capture follows the same 70% rule in its panel.
290
+ - **Title.** The short name of what it shows, such as "Ticket screenshot" or "Build capture", not the image's alt text. The alt text stays on the image.
291
+ - **Do.** Open every screenshot, capture, or figure that the page shows smaller than its full size in a viewer, from a native button or link, so all of them open the same way.
292
+ - **Don't.** A footer with a Close button, a long alt text as the title, or a phone viewer that shrinks a screenshot to the screen's width so that its text cannot be read.
293
+ - **Keyboard and screen reader.** As for the dialog. The scroll region is focusable and named by the title, so the arrow keys scroll it; its focus ring is inset, because the body clips it. Focus returns to the trigger on close.
294
+ - **Phones.** At `max-width: 640px` it is the dialog's bottom sheet at full width, up to the dynamic viewport height minus `--space-4`. The scroll region contains its overscroll, so a pan that reaches the edge does not scroll the page behind.
295
+ - **Motion.** None: as for the dialog.
296
+
286
297
  ## Drawer
287
298
 
288
299
  Layer: Core.
@@ -454,11 +465,11 @@ Layer: Identity.
454
465
 
455
466
  Layer: Identity.
456
467
 
457
- - **Anatomy.** A panel whose header holds mono tabs (one for each capture) and a Full size [quiet action](#quiet-action) at the end. The screen is the neutral `--color-terminal` plate, and a mono status-line caption sits below it on `--color-terminal-caption` with `--color-terminal-caption-text`. Full size opens the capture in a dialog.
468
+ - **Anatomy.** A panel whose header holds mono tabs (one for each capture) and a Full size [quiet action](#quiet-action) at the end. The screen is the neutral `--color-terminal` plate, and a mono status-line caption sits below it on `--color-terminal-caption` with `--color-terminal-caption-text`. Full size opens the capture in a [viewer](#viewer).
458
469
  - **States.** Tabs take the tab states in the capture's palette, and Full size takes the quiet action states.
459
470
  - **Do.** Use it to show what a command prints, one tab per capture, with the path and branch in the status line.
460
471
  - **Don't.** A capture for a screenshot of a graphical app. Use a figure.
461
- - **Keyboard and screen reader.** Tabs follow the tabs spec. Full size opens the selected capture in a modal dialog named after it, and focus returns to the button when the dialog closes. Without JavaScript the button is hidden. Focus rings are inset, because the panel clips its content. Without JavaScript, every capture is listed under its own heading.
472
+ - **Keyboard and screen reader.** Tabs follow the tabs spec. Full size opens the selected capture in a [viewer](#viewer) named after it, and focus returns to the button when the viewer closes. Without JavaScript the button is hidden. Focus rings are inset, because the panel clips its content. Without JavaScript, every capture is listed under its own heading.
462
473
  - **Header.** The whole panel, header included, is the `--color-terminal` plate in both page appearances, with a 1px `--color-terminal-border` edge. It scopes its own palette so the tabs read on it: current fill `--color-project-dark` at 20% over transparent, with a `--shadow-nav-current-dark` lift, hover `--color-terminal-text` at 4%, selected text, accent, and focus `--color-project-dark`, text `--color-terminal-text`, muted text `--color-terminal-caption-text`, and dividers `--color-terminal-border`. The tab list keeps its 4px block padding, and the Full size control stays centred on the tab row.
463
474
  - **Motion.** Tabs glide as in the tabs spec; the panel has no motion of its own.
464
475
  - **Forced colors.** The plate and the caption drop to the system background and text, the edge draws in the system colour, and the tabs follow the tabs rule.
@@ -44,6 +44,8 @@ Each entry records a choice this language made, the options it rejected, and why
44
44
  | Specimen captions | Core | Every catalogue specimen has a caption that names its state, such as "Disabled" or "Rest, live". The owner chose it at Gate M. | Captions only on some specimens: a disabled or static specimen with no caption could read as broken. | every specimen captioned: `tests/catalogue/catalogue.spec.ts` "every specimen has a caption" |
45
45
  | Focus ring | Core | One accent ring for every role but fields: `outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset)` (2px, 3px), with no glow, over the control's own shadow. Variants recolour it with `outline-color` only. `--color-focus` is `--color-accent`: 6.26:1 on the page, 5.72:1 on a surface, and 6.61:1 on a raised surface in light; 8.31:1, 7.85:1, and 7.39:1 in dark. Commands use the normal code block ring: the accent on `--color-code` (5.72:1 in light and 7.85:1 in dark). Terminal captures use `--color-project-dark`: 8.53:1 on the terminal plate. Inspired by Astryx `focusDefaults` (`utils/focusOutline.stylex.ts`), which writes the width, accent colour, and offset once from tokens. The user chose it from rendered demos and accepted an accent ring around primary, danger, and selected controls. | The neutral ink ring (`--color-focus: var(--color-text)`, offset 2px), the previous choice; the user preferred the accent ring with a 3px gap in rendered demos. Before that, an accent ring on controls and a `--color-link` ring on links, tabs, and navigation rows: two ring hues, cyan around the purple selected tab and current row. A ring in each control's own tone, such as `--color-error` around the danger button: every role needs its own ring rule, and the ring changes colour from control to control. A 2px ring with a 6px accent halo felt jarring, and a 1.5px ring was hard to see; Chromium drew it 1px at 1x. | one accent ring: `tests/design-foundations.test.mjs` "every focus ring is the one accent ring: no per-role ring colour or hand-written ring on any page or in tokens.css"; ring contrast: `tests/design-foundations.test.mjs` "the accent focus ring reaches 3:1 on --color-bg, --color-surface, and --color-surface-raised in both themes" |
46
46
  | Page colours outside the base layer | Core | `tokens.css` sets the body background and text colour unlayered; the rest of the base stays in `@layer base`, so component rules still outrank it. | Everything in the layer: a host that wraps the page in its own unlayered reset, such as an artifact viewer, kept its light body while the tokens switched to dark, so token-coloured text sat near-white on white. A note telling each page to restate the body: every delivered page would need to remember it, and the failure only shows in dark mode. | unlayered page colours: `tests/design-foundations.test.mjs` "keeps the page background and text colour outside the base layer, so a host reset cannot win" |
47
+ | Page element rules in the base layer | Core | A page's own element rules, such as its heading and paragraph type, go in `@layer base`, so every component's rules outrank them. | Unlayered page element rules: an unlayered rule outranks every layered rule whatever its specificity, so a page's mono display `h2` turned the title of a dialog and a drawer into a page heading, and each site patched each title back. | No test yet |
48
+ | Full-size viewer | Core | One viewer for screenshots, terminal captures, and figures: a dialog with no footer, titled with the short name of what it shows, as wide and tall as its content up to the viewport, whose body scrolls both ways. Content fits the width only while it keeps 70% of its full size; below that it stays at full size and scrolls. On phones it is the bottom sheet, up to the dynamic viewport height. | A screenshot fitted to the phone's width: at 390px a 1280px screenshot shrinks to 28%, and its text cannot be read. The image's alt text as the title: four lines of heading above a small image. A Close button in a footer: the header close, Escape, and the backdrop already close it, and the footer took height from the image. A viewer per site: each site sized and titled it differently. | capture viewer: `tests/catalogue/catalogue.spec.ts` "the viewer names the capture, fits the viewport"; 70% rule: no test yet |
47
49
  | Field focus | Core | No ring. The 1px edge turns `--color-accent` with a 2px inset line of the accent at 18% (`--shadow-field-focus`; `--shadow-field-focus-invalid` for an invalid field), and the fill does not change in either theme. An invalid field keeps `--color-error` for the edge and the line. Forced colors drop the line, so a focused field there draws a `Highlight` outline 1px inside its edge. Inspired by Astryx `Field/inputStyles.stylex.ts`: a full accent border with an inset muted-accent line, and `Highlight` in forced colors. The user approved it from rendered demos. | The control ring plus a lift out of the well onto the control surface (`--field-focus`, `--color-control-thumb`, `--shadow-raise`), the previous choice, replaced by the edge the user chose from rendered demos. Before that, the lift with a 35% accent edge and no ring, which measured below 3:1 in light, and an accent edge with a halo and an underline, which felt too heavy. | edge contrast of focused inputs (valid and invalid), selects, textareas, and search fields, light and dark: `tests/catalogue/catalogue.spec.ts` "contrast: every focused field edge, on its fill and on the surface around it reaches 3:1"; inset line and forced colors: no test yet |
48
50
  | Selected tab | Core | The navigation row's lifted fill (`--color-nav-current`, `--shadow-nav-current`, accent text, 6px corners), with no underline. Navigation and tabs share one selected state. | A 2px accent underline curved at rounded corners and did not match navigation. | rule present: `tests/design-foundations.test.mjs` "every state rule the guard requires exists in the catalogue"; 6px corners: `tests/catalogue/catalogue.spec.ts` "each component renders the corner radius of its role, and no other part has one"; fill recipe: no test yet |
49
51
  | Selected text | Core | The first of accent, body text, black, and white that reaches 4.5:1 over the rendered current-row fill, on the page and on a surface (`--color-nav-current-text`). | Accent text everywhere: the accent is validated only at 3:1, so some hues miss 4.5:1 as text on the fill. | accent text at 4.5:1: `tests/design-foundations.test.mjs` "accent text on the selected fill reaches 4.5:1 on every surface in both themes"; fallback order: no test yet |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/design-system",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Filip's design language, tokens, and component catalogue for any framework",
5
5
  "type": "module",
6
6
  "sideEffects": [