@aitrien/motifspec 1.21.0 → 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,23 @@
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
+
5
22
  ## [1.21.0] - 2026-11-05
6
23
 
7
24
  ### Added
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.21.0 — 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. */
@@ -1344,12 +1415,13 @@ body:not(.cx-backdrop-page):has(.cx-backdrop-page) { background: transparent; }
1344
1415
  so it stays beside the navigation as the page scrolls. It reaches the left edge of the docs' main column
1345
1416
  (--_side: the page container's margin and gutter, then the navigation column), and the page's surface fades in
1346
1417
  across it, so the contours show in the margin, keep color.backdrop.calm behind the navigation, and are gone before
1347
- 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. */
1348
1420
  .cx-backdrop--side { display: none; }
1349
1421
  .cx-backdrop-page--side {
1350
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));
1351
1423
  }
1352
- @media (width >= 48rem) {
1424
+ @media (width >= 64rem) {
1353
1425
  .cx-backdrop-page--side { background: linear-gradient(to right, transparent, var(--cx-color-surface-base) var(--_side)); }
1354
1426
  /* The header keeps the same fade when it sticks: what scrolls under it is the article, which is past --_side. */
1355
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) {
package/dist/tokens.css CHANGED
@@ -1,4 +1,4 @@
1
- /* MotifSpec 1.21.0 — 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.21.0";
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.21.0",
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
 
@@ -73,7 +73,7 @@ From the bottom up: the canvas (`color.surface.base`), the contours (the specime
73
73
 
74
74
  ### The side
75
75
 
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.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.
77
77
 
78
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.
79
79
 
@@ -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.
@@ -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
 
@@ -132,10 +132,12 @@ Every partial below is called as `partial "motifspec/<name>.html" <context>`.
132
132
  | `pagination-entries.html` | `pagination.md` | `dict "page" . "label" "Post navigation" "noun" "Post"`. Previous and next in the page's section, oldest first. |
133
133
  | `pagination-pages.html` | `pagination.md` | `dict "pager" $pager "label" "Writing pages"`. Pages of a paginated list; nothing when it fits on one page. |
134
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. |
135
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. |
136
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`. |
137
138
  | `pagination-docs.html` | `pagination.md`, `page-footer.md` | A page. Previous and next in the order `docs-nav.html` lists the pages. |
138
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. |
139
141
  | `back-link.html` | `button-and-link.md` | `dict "href" "…" "label" "All work"`. |
140
142
  | `section-heading.html` | `heading-anchor.md` | `dict "id" "work" "title" "Selected work"`, inside a `<section id="work" aria-labelledby="work-title">`. |
141
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
@@ -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,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.21.0",
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",