@aitrien/motifspec 1.20.1 → 1.22.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,35 @@
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.22.0] - 2026-11-06
6
+
7
+ ### Added
8
+ - A documentation site's header (`cx-header--docs`, written by `site-header.html` when `params.motifspec.layout` is `"documentation"`) takes over the page navigation below `size.breakpoint.lg`. The bar is one row: the wordmark, "On this page", search and a menu. It sticks, and once the page scrolls the wordmark compacts and "On this page" appears.
9
+ - The menu is a `<details>` whose sheet holds the page navigation, which scrolls, with the menu's external links, the changelog with the version, and the theme toggle fixed at the bottom. The page behind it doesn't scroll.
10
+ - "On this page" is a panel under the bar with Back to top and the page's sections, the current one marked.
11
+ - Both work without script. With `dist/codex.js`, one opens at a time, and each closes on Escape, a click outside it, or a link followed inside it.
12
+ - `docs-nav-groups.html` (the page navigation's groups, written in the side column and in the menu, with an id prefix each) and `theme-toggle.html`.
13
+
14
+ ### Changed
15
+ - Search's trigger looks like the field it opens: square, on `color.surface.sunken` and as wide as `size.column.sidebar` allows, so it no longer reads as the current section's outlined pill. Below `size.breakpoint.lg` it is an icon.
16
+ - The docs shell's side column, and the side layer of the backdrop, start at `size.breakpoint.lg` instead of `size.breakpoint.md`. Below it, the navigation and "On this page" are in the header, and the article's own table of contents is hidden.
17
+ - From `size.breakpoint.lg` up, the documentation header compacts its wordmark on scroll and stays on one row, with the search field giving way first.
18
+
19
+ ### Removed
20
+ - The docs shell's Menu control (`cx-docs-nav__menu`), replaced by the header's menu.
21
+
22
+ ## [1.21.0] - 2026-11-05
23
+
24
+ ### Added
25
+ - `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`).
26
+ - `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.
27
+
28
+ ### Changed
29
+ - 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.
30
+
31
+ ### Fixed
32
+ - 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.
33
+
5
34
  ## [1.20.1] - 2026-11-05
6
35
 
7
36
  ### 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.22.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 {
@@ -562,13 +562,8 @@ p, li, dd, figcaption { text-wrap: pretty; }
562
562
  position: sticky; top: var(--_header-height, var(--cx-size-target-touch));
563
563
  max-height: calc(var(--_viewport-height) - var(--_header-height, var(--cx-size-target-touch))); overflow-y: auto; scrollbar-width: thin;
564
564
  }
565
- .cx-docs-nav__menu > summary {
566
- display: flex; align-items: center; gap: var(--cx-space-inline-xs); width: fit-content; min-height: var(--cx-size-target-control);
567
- padding-inline: var(--cx-space-inset-md); border: var(--cx-border-width-hairline) solid var(--cx-color-border-strong); border-radius: var(--cx-radius-pill);
568
- color: var(--cx-color-text-primary); font-weight: var(--cx-font-weight-strong); cursor: pointer; list-style: none;
569
- }
570
- .cx-docs-nav__menu > summary::-webkit-details-marker, .cx-docs-nav__group > summary::-webkit-details-marker { display: none; }
571
- .cx-docs-nav__menu[open] > summary .cx-icon, .cx-docs-nav__group[open] > summary .cx-icon { transform: rotate(180deg); }
565
+ .cx-docs-nav__group > summary::-webkit-details-marker { display: none; }
566
+ .cx-docs-nav__group[open] > summary .cx-icon { transform: rotate(180deg); }
572
567
  .cx-docs-nav__groups { display: flex; flex-direction: column; gap: var(--cx-space-stack-md); }
573
568
  .cx-docs-nav__group > summary {
574
569
  display: flex; align-items: center; gap: var(--cx-space-inline-sm); min-height: var(--cx-size-target-min); padding-inline: var(--cx-space-inset-md);
@@ -585,16 +580,11 @@ p, li, dd, figcaption { text-wrap: pretty; }
585
580
  }
586
581
  .cx-docs-nav__list a:hover { color: var(--cx-color-text-primary); border-left-color: var(--cx-color-border-strong); }
587
582
  .cx-docs-nav__list a[aria-current="page"] { color: var(--cx-color-text-primary); font-weight: var(--cx-font-weight-strong); border-left-color: var(--cx-color-accent-border); }
588
- /* Wide: the navigation is always open and the Menu control is hidden. */
589
- @media (width >= 48rem) {
590
- .cx-docs-nav__menu > summary { display: none; }
591
- .cx-docs-nav__menu::details-content { content-visibility: visible; }
592
- }
593
- /* Phone: one column; the navigation sits behind the Menu control above the page, closed until it's opened. */
594
- @media (width < 48rem) {
583
+ /* Below size.breakpoint.lg: one column. The side column is hidden: the same navigation is in the header's menu, and
584
+ "On this page" is in the header too, so the article's own table of contents is hidden as well. */
585
+ @media (width < 64rem) {
595
586
  .cx-docs { grid-template-columns: minmax(0, 1fr); }
596
- .cx-docs-nav { padding-block: var(--cx-space-stack-md) 0; }
597
- .cx-docs-nav__menu[open] > .cx-docs-nav__groups { padding-top: var(--cx-space-stack-md); }
587
+ .cx-docs > .cx-docs-nav, .cx-docs .cx-article > .cx-toc { display: none; }
598
588
  }
599
589
 
600
590
  /* ------------------------------------------------------------ page actions and page footer (documentation layout) */
@@ -613,14 +603,17 @@ p, li, dd, figcaption { text-wrap: pretty; }
613
603
  .cx-page-footer .cx-meta a:hover { color: var(--cx-color-link-hover); text-decoration-thickness: var(--cx-border-width-emphasis); }
614
604
 
615
605
  /* ------------------------------------------------------------ search (a dialog over the page, from the header) */
606
+ /* The trigger looks like the field it opens: square, sunken and wide, so it doesn't read as the current section's
607
+ outlined pill in the nav beside it. */
616
608
  .cx-search-trigger {
617
- flex: none; display: inline-flex; align-items: center; gap: var(--cx-space-inline-sm); min-height: var(--cx-size-target-touch);
618
- padding-inline: var(--cx-space-inset-sm) var(--cx-space-inset-xs); border: var(--cx-border-width-hairline) solid var(--cx-color-border-strong);
619
- border-radius: var(--cx-radius-pill); background: var(--cx-color-surface-base); color: var(--cx-color-text-secondary);
620
- font: inherit; font-size: var(--cx-font-size-small); cursor: pointer;
621
- }
622
- .cx-search-trigger:hover { color: var(--cx-color-text-primary); background: var(--cx-color-surface-hover); }
623
- .cx-search-trigger__keys { display: inline-flex; gap: var(--cx-space-inline-xs); }
609
+ flex: 0 1 var(--cx-size-column-sidebar); min-width: 0; display: inline-flex; align-items: center; gap: var(--cx-space-inline-sm);
610
+ min-height: var(--cx-size-target-control); padding-inline: var(--cx-space-inset-sm) var(--cx-space-inset-xs);
611
+ border: var(--cx-border-width-hairline) solid var(--cx-color-border-strong); border-radius: var(--cx-radius-control);
612
+ background: var(--cx-color-surface-sunken); color: var(--cx-color-text-muted); font: inherit; font-size: var(--cx-font-size-small); cursor: text;
613
+ }
614
+ .cx-search-trigger:hover { color: var(--cx-color-text-secondary); }
615
+ .cx-search-trigger__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
616
+ .cx-search-trigger__keys { flex: none; display: inline-flex; gap: var(--cx-space-inline-xs); }
624
617
  .cx-search {
625
618
  width: min(100% - 2 * var(--cx-space-gutter-page), 2 * var(--cx-size-column-card)); max-height: calc(100% - 2 * var(--cx-space-section-sm));
626
619
  margin: var(--cx-space-section-sm) auto auto; padding: 0; border: var(--cx-border-width-hairline) solid var(--cx-color-border-default);
@@ -654,8 +647,13 @@ p, li, dd, figcaption { text-wrap: pretty; }
654
647
  .cx-search__title { font-weight: var(--cx-font-weight-strong); line-height: var(--cx-font-line-height-heading); }
655
648
  .cx-search__excerpt { font-size: var(--cx-font-size-small); line-height: var(--cx-font-line-height-ui); color: var(--cx-color-text-secondary); }
656
649
  .cx-search__excerpt mark { background: var(--cx-color-surface-highlight); color: var(--cx-color-text-primary); }
657
- @media (width < 48rem) {
658
- .cx-search-trigger { width: var(--cx-size-target-touch); padding: 0; justify-content: center; }
650
+ /* Below size.breakpoint.lg, where the header is one short row, the trigger is an icon. */
651
+ @media (width < 64rem) {
652
+ .cx-search-trigger {
653
+ flex: none; width: var(--cx-size-target-touch); min-height: var(--cx-size-target-touch); padding: 0; justify-content: center;
654
+ border: 0; border-radius: var(--cx-radius-pill); background: transparent; color: var(--cx-color-text-primary); cursor: pointer;
655
+ }
656
+ @media (hover: hover) { .cx-search-trigger:hover { background: var(--_wash); } }
659
657
  .cx-search-trigger__keys { display: none; }
660
658
  /* Icon only on a phone, but the label stays as the button's name (visually hidden, as cx-visually-hidden). */
661
659
  .cx-search-trigger__label {
@@ -669,6 +667,79 @@ p, li, dd, figcaption { text-wrap: pretty; }
669
667
  @media (hover: hover) { .cx-header__version:hover { color: var(--cx-color-text-primary); background: var(--_wash); } }
670
668
  .cx-nav a .cx-icon { margin-left: var(--cx-space-inline-xs); }
671
669
 
670
+ /* ------------------------------------------------------------ docs header (site-header.md, documentation layout) */
671
+ /* Below size.breakpoint.lg the bar is one row: the wordmark, "On this page", search and the menu. The nav, version and
672
+ theme toggle move into the menu's sheet with the page navigation. At the top of the page the wordmark shows in full;
673
+ once the page scrolls (data-scrolled="true", from dist/codex.js) it is compact and "On this page" appears. From
674
+ size.breakpoint.lg up the bar is the full header, compacting the same way on scroll. */
675
+ .cx-header--docs .cx-wordmark { transition: font-size var(--cx-motion-duration-fast) var(--cx-motion-easing-standard); }
676
+ .cx-header__toc, .cx-header__menu { flex: none; }
677
+ .cx-header__toc > summary, .cx-header__menu > summary { list-style: none; cursor: pointer; }
678
+ .cx-header__toc > summary::-webkit-details-marker, .cx-header__menu > summary::-webkit-details-marker { display: none; }
679
+ .cx-header__toc > summary {
680
+ display: inline-flex; align-items: center; gap: var(--cx-space-inline-xs); min-height: var(--cx-size-target-control);
681
+ padding-inline: var(--cx-space-inset-sm); border: var(--cx-border-width-hairline) solid var(--cx-color-border-strong); border-radius: var(--cx-radius-pill);
682
+ color: var(--cx-color-text-primary); font-size: var(--cx-font-size-small); font-weight: var(--cx-font-weight-ui); white-space: nowrap;
683
+ }
684
+ .cx-header__chevron { transition: transform var(--cx-motion-duration-base) var(--cx-motion-easing-standard); }
685
+ .cx-header__toc[open] .cx-header__chevron { transform: rotate(180deg); }
686
+ .cx-header__menu > summary {
687
+ display: inline-grid; place-items: center; width: var(--cx-size-target-touch); height: var(--cx-size-target-touch);
688
+ border-radius: var(--cx-radius-pill); color: var(--cx-color-text-primary);
689
+ }
690
+ @media (hover: hover) { .cx-header__toc > summary:hover, .cx-header__menu > summary:hover { background: var(--_wash); } }
691
+ .cx-header__menu [data-when="open"], .cx-header__menu[open] [data-when="closed"] { display: none; }
692
+ .cx-header__menu[open] [data-when="open"] { display: inline-block; }
693
+ /* "On this page": a panel under the bar, across the page, that scrolls if the page has many sections. */
694
+ .cx-header__panel {
695
+ position: absolute; top: 100%; left: var(--cx-space-gutter-page); right: var(--cx-space-gutter-page);
696
+ max-height: calc(var(--_viewport-height, var(--cx-size-container-breakout)) - var(--_header-height, var(--cx-size-target-touch)) - var(--cx-space-stack-lg));
697
+ overflow-y: auto; padding-block: var(--cx-space-inset-xs); border: var(--cx-border-width-hairline) solid var(--cx-color-border-default);
698
+ background: var(--cx-color-surface-raised);
699
+ }
700
+ .cx-header__top {
701
+ display: flex; align-items: center; gap: var(--cx-space-inline-xs); min-height: var(--cx-size-target-min); padding: var(--cx-space-inset-xs) var(--cx-space-inset-md);
702
+ margin-bottom: var(--cx-space-inset-xs); border-bottom: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle); color: var(--cx-color-link-rest);
703
+ }
704
+ /* The menu: a sheet under the bar, to the bottom of the screen. The page navigation scrolls; the links and settings
705
+ stay at the bottom. The page behind it doesn't scroll while it is open. */
706
+ .cx-header__sheet {
707
+ position: fixed; top: var(--_header-height, calc(var(--cx-size-target-touch) + var(--cx-space-inset-sm))); left: 0; right: 0; bottom: 0;
708
+ display: flex; flex-direction: column; border-top: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle); background: var(--cx-color-surface-base);
709
+ }
710
+ .cx-header__sheet-body.cx-docs-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--cx-space-stack-md) var(--cx-space-gutter-page); }
711
+ .cx-header__sheet-foot {
712
+ flex: none; display: flex; flex-direction: column; gap: var(--cx-space-stack-xs);
713
+ padding: var(--cx-space-stack-sm) var(--cx-space-gutter-page) max(var(--cx-space-stack-sm), env(safe-area-inset-bottom, 0px));
714
+ border-top: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle); font-size: var(--cx-font-size-small);
715
+ }
716
+ .cx-header__sheet-foot .cx-header__version { margin-left: auto; min-height: 0; padding: 0; }
717
+ .cx-header__setting { display: flex; align-items: center; justify-content: space-between; padding-left: var(--cx-space-inset-md); color: var(--cx-color-text-secondary); }
718
+ :root:has(.cx-header__menu[open]) { overflow: hidden; }
719
+ /* The bar under an open menu holds only what's needed to close it. */
720
+ .cx-header__end:has(.cx-header__menu[open]) > .cx-header__toc { visibility: hidden; }
721
+ /* One row at every width: from size.breakpoint.lg the search field gives way first, down to an icon's width with its
722
+ label, before the nav or the wordmark would wrap. */
723
+ .cx-header--docs .cx-header__inner { flex-wrap: nowrap; }
724
+ .cx-header--docs .cx-nav { flex: none; }
725
+ .cx-header--docs .cx-wordmark { flex: none; }
726
+ /* A docs header sticks, with its surface, even without dist/codex.js: its menu and "On this page" open from it. */
727
+ .cx-backdrop-page .cx-header--docs:not([data-scrolled]) { position: sticky; background: var(--cx-color-surface-base); }
728
+ @media (width < 64rem) {
729
+ .cx-header--docs .cx-header__end { gap: var(--cx-space-inline-xs); }
730
+ .cx-header--docs .cx-nav, .cx-header--docs .cx-header__end > .cx-header__version, .cx-header--docs .cx-header__end > .cx-theme-toggle { display: none; }
731
+ .cx-header--docs .cx-wordmark { font-size: var(--cx-font-size-body); }
732
+ .cx-header--docs .cx-wordmark__role { display: none; }
733
+ .cx-header--docs[data-scrolled="false"] .cx-wordmark { font-size: var(--cx-font-size-heading-4); }
734
+ .cx-header--docs[data-scrolled="false"] .cx-wordmark__role { display: inline; }
735
+ .cx-header--docs[data-scrolled="false"] .cx-header__toc { display: none; }
736
+ }
737
+ @media (width >= 64rem) {
738
+ .cx-header__toc, .cx-header__menu { display: none; }
739
+ .cx-header--docs[data-scrolled="true"] .cx-wordmark { font-size: var(--cx-font-size-body); }
740
+ .cx-header--docs[data-scrolled="true"] .cx-wordmark__role { display: none; }
741
+ }
742
+
672
743
  /* ------------------------------------------------------------ component preview (a live example above its code) */
673
744
  /* The example runs in its own document (an iframe's srcdoc) with the system's stylesheet and script, so its ids,
674
745
  sticky headers and landmarks can't clash with the page around it. dist/codex.js sizes it to its content. */
@@ -1239,13 +1310,24 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
1239
1310
  .cx-toc a[aria-current="true"] { color: var(--cx-color-text-primary); border-left-color: var(--cx-color-accent-border); }
1240
1311
  .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
1312
 
1242
- /* ------------------------------------------------------------ specimen plate (contour survey of simplex-noise terrain) */
1313
+ /* ------------------------------------------------------------ specimen plate (specimen-plate.md) */
1314
+ /* A framed, captioned illustration that moves: an inline SVG, a video, a scripted drawing, or MotifSpec's own contour
1315
+ survey of simplex-noise terrain (data-plate-seed, run by js/plate.js). */
1243
1316
  .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
1317
  .cx-plate {
1245
1318
  position: relative; width: var(--cx-size-column-card); max-width: 100%; aspect-ratio: 1; overflow: hidden;
1246
1319
  /* 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
1320
  --cx-plate-drift: var(--cx-motion-duration-drift); --cx-plate-draw: var(--cx-motion-duration-plate);
1248
1321
  }
1322
+ .cx-plate--wide { width: calc(var(--cx-size-column-card) * 1.6); aspect-ratio: 16 / 10; }
1323
+ /* Whatever the illustration is, it fills the plate. */
1324
+ .cx-plate > :is(svg, img, video, canvas) { display: block; width: 100%; height: 100%; object-fit: cover; }
1325
+ /* Paused (dist/codex.js sets data-paused on the frame), CSS animations in the illustration stop where they are. Under
1326
+ reduced motion they never run: an illustration must read complete without them. */
1327
+ .cx-plate-frame[data-paused] .cx-plate[data-plate-motion] :is(*, *::before, *::after) { animation-play-state: paused !important; }
1328
+ @media (prefers-reduced-motion: reduce) {
1329
+ .cx-plate[data-plate-motion] :is(*, *::before, *::after) { animation: none !important; transition: none !important; }
1330
+ }
1249
1331
  .cx-plate__map { display: block; width: 100%; height: 100%; }
1250
1332
  .cx-plate__map path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
1251
1333
  .cx-plate__grid { stroke: var(--cx-color-ornament-muted); stroke-width: var(--cx-border-width-hairline); }
@@ -1261,8 +1343,9 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
1261
1343
  /* The dash only exists for the draw-in. The last keyframe drops it, so lines reshaped later never show gaps. */
1262
1344
  @keyframes cx-contour { 99% { stroke-dasharray: 1; stroke-dashoffset: 0; } 100% { stroke-dasharray: none; stroke-dashoffset: 0; } }
1263
1345
 
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. */
1346
+ /* Pause control: a native checkbox styled as an icon-only pill. It ships hidden; a script reveals it when the
1347
+ illustration starts moving (js/plate.js for the contour survey, dist/codex.js for any other), so it never appears
1348
+ on a plate that isn't moving. */
1266
1349
  .cx-plate__pause {
1267
1350
  position: absolute; z-index: 2; top: var(--cx-space-inset-sm); right: var(--cx-space-inset-sm);
1268
1351
  display: inline-grid; place-items: center; width: var(--cx-size-target-touch); height: var(--cx-size-target-touch);
@@ -1332,12 +1415,13 @@ body:not(.cx-backdrop-page):has(.cx-backdrop-page) { background: transparent; }
1332
1415
  so it stays beside the navigation as the page scrolls. It reaches the left edge of the docs' main column
1333
1416
  (--_side: the page container's margin and gutter, then the navigation column), and the page's surface fades in
1334
1417
  across it, so the contours show in the margin, keep color.backdrop.calm behind the navigation, and are gone before
1335
- the article. The header fades the same way, so there is no edge across the band. On a phone the foot takes over. */
1418
+ the article. The header fades the same way, so there is no edge across the band. Below size.breakpoint.lg, where
1419
+ the side column is hidden, the foot takes over. */
1336
1420
  .cx-backdrop--side { display: none; }
1337
1421
  .cx-backdrop-page--side {
1338
1422
  --_side: calc(max(0%, 50% - var(--cx-size-container-page) / 2 - var(--cx-space-gutter-page)) + var(--cx-space-gutter-page) + var(--cx-size-column-sidebar));
1339
1423
  }
1340
- @media (width >= 48rem) {
1424
+ @media (width >= 64rem) {
1341
1425
  .cx-backdrop-page--side { background: linear-gradient(to right, transparent, var(--cx-color-surface-base) var(--_side)); }
1342
1426
  /* The header keeps the same fade when it sticks: what scrolls under it is the article, which is past --_side. */
1343
1427
  .cx-backdrop-page--side .cx-header, .cx-backdrop-page--side .cx-header[data-scrolled] { background: linear-gradient(to right, transparent, var(--cx-color-surface-base) var(--_side)); }
package/dist/codex.js CHANGED
@@ -79,13 +79,30 @@
79
79
  // Backdrop pages: the header starts on the frost and scrolls with the page. Once the script marks it, it sticks,
80
80
  // and data-scrolled="true" fades its surface in as soon as the page leaves the top; back at the top it fades out.
81
81
  // Without this script it keeps scrolling away, which is safe: it never sits see-through over the text.
82
- document.querySelectorAll('.cx-backdrop-page .cx-header').forEach(function (header) {
82
+ // A docs header (cx-header--docs) is marked the same way, so it shows the wordmark in full at the top of the page
83
+ // and compacts once the page scrolls.
84
+ document.querySelectorAll('.cx-backdrop-page .cx-header, .cx-header--docs').forEach(function (header) {
83
85
  var queued = false;
84
86
  var set = function () { queued = false; header.setAttribute('data-scrolled', window.scrollY > 0 ? 'true' : 'false'); };
85
87
  set();
86
88
  window.addEventListener('scroll', function () { if (!queued) { queued = true; window.requestAnimationFrame(set); } }, { passive: true });
87
89
  });
88
90
 
91
+ // The docs header's "On this page" and menu are <details>, so they open and close without script. With it, one
92
+ // opens at a time, and they close on Escape, on a click outside them, and when a link in them is followed.
93
+ var panels = Array.prototype.slice.call(document.querySelectorAll('.cx-header__toc, .cx-header__menu'));
94
+ panels.forEach(function (d) {
95
+ d.addEventListener('toggle', function () { if (d.open) panels.forEach(function (o) { if (o !== d) o.open = false; }); });
96
+ d.addEventListener('click', function (e) { if (e.target.closest('a[href]')) d.open = false; });
97
+ });
98
+ if (panels.length) {
99
+ document.addEventListener('keydown', function (e) {
100
+ if (e.key !== 'Escape') return;
101
+ panels.forEach(function (d) { if (d.open) { d.open = false; d.querySelector('summary').focus(); } });
102
+ });
103
+ document.addEventListener('click', function (e) { panels.forEach(function (d) { if (d.open && !d.contains(e.target)) d.open = false; }); });
104
+ }
105
+
89
106
  // Copy buttons on code blocks.
90
107
  document.querySelectorAll('.cx-code').forEach(function (block) {
91
108
  var btn = block.querySelector('.cx-code__copy');
@@ -287,7 +304,8 @@
287
304
  if (!toc || !main) return;
288
305
  var dock = function () { toc.classList.toggle('is-docked', Math.abs(toc.offsetTop - main.offsetTop) < 1); };
289
306
  dock(); window.addEventListener('resize', dock);
290
- var links = Array.prototype.slice.call(toc.querySelectorAll('a[href^="#"]'));
307
+ // The docs header's "On this page" (site-header.md) lists the same sections, so it is marked too.
308
+ var links = Array.prototype.slice.call(document.querySelectorAll('.cx-article .cx-toc a[href^="#"], .cx-header__toc li a[href^="#"]'));
291
309
  if (!('IntersectionObserver' in window)) return;
292
310
  var io = new IntersectionObserver(function (entries) {
293
311
  entries.forEach(function (e) {
@@ -297,5 +315,26 @@
297
315
  }, { rootMargin: '0px 0px -70% 0px' });
298
316
  links.forEach(function (a) { var t = document.getElementById(a.getAttribute('href').slice(1)); if (t) io.observe(t); });
299
317
  });
318
+
319
+ // Specimen plates whose illustration moves (data-plate-motion): show the pause control, and pause or play what
320
+ // is inside with it: CSS animations (through data-paused on the frame), SMIL in an inline SVG, and video. A
321
+ // scripted drawing listens for the "cx-plate-pause" event. Under reduced motion nothing plays and the control
322
+ // stays hidden. The contour survey (data-plate-seed) is run by dist/plate.js instead.
323
+ var still = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
324
+ document.querySelectorAll('.cx-plate[data-plate-motion]').forEach(function (plate) {
325
+ var frame = plate.closest('.cx-plate-frame') || plate.parentElement;
326
+ var toggle = frame.querySelector('.cx-plate__pause');
327
+ var input = toggle && toggle.querySelector('input');
328
+ var set = function (paused) {
329
+ frame.toggleAttribute('data-paused', paused);
330
+ plate.querySelectorAll('svg').forEach(function (svg) { if (svg.pauseAnimations) { if (paused) svg.pauseAnimations(); else svg.unpauseAnimations(); } });
331
+ 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 */ }); } });
332
+ frame.dispatchEvent(new CustomEvent('cx-plate-pause', { bubbles: true, detail: { paused: paused } }));
333
+ };
334
+ if (still) { set(true); return; }
335
+ if (toggle) toggle.hidden = false;
336
+ if (input) input.addEventListener('change', function () { set(input.checked); });
337
+ set(Boolean(input && input.checked));
338
+ });
300
339
  });
301
340
  })();
package/dist/tokens.css CHANGED
@@ -1,4 +1,4 @@
1
- /* MotifSpec 1.20.1 — generated from tokens/*.json. Do not edit.
1
+ /* MotifSpec 1.22.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.22.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.22.0",
3
3
  "changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
4
4
  "showcase": "https://motifspec.com",
5
5
  "tokens": [
@@ -28,7 +28,7 @@ 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 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`).
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 below `size.breakpoint.lg`. 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
 
@@ -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> -->
@@ -60,7 +73,7 @@ From the bottom up: the canvas (`color.surface.base`), the contours (the specime
60
73
 
61
74
  ### The side
62
75
 
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.
76
+ 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.lg` up, where the side column shows, 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.lg` the side is hidden and the foot shows behind the footer, as on a portfolio.
64
77
 
65
78
  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
79
 
@@ -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
 
@@ -19,14 +19,12 @@ tokens:
19
19
  - font.weight.strong
20
20
  - motion.duration.base
21
21
  - motion.easing.standard
22
- - radius.pill
23
22
  - size.column.sidebar
24
- - size.target.control
25
23
  - size.target.min
26
24
  - size.target.touch
27
25
  - space.gutter.grid
26
+ - space.gutter.page
28
27
  - space.inline.sm
29
- - space.inline.xs
30
28
  - space.inset.md
31
29
  - space.inset.xs
32
30
  - space.section.sm
@@ -36,7 +34,7 @@ tokens:
36
34
 
37
35
  # Docs shell
38
36
 
39
- The frame of a documentation page: grouped page navigation on the left, the page beside it, and "On this page" on the right when there is room.
37
+ The frame of a documentation page: grouped page navigation on the left, the page beside it, and "On this page" on the right when there is room. Narrower than `size.breakpoint.lg`, both move into the header (`site-header.md`).
40
38
 
41
39
  ## When to use
42
40
 
@@ -56,28 +54,25 @@ The site header (`site-header.md`) and footer (`site-footer.md`) go around it as
56
54
  ```html {preview=true}
57
55
  <div class="cx-container cx-docs">
58
56
  <nav class="cx-docs-nav" aria-label="Documentation">
59
- <details class="cx-docs-nav__menu">
60
- <summary>Menu<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
61
- <div class="cx-docs-nav__groups">
62
- <ul class="cx-docs-nav__list">
63
- <li><a href="/">Overview</a></li>
57
+ <div class="cx-docs-nav__groups">
58
+ <ul class="cx-docs-nav__list">
59
+ <li><a href="/">Overview</a></li>
60
+ </ul>
61
+ <details class="cx-docs-nav__group" open>
62
+ <summary id="docs-nav-guide">Guide<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
63
+ <ul class="cx-docs-nav__list" aria-labelledby="docs-nav-guide">
64
+ <li><a href="/guide/getting-started/" aria-current="page">Getting started</a></li>
65
+ <li><a href="/guide/layouts/">Choosing a layout</a></li>
64
66
  </ul>
65
- <details class="cx-docs-nav__group" open>
66
- <summary id="docs-nav-guide">Guide<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
67
- <ul class="cx-docs-nav__list" aria-labelledby="docs-nav-guide">
68
- <li><a href="/guide/getting-started/" aria-current="page">Getting started</a></li>
69
- <li><a href="/guide/layouts/">Choosing a layout</a></li>
70
- </ul>
71
- </details>
72
- <details class="cx-docs-nav__group" open>
73
- <summary id="docs-nav-reference">Reference<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
74
- <ul class="cx-docs-nav__list" aria-labelledby="docs-nav-reference">
75
- <li><a href="/reference/tokens/">Tokens</a></li>
76
- <li><a href="/reference/changelog/">Changelog</a></li>
77
- </ul>
78
- </details>
79
- </div>
80
- </details>
67
+ </details>
68
+ <details class="cx-docs-nav__group" open>
69
+ <summary id="docs-nav-reference">Reference<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
70
+ <ul class="cx-docs-nav__list" aria-labelledby="docs-nav-reference">
71
+ <li><a href="/reference/tokens/">Tokens</a></li>
72
+ <li><a href="/reference/changelog/">Changelog</a></li>
73
+ </ul>
74
+ </details>
75
+ </div>
81
76
  </nav>
82
77
  <main id="main" class="cx-docs__main" tabindex="-1" data-pagefind-body>
83
78
  <div class="cx-page-head">
@@ -93,7 +88,7 @@ The site header (`site-header.md`) and footer (`site-footer.md`) go around it as
93
88
  </div>
94
89
  ```
95
90
 
96
- In Hugo, `partial "motifspec/docs-nav.html" .` writes the navigation from the site's sections (`docs/hugo.md`). `data-pagefind-body` limits search (`search.md`) to the page's own content.
91
+ In Hugo, `partial "motifspec/docs-nav.html" .` writes the navigation from the site's sections (`docs/hugo.md`), through `docs-nav-groups.html`, which the header's menu uses too. `data-pagefind-body` limits search (`search.md`) to the page's own content.
97
92
 
98
93
  ## Do
99
94
 
@@ -108,19 +103,18 @@ In Hugo, `partial "motifspec/docs-nav.html" .` writes the navigation from the si
108
103
  - Don't nest groups; one level of groups, then pages.
109
104
  - Don't put the same page in two groups.
110
105
  - Don't add icons to the docs navigation; the page titles are the labels.
111
- - Don't hide the Menu control on a phone or ship the menu open there; the page comes first.
112
106
 
113
107
  ## Accessibility
114
108
 
115
109
  - The navigation is a `<nav>` named "Documentation", separate from the header's "Main".
116
110
  - Each group's list is named by its summary (`aria-labelledby`), so a screen reader hears "Guide, list, 4 items".
117
- - On a phone, the Menu control is a `<details>` summary: it opens with Enter or Space and works without script.
118
- - Group summaries and links meet `size.target.min`; the Menu control meets `size.target.control`.
111
+ - Below `size.breakpoint.lg` the side column is hidden, and the same navigation is in the header's menu, a `<details>` that opens with Enter or Space and works without script (`site-header.md`).
112
+ - Group summaries and links meet `size.target.min`.
119
113
  - The current page is marked in words for assistive tech (`aria-current`) and by weight and the accent rule on screen, not colour alone.
120
114
  - Pairs: `color.text.primary` and `color.text.secondary` on `color.surface.base` (7:1); the accent rule `color.accent.border` and hover rule `color.border.strong` on `color.surface.base` (3:1).
121
115
 
122
116
  ## Behaviour
123
117
 
124
- - **Without script:** at `size.breakpoint.md` and wider, the navigation is always shown and the Menu control is hidden; below it, the Menu control opens and closes it. The page scrolls with the navigation.
118
+ - **Without script:** from `size.breakpoint.lg` up, the navigation is shown beside the page and scrolls with it. Narrower, it is in the header's menu, and the article's own "On this page" is hidden, since the header has one.
125
119
  - **With `dist/codex.js`:** while the navigation sits beside the main column, it gets `is-docked`: it sticks below the header and scrolls on its own, sized from `--_viewport-height` and `--_header-height`, which the script keeps up to date. The current page is scrolled into the middle of the docked navigation on load. Docking is checked again on resize.
126
120
  - An app that renders the shell itself does the same, or leaves it undocked.
@@ -11,10 +11,10 @@ tokens:
11
11
  - color.border.subtle
12
12
  - color.focus.ring
13
13
  - color.scrim
14
- - color.surface.base
15
14
  - color.surface.highlight
16
15
  - color.surface.hover
17
16
  - color.surface.raised
17
+ - color.surface.sunken
18
18
  - color.text.muted
19
19
  - color.text.primary
20
20
  - color.text.secondary
@@ -27,8 +27,11 @@ tokens:
27
27
  - font.size.small
28
28
  - font.tracking.ui
29
29
  - font.weight.strong
30
+ - radius.control
30
31
  - radius.pill
31
32
  - size.column.card
33
+ - size.column.sidebar
34
+ - size.target.control
32
35
  - size.target.touch
33
36
  - space.gutter.page
34
37
  - space.inline.sm
@@ -57,7 +60,7 @@ A search control in the header that opens a dialog of results as you type, from
57
60
 
58
61
  ## Markup
59
62
 
60
- The trigger goes first in the header's end (`site-header.md`); the dialog can sit next to it.
63
+ The trigger goes in the header's end (`site-header.md`); the dialog can sit next to it. It looks like the field it opens: square (`radius.control`), on `color.surface.sunken`, and as wide as `size.column.sidebar` allows, so it can't be mistaken for the nav's pills or the current section's outline. Below `size.breakpoint.lg` it is an icon.
61
64
 
62
65
  ```html {preview=true}
63
66
  <button class="cx-search-trigger" type="button" data-search-open aria-haspopup="dialog" aria-controls="cx-search" hidden>
@@ -99,11 +102,11 @@ A result, as the script writes it:
99
102
 
100
103
  ## Accessibility
101
104
 
102
- - The trigger is a button with visible text ("Search"); on a phone, the label hides and its name stays in the DOM. The shortcut keys are `aria-hidden`; the shortcut is a convenience, never the only way in.
105
+ - The trigger is a button with visible text ("Search"); below `size.breakpoint.lg`, the label is visually hidden and stays its name. The shortcut keys are `aria-hidden`; the shortcut is a convenience, never the only way in.
103
106
  - The dialog is a modal `<dialog>`: focus moves into the field when it opens and returns to where it was when it closes; Escape closes it, even from the field; the page behind is inert.
104
107
  - The field is labelled by its visually hidden label, which also names the dialog, and described by the status line, a polite live region that says how many results there are.
105
108
  - Arrow keys move from the field into the results and between them; Up from the first result returns to the field.
106
- - Pairs: `color.text.primary` and `color.text.secondary` on `color.surface.raised` and `color.surface.hover` (7:1); `color.text.primary` on `color.surface.highlight` for matched words (7:1); the trigger's boundary `color.border.strong` on `color.surface.base` (3:1).
109
+ - Pairs: `color.text.primary` and `color.text.secondary` on `color.surface.raised` and `color.surface.hover` (7:1); `color.text.primary` on `color.surface.highlight` for matched words (7:1); the trigger's boundary `color.border.strong` on `color.surface.base` (3:1), and its text `color.text.muted` on `color.surface.sunken` (4.5:1).
107
110
 
108
111
  ## Behaviour
109
112
 
@@ -7,10 +7,13 @@ tokens:
7
7
  - border.focus.width
8
8
  - border.width.hairline
9
9
  - color.accent.fill.rest
10
+ - color.border.default
10
11
  - color.border.strong
11
12
  - color.border.subtle
12
13
  - color.focus.ring
14
+ - color.link.rest
13
15
  - color.surface.base
16
+ - color.surface.raised
14
17
  - color.text.muted
15
18
  - color.text.on-accent
16
19
  - color.text.primary
@@ -19,18 +22,24 @@ tokens:
19
22
  - font.family.display
20
23
  - font.family.mono
21
24
  - font.line-height.ui
25
+ - font.size.body
22
26
  - font.size.heading-4
23
27
  - font.size.label
28
+ - font.size.small
24
29
  - font.tracking.heading
25
30
  - font.tracking.label
26
31
  - font.weight.display
27
32
  - font.weight.strong
28
33
  - font.weight.ui
34
+ - motion.duration.base
29
35
  - motion.duration.fast
30
36
  - motion.duration.slow
31
37
  - motion.easing.standard
32
38
  - radius.pill
39
+ - size.container.breakout
33
40
  - size.container.page
41
+ - size.target.control
42
+ - size.target.min
34
43
  - size.target.touch
35
44
  - space.gutter.page
36
45
  - space.inline.lg
@@ -39,6 +48,10 @@ tokens:
39
48
  - space.inset.md
40
49
  - space.inset.sm
41
50
  - space.inset.xs
51
+ - space.stack.lg
52
+ - space.stack.md
53
+ - space.stack.sm
54
+ - space.stack.xs
42
55
  ---
43
56
 
44
57
  # Site header and nav
@@ -83,24 +96,56 @@ The bar at the top of every page: wordmark, primary nav and the theme toggle. On
83
96
 
84
97
  ### In a documentation site
85
98
 
86
- A documentation site's header can also carry search (first, before the nav; `search.md`), a link out to the source repository in the nav, with the outward arrow, and the version before the theme toggle, linking to the changelog:
99
+ A documentation site's header (`cx-header--docs`) also carries search, a link out to the source repository, the version linking to the changelog, and two `<details>` that take over below `size.breakpoint.lg`: "On this page" and a menu.
87
100
 
88
101
  ```html
89
- <div class="cx-header__end">
90
- <button class="cx-search-trigger" type="button" data-search-open aria-haspopup="dialog" aria-controls="cx-search" hidden>…</button>
91
- <nav class="cx-nav" aria-label="Main">
92
- <ul>
93
- <li><a href="/guide/" aria-current="page">Guide</a></li>
94
- <li><a href="/reference/">Reference</a></li>
95
- <li><a href="https://github.com/owner/repo">GitHub<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg></a></li>
96
- </ul>
97
- </nav>
98
- <a class="cx-header__version" href="/reference/changelog/">v1.19.0<span class="cx-visually-hidden">, changelog</span></a>
99
- <button class="cx-theme-toggle" type="button" data-theme-toggle hidden aria-label="Switch to dark theme">…</button>
100
- </div>
102
+ <header class="cx-header cx-header--docs">
103
+ <div class="cx-container cx-header__inner">
104
+ <a class="cx-wordmark" href="/">MotifSpec <span class="cx-wordmark__role">Brand guidelines</span></a>
105
+ <div class="cx-header__end">
106
+ <details class="cx-header__toc" data-pagefind-ignore>
107
+ <summary>On this page<svg class="cx-icon cx-icon--sm cx-header__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
108
+ <nav class="cx-header__panel cx-toc" aria-label="On this page">
109
+ <a class="cx-header__top" 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>
110
+ <ol><li><a href="#install"><span class="cx-toc__no">01</span>Install</a></li></ol>
111
+ </nav>
112
+ </details>
113
+ <button class="cx-search-trigger" type="button" data-search-open aria-haspopup="dialog" aria-controls="cx-search" hidden>…</button>
114
+ <nav class="cx-nav" aria-label="Main">
115
+ <ul>
116
+ <li><a href="/guide/" aria-current="page">Guide</a></li>
117
+ <li><a href="https://github.com/owner/repo">GitHub<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg></a></li>
118
+ </ul>
119
+ </nav>
120
+ <a class="cx-header__version" href="/reference/changelog/">v1.22.0<span class="cx-visually-hidden">, changelog</span></a>
121
+ <button class="cx-theme-toggle" type="button" data-theme-toggle hidden aria-label="Switch to dark theme">…</button>
122
+ <details class="cx-header__menu">
123
+ <summary aria-label="Menu"><svg class="cx-icon" data-when="closed" aria-hidden="true" focusable="false"><use href="#cx-icon-menu"></use></svg><svg class="cx-icon" data-when="open" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></summary>
124
+ <div class="cx-header__sheet" data-pagefind-ignore>
125
+ <nav class="cx-header__sheet-body cx-docs-nav" aria-label="Documentation"><!-- the page navigation: docs-shell.md --></nav>
126
+ <div class="cx-header__sheet-foot">
127
+ <ul class="cx-docs-nav__list">
128
+ <li><a href="https://github.com/owner/repo">GitHub<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg></a></li>
129
+ <li><a href="/reference/changelog/">Changelog<span class="cx-header__version">v1.22.0</span></a></li>
130
+ </ul>
131
+ <div class="cx-header__setting">Theme<button class="cx-theme-toggle" type="button" data-theme-toggle hidden aria-label="Switch to dark theme">…</button></div>
132
+ </div>
133
+ </div>
134
+ </details>
135
+ </div>
136
+ </div>
137
+ </header>
101
138
  ```
102
139
 
103
- A portfolio's header has none of these.
140
+ <!-- caption: The documentation header by width -->
141
+ | | Below `size.breakpoint.lg` | From `size.breakpoint.lg` |
142
+ |---|---|---|
143
+ | At the top of the page | The wordmark in full, search (an icon) and the menu | The wordmark in full, search (a field), the nav, the version and the theme toggle |
144
+ | Scrolled | A compact wordmark, "On this page", search and the menu | The same, with a compact wordmark |
145
+ | The menu | A sheet under the bar: the page navigation scrolls; the external links, the changelog with the version, and the theme toggle stay at the bottom | Not shown: the side column has the navigation |
146
+ | "On this page" | A panel under the bar, with Back to top and the page's sections | Not shown: the article has its own |
147
+
148
+ "On this page" is written only for a page whose article shows a table of contents: three or more h2s, and no `toc: false`. In Hugo, `partial "motifspec/site-header.html" .` writes all of this when `params.motifspec.layout` is `"documentation"`, with the menu's page navigation from `docs-nav-groups.html` and the toggle from `theme-toggle.html` (`docs/hugo.md`). A portfolio's header has none of these.
104
149
 
105
150
  ### Scripts
106
151
 
@@ -131,16 +176,18 @@ Copy the snippet as it is: the build fails if this doc and `js/theme-init.js` di
131
176
 
132
177
  ## Don't
133
178
 
134
- - Don't hide the nav behind a menu button at small widths. The list scrolls inside its row instead.
135
- - Don't add icons or ornaments to nav items. The theme toggle is the only header control with an icon.
179
+ - Don't hide a portfolio's nav behind a menu button at small widths; the list scrolls inside its row instead. A documentation site, whose navigation is a long list of pages, puts it in its menu below `size.breakpoint.lg`.
180
+ - Don't add icons or ornaments to nav items. The theme toggle, and on a documentation site the search icon and the menu, are the only header controls that are icons.
136
181
  - Don't make the header sticky on a backdrop page without its surface; see-through, it would sit on the text below it. The `data-scrolled` rules keep the two together.
137
- - Don't animate the header on scroll beyond that surface fade (no shrink, hide or reveal).
182
+ - Don't animate the header on scroll beyond that surface fade and, on a documentation site, the compact wordmark: no hiding or revealing the bar.
138
183
 
139
184
  ## Accessibility
140
185
 
141
186
  - The skip link is the first focusable element and targets `<main id="main">`.
142
187
  - `<nav aria-label="Main">`; only one nav per page uses that label.
143
- - Nav links and the toggle are 44px (`size.target.touch`); the toggle is a pill with equal sides, so it renders as a circle.
188
+ - Nav links, the toggle and the menu control are 44px (`size.target.touch`); the toggle is a pill with equal sides, so it renders as a circle.
189
+ - The menu's control is named "Menu" (`aria-label` on its summary), and its icon changes to a cross while it is open; "On this page" is named by its text. Both are `<details>`, so Enter or Space opens them without script, and the browser announces whether they are expanded.
190
+ - While the menu is open, the page behind it doesn't scroll. With `dist/codex.js`, Escape closes an open menu or panel and returns focus to its control.
144
191
  - The toggle's `aria-label` is its action ("Switch to light theme"); the visible tooltip repeats it and is `aria-hidden`. Escape hides the tooltip without moving the pointer (see `tooltip.md`).
145
192
  - `aria-current` carries the current state for assistive tech; the outline is the visual cue.
146
193
  - Pairs: `color.text.secondary` and `color.text.primary` on `color.surface.base` (7:1); `color.border.strong` on `color.surface.base` (current outline, 3:1). On a backdrop page the frost is measured as `color.surface.base`; the contour lines beneath it are not part of the check.
@@ -153,3 +200,4 @@ Copy the snippet as it is: the build fails if this doc and `js/theme-init.js` di
153
200
  - **System changes:** while following the system, a change to the system theme updates the toggle's label.
154
201
  - **Header height:** `--_header-height` on `<html>` is kept equal to the header's height, for scroll padding and the docked table of contents. When the nav wraps below the wordmark, the header gets `data-wrapped`.
155
202
  - **On a backdrop page:** the header sticks once script runs, and `data-scrolled="true"` fades its surface in as soon as the page leaves the top. Without script it scrolls away with the page.
203
+ - **On a documentation site:** the header always sticks with its surface, and gets `data-scrolled` too, which compacts the wordmark and (below `size.breakpoint.lg`) shows "On this page" once the page leaves the top. Without script the bar stays compact, with "On this page" shown. Only one of the menu and "On this page" is open at a time; each closes on Escape, a click outside it, or a link followed inside it. The current section is marked in "On this page", as in the article's table of contents.
@@ -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.
@@ -68,7 +68,7 @@ A numbered list of an article's sections, beside the text on wide screens and ab
68
68
  ## Do
69
69
 
70
70
  - Number sections because the order is real; nest `<h3>` entries one level only.
71
- - Ship `<details open>` so it works without script. Readers can collapse it on phones; the chevron rotates with `motion.duration.base`.
71
+ - Ship `<details open>` so it works without script. Readers can collapse it on phones; the chevron rotates with `motion.duration.base`. On a documentation site it is hidden below `size.breakpoint.lg`, where the header has "On this page" (`site-header.md`).
72
72
  - Let the script add `is-docked` (sticky) only when the TOC sits beside the text, and set `aria-current="true"` on the visible section.
73
73
 
74
74
  ## Don't
package/docs/hugo.md CHANGED
@@ -46,7 +46,7 @@ Pin a release with `hugo mod get github.com/aitrien/motifspec@vX.Y.Z`. The modul
46
46
  |---|---|
47
47
  | `motifspec/head.html` | The stored-theme snippet, font preloads, `codex.css` and `codex.js`, in that order. |
48
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`. |
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
+ | `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. With `params.motifspec.layout = "documentation"`, it adds "On this page" and the menu, which take over below `size.breakpoint.lg` (`site-header.md`, In a documentation site). |
50
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. |
51
51
 
52
52
  The footer stays in the site: its columns are the site's own links and colophon. Use the markup in `site-footer.md`.
@@ -68,7 +68,7 @@ A site using the documentation layout (`docs/layouts/documentation.md`) puts the
68
68
  </body>
69
69
  ```
70
70
 
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
+ 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; below `size.breakpoint.lg` 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.
72
72
 
73
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`.
74
74
 
@@ -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. |
@@ -131,10 +132,12 @@ Every partial below is called as `partial "motifspec/<name>.html" <context>`.
131
132
  | `pagination-entries.html` | `pagination.md` | `dict "page" . "label" "Post navigation" "noun" "Post"`. Previous and next in the page's section, oldest first. |
132
133
  | `pagination-pages.html` | `pagination.md` | `dict "pager" $pager "label" "Writing pages"`. Pages of a paginated list; nothing when it fits on one page. |
133
134
  | `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. |
135
+ | `docs-nav-groups.html` | `docs-shell.md` | `dict "page" . "prefix" "menu"`. The navigation's groups, which `docs-nav.html` and the documentation header's menu both write; `prefix` keeps each copy's ids apart. |
134
136
  | `page-actions.html` | `page-actions.md` | A page. Copy page and View as Markdown, when the page has the markdown output format; nothing otherwise. |
135
137
  | `page-footer.html` | `page-footer.md` | A page. Last updated (its `Lastmod`), Generated from (its `data` param) and View source, from `params.motifspec.sourceURL` (or Edit this page, from `editURL`) and, for a site in a folder of its repository, `params.motifspec.siteDir`. A page with no file of its own sets `source` and, for one section of a file, `sourceAnchor`. |
136
138
  | `pagination-docs.html` | `pagination.md`, `page-footer.md` | A page. Previous and next in the order `docs-nav.html` lists the pages. |
137
139
  | `search.html` | `search.md` | A page. The search trigger and dialog; `site-header.html` calls it when `params.motifspec.search` is true. |
140
+ | `theme-toggle.html` | `site-header.md` | A page. The theme toggle; `site-header.html` writes it in the bar and, on a documentation site, in the menu. |
138
141
  | `back-link.html` | `button-and-link.md` | `dict "href" "…" "label" "All work"`. |
139
142
  | `section-heading.html` | `heading-anchor.md` | `dict "id" "work" "title" "Selected work"`, inside a `<section id="work" aria-labelledby="work-title">`. |
140
143
  | `tokens.html` | | Call with `partialCached "motifspec/tokens.html" "tokens"`. A map from token name to its entry in `dist/tokens.json`, for templates that need a token's value at build time. |
@@ -10,7 +10,7 @@ Since 1.20.0, the token table (`token-table.md`) for reference pages generated f
10
10
 
11
11
  ## Shell
12
12
 
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).
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` both move into the header (`site-header.md`): the page navigation into its menu, with the external links, the changelog and the theme toggle, and "On this page" into a panel that appears once the page scrolls. In Hugo, see `docs/hugo.md` (A documentation page).
14
14
 
15
15
  ## Page templates
16
16
 
@@ -30,7 +30,7 @@ Every shared component, plus the components whose doc lists `documentation` unde
30
30
  ## Decoration
31
31
 
32
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.
33
+ - Every page in the docs shell: the side of the backdrop, down the left edge behind the navigation, fading out before the article. Below `size.breakpoint.lg`, the foot behind the footer instead.
34
34
  - The footer band. No other ornaments in articles.
35
35
 
36
36
  ## Headings
@@ -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,29 @@
1
+ {{- /* docs-shell.md: the documentation layout's page navigation, as groups. Pages at the top level of the site come
2
+ first, 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; one with `deprecated` set says so
4
+ after its title. Every group starts open; the current page is marked. Written twice on a page, in the side
5
+ column (docs-nav.html) and in the header's menu (site-header.html), so each copy's ids take a prefix.
6
+ Context: dict "page" (the current page) "prefix". */ -}}
7
+ {{- $current := .page -}}
8
+ {{- $prefix := .prefix -}}
9
+ {{- $top := where (where site.Home.RegularPages "Params.docs_nav" "ne" false) "Kind" "page" -}}
10
+ <div class="cx-docs-nav__groups">
11
+ {{- with $top.ByWeight }}
12
+ <ul class="cx-docs-nav__list">
13
+ {{- range . }}
14
+ <li><a href="{{ .RelPermalink }}"{{ if eq .RelPermalink $current.RelPermalink }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
15
+ {{- end }}
16
+ </ul>
17
+ {{- end }}
18
+ {{- range where site.Home.Sections.ByWeight "Params.docs_nav" "ne" false }}
19
+ {{- $id := printf "%s-%s" $prefix (.Section | urlize) }}
20
+ <details class="cx-docs-nav__group" open>
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
+ <ul class="cx-docs-nav__list" aria-labelledby="{{ $id }}">
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 }}{{ if .Params.deprecated }} (deprecated){{ end }}</a></li>
25
+ {{- end }}
26
+ </ul>
27
+ </details>
28
+ {{- end }}
29
+ </div>
@@ -1,31 +1,6 @@
1
- {{- /* docs-shell.md: the documentation layout's page navigation. Pages at the top level of the site come first,
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; one with `deprecated` set says so after its title. Every group starts open; the
4
- current page is marked. Context: the current page. */ -}}
5
- {{- $current := . -}}
6
- {{- $top := where (where site.Home.RegularPages "Params.docs_nav" "ne" false) "Kind" "page" -}}
1
+ {{- /* docs-shell.md: the side column's page navigation (docs-nav-groups.html), from size.breakpoint.lg up. Narrower,
2
+ the column is hidden and the same navigation is in the header's menu (site-header.html). Context: the current
3
+ page. */ -}}
7
4
  <nav class="cx-docs-nav" aria-label="Documentation">
8
- <details class="cx-docs-nav__menu">
9
- <summary>Menu<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
10
- <div class="cx-docs-nav__groups">
11
- {{- with $top.ByWeight }}
12
- <ul class="cx-docs-nav__list">
13
- {{- range . }}
14
- <li><a href="{{ .RelPermalink }}"{{ if eq .RelPermalink $current.RelPermalink }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
15
- {{- end }}
16
- </ul>
17
- {{- end }}
18
- {{- range where site.Home.Sections.ByWeight "Params.docs_nav" "ne" false }}
19
- {{- $id := printf "docs-nav-%s" (.Section | urlize) }}
20
- <details class="cx-docs-nav__group" open>
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
- <ul class="cx-docs-nav__list" aria-labelledby="{{ $id }}">
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 }}{{ if .Params.deprecated }} (deprecated){{ end }}</a></li>
25
- {{- end }}
26
- </ul>
27
- </details>
28
- {{- end }}
29
- </div>
30
- </details>
5
+ {{ partial "motifspec/docs-nav-groups.html" (dict "page" . "prefix" "docs-nav") }}
31
6
  </nav>
@@ -1,11 +1,33 @@
1
1
  {{- /* site-header.md. A child page marks its section (a post marks Writing). A menu entry whose URL starts with
2
2
  "http" gets the outward arrow. Optional, from params.motifspec: search = true adds search (search.md);
3
- version = "1.19.0" with changelog = "<url>" adds the version, linked to the changelog. */ -}}
3
+ version = "1.19.0" with changelog = "<url>" adds the version, linked to the changelog.
4
+ On a documentation site (params.motifspec.layout "documentation"), below size.breakpoint.lg the bar holds only
5
+ the wordmark, "On this page", search and the menu, whose sheet has the page navigation (docs-shell.md), the
6
+ menu's external links, the changelog and the theme toggle. */ -}}
4
7
  {{- $ms := site.Params.motifspec -}}
5
- <header class="cx-header">
8
+ {{- $docs := eq $ms.layout "documentation" -}}
9
+ {{- $external := where site.Menus.main "URL" "like" `^https?://` -}}
10
+ <header class="cx-header{{ if $docs }} cx-header--docs{{ end }}">
6
11
  <div class="cx-container cx-header__inner">
7
12
  <a class="cx-wordmark" href="{{ site.Home.RelPermalink }}">{{ site.Title }} <span class="cx-wordmark__role">{{ site.Params.role }}</span></a>
8
13
  <div class="cx-header__end">
14
+ {{- if $docs }}
15
+ {{- /* "On this page", for a page whose article shows a table of contents: three or more h2s, and no toc: false. */}}
16
+ {{- $h2s := partial "motifspec/h2s.html" . }}
17
+ {{- if and (ge (len $h2s) 3) (ne .Params.toc false) }}
18
+ <details class="cx-header__toc" data-pagefind-ignore>
19
+ <summary>On this page<svg class="cx-icon cx-icon--sm cx-header__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
20
+ <nav class="cx-header__panel cx-toc" aria-label="On this page">
21
+ <a class="cx-header__top" 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>
22
+ <ol>
23
+ {{- range $i, $h := $h2s }}
24
+ <li><a href="#{{ $h.ID }}"><span class="cx-toc__no">{{ printf "%02d" (add $i 1) }}</span>{{ $h.Title | plainify | htmlUnescape }}</a></li>
25
+ {{- end }}
26
+ </ol>
27
+ </nav>
28
+ </details>
29
+ {{- end }}
30
+ {{- end }}
9
31
  {{- if $ms.search }}
10
32
  {{ partial "motifspec/search.html" . }}
11
33
  {{- end }}
@@ -19,11 +41,28 @@
19
41
  {{- with $ms.version }}
20
42
  <a class="cx-header__version" href="{{ $ms.changelog | default "#" }}">v{{ . }}<span class="cx-visually-hidden">, changelog</span></a>
21
43
  {{- end }}
22
- <button class="cx-theme-toggle" type="button" data-theme-toggle hidden aria-label="Switch to dark theme">
23
- <svg class="cx-icon" data-icon="to-dark" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-dark"></use></svg>
24
- <svg class="cx-icon" data-icon="to-light" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-light"></use></svg>
25
- <span class="cx-tooltip" aria-hidden="true">Switch to dark theme</span>
26
- </button>
44
+ {{ partial "motifspec/theme-toggle.html" . }}
45
+ {{- if $docs }}
46
+ <details class="cx-header__menu">
47
+ <summary aria-label="Menu"><svg class="cx-icon" data-when="closed" aria-hidden="true" focusable="false"><use href="#cx-icon-menu"></use></svg><svg class="cx-icon" data-when="open" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></summary>
48
+ <div class="cx-header__sheet" data-pagefind-ignore>
49
+ <nav class="cx-header__sheet-body cx-docs-nav" aria-label="Documentation">
50
+ {{ partial "motifspec/docs-nav-groups.html" (dict "page" . "prefix" "menu") }}
51
+ </nav>
52
+ <div class="cx-header__sheet-foot">
53
+ <ul class="cx-docs-nav__list">
54
+ {{- range $external }}
55
+ <li><a href="{{ .URL }}">{{ .Name }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg></a></li>
56
+ {{- end }}
57
+ {{- with $ms.version }}
58
+ <li><a href="{{ $ms.changelog | default "#" }}">Changelog<span class="cx-header__version">v{{ . }}</span></a></li>
59
+ {{- end }}
60
+ </ul>
61
+ <div class="cx-header__setting">Theme{{ partial "motifspec/theme-toggle.html" . }}</div>
62
+ </div>
63
+ </div>
64
+ </details>
65
+ {{- end }}
27
66
  </div>
28
67
  </div>
29
68
  </header>
@@ -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>
@@ -0,0 +1,7 @@
1
+ {{- /* site-header.md: the theme toggle, an icon-only button that shows the action. dist/codex.js reveals it and keeps
2
+ every toggle on the page in step. Context: a page. */ -}}
3
+ <button class="cx-theme-toggle" type="button" data-theme-toggle hidden aria-label="Switch to dark theme">
4
+ <svg class="cx-icon" data-icon="to-dark" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-dark"></use></svg>
5
+ <svg class="cx-icon" data-icon="to-light" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-light"></use></svg>
6
+ <span class="cx-tooltip" aria-hidden="true">Switch to dark theme</span>
7
+ </button>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitrien/motifspec",
3
- "version": "1.20.1",
3
+ "version": "1.22.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",