@filipgutica/design-system 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/language/DESIGN.md +46 -4
- package/language/components.html +800 -221
- package/language/components.md +132 -51
- package/language/decisions.md +20 -3
- package/language/docs.html +9 -6
- package/language/reference.html +16 -15
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Filip's design language for any framework: the spec, the tokens, the component c
|
|
|
15
15
|
| `scripts/build-tokens.mjs` | The token generator: writes `language/tokens.css` and `dist/` |
|
|
16
16
|
| `dist/` | Generated token files for the class flavour, theme overrides, JSON, and JavaScript |
|
|
17
17
|
| `fonts/` | IBM Plex latin `woff2` files, `fonts.css`, and their OFL licences |
|
|
18
|
-
| `tests/` | Guard tests for the payload and the tokens,
|
|
18
|
+
| `tests/` | Guard tests for the payload and the tokens, the React smoke test, and the catalogue's behaviour tests |
|
|
19
19
|
|
|
20
20
|
To change a value, edit the JSON and run `pnpm tokens:build`. `pnpm tokens:check` fails when a generated file is stale.
|
|
21
21
|
|
|
@@ -45,7 +45,7 @@ pnpm install --frozen-lockfile
|
|
|
45
45
|
pnpm verify
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
`pnpm verify` checks the generated files, runs the tests
|
|
48
|
+
`pnpm verify` checks the generated files, runs the tests, the React smoke test, and the catalogue tests (Find, shortcuts, location, drawer, overflow, and axe), then `pnpm pack --dry-run` and `publint`. The browser tests need Chromium: `pnpm exec playwright install chromium`.
|
|
49
49
|
|
|
50
50
|
## Release
|
|
51
51
|
|
package/language/DESIGN.md
CHANGED
|
@@ -87,7 +87,7 @@ Controls use quiet depth and familiar shapes: borderless surfaces with one tight
|
|
|
87
87
|
- Use neutral `--color-bg`, `--color-surface`, and `--color-surface-raised` (paper in light, graphite in dark) to separate regions. Use `--color-text` and `--color-muted` for the main hierarchy.
|
|
88
88
|
- Each project sets one hue, and `--color-accent` follows it. The hue fills the one primary action in each decision group, and marks identity and selection: current items, the selected tab's text, and checked or selected controls. It is never a fill for secondary buttons, cards, or wells. Check it at 3:1 for marks and bars, and at 4.5:1 wherever it colours text, on every surface it sits on. `--color-accent-text` on an `--color-accent` fill must reach 4.5:1 for each hue; a hue that misses does not colour text or carry a label there.
|
|
89
89
|
- `--color-link` identifies links; underline prose links. `--color-focus` is the accent (`--color-accent`) and outlines keyboard focus on every role but fields, which turn their edge the accent instead (see [focus](components.md#rules-for-every-control)). Where color marks a checked or selected state, use `--color-accent` as a fill, tint, or mark; `--color-link` never marks one, and a focus ring marks only focus, never selection.
|
|
90
|
-
- Navigation and selection: the current page, the selected tab, and a selected list row take the same quiet lifted fill, tinted with the accent, with accent text where it reaches 4.5:1 on that fill (another readable colour otherwise), and no underline or bar
|
|
90
|
+
- Navigation and selection: the current page, the selected tab, and a selected list row take the same quiet lifted fill, tinted with the accent, with accent text where it reaches 4.5:1 on that fill (another readable colour otherwise), and no underline or bar. An in-page location takes a short accent pip without a fill in strips and contents lists; in a section rail it takes the current page's fill instead. Keep raised-control hover and keyboard focus separate from these states. [Component specs](components.md#navigation-list) give the values.
|
|
91
91
|
- Status colors mean state and have a text or icon label. Status surfaces are soft tints of their status color (the `--color-*-surface` tokens). Outside badges, the danger button label, and field error text, status foreground colors go on icons; numbers and labels beside them stay in `--color-text` or `--color-muted`. Keep restrained syntax colors separate from the action palette.
|
|
92
92
|
- Verify light and dark appearance where supported, regardless of whether a switch is visible. Check text contrast rather than assuming a muted token is accessible at every size.
|
|
93
93
|
|
|
@@ -105,7 +105,7 @@ Controls use quiet depth and familiar shapes: borderless surfaces with one tight
|
|
|
105
105
|
| Phone | `@media (max-width: 640px)` | Side gutters drop from `--space-6` to `--space-4`, and section gaps take their phone step. |
|
|
106
106
|
|
|
107
107
|
Use `@media (min-width: 801px)` only for a rule that applies to desktop alone. One documented exception: the tool-home hero (`.fg-site-hero` in `@filipgutica/ui`) splits at `@media (min-width: 1024px)`, with the title across the top, the lede on the left, and the install block and facts on the right. Below 1024px it stacks in source order. `@filipgutica/ui` also ships 680px rules for its own site header, prose title and definitions (`max-width: 680px`, with `min-width: 681px` for frame padding); they belong to the library, so pages add no viewport breakpoint beyond the table and the hero split. A pane that must collapse at its own width uses a container query, as the detail column in `reference.html` does.
|
|
108
|
-
- Navigation
|
|
108
|
+
- [Navigation](#navigation) is a strip of 6 links or fewer, or a section rail that moves into a drawer at tablet width. A sticky side rail taller than the window scrolls its link list, not the element that draws its divider, so an overlay scrollbar sits clear of the line; `UiSiteNav` does this. Keep wide code, tables, and charts scrolling inside their containers.
|
|
109
109
|
- Keep main headings, actions, and product evidence visible on load. Scrolling should reveal more content without being required to make existing content appear.
|
|
110
110
|
|
|
111
111
|
### Surfaces
|
|
@@ -123,7 +123,7 @@ Controls use quiet depth and familiar shapes: borderless surfaces with one tight
|
|
|
123
123
|
| Floating layer | Menus, popovers, pickers, and dialogs | `--color-surface-raised` | Transparent 1px; the shadow's ring draws the edge | `--radius-panel` | `--shadow-dialog` |
|
|
124
124
|
|
|
125
125
|
- Borders stay 1px and transparent on buttons, quiet actions, tracks, panels, and radio cards, so forced colors can draw them. Fields keep `--color-field-edge`. `--color-border` keeps unchecked checkbox and radio edges visible. The toggle card is a named exception: a visible `--color-border-subtle` edge and no rest raise. Invalid fields show a `--color-error` edge, except in forced colors, where the system edge wins. Figures, example frames, and dividers use `--color-border-subtle`.
|
|
126
|
-
- Radii: `--radius-inline` for inline elements and
|
|
126
|
+
- Radii: `--radius-inline` for inline elements, checkboxes, navigation rows, list-selection rows, and tabs; `--radius-field` for fields, toggle cards, and pager links; `--radius-control` (a pill) for buttons and segmented controls; `--radius-panel` for wells, example frames, plates, panels, radio cards, alerts, and floating layers; `--radius-pill` for badges and switch tracks. Navigation rows inside a floating menu, such as the project menu, keep `--radius-inline`; option rows in a select picker take the panel radius minus `--space-1`.
|
|
127
127
|
- Avoid nesting panels. Cards are for a few parallel self-contained options that a reader compares. Running prose belongs in open sections. Product screenshots need one frame, not a frame around a frame.
|
|
128
128
|
- [Depth](#depth) gives each role its shadow. Stable hover states keep normal content quiet.
|
|
129
129
|
|
|
@@ -156,11 +156,53 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
|
|
|
156
156
|
- 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).
|
|
157
157
|
- A screenshot opens at full size when clicked; use a native accessible trigger and restore its focus on close.
|
|
158
158
|
|
|
159
|
+
### Navigation
|
|
160
|
+
|
|
161
|
+
[`components.md`](components.md) specifies each navigation component. These rules decide which one a page uses and how they agree.
|
|
162
|
+
|
|
163
|
+
- **Levels.** Each level has one component and one marker.
|
|
164
|
+
|
|
165
|
+
| Level | Answers | Component | Marker |
|
|
166
|
+
| --- | --- | --- | --- |
|
|
167
|
+
| Global | Which site? | Site header and project switcher | `aria-current="page"` on the registry row |
|
|
168
|
+
| Local | Which page of this site? | Section rail, or a navigation strip of 6 links or fewer | `aria-current="page"`: the lifted fill |
|
|
169
|
+
| In-page | Where am I on this page? | Section rail rows that point to `#id` | `aria-current="location"`: the lifted fill in a rail, a pip in strips and contents lists |
|
|
170
|
+
| Sequential | What comes next? | Pager | `rel="prev"` and `rel="next"` |
|
|
171
|
+
| Path | How do I get back up? | Breadcrumbs, only at depth 3 or more, or for a page outside its site's shell | The current page as text with `aria-current="page"` |
|
|
172
|
+
| Find | Where is X? | Find field that filters the rail | A live match count |
|
|
173
|
+
|
|
174
|
+
- **`aria-current`.**
|
|
175
|
+
- `page` goes on the link whose path matches the URL, ignoring the hash, and on one link in each landmark at most.
|
|
176
|
+
- `location` goes on the in-page link for the section in view.
|
|
177
|
+
- A link carries one marker, and page outranks location. Never put `page` on a link to `#id`.
|
|
178
|
+
- Use `step` for wizards and `true` for other sets.
|
|
179
|
+
- **Choosing a component.**
|
|
180
|
+
- A link (a navigation row or a strip) when the destination has its own URL.
|
|
181
|
+
- Tabs for panels about one object when no URL changes.
|
|
182
|
+
- A segmented control when the choice changes how the same content shows.
|
|
183
|
+
- Never mix URL-changing items and panel items in one set, and never give links `role="tab"`.
|
|
184
|
+
- **Landmarks.**
|
|
185
|
+
- Give every `<nav>` a unique name, and leave "navigation" out of it, because screen readers add that word.
|
|
186
|
+
- Order: skip link, banner (the header), local navigation, `main`, contentinfo. Focus follows that order. At tablet width the Find and Menu buttons come before `main`.
|
|
187
|
+
- **Scroll offset.**
|
|
188
|
+
- One offset: `html { scroll-padding-top }`, equal to any sticky bar plus `--space-4`. Sections do not set `scroll-margin-top`.
|
|
189
|
+
- Use `scroll-behavior: smooth` only under `prefers-reduced-motion: no-preference`.
|
|
190
|
+
- **Location tracking.**
|
|
191
|
+
- The current section is the last tracked heading, in page order, whose top has passed the scroll-padding inset. At the bottom of the page, the last tracked heading is current.
|
|
192
|
+
- After a jump (a click, a hash change, or a deep link), the target stays current until the reader scrolls away from where it landed.
|
|
193
|
+
- A group heading counts as its group's first row.
|
|
194
|
+
- **Single-key shortcuts.**
|
|
195
|
+
- Allowed only with an off switch, saved in storage and wrapped in `try`/`catch` (WCAG 2.1.4).
|
|
196
|
+
- Ignored while focus is in an editable element or a modal dialog is open.
|
|
197
|
+
- Shown with a visible [keyboard key](components.md#keyboard-key) hint and `aria-keyshortcuts`.
|
|
198
|
+
- The only shortcut is `/`, which focuses Find.
|
|
199
|
+
- **No command palette.** Find covers a single-page catalogue and a small site; see [decisions](decisions.md).
|
|
200
|
+
|
|
159
201
|
### Interaction and motion
|
|
160
202
|
|
|
161
203
|
- Show visible focus and accessible names. A visual simplification must preserve useful controls, caveats, and keyboard paths.
|
|
162
204
|
- Every focusable element but a field draws one ring, `outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset)`, with no glow, over its own raise or sink shadow. The `tokens.css` base sets it. `--color-focus` is the accent, which reaches 3:1 on `--color-bg`, `--color-surface`, and `--color-surface-raised` in both themes; a dark plate sets `--color-focus: var(--color-project-dark)`. Do not give a role its own ring colour. Fields (input, select, textarea, search) draw no ring: focus turns the edge `--color-accent` with a 2px inset line (`--shadow-field-focus`), and the fill stays. [Component specs](components.md#rules-for-every-control) give the values. Use an inset offset (`calc(var(--focus-width) * -1)`) only where a scrolling or clipping parent would cut the ring, or inside a segmented control; add a comment that names the reason. Keep the focus default in `@layer base`, so a component's own focus rule can refine it. Pointer hover never draws the outline.
|
|
163
|
-
- Keep product navigation distinct from in-page section links. Current
|
|
205
|
+
- Keep product navigation distinct from in-page section links. Current page and current section are different markers (`aria-current="page"` and `"location"`); see [Navigation](#navigation). Open sibling project links in the same tab; indicate a new tab only when the link opens one.
|
|
164
206
|
- Use `--duration-fast` for hover/press and `--duration` for menus/panels. Animate opacity or transform only where it explains a state change. A component spec may set its own timing, as the segmented control's glide does.
|
|
165
207
|
- Keep content visible without reveal effects, entrance sequences, or continuous decorative animation. Honor reduced motion, including anchor scrolling.
|
|
166
208
|
- An interactive figure first renders as complete static content, so it reads the same without JavaScript; enhancement adds controls, not information. Give each state a text label and announce live results politely. A lesson needs one interactive figure at most; keep the rest static.
|