@aitrien/motifspec 1.18.1 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +90 -72
- package/dist/backdrop-side.html +1 -0
- package/dist/codex.css +236 -2
- package/dist/codex.js +176 -1
- package/dist/plate.js +4 -4
- package/dist/tokens.css +5 -1
- package/dist/tokens.js +21 -1
- package/dist/tokens.json +21 -1
- package/docs/components/_template.md +2 -1
- package/docs/components/accession-label.md +2 -1
- package/docs/components/backdrop.md +20 -8
- package/docs/components/button-and-link.md +2 -2
- package/docs/components/callout.md +1 -1
- package/docs/components/code-block.md +1 -1
- package/docs/components/component-preview.md +68 -0
- package/docs/components/data-table.md +2 -2
- package/docs/components/disclosure.md +1 -1
- package/docs/components/docs-shell.md +126 -0
- package/docs/components/figure.md +2 -1
- package/docs/components/heading-anchor.md +1 -1
- package/docs/components/icon.md +5 -1
- package/docs/components/keyboard-key.md +1 -1
- package/docs/components/ornament.md +3 -2
- package/docs/components/page-actions.md +56 -0
- package/docs/components/page-footer.md +67 -0
- package/docs/components/pagination.md +2 -1
- package/docs/components/post-list-item.md +1 -1
- package/docs/components/project-card.md +1 -1
- package/docs/components/prose.md +2 -1
- package/docs/components/search.md +117 -0
- package/docs/components/site-footer.md +3 -3
- package/docs/components/site-header.md +22 -1
- package/docs/components/specimen-plate.md +2 -2
- package/docs/components/status.md +2 -1
- package/docs/components/steps.md +70 -0
- package/docs/components/table-of-contents.md +1 -1
- package/docs/components/tabs.md +81 -0
- package/docs/components/tag.md +1 -1
- package/docs/components/token-table.md +96 -0
- package/docs/components/tooltip.md +1 -1
- package/docs/hugo.md +72 -4
- package/docs/layouts/a-la-carte.md +1 -0
- package/docs/layouts/dashboard.md +2 -0
- package/docs/layouts/documentation.md +8 -8
- package/docs/layouts/portfolio.md +2 -0
- package/docs/syntax-highlighting.md +1 -0
- package/layouts/_markup/render-blockquote.html +1 -1
- package/layouts/_markup/render-codeblock.html +18 -3
- package/layouts/_markup/render-heading.html +1 -1
- package/layouts/_markup/render-image.html +5 -4
- package/layouts/_markup/render-link.html +1 -1
- package/layouts/_markup/render-table.html +3 -2
- package/layouts/_partials/motifspec/article.html +13 -8
- package/layouts/_partials/motifspec/body-start.html +8 -4
- package/layouts/_partials/motifspec/docs-nav.html +31 -0
- package/layouts/_partials/motifspec/page-actions.html +8 -0
- package/layouts/_partials/motifspec/page-footer.html +27 -0
- package/layouts/_partials/motifspec/pagination-docs.html +37 -0
- package/layouts/_partials/motifspec/search.html +18 -0
- package/layouts/_partials/motifspec/site-header.html +11 -2
- package/layouts/_partials/motifspec/table-of-contents.html +1 -1
- package/layouts/home.markdown.md +7 -0
- package/layouts/page.markdown.md +7 -0
- package/layouts/section.markdown.md +7 -0
- package/package.json +7 -4
- package/scripts/check.mjs +16 -19
- package/scripts/lib.mjs +40 -2
- package/tokens/color.json +13 -0
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.
|
|
5
|
+
/* MotifSpec 1.20.0 — generated from tokens/*.json. Do not edit.
|
|
6
6
|
Themes: semantic colours use light-dark(); color-scheme follows the system unless
|
|
7
7
|
<html data-theme="light|dark"> pins it. --cx-primitive-* are for this file only. */
|
|
8
8
|
:root {
|
|
@@ -182,6 +182,10 @@
|
|
|
182
182
|
|
|
183
183
|
/* color.wash */
|
|
184
184
|
--cx-color-wash-hover: var(--cx-primitive-color-amount-1);
|
|
185
|
+
--cx-color-wash-scrim: var(--cx-primitive-color-amount-3);
|
|
186
|
+
|
|
187
|
+
/* color.scrim */
|
|
188
|
+
--cx-color-scrim: light-dark(var(--cx-primitive-color-ash-1000), var(--cx-primitive-color-ash-1000));
|
|
185
189
|
|
|
186
190
|
/* primitive.motion.duration */
|
|
187
191
|
--cx-primitive-motion-duration-0: 0ms;
|
|
@@ -547,6 +551,171 @@ p, li, dd, figcaption { text-wrap: pretty; }
|
|
|
547
551
|
.cx-article > .cx-article__main { flex: 999 1 0; min-width: min(100%, 60%); }
|
|
548
552
|
.cx-article > .cx-toc { flex: 1 1 var(--cx-size-column-sidebar); }
|
|
549
553
|
|
|
554
|
+
/* ------------------------------------------------------------ docs shell (documentation layout) */
|
|
555
|
+
/* A side column of page navigation beside the main column, inside the page container. The main column holds the
|
|
556
|
+
page head and a cx-article, so "On this page" sits on the right when there is room for it. */
|
|
557
|
+
.cx-docs { display: grid; grid-template-columns: var(--cx-size-column-sidebar) minmax(0, 1fr); align-items: start; gap: 0 var(--cx-space-gutter-grid); }
|
|
558
|
+
.cx-docs__main { min-width: 0; padding-bottom: var(--cx-space-section-sm); }
|
|
559
|
+
.cx-docs-nav { min-width: 0; padding-block: var(--cx-space-section-sm); font-size: var(--cx-font-size-small); }
|
|
560
|
+
/* Docked by dist/codex.js while it sits beside the main column: it stays in view and scrolls on its own. */
|
|
561
|
+
.cx-docs-nav.is-docked {
|
|
562
|
+
position: sticky; top: var(--_header-height, var(--cx-size-target-touch));
|
|
563
|
+
max-height: calc(var(--_viewport-height) - var(--_header-height, var(--cx-size-target-touch))); overflow-y: auto; scrollbar-width: thin;
|
|
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); }
|
|
572
|
+
.cx-docs-nav__groups { display: flex; flex-direction: column; gap: var(--cx-space-stack-md); }
|
|
573
|
+
.cx-docs-nav__group > summary {
|
|
574
|
+
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);
|
|
575
|
+
color: var(--cx-color-text-primary); font-weight: var(--cx-font-weight-strong); cursor: pointer; list-style: none;
|
|
576
|
+
}
|
|
577
|
+
.cx-docs-nav__group > summary .cx-icon { margin-left: auto; color: var(--cx-color-text-muted); transition: transform var(--cx-motion-duration-base) var(--cx-motion-easing-standard); }
|
|
578
|
+
.cx-docs-nav__list { margin: 0; padding: 0; list-style: none; border-left: var(--cx-border-width-hairline) solid var(--cx-color-border-default); }
|
|
579
|
+
.cx-docs-nav__group > .cx-docs-nav__list { margin-top: var(--cx-space-stack-xs); }
|
|
580
|
+
.cx-docs-nav__list a {
|
|
581
|
+
display: flex; align-items: center; min-height: var(--cx-size-target-min);
|
|
582
|
+
margin-left: calc(var(--cx-border-width-hairline) * -1); padding: var(--cx-space-inset-xs) var(--cx-space-inset-md);
|
|
583
|
+
border-left: var(--cx-border-width-emphasis) solid transparent; color: var(--cx-color-text-secondary); text-decoration: none; line-height: var(--cx-font-line-height-ui);
|
|
584
|
+
transition: color var(--cx-motion-duration-base) var(--cx-motion-easing-standard), border-color var(--cx-motion-duration-base) var(--cx-motion-easing-standard);
|
|
585
|
+
}
|
|
586
|
+
.cx-docs-nav__list a:hover { color: var(--cx-color-text-primary); border-left-color: var(--cx-color-border-strong); }
|
|
587
|
+
.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) {
|
|
595
|
+
.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); }
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/* ------------------------------------------------------------ page actions and page footer (documentation layout) */
|
|
601
|
+
/* Copy page and View as Markdown, under a docs page's title. */
|
|
602
|
+
.cx-page-actions { display: flex; flex-wrap: wrap; gap: var(--cx-space-inline-xs); }
|
|
603
|
+
.cx-page-actions .cx-icon { flex: none; }
|
|
604
|
+
/* After the article: when the page last changed and where to edit it, then previous and next. */
|
|
605
|
+
.cx-page-footer {
|
|
606
|
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cx-space-stack-sm) var(--cx-space-inline-lg);
|
|
607
|
+
margin-block: var(--cx-space-section-sm) var(--cx-space-stack-lg); padding-top: var(--cx-space-stack-md);
|
|
608
|
+
border-top: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle);
|
|
609
|
+
}
|
|
610
|
+
.cx-page-footer .cx-meta { margin: 0; }
|
|
611
|
+
|
|
612
|
+
/* ------------------------------------------------------------ search (a dialog over the page, from the header) */
|
|
613
|
+
.cx-search-trigger {
|
|
614
|
+
flex: none; display: inline-flex; align-items: center; gap: var(--cx-space-inline-sm); min-height: var(--cx-size-target-touch);
|
|
615
|
+
padding-inline: var(--cx-space-inset-sm) var(--cx-space-inset-xs); border: var(--cx-border-width-hairline) solid var(--cx-color-border-strong);
|
|
616
|
+
border-radius: var(--cx-radius-pill); background: var(--cx-color-surface-base); color: var(--cx-color-text-secondary);
|
|
617
|
+
font: inherit; font-size: var(--cx-font-size-small); cursor: pointer;
|
|
618
|
+
}
|
|
619
|
+
.cx-search-trigger:hover { color: var(--cx-color-text-primary); background: var(--cx-color-surface-hover); }
|
|
620
|
+
.cx-search-trigger__keys { display: inline-flex; gap: var(--cx-space-inline-xs); }
|
|
621
|
+
.cx-search {
|
|
622
|
+
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));
|
|
623
|
+
margin: var(--cx-space-section-sm) auto auto; padding: 0; border: var(--cx-border-width-hairline) solid var(--cx-color-border-default);
|
|
624
|
+
background: var(--cx-color-surface-raised); color: var(--cx-color-text-primary);
|
|
625
|
+
}
|
|
626
|
+
.cx-search[open] { display: flex; flex-direction: column; }
|
|
627
|
+
.cx-search::backdrop { background: color-mix(in srgb, var(--cx-color-scrim) var(--cx-color-wash-scrim), transparent); }
|
|
628
|
+
.cx-search__form { display: flex; align-items: center; gap: var(--cx-space-inline-sm); padding: var(--cx-space-inset-xs) var(--cx-space-inset-xs) var(--cx-space-inset-xs) var(--cx-space-inset-md); border-bottom: var(--cx-border-width-hairline) solid var(--cx-color-border-default); }
|
|
629
|
+
.cx-search__form > .cx-icon { flex: none; color: var(--cx-color-text-muted); }
|
|
630
|
+
.cx-search__input {
|
|
631
|
+
flex: 1 1 auto; min-width: 0; min-height: var(--cx-size-target-touch); padding: 0; border: 0; background: transparent;
|
|
632
|
+
color: var(--cx-color-text-primary); font: inherit; font-size: var(--cx-font-size-body);
|
|
633
|
+
}
|
|
634
|
+
.cx-search__input:focus { outline: none; }
|
|
635
|
+
.cx-search__input::-webkit-search-cancel-button { display: none; }
|
|
636
|
+
.cx-search__form:focus-within { box-shadow: inset 0 calc(var(--cx-border-width-focus) * -1) 0 var(--cx-color-focus-ring); }
|
|
637
|
+
.cx-search__close {
|
|
638
|
+
flex: none; display: inline-grid; place-items: center; width: var(--cx-size-target-touch); height: var(--cx-size-target-touch); padding: 0;
|
|
639
|
+
border: 0; border-radius: var(--cx-radius-pill); background: transparent; color: var(--cx-color-text-secondary); cursor: pointer;
|
|
640
|
+
}
|
|
641
|
+
.cx-search__close:hover { color: var(--cx-color-text-primary); background: var(--cx-color-surface-hover); }
|
|
642
|
+
.cx-search__status { margin: 0; padding: var(--cx-space-inset-sm) var(--cx-space-inset-md); font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); letter-spacing: var(--cx-font-tracking-ui); color: var(--cx-color-text-muted); }
|
|
643
|
+
.cx-search__status:empty { display: none; }
|
|
644
|
+
.cx-search__results { margin: 0; padding: 0 0 var(--cx-space-inset-xs); list-style: none; overflow-y: auto; }
|
|
645
|
+
.cx-search__result {
|
|
646
|
+
display: flex; flex-direction: column; gap: var(--cx-space-stack-xs); padding: var(--cx-space-inset-sm) var(--cx-space-inset-md);
|
|
647
|
+
border-top: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle); color: var(--cx-color-text-primary); text-decoration: none;
|
|
648
|
+
}
|
|
649
|
+
.cx-search__result:hover, .cx-search__result:focus-visible { background: var(--cx-color-surface-hover); }
|
|
650
|
+
.cx-search__result:focus-visible { outline-offset: calc(var(--cx-border-focus-offset) * -1); }
|
|
651
|
+
.cx-search__title { font-weight: var(--cx-font-weight-strong); line-height: var(--cx-font-line-height-heading); }
|
|
652
|
+
.cx-search__excerpt { font-size: var(--cx-font-size-small); line-height: var(--cx-font-line-height-ui); color: var(--cx-color-text-secondary); }
|
|
653
|
+
.cx-search__excerpt mark { background: var(--cx-color-surface-highlight); color: var(--cx-color-text-primary); }
|
|
654
|
+
@media (width < 48rem) {
|
|
655
|
+
.cx-search-trigger { width: var(--cx-size-target-touch); padding: 0; justify-content: center; }
|
|
656
|
+
.cx-search-trigger__keys { display: none; }
|
|
657
|
+
/* Icon only on a phone, but the label stays as the button's name (visually hidden, as cx-visually-hidden). */
|
|
658
|
+
.cx-search-trigger__label {
|
|
659
|
+
position: absolute; width: var(--cx-border-width-hairline); height: var(--cx-border-width-hairline);
|
|
660
|
+
margin: calc(var(--cx-border-width-hairline) * -1); padding: 0; overflow: hidden;
|
|
661
|
+
clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/* The header's version, when it has one: the release a docs site describes, linking to its changelog. */
|
|
665
|
+
.cx-header__version { display: inline-flex; align-items: center; min-height: var(--cx-size-target-touch); padding-inline: var(--_nav-pad); border-radius: var(--cx-radius-pill); color: var(--cx-color-text-secondary); font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); text-decoration: none; }
|
|
666
|
+
@media (hover: hover) { .cx-header__version:hover { color: var(--cx-color-text-primary); background: var(--_wash); } }
|
|
667
|
+
.cx-nav a .cx-icon { margin-left: var(--cx-space-inline-xs); }
|
|
668
|
+
|
|
669
|
+
/* ------------------------------------------------------------ component preview (a live example above its code) */
|
|
670
|
+
/* The example runs in its own document (an iframe's srcdoc) with the system's stylesheet and script, so its ids,
|
|
671
|
+
sticky headers and landmarks can't clash with the page around it. dist/codex.js sizes it to its content. */
|
|
672
|
+
.cx-preview { margin-block: var(--cx-space-stack-lg); border: var(--cx-border-width-hairline) solid var(--cx-color-border-default); }
|
|
673
|
+
.cx-preview__frame {
|
|
674
|
+
display: block; width: 100%; height: var(--_frame-height, var(--cx-size-column-card)); border: 0;
|
|
675
|
+
border-bottom: var(--cx-border-width-hairline) solid var(--cx-color-border-default); background: var(--cx-color-surface-base);
|
|
676
|
+
}
|
|
677
|
+
.cx-preview > .cx-code { margin: 0; border: 0; }
|
|
678
|
+
.cx-preview-body { margin: 0; padding: var(--cx-space-inset-md); background: var(--cx-color-surface-base); }
|
|
679
|
+
|
|
680
|
+
/* ------------------------------------------------------------ steps (a numbered procedure) */
|
|
681
|
+
.cx-steps, .cx-prose .cx-steps { margin: 0; padding: 0; list-style: none; counter-reset: cx-step; }
|
|
682
|
+
.cx-steps > li::marker { content: none; }
|
|
683
|
+
/* The number sits in the step's left padding, so a step's content flows as ordinary text: a Markdown list item's
|
|
684
|
+
bold lead-in, inline code and links stay on their lines. */
|
|
685
|
+
.cx-steps > li {
|
|
686
|
+
position: relative; counter-increment: cx-step; margin: 0;
|
|
687
|
+
padding: var(--cx-space-stack-md) 0 var(--cx-space-stack-md) calc(var(--cx-size-target-min) + var(--cx-space-inline-md));
|
|
688
|
+
border-top: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle);
|
|
689
|
+
}
|
|
690
|
+
.cx-steps > li:last-child { border-bottom: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle); }
|
|
691
|
+
.cx-steps > li::before {
|
|
692
|
+
content: counter(cx-step, decimal-leading-zero); position: absolute; left: 0; top: var(--cx-space-stack-md);
|
|
693
|
+
font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); letter-spacing: var(--cx-font-tracking-ui);
|
|
694
|
+
line-height: var(--cx-font-line-height-body); font-variant-numeric: tabular-nums; color: var(--cx-color-text-accent);
|
|
695
|
+
}
|
|
696
|
+
.cx-steps > li > :first-child { margin-top: 0; }
|
|
697
|
+
.cx-steps > li > :last-child { margin-bottom: 0; }
|
|
698
|
+
/* A step's title: an h3 with this class in HTML, or the bold lead-in of a Markdown list item. */
|
|
699
|
+
.cx-steps .cx-steps__title, .cx-steps > li > strong:first-child { display: block; margin: 0 0 var(--cx-space-stack-xs); font-size: var(--cx-font-size-body); font-weight: var(--cx-font-weight-strong); line-height: var(--cx-font-line-height-heading); }
|
|
700
|
+
|
|
701
|
+
/* ------------------------------------------------------------ tabs (the same content in two or more forms) */
|
|
702
|
+
/* Without script every panel shows, each under its own label. dist/codex.js adds a tab list, keeps one panel shown
|
|
703
|
+
and hides the labels (the tabs name the panels). */
|
|
704
|
+
.cx-tabs { margin-block: var(--cx-space-stack-lg); }
|
|
705
|
+
.cx-tabs__panel + .cx-tabs__panel { margin-top: var(--cx-space-stack-lg); }
|
|
706
|
+
.cx-tabs .cx-tabs__label { margin: 0 0 var(--cx-space-stack-sm); font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); font-weight: var(--cx-font-weight-ui); letter-spacing: var(--cx-font-tracking-label); text-transform: uppercase; color: var(--cx-color-text-muted); }
|
|
707
|
+
.cx-tabs.is-tabbed .cx-tabs__label { display: none; }
|
|
708
|
+
.cx-tabs.is-tabbed .cx-tabs__panel + .cx-tabs__panel { margin-top: 0; }
|
|
709
|
+
.cx-tabs__list { display: flex; flex-wrap: wrap; gap: 0 var(--cx-space-inline-xs); margin-bottom: var(--cx-space-stack-sm); border-bottom: var(--cx-border-width-hairline) solid var(--cx-color-border-default); }
|
|
710
|
+
.cx-tabs__tab {
|
|
711
|
+
min-height: var(--cx-size-target-control); margin-bottom: calc(var(--cx-border-width-hairline) * -1); padding-inline: var(--cx-space-inset-md);
|
|
712
|
+
border: 0; border-bottom: var(--cx-border-width-emphasis) solid transparent; background: transparent; color: var(--cx-color-text-secondary);
|
|
713
|
+
font: inherit; font-size: var(--cx-font-size-small); cursor: pointer;
|
|
714
|
+
}
|
|
715
|
+
.cx-tabs__tab:hover { color: var(--cx-color-text-primary); border-bottom-color: var(--cx-color-border-strong); }
|
|
716
|
+
.cx-tabs__tab[aria-selected="true"] { color: var(--cx-color-text-primary); font-weight: var(--cx-font-weight-strong); border-bottom-color: var(--cx-color-accent-border); }
|
|
717
|
+
.cx-tabs__panel:focus-visible { outline-offset: var(--cx-border-focus-offset); }
|
|
718
|
+
|
|
550
719
|
/* ------------------------------------------------------------ site header and nav */
|
|
551
720
|
.cx-header {
|
|
552
721
|
position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
|
|
@@ -929,6 +1098,50 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
|
|
|
929
1098
|
.cx-table td.is-actions { width: 1%; white-space: nowrap; }
|
|
930
1099
|
.cx-table__actions { display: flex; justify-content: flex-end; gap: var(--cx-space-inline-xs); }
|
|
931
1100
|
|
|
1101
|
+
/* ------------------------------------------------------------ token table (token-table.md, documentation layout) */
|
|
1102
|
+
/* What a token looks like, beside its name and rule, on the reference pages that MotifSpec's docs generator writes
|
|
1103
|
+
from dist/tokens.json. Each shows a value from a private custom property the generator sets on the element
|
|
1104
|
+
(--_swatch; --_fg and --_bg; --_size and --_family; --_width). That is the one place MotifSpec writes a style
|
|
1105
|
+
attribute, and only in generated pages; without it each falls back to a neutral look. */
|
|
1106
|
+
.cx-swatch {
|
|
1107
|
+
display: inline-block; flex: none; vertical-align: middle;
|
|
1108
|
+
width: var(--cx-size-target-min); height: var(--cx-size-target-min); margin-right: var(--cx-space-inline-sm);
|
|
1109
|
+
border: var(--cx-border-width-hairline) solid var(--cx-color-border-default);
|
|
1110
|
+
background: var(--_swatch, var(--cx-color-surface-sunken));
|
|
1111
|
+
}
|
|
1112
|
+
/* A tile: the colour as the background, with its name and value written on it in the ink the generator picks for
|
|
1113
|
+
contrast (--_ink: the darkest or lightest neutral, whichever reads better on that colour). */
|
|
1114
|
+
.cx-swatch--tile {
|
|
1115
|
+
display: inline-flex; flex-direction: column; justify-content: space-between; gap: var(--cx-space-stack-xs); vertical-align: top;
|
|
1116
|
+
width: auto; min-width: calc(var(--cx-size-target-touch) * 2.4); height: auto; min-height: var(--cx-size-target-touch);
|
|
1117
|
+
margin: 0; padding: var(--cx-space-inset-xs) var(--cx-space-inset-sm);
|
|
1118
|
+
border-color: var(--cx-color-border-subtle); color: var(--_ink, var(--cx-color-text-primary));
|
|
1119
|
+
font-family: var(--cx-font-family-mono); font-size: var(--cx-font-size-label); line-height: var(--cx-font-line-height-ui);
|
|
1120
|
+
font-variant-numeric: tabular-nums; white-space: nowrap;
|
|
1121
|
+
}
|
|
1122
|
+
.cx-swatch--tile b { font-weight: var(--cx-font-weight-strong); }
|
|
1123
|
+
.cx-palette, .cx-prose .cx-palette {
|
|
1124
|
+
display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--cx-size-target-touch) * 2.4), 1fr));
|
|
1125
|
+
gap: var(--cx-space-inline-xs); margin: 0; padding: 0; list-style: none;
|
|
1126
|
+
}
|
|
1127
|
+
.cx-palette > li::marker { content: none; }
|
|
1128
|
+
.cx-prose .cx-palette > li { margin: 0; padding: 0; }
|
|
1129
|
+
.cx-palette .cx-swatch--tile { display: flex; width: 100%; min-height: calc(var(--cx-size-target-touch) * 1.6); }
|
|
1130
|
+
/* In a token table (cx-table cx-token-table) a token's name stays on one line; the table scrolls sideways instead. */
|
|
1131
|
+
.cx-token-table th[scope="row"] code { white-space: nowrap; }
|
|
1132
|
+
.cx-token-sample {
|
|
1133
|
+
display: block; margin: 0; white-space: nowrap; font-size: var(--_size, inherit); font-family: var(--_family, inherit);
|
|
1134
|
+
line-height: var(--cx-font-line-height-heading); color: var(--cx-color-text-primary); overflow-wrap: anywhere;
|
|
1135
|
+
}
|
|
1136
|
+
.cx-token-bar { display: block; width: var(--_width, 0%); height: var(--cx-space-inset-sm); background: var(--cx-color-accent-fill-rest); }
|
|
1137
|
+
.cx-pair-sample {
|
|
1138
|
+
display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
|
|
1139
|
+
min-width: var(--cx-size-target-control); min-height: var(--cx-size-target-min); margin-right: var(--cx-space-inline-sm);
|
|
1140
|
+
border: var(--cx-border-width-hairline) solid var(--cx-color-border-subtle);
|
|
1141
|
+
color: var(--_fg, var(--cx-color-text-primary)); background: var(--_bg, var(--cx-color-surface-base));
|
|
1142
|
+
font-family: var(--cx-font-family-body); font-weight: var(--cx-font-weight-strong);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
932
1145
|
/* ------------------------------------------------------------ project card */
|
|
933
1146
|
.cx-cards { display: grid; gap: var(--cx-space-gutter-grid); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--cx-size-column-card)), 1fr)); margin: 0; padding: 0; list-style: none; }
|
|
934
1147
|
.cx-card {
|
|
@@ -1073,7 +1286,7 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
|
|
|
1073
1286
|
footer and reading happens on the plain surface. Two layers, each size.backdrop.fade tall and scrolling with the page:
|
|
1074
1287
|
the head (home page only, first child of the page) and the foot (every page, at the bottom). */
|
|
1075
1288
|
:root:has(.cx-backdrop-page) { background: var(--cx-color-surface-base); }
|
|
1076
|
-
/* When the page class sits on a wrapper
|
|
1289
|
+
/* When the page class sits on a wrapper rather than <body>, body's own surface would cover the backdrop. */
|
|
1077
1290
|
body:not(.cx-backdrop-page):has(.cx-backdrop-page) { background: transparent; }
|
|
1078
1291
|
/* Positioned so the layers can sit at its top and bottom; no z-index, so the layers still paint under its surface. */
|
|
1079
1292
|
.cx-backdrop-page {
|
|
@@ -1112,6 +1325,27 @@ body:not(.cx-backdrop-page):has(.cx-backdrop-page) { background: transparent; }
|
|
|
1112
1325
|
mask-composite: intersect;
|
|
1113
1326
|
}
|
|
1114
1327
|
.cx-backdrop--foot { bottom: 0; }
|
|
1328
|
+
/* Side: documentation pages (cx-backdrop-page--side) from size.breakpoint.md up. One layer down the left edge, fixed,
|
|
1329
|
+
so it stays beside the navigation as the page scrolls. It reaches the left edge of the docs' main column
|
|
1330
|
+
(--_side: the page container's margin and gutter, then the navigation column), and the page's surface fades in
|
|
1331
|
+
across it, so the contours show in the margin, keep color.backdrop.calm behind the navigation, and are gone before
|
|
1332
|
+
the article. The header fades the same way, so there is no edge across the band. On a phone the foot takes over. */
|
|
1333
|
+
.cx-backdrop--side { display: none; }
|
|
1334
|
+
.cx-backdrop-page--side {
|
|
1335
|
+
--_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));
|
|
1336
|
+
}
|
|
1337
|
+
@media (width >= 48rem) {
|
|
1338
|
+
.cx-backdrop-page--side { background: linear-gradient(to right, transparent, var(--cx-color-surface-base) var(--_side)); }
|
|
1339
|
+
/* The header keeps the same fade when it sticks: what scrolls under it is the article, which is past --_side. */
|
|
1340
|
+
.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)); }
|
|
1341
|
+
.cx-backdrop-page--side .cx-header[data-scrolled="true"] { background-color: transparent; }
|
|
1342
|
+
.cx-backdrop-page--side .cx-backdrop--foot { display: none; }
|
|
1343
|
+
.cx-backdrop-page--side .cx-backdrop--side {
|
|
1344
|
+
display: block; position: fixed; top: 0; bottom: 0; left: 0; right: auto; width: var(--_side); height: auto;
|
|
1345
|
+
-webkit-mask-image: linear-gradient(to right, var(--_full), var(--_calm) 55%);
|
|
1346
|
+
mask-image: linear-gradient(to right, var(--_full), var(--_calm) 55%);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1115
1349
|
.cx-backdrop .cx-plate__map { position: relative; z-index: 0; width: 100%; height: 100%; filter: saturate(var(--cx-color-backdrop-saturation)); }
|
|
1116
1350
|
/* Sharp hairlines, as on the plate, without its survey grid. No draw-in: the backdrop is already there when a page opens. */
|
|
1117
1351
|
.cx-backdrop .cx-plate__grid { display: none; }
|
package/dist/codex.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// MotifSpec behaviour: theme toggle, the backdrop header's scroll state, tooltip dismissal, code copy buttons,
|
|
2
2
|
// TOC docking and active section.
|
|
3
|
-
// Shipped as dist/codex.js (@aitrien/motifspec/codex.js)
|
|
3
|
+
// Shipped as dist/codex.js (@aitrien/motifspec/codex.js).
|
|
4
4
|
// Enhancement only. Without this script: themes follow the system, code is selectable, the TOC is a plain open list,
|
|
5
5
|
// and every control that needs script stays hidden. Load it with `defer`; it also works inline at the end of <body>.
|
|
6
6
|
// Pair it with dist/theme-init.js inline in <head>, which applies a stored theme before first paint.
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
b.setAttribute('aria-label', label);
|
|
22
22
|
var tip = b.querySelector('.cx-tooltip'); if (tip) tip.textContent = label;
|
|
23
23
|
});
|
|
24
|
+
// Component previews run in their own documents; keep them in the page's theme.
|
|
25
|
+
document.querySelectorAll('.cx-preview__frame').forEach(function (f) {
|
|
26
|
+
try { var r = f.contentDocument && f.contentDocument.documentElement; if (r) { if (pref === 'auto') r.removeAttribute('data-theme'); else r.setAttribute('data-theme', pref); } } catch (e) { /* not ready yet */ }
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
// Durations come from the tokens, never from literals in this file.
|
|
@@ -64,6 +68,7 @@
|
|
|
64
68
|
var end = header.querySelector('.cx-header__end'), mark = header.querySelector('.cx-wordmark');
|
|
65
69
|
var measure = function () {
|
|
66
70
|
root.style.setProperty('--_header-height', header.offsetHeight + 'px');
|
|
71
|
+
root.style.setProperty('--_viewport-height', window.innerHeight + 'px');
|
|
67
72
|
// When the nav and controls wrap below the wordmark, mark the header so the nav aligns with the page text.
|
|
68
73
|
if (end && mark) header.toggleAttribute('data-wrapped', end.offsetTop > mark.offsetTop + mark.offsetHeight / 2);
|
|
69
74
|
};
|
|
@@ -105,6 +110,176 @@
|
|
|
105
110
|
});
|
|
106
111
|
});
|
|
107
112
|
|
|
113
|
+
// Component previews: size each frame to its document's body (the root is never shorter than the frame), and keep
|
|
114
|
+
// its theme. Inside a preview, links don't navigate.
|
|
115
|
+
document.querySelectorAll('.cx-preview__frame').forEach(function (f) {
|
|
116
|
+
var fit = function () {
|
|
117
|
+
try { var d = f.contentDocument; if (d && d.body) f.style.setProperty('--_frame-height', d.body.offsetHeight + 'px'); } catch (e) { /* cross-origin: keep the default height */ }
|
|
118
|
+
};
|
|
119
|
+
var start = function () {
|
|
120
|
+
apply(theme); fit();
|
|
121
|
+
try { if ('ResizeObserver' in window) new ResizeObserver(fit).observe(f.contentDocument.body); } catch (e) { /* keep the measured height */ }
|
|
122
|
+
};
|
|
123
|
+
f.addEventListener('load', start);
|
|
124
|
+
try { if (f.contentDocument && f.contentDocument.readyState === 'complete' && f.contentDocument.body && f.contentDocument.body.childNodes.length) start(); } catch (e) { /* wait for load */ }
|
|
125
|
+
});
|
|
126
|
+
if (document.body.classList.contains('cx-preview-body')) {
|
|
127
|
+
document.addEventListener('click', function (e) { if (e.target.closest && e.target.closest('a[href]')) e.preventDefault(); });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Tabs: turn the labelled panels into a tab list with one panel shown. Sets that share data-tabs stay in step,
|
|
131
|
+
// and the choice is remembered for the next page (cx-tabs:<name> in localStorage).
|
|
132
|
+
document.querySelectorAll('.cx-tabs').forEach(function (set, n) {
|
|
133
|
+
var panels = Array.prototype.slice.call(set.querySelectorAll(':scope > .cx-tabs__panel'));
|
|
134
|
+
if (panels.length < 2) return;
|
|
135
|
+
var list = document.createElement('div'); list.className = 'cx-tabs__list'; list.setAttribute('role', 'tablist');
|
|
136
|
+
if (set.getAttribute('aria-label')) list.setAttribute('aria-label', set.getAttribute('aria-label'));
|
|
137
|
+
var tabs = panels.map(function (panel, i) {
|
|
138
|
+
var label = panel.querySelector('.cx-tabs__label');
|
|
139
|
+
var id = 'cx-tabs-' + n + '-' + i;
|
|
140
|
+
var tab = document.createElement('button'); tab.type = 'button'; tab.className = 'cx-tabs__tab'; tab.id = id + '-tab';
|
|
141
|
+
tab.setAttribute('role', 'tab'); tab.setAttribute('aria-controls', panel.id || (panel.id = id + '-panel'));
|
|
142
|
+
tab.textContent = label ? label.textContent : 'Tab ' + (i + 1);
|
|
143
|
+
panel.setAttribute('role', 'tabpanel'); panel.setAttribute('aria-labelledby', tab.id); panel.tabIndex = 0;
|
|
144
|
+
list.appendChild(tab);
|
|
145
|
+
return tab;
|
|
146
|
+
});
|
|
147
|
+
var key = set.dataset.tabs ? 'cx-tabs:' + set.dataset.tabs : null;
|
|
148
|
+
var select = function (i, focus) {
|
|
149
|
+
tabs.forEach(function (t, j) { t.setAttribute('aria-selected', i === j ? 'true' : 'false'); t.tabIndex = i === j ? 0 : -1; panels[j].hidden = i !== j; });
|
|
150
|
+
if (focus) tabs[i].focus();
|
|
151
|
+
};
|
|
152
|
+
set.insertBefore(list, panels[0]); set.classList.add('is-tabbed');
|
|
153
|
+
var stored = null; try { stored = key && localStorage.getItem(key); } catch (e) { /* storage blocked */ }
|
|
154
|
+
var first = tabs.findIndex(function (t) { return t.textContent === stored; });
|
|
155
|
+
select(first < 0 ? 0 : first);
|
|
156
|
+
set.addEventListener('cx-tabs-sync', function (e) { var i = tabs.findIndex(function (t) { return t.textContent === e.detail; }); if (i >= 0) select(i); });
|
|
157
|
+
var choose = function (i, focus) {
|
|
158
|
+
select(i, focus);
|
|
159
|
+
if (!key) return;
|
|
160
|
+
try { localStorage.setItem(key, tabs[i].textContent); } catch (e) { /* storage blocked */ }
|
|
161
|
+
document.querySelectorAll('.cx-tabs[data-tabs="' + set.dataset.tabs + '"]').forEach(function (other) {
|
|
162
|
+
if (other !== set) other.dispatchEvent(new CustomEvent('cx-tabs-sync', { detail: tabs[i].textContent }));
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
tabs.forEach(function (t, i) { t.addEventListener('click', function () { choose(i); }); });
|
|
166
|
+
list.addEventListener('keydown', function (e) {
|
|
167
|
+
var at = tabs.indexOf(document.activeElement), last = tabs.length - 1;
|
|
168
|
+
var to = { ArrowRight: at + 1 > last ? 0 : at + 1, ArrowLeft: at - 1 < 0 ? last : at - 1, Home: 0, End: last }[e.key];
|
|
169
|
+
if (to === undefined || at < 0) return;
|
|
170
|
+
e.preventDefault(); choose(to, true);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Search: a dialog over a Pagefind index. The trigger is shown once this script runs; Pagefind's script loads on the
|
|
175
|
+
// first open. Ctrl+K or Cmd+K, or "/" outside a text field, opens it; Escape closes it (native to <dialog>).
|
|
176
|
+
document.querySelectorAll('.cx-search[data-search]').forEach(function (dialog) {
|
|
177
|
+
var input = dialog.querySelector('.cx-search__input');
|
|
178
|
+
var list = dialog.querySelector('.cx-search__results');
|
|
179
|
+
var status = dialog.querySelector('.cx-search__status');
|
|
180
|
+
var triggers = document.querySelectorAll('[data-search-open][aria-controls="' + dialog.id + '"]');
|
|
181
|
+
var pagefind = null, failed = false, seq = 0;
|
|
182
|
+
var load = function () {
|
|
183
|
+
if (!pagefind) pagefind = import(dialog.dataset.search).then(function (pf) { return pf.options({ excerptLength: 24 }).then(function () { return pf; }); });
|
|
184
|
+
return pagefind;
|
|
185
|
+
};
|
|
186
|
+
// Pagefind marks matches with <mark> in an escaped excerpt; keep the text and the marks, nothing else.
|
|
187
|
+
var excerpt = function (html) {
|
|
188
|
+
var out = document.createDocumentFragment();
|
|
189
|
+
new DOMParser().parseFromString('<p>' + html + '</p>', 'text/html').body.firstChild.childNodes.forEach(function (n) {
|
|
190
|
+
if (n.nodeName === 'MARK') { var m = document.createElement('mark'); m.textContent = n.textContent; out.appendChild(m); }
|
|
191
|
+
else out.appendChild(document.createTextNode(n.textContent));
|
|
192
|
+
});
|
|
193
|
+
return out;
|
|
194
|
+
};
|
|
195
|
+
var render = function (items, query) {
|
|
196
|
+
list.replaceChildren();
|
|
197
|
+
items.forEach(function (r) {
|
|
198
|
+
var li = document.createElement('li');
|
|
199
|
+
var a = document.createElement('a'); a.className = 'cx-search__result'; a.href = r.url;
|
|
200
|
+
var t = document.createElement('span'); t.className = 'cx-search__title'; t.textContent = (r.meta && r.meta.title) || r.url;
|
|
201
|
+
var e = document.createElement('span'); e.className = 'cx-search__excerpt'; e.appendChild(excerpt(r.excerpt || ''));
|
|
202
|
+
a.append(t, e); li.appendChild(a); list.appendChild(li);
|
|
203
|
+
});
|
|
204
|
+
status.textContent = !query ? '' : items.length ? items.length + (items.length === 1 ? ' result' : ' results') : 'No results for \u201c' + query + '\u201d';
|
|
205
|
+
};
|
|
206
|
+
var search = function () {
|
|
207
|
+
var q = input.value.trim(), n = ++seq;
|
|
208
|
+
if (!q) { render([], ''); return; }
|
|
209
|
+
if (failed) return;
|
|
210
|
+
load().then(function (pf) { return pf.debouncedSearch(q, {}, 150); }).then(function (s) {
|
|
211
|
+
if (!s || n !== seq) return null;
|
|
212
|
+
return Promise.all(s.results.slice(0, 8).map(function (r) { return r.data(); }));
|
|
213
|
+
}).then(function (items) { if (items && n === seq) render(items, q); }, function () {
|
|
214
|
+
failed = true; list.replaceChildren(); status.textContent = 'Search isn\u2019t available right now.';
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
var back = null;
|
|
218
|
+
var open = function () { if (!dialog.open) { back = document.activeElement; dialog.showModal(); input.select(); load().catch(function () {}); } };
|
|
219
|
+
dialog.addEventListener('close', function () { if (back && back.isConnected && back.focus) back.focus(); back = null; });
|
|
220
|
+
triggers.forEach(function (t) { t.hidden = false; t.addEventListener('click', open); });
|
|
221
|
+
dialog.querySelectorAll('[data-search-close]').forEach(function (b) { b.addEventListener('click', function () { dialog.close(); }); });
|
|
222
|
+
dialog.addEventListener('click', function (e) { if (e.target === dialog) dialog.close(); });
|
|
223
|
+
input.addEventListener('input', search);
|
|
224
|
+
// Escape closes, even from the field (a search field would otherwise spend the first Escape clearing itself).
|
|
225
|
+
// Arrow keys move between the field and the results; Enter follows a result as any link does.
|
|
226
|
+
dialog.addEventListener('keydown', function (e) {
|
|
227
|
+
if (e.key === 'Escape') { e.preventDefault(); dialog.close(); return; }
|
|
228
|
+
if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
|
|
229
|
+
var links = Array.prototype.slice.call(list.querySelectorAll('a'));
|
|
230
|
+
if (!links.length) return;
|
|
231
|
+
var at = links.indexOf(document.activeElement);
|
|
232
|
+
var next = e.key === 'ArrowDown' ? (at < 0 ? 0 : Math.min(at + 1, links.length - 1)) : at - 1;
|
|
233
|
+
e.preventDefault();
|
|
234
|
+
if (next < 0) input.focus(); else links[next].focus();
|
|
235
|
+
});
|
|
236
|
+
document.addEventListener('keydown', function (e) {
|
|
237
|
+
var typing = /^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement.tagName) || document.activeElement.isContentEditable;
|
|
238
|
+
if (((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'k') || (e.key === '/' && !typing && !e.ctrlKey && !e.metaKey && !e.altKey)) {
|
|
239
|
+
e.preventDefault(); open();
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Copy page: copies the page's Markdown (its index.md) as plain text. ClipboardItem takes a promise, so the copy
|
|
245
|
+
// still counts as part of the click while the file loads; without it, the text is fetched first.
|
|
246
|
+
document.querySelectorAll('[data-copy-page]').forEach(function (btn) {
|
|
247
|
+
var label = btn.querySelector('.cx-page-actions__label');
|
|
248
|
+
var icon = btn.querySelector('use');
|
|
249
|
+
var set = function (state, text, iconId) {
|
|
250
|
+
btn.dataset.state = state; if (label) label.textContent = text;
|
|
251
|
+
if (icon) icon.setAttribute('href', '#cx-icon-' + iconId);
|
|
252
|
+
};
|
|
253
|
+
var done = function (ok) {
|
|
254
|
+
set(ok ? 'copied' : 'failed', ok ? 'Copied' : 'Couldn\u2019t copy', ok ? 'check' : 'content-copy');
|
|
255
|
+
setTimeout(function () { set('', 'Copy page', 'content-copy'); }, ms('--cx-motion-duration-plate'));
|
|
256
|
+
};
|
|
257
|
+
if (!navigator.clipboard) return;
|
|
258
|
+
btn.hidden = false;
|
|
259
|
+
btn.addEventListener('click', function () {
|
|
260
|
+
var text = fetch(btn.dataset.copyPage).then(function (r) { if (!r.ok) throw new Error(r.status); return r.text(); });
|
|
261
|
+
var copied = window.ClipboardItem && navigator.clipboard.write
|
|
262
|
+
? navigator.clipboard.write([new ClipboardItem({ 'text/plain': text.then(function (t) { return new Blob([t], { type: 'text/plain' }); }) })])
|
|
263
|
+
: text.then(function (t) { return navigator.clipboard.writeText(t); });
|
|
264
|
+
copied.then(function () { done(true); }, function () { done(false); });
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Docs navigation: dock it (sticky, scrolling on its own) while it sits beside the main column, as the TOC does.
|
|
269
|
+
document.querySelectorAll('.cx-docs').forEach(function (docs) {
|
|
270
|
+
var nav = docs.querySelector('.cx-docs-nav');
|
|
271
|
+
var main = docs.querySelector('.cx-docs__main');
|
|
272
|
+
if (!nav || !main) return;
|
|
273
|
+
var dock = function () {
|
|
274
|
+
root.style.setProperty('--_viewport-height', window.innerHeight + 'px');
|
|
275
|
+
nav.classList.toggle('is-docked', Math.abs(nav.offsetTop - main.offsetTop) < 1);
|
|
276
|
+
};
|
|
277
|
+
dock(); window.addEventListener('resize', dock);
|
|
278
|
+
// Bring the current page into view inside the docked navigation.
|
|
279
|
+
var current = nav.querySelector('[aria-current="page"]');
|
|
280
|
+
if (current && nav.classList.contains('is-docked') && current.offsetTop > nav.clientHeight / 2) nav.scrollTop = current.offsetTop - nav.clientHeight / 2;
|
|
281
|
+
});
|
|
282
|
+
|
|
108
283
|
// Table of contents: dock beside the article when there is room, and mark the current section.
|
|
109
284
|
document.querySelectorAll('.cx-article').forEach(function (article) {
|
|
110
285
|
var toc = article.querySelector('.cx-toc');
|
package/dist/plate.js
CHANGED
|
@@ -216,11 +216,11 @@
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// ------------------------------------------------------------ static markup (used by the build)
|
|
219
|
-
// kind 'head' or '
|
|
220
|
-
// its layer instead of fitted into the plate's square, on a finer grid so a warmed hill is round.
|
|
221
|
-
var BACKDROP = { head: { seed: 3, cells: 48 }, foot: { seed: 7, cells: 48 } };
|
|
219
|
+
// kind 'head', 'foot' or 'side' draws the same survey full-bleed behind a page (docs/components/backdrop.md): sliced
|
|
220
|
+
// to cover its layer instead of fitted into the plate's square, on a finer grid so a warmed hill is round.
|
|
221
|
+
var BACKDROP = { head: { seed: 3, cells: 48 }, foot: { seed: 7, cells: 48 }, side: { seed: 11, cells: 48 } };
|
|
222
222
|
function markup(opts, kind) {
|
|
223
|
-
var bg =
|
|
223
|
+
var bg = Object.prototype.hasOwnProperty.call(BACKDROP, kind);
|
|
224
224
|
if (bg) { opts = opts || {}; for (var key in BACKDROP[kind]) if (opts[key] == null) opts[key] = BACKDROP[kind][key]; }
|
|
225
225
|
var s = survey(opts), S = s.options.size, q = S / 4;
|
|
226
226
|
var grid = [q, 2 * q, 3 * q].map(function (v) { return 'M' + v + ' 0V' + S + 'M0 ' + v + 'H' + S; }).join('');
|
package/dist/tokens.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* MotifSpec 1.
|
|
1
|
+
/* MotifSpec 1.20.0 — generated from tokens/*.json. Do not edit.
|
|
2
2
|
Themes: semantic colours use light-dark(); color-scheme follows the system unless
|
|
3
3
|
<html data-theme="light|dark"> pins it. --cx-primitive-* are for this file only. */
|
|
4
4
|
:root {
|
|
@@ -178,6 +178,10 @@
|
|
|
178
178
|
|
|
179
179
|
/* color.wash */
|
|
180
180
|
--cx-color-wash-hover: var(--cx-primitive-color-amount-1);
|
|
181
|
+
--cx-color-wash-scrim: var(--cx-primitive-color-amount-3);
|
|
182
|
+
|
|
183
|
+
/* color.scrim */
|
|
184
|
+
--cx-color-scrim: light-dark(var(--cx-primitive-color-ash-1000), var(--cx-primitive-color-ash-1000));
|
|
181
185
|
|
|
182
186
|
/* primitive.motion.duration */
|
|
183
187
|
--cx-primitive-motion-duration-0: 0ms;
|
package/dist/tokens.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by npm run build. Do not edit.
|
|
2
|
-
export const version = "1.
|
|
2
|
+
export const version = "1.20.0";
|
|
3
3
|
export const changelog = "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md";
|
|
4
4
|
export const showcase = "https://motifspec.com";
|
|
5
5
|
export const tokens = [
|
|
@@ -1670,6 +1670,26 @@ export const tokens = [
|
|
|
1670
1670
|
"value": "10%",
|
|
1671
1671
|
"description": "Share of color.text.primary mixed into a transparent hover background, in percent: header controls on the frosted backdrop, where a solid color.surface.hover would match the frost. Not for controls on a plain surface."
|
|
1672
1672
|
},
|
|
1673
|
+
{
|
|
1674
|
+
"name": "color.wash.scrim",
|
|
1675
|
+
"css": "--cx-color-wash-scrim",
|
|
1676
|
+
"tier": "semantic",
|
|
1677
|
+
"type": "number",
|
|
1678
|
+
"references": "primitive.color.amount.3",
|
|
1679
|
+
"value": "40%",
|
|
1680
|
+
"description": "Share of color.scrim in the scrim behind a modal dialog such as search, in percent: the page recedes but stays recognisable. Only in ::backdrop."
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
"name": "color.scrim",
|
|
1684
|
+
"css": "--cx-color-scrim",
|
|
1685
|
+
"tier": "semantic",
|
|
1686
|
+
"type": "color",
|
|
1687
|
+
"references": "primitive.color.ash.1000",
|
|
1688
|
+
"referencesDark": "primitive.color.ash.1000",
|
|
1689
|
+
"value": "#0e100f",
|
|
1690
|
+
"valueDark": "#0e100f",
|
|
1691
|
+
"description": "The colour behind a modal dialog such as search, mixed in at color.wash.scrim, so the page recedes in both themes. Only in ::backdrop."
|
|
1692
|
+
},
|
|
1673
1693
|
{
|
|
1674
1694
|
"name": "primitive.motion.duration.0",
|
|
1675
1695
|
"css": "--cx-primitive-motion-duration-0",
|
package/dist/tokens.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.20.0",
|
|
3
3
|
"changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
|
|
4
4
|
"showcase": "https://motifspec.com",
|
|
5
5
|
"tokens": [
|
|
@@ -1670,6 +1670,26 @@
|
|
|
1670
1670
|
"value": "10%",
|
|
1671
1671
|
"description": "Share of color.text.primary mixed into a transparent hover background, in percent: header controls on the frosted backdrop, where a solid color.surface.hover would match the frost. Not for controls on a plain surface."
|
|
1672
1672
|
},
|
|
1673
|
+
{
|
|
1674
|
+
"name": "color.wash.scrim",
|
|
1675
|
+
"css": "--cx-color-wash-scrim",
|
|
1676
|
+
"tier": "semantic",
|
|
1677
|
+
"type": "number",
|
|
1678
|
+
"references": "primitive.color.amount.3",
|
|
1679
|
+
"value": "40%",
|
|
1680
|
+
"description": "Share of color.scrim in the scrim behind a modal dialog such as search, in percent: the page recedes but stays recognisable. Only in ::backdrop."
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
"name": "color.scrim",
|
|
1684
|
+
"css": "--cx-color-scrim",
|
|
1685
|
+
"tier": "semantic",
|
|
1686
|
+
"type": "color",
|
|
1687
|
+
"references": "primitive.color.ash.1000",
|
|
1688
|
+
"referencesDark": "primitive.color.ash.1000",
|
|
1689
|
+
"value": "#0e100f",
|
|
1690
|
+
"valueDark": "#0e100f",
|
|
1691
|
+
"description": "The colour behind a modal dialog such as search, mixed in at color.wash.scrim, so the page recedes in both themes. Only in ::backdrop."
|
|
1692
|
+
},
|
|
1673
1693
|
{
|
|
1674
1694
|
"name": "primitive.motion.duration.0",
|
|
1675
1695
|
"css": "--cx-primitive-motion-duration-0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: component-name
|
|
3
3
|
status: draft # draft | stable | deprecated
|
|
4
|
+
# deprecated: Use x instead; removed in 2.0.0. # required when status is deprecated
|
|
4
5
|
layouts: [shared] # [shared], or the layouts it belongs to: portfolio, dashboard, documentation
|
|
5
6
|
tokens: # semantic tokens this component uses
|
|
6
7
|
- color.accent
|
|
@@ -21,7 +22,7 @@ One sentence: what it is for.
|
|
|
21
22
|
|
|
22
23
|
## Markup
|
|
23
24
|
|
|
24
|
-
```html preview
|
|
25
|
+
```html {preview=true}
|
|
25
26
|
<!-- Minimal markup: the pattern to copy. -->
|
|
26
27
|
```
|
|
27
28
|
|
|
@@ -52,6 +52,7 @@ The system's signature: a herbarium-style label that gives an entry its catalogu
|
|
|
52
52
|
|
|
53
53
|
`LM-{collection}-{sequence}`, with the sequence zero-padded to three digits and never reused.
|
|
54
54
|
|
|
55
|
+
<!-- caption: Catalogue numbers -->
|
|
55
56
|
| Collection | Code | Example |
|
|
56
57
|
|---|---|---|
|
|
57
58
|
| Work (projects, case studies) | `W` | `LM-W-004` |
|
|
@@ -61,7 +62,7 @@ Store the number in front matter (`accession: LM-W-004`) rather than deriving it
|
|
|
61
62
|
|
|
62
63
|
## Markup
|
|
63
64
|
|
|
64
|
-
```html preview
|
|
65
|
+
```html {preview=true}
|
|
65
66
|
<dl class="cx-label" aria-label="Accession label">
|
|
66
67
|
<div class="cx-label__id"><dt>No.</dt><dd>LM-W-001</dd></div>
|
|
67
68
|
<div><dt>Filed</dt><dd><time datetime="2026-03-14">2026-03-14</time></dd></div>
|