@filipgutica/design-system 1.0.3 → 1.0.5
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/language/DESIGN.md +5 -4
- package/language/components.html +91 -42
- package/language/components.md +15 -9
- package/language/decisions.md +2 -1
- package/language/docs.html +5 -3
- package/language/product.html +2 -1
- package/language/reference.html +63 -29
- package/package.json +1 -1
package/language/DESIGN.md
CHANGED
|
@@ -117,13 +117,14 @@ Controls use quiet depth and familiar shapes: borderless surfaces with one tight
|
|
|
117
117
|
| Role | Use for | Fill | Border | Radius | Shadow |
|
|
118
118
|
| --- | --- | --- | --- | --- | --- |
|
|
119
119
|
| Page | The canvas and example stages | `--color-bg` | None | None | None |
|
|
120
|
-
| Well |
|
|
120
|
+
| Well | Screenshots, figures, and inset previews other than example stages | `--color-surface` | `--color-border-subtle` | `--radius-panel` | None |
|
|
121
|
+
| Code block | Source code: a frame that holds the header, with the source in an inset panel | Frame: `--color-surface-raised`; panel: `--color-code` | Frame: `--color-border-subtle`; panel: transparent 1px | Frame: `--radius-panel`; panel: `calc(var(--radius-panel) - var(--space-1))` | Frame: `--shadow-surface`; panel: none |
|
|
121
122
|
| Panel | Cards, forms, charts, and detail views | `--color-surface-raised` | Transparent 1px | `--radius-panel` | `--shadow-surface` |
|
|
122
123
|
| Field | Inputs, selects, textareas, and search fields | `--color-field-bg`; disabled: `--color-well` | `--color-field-edge` | `--radius-field` | `--shadow-field`; disabled: none |
|
|
123
124
|
| Track | Segmented and switch tracks, and selected radio cards | `--color-well` | Transparent 1px | Segmented tracks: `--radius-control`; switch tracks: `--radius-pill`; radio cards: `--radius-panel` | `--shadow-sink` |
|
|
124
125
|
| Floating layer | Menus, popovers, pickers, and dialogs | `--color-surface-raised` | Transparent 1px; the shadow's ring draws the edge | `--radius-panel` | `--shadow-dialog` |
|
|
125
126
|
|
|
126
|
-
- 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`.
|
|
127
|
+
- 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, code block frames, and dividers use `--color-border-subtle`.
|
|
127
128
|
- Shape follows role. A pill acts, or sets a value in place; a rectangle is a place, or holds content. Pick a new component's radius from its role in this table, not from the component it looks like.
|
|
128
129
|
|
|
129
130
|
| Role | Shape | Token | Members |
|
|
@@ -135,7 +136,7 @@ Controls use quiet depth and familiar shapes: borderless surfaces with one tight
|
|
|
135
136
|
| Holds other things | 16px | `--radius-panel` | Wells, plates, panels, cards, radio cards, alerts, code blocks, example frames, and floating layers |
|
|
136
137
|
|
|
137
138
|
- A pill never holds text that can wrap. A control whose label can wrap, such as a toggle card or a radio card, is a rectangle.
|
|
138
|
-
- Nested rectangles are concentric: a rectangle that sits closer to a rounded container's edge than the container's radius takes that radius minus the gap. Option rows in a select picker
|
|
139
|
+
- Nested rectangles are concentric: a rectangle that sits closer to a rounded container's edge than the container's radius takes that radius minus the gap. Option rows in a select picker, the rows of a floating menu, such as the project menu, and a code block's source panel, each `--space-1` inside a 16px container, take `calc(var(--radius-panel) - var(--space-1))`, 12px. A shape with more room than that, such as a field in a dialog, keeps the radius of its role.
|
|
139
140
|
- Round marks (radios, slider thumbs, badge dots, and the busy spinner) take `50%`, a fill inside a shape inherits its corners, and an edge that meets another shape takes `0`. A page writes no other literal radius.
|
|
140
141
|
- 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.
|
|
141
142
|
- [Depth](#depth) gives each role its shadow. Stable hover states keep normal content quiet.
|
|
@@ -165,7 +166,7 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
|
|
|
165
166
|
- Callouts carry a real caveat, not decorative emphasis.
|
|
166
167
|
- Lists and properties: align short labels, values, and metadata. Use definition lists for terms and short meanings; use tables for actual comparisons.
|
|
167
168
|
- 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.
|
|
168
|
-
- Source code sits in a theme-matched
|
|
169
|
+
- 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.
|
|
169
170
|
- 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).
|
|
170
171
|
- A screenshot opens at full size when clicked; use a native accessible trigger and restore its focus on close.
|
|
171
172
|
|
package/language/components.html
CHANGED
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
* stand in for :hover, :active, and :focus-visible, and ARIA or native attributes
|
|
15
15
|
* (aria-pressed, aria-checked, checked, disabled, aria-invalid, aria-busy) set the rest.
|
|
16
16
|
* Pinned specimens sit inside an inert wrapper, so they take no focus and no input.
|
|
17
|
-
* Drop the .is-* classes when you copy a component.
|
|
17
|
+
* Drop the .is-* classes, and the rules that name them, when you copy a component.
|
|
18
|
+
*
|
|
19
|
+
* Hover: a real :hover rule sits in @media (hover: hover), so a tap on a touch screen leaves
|
|
20
|
+
* no fill behind. The .is-hover rule beside it pins the same look for the specimen.
|
|
18
21
|
*/
|
|
19
22
|
|
|
20
23
|
/* ---------- Shared recipes ---------- */
|
|
@@ -28,16 +31,21 @@
|
|
|
28
31
|
.btn { --depth: var(--shadow-raise); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-accent-text); box-shadow: var(--depth); font: var(--weight-medium) var(--text-md) / 1.25 var(--font-ui); letter-spacing: -0.01em; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
|
|
29
32
|
.btn[data-size="sm"] { min-height: var(--control-sm); padding: 0 0.625rem; font-size: var(--text-sm); }
|
|
30
33
|
.btn[data-size="lg"] { min-height: var(--control-lg); padding: 0 var(--space-4); font-size: var(--text-lg); }
|
|
31
|
-
.btn
|
|
34
|
+
.btn.is-hover:not(:disabled) { background: var(--color-button-hover); }
|
|
35
|
+
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--color-button-hover); } }
|
|
32
36
|
.btn.secondary { background: var(--color-control-thumb); color: var(--color-text); }
|
|
33
|
-
.btn.secondary
|
|
37
|
+
.btn.secondary.is-hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); }
|
|
38
|
+
@media (hover: hover) { .btn.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); } }
|
|
34
39
|
.btn.ghost { --depth: none; background: transparent; color: var(--color-muted); }
|
|
35
|
-
.btn.ghost
|
|
40
|
+
.btn.ghost.is-hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); }
|
|
41
|
+
@media (hover: hover) { .btn.ghost:hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); } }
|
|
36
42
|
/* Danger rises like the other filled variants; its text mixes the hue toward --color-text, as status badges do. */
|
|
37
43
|
.btn.danger { background: var(--color-error-surface); color: light-dark(color-mix(in srgb, var(--color-error) 75%, var(--color-text)), color-mix(in srgb, var(--color-error) 85%, var(--color-text))); }
|
|
38
|
-
.btn.danger
|
|
44
|
+
.btn.danger.is-hover:not(:disabled) { background: color-mix(in srgb, var(--color-error) 10%, var(--color-error-surface)); }
|
|
45
|
+
@media (hover: hover) { .btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--color-error) 10%, var(--color-error-surface)); } }
|
|
39
46
|
.btn.text { --depth: none; min-height: auto; padding: var(--space-1); background: transparent; color: var(--color-link); text-decoration: underline; text-underline-offset: 0.2em; }
|
|
40
|
-
.btn.text
|
|
47
|
+
.btn.text.is-hover:not(:disabled) { background: transparent; }
|
|
48
|
+
@media (hover: hover) { .btn.text:hover:not(:disabled) { background: transparent; } }
|
|
41
49
|
/* A press sinks the button 1px and changes its fill, so the click reads at a glance. */
|
|
42
50
|
.btn:not(.secondary, .ghost, .danger, .text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-button-hover); }
|
|
43
51
|
.btn:is(.secondary, .ghost):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-well); }
|
|
@@ -59,8 +67,9 @@
|
|
|
59
67
|
never a text glyph such as ×: a font draws a glyph's ink off its box centre.
|
|
60
68
|
:where keeps the base below each component's own size and layout. */
|
|
61
69
|
:where(.quiet-action) { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
62
|
-
.quiet-action
|
|
63
|
-
.quiet-action:
|
|
70
|
+
.quiet-action.is-hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
71
|
+
@media (hover: hover) { .quiet-action:hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); } }
|
|
72
|
+
.quiet-action:is(:active, .is-active):where(:not(:disabled)) { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
64
73
|
.quiet-action:disabled { opacity: 0.58; cursor: not-allowed; }
|
|
65
74
|
|
|
66
75
|
/* Fields: input, textarea, select */
|
|
@@ -89,7 +98,7 @@
|
|
|
89
98
|
.select::picker(select) { min-width: anchor-size(width); max-height: min(20rem, 50dvh); overflow: auto; margin-block: var(--space-1); padding: var(--space-1); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); font: var(--text-md) / var(--leading) var(--font-ui); }
|
|
90
99
|
.select option { min-height: var(--control-sm); padding: var(--space-2) var(--space-3); border-radius: calc(var(--radius-panel) - var(--space-1)); cursor: pointer; }
|
|
91
100
|
.select option:checked { background: var(--color-row-selected); }
|
|
92
|
-
.select option:hover:where(:not(:disabled)) { background: var(--color-row-hover); }
|
|
101
|
+
@media (hover: hover) { .select option:hover:where(:not(:disabled)) { background: var(--color-row-hover); } }
|
|
93
102
|
/* Inset: the picker scrolls. */
|
|
94
103
|
.select option:focus-visible { background: var(--color-row-hover); outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
|
|
95
104
|
.select option::checkmark { order: 1; margin-left: auto; color: var(--color-accent); }
|
|
@@ -103,7 +112,7 @@
|
|
|
103
112
|
.search input::placeholder { color: var(--color-muted); }
|
|
104
113
|
/* The native search clear button, quieted to a thin muted cross drawn with a mask. */
|
|
105
114
|
.search input::-webkit-search-cancel-button { width: 0.75rem; height: 0.75rem; margin-inline-start: var(--space-2); background: var(--color-muted); cursor: pointer; -webkit-appearance: none; appearance: none; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 2.5l7 7m0-7l-7 7' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
|
|
106
|
-
.search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); }
|
|
115
|
+
@media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); } }
|
|
107
116
|
/* A disabled field drops into the grey well (the same fill as rest in dark) and loses its shadow. background-color keeps the select chevron. */
|
|
108
117
|
:is(.input, .select, .textarea):disabled { background-color: var(--color-well); box-shadow: none; opacity: 0.58; cursor: not-allowed; }
|
|
109
118
|
/* A static drawing of the open picker; a native select cannot be pinned open. */
|
|
@@ -130,7 +139,8 @@
|
|
|
130
139
|
/* Radio card: the native radio owns selection; the label owns the card surface. */
|
|
131
140
|
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); width: min(100%, 420px); border: 0; margin: 0; padding: 0; }
|
|
132
141
|
.radio-card { --depth: var(--shadow-raise); position: relative; display: grid; gap: var(--space-1); min-width: 0; padding: var(--space-3); padding-right: var(--space-8); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); box-shadow: var(--depth); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out); }
|
|
133
|
-
.radio-card
|
|
142
|
+
.radio-card.is-hover:not(:has(input:checked, input:disabled)) { background: color-mix(in srgb, var(--color-surface-muted) 45%, var(--color-surface-raised)); }
|
|
143
|
+
@media (hover: hover) { .radio-card:hover:not(:has(input:checked, input:disabled)) { background: color-mix(in srgb, var(--color-surface-muted) 45%, var(--color-surface-raised)); } }
|
|
134
144
|
/* Depth and a check badge show the choice, without an accent ring. */
|
|
135
145
|
.radio-card:has(input:checked) { --depth: var(--shadow-sink); background: var(--color-well); }
|
|
136
146
|
.radio-card:has(input:disabled) { opacity: 0.58; cursor: not-allowed; }
|
|
@@ -158,7 +168,8 @@
|
|
|
158
168
|
.toggle { --w: 2.75rem; --h: 1.375rem; --inset: 0.125rem; --depth: none; display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-field); background: var(--color-surface-raised); color: var(--color-text); font: var(--text-md) / var(--leading-tight) var(--font-ui); text-align: left; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out); }
|
|
159
169
|
.toggle[data-size="sm"] { --w: 2.2rem; --h: 1.1rem; --inset: 0.1rem; min-height: var(--control-sm); font-size: var(--text-sm); }
|
|
160
170
|
.toggle[data-size="lg"] { --w: 3.3rem; --h: 1.65rem; --inset: 0.15rem; min-height: var(--control-lg); font-size: var(--text-lg); }
|
|
161
|
-
.toggle
|
|
171
|
+
.toggle.is-hover:not(:disabled, [aria-pressed="true"]) { border-color: var(--color-border); }
|
|
172
|
+
@media (hover: hover) { .toggle:hover:not(:disabled, [aria-pressed="true"]) { border-color: var(--color-border); } }
|
|
162
173
|
/* The switch carries the on state; the card takes a faint 8% accent tint and an accent hairline. */
|
|
163
174
|
.toggle[aria-pressed="true"] { border-color: color-mix(in srgb, var(--color-accent) 35%, transparent); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised)); }
|
|
164
175
|
.toggle:disabled { opacity: 0.58; cursor: not-allowed; }
|
|
@@ -174,8 +185,10 @@
|
|
|
174
185
|
.segmented[data-icon-only] button { width: var(--item); padding: 0; }
|
|
175
186
|
/* The thumb is inset inside each full-size button, so it floats on the track and the hit area keeps its size. */
|
|
176
187
|
.segmented button::before { content: ""; position: absolute; inset: 2px; z-index: -2; border-radius: var(--radius-control); pointer-events: none; }
|
|
177
|
-
.segmented button
|
|
178
|
-
|
|
188
|
+
.segmented button.is-hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); }
|
|
189
|
+
@media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); } }
|
|
190
|
+
.segmented button.is-hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
|
|
191
|
+
@media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); } }
|
|
179
192
|
/* The pressed label reads at 4.5:1 on its thumb, and an icon at 3:1 (--color-segmented-current-text). */
|
|
180
193
|
.segmented button[aria-pressed="true"] { color: var(--color-segmented-current-text); }
|
|
181
194
|
.segmented button[aria-pressed="true"]::before { z-index: -1; background: var(--color-control-thumb); box-shadow: var(--shadow-raise); }
|
|
@@ -235,7 +248,8 @@
|
|
|
235
248
|
.tablist[data-clip="end"] { mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
|
|
236
249
|
.tablist[data-clip="start end"] { mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
|
|
237
250
|
.tab { position: relative; flex: none; min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-medium) var(--text-md) / var(--leading) var(--font-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
238
|
-
.tab
|
|
251
|
+
.tab.is-hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
|
|
252
|
+
@media (hover: hover) { .tab:hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); } }
|
|
239
253
|
/* The selected tab takes the navigation row's lifted fill: one selected state for both. The fill is a
|
|
240
254
|
::before layer behind the label, so it can glide between tabs as the segmented thumb does. */
|
|
241
255
|
.tab[aria-selected="true"] { background: transparent; color: var(--color-nav-current-text); }
|
|
@@ -324,7 +338,8 @@
|
|
|
324
338
|
.navlist { display: grid; gap: 0.125rem; width: min(100%, 240px); }
|
|
325
339
|
.navlist .group-label { padding: 0 var(--space-3) var(--space-1); color: var(--color-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
|
|
326
340
|
.navlist a { position: relative; display: flex; align-items: center; min-height: var(--row); padding-inline: var(--space-3); border-radius: var(--radius-inline); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
|
|
327
|
-
.navlist a
|
|
341
|
+
.navlist a.is-hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
|
|
342
|
+
@media (hover: hover) { .navlist a:hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; } }
|
|
328
343
|
.navlist a[aria-current="page"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
|
|
329
344
|
.navlist a[aria-current="location"] { color: var(--color-text); font-weight: var(--weight-medium); }
|
|
330
345
|
.navlist a[aria-current="location"]::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
|
|
@@ -350,7 +365,8 @@
|
|
|
350
365
|
details.rail-details[open] > .navlist { margin-top: var(--space-2); }
|
|
351
366
|
/* A collapsible group's label is a disclosure button in the group-label type. Only rails over about 40 rows use it. */
|
|
352
367
|
.group-toggle { display: flex; align-items: center; justify-content: space-between; min-height: var(--control-sm); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-semibold) var(--text-xs) var(--font-ui); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
353
|
-
.group-toggle
|
|
368
|
+
.group-toggle.is-hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
|
|
369
|
+
@media (hover: hover) { .group-toggle:hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); } }
|
|
354
370
|
.group-toggle .icon { transition: transform var(--duration-fast) var(--ease-out); }
|
|
355
371
|
.group-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
|
|
356
372
|
/* Inset: the rail list scrolls. */
|
|
@@ -395,7 +411,8 @@
|
|
|
395
411
|
.crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
|
|
396
412
|
.crumbs li + li::before { content: "/" / ""; color: var(--color-muted); }
|
|
397
413
|
.crumbs a { display: inline-flex; align-items: center; min-height: var(--control-sm); border-radius: var(--radius-inline); color: var(--color-muted); text-decoration: none; }
|
|
398
|
-
.crumbs a
|
|
414
|
+
.crumbs a.is-hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; }
|
|
415
|
+
@media (hover: hover) { .crumbs a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; } }
|
|
399
416
|
.crumbs [aria-current="page"] { color: var(--color-text); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
|
|
400
417
|
/* Crumbs share the header row with the strip, so they centre on the cap height too. */
|
|
401
418
|
@supports (text-box: trim-both cap alphabetic) {
|
|
@@ -410,7 +427,8 @@
|
|
|
410
427
|
/* Pager: previous at the start, next always at the end. */
|
|
411
428
|
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); width: 100%; padding-top: var(--space-6); border-top: 1px solid var(--color-border-subtle); }
|
|
412
429
|
.pager a { display: grid; align-content: start; gap: 0.125rem; padding: var(--space-3) var(--space-4); border: 1px solid transparent; border-radius: var(--radius-field); color: var(--color-text); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out); }
|
|
413
|
-
.pager a
|
|
430
|
+
.pager a.is-hover { background: var(--color-row-hover); }
|
|
431
|
+
@media (hover: hover) { .pager a:hover { background: var(--color-row-hover); } }
|
|
414
432
|
.pager a[rel="next"] { grid-column: 2; justify-items: end; text-align: end; }
|
|
415
433
|
.pager-dir { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--color-muted); font-size: var(--text-xs); }
|
|
416
434
|
.pager-title { font-weight: var(--weight-medium); }
|
|
@@ -428,34 +446,42 @@
|
|
|
428
446
|
/* Dividers are straight lines inset by the row padding, so they never follow a rounded corner.
|
|
429
447
|
A filled row (hovered or selected) hides the divider above it and the one below it. */
|
|
430
448
|
.rows [role="option"] + [role="option"]::before { content: ""; position: absolute; inset: 0 var(--space-3) auto; border-top: 1px solid var(--color-border-subtle); }
|
|
431
|
-
.rows [role="option"]:is(
|
|
432
|
-
.rows [role="option"]:is(
|
|
433
|
-
.rows [role="option"]:
|
|
449
|
+
.rows [role="option"]:is(.is-hover, [aria-selected="true"])::before,
|
|
450
|
+
.rows [role="option"]:is(.is-hover, [aria-selected="true"]) + [role="option"]::before { display: none; }
|
|
451
|
+
@media (hover: hover) { .rows [role="option"]:hover::before, .rows [role="option"]:hover + [role="option"]::before { display: none; } }
|
|
452
|
+
.rows [role="option"].is-hover { background: var(--color-row-hover); }
|
|
453
|
+
@media (hover: hover) { .rows [role="option"]:hover { background: var(--color-row-hover); } }
|
|
434
454
|
/* The selected row takes the navigation row's current recipe; it comes after hover, so hover keeps the fill. */
|
|
435
455
|
.rows [role="option"][aria-selected="true"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
|
|
436
456
|
@media (forced-colors: active) { .rows [role="option"][aria-selected="true"] { border-inline-start: 2px solid Highlight; } }
|
|
437
457
|
|
|
438
|
-
/* Code block: a source
|
|
439
|
-
.code { width: 100%; max-width: var(--measure); min-width: 0; overflow: hidden; border: 1px solid
|
|
440
|
-
|
|
458
|
+
/* Code block: a frame that holds the header, with the source in an inset panel */
|
|
459
|
+
.code { width: 100%; max-width: var(--measure); min-width: 0; overflow: hidden; padding: var(--space-1); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-panel); background: var(--color-surface-raised); color: var(--color-code-text); box-shadow: var(--shadow-surface); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
460
|
+
/* The header sits on the frame, so the frame drops its top padding under one. */
|
|
461
|
+
.code:has(> .code-head) { padding-top: 0; }
|
|
462
|
+
.code-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-height: 2.5rem; padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); font-size: var(--text-xs); }
|
|
441
463
|
.code-head b { font-weight: var(--weight-semibold); }
|
|
442
464
|
.code-head .lang { color: var(--color-muted); }
|
|
443
465
|
/* Copy is a quiet action; this sets its size and place. */
|
|
444
466
|
.copy { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-width: var(--control-lg); min-height: var(--control-lg); margin-left: auto; padding: var(--space-1) 0.375rem; color: inherit; }
|
|
445
|
-
/* The code block has its own palette, so
|
|
446
|
-
.code .copy
|
|
467
|
+
/* 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. */
|
|
468
|
+
.code .copy { color: var(--color-muted); }
|
|
469
|
+
.code .copy[data-copied] { color: var(--color-code-text); }
|
|
470
|
+
.code .copy.is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
|
|
471
|
+
@media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: var(--color-code-text); } }
|
|
447
472
|
/* Inset: the code block clips its content. */
|
|
448
473
|
.code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
|
|
449
474
|
.code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
|
|
450
|
-
|
|
475
|
+
/* The source is an inset panel. It sits --space-1 inside the frame, so its corners are concentric with the frame's. */
|
|
476
|
+
.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; }
|
|
451
477
|
/* Each line is a baseline-aligned row, so a prompt or line number sits on the text's baseline. */
|
|
452
478
|
.code .line { display: flex; align-items: baseline; min-height: 1.65em; }
|
|
453
479
|
.code .line > span { white-space: pre; }
|
|
454
480
|
.code .ln { min-width: 2.5em; padding-right: 1em; flex: none; text-align: right; color: var(--color-muted); user-select: none; }
|
|
455
481
|
.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); }
|
|
456
|
-
|
|
457
|
-
.code.compact
|
|
458
|
-
.code.compact
|
|
482
|
+
/* 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. */
|
|
483
|
+
.code.compact { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-1); }
|
|
484
|
+
.code.compact pre { align-content: center; padding: var(--space-2) var(--space-3); }
|
|
459
485
|
|
|
460
486
|
/* Code block with a live example: a live stage over its source, in one frame. */
|
|
461
487
|
.example { width: 100%; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-panel); background: var(--color-bg); }
|
|
@@ -464,16 +490,17 @@
|
|
|
464
490
|
.example-stage > * { min-width: 0; }
|
|
465
491
|
/* The frame draws the edge, so the source is flat and full width, with one hairline above it.
|
|
466
492
|
Copy comes first in DOM order and is placed in the source's top right corner. */
|
|
467
|
-
.example > .code { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; max-width: none; border-width: 1px 0 0; border-
|
|
468
|
-
.example > .code > pre { grid-row: 1; grid-column: 1; }
|
|
493
|
+
.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; }
|
|
494
|
+
.example > .code > pre { grid-row: 1; grid-column: 1; border: 0; border-radius: 0; }
|
|
469
495
|
.example > .code > .copy { grid-row: 1; grid-column: 2; margin: var(--space-1); }
|
|
470
496
|
|
|
471
497
|
/* ================= Identity: terminal folio ================= */
|
|
472
498
|
|
|
473
|
-
/* Command plate: dark in both themes and tinted with the project hue. */
|
|
474
|
-
/* The plate is dark in both themes, so its focus ring takes the dark-theme accent, which reaches 3:1 on it
|
|
475
|
-
|
|
476
|
-
.code.command
|
|
499
|
+
/* Command plate: dark in both themes and tinted with the project hue. Its source panel is the plate darkened, so it reads as a panel on it. */
|
|
500
|
+
/* The plate is dark in both themes, so its focus ring takes the dark-theme accent, which reaches 3:1 on it,
|
|
501
|
+
and muted text, such as Copy at rest, takes the caption colour. */
|
|
502
|
+
.code.command { --color-code: color-mix(in srgb, var(--color-command-bg) 55%, var(--color-terminal)); --color-code-text: var(--color-terminal-text); --color-muted: var(--color-terminal-caption-text); --color-focus: var(--color-project-dark); border-color: var(--color-command-border); background: var(--color-command-bg); color: var(--color-terminal-text); }
|
|
503
|
+
.code.command .code-head { color: var(--color-terminal-caption-text); }
|
|
477
504
|
.code.command .code-head .lang { color: var(--color-terminal-caption-text); }
|
|
478
505
|
/* The prompt is drawn by CSS, so copied and spoken text omit it. */
|
|
479
506
|
.code.command .line::before { content: "$ " / ""; flex: none; white-space: pre; color: var(--color-project-dark); user-select: none; }
|
|
@@ -523,7 +550,7 @@
|
|
|
523
550
|
/* The ~/ mark is decorative: the empty alternative text keeps it out of the name. */
|
|
524
551
|
.projects > summary::before { content: "~/" / ""; color: var(--color-project); }
|
|
525
552
|
/* The open menu keeps the hover tint. :where keeps it below the quiet action's press. */
|
|
526
|
-
:where(.projects[open]) > summary { background: color-mix(in srgb, currentColor
|
|
553
|
+
:where(.projects[open]) > summary { background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
527
554
|
.projects .icon { transition: transform var(--duration-fast) var(--ease-out); }
|
|
528
555
|
.projects[open] .icon { transform: rotate(180deg); }
|
|
529
556
|
.projects .navlist { position: absolute; z-index: 3; top: 100%; left: 0; min-width: 224px; margin-top: var(--space-1); padding: var(--space-1); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); box-shadow: var(--shadow-dialog); }
|
|
@@ -592,7 +619,8 @@
|
|
|
592
619
|
.tab[aria-selected="true"]::before { content: none; }
|
|
593
620
|
.check input:checked { forced-color-adjust: none; border-color: Highlight; background: Highlight; }
|
|
594
621
|
/* The masked search cross would lose its fill, so it opts out and takes the system text colour. */
|
|
595
|
-
.search input::-webkit-search-cancel-button
|
|
622
|
+
.search input::-webkit-search-cancel-button { forced-color-adjust: none; background: CanvasText; }
|
|
623
|
+
@media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { forced-color-adjust: none; background: CanvasText; } }
|
|
596
624
|
.check input[type="checkbox"]:checked::before { border-color: HighlightText; }
|
|
597
625
|
.check input[type="radio"]:checked { background: HighlightText; }
|
|
598
626
|
.radio-card input:checked { forced-color-adjust: none; border-color: Highlight; background: Highlight; color: HighlightText; }
|
|
@@ -776,6 +804,7 @@
|
|
|
776
804
|
<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>
|
|
777
805
|
<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>
|
|
778
806
|
<symbol id="i-check" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"/><path d="M5.8 8.2l1.5 1.5 2.9-3"/></symbol>
|
|
807
|
+
<symbol id="i-tick" viewBox="0 0 16 16"><path d="M3.5 8.5l3 3 6-7"/></symbol>
|
|
779
808
|
<symbol id="i-expand" viewBox="0 0 16 16"><path d="M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5 9 7M2.5 13.5 7 9"/></symbol>
|
|
780
809
|
<symbol id="i-list" viewBox="0 0 16 16"><path d="M5.5 4.5h8M5.5 8h8M5.5 11.5h8M2.5 4.5h.01M2.5 8h.01M2.5 11.5h.01"/></symbol>
|
|
781
810
|
<symbol id="i-grid" viewBox="0 0 16 16"><rect x="2.5" y="2.5" width="4.5" height="4.5" rx="1"/><rect x="9" y="2.5" width="4.5" height="4.5" rx="1"/><rect x="2.5" y="9" width="4.5" height="4.5" rx="1"/><rect x="9" y="9" width="4.5" height="4.5" rx="1"/></symbol>
|
|
@@ -1653,9 +1682,26 @@
|
|
|
1653
1682
|
return [...lines].map((line) => [...line.childNodes].filter((n) => !(n instanceof Element && n.classList.contains('ln'))).map((n) => n.textContent).join('')).join('\n');
|
|
1654
1683
|
};
|
|
1655
1684
|
const status = document.getElementById('copy-status');
|
|
1685
|
+
// A successful copy swaps the button's icon for a tick for 1.5s, and marks the button data-copied for the
|
|
1686
|
+
// colour. A repeat click restarts the wait, and a failure puts the icon back at once. The label and
|
|
1687
|
+
// accessible name do not change.
|
|
1688
|
+
const ticks = new WeakMap();
|
|
1689
|
+
const showCopied = (button, ok) => {
|
|
1690
|
+
const use = button.querySelector('.icon use');
|
|
1691
|
+
use.dataset.icon ??= use.getAttribute('href');
|
|
1692
|
+
const restore = () => { use.setAttribute('href', use.dataset.icon); delete button.dataset.copied; };
|
|
1693
|
+
clearTimeout(ticks.get(button));
|
|
1694
|
+
if (!ok) { restore(); return; }
|
|
1695
|
+
use.setAttribute('href', '#i-tick');
|
|
1696
|
+
button.dataset.copied = '';
|
|
1697
|
+
ticks.set(button, setTimeout(restore, 1500));
|
|
1698
|
+
};
|
|
1656
1699
|
document.querySelectorAll('[data-copy]').forEach((button) => button.addEventListener('click', async () => {
|
|
1657
1700
|
const text = copyText(document.getElementById(button.dataset.copy));
|
|
1658
|
-
|
|
1701
|
+
let ok = true;
|
|
1702
|
+
try { await navigator.clipboard.writeText(text); } catch (e) { ok = false; }
|
|
1703
|
+
status.textContent = ok ? 'Copied.' : 'Copy failed. Select the text instead.';
|
|
1704
|
+
showCopied(button, ok);
|
|
1659
1705
|
}));
|
|
1660
1706
|
|
|
1661
1707
|
// Live dialog and drawer: native modal dialogs return focus to the trigger on close.
|
|
@@ -1926,10 +1972,13 @@
|
|
|
1926
1972
|
document.getElementById('section-menu').addEventListener('click', (e) => openDrawer({ byPointer: e.detail > 0 }));
|
|
1927
1973
|
document.getElementById('section-find').addEventListener('click', () => openDrawer({ toFind: true }));
|
|
1928
1974
|
|
|
1929
|
-
// Copy link: writes the component's URL
|
|
1975
|
+
// Copy link: writes the component's URL, announces the result, and shows a tick as Copy does.
|
|
1930
1976
|
document.querySelectorAll('[data-copy-link]').forEach((button) => button.addEventListener('click', async () => {
|
|
1931
1977
|
const url = new URL(`#${button.dataset.copyLink}`, location.href).href;
|
|
1932
|
-
|
|
1978
|
+
let ok = true;
|
|
1979
|
+
try { await navigator.clipboard.writeText(url); } catch (e) { ok = false; }
|
|
1980
|
+
status.textContent = ok ? 'Link copied.' : 'Copy failed. Use the address bar instead.';
|
|
1981
|
+
showCopied(button, ok);
|
|
1933
1982
|
}));
|
|
1934
1983
|
})();
|
|
1935
1984
|
</script>
|
package/language/components.md
CHANGED
|
@@ -35,6 +35,7 @@ A control's **States** line names each interactive state it has. In `components.
|
|
|
35
35
|
- **Sizes.** `sm`, `md`, and `lg` use `--control-sm`, `--control-md`, and `--control-lg` for height, with `--text-sm`, `--text-md`, and `--text-lg`. At tablet width (`max-width: 800px`) touch targets use `--control-lg`.
|
|
36
36
|
- **Borders.** Every control keeps a 1px border, transparent unless its section says otherwise, so forced colors can draw an edge.
|
|
37
37
|
- **Depth.** Each control takes its shadow from the [depth tiers](DESIGN.md#depth).
|
|
38
|
+
- **Hover.** Hover fills apply only where the pointer can hover. Put every `:hover` rule that sets a background, shadow, border colour, or text colour in `@media (hover: hover)`, because a touch screen keeps `:hover` on the last element tapped. The pressed tint stays outside the query: it shows only while a finger is down.
|
|
38
39
|
- **Press.** Only a button has a pressed state; see [Button](#button). A [quiet action](#quiet-action) tints on press without sinking. Other controls have no `:active` treatment: they show their latched state as their section says.
|
|
39
40
|
- **Focus.** One ring for every role but fields: `outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset)` (2px, 3px), with no halo or glow. `--color-focus` is the accent (`--color-accent`), which reaches 3:1 on `--color-bg`, `--color-surface`, and `--color-surface-raised` in both themes. It sits around primary, danger, and selected controls too. Do not give a role its own ring colour; where a variant must recolour the ring, set only `outline-color`. The ring is drawn over the control's own raise or sink shadow, which does not change. It goes on the visible part of a composite control: the switch track, the radio card, and the slider thumb. A dark plate (command plate, terminal capture) sets `--color-focus: var(--color-project-dark)`, the dark-theme accent, which reaches 3:1 on the plate in both page themes. In forced colors, a control that opts out of adjustment (a checked box, the switch track, a pressed segmented option) sets `outline-color: CanvasText`. Inside a scrolling or clipping parent, the ring is inset (`outline-offset: calc(var(--focus-width) * -1)`), and a comment names the reason. Only `:focus-visible` shows a ring; pointer hover never does.
|
|
40
41
|
- **Field focus.** Fields (input, select, textarea, and the search wrapper) draw no ring. On `:focus-visible` (the search wrapper uses `:has(input:focus-visible)`) the 1px edge turns `--color-accent`, and `--shadow-field-focus` (`inset 0 0 0 2px`, the accent at 18% over transparent) draws a muted accent line inside it, with `outline: none`. The fill does not change in either theme. An invalid field keeps its `--color-error` edge while focused, and its inset line is `--shadow-field-focus-invalid` (`--color-error` at 18%). Forced colors drop the inset line, so a focused field there draws `outline: var(--focus-width) solid Highlight; outline-offset: -1px`.
|
|
@@ -70,7 +71,7 @@ Layer: Core. ui: `UiButton`.
|
|
|
70
71
|
Layer: Core. ui: the `fg-quiet-action` class.
|
|
71
72
|
|
|
72
73
|
- **Anatomy.** A native `<button>`, or the `<summary>` of a menu. Transparent fill, a transparent 1px border, `--radius-control`, and `--color-muted`. The project trigger overrides the corner with `--radius-field`, because it opens a menu and does not act (see [Site header](#site-header)). The content is centred in the box. An icon-only action holds an SVG icon, never a text glyph such as ×, because a font draws a glyph's ink off the centre of its box. Give the shared recipe zero specificity (`:where()`), so each component sets the action's size, place, and resting colour.
|
|
73
|
-
- **States.** Hover turns the text `--color-text` and fills `currentColor` at
|
|
74
|
+
- **States.** Hover turns the text `--color-text` and fills `currentColor` at 6% over transparent, only where the pointer can hover (`@media (hover: hover)`). Pressed fills `currentColor` at 12%, with no sink. Focus-visible is the focus ring, inset where the parent clips. An open menu keeps its trigger at the 6% hover tint, below the press. The code block's Copy is `--color-muted` at rest and takes the block's text colour (`--color-code-text`) on hover and while its tick shows. A disabled quiet action follows the shared [disabled](#rules-for-every-control) rule.
|
|
74
75
|
- **Do.** Use it for an action inside a component: Copy in a code block or command list, close in a dialog or drawer, Full size on a capture, and the project trigger.
|
|
75
76
|
- **Don't.** An action that stands on its own in the page, such as Save or Next. That is a button.
|
|
76
77
|
- **Keyboard and screen reader.** Native button behavior. An icon-only action needs `aria-label`.
|
|
@@ -405,15 +406,20 @@ Layer: Core. ui: none yet.
|
|
|
405
406
|
|
|
406
407
|
Layer: Core. ui: `UiCodeBlock`.
|
|
407
408
|
|
|
408
|
-
- **Anatomy.** A
|
|
409
|
+
- **Anatomy.** A frame that holds an optional header and the source panel.
|
|
410
|
+
- **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.
|
|
411
|
+
- **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.
|
|
412
|
+
- **Source panel.** The `<pre>`: `--color-code`, a transparent 1px border, and `calc(var(--radius-panel) - var(--space-1))` corners (12px), 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.
|
|
413
|
+
- **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.
|
|
409
414
|
- **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.
|
|
410
|
-
- **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 44×44 with an accessible name. Announce the result in a polite live region; in the compact variant the success message is visually hidden.
|
|
411
|
-
- **
|
|
415
|
+
- **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 44×44 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.
|
|
416
|
+
- **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.
|
|
417
|
+
- **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.
|
|
412
418
|
- **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.
|
|
413
419
|
- **Don't.** The same language label on every block of a page. Put useful setup context above the block instead.
|
|
414
|
-
- **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.
|
|
420
|
+
- **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 12px corners.
|
|
415
421
|
- **Motion.** None: the block is static, and Copy changes as a quiet action does.
|
|
416
|
-
- **Forced colors.** The shadow drops and the transparent border
|
|
422
|
+
- **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.
|
|
417
423
|
|
|
418
424
|
### With a live example
|
|
419
425
|
|
|
@@ -422,7 +428,7 @@ ui: `UiExample`.
|
|
|
422
428
|
- **Anatomy.** One frame: a `<figure>` with a 1px `--color-border-subtle` edge, `--radius-panel`, no shadow, and its content clipped to the corners. The stage comes first and holds the live preview, centred, at least 8rem tall, with `--space-8` padding. The code block follows directly below the stage, after one `--color-border-subtle` hairline. There is no header row and no language label. An optional caption follows the frame, as a [figure](#figure) caption does.
|
|
423
429
|
- **Tokens.** Frame edge `--color-border-subtle` and corners `--radius-panel`. Stage `--color-bg`. Hairline `--color-border-subtle`.
|
|
424
430
|
- **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).
|
|
425
|
-
- **Source.** Inside the frame the code block has no radius, border, or shadow of its own, and it spans the frame's full width, not `--measure`.
|
|
431
|
+
- **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.
|
|
426
432
|
- **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.
|
|
427
433
|
- **States.** The frame has no states. Components on the stage show their own states.
|
|
428
434
|
- **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.
|
|
@@ -434,14 +440,14 @@ ui: `UiExample`.
|
|
|
434
440
|
|
|
435
441
|
Layer: Identity. ui: `UiCodeBlock` with a shell language or the compact variant.
|
|
436
442
|
|
|
437
|
-
- **Anatomy.** A code block for a shell command, drawn as a dark plate in both themes: `--color-command-bg` with a `--color-command-border` edge (transparent in light). Text, syntax, and the caption all use `--color-terminal-text` or `--color-terminal-caption-text`. Each line starts with a `$ ` prompt in `--color-project-dark`, drawn with `content: "$ " / ""` and `user-select: none`, so copied and spoken text omit it. The plate sets `--color-focus: var(--color-project-dark)`, the dark-theme accent, so every ring on it, Copy's included, reads at 3:1 or more on the dark plate in both page themes.
|
|
443
|
+
- **Anatomy.** A code block for a shell command, drawn as a dark plate in both themes: the frame is `--color-command-bg` with a `--color-command-border` edge (transparent in light). The source panel is the plate darkened, `color-mix(in srgb, var(--color-command-bg) 55%, var(--color-terminal))`, set as the plate's `--color-code`, so it reads as a panel on the plate. Text, syntax, and the caption all use `--color-terminal-text` or `--color-terminal-caption-text`. Each line starts with a `$ ` prompt in `--color-project-dark`, drawn with `content: "$ " / ""` and `user-select: none`, so copied and spoken text omit it. The plate sets `--color-muted: var(--color-terminal-caption-text)`, so Copy at rest takes the caption colour, and `--color-focus: var(--color-project-dark)`, the dark-theme accent, so every ring on it, Copy's included, reads at 3:1 or more on the dark plate in both page themes.
|
|
438
444
|
- **States.** As for the code block.
|
|
439
445
|
- **Do.** Use it for a shell command the reader runs, one command per line.
|
|
440
446
|
- **Don't.** A `$` typed into the command. CSS draws the prompt; a typed one is copied with the command.
|
|
441
447
|
- **Keyboard and screen reader.** As for the code block.
|
|
442
448
|
- **Motion.** None: as for the code block.
|
|
443
449
|
- **Forced colors.** The dark plate drops to the system background, with system text and edge, and the prompt takes the system text colour.
|
|
444
|
-
- **Contrast.**
|
|
450
|
+
- **Contrast.** Text at least 4.5:1 and the prompt at least 3:1 on the source panel, and the header text at least 4.5:1 on `--color-command-bg`, for each project hue.
|
|
445
451
|
|
|
446
452
|
## Terminal capture
|
|
447
453
|
|
package/language/decisions.md
CHANGED
|
@@ -10,7 +10,8 @@ Each entry records a choice this language made, the options it rejected, and why
|
|
|
10
10
|
| Danger button | Core | A raised `--color-error-surface` button with danger-tinted text, mixed toward `--color-text` as status badges are. Hover and press deepen the tint, and press sinks it. The label must read at 4.5:1 on all three fills; where the mix misses, it falls back to `--color-text`, black, or white. | A flat button with `--color-text` and a hover border read as a pink secondary button, and pressing it showed nothing. | label contrast on all three fills: `tests/catalogue/catalogue.spec.ts` "contrast: every enabled danger button label reaches 4.5:1"; fills, raise, and sink: no test yet |
|
|
11
11
|
| Pressed button | Core | Every variant but text sinks 1px, takes `--shadow-sink`, and changes its fill. Press is a button state: other controls show their latched state, and quiet actions tint without sinking. | The sink shadow alone was too faint to show a click, especially on secondary and ghost. | rule present: `tests/design-foundations.test.mjs` "every state rule the guard requires exists in the catalogue"; 1px move, sink, and fill: no test yet |
|
|
12
12
|
| Busy button | Core | Busy also disables the button, so it takes no hover or press. | A busy button that still hovered and pressed looked ready for a second click. | No test yet |
|
|
13
|
-
| Quiet actions | Core | One recipe for Copy, Full size, dialog and drawer close, and the project trigger: transparent, `currentColor` at
|
|
13
|
+
| Quiet actions | Core | One recipe for Copy, Full size, dialog and drawer close, and the project trigger: transparent, `currentColor` at 6% on hover and 12% pressed (see Quiet action fill), no sink, and the control ring. The project trigger keeps the tint but takes the field corner (see One-line non-action controls). | Each had its own hover (`--color-row-hover`, a colour change only, or a 12% tint), so the same kind of action behaved differently. | rule present: `tests/design-foundations.test.mjs` "every state rule the guard requires exists in the catalogue"; tint recipe: `tests/catalogue/catalogue.spec.ts` "a hovering pointer adds a 6% fill, and a press 12%" |
|
|
14
|
+
| Quiet action fill | Core | `currentColor` at 6% under a hovering pointer and 12% pressed, a faint overlay after Astryx's ghost button overlay (the idea only; no code copied). The user approved it from rendered demos. | 12% hover and 18% pressed, the previous values, replaced by the fainter overlay the user chose. No fill on hover, with only the icon brightening: it hides the hit target, so the reader cannot see what a click will reach. | hover and press alpha: `tests/catalogue/catalogue.spec.ts` "a hovering pointer adds a 6% fill, and a press 12%"; no fill after a tap: "a tap leaves no fill behind" |
|
|
14
15
|
| One source per control | Core | Each control comes from the owning library's component or class, including a link styled as a button. | Local copies built from the same tokens drifted: a docs button had no raise and only faded when pressed. | copied rules unchanged: `tests/design-foundations.test.mjs` "example pages copy the catalogue rules for the shared controls and components they use unchanged" |
|
|
15
16
|
| Section mark | Identity | The `##` mark goes only on the page-level section headings (h2) of documentation, CLI tool, article, and product pages, which are mono with a `--color-border-subtle` rule above. Application and inline-visualization section headings are plain `--font-ui` semibold at `--text-xl` or smaller, with no mark and no rule. h3 and lower never take it. | The mark on every section heading: on a dense screen, such as a metrics dashboard with six sections, it repeated down the page and competed with the data. The mark on h2 and h3: deeper levels repeat more often. A per-page opt-out class: every application page would need to remember it. Dropping the mark: reading pages lose the folio identity that ties them to the `~/name` header. Mono application section headings without the mark: the mono face alone still reads as a document heading among compact sans rows. | No test yet |
|
|
16
17
|
| Command plate | Identity | A dark plate tinted with the project hue (`--color-command-bg`). Terminal captures keep the neutral plate. | The near-black plate looked too severe. | text and prompt contrast: `tests/catalogue/catalogue.spec.ts` "contrast: the command plate text reaches 4.5:1", "contrast: the command plate prompt reaches 3:1"; plate tint: no test yet |
|
package/language/docs.html
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
.sidebar { position: sticky; top: var(--space-6); align-self: start; display: grid; gap: var(--space-1); padding-block: var(--space-6); }
|
|
16
16
|
/* Navigation rows: components.html#navigation-list, unchanged. Only the rail's placement and spacing are local. */
|
|
17
17
|
.navlist a { position: relative; display: flex; align-items: center; min-height: var(--row); padding-inline: var(--space-3); border-radius: var(--radius-inline); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
|
|
18
|
-
.navlist a
|
|
18
|
+
.navlist a.is-hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
|
|
19
|
+
@media (hover: hover) { .navlist a:hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; } }
|
|
19
20
|
.navlist a[aria-current="page"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
|
|
20
21
|
.navlist a[aria-current="location"] { color: var(--color-text); font-weight: var(--weight-medium); }
|
|
21
22
|
.navlist a[aria-current="location"]::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
|
|
@@ -43,8 +44,9 @@ p { max-width: var(--measure); color: var(--color-muted); font-size: var(--text-
|
|
|
43
44
|
.command pre { min-width: 0; flex: 1; margin: 0; overflow-x: auto; font-size: var(--text-sm); }
|
|
44
45
|
/* Copy is a quiet action: components.html#quiet-action, unchanged. The page adds its size and colour only. */
|
|
45
46
|
:where(.quiet-action) { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
46
|
-
.quiet-action
|
|
47
|
-
.quiet-action:
|
|
47
|
+
.quiet-action.is-hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
48
|
+
@media (hover: hover) { .quiet-action:hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); } }
|
|
49
|
+
.quiet-action:is(:active, .is-active):where(:not(:disabled)) { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
48
50
|
.quiet-action:disabled { opacity: 0.58; cursor: not-allowed; }
|
|
49
51
|
.command button { flex: none; min-width: var(--control-lg); min-height: var(--control-lg); color: var(--color-terminal-caption-text); }
|
|
50
52
|
.meta, #copy-status { color: var(--color-muted); font-size: var(--text-sm); }
|
package/language/product.html
CHANGED
|
@@ -20,7 +20,8 @@ h1 { max-width: 18ch; font-size: var(--text-display); letter-spacing: var(--trac
|
|
|
20
20
|
/* The one primary action: components.html#button, unchanged. The page adds layout only. */
|
|
21
21
|
.btn { --depth: var(--shadow-raise); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-accent-text); box-shadow: var(--depth); font: var(--weight-medium) var(--text-md) / 1.25 var(--font-ui); letter-spacing: -0.01em; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
|
|
22
22
|
.btn[data-size="lg"] { min-height: var(--control-lg); padding: 0 var(--space-4); font-size: var(--text-lg); }
|
|
23
|
-
.btn
|
|
23
|
+
.btn.is-hover:not(:disabled) { background: var(--color-button-hover); }
|
|
24
|
+
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--color-button-hover); } }
|
|
24
25
|
.btn:not(.secondary, .ghost, .danger, .text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-button-hover); }
|
|
25
26
|
.btn:not(.text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { --depth: var(--shadow-sink); transform: translateY(1px); }
|
|
26
27
|
a.btn { text-decoration: none; }
|
package/language/reference.html
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
.navlist { display: grid; gap: 0.125rem; width: min(100%, 240px); }
|
|
21
21
|
.navlist .group-label { padding: 0 var(--space-3) var(--space-1); color: var(--color-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
|
|
22
22
|
.navlist a { position: relative; display: flex; align-items: center; min-height: var(--row); padding-inline: var(--space-3); border-radius: var(--radius-inline); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
|
|
23
|
-
.navlist a
|
|
23
|
+
.navlist a.is-hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; }
|
|
24
|
+
@media (hover: hover) { .navlist a:hover { background: var(--color-row-hover); color: var(--color-text); text-decoration: none; } }
|
|
24
25
|
/* The Foundations specimens share the current-page and location rules, forced colors included. */
|
|
25
26
|
.navlist a[aria-current="page"], .nav-current-sample { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
|
|
26
27
|
.navlist a[aria-current="location"], .pip-sample { color: var(--color-text); font-weight: var(--weight-medium); }
|
|
@@ -66,18 +67,22 @@
|
|
|
66
67
|
/* Buttons and quiet actions: components.html#button and #quiet-action, unchanged. The page adds layout only. */
|
|
67
68
|
.btn { --depth: var(--shadow-raise); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-accent); color: var(--color-accent-text); box-shadow: var(--depth); font: var(--weight-medium) var(--text-md) / 1.25 var(--font-ui); letter-spacing: -0.01em; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
|
|
68
69
|
.btn[data-size="sm"] { min-height: var(--control-sm); padding: 0 0.625rem; font-size: var(--text-sm); }
|
|
69
|
-
.btn
|
|
70
|
+
.btn.is-hover:not(:disabled) { background: var(--color-button-hover); }
|
|
71
|
+
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--color-button-hover); } }
|
|
70
72
|
.btn.secondary { background: var(--color-control-thumb); color: var(--color-text); }
|
|
71
|
-
.btn.secondary
|
|
73
|
+
.btn.secondary.is-hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); }
|
|
74
|
+
@media (hover: hover) { .btn.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, var(--color-control-thumb)); } }
|
|
72
75
|
.btn.ghost { --depth: none; background: transparent; color: var(--color-muted); }
|
|
73
|
-
.btn.ghost
|
|
76
|
+
.btn.ghost.is-hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); }
|
|
77
|
+
@media (hover: hover) { .btn.ghost:hover:not(:disabled) { background: var(--color-row-hover); color: var(--color-text); } }
|
|
74
78
|
.btn:not(.secondary, .ghost, .danger, .text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-button-hover); }
|
|
75
79
|
.btn:is(.secondary, .ghost):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { background: var(--color-well); }
|
|
76
80
|
.btn:not(.text):is(:active, [aria-pressed="true"], .is-active):not(:disabled) { --depth: var(--shadow-sink); transform: translateY(1px); }
|
|
77
81
|
.btn:disabled { --depth: none; opacity: 0.58; cursor: not-allowed; }
|
|
78
82
|
:where(.quiet-action) { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
79
|
-
.quiet-action
|
|
80
|
-
.quiet-action:
|
|
83
|
+
.quiet-action.is-hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
84
|
+
@media (hover: hover) { .quiet-action:hover:where(:not(:disabled)) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); } }
|
|
85
|
+
.quiet-action:is(:active, .is-active):where(:not(:disabled)) { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
81
86
|
.quiet-action:disabled { opacity: 0.58; cursor: not-allowed; }
|
|
82
87
|
/* .is-focus pins the focus state in the Focus and motion specimens. */
|
|
83
88
|
.is-focus { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
|
|
@@ -94,17 +99,18 @@
|
|
|
94
99
|
.search input::placeholder { color: var(--color-muted); }
|
|
95
100
|
/* The native clear button, quieted to a thin muted cross drawn with a mask. */
|
|
96
101
|
.search input::-webkit-search-cancel-button { width: 0.75rem; height: 0.75rem; margin-inline-start: var(--space-2); background: var(--color-muted); cursor: pointer; -webkit-appearance: none; appearance: none; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 2.5l7 7m0-7l-7 7' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
|
|
97
|
-
.search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); }
|
|
102
|
+
@media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { background: var(--color-text); } }
|
|
98
103
|
/* Forced colors would drop the masked fill, so the cross opts out and takes the system text colour. */
|
|
99
104
|
/* Forced colors drop the inset line, so the focused field draws the system ring just inside its edge. */
|
|
100
105
|
@media (forced-colors: active) { .search:is(:has(input:focus-visible), .is-focus) { outline: var(--focus-width) solid Highlight; outline-offset: -1px; } }
|
|
101
|
-
@media (forced-colors: active) { .search input::-webkit-search-cancel-button
|
|
106
|
+
@media (forced-colors: active) { .search input::-webkit-search-cancel-button { forced-color-adjust: none; background: CanvasText; } @media (hover: hover) { .search input:where(:not(:disabled))::-webkit-search-cancel-button:hover { forced-color-adjust: none; background: CanvasText; } } }
|
|
102
107
|
kbd { font-size: var(--text-xs); color: var(--color-muted); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-inline); padding: 0 var(--space-1); line-height: 1.125rem; background: var(--color-surface-raised); }
|
|
103
108
|
|
|
104
109
|
/* Tabs, for the Foundations specimens: components.html#tabs, unchanged. */
|
|
105
110
|
.tablist { --glide-lead: 260ms; --glide-trail: 300ms; display: flex; width: max-content; max-width: 100%; overflow-x: auto; padding: var(--space-1); isolation: isolate; }
|
|
106
111
|
.tab { position: relative; flex: none; min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-medium) var(--text-md) / var(--leading) var(--font-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
107
|
-
.tab
|
|
112
|
+
.tab.is-hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); }
|
|
113
|
+
@media (hover: hover) { .tab:hover:where(:not(:disabled)) { background: var(--color-row-hover); color: var(--color-text); } }
|
|
108
114
|
/* The selected tab takes the navigation row's lifted fill: one selected state for both. The fill is a
|
|
109
115
|
::before layer behind the label; in the catalogue it glides between tabs. */
|
|
110
116
|
.tab[aria-selected="true"] { background: transparent; color: var(--color-nav-current-text); }
|
|
@@ -123,8 +129,10 @@
|
|
|
123
129
|
.segmented[data-icon-only] button { width: var(--item); padding: 0; }
|
|
124
130
|
/* The thumb is inset inside each full-size button, so it floats on the track and the hit area keeps its size. */
|
|
125
131
|
.segmented button::before { content: ""; position: absolute; inset: 2px; z-index: -2; border-radius: var(--radius-control); pointer-events: none; }
|
|
126
|
-
.segmented button
|
|
127
|
-
|
|
132
|
+
.segmented button.is-hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); }
|
|
133
|
+
@media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"]) { color: var(--color-text); } }
|
|
134
|
+
.segmented button.is-hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
|
|
135
|
+
@media (hover: hover) { .segmented button:hover:not(:disabled, [aria-pressed="true"])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); } }
|
|
128
136
|
/* The pressed label reads at 4.5:1 on its thumb, and an icon at 3:1 (--color-segmented-current-text). */
|
|
129
137
|
.segmented button[aria-pressed="true"] { color: var(--color-segmented-current-text); }
|
|
130
138
|
.segmented button[aria-pressed="true"]::before { z-index: -1; background: var(--color-control-thumb); box-shadow: var(--shadow-raise); }
|
|
@@ -171,9 +179,13 @@
|
|
|
171
179
|
/* List selection: components.html#navigation-list. Dividers are straight lines inset by the row
|
|
172
180
|
padding; a filled row (hovered or selected) hides the divider above it and the one below it. */
|
|
173
181
|
.row + .row::before { content: ""; position: absolute; inset: 0 var(--space-3) auto; border-top: 1px solid var(--color-border-subtle); }
|
|
174
|
-
.row
|
|
175
|
-
.row
|
|
176
|
-
|
|
182
|
+
.row[aria-selected="true"]::before,
|
|
183
|
+
.row[aria-selected="true"] + .row::before { display: none; }
|
|
184
|
+
@media (hover: hover) {
|
|
185
|
+
.row:hover:where(:not(:disabled))::before,
|
|
186
|
+
.row:hover:where(:not(:disabled)) + .row::before { display: none; }
|
|
187
|
+
.row:hover:where(:not(:disabled)) { background: var(--color-row-hover); }
|
|
188
|
+
}
|
|
177
189
|
/* The selected row takes the navigation row's current recipe; it comes after hover, so hover keeps the fill. */
|
|
178
190
|
.row[aria-selected="true"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); font-weight: var(--weight-medium); }
|
|
179
191
|
.row[aria-selected="true"] .title { color: var(--color-nav-current-text); }
|
|
@@ -233,6 +245,8 @@
|
|
|
233
245
|
.detail h2 { font-size: var(--text-md); }
|
|
234
246
|
/* A code block inside a panel becomes a flush section, not a nested box. */
|
|
235
247
|
.detail > .code { padding: 0; border: 0; border-radius: 0; border-top: 1px solid var(--color-border-subtle); box-shadow: none; }
|
|
248
|
+
/* Its source spans the section, under one hairline, as a live example's does. */
|
|
249
|
+
.detail > .code > pre { border-width: 1px 0 0; border-color: var(--color-border-subtle); border-radius: 0; }
|
|
236
250
|
|
|
237
251
|
/* Properties */
|
|
238
252
|
.props { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); font-size: var(--text-sm); margin: 0; }
|
|
@@ -255,31 +269,38 @@
|
|
|
255
269
|
}
|
|
256
270
|
|
|
257
271
|
/* Code block: components.html#code-block, unchanged. */
|
|
258
|
-
.code { width: 100%; max-width: var(--measure); min-width: 0; overflow: hidden; border: 1px solid
|
|
259
|
-
|
|
272
|
+
.code { width: 100%; max-width: var(--measure); min-width: 0; overflow: hidden; padding: var(--space-1); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-panel); background: var(--color-surface-raised); color: var(--color-code-text); box-shadow: var(--shadow-surface); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
273
|
+
/* The header sits on the frame, so the frame drops its top padding under one. */
|
|
274
|
+
.code:has(> .code-head) { padding-top: 0; }
|
|
275
|
+
.code-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-height: 2.5rem; padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); font-size: var(--text-xs); }
|
|
260
276
|
.code-head b { font-weight: var(--weight-semibold); }
|
|
261
277
|
.code-head .lang { color: var(--color-muted); }
|
|
262
278
|
/* Copy is a quiet action; this sets its size and place. */
|
|
263
279
|
.copy { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-width: var(--control-lg); min-height: var(--control-lg); margin-left: auto; padding: var(--space-1) 0.375rem; color: inherit; }
|
|
264
|
-
/* The code block has its own palette, so
|
|
265
|
-
.code .copy
|
|
280
|
+
/* 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. */
|
|
281
|
+
.code .copy { color: var(--color-muted); }
|
|
282
|
+
.code .copy[data-copied] { color: var(--color-code-text); }
|
|
283
|
+
.code .copy.is-hover:where(:not(:disabled)) { color: var(--color-code-text); }
|
|
284
|
+
@media (hover: hover) { .code .copy:hover:where(:not(:disabled)) { color: var(--color-code-text); } }
|
|
266
285
|
/* Inset: the code block clips its content. */
|
|
267
286
|
.code pre:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
|
|
268
287
|
.code .copy.quiet-action:is(:focus-visible, .is-focus) { outline-offset: calc(var(--focus-width) * -1); }
|
|
269
|
-
|
|
288
|
+
/* The source is an inset panel. It sits --space-1 inside the frame, so its corners are concentric with the frame's. */
|
|
289
|
+
.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; }
|
|
270
290
|
/* Each line is a baseline-aligned row, so a prompt or line number sits on the text's baseline. */
|
|
271
291
|
.code .line { display: flex; align-items: baseline; min-height: 1.65em; }
|
|
272
292
|
.code .line > span { white-space: pre; }
|
|
273
293
|
.code .ln { min-width: 2.5em; padding-right: 1em; flex: none; text-align: right; color: var(--color-muted); user-select: none; }
|
|
274
294
|
.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); }
|
|
275
|
-
|
|
276
|
-
.code.compact
|
|
277
|
-
.code.compact
|
|
295
|
+
/* 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. */
|
|
296
|
+
.code.compact { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-1); }
|
|
297
|
+
.code.compact pre { align-content: center; padding: var(--space-2) var(--space-3); }
|
|
278
298
|
|
|
279
299
|
/* Command plate: components.html#command-plate, unchanged. */
|
|
280
|
-
/* The plate is dark in both themes, so its focus ring takes the dark-theme accent, which reaches 3:1 on it
|
|
281
|
-
|
|
282
|
-
.code.command
|
|
300
|
+
/* The plate is dark in both themes, so its focus ring takes the dark-theme accent, which reaches 3:1 on it,
|
|
301
|
+
and muted text, such as Copy at rest, takes the caption colour. */
|
|
302
|
+
.code.command { --color-code: color-mix(in srgb, var(--color-command-bg) 55%, var(--color-terminal)); --color-code-text: var(--color-terminal-text); --color-muted: var(--color-terminal-caption-text); --color-focus: var(--color-project-dark); border-color: var(--color-command-border); background: var(--color-command-bg); color: var(--color-terminal-text); }
|
|
303
|
+
.code.command .code-head { color: var(--color-terminal-caption-text); }
|
|
283
304
|
.code.command .code-head .lang { color: var(--color-terminal-caption-text); }
|
|
284
305
|
/* The prompt is drawn by CSS, so copied and spoken text omit it. */
|
|
285
306
|
.code.command .line::before { content: "$ " / ""; flex: none; white-space: pre; color: var(--color-project-dark); user-select: none; }
|
|
@@ -423,6 +444,7 @@
|
|
|
423
444
|
<symbol id="i-circle" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"/></symbol>
|
|
424
445
|
<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>
|
|
425
446
|
<symbol id="i-check" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"/><path d="M5.8 8.2l1.5 1.5 2.9-3"/></symbol>
|
|
447
|
+
<symbol id="i-tick" viewBox="0 0 16 16"><path d="M3.5 8.5l3 3 6-7"/></symbol>
|
|
426
448
|
<symbol id="i-dash" viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5" stroke-dasharray="2 2"/></symbol>
|
|
427
449
|
<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>
|
|
428
450
|
<symbol id="i-search" viewBox="0 0 16 16"><circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5 14 14"/></symbol>
|
|
@@ -486,6 +508,7 @@
|
|
|
486
508
|
</div>
|
|
487
509
|
</div>
|
|
488
510
|
<aside class="panel detail" id="detail" aria-live="polite"></aside>
|
|
511
|
+
<p class="sr-only" role="status" id="copy-status"></p>
|
|
489
512
|
</div>
|
|
490
513
|
|
|
491
514
|
<div class="doc">
|
|
@@ -762,6 +785,7 @@
|
|
|
762
785
|
MONITORS.forEach((m, i) => { m.data = series(m, 11 + i * 7); });
|
|
763
786
|
|
|
764
787
|
const icon = (id) => `<svg class="icon" aria-hidden="true"><use href="#${id}"/></svg>`;
|
|
788
|
+
const copyStatus = document.getElementById('copy-status');
|
|
765
789
|
const esc = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"');
|
|
766
790
|
|
|
767
791
|
const pathFor = (data, w, h, max, pad = 0) => {
|
|
@@ -878,10 +902,20 @@
|
|
|
878
902
|
</div>
|
|
879
903
|
<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>`;
|
|
880
904
|
const copy = detail.querySelector('.copy');
|
|
881
|
-
copy.
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
905
|
+
// A copy shows a tick for 1.5s and announces the result. Each completed copy restarts the wait, so copies
|
|
906
|
+
// still in flight do not stack timers; a failure puts the copy icon back at once.
|
|
907
|
+
const use = copy.querySelector('use');
|
|
908
|
+
const restore = () => { use.setAttribute('href', '#i-copy'); delete copy.dataset.copied; };
|
|
909
|
+
let wait;
|
|
910
|
+
copy.addEventListener('click', async () => {
|
|
911
|
+
let ok = true;
|
|
912
|
+
try { await navigator.clipboard.writeText(code); } catch (e) { ok = false; }
|
|
913
|
+
clearTimeout(wait);
|
|
914
|
+
copyStatus.textContent = ok ? 'Copied.' : 'Copy failed. Select the query instead.';
|
|
915
|
+
if (!ok) { restore(); return; }
|
|
916
|
+
use.setAttribute('href', '#i-tick');
|
|
917
|
+
copy.dataset.copied = '';
|
|
918
|
+
wait = setTimeout(restore, 1500);
|
|
885
919
|
});
|
|
886
920
|
};
|
|
887
921
|
|