@aitrien/motifspec 1.19.0 → 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 (36) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +88 -70
  3. package/dist/codex.css +53 -3
  4. package/dist/codex.js +1 -1
  5. package/dist/tokens.css +1 -1
  6. package/dist/tokens.js +1 -1
  7. package/dist/tokens.json +1 -1
  8. package/docs/components/_template.md +1 -0
  9. package/docs/components/accession-label.md +1 -0
  10. package/docs/components/backdrop.md +5 -5
  11. package/docs/components/docs-shell.md +2 -1
  12. package/docs/components/figure.md +1 -0
  13. package/docs/components/ornament.md +2 -1
  14. package/docs/components/page-footer.md +1 -1
  15. package/docs/components/prose.md +1 -0
  16. package/docs/components/site-footer.md +2 -2
  17. package/docs/components/specimen-plate.md +1 -1
  18. package/docs/components/status.md +1 -0
  19. package/docs/components/token-table.md +96 -0
  20. package/docs/hugo.md +8 -4
  21. package/docs/layouts/a-la-carte.md +1 -0
  22. package/docs/layouts/dashboard.md +2 -0
  23. package/docs/layouts/documentation.md +7 -4
  24. package/docs/layouts/portfolio.md +2 -0
  25. package/docs/syntax-highlighting.md +1 -0
  26. package/layouts/_markup/render-blockquote.html +1 -1
  27. package/layouts/_markup/render-image.html +5 -4
  28. package/layouts/_markup/render-link.html +1 -1
  29. package/layouts/_markup/render-table.html +3 -2
  30. package/layouts/_partials/motifspec/article.html +12 -7
  31. package/layouts/_partials/motifspec/body-start.html +5 -4
  32. package/layouts/_partials/motifspec/docs-nav.html +2 -2
  33. package/layouts/_partials/motifspec/page-footer.html +11 -5
  34. package/layouts/_partials/motifspec/site-header.html +1 -1
  35. package/package.json +6 -4
  36. package/scripts/lib.mjs +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  Every release of MotifSpec (named brand-codex until 1.10.0), newest first. Entries before 1.10.0 keep the names they were released under. Versions follow the rules in `CONVENTIONS.md`: renaming or removing a semantic token is major, adding tokens, components or icons is minor, and changing a value or fixing a description is a patch. `npm run build` fails if the version in `package.json` has no entry here.
4
4
 
5
+ ## [1.20.0] - 2026-11-05
6
+
7
+ ### Added
8
+ - motifspec.com is a documentation site built with the documentation layout from this repository (`site/`), in place of the one-page showcase. Every page is made from a file the repository already keeps: the component and layout docs, `docs/hugo.md`, the README's guide sections, `CONVENTIONS.md`, `CHANGELOG.md`, and pages generated from the tokens, icons and checker rules. It has search, a Markdown copy of every page, `llms.txt`, an A to Z page and a landing page. Links to the old page's sections (such as `/#components`) go to the pages that replaced them.
9
+ - `npm run docs`, `docs:check` and `docs:quality` build the site, check it, and run Lighthouse's accessibility audit on it. CI runs them, with a link check, on every pull request; a release publishes the site.
10
+ - Token table (`token-table.md`, documentation layout): colour tiles with their name and value written on them, a primitive palette, type samples, spacing bars and contrast samples in data tables, for reference pages generated from the tokens. motifspec.com's Colour, Type, Space and size, Motion, Icons, Ornaments, Tokens, Contrast pairs and Checker rules pages use it.
11
+ - A deprecated component's doc has a `deprecated:` line saying what replaces it and when it goes; the validator requires it. `docs-nav.html` says "(deprecated)" after the title of a page that sets `deprecated`.
12
+ - `article.html` takes `"toc" "never"`, for a page such as a changelog whose headings repeat.
13
+ - `page-footer.html` reads a page's `source` param, the repository path of the file a content adapter made the page from, so Edit this page works for pages with no file of their own.
14
+
15
+ ### Changed
16
+ - A documentation site's home page is a landing page (`docs/layouts/documentation.md`, Landing, which replaces Docs home): full width outside the docs shell, with the head and foot of the backdrop as on a portfolio's home page. `body-start.html` writes the head there and the side on every other page.
17
+ - On a documentation site, `article.html` leaves out the end mark: the layout's only ornament is the footer band, as `docs/layouts/documentation.md` says.
18
+ - The README's setup is grouped as Getting started (Hugo, npm, an AI assistant), Checking a project and The MCP server, the sections motifspec.com renders as pages. Every table in the README, `CONVENTIONS.md` and the docs has a caption, in an HTML comment before it that GitHub doesn't show.
19
+
20
+ ### Removed
21
+ - The showcase: `showcase/`, `dist/showcase.html` and `dist/showcase.standalone.html`, which the npm package never shipped. `npm run audit` now checks `dist/codex.css` directly. The `showcase` URL in `package.json`, `tokens.json` and `tokens.js` keeps its name and now means the docs site.
22
+
23
+ ### Fixed
24
+ - On a phone, the search trigger in the header had no accessible name: its label was removed with `display: none`. It is now visually hidden, so the icon-only button is still announced as "Search".
25
+ - The site header no longer marks a menu entry without an `identifier`, such as an external link, as the current page on the home page, whose section is empty.
26
+ - The render hooks for tables, blockquotes, images and links, and `article.html`, no longer fail on a page that has no content file, such as one made by a content adapter.
27
+
5
28
  ## [1.19.0] - 2026-11-04
6
29
 
7
30
  ### Added
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # MotifSpec
2
2
 
3
- Liam Marshall's design system: the single source of truth for aitrien.com and every project after it. The showcase is at [motifspec.com](https://motifspec.com). Tokens are [DTCG](https://www.designtokens.org/) JSON, components are documented rules with markup to copy, one checker holds every project that uses it to those rules, and an MCP server gives AI assistants all three.
3
+ Liam Marshall's design system: the single source of truth for aitrien.com and every project after it. The documentation is at [motifspec.com](https://motifspec.com), which renders this README's guide sections, the docs and the changelog from this repository. Tokens are [DTCG](https://www.designtokens.org/) JSON, components are documented rules with markup to copy, one checker holds every project that uses it to those rules, and an MCP server gives AI assistants all three.
4
+
4
5
 
5
6
  ## Principles
6
7
 
@@ -16,6 +17,7 @@ Liam Marshall's design system: the single source of truth for aitrien.com and ev
16
17
 
17
18
  A layout is a kind of site: its shell, page templates, components, decoration and heading rules. Pick the one that fits before choosing components.
18
19
 
20
+ <!-- caption: Layouts -->
19
21
  | Layout | For | File |
20
22
  |---|---|---|
21
23
  | Portfolio | Case studies, writing and an about page | `docs/layouts/portfolio.md` |
@@ -53,74 +55,23 @@ An à la carte project also lists the components it uses, by doc name: `componen
53
55
  - Write sample and placeholder content from scratch. Never copy wording from reference or competitor sites; quote only with a named person and a traceable source in the blockquote footer.
54
56
  - Give every section `<h2>` in reading text an id and a `cx-anchor` link (see `docs/components/heading-anchor.md`). Dashboard sections have an id and no anchor.
55
57
 
56
- ## What's here
58
+ ## Getting started
57
59
 
58
- ```
59
- LICENSE MIT, for code, tokens and docs
60
- AGENTS.md Instructions for AI agents changing this repo (CLAUDE.md points to it)
61
- CHANGELOG.md Every release, newest first (the build fails without an entry for the current version)
62
- tokens/ DTCG source of truth (color, typography, space, size, radius, border, motion)
63
- css/components.css Reference implementation of every component (tokens only)
64
- syntax/chroma.json Hugo Chroma class → token mapping
65
- icons/ Approved Material Symbols (manifest.json, source SVGs, Apache-2.0 LICENSE)
66
- docs/components/ One rule file per component (front-matter token lists generated from the CSS)
67
- docs/layouts/ One file per layout: shell, page templates, components, decoration, headings, stack
68
- docs/hugo.md The Hugo partials and render hooks, their contexts and the front matter they read
69
- layouts/ Hugo partials (_partials/motifspec/) and Markdown render hooks (_markup/), mounted by the module
70
- docs/syntax-highlighting.md
71
- fonts/ Self-hosted WOFF2 (Latin subsets) and their OFL licences
72
- scripts/ validate, build, audit, check (the rule checker projects run), pack-check and release
73
- js/codex.js Theme toggle, copy buttons, tooltip dismissal, TOC docking and active section (shared by sites and the showcase)
74
- js/theme-init.js One-line <head> snippet that applies a stored theme before first paint
75
- js/plate.js Contour survey generator for the backdrop and the specimen plate: draws the static contours at build time and animates them in the browser
76
- showcase/ Source of the system's showcase page
77
- mcp/ The MCP server (server.mjs), its Lambda handler, bundle step and tests
78
- infra/mcp.yml The server's AWS stack and deploy role (CloudFormation, applied by hand)
79
- hugo.toml, go.mod Hugo module definition and its mounts
80
- dist/ Generated: tokens.css, components in codex.css, chroma.css, fonts.css, icons.svg (sprite), tokens.json, tokens.js (ES module export), codex.js and theme-init.js (behaviour), backdrop.html, backdrop-foot.html and backdrop-side.html, plate.html and plate.js (backdrop and specimen plate), contrast.md, showcase.html (fragment for publishing), showcase.standalone.html (open locally)
81
- ```
60
+ MotifSpec reaches a project three ways: as a Hugo module, as an npm package, or through an AI assistant connected to its MCP server. Choose the layout first ([Layouts](#layouts)).
82
61
 
83
- ## Commands
84
-
85
- ```sh
86
- npm run validate # naming rules, tiers, aliases, DTCG value shapes, every contrast pair in both themes
87
- npm run build # validate, then write dist/ and refresh generated doc tables
88
- npm run audit # prove dist/showcase.html and the shipped scripts have no raw colour, size or duration outside :root
89
- npm run release:check # what merging this would release, and whether that release is valid
90
- npm run pack:check # the npm package has every file the README and package.json promise
91
- npm run check -- <dir> # check a project that uses MotifSpec (see below)
92
- npm run test:mcp # call every MCP tool through the Lambda handler
93
- npm run mcp:bundle # build/mcp.zip, the server's Lambda package
94
- ```
95
-
96
- `scripts/check.mjs` is the one rule checker: this repo's audit runs it on `layouts/` and the component docs' markup, and projects run it from the version they pin. It checks a project's `layouts/` and `content/` against the release it comes from, and fails on:
97
-
98
- - a stylesheet anywhere in the project, or a `style` attribute
99
- - a raw colour, or a number with a length or time unit (zero is allowed)
100
- - a primitive, unknown or deprecated `--cx-` token
101
- - a `cx-` class that the stylesheet and scripts don't define, or a `cx-icon-` that isn't in `icons/manifest.json`
102
- - "·" used as a separator
103
- - an unknown layout, or an unknown component in an à la carte list
104
- - in an à la carte project's own stylesheet, the same raw values and tokens, and any selector that targets a `cx-` class
105
-
106
- It warns, without failing, when a component (its classes or its Hugo partial) is used outside its layouts, or an à la carte project uses a layout component it hasn't listed. These become failures in a later release.
107
-
108
- Releases are automatic; `CONVENTIONS.md` (Versioning) says how.
109
-
110
- Node 20 or later. The package has no dependencies; the MCP server's are dev dependencies, bundled into its deployment.
111
-
112
- ## Using it in Hugo
62
+ ### In a Hugo site
113
63
 
114
64
  Import `github.com/aitrien/motifspec` as a Hugo module and pin a release with `hugo mod get github.com/aitrien/motifspec@vX.Y.Z`. The site then gets the CSS, scripts, fonts, component partials and Markdown render hooks; `docs/hugo.md` covers setup, every partial and the front matter they read.
115
65
 
116
- ## Using it from npm
66
+ ### From npm
117
67
 
118
68
  ```sh
119
69
  npm install --save-exact @aitrien/motifspec
120
70
  ```
121
71
 
122
- Pin an exact version, as a Hugo site pins a tag: the version you install is the version the checker holds you to. The package has the CSS, scripts, tokens, fonts, icons, component docs, Hugo templates and the checker; it leaves out the showcase.
72
+ Pin an exact version, as a Hugo site pins a tag: the version you install is the version the checker holds you to. The package has the CSS, scripts, tokens, fonts, icons, component docs, Hugo templates and the checker; it leaves out the docs site.
123
73
 
74
+ <!-- caption: npm imports -->
124
75
  | Import | What it is |
125
76
  |---|---|
126
77
  | `@aitrien/motifspec/codex.css` | Tokens, fonts and every component. Its font URLs are `../fonts/…`, so a bundler that copies assets (Vite, webpack, Parcel) resolves them from the package. Without a bundler, serve `dist/` and `fonts/` side by side. |
@@ -133,7 +84,34 @@ Pin an exact version, as a Hugo site pins a tag: the version you install is the
133
84
  | `@aitrien/motifspec/check` | `checkText` and `checkProject` from the rule checker. |
134
85
  | `@aitrien/motifspec/fonts/*` | The WOFF2 files, for preloading. |
135
86
 
136
- Copy component markup from `docs/components/*.md` (in the package under `node_modules/@aitrien/motifspec/docs/`). For React and similar, the MCP server's `get_component` with `form: "jsx"` gives the same examples as JSX, converted mechanically; components with script describe what to implement in their Behaviour section. Then check the project, pointing `--dirs` at the folders with your markup:
87
+ Copy component markup from `docs/components/*.md` (in the package under `node_modules/@aitrien/motifspec/docs/`). For React and similar, the MCP server's `get_component` with `form: "jsx"` gives the same examples as JSX, converted mechanically; components with script describe what to implement in their Behaviour section.
88
+
89
+ ### With an AI assistant
90
+
91
+ The MCP server at `https://mcp.motifspec.com/mcp` serves the latest release to any assistant that supports remote MCP servers. It needs no sign-in and only reads. [The MCP server](#the-mcp-server) lists its tools.
92
+
93
+ To connect it:
94
+
95
+ - **Claude (web, desktop):** Customize → Connectors → Add custom connector, with the URL above and "No sign in".
96
+ - **Claude Code:** `claude mcp add --transport http motifspec https://mcp.motifspec.com/mcp`, or a project `.mcp.json`.
97
+ - **VS Code:** add it to `.vscode/mcp.json` with `"type": "http"` and the URL.
98
+ - **Others:** add a remote MCP server by URL.
99
+
100
+ ## Checking a project
101
+
102
+ `scripts/check.mjs` is the one rule checker: this repo's audit runs it on `layouts/` and the component docs' markup, and projects run it from the version they pin. It checks a project's `layouts/` and `content/` against the release it comes from, and fails on:
103
+
104
+ - a stylesheet anywhere in the project, or a `style` attribute
105
+ - a raw colour, or a number with a length or time unit (zero is allowed)
106
+ - a primitive, unknown or deprecated `--cx-` token
107
+ - a `cx-` class that the stylesheet and scripts don't define, or a `cx-icon-` that isn't in `icons/manifest.json`
108
+ - "·" used as a separator
109
+ - an unknown layout, or an unknown component in an à la carte list
110
+ - in an à la carte project's own stylesheet, the same raw values and tokens, and any selector that targets a `cx-` class
111
+
112
+ It warns, without failing, when a component (its classes or its Hugo partial) is used outside its layouts, or an à la carte project uses a layout component it hasn't listed. These become failures in a later release.
113
+
114
+ In a Hugo site, run `node <module>/scripts/check.mjs .`, where `hugo config mounts` gives `<module>` (`docs/hugo.md`). Outside Hugo, run it from the package, pointing `--dirs` at the folders with your markup:
137
115
 
138
116
  ```sh
139
117
  npx motifspec-check . --dirs src
@@ -141,29 +119,22 @@ npx motifspec-check . --dirs src
141
119
 
142
120
  Add `--layout dashboard` (or the project's layout) so components are checked against it; à la carte projects add `--components` with their list. It reads `.html`, `.jsx`, `.tsx`, `.vue`, `.svelte`, `.astro`, `.md` and `.mdx` (both `class` and `className`), and skips `node_modules`, `dist` and `build`. Its stylesheet rule applies here too: a project using MotifSpec has no CSS of its own, except an à la carte project's frame (`docs/layouts/a-la-carte.md`).
143
121
 
144
- ## Using it from an AI assistant
145
-
146
- The MCP server at `https://mcp.motifspec.com/mcp` serves the latest release to any assistant that supports remote MCP servers. It needs no sign-in and only reads.
122
+ ## The MCP server
147
123
 
124
+ <!-- caption: MCP tools -->
148
125
  | Tool | What it returns |
149
126
  |---|---|
150
- | `get_rules` | The rules above, and what the checker enforces |
127
+ | `get_rules` | The [rules for AI assistants](#rules-for-ai-assistants), and what the checker enforces |
151
128
  | `find_tokens` | Semantic tokens matching a query: CSS property, usage rule, light and dark values, the surfaces a colour may sit on |
152
129
  | `get_component` | A component's doc (markup, do and don't, accessibility, behaviour). `form` picks the markup: `html`, `jsx` or `hugo` (with its partial); without it, the HTML and the partial. Without a name, the list with each component's layouts |
153
130
  | `get_doc` | `docs/hugo.md`, or a layout from `docs/layouts/` (`portfolio`, `dashboard`, `documentation`, `a-la-carte`) |
154
131
  | `check` | The checker's problems in a piece of markup, Markdown or CSS; with a `layout`, warnings for components from other layouts |
155
132
 
156
- To connect it:
157
-
158
- - **Claude (web, desktop):** Customize → Connectors → Add custom connector, with the URL above and "No sign in".
159
- - **Claude Code:** `claude mcp add --transport http motifspec https://mcp.motifspec.com/mcp`, or a project `.mcp.json`.
160
- - **VS Code:** add it to `.vscode/mcp.json` with `"type": "http"` and the URL.
161
- - **Others:** add a remote MCP server by URL.
162
-
163
133
  It serves the latest release. A project pinned to an older version can be offered something its version doesn't have yet; its own checker, at its pinned version, catches that.
164
134
 
165
135
  ## The identity in brief
166
136
 
137
+ <!-- caption: The identity in brief -->
167
138
  | | |
168
139
  |---|---|
169
140
  | Concept | A specimen ledger: an archival botanical compendium drawn as a technical catalogue, with a US national-park signage voice. |
@@ -176,6 +147,53 @@ It serves the latest release. A project pinned to an older version can be offere
176
147
 
177
148
  See `CONVENTIONS.md` for naming, tiers, extensions and versioning.
178
149
 
150
+ ## What's here
151
+
152
+ ```
153
+ LICENSE MIT, for code, tokens and docs
154
+ AGENTS.md Instructions for AI agents changing this repo (CLAUDE.md points to it)
155
+ CHANGELOG.md Every release, newest first (the build fails without an entry for the current version)
156
+ tokens/ DTCG source of truth (color, typography, space, size, radius, border, motion)
157
+ css/components.css Reference implementation of every component (tokens only)
158
+ syntax/chroma.json Hugo Chroma class → token mapping
159
+ icons/ Approved Material Symbols (manifest.json, source SVGs, Apache-2.0 LICENSE)
160
+ docs/components/ One rule file per component (front-matter token lists generated from the CSS)
161
+ docs/layouts/ One file per layout: shell, page templates, components, decoration, headings, stack
162
+ docs/hugo.md The Hugo partials and render hooks, their contexts and the front matter they read
163
+ layouts/ Hugo partials (_partials/motifspec/) and Markdown render hooks (_markup/), mounted by the module
164
+ docs/syntax-highlighting.md
165
+ fonts/ Self-hosted WOFF2 (Latin subsets) and their OFL licences
166
+ scripts/ validate, build, audit, check (the rule checker projects run), pack-check, release, and docs with docs-reference (motifspec.com and its generated pages)
167
+ js/codex.js Theme toggle, copy buttons, tooltip dismissal, TOC docking and active section, search, tabs and the component preview
168
+ js/theme-init.js One-line <head> snippet that applies a stored theme before first paint
169
+ js/plate.js Contour survey generator for the backdrop and the specimen plate: draws the static contours at build time and animates them in the browser
170
+ site/ motifspec.com: a Hugo site whose pages are made from this README's sections, docs/, CONVENTIONS.md and CHANGELOG.md
171
+ mcp/ The MCP server (server.mjs), its Lambda handler, bundle step and tests
172
+ infra/mcp.yml The server's AWS stack and deploy role (CloudFormation, applied by hand)
173
+ hugo.toml, go.mod Hugo module definition and its mounts
174
+ dist/ Generated: tokens.css, components in codex.css, chroma.css, fonts.css, icons.svg (sprite), tokens.json, tokens.js (ES module export), codex.js and theme-init.js (behaviour), backdrop.html, backdrop-foot.html and backdrop-side.html, plate.html and plate.js (backdrop and specimen plate), contrast.md
175
+ ```
176
+
177
+ ## Commands
178
+
179
+ ```sh
180
+ npm run validate # naming rules, tiers, aliases, DTCG value shapes, every contrast pair in both themes
181
+ npm run build # validate, then write dist/ and refresh generated doc tables
182
+ npm run audit # prove codex.css and the shipped scripts have no raw colour, size or duration outside :root
183
+ npm run release:check # what merging this would release, and whether that release is valid
184
+ npm run pack:check # the npm package has every file the README and package.json promise
185
+ npm run check -- <dir> # check a project that uses MotifSpec (Checking a project, above)
186
+ npm run test:mcp # call every MCP tool through the Lambda handler
187
+ npm run mcp:bundle # build/mcp.zip, the server's Lambda package
188
+ npm run docs # build motifspec.com into site/public and index it for search (needs Hugo extended)
189
+ npm run docs:check # run the checker on the site
190
+ npm run docs:quality # Lighthouse accessibility on four pages of the built site (needs Chrome)
191
+ ```
192
+
193
+ Releases are automatic; `CONVENTIONS.md` (Versioning) says how.
194
+
195
+ Node 20 or later. The package has no dependencies; the MCP server's are dev dependencies, bundled into its deployment.
196
+
179
197
  ## Licence
180
198
 
181
199
  The code, tokens and docs are MIT (`LICENSE`). The fonts keep their SIL Open Font Licences (`fonts/OFL-*.txt`) and the icons their Apache-2.0 licence (`icons/LICENSE`).
package/dist/codex.css CHANGED
@@ -2,7 +2,7 @@
2
2
  @font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-wght.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }
3
3
  @font-face { font-family: "Yarndings 12"; src: url("../fonts/yarndings-12-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: block; }
4
4
 
5
- /* MotifSpec 1.19.0 — generated from tokens/*.json. Do not edit.
5
+ /* MotifSpec 1.20.0 — generated from tokens/*.json. Do not edit.
6
6
  Themes: semantic colours use light-dark(); color-scheme follows the system unless
7
7
  <html data-theme="light|dark"> pins it. --cx-primitive-* are for this file only. */
8
8
  :root {
@@ -653,7 +653,13 @@ p, li, dd, figcaption { text-wrap: pretty; }
653
653
  .cx-search__excerpt mark { background: var(--cx-color-surface-highlight); color: var(--cx-color-text-primary); }
654
654
  @media (width < 48rem) {
655
655
  .cx-search-trigger { width: var(--cx-size-target-touch); padding: 0; justify-content: center; }
656
- .cx-search-trigger__label, .cx-search-trigger__keys { display: none; }
656
+ .cx-search-trigger__keys { display: none; }
657
+ /* Icon only on a phone, but the label stays as the button's name (visually hidden, as cx-visually-hidden). */
658
+ .cx-search-trigger__label {
659
+ position: absolute; width: var(--cx-border-width-hairline); height: var(--cx-border-width-hairline);
660
+ margin: calc(var(--cx-border-width-hairline) * -1); padding: 0; overflow: hidden;
661
+ clip-path: inset(50%); white-space: nowrap; border: 0;
662
+ }
657
663
  }
658
664
  /* The header's version, when it has one: the release a docs site describes, linking to its changelog. */
659
665
  .cx-header__version { display: inline-flex; align-items: center; min-height: var(--cx-size-target-touch); padding-inline: var(--_nav-pad); border-radius: var(--cx-radius-pill); color: var(--cx-color-text-secondary); font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); text-decoration: none; }
@@ -1092,6 +1098,50 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
1092
1098
  .cx-table td.is-actions { width: 1%; white-space: nowrap; }
1093
1099
  .cx-table__actions { display: flex; justify-content: flex-end; gap: var(--cx-space-inline-xs); }
1094
1100
 
1101
+ /* ------------------------------------------------------------ token table (token-table.md, documentation layout) */
1102
+ /* What a token looks like, beside its name and rule, on the reference pages that MotifSpec's docs generator writes
1103
+ from dist/tokens.json. Each shows a value from a private custom property the generator sets on the element
1104
+ (--_swatch; --_fg and --_bg; --_size and --_family; --_width). That is the one place MotifSpec writes a style
1105
+ attribute, and only in generated pages; without it each falls back to a neutral look. */
1106
+ .cx-swatch {
1107
+ display: inline-block; flex: none; vertical-align: middle;
1108
+ width: var(--cx-size-target-min); height: var(--cx-size-target-min); margin-right: var(--cx-space-inline-sm);
1109
+ border: var(--cx-border-width-hairline) solid var(--cx-color-border-default);
1110
+ background: var(--_swatch, var(--cx-color-surface-sunken));
1111
+ }
1112
+ /* A tile: the colour as the background, with its name and value written on it in the ink the generator picks for
1113
+ contrast (--_ink: the darkest or lightest neutral, whichever reads better on that colour). */
1114
+ .cx-swatch--tile {
1115
+ display: inline-flex; flex-direction: column; justify-content: space-between; gap: var(--cx-space-stack-xs); vertical-align: top;
1116
+ width: auto; min-width: calc(var(--cx-size-target-touch) * 2.4); height: auto; min-height: var(--cx-size-target-touch);
1117
+ margin: 0; padding: var(--cx-space-inset-xs) var(--cx-space-inset-sm);
1118
+ border-color: var(--cx-color-border-subtle); color: var(--_ink, var(--cx-color-text-primary));
1119
+ font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); line-height: var(--cx-font-line-height-ui);
1120
+ font-variant-numeric: tabular-nums; white-space: nowrap;
1121
+ }
1122
+ .cx-swatch--tile b { font-weight: var(--cx-font-weight-strong); }
1123
+ .cx-palette, .cx-prose .cx-palette {
1124
+ display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--cx-size-target-touch) * 2.4), 1fr));
1125
+ gap: var(--cx-space-inline-xs); margin: 0; padding: 0; list-style: none;
1126
+ }
1127
+ .cx-palette > li::marker { content: none; }
1128
+ .cx-prose .cx-palette > li { margin: 0; padding: 0; }
1129
+ .cx-palette .cx-swatch--tile { display: flex; width: 100%; min-height: calc(var(--cx-size-target-touch) * 1.6); }
1130
+ /* In a token table (cx-table cx-token-table) a token's name stays on one line; the table scrolls sideways instead. */
1131
+ .cx-token-table th[scope="row"] code { white-space: nowrap; }
1132
+ .cx-token-sample {
1133
+ display: block; margin: 0; white-space: nowrap; font-size: var(--_size, inherit); font-family: var(--_family, inherit);
1134
+ line-height: var(--cx-font-line-height-heading); color: var(--cx-color-text-primary); overflow-wrap: anywhere;
1135
+ }
1136
+ .cx-token-bar { display: block; width: var(--_width, 0%); height: var(--cx-space-inset-sm); background: var(--cx-color-accent-fill-rest); }
1137
+ .cx-pair-sample {
1138
+ display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
1139
+ min-width: var(--cx-size-target-control); min-height: var(--cx-size-target-min); margin-right: var(--cx-space-inline-sm);
1140
+ border: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle);
1141
+ color: var(--_fg, var(--cx-color-text-primary)); background: var(--_bg, var(--cx-color-surface-base));
1142
+ font-family: var(--cx-font-family-body); font-weight: var(--cx-font-weight-strong);
1143
+ }
1144
+
1095
1145
  /* ------------------------------------------------------------ project card */
1096
1146
  .cx-cards { display: grid; gap: var(--cx-space-gutter-grid); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--cx-size-column-card)), 1fr)); margin: 0; padding: 0; list-style: none; }
1097
1147
  .cx-card {
@@ -1236,7 +1286,7 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
1236
1286
  footer and reading happens on the plain surface. Two layers, each size.backdrop.fade tall and scrolling with the page:
1237
1287
  the head (home page only, first child of the page) and the foot (every page, at the bottom). */
1238
1288
  :root:has(.cx-backdrop-page) { background: var(--cx-color-surface-base); }
1239
- /* When the page class sits on a wrapper (a fragment such as the showcase), body's own surface would cover the backdrop. */
1289
+ /* When the page class sits on a wrapper rather than <body>, body's own surface would cover the backdrop. */
1240
1290
  body:not(.cx-backdrop-page):has(.cx-backdrop-page) { background: transparent; }
1241
1291
  /* Positioned so the layers can sit at its top and bottom; no z-index, so the layers still paint under its surface. */
1242
1292
  .cx-backdrop-page {
package/dist/codex.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // MotifSpec behaviour: theme toggle, the backdrop header's scroll state, tooltip dismissal, code copy buttons,
2
2
  // TOC docking and active section.
3
- // Shipped as dist/codex.js (@aitrien/motifspec/codex.js) and inlined into the showcase, so there is one implementation.
3
+ // Shipped as dist/codex.js (@aitrien/motifspec/codex.js).
4
4
  // Enhancement only. Without this script: themes follow the system, code is selectable, the TOC is a plain open list,
5
5
  // and every control that needs script stays hidden. Load it with `defer`; it also works inline at the end of <body>.
6
6
  // Pair it with dist/theme-init.js inline in <head>, which applies a stored theme before first paint.
package/dist/tokens.css CHANGED
@@ -1,4 +1,4 @@
1
- /* MotifSpec 1.19.0 — generated from tokens/*.json. Do not edit.
1
+ /* MotifSpec 1.20.0 — generated from tokens/*.json. Do not edit.
2
2
  Themes: semantic colours use light-dark(); color-scheme follows the system unless
3
3
  <html data-theme="light|dark"> pins it. --cx-primitive-* are for this file only. */
4
4
  :root {
package/dist/tokens.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Generated by npm run build. Do not edit.
2
- export const version = "1.19.0";
2
+ export const version = "1.20.0";
3
3
  export const changelog = "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md";
4
4
  export const showcase = "https://motifspec.com";
5
5
  export const tokens = [
package/dist/tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.19.0",
2
+ "version": "1.20.0",
3
3
  "changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
4
4
  "showcase": "https://motifspec.com",
5
5
  "tokens": [
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: component-name
3
3
  status: draft # draft | stable | deprecated
4
+ # deprecated: Use x instead; removed in 2.0.0. # required when status is deprecated
4
5
  layouts: [shared] # [shared], or the layouts it belongs to: portfolio, dashboard, documentation
5
6
  tokens: # semantic tokens this component uses
6
7
  - color.accent
@@ -52,6 +52,7 @@ The system's signature: a herbarium-style label that gives an entry its catalogu
52
52
 
53
53
  `LM-{collection}-{sequence}`, with the sequence zero-padded to three digits and never reused.
54
54
 
55
+ <!-- caption: Catalogue numbers -->
55
56
  | Collection | Code | Example |
56
57
  |---|---|---|
57
58
  | Work (projects, case studies) | `W` | `LM-W-004` |
@@ -28,13 +28,13 @@ Contour surveys drawn full-bleed behind the top of the home page and the bottom
28
28
 
29
29
  - The foot on every page of a portfolio, 404 included (`docs/layouts/portfolio.md`).
30
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 of a documentation site, down the left edge behind the navigation, with the foot in its place on a phone (`docs/layouts/documentation.md`).
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`).
32
32
  - On a dashboard, behind the main area, as `docs/layouts/dashboard.md` says.
33
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.
34
34
 
35
35
  ## When not to use
36
36
 
37
- - 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.
38
38
  - Inside a component or as a section background. The frost belongs to the page's top and bottom.
39
39
  - Behind layouts that need the plain surface from the very top, such as a full-screen app or a print stylesheet.
40
40
 
@@ -60,9 +60,9 @@ From the bottom up: the canvas (`color.surface.base`), the contours (the specime
60
60
 
61
61
  ### The side
62
62
 
63
- A documentation site reads from the top of every page, 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.
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
64
 
65
- In Hugo, with `params.motifspec.layout = "documentation"`, `motifspec/body-start.html` inlines the side on every page instead of the head (`docs/hugo.md`). Elsewhere, put the side's markup where the head would go and keep the foot after the footer.
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
66
 
67
67
  ### The calm side
68
68
 
@@ -79,7 +79,7 @@ Where text sits on the frost, the contours keep only `color.backdrop.calm` of th
79
79
 
80
80
  - Don't give sections, panels or cards a frosted background of their own.
81
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.
82
- - Don't put the head on pages other than the home page, or more than one head, side or foot on a page. The head and the side don't go on the same 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.
83
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.
84
84
  - Don't raise `color.backdrop.grain` until the noise competes with text, and don't give the grain a `mix-blend-mode`.
85
85
  - Don't put text, links or controls in the backdrop.
@@ -40,7 +40,7 @@ The frame of a documentation page: grouped page navigation on the left, the page
40
40
 
41
41
  ## When to use
42
42
 
43
- - On every page of a documentation site (`docs/layouts/documentation.md`), the docs home included.
43
+ - On every page of a documentation site except the landing page (`docs/layouts/documentation.md`), which is full width.
44
44
  - When readers move between many pages in a set order: guides, reference, a changelog.
45
45
 
46
46
  ## When not to use
@@ -100,6 +100,7 @@ In Hugo, `partial "motifspec/docs-nav.html" .` writes the navigation from the si
100
100
  - Group pages by what the reader is trying to do, in the order they'll need them: a guide before reference.
101
101
  - Keep group names to one or two words, and page titles short enough for one line in the column.
102
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`.
103
104
  - Leave every group open unless the navigation is long; a reader scans more easily than they click.
104
105
 
105
106
  ## Don't
@@ -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. |
@@ -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
 
@@ -46,7 +46,7 @@ After a documentation page's article: when the page last changed and a link to e
46
46
  </nav>
47
47
  ```
48
48
 
49
- In Hugo, `partial "motifspec/page-footer.html" .` writes the footer and `partial "motifspec/pagination-docs.html" .` the previous and next links, in the order `docs-nav.html` lists the pages (`docs/hugo.md`).
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
50
 
51
51
  ## Do
52
52
 
@@ -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
@@ -71,7 +71,7 @@ The closing band of every page: a knitted ornament band, grouped links, a coloph
71
71
  <div class="cx-container">
72
72
  <div class="cx-footer__base">
73
73
  <span>© 2026 Liam Marshall</span>
74
- <a class="cx-version" href="https://motifspec.com" aria-label="Version 1.16.0: view the MotifSpec showcase">MotifSpec v1.16.0<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg><span class="cx-tooltip cx-tooltip--above" aria-hidden="true">View showcase</span></a>
74
+ <a class="cx-version" href="https://motifspec.com" aria-label="Version 1.16.0: view the MotifSpec docs">MotifSpec v1.16.0<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg><span class="cx-tooltip cx-tooltip--above" aria-hidden="true">View MotifSpec docs</span></a>
75
75
  <a href="#top">Back to top<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-upward"></use></svg></a>
76
76
  </div>
77
77
  </div>
@@ -84,7 +84,7 @@ The closing band of every page: a knitted ornament band, grouped links, a coloph
84
84
  - Keep two to four columns; the grid wraps on its own.
85
85
  - Use the footer band as the page's single ornament when the page has no other.
86
86
  - On a backdrop page, let the footer sit on the frost: `cx-backdrop-page` removes its raised surface, and the bottom fade starts above it.
87
- - Put the MotifSpec version in the base row on sites that consume it, as a `cx-version` link to the showcase (`showcase` in `package.json`, also served in `dist/tokens.json`). The showcase's own footer links its version to the changelog instead. Its tooltip opens above (`cx-tooltip--above`) because it sits at the bottom of the page.
87
+ - Put the MotifSpec version in the base row on sites that consume it, as a `cx-version` link to motifspec.com (`showcase` in `package.json`, also served in `dist/tokens.json`). Its tooltip opens above (`cx-tooltip--above`) because it sits at the bottom of the page.
88
88
  - Point "Back to top" at `#top` and give no element that id. With no `#top` element, the browser scrolls to the top of the document; an id on the sticky header would leave the page where it is, because a stuck header is already in view.
89
89
 
90
90
  ## Don't
@@ -47,7 +47,7 @@ A contour survey of generated terrain: simplex-noise height lines drawn as a sta
47
47
 
48
48
  ## When not to use
49
49
 
50
- - On a page with the backdrop (`backdrop.md`), which already draws the survey behind it: one kind of contour field per page. The showcase, which documents both, is the only exception.
50
+ - On a page with the backdrop (`backdrop.md`), which already draws the survey behind it: one kind of contour field per page.
51
51
  - On article, index or 404 pages.
52
52
  - As a loading indicator, or as a map of a real place. It is generated, not surveyed.
53
53
  - Without its pause control.
@@ -44,6 +44,7 @@ A short mono label with a dot that names a state: online, degraded, down, live,
44
44
  <span class="cx-status cx-status--muted">Scheduled</span>
45
45
  ```
46
46
 
47
+ <!-- caption: Status tones -->
47
48
  | Tone | For | Example words |
48
49
  |---|---|---|
49
50
  | `--success` | Working, passing, done | Online, Running, Passed, Done |
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: token-table
3
+ status: stable
4
+ layouts: [documentation]
5
+ tokens:
6
+ - border.width.hairline
7
+ - color.accent.fill.rest
8
+ - color.border.default
9
+ - color.border.subtle
10
+ - color.surface.base
11
+ - color.surface.sunken
12
+ - color.text.primary
13
+ - font.family.body
14
+ - font.family.mono
15
+ - font.line-height.heading
16
+ - font.line-height.ui
17
+ - font.size.label
18
+ - font.weight.strong
19
+ - size.target.control
20
+ - size.target.min
21
+ - size.target.touch
22
+ - space.inline.sm
23
+ - space.inline.xs
24
+ - space.inset.sm
25
+ - space.inset.xs
26
+ - space.stack.xs
27
+ ---
28
+
29
+ # Token table
30
+
31
+ A token shown as it looks, beside its name, value and rule: colour tiles, a primitive palette, type samples, spacing bars and contrast samples.
32
+
33
+ ## When to use
34
+
35
+ - On the reference pages of a design system's documentation, where a reader compares tokens by eye as well as by name.
36
+ - Inside a data table (`data-table.md`), one sample per row, or as a palette of one hue's steps.
37
+
38
+ ## When not to use
39
+
40
+ - To decorate a page; a swatch stands for a token and is always labelled with its name.
41
+ - For a colour that isn't a token. Show only what the tokens define.
42
+
43
+ ## Markup
44
+
45
+ ```html {preview=true}
46
+ <div class="cx-table cx-token-table" role="region" aria-labelledby="tokens-example" tabindex="0">
47
+ <table>
48
+ <caption id="tokens-example">Text colours</caption>
49
+ <thead><tr><th scope="col">Token</th><th scope="col">Light</th><th scope="col">Dark</th><th scope="col">Rule</th></tr></thead>
50
+ <tbody>
51
+ <tr><th scope="row"><code>color.text.primary</code></th><td><span class="cx-swatch cx-swatch--tile"><b>ash.950</b><span>light value</span></span></td><td><span class="cx-swatch cx-swatch--tile"><b>ash.100</b><span>dark value</span></span></td><td>Body copy, headings and any text a reader must read.</td></tr>
52
+ </tbody>
53
+ </table>
54
+ </div>
55
+ <ol class="cx-palette" aria-label="ash">
56
+ <li><span class="cx-swatch cx-swatch--tile"><b>50</b><span>value</span></span></li>
57
+ <li><span class="cx-swatch cx-swatch--tile"><b>100</b><span>value</span></span></li>
58
+ </ol>
59
+ <span class="cx-pair-sample">Aa</span>
60
+ <span class="cx-token-sample">Type sample</span>
61
+ <span class="cx-token-bar"></span>
62
+ ```
63
+
64
+ <!-- caption: Token table parts -->
65
+ | Class | Shows | Set by the generator |
66
+ |---|---|---|
67
+ | `cx-token-table` | On a data table: keeps each token's name, in the row header, on one line | |
68
+ | `cx-swatch` | A small colour chip | `--_swatch` |
69
+ | `cx-swatch--tile` | A colour tile: the colour as the background, with its name and value written on it | `--_swatch`, and `--_ink` for the text |
70
+ | `cx-palette` | One hue's steps as a grid of tiles, lightest first | Each tile's |
71
+ | `cx-pair-sample` | "Aa" in a foreground on a background, beside the pair's ratio | `--_fg` and `--_bg` |
72
+ | `cx-token-sample` | Text at a size or in a family | `--_size`, `--_family` |
73
+ | `cx-token-bar` | A length, as a bar | `--_width` |
74
+
75
+ The value each part shows comes from a private custom property on the element, set in a `style` attribute by MotifSpec's docs generator (`scripts/docs-reference.mjs`) from `dist/tokens.json`. That's the only place MotifSpec writes a style attribute, and only in generated pages, which the checker doesn't read. Hand-written markup can't set them (the checker fails any `style` attribute), so it shows the neutral fallback, as above.
76
+
77
+ ## Do
78
+
79
+ - Name the token in the same row as its sample, in `<code>`, and write the colour's value on its tile: a reader who can't tell the colours apart reads the value.
80
+ - Write a tile's text in the ink that reads best on it, the darkest or the lightest neutral. The generator measures both and picks the higher contrast; a primitive keeps its value in both themes, so the choice holds in each.
81
+ - Show a semantic colour's light and dark values side by side, so a reader can check both themes in one view.
82
+ - Generate the tables from the tokens, so a changed value shows on the next build.
83
+
84
+ ## Don't
85
+
86
+ - Don't write token tables by hand; they go out of date.
87
+ - Don't show a primitive outside the palette. Pages and components use semantic tokens.
88
+ - Don't let a sample carry meaning the text doesn't.
89
+
90
+ ## Accessibility
91
+
92
+ - Swatches, bars and samples repeat what the text in the same row says; each table has a caption that names it (`data-table.md`).
93
+ - A palette is an ordered list named by its hue (`aria-label`).
94
+ - A tile's text is in whichever of the darkest and lightest neutral contrasts more with the tile. Against black or white, the better of the two is at least 4.5:1 on any colour, so every tile's label meets the label size's target.
95
+ - A pair sample's own contrast is the pair's: it is drawn in the colours it measures, so a failing pair looks like one.
96
+ - Pairs: the text around each sample is `color.text.primary` and `color.text.muted` on `color.surface.raised` (7:1 and 4.5:1); a chip's edge is `color.border.default`.
package/docs/hugo.md CHANGED
@@ -41,10 +41,11 @@ Pin a release with `hugo mod get github.com/aitrien/motifspec@vX.Y.Z`. The modul
41
41
  </html>
42
42
  ```
43
43
 
44
+ <!-- caption: Page shell partials -->
44
45
  | Partial | What it writes |
45
46
  |---|---|
46
47
  | `motifspec/head.html` | The stored-theme snippet, font preloads, `codex.css` and `codex.js`, in that order. |
47
- | `motifspec/body-start.html` | Call with the page. On the home page, the head of the backdrop (on a documentation site, the side, on every page); then the icon sprite and the skip link to `#main`. |
48
+ | `motifspec/body-start.html` | Call with the page. On the home page, the head of the backdrop (on a documentation site's other pages, the side); then the icon sprite and the skip link to `#main`. |
48
49
  | `motifspec/site-header.html` | `site-header.md`: wordmark from `site.Title` and `site.Params.role`, nav from `site.Menus.main` and the theme toggle. A menu entry is current when its `identifier` is the page's section; one whose URL starts with `http` gets the outward arrow. With `params.motifspec.search = true`, search comes first (`search.md`); with `params.motifspec.version` (and `changelog`, a URL), the version comes before the theme toggle. |
49
50
  | `motifspec/body-end.html` | The foot of the backdrop, behind the footer, and `plate.js`, which settles the home page's contours and lets the pointer warm them. |
50
51
 
@@ -67,7 +68,7 @@ A site using the documentation layout (`docs/layouts/documentation.md`) puts the
67
68
  </body>
68
69
  ```
69
70
 
70
- With `params.motifspec.layout = "documentation"`, `body-start.html` writes the side of the backdrop on every page, the docs home included, and `cx-backdrop-page--side` puts it down the left edge; on a phone the foot shows instead (`backdrop.md`).
71
+ With `params.motifspec.layout = "documentation"`, `body-start.html` writes the side of the backdrop on every page but the home page, and `cx-backdrop-page--side` puts it down the left edge; on a phone the foot shows instead (`backdrop.md`). The home page is the landing page: full width, outside the docs shell, with `<body class="cx-backdrop-page">` and the head of the backdrop, as in the page shell above.
71
72
 
72
73
  An article page's `main` block, in order: the page head with `page-actions.html` after the lede, `article.html`, `page-footer.html`, then `pagination-docs.html`.
73
74
 
@@ -113,9 +114,10 @@ hugo --gc --minify && npx pagefind@1.5.0 --site public
113
114
 
114
115
  Every partial below is called as `partial "motifspec/<name>.html" <context>`.
115
116
 
117
+ <!-- caption: Component partials -->
116
118
  | Partial | Doc | Context |
117
119
  |---|---|---|
118
- | `article.html` | `prose.md`, `table-of-contents.md`, `ornament.md` | `dict "page" . "toc" "always"` or `"auto"` (auto shows the TOC at three or more h2s). Ends the prose with the end mark, so the content must end with a paragraph. |
120
+ | `article.html` | `prose.md`, `table-of-contents.md`, `ornament.md` | `dict "page" . "toc" "always"`, `"auto"` (the TOC at three or more h2s) or `"never"` (for a page such as a changelog, whose headings repeat). Ends the prose with the end mark, so the content must end with a paragraph; on a documentation site, no end mark (`docs/layouts/documentation.md`, Decoration). |
119
121
  | `project-card.html` | `project-card.md` | `dict "page" . "level" 2` (the heading level that fits the page outline; default 3). |
120
122
  | `post-list-item.html` | `post-list-item.md` | `dict "page" . "level" 3`. Writes an `<li>`, so put it in `<ol class="cx-posts">`. |
121
123
  | `accession/label.html` | `accession-label.md` | `dict "page" . "variant" "lead"` above the title, or `"card"` after the article (shown on a phone). |
@@ -130,7 +132,7 @@ Every partial below is called as `partial "motifspec/<name>.html" <context>`.
130
132
  | `pagination-pages.html` | `pagination.md` | `dict "pager" $pager "label" "Writing pages"`. Pages of a paginated list; nothing when it fits on one page. |
131
133
  | `docs-nav.html` | `docs-shell.md` | A page. The documentation layout's navigation: top-level pages, then a group per top-level section in weight order. `docs_nav: false` in front matter leaves a page or section out. |
132
134
  | `page-actions.html` | `page-actions.md` | A page. Copy page and View as Markdown, when the page has the markdown output format; nothing otherwise. |
133
- | `page-footer.html` | `page-footer.md` | A page. Last updated (its `Lastmod`) and Edit this page, from `params.motifspec.editURL` and, for a site in a folder of its repository, `params.motifspec.siteDir`. |
135
+ | `page-footer.html` | `page-footer.md` | A page. Last updated (its `Lastmod`) and Edit this page, from `params.motifspec.editURL` and, for a site in a folder of its repository, `params.motifspec.siteDir`; a page with no file of its own uses its `source` param, the repository path of the file it was made from. |
134
136
  | `pagination-docs.html` | `pagination.md`, `page-footer.md` | A page. Previous and next in the order `docs-nav.html` lists the pages. |
135
137
  | `search.html` | `search.md` | A page. The search trigger and dialog; `site-header.html` calls it when `params.motifspec.search` is true. |
136
138
  | `back-link.html` | `button-and-link.md` | `dict "href" "…" "label" "All work"`. |
@@ -152,6 +154,7 @@ tags: [react, webgl, a11y]
152
154
  hero: { src: hero.png, alt: "…", caption: "…" }
153
155
  ```
154
156
 
157
+ <!-- caption: Front matter -->
155
158
  | Field | Used by | Notes |
156
159
  |---|---|---|
157
160
  | `summary` | cards, rows | The lede and the card or row summary. |
@@ -166,6 +169,7 @@ hero: { src: hero.png, alt: "…", caption: "…" }
166
169
 
167
170
  These apply to all Markdown content once the module is imported.
168
171
 
172
+ <!-- caption: Render hooks -->
169
173
  | Hook | Markdown | Doc |
170
174
  |---|---|---|
171
175
  | `render-heading.html` | Headings get ids; h2s get a `#` anchor. | `heading-anchor.md` |
@@ -29,6 +29,7 @@ One `<h1>` per page. Use heading anchors only on headings that start sections of
29
29
 
30
30
  ## Choosing a stack
31
31
 
32
+ <!-- caption: Choosing a stack -->
32
33
  | The project | Use |
33
34
  |---|---|
34
35
  | Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
@@ -17,6 +17,7 @@ Planned: a side navigation column (wordmark, grouped links, the theme toggle and
17
17
 
18
18
  ## Page templates
19
19
 
20
+ <!-- caption: Page templates -->
20
21
  | Template | Order | Dominant | Secondary |
21
22
  |---|---|---|---|
22
23
  | **Overview** | Page head (title, when the readings were last updated, page-wide controls) → alerts as callouts → headline figures → the main column and a side column of sections | Alerts and headline figures | Detail sections |
@@ -51,6 +52,7 @@ MotifSpec doesn't fetch data; where an app gets its readings is the project's de
51
52
 
52
53
  ## Choosing a stack
53
54
 
55
+ <!-- caption: Choosing a stack -->
54
56
  | The project | Use |
55
57
  |---|---|
56
58
  | Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
@@ -6,17 +6,18 @@ For product and system documentation: guides, reference pages and a changelog. m
6
6
 
7
7
  Complete since 1.19.0: the docs shell with its page navigation (`docs-shell.md`), search (`search.md`) and the version and repository link in the header (`site-header.md`), page actions (`page-actions.md`), the page footer with previous and next (`page-footer.md`), a Markdown copy of each page, and the component preview (`component-preview.md`), with every shared component, including steps, tabs, disclosures and keyboard keys, plus the table of contents, heading anchors and the ornaments.
8
8
 
9
- Not yet: tables generated from MotifSpec's own data (tokens, icons, checker rules) come with motifspec.com, the layout's first site. Don't write classes for anything MotifSpec doesn't define; the checker fails on them.
9
+ Since 1.20.0, the token table (`token-table.md`) for reference pages generated from a design system's tokens. Don't write classes for anything MotifSpec doesn't define; the checker fails on them.
10
10
 
11
11
  ## Shell
12
12
 
13
- The site header and footer, and between them the docs shell (`docs-shell.md`): grouped page navigation on the left, the page in the middle and "On this page" (the table of contents) on the right when there is room. Below `size.breakpoint.lg` "On this page" moves above the article, and below `size.breakpoint.md` the page navigation sits behind a Menu control above the page. In Hugo, see `docs/hugo.md` (A documentation page).
13
+ The site header and footer, and between them, on every page but the landing page, the docs shell (`docs-shell.md`): grouped page navigation on the left, the page in the middle and "On this page" (the table of contents) on the right when there is room. Below `size.breakpoint.lg` "On this page" moves above the article, and below `size.breakpoint.md` the page navigation sits behind a Menu control above the page. In Hugo, see `docs/hugo.md` (A documentation page).
14
14
 
15
15
  ## Page templates
16
16
 
17
+ <!-- caption: Page templates -->
17
18
  | Template | Order | Dominant | Secondary |
18
19
  |---|---|---|---|
19
- | **Docs home** | Header → statement (display h1, lede) → entry points to each section → what's new → footer | The statement and entry points | What's new |
20
+ | **Landing** | Header → statement (display h1, lede, a primary button to Getting started and a secondary one) on the frost → why the product exists → entry points to each section → footer. Full width, outside the docs shell. | The statement and its call to action | Why, entry points, the backdrop |
20
21
  | **Article** | Header → title and lede → TOC + prose with figures, code blocks, callouts and tables → edit link and last updated → previous and next → footer | The prose column | TOC, page actions |
21
22
  | **Reference table** | Header → title and one-line intro → the table (tokens, icons, rules) → footer | The table | Intro |
22
23
  | **Changelog** | Header → title → releases, newest first, each with its version, date and changes → footer | The releases | Dates |
@@ -28,7 +29,8 @@ Every shared component, plus the components whose doc lists `documentation` unde
28
29
 
29
30
  ## Decoration
30
31
 
31
- - The side of the backdrop on every page, down the left edge behind the navigation, fading out before the article (`backdrop.md`). On a phone, the foot behind the footer instead. No head, so every page, the docs home included, opens on the plain surface.
32
+ - The landing page: the head of the backdrop behind the statement and the foot behind the footer, as on a portfolio's home page (`backdrop.md`).
33
+ - Every page in the docs shell: the side of the backdrop, down the left edge behind the navigation, fading out before the article. On a phone, the foot behind the footer instead.
32
34
  - The footer band. No other ornaments in articles.
33
35
 
34
36
  ## Headings
@@ -38,6 +40,7 @@ Every shared component, plus the components whose doc lists `documentation` unde
38
40
 
39
41
  ## Choosing a stack
40
42
 
43
+ <!-- caption: Choosing a stack -->
41
44
  | The project | Use |
42
45
  |---|---|
43
46
  | Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
@@ -10,6 +10,7 @@ The site header, the main region and the site footer, on a backdrop page. In Hug
10
10
 
11
11
  Every template sits on the backdrop (`backdrop.md`): its contours show behind the footer, and on the home page behind the header and the statement too. Every template keeps the full site header (Work, Writing, About, the theme toggle) and the footer.
12
12
 
13
+ <!-- caption: Page templates -->
13
14
  | Template | Order | Dominant | Secondary |
14
15
  |---|---|---|---|
15
16
  | **Home** | Header → statement (eyebrow, display h1, lede, primary + secondary button) on the frost, inside the top fade → selected work (2–3 project cards) → recent writing (5 post rows) → capabilities table → footer | Statement and selected work | Writing rows, capabilities, the backdrop |
@@ -46,6 +47,7 @@ The fields each template reads are in `docs/hugo.md` (Front matter the partials
46
47
 
47
48
  ## Choosing a stack
48
49
 
50
+ <!-- caption: Choosing a stack -->
49
51
  | The project | Use |
50
52
  |---|---|
51
53
  | Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
@@ -31,6 +31,7 @@ Wrap highlighted output in the code-block component (see `components/code-block.
31
31
  Generated by `npm run build` from `syntax/chroma.json`. Values are light / dark.
32
32
 
33
33
  <!-- TABLE:START -->
34
+ <!-- caption: Chroma mapping -->
34
35
  | Role | Chroma classes | Token | Light / dark | Contrast on code surface (light / dark) |
35
36
  |---|---|---|---|---|
36
37
  | Keywords | `.k` `.kd` `.kn` `.kp` `.kr` `.ow` `.bp` | `color.syntax.keyword` + weight `font.weight.strong` | #942f29 / #feb5ac | 6.79 / 10.36 |
@@ -2,7 +2,7 @@
2
2
  Alerts become callout.md: > [!NOTE], [!TIP], [!WARNING], [!CAUTION] (danger). The title names the kind,
3
3
  the icon repeats it. At most two per article, no code blocks inside.
4
4
  Quotations follow prose.md: end with a line "— Name | Source title" and it becomes the attributed footer. */ -}}
5
- {{- $file := printf "content/%s" .Page.File.Path -}}
5
+ {{- $file := "" }}{{ with .Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = .Page.Path }}{{ end -}}
6
6
  {{- if eq .Type "alert" -}}
7
7
  {{- $kinds := dict
8
8
  "note" (dict "class" "cx-callout" "icon" "note" "title" "Note")
@@ -3,14 +3,15 @@
3
3
  {width="prose"} on the line after a figure keeps it to the prose measure instead of breaking out.
4
4
  An .svg is a diagram: inlined, coloured by its cx-diagram classes, named by the alt text. */ -}}
5
5
  {{- $img := .Page.Resources.Get .Destination -}}
6
- {{- if not $img }}{{ errorf "content/%s: image %q is not in the page bundle." .Page.File.Path .Destination }}{{ end -}}
7
- {{- if not .PlainText }}{{ errorf "content/%s: image %q has no alt text. Describe what the image shows (figure.md)." .Page.File.Path .Destination }}{{ end -}}
6
+ {{- $file := "" }}{{ with .Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = .Page.Path }}{{ end -}}
7
+ {{- if not $img }}{{ errorf "%s: image %q is not in the page bundle." $file .Destination }}{{ end -}}
8
+ {{- if not .PlainText }}{{ errorf "%s: image %q has no alt text. Describe what the image shows (figure.md)." $file .Destination }}{{ end -}}
8
9
  {{- if .IsBlock -}}
9
- {{- if not .Title }}{{ errorf "content/%s: figure %q has no caption. Add one as the image title: ![alt](file \"what to notice\")." .Page.File.Path .Destination }}{{ end -}}
10
+ {{- if not .Title }}{{ errorf "%s: figure %q has no caption. Add one as the image title: ![alt](file \"what to notice\")." $file .Destination }}{{ end -}}
10
11
  {{- $first := cond (isset .Page.Params "hero") 2 1 -}}
11
12
  {{- partial "motifspec/figure.html" (dict "image" $img "alt" .PlainText "caption" (.Title | markdownify) "plate" (add .Ordinal $first) "prose" (eq (index .Attributes "width") "prose")) -}}
12
13
  {{- else if eq $img.MediaType.SubType "svg" -}}
13
- {{- errorf "content/%s: %q is an SVG diagram; give it a line of its own so it becomes a figure (figure.md)." .Page.File.Path .Destination -}}
14
+ {{- errorf "%s: %q is an SVG diagram; give it a line of its own so it becomes a figure (figure.md)." $file .Destination -}}
14
15
  {{- else -}}
15
16
  {{- $s := $img.Process "webp" -}}
16
17
  <img src="{{ $s.RelPermalink }}" alt="{{ .PlainText }}" width="{{ $s.Width }}" height="{{ $s.Height }}" loading="lazy" decoding="async">
@@ -7,7 +7,7 @@
7
7
  {{- with or (.Page.GetPage $u.Path) (site.GetPage $u.Path) -}}
8
8
  {{- $dest = printf "%s%s" .RelPermalink (cond (ne $u.Fragment "") (printf "#%s" $u.Fragment) "") -}}
9
9
  {{- else -}}
10
- {{- with $.Page.Resources.Get $u.Path }}{{ $dest = .RelPermalink }}{{ else }}{{ if not (hasPrefix $u.Path "/") }}{{ errorf "content/%s: link %q does not resolve to a page or bundle file." $.Page.File.Path $.Destination }}{{ end }}{{ end -}}
10
+ {{- with $.Page.Resources.Get $u.Path }}{{ $dest = .RelPermalink }}{{ else }}{{ if not (hasPrefix $u.Path "/") }}{{ $file := "" }}{{ with $.Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = $.Page.Path }}{{ end }}{{ errorf "%s: link %q does not resolve to a page or bundle file." $file $.Destination }}{{ end }}{{ end -}}
11
11
  {{- end -}}
12
12
  {{- end -}}
13
13
  <a href="{{ $dest | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $external }} rel="noopener"{{ end }}>{{ .Text }}{{ if $external }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg>{{ end }}</a>
@@ -1,10 +1,11 @@
1
1
  {{- /* data-table.md: a focusable region named by its caption ({caption="…"} after the table; " | " becomes a
2
2
  separator), the first cell of each row as a row header, numeric or right-aligned columns marked is-num,
3
3
  and breakout above four columns. */ -}}
4
- {{- $file := printf "content/%s" .Page.File.Path -}}
4
+ {{- $file := "" }}{{ with .Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = .Page.Path }}{{ end -}}
5
5
  {{- $caption := .Attributes.caption -}}
6
6
  {{- if not $caption }}{{ errorf "%s: table %d has no caption. Add {caption=\"…\"} on the line after it (data-table.md)." $file (add .Ordinal 1) }}{{ end -}}
7
- {{- $id := printf "tbl-%s-%d" (.Page.File.ContentBaseName | urlize) .Ordinal -}}
7
+ {{- $base := "" }}{{ with .Page.File }}{{ $base = .ContentBaseName }}{{ else }}{{ $base = path.Base .Page.Path }}{{ end -}}
8
+ {{- $id := printf "tbl-%s-%d" ($base | urlize) .Ordinal -}}
8
9
  {{- $cols := 0 }}{{ range first 1 .THead }}{{ $cols = len . }}{{ end -}}
9
10
  {{- $num := slice -}}
10
11
  {{- range $c := seq 0 (sub $cols 1) -}}
@@ -1,18 +1,23 @@
1
1
  {{- /* The cx-article layout: TOC before the main column in the DOM, then prose ending in the flower end mark.
2
- Context: dict "page" "toc" (always | auto). auto shows the TOC when the content has three or more h2s
3
- (table-of-contents.md); a case study passes always. */ -}}
2
+ Context: dict "page" "toc" (always | auto | never). auto shows the TOC when the content has three or more h2s
3
+ (table-of-contents.md); a case study passes always. A documentation site (params.motifspec.layout
4
+ "documentation") has no end mark: its only ornament is the footer band (docs/layouts/documentation.md). */ -}}
4
5
  {{- $p := .page -}}
6
+ {{- $where := "" -}}
7
+ {{- with $p.File }}{{ $where = printf "content/%s" .Path }}{{ else }}{{ $where = $p.Path }}{{ end -}}
8
+ {{- $docs := eq site.Params.motifspec.layout "documentation" -}}
5
9
  {{- $h2s := partial "motifspec/h2s.html" $p -}}
6
- {{- $toc := or (eq .toc "always") (ge (len $h2s) 3) -}}
7
- {{- if and (eq .toc "always") (lt (len $h2s) 1) }}{{ errorf "content/%s: toc \"always\" needs h2 sections to list (table-of-contents.md)." $p.File.Path }}{{ end -}}
10
+ {{- $toc := and (ne .toc "never") (or (eq .toc "always") (ge (len $h2s) 3)) -}}
11
+ {{- if and (eq .toc "always") (lt (len $h2s) 1) }}{{ errorf "%s: toc \"always\" needs h2 sections to list (table-of-contents.md)." $where }}{{ end -}}
8
12
  {{- /* ornament.md: the flower ("g") goes after the last sentence, so the content must end with a paragraph. */ -}}
9
13
  {{- $content := $p.Content | strings.TrimSpace -}}
10
- {{- if gt (len (findRE `class="cx-callout[ "]` $content)) 2 }}{{ errorf "content/%s: more than two callouts in one article; they lose force when repeated (callout.md)." $p.File.Path }}{{ end -}}
14
+ {{- if gt (len (findRE `class="cx-callout[ "]` $content)) 2 }}{{ errorf "%s: more than two callouts in one article; they lose force when repeated (callout.md)." $where }}{{ end -}}
11
15
  {{- $endMark := `<span class="cx-end-mark" aria-hidden="true" data-pagefind-ignore>g</span></p>` -}}
12
- {{- if strings.HasSuffix $content "</p>" -}}
16
+ {{- if $docs -}}
17
+ {{- else if strings.HasSuffix $content "</p>" -}}
13
18
  {{- $content = printf "%s%s" (strings.TrimSuffix "</p>" $content) $endMark -}}
14
19
  {{- else -}}
15
- {{- warnf "content/%s: the article should end with a paragraph so the end mark follows the last sentence." $p.File.Path -}}
20
+ {{- warnf "%s: the article should end with a paragraph so the end mark follows the last sentence." $where -}}
16
21
  {{- end }}
17
22
  <div class="cx-article">
18
23
  {{- if $toc }}
@@ -1,8 +1,9 @@
1
1
  {{- /* docs/hugo.md. Call first inside <body class="cx-backdrop-page"> with the page: the contour backdrop's first
2
- layer (backdrop.md), which is the side layer on every page of a documentation site (params.motifspec.layout
3
- "documentation", with <body class="cx-backdrop-page cx-backdrop-page--side">) and otherwise the head, on the home
4
- page only; the icon sprite (icon.md), once, before anything that uses it; and the skip link to <main id="main">. */ -}}
5
- {{- if eq site.Params.motifspec.layout "documentation" }}
2
+ layer (backdrop.md), which is the head on the home page (a documentation site's landing page included) and,
3
+ on every other page of a documentation site (params.motifspec.layout "documentation", with
4
+ <body class="cx-backdrop-page cx-backdrop-page--side">), the side; the icon sprite (icon.md), once, before
5
+ anything that uses it; and the skip link to <main id="main">. */ -}}
6
+ {{- if and (eq site.Params.motifspec.layout "documentation") (not .IsHome) }}
6
7
  {{ with resources.Get "motifspec/backdrop-side.html" }}{{ .Content | safeHTML }}{{ else }}{{ errorf "motifspec/backdrop-side.html is missing: is the MotifSpec module imported?" }}{{ end }}
7
8
  {{- else if .IsHome }}
8
9
  {{ with resources.Get "motifspec/backdrop.html" }}{{ .Content | safeHTML }}{{ else }}{{ errorf "motifspec/backdrop.html is missing: is the MotifSpec module imported?" }}{{ end }}
@@ -1,6 +1,6 @@
1
1
  {{- /* docs-shell.md: the documentation layout's page navigation. Pages at the top level of the site come first,
2
2
  ungrouped; then each top-level section is a group, in weight order, listing its pages in weight order.
3
- A section or page with `docs_nav: false` in its front matter is left out. Every group starts open; the
3
+ A section or page with `docs_nav: false` in its front matter is left out; one with `deprecated` set says so after its title. Every group starts open; the
4
4
  current page is marked. Context: the current page. */ -}}
5
5
  {{- $current := . -}}
6
6
  {{- $top := where (where site.Home.RegularPages "Params.docs_nav" "ne" false) "Kind" "page" -}}
@@ -21,7 +21,7 @@
21
21
  <summary id="{{ $id }}">{{ .LinkTitle }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
22
22
  <ul class="cx-docs-nav__list" aria-labelledby="{{ $id }}">
23
23
  {{- range where .Pages.ByWeight "Params.docs_nav" "ne" false }}
24
- <li><a href="{{ .RelPermalink }}"{{ if eq .RelPermalink $current.RelPermalink }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
24
+ <li><a href="{{ .RelPermalink }}"{{ if eq .RelPermalink $current.RelPermalink }} aria-current="page"{{ end }}>{{ .LinkTitle }}{{ if .Params.deprecated }} (deprecated){{ end }}</a></li>
25
25
  {{- end }}
26
26
  </ul>
27
27
  </details>
@@ -1,13 +1,19 @@
1
1
  {{- /* page-footer.md: when the page last changed (its Lastmod; with enableGitInfo, from Git) and a link to edit its
2
2
  source. The edit link needs params.motifspec.editURL, the repository's edit address ending in "/", such as
3
3
  "https://github.com/owner/repo/edit/main/". When the site lives in a folder of the repository, also set
4
- params.motifspec.siteDir to that folder, so files mounted from outside it get the right path.
5
- Context: a page. */ -}}
4
+ params.motifspec.siteDir to that folder, so files mounted from outside it get the right path. A page with no
5
+ file of its own, such as one a content adapter makes from another file, names that file's path in the
6
+ repository as its `source` param. Context: a page. */ -}}
6
7
  {{- $p := . -}}
7
8
  {{- $edit := "" -}}
8
- {{- with and site.Params.motifspec.editURL $p.File -}}
9
- {{- $root := strings.TrimSuffix (printf "/%s" (site.Params.motifspec.siteDir | default "" | strings.Trim "/")) hugo.WorkingDir -}}
10
- {{- $edit = printf "%s%s" site.Params.motifspec.editURL (strings.TrimPrefix (printf "%s/" $root) $p.File.Filename) -}}
9
+ {{- with site.Params.motifspec.editURL -}}
10
+ {{- $base := . -}}
11
+ {{- with $p.Params.source -}}
12
+ {{- $edit = printf "%s%s" $base (strings.TrimPrefix "/" .) -}}
13
+ {{- else with $p.File -}}
14
+ {{- $root := strings.TrimSuffix (printf "/%s" (site.Params.motifspec.siteDir | default "" | strings.Trim "/")) hugo.WorkingDir -}}
15
+ {{- $edit = printf "%s%s" $base (strings.TrimPrefix (printf "%s/" $root) .Filename) -}}
16
+ {{- end -}}
11
17
  {{- end -}}
12
18
  {{- if or (not $p.Lastmod.IsZero) $edit }}
13
19
  <footer class="cx-page-footer" data-pagefind-ignore>
@@ -12,7 +12,7 @@
12
12
  <nav class="cx-nav" aria-label="Main">
13
13
  <ul>
14
14
  {{- range site.Menus.main }}
15
- <li><a href="{{ .URL }}"{{ if eq $.Section .Identifier }} aria-current="page"{{ end }}>{{ .Name }}{{ if hasPrefix .URL "http" }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg>{{ end }}</a></li>
15
+ <li><a href="{{ .URL }}"{{ if and .Identifier (eq $.Section .Identifier) }} aria-current="page"{{ end }}>{{ .Name }}{{ if hasPrefix .URL "http" }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg>{{ end }}</a></li>
16
16
  {{- end }}
17
17
  </ul>
18
18
  </nav>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitrien/motifspec",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Liam Marshall's design system: DTCG tokens, component rules, generated CSS, Hugo templates and a rule checker.",
5
5
  "keywords": [
6
6
  "design-system",
@@ -24,8 +24,6 @@
24
24
  },
25
25
  "files": [
26
26
  "dist",
27
- "!dist/showcase.html",
28
- "!dist/showcase.standalone.html",
29
27
  "tokens",
30
28
  "docs",
31
29
  "fonts",
@@ -65,7 +63,10 @@
65
63
  "release:check": "node scripts/release.mjs",
66
64
  "pack:check": "node scripts/pack-check.mjs",
67
65
  "test:mcp": "node --test mcp/test.mjs",
68
- "mcp:bundle": "node mcp/build.mjs"
66
+ "mcp:bundle": "node mcp/build.mjs",
67
+ "docs": "node scripts/docs.mjs",
68
+ "docs:check": "node scripts/check.mjs site",
69
+ "docs:quality": "node scripts/docs-quality.mjs"
69
70
  },
70
71
  "engines": {
71
72
  "node": ">=20"
@@ -73,6 +74,7 @@
73
74
  "devDependencies": {
74
75
  "@modelcontextprotocol/sdk": "1.32.2",
75
76
  "esbuild": "0.28.2",
77
+ "pagefind": "1.5.0",
76
78
  "zod": "4.6.7"
77
79
  }
78
80
  }
package/scripts/lib.mjs CHANGED
@@ -274,4 +274,5 @@ export const DOC_SELECTORS = {
274
274
  'component-preview': ['.cx-preview', '.cx-preview-body'],
275
275
  'steps': ['.cx-steps'],
276
276
  'tabs': ['.cx-tabs'],
277
+ 'token-table': ['.cx-token-table', '.cx-swatch', '.cx-palette', '.cx-token-sample', '.cx-token-bar', '.cx-pair-sample'],
277
278
  };