@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
|
@@ -4,22 +4,20 @@ For product and system documentation: guides, reference pages and a changelog. m
|
|
|
4
4
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Complete since 1.19.0: the docs shell with its page navigation (`docs-shell.md`), search (`search.md`) and the version and repository link in the header (`site-header.md`), page actions (`page-actions.md`), the page footer with previous and next (`page-footer.md`), a Markdown copy of each page, and the component preview (`component-preview.md`), with every shared component, including steps, tabs, disclosures and keyboard keys, plus the table of contents, heading anchors and the ornaments.
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- **Not available yet:** the documentation shell, the top bar with search and version, the docs sidebar, page actions (Copy page), the page footer (edit link, last updated), the component preview, the token table, steps and tabs.
|
|
11
|
-
|
|
12
|
-
Don't write classes for parts that aren't available. The checker fails on any `cx-` class MotifSpec doesn't define. Build what you can from the shared components, and say which parts MotifSpec doesn't have yet.
|
|
9
|
+
Since 1.20.0, the token table (`token-table.md`) for reference pages generated from a design system's tokens. Don't write classes for anything MotifSpec doesn't define; the checker fails on them.
|
|
13
10
|
|
|
14
11
|
## Shell
|
|
15
12
|
|
|
16
|
-
|
|
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).
|
|
17
14
|
|
|
18
15
|
## Page templates
|
|
19
16
|
|
|
17
|
+
<!-- caption: Page templates -->
|
|
20
18
|
| Template | Order | Dominant | Secondary |
|
|
21
19
|
|---|---|---|---|
|
|
22
|
-
| **
|
|
20
|
+
| **Landing** | Header → statement (display h1, lede, a primary button to Getting started and a secondary one) on the frost → why the product exists → entry points to each section → footer. Full width, outside the docs shell. | The statement and its call to action | Why, entry points, the backdrop |
|
|
23
21
|
| **Article** | Header → title and lede → TOC + prose with figures, code blocks, callouts and tables → edit link and last updated → previous and next → footer | The prose column | TOC, page actions |
|
|
24
22
|
| **Reference table** | Header → title and one-line intro → the table (tokens, icons, rules) → footer | The table | Intro |
|
|
25
23
|
| **Changelog** | Header → title → releases, newest first, each with its version, date and changes → footer | The releases | Dates |
|
|
@@ -31,7 +29,8 @@ Every shared component, plus the components whose doc lists `documentation` unde
|
|
|
31
29
|
|
|
32
30
|
## Decoration
|
|
33
31
|
|
|
34
|
-
- The head of the backdrop
|
|
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.
|
|
35
34
|
- The footer band. No other ornaments in articles.
|
|
36
35
|
|
|
37
36
|
## Headings
|
|
@@ -41,6 +40,7 @@ Every shared component, plus the components whose doc lists `documentation` unde
|
|
|
41
40
|
|
|
42
41
|
## Choosing a stack
|
|
43
42
|
|
|
43
|
+
<!-- caption: Choosing a stack -->
|
|
44
44
|
| The project | Use |
|
|
45
45
|
|---|---|
|
|
46
46
|
| Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
|
|
@@ -10,6 +10,7 @@ The site header, the main region and the site footer, on a backdrop page. In Hug
|
|
|
10
10
|
|
|
11
11
|
Every template sits on the backdrop (`backdrop.md`): its contours show behind the footer, and on the home page behind the header and the statement too. Every template keeps the full site header (Work, Writing, About, the theme toggle) and the footer.
|
|
12
12
|
|
|
13
|
+
<!-- caption: Page templates -->
|
|
13
14
|
| Template | Order | Dominant | Secondary |
|
|
14
15
|
|---|---|---|---|
|
|
15
16
|
| **Home** | Header → statement (eyebrow, display h1, lede, primary + secondary button) on the frost, inside the top fade → selected work (2–3 project cards) → recent writing (5 post rows) → capabilities table → footer | Statement and selected work | Writing rows, capabilities, the backdrop |
|
|
@@ -46,6 +47,7 @@ The fields each template reads are in `docs/hugo.md` (Front matter the partials
|
|
|
46
47
|
|
|
47
48
|
## Choosing a stack
|
|
48
49
|
|
|
50
|
+
<!-- caption: Choosing a stack -->
|
|
49
51
|
| The project | Use |
|
|
50
52
|
|---|---|
|
|
51
53
|
| Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
|
|
@@ -31,6 +31,7 @@ Wrap highlighted output in the code-block component (see `components/code-block.
|
|
|
31
31
|
Generated by `npm run build` from `syntax/chroma.json`. Values are light / dark.
|
|
32
32
|
|
|
33
33
|
<!-- TABLE:START -->
|
|
34
|
+
<!-- caption: Chroma mapping -->
|
|
34
35
|
| Role | Chroma classes | Token | Light / dark | Contrast on code surface (light / dark) |
|
|
35
36
|
|---|---|---|---|---|
|
|
36
37
|
| Keywords | `.k` `.kd` `.kn` `.kp` `.kr` `.ow` `.bp` | `color.syntax.keyword` + weight `font.weight.strong` | #942f29 / #feb5ac | 6.79 / 10.36 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Alerts become callout.md: > [!NOTE], [!TIP], [!WARNING], [!CAUTION] (danger). The title names the kind,
|
|
3
3
|
the icon repeats it. At most two per article, no code blocks inside.
|
|
4
4
|
Quotations follow prose.md: end with a line "— Name | Source title" and it becomes the attributed footer. */ -}}
|
|
5
|
-
{{- $file := printf "content/%s" .Page.
|
|
5
|
+
{{- $file := "" }}{{ with .Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = .Page.Path }}{{ end -}}
|
|
6
6
|
{{- if eq .Type "alert" -}}
|
|
7
7
|
{{- $kinds := dict
|
|
8
8
|
"note" (dict "class" "cx-callout" "icon" "note" "title" "Note")
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
{{- /* code-block.md: header bar (language, optional file, copy button revealed by codex.js) around Chroma's
|
|
2
2
|
classed output. Breakout when a line is longer than the prose measure (size.measure.prose, in characters),
|
|
3
|
-
as code-block.md asks. Use {file="path"} for a path.
|
|
3
|
+
as code-block.md asks. Use {file="path"} for a path.
|
|
4
|
+
component-preview.md: an html fence with {preview=true} also shows the example live, above its code, in an
|
|
5
|
+
iframe whose document has the system's theme snippet, stylesheet, script and icon sprite. */ -}}
|
|
4
6
|
{{- $lang := .Type | default "text" -}}
|
|
5
7
|
{{- $measure := (index (partialCached "motifspec/tokens.html" "tokens") "size.measure.prose").value | replaceRE `[^0-9]` "" | int -}}
|
|
6
8
|
{{- $long := false -}}
|
|
7
9
|
{{- range split .Inner "\n" }}{{ if gt (strings.RuneCount .) $measure }}{{ $long = true }}{{ end }}{{ end -}}
|
|
8
10
|
{{- $result := transform.HighlightCodeBlock . -}}
|
|
11
|
+
{{- $preview := and .Attributes.preview (eq $lang "html") -}}
|
|
12
|
+
{{- if $preview }}
|
|
13
|
+
{{- $css := resources.Get "motifspec/codex.css" | resources.Copy "cx/codex.css" | minify | fingerprint -}}
|
|
14
|
+
{{- $js := resources.Get "motifspec/codex.js" | resources.Copy "cx/codex.js" | minify | fingerprint -}}
|
|
15
|
+
{{- $init := (resources.Get "motifspec/theme-init.js").Content -}}
|
|
16
|
+
{{- $sprite := (resources.Get "motifspec/icons.svg").Content -}}
|
|
17
|
+
{{- $doc := printf `<!doctype html><html lang="%s"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script>%s</script><link rel="stylesheet" href="%s"><script src="%s" defer></script></head><body class="cx-preview-body"><div hidden>%s</div>%s</body></html>` (site.Language.LanguageCode | default "en") $init $css.RelPermalink $js.RelPermalink $sprite .Inner }}
|
|
18
|
+
<div class="cx-preview">
|
|
19
|
+
<iframe class="cx-preview__frame" title="Example{{ with .Page }}: {{ .LinkTitle }}{{ end }}" loading="lazy" srcdoc="{{ $doc }}"></iframe>
|
|
20
|
+
{{- end }}
|
|
9
21
|
<figure class="cx-code{{ if $long }} cx-code--breakout{{ end }}">
|
|
10
|
-
<figcaption class="cx-code__bar">
|
|
22
|
+
<figcaption class="cx-code__bar" data-pagefind-ignore>
|
|
11
23
|
<span>{{ $lang }}</span>
|
|
12
24
|
{{- with .Attributes.file }}
|
|
13
25
|
<span class="cx-code__file">{{ . }}</span>
|
|
14
26
|
{{- end }}
|
|
15
27
|
<button class="cx-code__copy" type="button" hidden><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use data-copy-icon href="#cx-icon-content-copy"></use></svg><span class="cx-code__copy-label">Copy</span></button>
|
|
16
28
|
</figcaption>
|
|
17
|
-
{{ replaceRE ` file="[^"]*"` "" (string $result.Wrapped)
|
|
29
|
+
{{ replaceRE ` (?:file|preview)="[^"]*"` "" (string $result.Wrapped) 2 | safeHTML }}
|
|
18
30
|
</figure>
|
|
31
|
+
{{- if $preview }}
|
|
32
|
+
</div>
|
|
33
|
+
{{- end }}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
{{- /* heading-anchor.md: every heading gets an id; h2s get the "#" anchor after a space. */ -}}
|
|
2
|
-
<h{{ .Level }} id="{{ .Anchor }}">{{ .Text }}{{ if eq .Level 2 }} <a class="cx-anchor" href="#{{ .Anchor }}" aria-label="Link to {{ .PlainText }}">#</a>{{ end }}</h{{ .Level }}>
|
|
2
|
+
<h{{ .Level }} id="{{ .Anchor }}">{{ .Text }}{{ if eq .Level 2 }} <a class="cx-anchor" href="#{{ .Anchor }}" aria-label="Link to {{ .PlainText }}" data-pagefind-ignore>#</a>{{ end }}</h{{ .Level }}>
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
{width="prose"} on the line after a figure keeps it to the prose measure instead of breaking out.
|
|
4
4
|
An .svg is a diagram: inlined, coloured by its cx-diagram classes, named by the alt text. */ -}}
|
|
5
5
|
{{- $img := .Page.Resources.Get .Destination -}}
|
|
6
|
-
{{-
|
|
7
|
-
{{- if not
|
|
6
|
+
{{- $file := "" }}{{ with .Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = .Page.Path }}{{ end -}}
|
|
7
|
+
{{- if not $img }}{{ errorf "%s: image %q is not in the page bundle." $file .Destination }}{{ end -}}
|
|
8
|
+
{{- if not .PlainText }}{{ errorf "%s: image %q has no alt text. Describe what the image shows (figure.md)." $file .Destination }}{{ end -}}
|
|
8
9
|
{{- if .IsBlock -}}
|
|
9
|
-
{{- if not .Title }}{{ errorf "
|
|
10
|
+
{{- if not .Title }}{{ errorf "%s: figure %q has no caption. Add one as the image title: ." $file .Destination }}{{ end -}}
|
|
10
11
|
{{- $first := cond (isset .Page.Params "hero") 2 1 -}}
|
|
11
12
|
{{- partial "motifspec/figure.html" (dict "image" $img "alt" .PlainText "caption" (.Title | markdownify) "plate" (add .Ordinal $first) "prose" (eq (index .Attributes "width") "prose")) -}}
|
|
12
13
|
{{- else if eq $img.MediaType.SubType "svg" -}}
|
|
13
|
-
{{- errorf "
|
|
14
|
+
{{- errorf "%s: %q is an SVG diagram; give it a line of its own so it becomes a figure (figure.md)." $file .Destination -}}
|
|
14
15
|
{{- else -}}
|
|
15
16
|
{{- $s := $img.Process "webp" -}}
|
|
16
17
|
<img src="{{ $s.RelPermalink }}" alt="{{ .PlainText }}" width="{{ $s.Width }}" height="{{ $s.Height }}" loading="lazy" decoding="async">
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{{- with or (.Page.GetPage $u.Path) (site.GetPage $u.Path) -}}
|
|
8
8
|
{{- $dest = printf "%s%s" .RelPermalink (cond (ne $u.Fragment "") (printf "#%s" $u.Fragment) "") -}}
|
|
9
9
|
{{- else -}}
|
|
10
|
-
{{- with $.Page.Resources.Get $u.Path }}{{ $dest = .RelPermalink }}{{ else }}{{ if not (hasPrefix $u.Path "/") }}{{
|
|
10
|
+
{{- with $.Page.Resources.Get $u.Path }}{{ $dest = .RelPermalink }}{{ else }}{{ if not (hasPrefix $u.Path "/") }}{{ $file := "" }}{{ with $.Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = $.Page.Path }}{{ end }}{{ errorf "%s: link %q does not resolve to a page or bundle file." $file $.Destination }}{{ end }}{{ end -}}
|
|
11
11
|
{{- end -}}
|
|
12
12
|
{{- end -}}
|
|
13
13
|
<a href="{{ $dest | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $external }} rel="noopener"{{ end }}>{{ .Text }}{{ if $external }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg>{{ end }}</a>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{{- /* data-table.md: a focusable region named by its caption ({caption="…"} after the table; " | " becomes a
|
|
2
2
|
separator), the first cell of each row as a row header, numeric or right-aligned columns marked is-num,
|
|
3
3
|
and breakout above four columns. */ -}}
|
|
4
|
-
{{- $file := printf "content/%s" .Page.
|
|
4
|
+
{{- $file := "" }}{{ with .Page.File }}{{ $file = printf "content/%s" .Path }}{{ else }}{{ $file = .Page.Path }}{{ end -}}
|
|
5
5
|
{{- $caption := .Attributes.caption -}}
|
|
6
6
|
{{- if not $caption }}{{ errorf "%s: table %d has no caption. Add {caption=\"…\"} on the line after it (data-table.md)." $file (add .Ordinal 1) }}{{ end -}}
|
|
7
|
-
{{- $
|
|
7
|
+
{{- $base := "" }}{{ with .Page.File }}{{ $base = .ContentBaseName }}{{ else }}{{ $base = path.Base .Page.Path }}{{ end -}}
|
|
8
|
+
{{- $id := printf "tbl-%s-%d" ($base | urlize) .Ordinal -}}
|
|
8
9
|
{{- $cols := 0 }}{{ range first 1 .THead }}{{ $cols = len . }}{{ end -}}
|
|
9
10
|
{{- $num := slice -}}
|
|
10
11
|
{{- range $c := seq 0 (sub $cols 1) -}}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
{{- /* The cx-article layout: TOC before the main column in the DOM, then prose ending in the flower end mark.
|
|
2
|
-
Context: dict "page" "toc" (always | auto). auto shows the TOC when the content has three or more h2s
|
|
3
|
-
(table-of-contents.md); a case study passes always.
|
|
2
|
+
Context: dict "page" "toc" (always | auto | never). auto shows the TOC when the content has three or more h2s
|
|
3
|
+
(table-of-contents.md); a case study passes always. A documentation site (params.motifspec.layout
|
|
4
|
+
"documentation") has no end mark: its only ornament is the footer band (docs/layouts/documentation.md). */ -}}
|
|
4
5
|
{{- $p := .page -}}
|
|
6
|
+
{{- $where := "" -}}
|
|
7
|
+
{{- with $p.File }}{{ $where = printf "content/%s" .Path }}{{ else }}{{ $where = $p.Path }}{{ end -}}
|
|
8
|
+
{{- $docs := eq site.Params.motifspec.layout "documentation" -}}
|
|
5
9
|
{{- $h2s := partial "motifspec/h2s.html" $p -}}
|
|
6
|
-
{{- $toc := or (eq .toc "always") (ge (len $h2s) 3) -}}
|
|
7
|
-
{{- if and (eq .toc "always") (lt (len $h2s) 1) }}{{ errorf "
|
|
10
|
+
{{- $toc := and (ne .toc "never") (or (eq .toc "always") (ge (len $h2s) 3)) -}}
|
|
11
|
+
{{- if and (eq .toc "always") (lt (len $h2s) 1) }}{{ errorf "%s: toc \"always\" needs h2 sections to list (table-of-contents.md)." $where }}{{ end -}}
|
|
8
12
|
{{- /* ornament.md: the flower ("g") goes after the last sentence, so the content must end with a paragraph. */ -}}
|
|
9
13
|
{{- $content := $p.Content | strings.TrimSpace -}}
|
|
10
|
-
{{- if gt (len (findRE `class="cx-callout[ "]` $content)) 2 }}{{ errorf "
|
|
11
|
-
{{- $endMark := `<span class="cx-end-mark" aria-hidden="true">g</span></p>` -}}
|
|
12
|
-
{{- if
|
|
14
|
+
{{- if gt (len (findRE `class="cx-callout[ "]` $content)) 2 }}{{ errorf "%s: more than two callouts in one article; they lose force when repeated (callout.md)." $where }}{{ end -}}
|
|
15
|
+
{{- $endMark := `<span class="cx-end-mark" aria-hidden="true" data-pagefind-ignore>g</span></p>` -}}
|
|
16
|
+
{{- if $docs -}}
|
|
17
|
+
{{- else if strings.HasSuffix $content "</p>" -}}
|
|
13
18
|
{{- $content = printf "%s%s" (strings.TrimSuffix "</p>" $content) $endMark -}}
|
|
14
19
|
{{- else -}}
|
|
15
|
-
{{- warnf "
|
|
20
|
+
{{- warnf "%s: the article should end with a paragraph so the end mark follows the last sentence." $where -}}
|
|
16
21
|
{{- end }}
|
|
17
22
|
<div class="cx-article">
|
|
18
23
|
{{- if $toc }}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
{{- /* docs/hugo.md. Call first inside <body class="cx-backdrop-page"> with the page:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
{{- /* docs/hugo.md. Call first inside <body class="cx-backdrop-page"> with the page: the contour backdrop's first
|
|
2
|
+
layer (backdrop.md), which is the head on the home page (a documentation site's landing page included) and,
|
|
3
|
+
on every other page of a documentation site (params.motifspec.layout "documentation", with
|
|
4
|
+
<body class="cx-backdrop-page cx-backdrop-page--side">), the side; the icon sprite (icon.md), once, before
|
|
5
|
+
anything that uses it; and the skip link to <main id="main">. */ -}}
|
|
6
|
+
{{- if and (eq site.Params.motifspec.layout "documentation") (not .IsHome) }}
|
|
7
|
+
{{ with resources.Get "motifspec/backdrop-side.html" }}{{ .Content | safeHTML }}{{ else }}{{ errorf "motifspec/backdrop-side.html is missing: is the MotifSpec module imported?" }}{{ end }}
|
|
8
|
+
{{- else if .IsHome }}
|
|
5
9
|
{{ with resources.Get "motifspec/backdrop.html" }}{{ .Content | safeHTML }}{{ else }}{{ errorf "motifspec/backdrop.html is missing: is the MotifSpec module imported?" }}{{ end }}
|
|
6
10
|
{{- end }}
|
|
7
11
|
<div hidden>{{ with resources.Get "motifspec/icons.svg" }}{{ .Content | safeHTML }}{{ end }}</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
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" -}}
|
|
7
|
+
<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>
|
|
31
|
+
</nav>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{{- /* page-actions.md: Copy page and View as Markdown, for a page that has the markdown output format (docs/hugo.md).
|
|
2
|
+
Writes nothing for a page without it. Context: a page. */ -}}
|
|
3
|
+
{{- with .OutputFormats.Get "markdown" }}
|
|
4
|
+
<div class="cx-page-actions" data-pagefind-ignore>
|
|
5
|
+
<button class="cx-button cx-button--sm" type="button" data-copy-page="{{ .RelPermalink }}" hidden><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-content-copy"></use></svg><span class="cx-page-actions__label">Copy page</span></button>
|
|
6
|
+
<a class="cx-button cx-button--sm" href="{{ .RelPermalink }}" type="text/markdown">View as Markdown</a>
|
|
7
|
+
</div>
|
|
8
|
+
{{- end -}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{{- /* page-footer.md: when the page last changed (its Lastmod; with enableGitInfo, from Git) and a link to edit its
|
|
2
|
+
source. The edit link needs params.motifspec.editURL, the repository's edit address ending in "/", such as
|
|
3
|
+
"https://github.com/owner/repo/edit/main/". When the site lives in a folder of the repository, also set
|
|
4
|
+
params.motifspec.siteDir to that folder, so files mounted from outside it get the right path. A page with no
|
|
5
|
+
file of its own, such as one a content adapter makes from another file, names that file's path in the
|
|
6
|
+
repository as its `source` param. Context: a page. */ -}}
|
|
7
|
+
{{- $p := . -}}
|
|
8
|
+
{{- $edit := "" -}}
|
|
9
|
+
{{- with site.Params.motifspec.editURL -}}
|
|
10
|
+
{{- $base := . -}}
|
|
11
|
+
{{- with $p.Params.source -}}
|
|
12
|
+
{{- $edit = printf "%s%s" $base (strings.TrimPrefix "/" .) -}}
|
|
13
|
+
{{- else with $p.File -}}
|
|
14
|
+
{{- $root := strings.TrimSuffix (printf "/%s" (site.Params.motifspec.siteDir | default "" | strings.Trim "/")) hugo.WorkingDir -}}
|
|
15
|
+
{{- $edit = printf "%s%s" $base (strings.TrimPrefix (printf "%s/" $root) .Filename) -}}
|
|
16
|
+
{{- end -}}
|
|
17
|
+
{{- end -}}
|
|
18
|
+
{{- if or (not $p.Lastmod.IsZero) $edit }}
|
|
19
|
+
<footer class="cx-page-footer" data-pagefind-ignore>
|
|
20
|
+
{{- if not $p.Lastmod.IsZero }}
|
|
21
|
+
<p class="cx-meta">Last updated <time datetime="{{ $p.Lastmod.Format "2006-01-02" }}">{{ $p.Lastmod.Format "2 January 2006" }}</time></p>
|
|
22
|
+
{{- end }}
|
|
23
|
+
{{- with $edit }}
|
|
24
|
+
<a class="cx-link" href="{{ . }}"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-edit"></use></svg>Edit this page<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg></a>
|
|
25
|
+
{{- end }}
|
|
26
|
+
</footer>
|
|
27
|
+
{{- end -}}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{{- /* pagination.md for the documentation layout: previous and next in the order of the docs navigation
|
|
2
|
+
(docs-nav.html): top-level pages, then each top-level section's pages. The middle cell names the page's group.
|
|
3
|
+
Context: a page. */ -}}
|
|
4
|
+
{{- $p := . -}}
|
|
5
|
+
{{- $order := slice -}}
|
|
6
|
+
{{- range (where (where site.Home.RegularPages "Params.docs_nav" "ne" false) "Kind" "page").ByWeight }}{{ $order = $order | append . }}{{ end -}}
|
|
7
|
+
{{- range where site.Home.Sections.ByWeight "Params.docs_nav" "ne" false }}{{ range where .Pages.ByWeight "Params.docs_nav" "ne" false }}{{ $order = $order | append . }}{{ end }}{{ end -}}
|
|
8
|
+
{{- $at := -1 }}{{ range $i, $e := $order }}{{ if eq $e.RelPermalink $p.RelPermalink }}{{ $at = $i }}{{ end }}{{ end -}}
|
|
9
|
+
{{- if ge $at 0 }}
|
|
10
|
+
{{- $prev := cond (gt $at 0) (index $order (sub $at 1)) nil -}}
|
|
11
|
+
{{- $next := cond (lt (add $at 1) (len $order)) (index $order (add $at 1)) nil -}}
|
|
12
|
+
<nav class="cx-pagination" aria-label="Documentation pages" data-pagefind-ignore>
|
|
13
|
+
{{- with $prev }}
|
|
14
|
+
<a class="cx-pagination__link" href="{{ .RelPermalink }}" rel="prev">
|
|
15
|
+
<span class="cx-pagination__dir"><svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-back"></use></svg>Previous</span>
|
|
16
|
+
<span class="cx-pagination__title">{{ .LinkTitle }}</span>
|
|
17
|
+
</a>
|
|
18
|
+
{{- else }}
|
|
19
|
+
<span class="cx-pagination__link" rel="prev" aria-disabled="true">
|
|
20
|
+
<span class="cx-pagination__dir"><svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-back"></use></svg>Previous</span>
|
|
21
|
+
<span class="cx-pagination__title">First page</span>
|
|
22
|
+
</span>
|
|
23
|
+
{{- end }}
|
|
24
|
+
<p class="cx-pagination__status">{{ with $p.Parent }}{{ if not .IsHome }}{{ .LinkTitle }}{{ end }}{{ end }}<strong>{{ add $at 1 }} / {{ len $order }}</strong></p>
|
|
25
|
+
{{- with $next }}
|
|
26
|
+
<a class="cx-pagination__link" href="{{ .RelPermalink }}" rel="next">
|
|
27
|
+
<span class="cx-pagination__dir">Next<svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-forward"></use></svg></span>
|
|
28
|
+
<span class="cx-pagination__title">{{ .LinkTitle }}</span>
|
|
29
|
+
</a>
|
|
30
|
+
{{- else }}
|
|
31
|
+
<span class="cx-pagination__link" rel="next" aria-disabled="true">
|
|
32
|
+
<span class="cx-pagination__dir">Next<svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-forward"></use></svg></span>
|
|
33
|
+
<span class="cx-pagination__title">Last page</span>
|
|
34
|
+
</span>
|
|
35
|
+
{{- end }}
|
|
36
|
+
</nav>
|
|
37
|
+
{{- end -}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{{- /* search.md: the search trigger and its dialog, over a Pagefind index at /pagefind/ (built after Hugo with
|
|
2
|
+
`npx pagefind --site public`). site-header.html calls it when params.motifspec.search is true; the trigger is
|
|
3
|
+
revealed by dist/codex.js, so without script there is nothing to press. Context: a page. */ -}}
|
|
4
|
+
<button class="cx-search-trigger" type="button" data-search-open aria-haspopup="dialog" aria-controls="cx-search" hidden>
|
|
5
|
+
<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-search"></use></svg>
|
|
6
|
+
<span class="cx-search-trigger__label">Search</span>
|
|
7
|
+
<span class="cx-search-trigger__keys" aria-hidden="true"><kbd class="cx-kbd">Ctrl</kbd><kbd class="cx-kbd">K</kbd></span>
|
|
8
|
+
</button>
|
|
9
|
+
<dialog class="cx-search" id="cx-search" aria-labelledby="cx-search-label" data-search="{{ "pagefind/pagefind.js" | relURL }}">
|
|
10
|
+
<form class="cx-search__form" role="search" method="dialog">
|
|
11
|
+
<svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-search"></use></svg>
|
|
12
|
+
<label class="cx-visually-hidden" id="cx-search-label" for="cx-search-input">Search {{ site.Title }}</label>
|
|
13
|
+
<input class="cx-search__input" id="cx-search-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search" aria-describedby="cx-search-status">
|
|
14
|
+
<button class="cx-search__close" type="button" aria-label="Close search" data-search-close><svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
15
|
+
</form>
|
|
16
|
+
<p class="cx-search__status" id="cx-search-status" role="status"></p>
|
|
17
|
+
<ol class="cx-search__results" aria-label="Results"></ol>
|
|
18
|
+
</dialog>
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
{{- /* site-header.md. A child page marks its section (a post marks Writing).
|
|
1
|
+
{{- /* site-header.md. A child page marks its section (a post marks Writing). A menu entry whose URL starts with
|
|
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. */ -}}
|
|
4
|
+
{{- $ms := site.Params.motifspec -}}
|
|
2
5
|
<header class="cx-header">
|
|
3
6
|
<div class="cx-container cx-header__inner">
|
|
4
7
|
<a class="cx-wordmark" href="{{ site.Home.RelPermalink }}">{{ site.Title }} <span class="cx-wordmark__role">{{ site.Params.role }}</span></a>
|
|
5
8
|
<div class="cx-header__end">
|
|
9
|
+
{{- if $ms.search }}
|
|
10
|
+
{{ partial "motifspec/search.html" . }}
|
|
11
|
+
{{- end }}
|
|
6
12
|
<nav class="cx-nav" aria-label="Main">
|
|
7
13
|
<ul>
|
|
8
14
|
{{- range site.Menus.main }}
|
|
9
|
-
<li><a href="{{ .URL }}"{{ if eq $.Section .Identifier }} aria-current="page"{{ end }}>{{ .Name }}</a></li>
|
|
15
|
+
<li><a href="{{ .URL }}"{{ if and .Identifier (eq $.Section .Identifier) }} aria-current="page"{{ end }}>{{ .Name }}{{ if hasPrefix .URL "http" }}<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-outward"></use></svg>{{ end }}</a></li>
|
|
10
16
|
{{- end }}
|
|
11
17
|
</ul>
|
|
12
18
|
</nav>
|
|
19
|
+
{{- with $ms.version }}
|
|
20
|
+
<a class="cx-header__version" href="{{ $ms.changelog | default "#" }}">v{{ . }}<span class="cx-visually-hidden">, changelog</span></a>
|
|
21
|
+
{{- end }}
|
|
13
22
|
<button class="cx-theme-toggle" type="button" data-theme-toggle hidden aria-label="Switch to dark theme">
|
|
14
23
|
<svg class="cx-icon" data-icon="to-dark" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-dark"></use></svg>
|
|
15
24
|
<svg class="cx-icon" data-icon="to-light" aria-hidden="true" focusable="false"><use href="#cx-icon-theme-light"></use></svg>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{- /* table-of-contents.md: numbered h2 entries with one nested level of h3. Ships <details open>, so it works
|
|
2
2
|
without script; codex.js docks it and marks the current section. Context: a page. */ -}}
|
|
3
3
|
{{- $h2s := partial "motifspec/h2s.html" . -}}
|
|
4
|
-
<nav class="cx-toc" aria-labelledby="toc-title">
|
|
4
|
+
<nav class="cx-toc" aria-labelledby="toc-title" data-pagefind-ignore>
|
|
5
5
|
<details open>
|
|
6
6
|
<summary id="toc-title">On this page<svg class="cx-icon cx-icon--sm cx-toc__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
|
|
7
7
|
<ol>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aitrien/motifspec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Liam Marshall's design system: DTCG tokens, component rules, generated CSS, Hugo templates and a rule checker.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist",
|
|
27
|
-
"!dist/showcase.html",
|
|
28
|
-
"!dist/showcase.standalone.html",
|
|
29
27
|
"tokens",
|
|
30
28
|
"docs",
|
|
31
29
|
"fonts",
|
|
@@ -49,6 +47,7 @@
|
|
|
49
47
|
"./plate.html": "./dist/plate.html",
|
|
50
48
|
"./backdrop.html": "./dist/backdrop.html",
|
|
51
49
|
"./backdrop-foot.html": "./dist/backdrop-foot.html",
|
|
50
|
+
"./backdrop-side.html": "./dist/backdrop-side.html",
|
|
52
51
|
"./icons.svg": "./dist/icons.svg",
|
|
53
52
|
"./tokens.js": "./dist/tokens.js",
|
|
54
53
|
"./tokens.json": "./dist/tokens.json",
|
|
@@ -64,7 +63,10 @@
|
|
|
64
63
|
"release:check": "node scripts/release.mjs",
|
|
65
64
|
"pack:check": "node scripts/pack-check.mjs",
|
|
66
65
|
"test:mcp": "node --test mcp/test.mjs",
|
|
67
|
-
"mcp:bundle": "node mcp/build.mjs"
|
|
66
|
+
"mcp:bundle": "node mcp/build.mjs",
|
|
67
|
+
"docs": "node scripts/docs.mjs",
|
|
68
|
+
"docs:check": "node scripts/check.mjs site",
|
|
69
|
+
"docs:quality": "node scripts/docs-quality.mjs"
|
|
68
70
|
},
|
|
69
71
|
"engines": {
|
|
70
72
|
"node": ">=20"
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
"devDependencies": {
|
|
73
75
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
74
76
|
"esbuild": "0.28.2",
|
|
77
|
+
"pagefind": "1.5.0",
|
|
75
78
|
"zod": "4.6.7"
|
|
76
79
|
}
|
|
77
80
|
}
|
package/scripts/check.mjs
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from 'node:fs';
|
|
19
19
|
import { extname, join, relative, resolve } from 'node:path';
|
|
20
20
|
import { fileURLToPath } from 'node:url';
|
|
21
|
-
import { ROOT } from './lib.mjs';
|
|
21
|
+
import { ROOT, DOC_SELECTORS } from './lib.mjs';
|
|
22
22
|
|
|
23
23
|
export const RULES = {
|
|
24
24
|
stylesheet: 'Styles come only from MotifSpec. Remove the stylesheet; use components and tokens, or propose an addition to MotifSpec.',
|
|
@@ -57,36 +57,33 @@ function load() {
|
|
|
57
57
|
icons: new Set(Object.keys(JSON.parse(read('icons', 'manifest.json')).icons)),
|
|
58
58
|
tokens: new Map(tokens.map((t) => [t.css, t])),
|
|
59
59
|
breakpoints: new Set(Object.entries(sizes.primitive.size.breakpoint).filter(([k]) => !k.startsWith('$')).map(([, t]) => `${t.$value.value}${t.$value.unit}`)),
|
|
60
|
-
...componentLayouts(),
|
|
61
60
|
};
|
|
61
|
+
Object.assign(data, componentLayouts(data.classes));
|
|
62
62
|
return data;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Which layouts each class and Hugo partial belongs to
|
|
67
|
-
*
|
|
68
|
-
*
|
|
66
|
+
* Which layouts each class and Hugo partial belongs to. A class belongs to the docs that own it (DOC_SELECTORS in
|
|
67
|
+
* lib.mjs: a root class and its __elements and --modifiers), so a doc that only shows another component's classes in
|
|
68
|
+
* its example doesn't claim them. A class owned by any shared doc, or by no doc, is shared. A partial is restricted by
|
|
69
|
+
* every doc its row in docs/hugo.md names.
|
|
69
70
|
*/
|
|
70
|
-
function componentLayouts() {
|
|
71
|
+
function componentLayouts(classes) {
|
|
71
72
|
const dir = join(ROOT, 'docs', 'components');
|
|
72
73
|
const docs = new Map(); // doc name -> layouts, or null when shared
|
|
73
|
-
const classDocs = new Map(); // class -> doc names that use it
|
|
74
74
|
for (const f of readdirSync(dir).filter((x) => x.endsWith('.md') && !x.startsWith('_'))) {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
75
|
+
const layouts = readFileSync(join(dir, f), 'utf8').match(/^layouts: \[(.*)\]/m)?.[1].split(',').map((l) => l.trim()) ?? ['shared'];
|
|
76
|
+
docs.set(f.replace(/\.md$/, ''), layouts.includes('shared') ? null : layouts);
|
|
77
|
+
}
|
|
78
|
+
const roots = Object.entries(DOC_SELECTORS).flatMap(([name, sels]) => sels.filter((s) => s.startsWith('.cx-')).map((s) => [s.slice(1), name]));
|
|
79
|
+
const restrictedClasses = new Map(); // class -> restricted doc names that own it (only classes no shared doc owns)
|
|
80
|
+
for (const c of classes) {
|
|
81
|
+
const owners = roots.filter(([r]) => c === r || c.startsWith(`${r}__`) || c.startsWith(`${r}--`)).map(([, n]) => n);
|
|
82
|
+
if (owners.length && owners.every((n) => docs.get(n))) restrictedClasses.set(c, [...new Set(owners)]);
|
|
84
83
|
}
|
|
85
|
-
const restrictedClasses = new Map(); // class -> restricted doc names (only classes no shared doc uses)
|
|
86
|
-
for (const [c, names] of classDocs) if ([...names].every((n) => docs.get(n))) restrictedClasses.set(c, [...names]);
|
|
87
84
|
const partials = new Map(); // partial file -> restricted doc names it renders
|
|
88
85
|
for (const row of read('docs', 'hugo.md').split('\n').filter((l) => /^\| `[a-z0-9/_-]+\.html` \|/.test(l))) {
|
|
89
|
-
const [file, related] = row.split('|').slice(1, 3).map((
|
|
86
|
+
const [file, related] = row.split('|').slice(1, 3).map((col) => col.trim());
|
|
90
87
|
const names = [...related.matchAll(/`([a-z0-9-]+)\.md`/g)].map((m) => m[1]).filter((n) => docs.get(n));
|
|
91
88
|
if (names.length) partials.set(file.replace(/`/g, ''), names);
|
|
92
89
|
}
|
package/scripts/lib.mjs
CHANGED
|
@@ -229,12 +229,50 @@ export function htmlToJsx(html) {
|
|
|
229
229
|
return roots > 1 ? `<>\n${jsx}\n</>` : jsx;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
/** A component doc with each
|
|
232
|
+
/** A component doc with each ```html {preview=true} example replaced by its JSX form (see htmlToJsx). */
|
|
233
233
|
export function docAsJsx(md) {
|
|
234
|
-
return md.replace(/```html preview\n([\s\S]*?)```/g, (block, html) => {
|
|
234
|
+
return md.replace(/```html \{preview=true\}\n([\s\S]*?)```/g, (block, html) => {
|
|
235
235
|
const jsx = htmlToJsx(html);
|
|
236
236
|
return jsx === null
|
|
237
237
|
? `This example is written for Hugo, so it has no JSX form. Outside Hugo, use the files the README's npm table lists.\n\n${block}`
|
|
238
238
|
: `\`\`\`jsx\n${jsx}\n\`\`\``;
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
|
+
|
|
242
|
+
// ------------------------------------------------------------------ which classes each component owns
|
|
243
|
+
// The root selectors of each component doc's own CSS: the build reads the tokens each doc uses from them, and the
|
|
244
|
+
// checker the layouts a class belongs to. A component owns a root and its __elements and --modifiers. Every doc in
|
|
245
|
+
// docs/components/ needs an entry.
|
|
246
|
+
export const DOC_SELECTORS = {
|
|
247
|
+
'site-header': ['.cx-header', '.cx-wordmark', '.cx-nav', '.cx-theme-toggle', '.cx-skip-link', '.cx-container'],
|
|
248
|
+
'backdrop': ['.cx-backdrop', '.cx-backdrop-page'],
|
|
249
|
+
'site-footer': ['.cx-footer', '.cx-band', '.cx-version'],
|
|
250
|
+
'accession-label': ['.cx-label', '.cx-id', '.cx-status'],
|
|
251
|
+
'project-card': ['.cx-cards', '.cx-card'],
|
|
252
|
+
'post-list-item': ['.cx-posts', '.cx-post'],
|
|
253
|
+
'icon': ['.cx-icon'],
|
|
254
|
+
'heading-anchor': ['.cx-anchor'],
|
|
255
|
+
'tooltip': ['.cx-tooltip'],
|
|
256
|
+
'prose': ['.cx-sep', '.cx-prose', '.cx-lede', '.cx-end-mark', '.cx-code-inline', '.cx-page-head', '.cx-h1', '.cx-display', '.cx-meta', '.cx-eyebrow'],
|
|
257
|
+
'code-block': ['.cx-code', '.chroma'],
|
|
258
|
+
'figure': ['.cx-figure', '.cx-diagram'],
|
|
259
|
+
'callout': ['.cx-callout'],
|
|
260
|
+
'tag': ['.cx-tags', '.cx-tag'],
|
|
261
|
+
'button-and-link': ['.cx-actions', '.cx-button', '.cx-link', '.cx-back'],
|
|
262
|
+
'pagination': ['.cx-pagination'],
|
|
263
|
+
'table-of-contents': ['.cx-toc', '.cx-article'],
|
|
264
|
+
'data-table': ['.cx-table'],
|
|
265
|
+
'ornament': ['.cx-band', '.cx-divider', '.cx-end-mark', '.cx-ornament'],
|
|
266
|
+
'specimen-plate': ['.cx-plate', '.cx-plate-frame', '.cx-plate__pause'],
|
|
267
|
+
'status': ['.cx-status'],
|
|
268
|
+
'disclosure': ['.cx-disclosure'],
|
|
269
|
+
'keyboard-key': ['.cx-kbd'],
|
|
270
|
+
'docs-shell': ['.cx-docs', '.cx-docs-nav'],
|
|
271
|
+
'page-actions': ['.cx-page-actions'],
|
|
272
|
+
'page-footer': ['.cx-page-footer'],
|
|
273
|
+
'search': ['.cx-search', '.cx-search-trigger'],
|
|
274
|
+
'component-preview': ['.cx-preview', '.cx-preview-body'],
|
|
275
|
+
'steps': ['.cx-steps'],
|
|
276
|
+
'tabs': ['.cx-tabs'],
|
|
277
|
+
'token-table': ['.cx-token-table', '.cx-swatch', '.cx-palette', '.cx-token-sample', '.cx-token-bar', '.cx-pair-sample'],
|
|
278
|
+
};
|