@aitrien/motifspec 1.18.1 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +90 -72
  3. package/dist/backdrop-side.html +1 -0
  4. package/dist/codex.css +236 -2
  5. package/dist/codex.js +176 -1
  6. package/dist/plate.js +4 -4
  7. package/dist/tokens.css +5 -1
  8. package/dist/tokens.js +21 -1
  9. package/dist/tokens.json +21 -1
  10. package/docs/components/_template.md +2 -1
  11. package/docs/components/accession-label.md +2 -1
  12. package/docs/components/backdrop.md +20 -8
  13. package/docs/components/button-and-link.md +2 -2
  14. package/docs/components/callout.md +1 -1
  15. package/docs/components/code-block.md +1 -1
  16. package/docs/components/component-preview.md +68 -0
  17. package/docs/components/data-table.md +2 -2
  18. package/docs/components/disclosure.md +1 -1
  19. package/docs/components/docs-shell.md +126 -0
  20. package/docs/components/figure.md +2 -1
  21. package/docs/components/heading-anchor.md +1 -1
  22. package/docs/components/icon.md +5 -1
  23. package/docs/components/keyboard-key.md +1 -1
  24. package/docs/components/ornament.md +3 -2
  25. package/docs/components/page-actions.md +56 -0
  26. package/docs/components/page-footer.md +67 -0
  27. package/docs/components/pagination.md +2 -1
  28. package/docs/components/post-list-item.md +1 -1
  29. package/docs/components/project-card.md +1 -1
  30. package/docs/components/prose.md +2 -1
  31. package/docs/components/search.md +117 -0
  32. package/docs/components/site-footer.md +3 -3
  33. package/docs/components/site-header.md +22 -1
  34. package/docs/components/specimen-plate.md +2 -2
  35. package/docs/components/status.md +2 -1
  36. package/docs/components/steps.md +70 -0
  37. package/docs/components/table-of-contents.md +1 -1
  38. package/docs/components/tabs.md +81 -0
  39. package/docs/components/tag.md +1 -1
  40. package/docs/components/token-table.md +96 -0
  41. package/docs/components/tooltip.md +1 -1
  42. package/docs/hugo.md +72 -4
  43. package/docs/layouts/a-la-carte.md +1 -0
  44. package/docs/layouts/dashboard.md +2 -0
  45. package/docs/layouts/documentation.md +8 -8
  46. package/docs/layouts/portfolio.md +2 -0
  47. package/docs/syntax-highlighting.md +1 -0
  48. package/layouts/_markup/render-blockquote.html +1 -1
  49. package/layouts/_markup/render-codeblock.html +18 -3
  50. package/layouts/_markup/render-heading.html +1 -1
  51. package/layouts/_markup/render-image.html +5 -4
  52. package/layouts/_markup/render-link.html +1 -1
  53. package/layouts/_markup/render-table.html +3 -2
  54. package/layouts/_partials/motifspec/article.html +13 -8
  55. package/layouts/_partials/motifspec/body-start.html +8 -4
  56. package/layouts/_partials/motifspec/docs-nav.html +31 -0
  57. package/layouts/_partials/motifspec/page-actions.html +8 -0
  58. package/layouts/_partials/motifspec/page-footer.html +27 -0
  59. package/layouts/_partials/motifspec/pagination-docs.html +37 -0
  60. package/layouts/_partials/motifspec/search.html +18 -0
  61. package/layouts/_partials/motifspec/site-header.html +11 -2
  62. package/layouts/_partials/motifspec/table-of-contents.html +1 -1
  63. package/layouts/home.markdown.md +7 -0
  64. package/layouts/page.markdown.md +7 -0
  65. package/layouts/section.markdown.md +7 -0
  66. package/package.json +7 -4
  67. package/scripts/check.mjs +16 -19
  68. package/scripts/lib.mjs +40 -2
  69. package/tokens/color.json +13 -0
@@ -15,22 +15,26 @@ tokens:
15
15
  - motion.duration.slow
16
16
  - motion.easing.standard
17
17
  - size.backdrop.fade
18
+ - size.column.sidebar
19
+ - size.container.page
20
+ - space.gutter.page
18
21
  ---
19
22
 
20
23
  # Backdrop
21
24
 
22
- Contour surveys drawn full-bleed behind the top of the home page and the bottom of every page, under a light, grainy frost. The page's own surface fades out over its first and last `size.backdrop.fade`, so the contours show behind the header, the home page's statement and the footer, and reading happens on the plain surface. They don't drift. The home page's contours settle into place once on arrival, and the pointer warms the ground under it into a hill of rings, like an attention heatmap drawn as a survey.
25
+ Contour surveys drawn full-bleed behind the top of the home page and the bottom of every page (or, on a documentation site, down the left edge), under a light, grainy frost. The page's own surface fades out over its first and last `size.backdrop.fade`, so the contours show behind the header, the home page's statement and the footer, and reading happens on the plain surface. They don't drift. The home page's contours settle into place once on arrival, and the pointer warms the ground under it into a hill of rings, like an attention heatmap drawn as a survey.
23
26
 
24
27
  ## When to use
25
28
 
26
- - The foot on every page of a portfolio or documentation site, 404 included (`docs/layouts/`).
27
- - The head on the home page only, behind the statement: it is where a visitor starts. Every other page opens on the plain surface.
29
+ - The foot on every page of a portfolio, 404 included (`docs/layouts/portfolio.md`).
30
+ - The head on a portfolio's home page only, behind the statement: it is where a visitor starts. Every other page opens on the plain surface.
31
+ - The side on every page in a documentation site's docs shell, down the left edge behind the navigation, with the foot in its place on a phone. A documentation site's landing page has the head and foot, like a portfolio's home page (`docs/layouts/documentation.md`).
28
32
  - On a dashboard, behind the main area, as `docs/layouts/dashboard.md` says.
29
- - Once each per page, both inside `<body class="cx-backdrop-page">`: the head as its first child, the foot after the footer.
33
+ - Once each per page, all inside `<body class="cx-backdrop-page">`: the head or the side as its first child, the foot after the footer.
30
34
 
31
35
  ## When not to use
32
36
 
33
- - On the same page as the specimen plate: one kind of contour field per page. The showcase, which documents both, is the only exception.
37
+ - On the same page as the specimen plate: one kind of contour field per page.
34
38
  - Inside a component or as a section background. The frost belongs to the page's top and bottom.
35
39
  - Behind layouts that need the plain surface from the very top, such as a full-screen app or a print stylesheet.
36
40
 
@@ -38,7 +42,7 @@ Contour surveys drawn full-bleed behind the top of the home page and the bottom
38
42
 
39
43
  The build writes the head to `dist/backdrop.html` and the foot to `dist/backdrop-foot.html`: the contours at time zero, on a different stretch of terrain each, sliced to cover the layer. In Hugo, `motifspec/body-start.html` inlines the head on the home page, and `motifspec/body-end.html` inlines the foot and loads `dist/plate.js`:
40
44
 
41
- ```html preview
45
+ ```html {preview=true}
42
46
  <body class="cx-backdrop-page">
43
47
  {{ (resources.Get "motifspec/backdrop.html").Content | safeHTML }}
44
48
  <!-- home page only: <div class="cx-backdrop cx-backdrop--head" aria-hidden="true" data-plate-seed="3" data-plate-cells="48"><svg class="cx-plate__map" preserveAspectRatio="xMidYMid slice" …>…</svg></div> -->
@@ -54,6 +58,14 @@ The build writes the head to `dist/backdrop.html` and the foot to `dist/backdrop
54
58
 
55
59
  From the bottom up: the canvas (`color.surface.base`), the contours (the specimen plate's `color.ornament.rest` lines and `color.ornament.strong` index contours, at `border.width.hairline` and `border.width.emphasis`, with `color.backdrop.saturation`), the frost (`color.backdrop.tint` of the surface), the grain (monochrome noise at `color.backdrop.grain`), then the page, whose surface is solid between the two fades. Each layer is `size.backdrop.fade` tall and scrolls with the page: the head from the top of the page, the foot up from the bottom.
56
60
 
61
+ ### The side
62
+
63
+ A documentation page reads from the top, so it has no head. The build writes a third layer, `dist/backdrop-side.html`, and `<body class="cx-backdrop-page cx-backdrop-page--side">` puts it down the left edge instead. From `size.breakpoint.md` up it is fixed, so it stays beside the navigation as the page scrolls, and it reaches the left edge of the main column: the page container's margin and gutter, then `size.column.sidebar`. The page's surface, and the header's, fade in across it from left to right, so the contours are strongest at the window's edge, keep `color.backdrop.calm` behind the navigation, and are gone before the article. There is no edge across the page, and the foot is hidden. Below `size.breakpoint.md` the side is hidden and the foot shows behind the footer, as on a portfolio.
64
+
65
+ In Hugo, with `params.motifspec.layout = "documentation"`, `motifspec/body-start.html` inlines the side on every page but the home page, which gets the head (`docs/hugo.md`). The home page's body has `cx-backdrop-page` without `--side`. Elsewhere, put the side's markup where the head would go and keep the foot after the footer.
66
+
67
+ ### The calm side
68
+
57
69
  Where text sits on the frost, the contours keep only `color.backdrop.calm` of their strength: on the left, where the statement and the footer start, and along the header. They come up to full strength towards the open side. The calm side is a mask, so the lines run behind the text rather than around it.
58
70
 
59
71
  ## Do
@@ -67,7 +79,7 @@ Where text sits on the frost, the contours keep only `color.backdrop.calm` of th
67
79
 
68
80
  - Don't give sections, panels or cards a frosted background of their own.
69
81
  - Don't give `<body>` a `z-index`. `cx-backdrop-page` positions it so the layers can sit at its top and bottom; a `z-index` would lift its surface's stacking context over them, or put them on top of it.
70
- - Don't put the head on pages other than the home page, or more than one head or foot on a page.
82
+ - Don't put the head on pages other than the home page (a portfolio's, or a documentation site's landing page), or more than one head, side or foot on a page. The head and the side don't go on the same page.
71
83
  - Don't make the backdrop drift, or animate it on a timer. Its only motion is the settle on arrival and the response to the pointer.
72
84
  - Don't raise `color.backdrop.grain` until the noise competes with text, and don't give the grain a `mix-blend-mode`.
73
85
  - Don't put text, links or controls in the backdrop.
@@ -77,4 +89,4 @@ Where text sits on the frost, the contours keep only `color.backdrop.calm` of th
77
89
  - The backdrop is `aria-hidden` and carries no information.
78
90
  - WCAG 2.2.2 (Pause, Stop, Hide) doesn't apply: the settle is over in under five seconds, and every other change follows the reader's own pointer. So there is no pause control.
79
91
  - Under `prefers-reduced-motion: reduce` the contours never move: no settle and no warming.
80
- - Reading text between the fades sits on `color.surface.base`, so the declared pairs apply. Text over the frost (the header, the footer, the home page's statement, and all of a short page) is measured against `color.surface.base` too: by design, contrast is not checked against the contour lines beneath it, which are faint there by the calm side.
92
+ - Reading text between the fades sits on `color.surface.base`, so the declared pairs apply. Text over the frost (the header, the footer, the home page's statement, a documentation site's navigation, and all of a short page) is measured against `color.surface.base` too: by design, contrast is not checked against the contour lines beneath it, which are faint there by the calm side.
@@ -58,7 +58,7 @@ Buttons start actions or journeys; standalone links and back links move between
58
58
 
59
59
  ## Markup
60
60
 
61
- ```html preview
61
+ ```html {preview=true}
62
62
  <div class="cx-actions">
63
63
  <a class="cx-button cx-button--primary" href="/work/">View work <svg class="cx-icon cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-forward"></use></svg></a>
64
64
  <a class="cx-button" href="/writing/">Read the writing</a>
@@ -70,7 +70,7 @@ Buttons start actions or journeys; standalone links and back links move between
70
70
 
71
71
  Add `cx-button--sm` for a compact button in a table row or a toolbar, where full-size buttons would make every row tall:
72
72
 
73
- ```html preview
73
+ ```html {preview=true}
74
74
  <button class="cx-button cx-button--sm" type="button">Restart<span class="cx-visually-hidden"> Jellyfin</span></button>
75
75
  ```
76
76
 
@@ -49,7 +49,7 @@ A tinted note set apart from running text, in four kinds: note, tip, warning and
49
49
 
50
50
  Hugo shortcode output (`{{< callout warning >}}…{{< /callout >}}`):
51
51
 
52
- ```html preview
52
+ ```html {preview=true}
53
53
  <div class="cx-callout cx-callout--warning" role="note">
54
54
  <p class="cx-callout__title"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-warning"></use></svg>Warning</p>
55
55
  <p>Renaming a semantic token is a major version bump.</p>
@@ -76,7 +76,7 @@ A framed block of syntax-highlighted code with a header bar for language, file n
76
76
 
77
77
  Hugo render hook (`layouts/_default/_markup/render-codeblock.html`):
78
78
 
79
- ```html preview
79
+ ```html {preview=true}
80
80
  <figure class="cx-code">
81
81
  <figcaption class="cx-code__bar">
82
82
  <span>ts</span>
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: component-preview
3
+ status: stable
4
+ layouts: [documentation]
5
+ tokens:
6
+ - border.width.hairline
7
+ - color.border.default
8
+ - color.surface.base
9
+ - size.column.card
10
+ - space.inset.md
11
+ - space.stack.lg
12
+ ---
13
+
14
+ # Component preview
15
+
16
+ A live example above its markup, on a page that documents a component, so a reader sees it working and copies the same code.
17
+
18
+ ## When to use
19
+
20
+ - On a design system's documentation pages, for each component example.
21
+ - Wherever a reader should see markup rendered with the system's styles and script before copying it.
22
+
23
+ ## When not to use
24
+
25
+ - For code that isn't HTML for the system, such as a config file or a template; that is a code block (`code-block.md`).
26
+ - For a screenshot of a whole page; that is a figure (`figure.md`).
27
+ - In a portfolio case study; show the result as a figure.
28
+
29
+ ## Markup
30
+
31
+ In Markdown, fence the example as ```` ```html {preview=true} ````; the code block render hook adds the preview. The hook writes:
32
+
33
+ ```html {preview=true}
34
+ <div class="cx-preview">
35
+ <iframe class="cx-preview__frame" title="Example: Callout" loading="lazy" srcdoc="&lt;!doctype html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;…&lt;/head&gt;&lt;body class=&quot;cx-preview-body&quot;&gt;…the example…&lt;/body&gt;&lt;/html&gt;"></iframe>
36
+ <figure class="cx-code">…the example's code block…</figure>
37
+ </div>
38
+ ```
39
+
40
+ The frame's document has the theme snippet (`dist/theme-init.js`), `codex.css`, `codex.js` and the icon sprite, and the example in a `<body class="cx-preview-body">`.
41
+
42
+ ## Do
43
+
44
+ - Preview the same markup the doc asks readers to copy: the preview and the code block come from one fence.
45
+ - Keep each example to one component in one state; give other states their own fence.
46
+ - Write examples whose ids and landmarks make sense on their own; the frame keeps them apart from the page's.
47
+
48
+ ## Don't
49
+
50
+ - Don't put a preview's markup straight into the page; a header or shell example would clash with the page's own.
51
+ - Don't rely on links in an example; they don't navigate.
52
+ - Don't preview examples that need data from the page around them.
53
+
54
+ ## Accessibility
55
+
56
+ - The frame has a title ("Example: Callout"), so a screen reader announces it before its content; the content is the example's own, with its own landmarks.
57
+ - The code block after it is the text alternative: everything in the preview is in the code.
58
+ - Without script the frame keeps a fixed height and scrolls; with it, the frame is as tall as the example.
59
+ - Pairs: as the previewed component. The frame and its border: `color.surface.base` and `color.border.default`.
60
+
61
+ ## Behaviour
62
+
63
+ `dist/codex.js` does this on the page and in the frame; a site that renders previews itself does the same.
64
+
65
+ - **Size:** when a frame loads, its height (`--_frame-height`) is set to the body of its document, and kept there with a ResizeObserver as the example changes.
66
+ - **Theme:** the frame's document reads the stored theme like any page, and when the page's theme toggle is used, `data-theme` is set on the frame's root too.
67
+ - **Links:** inside a preview (`body.cx-preview-body`), clicks on links don't navigate.
68
+ - **Scripts:** the example's own behaviour, such as a theme toggle or a copy button, runs inside the frame from `codex.js`.
@@ -45,7 +45,7 @@ A framed table for comparing values: mono headers, hairline rows, right-aligned
45
45
 
46
46
  ## Markup
47
47
 
48
- ```html preview
48
+ ```html {preview=true}
49
49
  <div class="cx-table" role="region" aria-labelledby="tbl-fonts" tabindex="0">
50
50
  <table>
51
51
  <caption id="tbl-fonts">Font budget <span class="cx-sep" aria-hidden="true">|</span> Latin subset</caption>
@@ -59,7 +59,7 @@ A framed table for comparing values: mono headers, hairline rows, right-aligned
59
59
 
60
60
  A table of things to act on gives each row a state cell (`td.is-state`, with a status from `status.md`) and an actions cell (`td.is-actions`) of compact buttons. Each button's hidden text finishes its name, so a screen reader hears "Restart Jellyfin", not "Restart" six times:
61
61
 
62
- ```html preview
62
+ ```html {preview=true}
63
63
  <div class="cx-table" role="region" aria-labelledby="tbl-services" tabindex="0">
64
64
  <table>
65
65
  <caption id="tbl-services">Services</caption>
@@ -36,7 +36,7 @@ A native `<details>` that shows and hides a block of content under a labelled ro
36
36
 
37
37
  ## Markup
38
38
 
39
- ```html preview
39
+ ```html {preview=true}
40
40
  <details class="cx-disclosure">
41
41
  <summary>Show as a table<svg class="cx-icon cx-icon--sm cx-disclosure__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
42
42
  <div class="cx-disclosure__body">
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: docs-shell
3
+ status: stable
4
+ layouts: [documentation]
5
+ tokens:
6
+ - border.focus.offset
7
+ - border.focus.width
8
+ - border.width.emphasis
9
+ - border.width.hairline
10
+ - color.accent.border
11
+ - color.border.default
12
+ - color.border.strong
13
+ - color.focus.ring
14
+ - color.text.muted
15
+ - color.text.primary
16
+ - color.text.secondary
17
+ - font.line-height.ui
18
+ - font.size.small
19
+ - font.weight.strong
20
+ - motion.duration.base
21
+ - motion.easing.standard
22
+ - radius.pill
23
+ - size.column.sidebar
24
+ - size.target.control
25
+ - size.target.min
26
+ - size.target.touch
27
+ - space.gutter.grid
28
+ - space.inline.sm
29
+ - space.inline.xs
30
+ - space.inset.md
31
+ - space.inset.xs
32
+ - space.section.sm
33
+ - space.stack.md
34
+ - space.stack.xs
35
+ ---
36
+
37
+ # Docs shell
38
+
39
+ The frame of a documentation page: grouped page navigation on the left, the page beside it, and "On this page" on the right when there is room.
40
+
41
+ ## When to use
42
+
43
+ - On every page of a documentation site except the landing page (`docs/layouts/documentation.md`), which is full width.
44
+ - When readers move between many pages in a set order: guides, reference, a changelog.
45
+
46
+ ## When not to use
47
+
48
+ - On a portfolio; it has the site header's nav and no side column.
49
+ - On a dashboard; its side navigation is a different component, for places in an app rather than pages to read.
50
+ - For a site of fewer than about eight pages, where the header's nav is enough.
51
+
52
+ ## Markup
53
+
54
+ The site header (`site-header.md`) and footer (`site-footer.md`) go around it as on any page. The main column holds the page head and a `cx-article`, whose table of contents (`table-of-contents.md`) is "On this page".
55
+
56
+ ```html {preview=true}
57
+ <div class="cx-container cx-docs">
58
+ <nav class="cx-docs-nav" aria-label="Documentation">
59
+ <details class="cx-docs-nav__menu">
60
+ <summary>Menu<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
61
+ <div class="cx-docs-nav__groups">
62
+ <ul class="cx-docs-nav__list">
63
+ <li><a href="/">Overview</a></li>
64
+ </ul>
65
+ <details class="cx-docs-nav__group" open>
66
+ <summary id="docs-nav-guide">Guide<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
67
+ <ul class="cx-docs-nav__list" aria-labelledby="docs-nav-guide">
68
+ <li><a href="/guide/getting-started/" aria-current="page">Getting started</a></li>
69
+ <li><a href="/guide/layouts/">Choosing a layout</a></li>
70
+ </ul>
71
+ </details>
72
+ <details class="cx-docs-nav__group" open>
73
+ <summary id="docs-nav-reference">Reference<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
74
+ <ul class="cx-docs-nav__list" aria-labelledby="docs-nav-reference">
75
+ <li><a href="/reference/tokens/">Tokens</a></li>
76
+ <li><a href="/reference/changelog/">Changelog</a></li>
77
+ </ul>
78
+ </details>
79
+ </div>
80
+ </details>
81
+ </nav>
82
+ <main id="main" class="cx-docs__main" tabindex="-1" data-pagefind-body>
83
+ <div class="cx-page-head">
84
+ <h1>Getting started</h1>
85
+ <p class="cx-lede">Install the module, import it, and check your site.</p>
86
+ </div>
87
+ <div class="cx-article">
88
+ <div class="cx-article__main cx-prose">
89
+ <p>The page's content.</p>
90
+ </div>
91
+ </div>
92
+ </main>
93
+ </div>
94
+ ```
95
+
96
+ In Hugo, `partial "motifspec/docs-nav.html" .` writes the navigation from the site's sections (`docs/hugo.md`). `data-pagefind-body` limits search (`search.md`) to the page's own content.
97
+
98
+ ## Do
99
+
100
+ - Group pages by what the reader is trying to do, in the order they'll need them: a guide before reference.
101
+ - Keep group names to one or two words, and page titles short enough for one line in the column.
102
+ - Mark the current page with `aria-current="page"`.
103
+ - Say "(deprecated)" after the title of a page about something deprecated; `docs-nav.html` does when the page sets `deprecated`.
104
+ - Leave every group open unless the navigation is long; a reader scans more easily than they click.
105
+
106
+ ## Don't
107
+
108
+ - Don't nest groups; one level of groups, then pages.
109
+ - Don't put the same page in two groups.
110
+ - Don't add icons to the docs navigation; the page titles are the labels.
111
+ - Don't hide the Menu control on a phone or ship the menu open there; the page comes first.
112
+
113
+ ## Accessibility
114
+
115
+ - The navigation is a `<nav>` named "Documentation", separate from the header's "Main".
116
+ - Each group's list is named by its summary (`aria-labelledby`), so a screen reader hears "Guide, list, 4 items".
117
+ - On a phone, the Menu control is a `<details>` summary: it opens with Enter or Space and works without script.
118
+ - Group summaries and links meet `size.target.min`; the Menu control meets `size.target.control`.
119
+ - The current page is marked in words for assistive tech (`aria-current`) and by weight and the accent rule on screen, not colour alone.
120
+ - Pairs: `color.text.primary` and `color.text.secondary` on `color.surface.base` (7:1); the accent rule `color.accent.border` and hover rule `color.border.strong` on `color.surface.base` (3:1).
121
+
122
+ ## Behaviour
123
+
124
+ - **Without script:** at `size.breakpoint.md` and wider, the navigation is always shown and the Menu control is hidden; below it, the Menu control opens and closes it. The page scrolls with the navigation.
125
+ - **With `dist/codex.js`:** while the navigation sits beside the main column, it gets `is-docked`: it sticks below the header and scrolls on its own, sized from `--_viewport-height` and `--_header-height`, which the script keeps up to date. The current page is scrolled into the middle of the docked navigation on load. Docking is checked again on resize.
126
+ - An app that renders the shell itself does the same, or leaves it undocked.
@@ -46,7 +46,7 @@ A framed image or diagram with a numbered plate label and a caption.
46
46
 
47
47
  ## Markup
48
48
 
49
- ```html preview
49
+ ```html {preview=true}
50
50
  <figure class="cx-figure cx-figure--breakout cx-figure--diagram">
51
51
  <div class="cx-figure__frame">
52
52
  <svg class="cx-diagram" viewBox="0 0 720 120" role="img" aria-label="Tokens go through the build, which writes CSS for sites.">
@@ -70,6 +70,7 @@ A framed image or diagram with a numbered plate label and a caption.
70
70
 
71
71
  ### Diagram parts
72
72
 
73
+ <!-- caption: Diagram parts -->
73
74
  | Class | Draws |
74
75
  |---|---|
75
76
  | `cx-diagram` | The `<svg>`. Sets the body font. |
@@ -40,7 +40,7 @@ A "#" link after a section heading, so readers can copy a link straight to that
40
40
 
41
41
  ## Markup
42
42
 
43
- ```html preview
43
+ ```html {preview=true}
44
44
  <!-- Prose: the heading carries the id -->
45
45
  <h2 id="approach">Approach <a class="cx-anchor" href="#approach" aria-label="Link to Approach">#</a></h2>
46
46
 
@@ -3,9 +3,13 @@ name: icon
3
3
  status: stable
4
4
  layouts: [shared]
5
5
  tokens:
6
+ - color.text.muted
7
+ - motion.duration.base
8
+ - motion.easing.standard
6
9
  - size.icon.lg
7
10
  - size.icon.md
8
11
  - size.icon.sm
12
+ - space.inline.xs
9
13
  ---
10
14
 
11
15
  # Icon
@@ -28,7 +32,7 @@ A Material Symbols glyph from the MotifSpec sprite, used to reinforce a control'
28
32
 
29
33
  Inline the sprite once per page, right after `<body>` (Hugo: `{{ readFile "assets/motifspec/icons.svg" | safeHTML }}` inside a hidden wrapper, or the build's inline sprite). Then reference symbols by id:
30
34
 
31
- ```html preview
35
+ ```html {preview=true}
32
36
  <a class="cx-button cx-button--primary" href="/work/">
33
37
  View work
34
38
  <svg class="cx-icon cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-forward"></use></svg>
@@ -30,7 +30,7 @@ A key the reader presses, set as a small keycap: Ctrl K, Esc, Enter.
30
30
 
31
31
  ## Markup
32
32
 
33
- ```html preview
33
+ ```html {preview=true}
34
34
  <kbd class="cx-kbd">Ctrl</kbd> <kbd class="cx-kbd">K</kbd>
35
35
  ```
36
36
 
@@ -37,7 +37,7 @@ Yarndings 12 knitting-chart glyphs: the footer band, the prose divider, the arti
37
37
 
38
38
  ## Markup
39
39
 
40
- ```html preview
40
+ ```html {preview=true}
41
41
  <span class="cx-band" aria-hidden="true"></span>
42
42
  <hr class="cx-divider">
43
43
  <p>Last sentence of the article.<span class="cx-end-mark" aria-hidden="true">g</span></p>
@@ -49,6 +49,7 @@ Yarndings 12 knitting-chart glyphs: the footer band, the prose divider, the arti
49
49
 
50
50
  `font.family.ornament` → `$extensions["codex.glyphs"]` lists all 80 approved glyphs by name, with the key that types each one and its group:
51
51
 
52
+ <!-- caption: Ornament catalogue -->
52
53
  | Group | Character | Examples (key) |
53
54
  |---|---|---|
54
55
  | botanical | Plants and flowers; the default choice | leaf `h`, sprout `f`, flower `g`, potted `c`, bloom `b`, blossom `m`, petals `P`, clover `E` |
@@ -57,7 +58,7 @@ Yarndings 12 knitting-chart glyphs: the footer band, the prose divider, the arti
57
58
  | diamond | Diamonds and rings | diamond `–` (U+2013), diamond-nested `p`, ring `?` |
58
59
  | mark | Corners, bars, dots, triangles | summit `·` (U+00B7), corner-top-left `/`, bar `(`, dot `.` |
59
60
 
60
- `codex.glyphs.roles` fixes the glyphs for the system's own ornaments (band, divider, end mark, empty state); anything else may use any approved glyph. The showcase lists every glyph.
61
+ `codex.glyphs.roles` fixes the glyphs for the system's own ornaments (band, divider, end mark, empty state); anything else may use any approved glyph. motifspec.com's Ornaments page lists every glyph.
61
62
 
62
63
  ## Do
63
64
 
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: page-actions
3
+ status: stable
4
+ layouts: [documentation]
5
+ tokens:
6
+ - space.inline.xs
7
+ ---
8
+
9
+ # Page actions
10
+
11
+ Copy page and View as Markdown, under a documentation page's title, so a reader can hand the page to an AI assistant or read its source.
12
+
13
+ ## When to use
14
+
15
+ - On documentation pages that have a Markdown copy beside them (`index.md` beside `index.html`; `docs/hugo.md`, A Markdown copy of each page).
16
+ - Under the page head's lede, before the article.
17
+
18
+ ## When not to use
19
+
20
+ - On a page with no Markdown copy; there is nothing to copy.
21
+ - On portfolio case studies and posts; they are written to be read on the site.
22
+ - For actions on the site as a whole, such as search; those belong in the header.
23
+
24
+ ## Markup
25
+
26
+ ```html {preview=true}
27
+ <div class="cx-page-actions">
28
+ <button class="cx-button cx-button--sm" type="button" data-copy-page="/guide/getting-started/index.md" hidden><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-content-copy"></use></svg><span class="cx-page-actions__label">Copy page</span></button>
29
+ <a class="cx-button cx-button--sm" href="/guide/getting-started/index.md" type="text/markdown">View as Markdown</a>
30
+ </div>
31
+ ```
32
+
33
+ In Hugo, `partial "motifspec/page-actions.html" .` writes it for a page that has the markdown output format, and nothing otherwise.
34
+
35
+ ## Do
36
+
37
+ - Put them in the page head, after the lede, so they're found before the reader starts the article.
38
+ - Keep the labels as they are: "Copy page" says what goes on the clipboard, "View as Markdown" what opens.
39
+
40
+ ## Don't
41
+
42
+ - Don't ship the copy button visible; it needs script, so it starts `hidden`.
43
+ - Don't add other actions here, such as share or print; the browser has them.
44
+
45
+ ## Accessibility
46
+
47
+ - Both are compact buttons (`button-and-link.md`), at `size.target.min`, with visible text; the icon is `aria-hidden`.
48
+ - "View as Markdown" is a real link, so it works without script and opens in a new tab on request.
49
+ - The copy button's result is in its label ("Copied" or "Couldn't copy"), which a screen reader reads when focus returns to it.
50
+ - Pairs: as `button-and-link.md`.
51
+
52
+ ## Behaviour
53
+
54
+ - **Without script:** only "View as Markdown" shows.
55
+ - **With `dist/codex.js`:** when the browser has a clipboard, the copy button is shown. A click fetches the address in `data-copy-page` and copies it as plain text. With `ClipboardItem`, the copy is written with a promise, so it still counts as part of the click while the file loads (Safari needs this); without it, the text is fetched first and written with `writeText`. The label becomes "Copied" with the `check` icon, or "Couldn't copy", and `data-state` is `copied` or `failed`; after `motion.duration.plate` it returns to "Copy page".
56
+ - An app that renders it itself does the same, or leaves only the link.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: page-footer
3
+ status: stable
4
+ layouts: [documentation]
5
+ tokens:
6
+ - border.width.hairline
7
+ - color.border.subtle
8
+ - space.inline.lg
9
+ - space.section.sm
10
+ - space.stack.lg
11
+ - space.stack.md
12
+ - space.stack.sm
13
+ ---
14
+
15
+ # Page footer
16
+
17
+ After a documentation page's article: when the page last changed and a link to edit its source, then previous and next in the order of the navigation.
18
+
19
+ ## When to use
20
+
21
+ - At the end of every documentation article, before the site footer.
22
+ - When pages are read in sequence, so a reader can go on without returning to the navigation.
23
+
24
+ ## When not to use
25
+
26
+ - On portfolio pages; their pagination moves between entries of a collection (`pagination.md`).
27
+ - When the site has no public source; leave out the edit link, not the date.
28
+
29
+ ## Markup
30
+
31
+ ```html {preview=true}
32
+ <footer class="cx-page-footer">
33
+ <p class="cx-meta">Last updated <time datetime="2026-11-04">4 November 2026</time></p>
34
+ <a class="cx-link" href="https://github.com/owner/repo/edit/main/docs/guide/getting-started.md"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-edit"></use></svg>Edit this page<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg></a>
35
+ </footer>
36
+ <nav class="cx-pagination" aria-label="Documentation pages">
37
+ <a class="cx-pagination__link" href="/guide/" rel="prev">
38
+ <span class="cx-pagination__dir"><svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-back"></use></svg>Previous</span>
39
+ <span class="cx-pagination__title">Overview</span>
40
+ </a>
41
+ <p class="cx-pagination__status">Guide<strong>2 / 12</strong></p>
42
+ <a class="cx-pagination__link" href="/guide/choosing-a-layout/" rel="next">
43
+ <span class="cx-pagination__dir">Next<svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-forward"></use></svg></span>
44
+ <span class="cx-pagination__title">Choosing a layout</span>
45
+ </a>
46
+ </nav>
47
+ ```
48
+
49
+ In Hugo, `partial "motifspec/page-footer.html" .` writes the footer (a page made by a content adapter from another file names that file's repository path as its `source` param, for the edit link) and `partial "motifspec/pagination-docs.html" .` the previous and next links, in the order `docs-nav.html` lists the pages (`docs/hugo.md`).
50
+
51
+ ## Do
52
+
53
+ - Show the date the content last changed, from version control where possible, written as a reader would say it ("4 November 2026").
54
+ - Link "Edit this page" to the page's source file, not to a generated copy.
55
+ - Name the group in the pagination's middle cell, with the page's position in the whole set.
56
+
57
+ ## Don't
58
+
59
+ - Don't show a date that changes on every build; a reader can't tell a fresh page from a rebuilt one.
60
+ - Don't open the edit link in a new window by force; the outward arrow says where it goes.
61
+
62
+ ## Accessibility
63
+
64
+ - The date is a `<time>` with a machine-readable `datetime`.
65
+ - The edit link's text says what it does; both icons are `aria-hidden`, and the outward arrow repeats that it leaves the site.
66
+ - The pagination is a `<nav>` named "Documentation pages", separate from the navigation's "Documentation". Pairs and targets as `pagination.md`.
67
+ - Pairs: `color.text.muted` on `color.surface.base` (4.5:1) for the date; `color.link.rest` on `color.surface.base` (7:1).
@@ -38,6 +38,7 @@ A three-cell bar: previous with its title, current position, and next with its t
38
38
 
39
39
  - At the end of a post or case study, to the previous and next entries in the collection.
40
40
  - Below a paginated index ("Page 2 / 5"), with the page titles replaced by "Newer" and "Older".
41
+ - Between documentation pages, in the order of the docs navigation (`page-footer.md`, `pagination-docs.html`).
41
42
 
42
43
  ## When not to use
43
44
 
@@ -46,7 +47,7 @@ A three-cell bar: previous with its title, current position, and next with its t
46
47
 
47
48
  ## Markup
48
49
 
49
- ```html preview
50
+ ```html {preview=true}
50
51
  <nav class="cx-pagination" aria-label="Post navigation">
51
52
  <a class="cx-pagination__link" href="/writing/instancing-arcs/" rel="prev">
52
53
  <span class="cx-pagination__dir"><svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-back"></use></svg>Previous</span>
@@ -55,7 +55,7 @@ One ledger row in a list of writing: catalogue number, date and reading time bes
55
55
 
56
56
  ## Markup
57
57
 
58
- ```html preview
58
+ ```html {preview=true}
59
59
  <h2 class="cx-posts__year">2026</h2>
60
60
  <ol class="cx-posts" reversed>
61
61
  <li class="cx-post">
@@ -46,7 +46,7 @@ A framed summary of one project that links to its case study.
46
46
 
47
47
  ## Markup
48
48
 
49
- ```html preview
49
+ ```html {preview=true}
50
50
  <ul class="cx-cards">
51
51
  <li>
52
52
  <article class="cx-card">
@@ -50,6 +50,7 @@ tokens:
50
50
  - size.measure.code
51
51
  - size.measure.prose
52
52
  - size.ornament.sm
53
+ - size.target.touch
53
54
  - space.inline.md
54
55
  - space.inline.sm
55
56
  - space.inline.xs
@@ -80,7 +81,7 @@ Styles for Markdown-rendered long-form content: headings, paragraphs, lists, blo
80
81
 
81
82
  ## Markup
82
83
 
83
- ```html preview
84
+ ```html {preview=true}
84
85
  <div class="cx-prose">
85
86
  <p>A token without a rule is a colour with a name, so the <a href="/writing/rules/">description becomes the contract</a>.</p>
86
87
  <h2 id="why">Why tokens need rules <a class="cx-anchor" href="#why" aria-label="Link to Why tokens need rules">#</a></h2>