@aitrien/motifspec 1.13.0 → 1.13.2
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/CHANGELOG.md +269 -257
- package/LICENSE +21 -21
- package/README.md +150 -150
- package/dist/backdrop.html +1 -1
- package/dist/chroma.css +36 -36
- package/dist/codex.css +1145 -1145
- package/dist/codex.js +126 -126
- package/dist/contrast.md +101 -101
- package/dist/fonts.css +3 -3
- package/dist/icons.svg +18 -18
- package/dist/plate.html +1 -1
- package/dist/plate.js +292 -292
- package/dist/theme-init.js +1 -1
- package/dist/tokens.css +466 -466
- package/dist/tokens.js +3330 -3330
- package/dist/tokens.json +3330 -3330
- package/docs/components/_template.md +37 -37
- package/docs/components/accession-label.md +106 -106
- package/docs/components/backdrop.md +83 -83
- package/docs/components/button-and-link.md +87 -87
- package/docs/components/callout.md +75 -75
- package/docs/components/code-block.md +109 -109
- package/docs/components/data-table.md +73 -73
- package/docs/components/figure.md +68 -68
- package/docs/components/heading-anchor.md +76 -76
- package/docs/components/icon.md +63 -63
- package/docs/components/ornament.md +77 -77
- package/docs/components/pagination.md +78 -78
- package/docs/components/post-list-item.md +91 -91
- package/docs/components/project-card.md +82 -82
- package/docs/components/prose.md +122 -122
- package/docs/components/site-footer.md +99 -99
- package/docs/components/site-header.md +133 -133
- package/docs/components/specimen-plate.md +92 -92
- package/docs/components/table-of-contents.md +83 -83
- package/docs/components/tag.md +70 -70
- package/docs/components/tooltip.md +67 -67
- package/docs/hugo.md +120 -120
- package/docs/syntax-highlighting.md +55 -55
- package/docs/templates.md +30 -30
- package/fonts/OFL-jetbrains-mono.txt +93 -93
- package/fonts/OFL-national-park.txt +93 -93
- package/fonts/OFL-yarndings-12.txt +93 -93
- package/icons/LICENSE +202 -202
- package/icons/manifest.json +75 -75
- package/layouts/_markup/render-blockquote.html +30 -30
- package/layouts/_markup/render-codeblock.html +18 -18
- package/layouts/_markup/render-heading.html +2 -2
- package/layouts/_markup/render-image.html +14 -14
- package/layouts/_markup/render-link.html +14 -14
- package/layouts/_markup/render-table.html +31 -31
- package/layouts/_partials/motifspec/accession/id.html +2 -2
- package/layouts/_partials/motifspec/accession/label.html +18 -18
- package/layouts/_partials/motifspec/accession/status.html +2 -2
- package/layouts/_partials/motifspec/article.html +24 -24
- package/layouts/_partials/motifspec/back-link.html +2 -2
- package/layouts/_partials/motifspec/body-end.html +5 -5
- package/layouts/_partials/motifspec/body-start.html +5 -5
- package/layouts/_partials/motifspec/figure.html +14 -14
- package/layouts/_partials/motifspec/filed-under.html +5 -5
- package/layouts/_partials/motifspec/h2s.html +7 -7
- package/layouts/_partials/motifspec/head.html +15 -15
- package/layouts/_partials/motifspec/pagination-entries.html +34 -34
- package/layouts/_partials/motifspec/pagination-pages.html +30 -30
- package/layouts/_partials/motifspec/post-list-item.html +15 -15
- package/layouts/_partials/motifspec/project-card.html +23 -23
- package/layouts/_partials/motifspec/section-heading.html +3 -3
- package/layouts/_partials/motifspec/site-header.html +27 -27
- package/layouts/_partials/motifspec/table-of-contents.html +21 -21
- package/layouts/_partials/motifspec/tag-filter.html +22 -22
- package/layouts/_partials/motifspec/tags.html +8 -8
- package/layouts/_partials/motifspec/tokens.html +9 -9
- package/package.json +68 -68
- package/scripts/check.mjs +153 -153
- package/scripts/lib.mjs +176 -176
- package/tokens/README.md +3 -3
- package/tokens/border.json +63 -63
- package/tokens/color.json +1902 -1902
- package/tokens/motion.json +207 -207
- package/tokens/radius.json +53 -53
- package/tokens/size.json +378 -378
- package/tokens/space.json +289 -289
- package/tokens/typography.json +859 -859
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: specimen-plate
|
|
3
|
-
status: stable
|
|
4
|
-
tokens:
|
|
5
|
-
- border.focus.offset
|
|
6
|
-
- border.focus.width
|
|
7
|
-
- border.width.contour
|
|
8
|
-
- border.width.emphasis
|
|
9
|
-
- border.width.hairline
|
|
10
|
-
- color.backdrop.saturation
|
|
11
|
-
- color.border.default
|
|
12
|
-
- color.border.strong
|
|
13
|
-
- color.focus.ring
|
|
14
|
-
- color.ornament.muted
|
|
15
|
-
- color.ornament.rest
|
|
16
|
-
- color.ornament.strong
|
|
17
|
-
- color.surface.hover
|
|
18
|
-
- color.surface.raised
|
|
19
|
-
- color.text.muted
|
|
20
|
-
- color.text.primary
|
|
21
|
-
- color.text.secondary
|
|
22
|
-
- font.family.mono
|
|
23
|
-
- font.size.label
|
|
24
|
-
- font.tracking.ui
|
|
25
|
-
- motion.duration.drift
|
|
26
|
-
- motion.duration.fast
|
|
27
|
-
- motion.duration.plate
|
|
28
|
-
- motion.easing.enter
|
|
29
|
-
- motion.easing.standard
|
|
30
|
-
- radius.pill
|
|
31
|
-
- size.backdrop.blur
|
|
32
|
-
- size.column.card
|
|
33
|
-
- size.mark.tick
|
|
34
|
-
- size.target.touch
|
|
35
|
-
- space.inset.md
|
|
36
|
-
- space.inset.sm
|
|
37
|
-
- space.stack.sm
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
# Specimen plate
|
|
41
|
-
|
|
42
|
-
A contour survey of generated terrain: simplex-noise height lines drawn as a static SVG, which slowly reshape as the terrain drifts. Framed with registration ticks and captioned as Plate 0.
|
|
43
|
-
|
|
44
|
-
## When to use
|
|
45
|
-
|
|
46
|
-
- Once, beside the statement on a product's landing page that does not use the backdrop.
|
|
47
|
-
- As the only decorative graphic on that page, and its only looping motion.
|
|
48
|
-
|
|
49
|
-
## When not to use
|
|
50
|
-
|
|
51
|
-
- On a page with the backdrop (`backdrop.md`), which already draws the survey behind it: one contour field per page. The showcase, which documents both, is the only exception.
|
|
52
|
-
- On article, index or 404 pages.
|
|
53
|
-
- As a loading indicator, or as a map of a real place. It is generated, not surveyed.
|
|
54
|
-
- Without its pause control.
|
|
55
|
-
|
|
56
|
-
## Markup
|
|
57
|
-
|
|
58
|
-
The build writes the plate to `dist/plate.html` (the contours at time zero) and ships the script as `dist/plate.js`. In Hugo, inline the markup and load the script; it finds every `.cx-plate[data-plate-seed]` on its own:
|
|
59
|
-
|
|
60
|
-
```html preview
|
|
61
|
-
<figure class="cx-plate-frame">
|
|
62
|
-
<label class="cx-plate__pause" hidden>
|
|
63
|
-
<input class="cx-visually-hidden" type="checkbox" aria-label="Pause animation">
|
|
64
|
-
<svg class="cx-icon" data-when="running" aria-hidden="true" focusable="false"><use href="#cx-icon-pause"></use></svg>
|
|
65
|
-
<svg class="cx-icon" data-when="paused" aria-hidden="true" focusable="false"><use href="#cx-icon-play"></use></svg>
|
|
66
|
-
<span class="cx-tooltip" aria-hidden="true"><span data-when="running">Pause animation</span><span data-when="paused">Play animation</span></span>
|
|
67
|
-
</label>
|
|
68
|
-
{{ (resources.Get "motifspec/plate.html").Content | safeHTML }}
|
|
69
|
-
<figcaption>Plate 0 <span class="cx-sep" aria-hidden="true">|</span> Contour survey <span class="cx-sep" aria-hidden="true">|</span> Simplex noise, 14 levels, index every fifth</figcaption>
|
|
70
|
-
</figure>
|
|
71
|
-
<script src="{{ (resources.Get "motifspec/plate.js" | minify | fingerprint).RelPermalink }}" defer></script>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Do
|
|
75
|
-
|
|
76
|
-
- Keep the survey conventions: 14 contour levels, every fifth an index contour (`color.ornament.strong`, `border.width.emphasis`), the rest hairlines in `color.ornament.rest`, over a quarter grid in `color.ornament.muted`.
|
|
77
|
-
- Let each contour draw in once on load (`motion.duration.plate`, `motion.easing.enter`, staggered from the lowest line), then let the script start the drift: it eases up from rest over `motion.duration.plate`, then the terrain moves one noise unit every `motion.duration.drift`, linearly, and the lines are recomputed on every second frame.
|
|
78
|
-
- Change the terrain with `data-plate-seed` (and the matching `seed` option at build time), never by editing path data.
|
|
79
|
-
- Keep the caption factual: what it is, the method and the contour count.
|
|
80
|
-
|
|
81
|
-
## Don't
|
|
82
|
-
|
|
83
|
-
- Don't speed up the drift, add a second animated plate, or make it react to the pointer.
|
|
84
|
-
- Don't add elevation numbers, place names or a north arrow. It must not read as a real map.
|
|
85
|
-
- Don't put text or links inside the plate.
|
|
86
|
-
|
|
87
|
-
## Accessibility
|
|
88
|
-
|
|
89
|
-
- The plate is `aria-hidden`; the caption is the only text.
|
|
90
|
-
- WCAG 2.2.2 (Pause, Stop, Hide): the drift runs longer than five seconds, so the pause control (a native checkbox named "Pause animation") is reachable by keyboard and its checked state means paused. It ships `hidden` and the script reveals it only when the drift starts, so no dead control appears without JavaScript.
|
|
91
|
-
- The script stops drawing while the plate is off screen or the tab is hidden, and never starts under `prefers-reduced-motion: reduce`; there, the contours render complete and still and the pause control stays hidden.
|
|
92
|
-
- Contours are decorative: `color.ornament.rest` has no text-contrast requirement.
|
|
1
|
+
---
|
|
2
|
+
name: specimen-plate
|
|
3
|
+
status: stable
|
|
4
|
+
tokens:
|
|
5
|
+
- border.focus.offset
|
|
6
|
+
- border.focus.width
|
|
7
|
+
- border.width.contour
|
|
8
|
+
- border.width.emphasis
|
|
9
|
+
- border.width.hairline
|
|
10
|
+
- color.backdrop.saturation
|
|
11
|
+
- color.border.default
|
|
12
|
+
- color.border.strong
|
|
13
|
+
- color.focus.ring
|
|
14
|
+
- color.ornament.muted
|
|
15
|
+
- color.ornament.rest
|
|
16
|
+
- color.ornament.strong
|
|
17
|
+
- color.surface.hover
|
|
18
|
+
- color.surface.raised
|
|
19
|
+
- color.text.muted
|
|
20
|
+
- color.text.primary
|
|
21
|
+
- color.text.secondary
|
|
22
|
+
- font.family.mono
|
|
23
|
+
- font.size.label
|
|
24
|
+
- font.tracking.ui
|
|
25
|
+
- motion.duration.drift
|
|
26
|
+
- motion.duration.fast
|
|
27
|
+
- motion.duration.plate
|
|
28
|
+
- motion.easing.enter
|
|
29
|
+
- motion.easing.standard
|
|
30
|
+
- radius.pill
|
|
31
|
+
- size.backdrop.blur
|
|
32
|
+
- size.column.card
|
|
33
|
+
- size.mark.tick
|
|
34
|
+
- size.target.touch
|
|
35
|
+
- space.inset.md
|
|
36
|
+
- space.inset.sm
|
|
37
|
+
- space.stack.sm
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# Specimen plate
|
|
41
|
+
|
|
42
|
+
A contour survey of generated terrain: simplex-noise height lines drawn as a static SVG, which slowly reshape as the terrain drifts. Framed with registration ticks and captioned as Plate 0.
|
|
43
|
+
|
|
44
|
+
## When to use
|
|
45
|
+
|
|
46
|
+
- Once, beside the statement on a product's landing page that does not use the backdrop.
|
|
47
|
+
- As the only decorative graphic on that page, and its only looping motion.
|
|
48
|
+
|
|
49
|
+
## When not to use
|
|
50
|
+
|
|
51
|
+
- On a page with the backdrop (`backdrop.md`), which already draws the survey behind it: one contour field per page. The showcase, which documents both, is the only exception.
|
|
52
|
+
- On article, index or 404 pages.
|
|
53
|
+
- As a loading indicator, or as a map of a real place. It is generated, not surveyed.
|
|
54
|
+
- Without its pause control.
|
|
55
|
+
|
|
56
|
+
## Markup
|
|
57
|
+
|
|
58
|
+
The build writes the plate to `dist/plate.html` (the contours at time zero) and ships the script as `dist/plate.js`. In Hugo, inline the markup and load the script; it finds every `.cx-plate[data-plate-seed]` on its own:
|
|
59
|
+
|
|
60
|
+
```html preview
|
|
61
|
+
<figure class="cx-plate-frame">
|
|
62
|
+
<label class="cx-plate__pause" hidden>
|
|
63
|
+
<input class="cx-visually-hidden" type="checkbox" aria-label="Pause animation">
|
|
64
|
+
<svg class="cx-icon" data-when="running" aria-hidden="true" focusable="false"><use href="#cx-icon-pause"></use></svg>
|
|
65
|
+
<svg class="cx-icon" data-when="paused" aria-hidden="true" focusable="false"><use href="#cx-icon-play"></use></svg>
|
|
66
|
+
<span class="cx-tooltip" aria-hidden="true"><span data-when="running">Pause animation</span><span data-when="paused">Play animation</span></span>
|
|
67
|
+
</label>
|
|
68
|
+
{{ (resources.Get "motifspec/plate.html").Content | safeHTML }}
|
|
69
|
+
<figcaption>Plate 0 <span class="cx-sep" aria-hidden="true">|</span> Contour survey <span class="cx-sep" aria-hidden="true">|</span> Simplex noise, 14 levels, index every fifth</figcaption>
|
|
70
|
+
</figure>
|
|
71
|
+
<script src="{{ (resources.Get "motifspec/plate.js" | minify | fingerprint).RelPermalink }}" defer></script>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Do
|
|
75
|
+
|
|
76
|
+
- Keep the survey conventions: 14 contour levels, every fifth an index contour (`color.ornament.strong`, `border.width.emphasis`), the rest hairlines in `color.ornament.rest`, over a quarter grid in `color.ornament.muted`.
|
|
77
|
+
- Let each contour draw in once on load (`motion.duration.plate`, `motion.easing.enter`, staggered from the lowest line), then let the script start the drift: it eases up from rest over `motion.duration.plate`, then the terrain moves one noise unit every `motion.duration.drift`, linearly, and the lines are recomputed on every second frame.
|
|
78
|
+
- Change the terrain with `data-plate-seed` (and the matching `seed` option at build time), never by editing path data.
|
|
79
|
+
- Keep the caption factual: what it is, the method and the contour count.
|
|
80
|
+
|
|
81
|
+
## Don't
|
|
82
|
+
|
|
83
|
+
- Don't speed up the drift, add a second animated plate, or make it react to the pointer.
|
|
84
|
+
- Don't add elevation numbers, place names or a north arrow. It must not read as a real map.
|
|
85
|
+
- Don't put text or links inside the plate.
|
|
86
|
+
|
|
87
|
+
## Accessibility
|
|
88
|
+
|
|
89
|
+
- The plate is `aria-hidden`; the caption is the only text.
|
|
90
|
+
- WCAG 2.2.2 (Pause, Stop, Hide): the drift runs longer than five seconds, so the pause control (a native checkbox named "Pause animation") is reachable by keyboard and its checked state means paused. It ships `hidden` and the script reveals it only when the drift starts, so no dead control appears without JavaScript.
|
|
91
|
+
- The script stops drawing while the plate is off screen or the tab is hidden, and never starts under `prefers-reduced-motion: reduce`; there, the contours render complete and still and the pause control stays hidden.
|
|
92
|
+
- Contours are decorative: `color.ornament.rest` has no text-contrast requirement.
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: table-of-contents
|
|
3
|
-
status: stable
|
|
4
|
-
tokens:
|
|
5
|
-
- border.focus.offset
|
|
6
|
-
- border.focus.width
|
|
7
|
-
- border.width.emphasis
|
|
8
|
-
- border.width.hairline
|
|
9
|
-
- color.accent.border
|
|
10
|
-
- color.border.default
|
|
11
|
-
- color.border.strong
|
|
12
|
-
- color.focus.ring
|
|
13
|
-
- color.text.muted
|
|
14
|
-
- color.text.primary
|
|
15
|
-
- color.text.secondary
|
|
16
|
-
- font.family.mono
|
|
17
|
-
- font.line-height.ui
|
|
18
|
-
- font.size.label
|
|
19
|
-
- font.size.small
|
|
20
|
-
- font.tracking.label
|
|
21
|
-
- font.weight.ui
|
|
22
|
-
- motion.duration.base
|
|
23
|
-
- motion.easing.standard
|
|
24
|
-
- size.column.sidebar
|
|
25
|
-
- size.target.min
|
|
26
|
-
- size.target.touch
|
|
27
|
-
- space.inline.sm
|
|
28
|
-
- space.inset.md
|
|
29
|
-
- space.inset.xs
|
|
30
|
-
- space.section.sm
|
|
31
|
-
- space.stack.xl
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
# Table of contents
|
|
35
|
-
|
|
36
|
-
A numbered list of an article's sections, beside the text on wide screens and above it on narrow ones.
|
|
37
|
-
|
|
38
|
-
## When to use
|
|
39
|
-
|
|
40
|
-
- On posts with three or more `<h2>` sections, and on every case study.
|
|
41
|
-
- Inside the `cx-article` layout, before `cx-article__main` in the DOM.
|
|
42
|
-
|
|
43
|
-
## When not to use
|
|
44
|
-
|
|
45
|
-
- On short posts (fewer than three sections).
|
|
46
|
-
- For site navigation; use `site-header`.
|
|
47
|
-
|
|
48
|
-
## Markup
|
|
49
|
-
|
|
50
|
-
```html preview
|
|
51
|
-
<div class="cx-article">
|
|
52
|
-
<nav class="cx-toc" aria-labelledby="toc-title">
|
|
53
|
-
<details open>
|
|
54
|
-
<summary id="toc-title">On this page<svg class="cx-icon cx-icon--sm cx-toc__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
|
|
55
|
-
<ol>
|
|
56
|
-
<li><a href="#why"><span class="cx-toc__no">01</span>Why tokens need rules</a></li>
|
|
57
|
-
<li><a href="#pairs"><span class="cx-toc__no">02</span>The pairs contract</a>
|
|
58
|
-
<ol><li><a href="#fail"><span class="cx-toc__no">2.1</span>Failure modes</a></li></ol>
|
|
59
|
-
</li>
|
|
60
|
-
</ol>
|
|
61
|
-
</details>
|
|
62
|
-
</nav>
|
|
63
|
-
<div class="cx-article__main cx-prose"><!-- content with matching ids --></div>
|
|
64
|
-
</div>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Do
|
|
68
|
-
|
|
69
|
-
- Number sections because the order is real; nest `<h3>` entries one level only.
|
|
70
|
-
- Ship `<details open>` so it works without script. Readers can collapse it on phones; the chevron rotates with `motion.duration.base`.
|
|
71
|
-
- Let the script add `is-docked` (sticky) only when the TOC sits beside the text, and set `aria-current="true"` on the visible section.
|
|
72
|
-
|
|
73
|
-
## Don't
|
|
74
|
-
|
|
75
|
-
- Don't make the TOC sticky in CSS alone; when wrapped above the text it would cover content.
|
|
76
|
-
- Don't list more than about eight entries.
|
|
77
|
-
|
|
78
|
-
## Accessibility
|
|
79
|
-
|
|
80
|
-
- `<nav aria-labelledby>` points at the summary text.
|
|
81
|
-
- The active entry is announced through `aria-current`, not colour alone (it also gets the accent rule).
|
|
82
|
-
- Entries are at least 24px tall.
|
|
83
|
-
- Pairs: `color.text.secondary` on `color.surface.base` (7:1); active rule `color.accent.border` (3:1).
|
|
1
|
+
---
|
|
2
|
+
name: table-of-contents
|
|
3
|
+
status: stable
|
|
4
|
+
tokens:
|
|
5
|
+
- border.focus.offset
|
|
6
|
+
- border.focus.width
|
|
7
|
+
- border.width.emphasis
|
|
8
|
+
- border.width.hairline
|
|
9
|
+
- color.accent.border
|
|
10
|
+
- color.border.default
|
|
11
|
+
- color.border.strong
|
|
12
|
+
- color.focus.ring
|
|
13
|
+
- color.text.muted
|
|
14
|
+
- color.text.primary
|
|
15
|
+
- color.text.secondary
|
|
16
|
+
- font.family.mono
|
|
17
|
+
- font.line-height.ui
|
|
18
|
+
- font.size.label
|
|
19
|
+
- font.size.small
|
|
20
|
+
- font.tracking.label
|
|
21
|
+
- font.weight.ui
|
|
22
|
+
- motion.duration.base
|
|
23
|
+
- motion.easing.standard
|
|
24
|
+
- size.column.sidebar
|
|
25
|
+
- size.target.min
|
|
26
|
+
- size.target.touch
|
|
27
|
+
- space.inline.sm
|
|
28
|
+
- space.inset.md
|
|
29
|
+
- space.inset.xs
|
|
30
|
+
- space.section.sm
|
|
31
|
+
- space.stack.xl
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Table of contents
|
|
35
|
+
|
|
36
|
+
A numbered list of an article's sections, beside the text on wide screens and above it on narrow ones.
|
|
37
|
+
|
|
38
|
+
## When to use
|
|
39
|
+
|
|
40
|
+
- On posts with three or more `<h2>` sections, and on every case study.
|
|
41
|
+
- Inside the `cx-article` layout, before `cx-article__main` in the DOM.
|
|
42
|
+
|
|
43
|
+
## When not to use
|
|
44
|
+
|
|
45
|
+
- On short posts (fewer than three sections).
|
|
46
|
+
- For site navigation; use `site-header`.
|
|
47
|
+
|
|
48
|
+
## Markup
|
|
49
|
+
|
|
50
|
+
```html preview
|
|
51
|
+
<div class="cx-article">
|
|
52
|
+
<nav class="cx-toc" aria-labelledby="toc-title">
|
|
53
|
+
<details open>
|
|
54
|
+
<summary id="toc-title">On this page<svg class="cx-icon cx-icon--sm cx-toc__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
|
|
55
|
+
<ol>
|
|
56
|
+
<li><a href="#why"><span class="cx-toc__no">01</span>Why tokens need rules</a></li>
|
|
57
|
+
<li><a href="#pairs"><span class="cx-toc__no">02</span>The pairs contract</a>
|
|
58
|
+
<ol><li><a href="#fail"><span class="cx-toc__no">2.1</span>Failure modes</a></li></ol>
|
|
59
|
+
</li>
|
|
60
|
+
</ol>
|
|
61
|
+
</details>
|
|
62
|
+
</nav>
|
|
63
|
+
<div class="cx-article__main cx-prose"><!-- content with matching ids --></div>
|
|
64
|
+
</div>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Do
|
|
68
|
+
|
|
69
|
+
- Number sections because the order is real; nest `<h3>` entries one level only.
|
|
70
|
+
- Ship `<details open>` so it works without script. Readers can collapse it on phones; the chevron rotates with `motion.duration.base`.
|
|
71
|
+
- Let the script add `is-docked` (sticky) only when the TOC sits beside the text, and set `aria-current="true"` on the visible section.
|
|
72
|
+
|
|
73
|
+
## Don't
|
|
74
|
+
|
|
75
|
+
- Don't make the TOC sticky in CSS alone; when wrapped above the text it would cover content.
|
|
76
|
+
- Don't list more than about eight entries.
|
|
77
|
+
|
|
78
|
+
## Accessibility
|
|
79
|
+
|
|
80
|
+
- `<nav aria-labelledby>` points at the summary text.
|
|
81
|
+
- The active entry is announced through `aria-current`, not colour alone (it also gets the accent rule).
|
|
82
|
+
- Entries are at least 24px tall.
|
|
83
|
+
- Pairs: `color.text.secondary` on `color.surface.base` (7:1); active rule `color.accent.border` (3:1).
|
package/docs/components/tag.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tag
|
|
3
|
-
status: stable
|
|
4
|
-
tokens:
|
|
5
|
-
- border.focus.offset
|
|
6
|
-
- border.focus.width
|
|
7
|
-
- border.width.hairline
|
|
8
|
-
- color.accent.border
|
|
9
|
-
- color.border.default
|
|
10
|
-
- color.focus.ring
|
|
11
|
-
- color.surface.sunken
|
|
12
|
-
- color.text.muted
|
|
13
|
-
- color.text.primary
|
|
14
|
-
- color.text.secondary
|
|
15
|
-
- font.family.mono
|
|
16
|
-
- font.line-height.ui
|
|
17
|
-
- font.size.label
|
|
18
|
-
- font.tracking.ui
|
|
19
|
-
- motion.duration.fast
|
|
20
|
-
- motion.easing.standard
|
|
21
|
-
- radius.none
|
|
22
|
-
- size.target.min
|
|
23
|
-
- space.inline.sm
|
|
24
|
-
- space.inline.xs
|
|
25
|
-
- space.inset.sm
|
|
26
|
-
- space.stack.sm
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
# Tag
|
|
30
|
-
|
|
31
|
-
A small mono label for a topic or technology, optionally linking to its index.
|
|
32
|
-
|
|
33
|
-
## When to use
|
|
34
|
-
|
|
35
|
-
- For taxonomy terms on cards, post rows and post footers ("Filed under").
|
|
36
|
-
- As filters on index pages, with `aria-current="page"` on the active one.
|
|
37
|
-
|
|
38
|
-
## When not to use
|
|
39
|
-
|
|
40
|
-
- For status; use `cx-status` in an accession label.
|
|
41
|
-
- For actions; use `button-and-link`.
|
|
42
|
-
- For more than three tags on a card or five on a post.
|
|
43
|
-
|
|
44
|
-
## Markup
|
|
45
|
-
|
|
46
|
-
```html preview
|
|
47
|
-
<ul class="cx-tags">
|
|
48
|
-
<li><a class="cx-tag" href="/tags/webgl/">webgl<span class="cx-tag__count">4</span></a></li>
|
|
49
|
-
<li><a class="cx-tag" href="/tags/accessibility/" aria-current="page">accessibility</a></li>
|
|
50
|
-
<li><span class="cx-tag">draft</span></li>
|
|
51
|
-
</ul>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Do
|
|
55
|
-
|
|
56
|
-
- Write terms in lowercase kebab-case, matching the taxonomy slug.
|
|
57
|
-
- Show counts only on filter lists.
|
|
58
|
-
- Use `<span class="cx-tag">` when the tag doesn't link anywhere.
|
|
59
|
-
|
|
60
|
-
## Don't
|
|
61
|
-
|
|
62
|
-
- Don't colour tags by category.
|
|
63
|
-
- Don't round the corners or add icons.
|
|
64
|
-
|
|
65
|
-
## Accessibility
|
|
66
|
-
|
|
67
|
-
- Tags are at least 24px tall (`size.target.min`).
|
|
68
|
-
- Wrap groups in `<ul>` so the count is announced.
|
|
69
|
-
- The current filter uses `aria-current="page"` as well as the accent border.
|
|
70
|
-
- Pairs: `color.text.secondary` on `color.surface.sunken` (7:1); hover border `color.accent.border` (3:1).
|
|
1
|
+
---
|
|
2
|
+
name: tag
|
|
3
|
+
status: stable
|
|
4
|
+
tokens:
|
|
5
|
+
- border.focus.offset
|
|
6
|
+
- border.focus.width
|
|
7
|
+
- border.width.hairline
|
|
8
|
+
- color.accent.border
|
|
9
|
+
- color.border.default
|
|
10
|
+
- color.focus.ring
|
|
11
|
+
- color.surface.sunken
|
|
12
|
+
- color.text.muted
|
|
13
|
+
- color.text.primary
|
|
14
|
+
- color.text.secondary
|
|
15
|
+
- font.family.mono
|
|
16
|
+
- font.line-height.ui
|
|
17
|
+
- font.size.label
|
|
18
|
+
- font.tracking.ui
|
|
19
|
+
- motion.duration.fast
|
|
20
|
+
- motion.easing.standard
|
|
21
|
+
- radius.none
|
|
22
|
+
- size.target.min
|
|
23
|
+
- space.inline.sm
|
|
24
|
+
- space.inline.xs
|
|
25
|
+
- space.inset.sm
|
|
26
|
+
- space.stack.sm
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# Tag
|
|
30
|
+
|
|
31
|
+
A small mono label for a topic or technology, optionally linking to its index.
|
|
32
|
+
|
|
33
|
+
## When to use
|
|
34
|
+
|
|
35
|
+
- For taxonomy terms on cards, post rows and post footers ("Filed under").
|
|
36
|
+
- As filters on index pages, with `aria-current="page"` on the active one.
|
|
37
|
+
|
|
38
|
+
## When not to use
|
|
39
|
+
|
|
40
|
+
- For status; use `cx-status` in an accession label.
|
|
41
|
+
- For actions; use `button-and-link`.
|
|
42
|
+
- For more than three tags on a card or five on a post.
|
|
43
|
+
|
|
44
|
+
## Markup
|
|
45
|
+
|
|
46
|
+
```html preview
|
|
47
|
+
<ul class="cx-tags">
|
|
48
|
+
<li><a class="cx-tag" href="/tags/webgl/">webgl<span class="cx-tag__count">4</span></a></li>
|
|
49
|
+
<li><a class="cx-tag" href="/tags/accessibility/" aria-current="page">accessibility</a></li>
|
|
50
|
+
<li><span class="cx-tag">draft</span></li>
|
|
51
|
+
</ul>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Do
|
|
55
|
+
|
|
56
|
+
- Write terms in lowercase kebab-case, matching the taxonomy slug.
|
|
57
|
+
- Show counts only on filter lists.
|
|
58
|
+
- Use `<span class="cx-tag">` when the tag doesn't link anywhere.
|
|
59
|
+
|
|
60
|
+
## Don't
|
|
61
|
+
|
|
62
|
+
- Don't colour tags by category.
|
|
63
|
+
- Don't round the corners or add icons.
|
|
64
|
+
|
|
65
|
+
## Accessibility
|
|
66
|
+
|
|
67
|
+
- Tags are at least 24px tall (`size.target.min`).
|
|
68
|
+
- Wrap groups in `<ul>` so the count is announced.
|
|
69
|
+
- The current filter uses `aria-current="page"` as well as the accent border.
|
|
70
|
+
- Pairs: `color.text.secondary` on `color.surface.sunken` (7:1); hover border `color.accent.border` (3:1).
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tooltip
|
|
3
|
-
status: stable
|
|
4
|
-
tokens:
|
|
5
|
-
- color.surface.inverse
|
|
6
|
-
- color.text.inverse
|
|
7
|
-
- font.family.mono
|
|
8
|
-
- font.line-height.ui
|
|
9
|
-
- font.size.label
|
|
10
|
-
- font.tracking.ui
|
|
11
|
-
- font.weight.ui
|
|
12
|
-
- motion.duration.fast
|
|
13
|
-
- motion.easing.standard
|
|
14
|
-
- size.column.card
|
|
15
|
-
- space.inset.sm
|
|
16
|
-
- space.inset.xs
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# Tooltip
|
|
20
|
-
|
|
21
|
-
A short label that appears beside an icon-only control on hover or keyboard focus, saying what the control does.
|
|
22
|
-
|
|
23
|
-
## When to use
|
|
24
|
-
|
|
25
|
-
- On icon-only controls, such as the theme toggle ("Switch to dark theme").
|
|
26
|
-
- On a version number that links to the changelog ("View changelog"), where the text alone doesn't say it's a link.
|
|
27
|
-
- When the label is an action of five words or fewer.
|
|
28
|
-
|
|
29
|
-
## When not to use
|
|
30
|
-
|
|
31
|
-
- On controls that already show text. Their label is enough.
|
|
32
|
-
- For explanations, definitions or anything a reader needs in order to continue. Put that in the page.
|
|
33
|
-
- On touch-only interactions, where hover doesn't exist. The control's accessible name has to carry the meaning on its own.
|
|
34
|
-
- For links, form errors or rich content.
|
|
35
|
-
|
|
36
|
-
## Markup
|
|
37
|
-
|
|
38
|
-
The tooltip is a child of the control, so hover and focus on the control reveal it:
|
|
39
|
-
|
|
40
|
-
```html preview
|
|
41
|
-
<button class="cx-theme-toggle" type="button" aria-label="Switch to dark theme">
|
|
42
|
-
<svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-dark"></use></svg>
|
|
43
|
-
<span class="cx-tooltip" aria-hidden="true">Switch to dark theme</span>
|
|
44
|
-
</button>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
It opens below the control, aligned to its right edge. Add `cx-tooltip--start` to align it to the left edge instead, for controls near the left of the screen, and `cx-tooltip--above` to open it above the control, for controls near the bottom of the page (the footer version link).
|
|
48
|
-
|
|
49
|
-
## Do
|
|
50
|
-
|
|
51
|
-
- Keep the text identical to the control's `aria-label`, and update both together when the action changes.
|
|
52
|
-
- Write the action, not the state: "Switch to dark theme", not "Light theme".
|
|
53
|
-
- Let Escape dismiss it (`is-tooltip-dismissed` on the control until the pointer leaves or focus moves).
|
|
54
|
-
- Use the inverse surface (`color.surface.inverse`, `color.text.inverse`) so it reads on every background, in both themes.
|
|
55
|
-
|
|
56
|
-
## Don't
|
|
57
|
-
|
|
58
|
-
- Don't round it. Tooltips are labels, and pills are reserved for buttons.
|
|
59
|
-
- Don't add a delay longer than `motion.duration.fast` or animate its position.
|
|
60
|
-
- Don't put interactive content inside it; it ignores the pointer.
|
|
61
|
-
|
|
62
|
-
## Accessibility
|
|
63
|
-
|
|
64
|
-
- The tooltip is `aria-hidden="true"` because it repeats the accessible name. Screen readers hear the `aria-label` once.
|
|
65
|
-
- It shows on `:focus-visible` as well as `:hover`, so keyboard users see it too.
|
|
66
|
-
- Escape hides it without moving the pointer or focus (WCAG 1.4.13).
|
|
67
|
-
- Pair: `color.text.inverse` on `color.surface.inverse` (7:1 in both themes).
|
|
1
|
+
---
|
|
2
|
+
name: tooltip
|
|
3
|
+
status: stable
|
|
4
|
+
tokens:
|
|
5
|
+
- color.surface.inverse
|
|
6
|
+
- color.text.inverse
|
|
7
|
+
- font.family.mono
|
|
8
|
+
- font.line-height.ui
|
|
9
|
+
- font.size.label
|
|
10
|
+
- font.tracking.ui
|
|
11
|
+
- font.weight.ui
|
|
12
|
+
- motion.duration.fast
|
|
13
|
+
- motion.easing.standard
|
|
14
|
+
- size.column.card
|
|
15
|
+
- space.inset.sm
|
|
16
|
+
- space.inset.xs
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Tooltip
|
|
20
|
+
|
|
21
|
+
A short label that appears beside an icon-only control on hover or keyboard focus, saying what the control does.
|
|
22
|
+
|
|
23
|
+
## When to use
|
|
24
|
+
|
|
25
|
+
- On icon-only controls, such as the theme toggle ("Switch to dark theme").
|
|
26
|
+
- On a version number that links to the changelog ("View changelog"), where the text alone doesn't say it's a link.
|
|
27
|
+
- When the label is an action of five words or fewer.
|
|
28
|
+
|
|
29
|
+
## When not to use
|
|
30
|
+
|
|
31
|
+
- On controls that already show text. Their label is enough.
|
|
32
|
+
- For explanations, definitions or anything a reader needs in order to continue. Put that in the page.
|
|
33
|
+
- On touch-only interactions, where hover doesn't exist. The control's accessible name has to carry the meaning on its own.
|
|
34
|
+
- For links, form errors or rich content.
|
|
35
|
+
|
|
36
|
+
## Markup
|
|
37
|
+
|
|
38
|
+
The tooltip is a child of the control, so hover and focus on the control reveal it:
|
|
39
|
+
|
|
40
|
+
```html preview
|
|
41
|
+
<button class="cx-theme-toggle" type="button" aria-label="Switch to dark theme">
|
|
42
|
+
<svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-dark"></use></svg>
|
|
43
|
+
<span class="cx-tooltip" aria-hidden="true">Switch to dark theme</span>
|
|
44
|
+
</button>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
It opens below the control, aligned to its right edge. Add `cx-tooltip--start` to align it to the left edge instead, for controls near the left of the screen, and `cx-tooltip--above` to open it above the control, for controls near the bottom of the page (the footer version link).
|
|
48
|
+
|
|
49
|
+
## Do
|
|
50
|
+
|
|
51
|
+
- Keep the text identical to the control's `aria-label`, and update both together when the action changes.
|
|
52
|
+
- Write the action, not the state: "Switch to dark theme", not "Light theme".
|
|
53
|
+
- Let Escape dismiss it (`is-tooltip-dismissed` on the control until the pointer leaves or focus moves).
|
|
54
|
+
- Use the inverse surface (`color.surface.inverse`, `color.text.inverse`) so it reads on every background, in both themes.
|
|
55
|
+
|
|
56
|
+
## Don't
|
|
57
|
+
|
|
58
|
+
- Don't round it. Tooltips are labels, and pills are reserved for buttons.
|
|
59
|
+
- Don't add a delay longer than `motion.duration.fast` or animate its position.
|
|
60
|
+
- Don't put interactive content inside it; it ignores the pointer.
|
|
61
|
+
|
|
62
|
+
## Accessibility
|
|
63
|
+
|
|
64
|
+
- The tooltip is `aria-hidden="true"` because it repeats the accessible name. Screen readers hear the `aria-label` once.
|
|
65
|
+
- It shows on `:focus-visible` as well as `:hover`, so keyboard users see it too.
|
|
66
|
+
- Escape hides it without moving the pointer or focus (WCAG 1.4.13).
|
|
67
|
+
- Pair: `color.text.inverse` on `color.surface.inverse` (7:1 in both themes).
|