@aitrien/motifspec 1.20.1 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
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.21.0] - 2026-11-05
6
+
7
+ ### Added
8
+ - `specimen-plate.html`: a Hugo partial that frames any illustration as a specimen plate, with its pause control and "Plate 0" caption. It inlines an `.svg` or `.html` asset (`motifspec/plate.html` is the contour survey) or plays an `.mp4` or `.webm` video, takes a text alternative (`label`) for an illustration a reader needs, a `poster` for a video, and `wide` for a 16:10 plate (`cx-plate--wide`).
9
+ - `dist/codex.js` runs the pause control for any plate marked `data-plate-motion`: it reveals the control, pauses or plays CSS animations and SMIL in an inline SVG and video with it, sets `data-paused` on the frame, and sends a `cx-plate-pause` event for a scripted drawing. Under reduced motion nothing plays and the control stays hidden.
10
+
11
+ ### Changed
12
+ - The specimen plate is now a frame for any moving illustration (an animated SVG, a short silent video or a scripted drawing), in a page's head beside or below the statement, with the contour survey as the one MotifSpec ships. It belongs to every layout (`layouts: [shared]`), not only the portfolio. Its drawing classes (`cx-plate__grid`, `cx-plate__line`, `cx-plate__line--index`) suit any line drawing.
13
+
14
+ ### Fixed
15
+ - The specimen plate's and backdrop's examples on motifspec.com showed Hugo template code (`{{ (resources.Get "motifspec/plate.html").Content | safeHTML }}`) in their live previews. The plate's example is now HTML, the backdrop's is fenced as a Hugo template without a preview, and the code block hook fails the build on a previewed example with template syntax.
16
+
5
17
  ## [1.20.1] - 2026-11-05
6
18
 
7
19
  ### Changed
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.20.1 — generated from tokens/*.json. Do not edit.
5
+ /* MotifSpec 1.21.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 {
@@ -1239,13 +1239,24 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
1239
1239
  .cx-toc a[aria-current="true"] { color: var(--cx-color-text-primary); border-left-color: var(--cx-color-accent-border); }
1240
1240
  .cx-toc__no { color: var(--cx-color-text-muted); font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); font-variant-numeric: tabular-nums; }
1241
1241
 
1242
- /* ------------------------------------------------------------ specimen plate (contour survey of simplex-noise terrain) */
1242
+ /* ------------------------------------------------------------ specimen plate (specimen-plate.md) */
1243
+ /* A framed, captioned illustration that moves: an inline SVG, a video, a scripted drawing, or MotifSpec's own contour
1244
+ survey of simplex-noise terrain (data-plate-seed, run by js/plate.js). */
1243
1245
  .cx-plate-frame { position: relative; display: inline-flex; flex-direction: column; gap: var(--cx-space-stack-sm); margin: var(--cx-size-mark-tick); padding: var(--cx-space-inset-md); border: var(--cx-border-width-hairline) solid var(--cx-color-border-default); background: var(--cx-color-surface-raised); max-width: 100%; }
1244
1246
  .cx-plate {
1245
1247
  position: relative; width: var(--cx-size-column-card); max-width: 100%; aspect-ratio: 1; overflow: hidden;
1246
1248
  /* Read by js/plate.js: how long the terrain takes to drift one noise unit, and how long to wait for the draw-in. */
1247
1249
  --cx-plate-drift: var(--cx-motion-duration-drift); --cx-plate-draw: var(--cx-motion-duration-plate);
1248
1250
  }
1251
+ .cx-plate--wide { width: calc(var(--cx-size-column-card) * 1.6); aspect-ratio: 16 / 10; }
1252
+ /* Whatever the illustration is, it fills the plate. */
1253
+ .cx-plate > :is(svg, img, video, canvas) { display: block; width: 100%; height: 100%; object-fit: cover; }
1254
+ /* Paused (dist/codex.js sets data-paused on the frame), CSS animations in the illustration stop where they are. Under
1255
+ reduced motion they never run: an illustration must read complete without them. */
1256
+ .cx-plate-frame[data-paused] .cx-plate[data-plate-motion] :is(*, *::before, *::after) { animation-play-state: paused !important; }
1257
+ @media (prefers-reduced-motion: reduce) {
1258
+ .cx-plate[data-plate-motion] :is(*, *::before, *::after) { animation: none !important; transition: none !important; }
1259
+ }
1249
1260
  .cx-plate__map { display: block; width: 100%; height: 100%; }
1250
1261
  .cx-plate__map path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
1251
1262
  .cx-plate__grid { stroke: var(--cx-color-ornament-muted); stroke-width: var(--cx-border-width-hairline); }
@@ -1261,8 +1272,9 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
1261
1272
  /* The dash only exists for the draw-in. The last keyframe drops it, so lines reshaped later never show gaps. */
1262
1273
  @keyframes cx-contour { 99% { stroke-dasharray: 1; stroke-dashoffset: 0; } 100% { stroke-dasharray: none; stroke-dashoffset: 0; } }
1263
1274
 
1264
- /* Pause control: a native checkbox styled as an icon-only pill. It ships hidden; the script reveals it when it
1265
- starts the drift, so it never appears on a plate that isn't moving. */
1275
+ /* Pause control: a native checkbox styled as an icon-only pill. It ships hidden; a script reveals it when the
1276
+ illustration starts moving (js/plate.js for the contour survey, dist/codex.js for any other), so it never appears
1277
+ on a plate that isn't moving. */
1266
1278
  .cx-plate__pause {
1267
1279
  position: absolute; z-index: 2; top: var(--cx-space-inset-sm); right: var(--cx-space-inset-sm);
1268
1280
  display: inline-grid; place-items: center; width: var(--cx-size-target-touch); height: var(--cx-size-target-touch);
package/dist/codex.js CHANGED
@@ -297,5 +297,26 @@
297
297
  }, { rootMargin: '0px 0px -70% 0px' });
298
298
  links.forEach(function (a) { var t = document.getElementById(a.getAttribute('href').slice(1)); if (t) io.observe(t); });
299
299
  });
300
+
301
+ // Specimen plates whose illustration moves (data-plate-motion): show the pause control, and pause or play what
302
+ // is inside with it: CSS animations (through data-paused on the frame), SMIL in an inline SVG, and video. A
303
+ // scripted drawing listens for the "cx-plate-pause" event. Under reduced motion nothing plays and the control
304
+ // stays hidden. The contour survey (data-plate-seed) is run by dist/plate.js instead.
305
+ var still = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
306
+ document.querySelectorAll('.cx-plate[data-plate-motion]').forEach(function (plate) {
307
+ var frame = plate.closest('.cx-plate-frame') || plate.parentElement;
308
+ var toggle = frame.querySelector('.cx-plate__pause');
309
+ var input = toggle && toggle.querySelector('input');
310
+ var set = function (paused) {
311
+ frame.toggleAttribute('data-paused', paused);
312
+ plate.querySelectorAll('svg').forEach(function (svg) { if (svg.pauseAnimations) { if (paused) svg.pauseAnimations(); else svg.unpauseAnimations(); } });
313
+ plate.querySelectorAll('video').forEach(function (v) { if (paused) v.pause(); else { var p = v.play(); if (p && p.catch) p.catch(function () { /* autoplay refused: the poster stays */ }); } });
314
+ frame.dispatchEvent(new CustomEvent('cx-plate-pause', { bubbles: true, detail: { paused: paused } }));
315
+ };
316
+ if (still) { set(true); return; }
317
+ if (toggle) toggle.hidden = false;
318
+ if (input) input.addEventListener('change', function () { set(input.checked); });
319
+ set(Boolean(input && input.checked));
320
+ });
300
321
  });
301
322
  })();
package/dist/tokens.css CHANGED
@@ -1,4 +1,4 @@
1
- /* MotifSpec 1.20.1 — generated from tokens/*.json. Do not edit.
1
+ /* MotifSpec 1.21.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.20.1";
2
+ export const version = "1.21.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.20.1",
2
+ "version": "1.21.0",
3
3
  "changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
4
4
  "showcase": "https://motifspec.com",
5
5
  "tokens": [
@@ -40,9 +40,22 @@ Contour surveys drawn full-bleed behind the top of the home page and the bottom
40
40
 
41
41
  ## Markup
42
42
 
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`:
43
+ The page, as it reaches the browser. Each layer's contours are an SVG the build draws (left out here, so the preview shows only the frost):
44
44
 
45
45
  ```html {preview=true}
46
+ <body class="cx-backdrop-page">
47
+ <div class="cx-backdrop cx-backdrop--head" aria-hidden="true" data-plate-seed="3" data-plate-cells="48"><!-- the contours: dist/backdrop.html --></div>
48
+ <a class="cx-skip-link" href="#main">Skip to content</a>
49
+ <header class="cx-header"><!-- site-header.md --></header>
50
+ <main id="main"><!-- the template --></main>
51
+ <footer class="cx-footer"><!-- site-footer.md --></footer>
52
+ <div class="cx-backdrop cx-backdrop--foot" aria-hidden="true" data-plate-seed="7" data-plate-cells="48"><!-- the contours: dist/backdrop-foot.html --></div>
53
+ </body>
54
+ ```
55
+
56
+ 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`:
57
+
58
+ ```go-html-template
46
59
  <body class="cx-backdrop-page">
47
60
  {{ (resources.Get "motifspec/backdrop.html").Content | safeHTML }}
48
61
  <!-- 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> -->
@@ -50,6 +50,7 @@ The frame's document has the theme snippet (`dist/theme-init.js`), `codex.css`,
50
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
51
  - Don't rely on links in an example; they don't navigate.
52
52
  - Don't preview examples that need data from the page around them.
53
+ - Don't preview an example written in Hugo template syntax (`{{ … }}`); it would show the template, not what it writes. Fence it as `go-html-template`. The code block hook fails the build on one.
53
54
 
54
55
  ## Accessibility
55
56
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specimen-plate
3
3
  status: stable
4
- layouts: [portfolio]
4
+ layouts: [shared]
5
5
  tokens:
6
6
  - border.focus.offset
7
7
  - border.focus.width
@@ -38,24 +38,25 @@ tokens:
38
38
 
39
39
  # Specimen plate
40
40
 
41
- A contour survey of generated terrain: simplex-noise height lines drawn as a static SVG, which slowly reshape as the terrain drifts. Framed with registration ticks and captioned as Plate 0.
41
+ A framed, captioned illustration that moves: an animated SVG, a short silent video or a scripted drawing, with a control to pause it. MotifSpec ships one, a contour survey of generated terrain that slowly drifts.
42
42
 
43
43
  ## When to use
44
44
 
45
- - Once, beside the statement on a product's landing page that does not use the backdrop.
46
- - As the only decorative graphic on that page, and its only looping motion.
45
+ - Once, in a page's head, beside or below the statement: a landing page, or the head of a case study or post whose subject is easier to show than to say.
46
+ - For a moving picture of the subject, such as a product's interface at work or a process running, or for the contour survey as the page's one decorative graphic.
47
+ - As the only illustration on the page that loops.
47
48
 
48
49
  ## When not to use
49
50
 
50
- - On a page with the backdrop (`backdrop.md`), which already draws the survey behind it: one kind of contour field per page.
51
- - On article, index or 404 pages.
52
- - As a loading indicator, or as a map of a real place. It is generated, not surveyed.
53
- - Without its pause control.
51
+ - For a still image or diagram; that is a figure (`figure.md`), numbered from Plate 1.
52
+ - More than once on a page, or beside another animation.
53
+ - The contour survey on a page with the backdrop (`backdrop.md`), which draws the same survey behind it: one kind of contour field per page. Another illustration can sit on a backdrop page.
54
+ - As a loading indicator, or for anything a reader must watch to follow the page.
55
+ - For an animated GIF, or an SVG in an `<img>`: neither can be paused.
56
+ - Without its pause control, when it moves for longer than five seconds.
54
57
 
55
58
  ## Markup
56
59
 
57
- The build writes the plate to `dist/plate.html` (the contours at time zero) and ships the script as `dist/plate.js`. In Hugo, inline the markup and load the script; it finds every `.cx-plate[data-plate-seed]` on its own:
58
-
59
60
  ```html {preview=true}
60
61
  <figure class="cx-plate-frame">
61
62
  <label class="cx-plate__pause" hidden>
@@ -64,28 +65,73 @@ The build writes the plate to `dist/plate.html` (the contours at time zero) and
64
65
  <svg class="cx-icon" data-when="paused" aria-hidden="true" focusable="false"><use href="#cx-icon-play"></use></svg>
65
66
  <span class="cx-tooltip" aria-hidden="true"><span data-when="running">Pause animation</span><span data-when="paused">Play animation</span></span>
66
67
  </label>
67
- {{ (resources.Get "motifspec/plate.html").Content | safeHTML }}
68
- <figcaption>Plate 0 <span class="cx-sep" aria-hidden="true">|</span> Contour survey</figcaption>
68
+ <div class="cx-plate" data-plate-motion aria-hidden="true">
69
+ <svg class="cx-plate__map" viewBox="0 0 240 240" focusable="false">
70
+ <path class="cx-plate__grid" d="M80 0V240M160 0V240M0 80H240M0 160H240"/>
71
+ <path class="cx-plate__line" pathLength="1" d="M0 200C60 150 90 190 130 120S200 60 240 70"/>
72
+ <path class="cx-plate__line cx-plate__line--index" pathLength="1" d="M0 220C70 180 100 210 150 150S210 100 240 110"/>
73
+ <path class="cx-plate__line" pathLength="1" d="M60 240C90 200 140 220 170 180S220 150 240 150"/>
74
+ </svg>
75
+ </div>
76
+ <figcaption>Plate 0 <span class="cx-sep" aria-hidden="true">|</span> What it shows</figcaption>
69
77
  </figure>
70
- <script src="{{ (resources.Get "motifspec/plate.js" | minify | fingerprint).RelPermalink }}" defer></script>
71
78
  ```
72
79
 
73
- ## Do
80
+ The frame (`cx-plate-frame`) holds the pause control, the plate (`cx-plate`) and the caption. The plate is square, or 16:10 with `cx-plate--wide`, and whatever is inside it fills it:
81
+
82
+ <!-- caption: What a plate can hold -->
83
+ | Illustration | How it moves | How it pauses |
84
+ |---|---|---|
85
+ | An inline SVG | CSS animations or SMIL in the drawing | `dist/codex.js` stops both |
86
+ | A video | Muted, looping, no sound track, with a poster | `dist/codex.js` pauses it |
87
+ | A scripted drawing (SVG or canvas) | The site's own script | The script listens for `cx-plate-pause` |
88
+ | The contour survey | `dist/plate.js` | `dist/plate.js` |
89
+
90
+ Mark a plate whose illustration moves for longer than five seconds with `data-plate-motion`. `dist/codex.js` then reveals the pause control, pauses or plays the illustration with it, and sets `data-paused` on the frame while it is paused. Under `prefers-reduced-motion: reduce`, nothing plays, the control stays hidden, and CSS animations inside the plate don't run. The example above only draws in once, so it would leave `data-plate-motion` off; it carries it here to show the control.
74
91
 
75
- - Keep the survey conventions: 14 contour levels, every fifth an index contour (`color.ornament.strong`, `border.width.emphasis`), the rest hairlines in `color.ornament.rest`, over a quarter grid in `color.ornament.muted`.
76
- - Let each contour draw in once on load (`motion.duration.plate`, `motion.easing.enter`, staggered from the lowest line), then let the script start the drift: it eases up from rest over `motion.duration.plate`, then the terrain moves one noise unit every `motion.duration.drift`, linearly, and the lines are recomputed on every second frame.
92
+ The plate's drawing classes suit any line drawing, not only contours: `cx-plate__grid` for a quarter grid in `color.ornament.muted`, `cx-plate__line` for a hairline in `color.ornament.rest` that draws in once on load (give each path `pathLength="1"`), and `cx-plate__line--index` for the emphasised line in `color.ornament.strong`.
93
+
94
+ ### In Hugo
95
+
96
+ `partial "motifspec/specimen-plate.html"` writes the frame, the pause control and the caption around an asset, which it inlines (an `.svg` or `.html` file) or plays (an `.mp4` or `.webm` video):
97
+
98
+ ```go-html-template
99
+ {{ partial "motifspec/specimen-plate.html" (dict "src" "illustrations/sync.svg" "caption" "A sync in progress" "label" "Two devices exchange changes, then show the same list.") }}
100
+ {{ partial "motifspec/specimen-plate.html" (dict "src" "illustrations/tour.mp4" "poster" "illustrations/tour.png" "caption" "The editor" "wide" true) }}
101
+ {{ partial "motifspec/specimen-plate.html" (dict "src" "motifspec/plate.html" "caption" "Contour survey") }}
102
+ ```
103
+
104
+ `label` is the illustration's text alternative, for one that shows something a reader needs; without it the plate is decoration and `aria-hidden`. `dist/codex.js` and `dist/plate.js` load on every page through `head.html` and `body-end.html`.
105
+
106
+ ### The contour survey
107
+
108
+ MotifSpec's own plate: simplex-noise height lines drawn as a static SVG, which slowly reshape as the terrain drifts. The build writes it to `dist/plate.html` (the contours at time zero), with `data-plate-seed` on the plate, and `dist/plate.js` finds and runs every such plate on its own.
109
+
110
+ - Keep the survey conventions: 14 contour levels, every fifth an index contour, the rest hairlines, over the quarter grid.
111
+ - Each contour draws in once on load (`motion.duration.plate`, `motion.easing.enter`, staggered from the lowest line). Then the script starts the drift: it eases up from rest over `motion.duration.plate`, then the terrain moves one noise unit every `motion.duration.drift`, linearly, and the lines are recomputed on every second frame.
77
112
  - Change the terrain with `data-plate-seed` (and the matching `seed` option at build time), never by editing path data.
78
- - Keep the caption short: the plate number and what it shows.
113
+ - Don't speed up the drift or make it react to the pointer, and don't add elevation numbers, place names or a north arrow: it must not read as a real map.
114
+
115
+ ## Do
116
+
117
+ - Caption it "Plate 0" and what it shows, in a few words. Plate 0 is the one moving plate; figures count from 1.
118
+ - Colour an illustration of your own with MotifSpec's tokens (classes, or `var(--cx-color-…)` in the drawing's own styles), so it follows the theme.
119
+ - Time it with the motion tokens where it can (`var(--cx-motion-duration-…)`), and keep it slow: a loop the eye can rest on, not one that pulls at it.
120
+ - Draw it so it reads complete when still, at its first frame: that is what reduced motion, a paused plate and a page without script show.
121
+ - Give a video a poster, and no sound track.
79
122
 
80
123
  ## Don't
81
124
 
82
- - Don't speed up the drift, add a second animated plate, or make it react to the pointer.
83
- - Don't add elevation numbers, place names or a north arrow. It must not read as a real map.
84
- - Don't put text or links inside the plate.
125
+ - Don't put text, links or controls inside the plate, other than the pause control.
126
+ - Don't flash: nothing in it changes brightness sharply more than three times a second.
127
+ - Don't start it with sound, or show a video's own controls.
128
+ - Don't use the plate for a second animation on a page that already has one.
85
129
 
86
130
  ## Accessibility
87
131
 
88
- - The plate is `aria-hidden`; the caption is the only text.
89
- - WCAG 2.2.2 (Pause, Stop, Hide): the drift runs longer than five seconds, so the pause control (a native checkbox named "Pause animation") is reachable by keyboard and its checked state means paused. It ships `hidden` and the script reveals it only when the drift starts, so no dead control appears without JavaScript.
90
- - The script stops drawing while the plate is off screen or the tab is hidden, and never starts under `prefers-reduced-motion: reduce`; there, the contours render complete and still and the pause control stays hidden.
91
- - Contours are decorative: `color.ornament.rest` has no text-contrast requirement.
132
+ - A decorative plate is `aria-hidden`, and the caption is its only text. One that shows something a reader needs has a text alternative (`role="img"` and `aria-label`, or the partial's `label`), and its caption still says what it is.
133
+ - WCAG 2.2.2 (Pause, Stop, Hide): anything that moves for more than five seconds has the pause control, a native checkbox named "Pause animation" whose checked state means paused, reachable by keyboard. It ships `hidden`, and a script reveals it only when the illustration starts, so no dead control appears without JavaScript or under reduced motion.
134
+ - Under `prefers-reduced-motion: reduce` nothing plays: CSS animations don't run, SMIL and video stay paused, and the contour survey renders complete and still.
135
+ - WCAG 2.3.1 (Three Flashes): nothing flashes more than three times a second.
136
+ - The contour survey stops drawing while it is off screen or the tab is hidden.
137
+ - The drawing classes are decorative: `color.ornament.rest` has no text-contrast requirement.
package/docs/hugo.md CHANGED
@@ -124,6 +124,7 @@ Every partial below is called as `partial "motifspec/<name>.html" <context>`.
124
124
  | `accession/id.html` | `accession-label.md` | A page. The compact number, date and reading time line. |
125
125
  | `accession/status.html` | `accession-label.md` | `live`, `building` or `archived`. |
126
126
  | `figure.html` | `figure.md` | `dict "image" <resource> "alt" "…" "caption" <HTML> "plate" 1`, plus `"eager" true` for the largest image above the fold and `"prose" true` to keep it to the text measure. |
127
+ | `specimen-plate.html` | `specimen-plate.md` | `dict "src" "illustrations/x.svg" "caption" "…"`, plus `"label"` for one a reader needs, `"poster"` for a video and `"wide" true` for 16:10. Inlines an `.svg` or `.html` asset (`"motifspec/plate.html"` is the contour survey) or plays an `.mp4` or `.webm`, in the frame with its pause control and "Plate 0" caption. |
127
128
  | `table-of-contents.html` | `table-of-contents.md` | A page. `article.html` already calls it. |
128
129
  | `tags.html` | `tag.md` | `dict "page" . "max" 3`. |
129
130
  | `tag-filter.html` | `tag.md` | `dict "section" "work" "current" nil` on a section page, or `dict "section" "" "current" .` on a term page. |
@@ -22,7 +22,7 @@ Every template sits on the backdrop (`backdrop.md`): its contours show behind th
22
22
 
23
23
  ## Components
24
24
 
25
- Every shared component, plus the components whose doc lists `portfolio` under `layouts:`: accession label, backdrop, heading anchor, ornament, post list item, project card, specimen plate and table of contents.
25
+ Every shared component, plus the components whose doc lists `portfolio` under `layouts:`: accession label, backdrop, heading anchor, ornament, post list item, project card and table of contents.
26
26
 
27
27
  ## Catalogue numbers
28
28
 
@@ -9,6 +9,7 @@
9
9
  {{- range split .Inner "\n" }}{{ if gt (strings.RuneCount .) $measure }}{{ $long = true }}{{ end }}{{ end -}}
10
10
  {{- $result := transform.HighlightCodeBlock . -}}
11
11
  {{- $preview := and .Attributes.preview (eq $lang "html") -}}
12
+ {{- if and $preview (strings.Contains .Inner "{{") }}{{ errorf "%s: an example with Hugo template syntax can't be previewed. Fence it as go-html-template, or show the HTML it writes." .Page.Path }}{{ end -}}
12
13
  {{- if $preview }}
13
14
  {{- $css := resources.Get "motifspec/codex.css" | resources.Copy "cx/codex.css" | minify | fingerprint -}}
14
15
  {{- $js := resources.Get "motifspec/codex.js" | resources.Copy "cx/codex.js" | minify | fingerprint -}}
@@ -0,0 +1,33 @@
1
+ {{- /* specimen-plate.md: a framed, captioned illustration that moves, with its pause control. dist/codex.js (for an
2
+ illustration of the site's own) or dist/plate.js (for the contour survey) reveals the control and runs it; both
3
+ load on every page through head.html and body-end.html. Context: dict
4
+ "src" an asset path: an .svg or .html file to inline, such as "motifspec/plate.html" (MotifSpec's contour
5
+ survey) or one of the site's own in assets/, or a video (.mp4 or .webm)
6
+ "caption" what it shows, after "Plate 0"
7
+ "label" the illustration's text alternative, when it shows something a reader needs. Without it, the plate is
8
+ decoration and hidden from assistive tech.
9
+ "poster" for a video: an image asset shown before it plays, and instead of it under reduced motion
10
+ "wide" true for a 16:10 plate instead of a square one */ -}}
11
+ {{- $r := resources.Get .src -}}
12
+ {{- if not $r }}{{ errorf "specimen-plate.html: %q is not an asset (assets/, or a module's mount)." .src }}{{ end -}}
13
+ {{- if not .caption }}{{ errorf "specimen-plate.html: %q needs a caption: what the plate shows (specimen-plate.md)." .src }}{{ end -}}
14
+ {{- $video := in (slice "mp4" "webm") $r.MediaType.SubType -}}
15
+ {{- $own := and (not $video) (hasPrefix (strings.TrimSpace $r.Content) `<div class="cx-plate"`) -}}
16
+ {{- $class := cond (eq .wide true) "cx-plate cx-plate--wide" "cx-plate" -}}
17
+ {{- $name := cond (ne (.label | default "") "") (printf ` role="img" aria-label="%s"` (.label | htmlEscape)) ` aria-hidden="true"` -}}
18
+ <figure class="cx-plate-frame">
19
+ <label class="cx-plate__pause" hidden>
20
+ <input class="cx-visually-hidden" type="checkbox" aria-label="Pause animation">
21
+ <svg class="cx-icon" data-when="running" aria-hidden="true" focusable="false"><use href="#cx-icon-pause"></use></svg>
22
+ <svg class="cx-icon" data-when="paused" aria-hidden="true" focusable="false"><use href="#cx-icon-play"></use></svg>
23
+ <span class="cx-tooltip" aria-hidden="true"><span data-when="running">Pause animation</span><span data-when="paused">Play animation</span></span>
24
+ </label>
25
+ {{- if $own }}
26
+ {{ $r.Content | safeHTML }}
27
+ {{- else if $video }}
28
+ <div class="{{ $class }}" data-plate-motion{{ safeHTMLAttr $name }}><video src="{{ $r.RelPermalink }}" muted loop playsinline preload="metadata"{{ with .poster }}{{ with resources.Get . }} poster="{{ .RelPermalink }}"{{ end }}{{ end }}></video></div>
29
+ {{- else }}
30
+ <div class="{{ $class }}" data-plate-motion{{ safeHTMLAttr $name }}>{{ $r.Content | safeHTML }}</div>
31
+ {{- end }}
32
+ <figcaption>Plate 0 <span class="cx-sep" aria-hidden="true">|</span> {{ .caption }}</figcaption>
33
+ </figure>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitrien/motifspec",
3
- "version": "1.20.1",
3
+ "version": "1.21.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",