@aitrien/motifspec 1.17.2 → 1.18.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 +31 -0
- package/README.md +37 -9
- package/dist/codex.css +27 -7
- package/dist/contrast.md +5 -1
- package/dist/icons.svg +13 -0
- package/dist/tokens.css +1 -1
- package/dist/tokens.js +17 -1
- package/dist/tokens.json +17 -1
- package/docs/components/_template.md +5 -0
- package/docs/components/accession-label.md +5 -1
- package/docs/components/backdrop.md +3 -1
- package/docs/components/button-and-link.md +10 -1
- package/docs/components/callout.md +1 -0
- package/docs/components/code-block.md +10 -0
- package/docs/components/data-table.md +23 -1
- package/docs/components/disclosure.md +73 -0
- package/docs/components/figure.md +1 -0
- package/docs/components/heading-anchor.md +3 -1
- package/docs/components/icon.md +3 -2
- package/docs/components/keyboard-key.md +53 -0
- package/docs/components/ornament.md +2 -0
- package/docs/components/pagination.md +1 -0
- package/docs/components/post-list-item.md +1 -0
- package/docs/components/project-card.md +1 -0
- package/docs/components/prose.md +1 -0
- package/docs/components/site-footer.md +1 -0
- package/docs/components/site-header.md +10 -0
- package/docs/components/specimen-plate.md +1 -0
- package/docs/components/status.md +74 -0
- package/docs/components/table-of-contents.md +9 -0
- package/docs/components/tag.md +2 -1
- package/docs/components/tooltip.md +6 -0
- package/docs/hugo.md +2 -2
- package/docs/layouts/a-la-carte.md +36 -0
- package/docs/layouts/dashboard.md +58 -0
- package/docs/layouts/documentation.md +48 -0
- package/docs/{templates.md → layouts/portfolio.md} +34 -2
- package/icons/manifest.json +52 -0
- package/icons/svg/apps.svg +1 -0
- package/icons/svg/close.svg +1 -0
- package/icons/svg/dashboard.svg +1 -0
- package/icons/svg/dns.svg +1 -0
- package/icons/svg/edit.svg +1 -0
- package/icons/svg/lan.svg +1 -0
- package/icons/svg/menu.svg +1 -0
- package/icons/svg/notifications.svg +1 -0
- package/icons/svg/restart_alt.svg +1 -0
- package/icons/svg/search.svg +1 -0
- package/icons/svg/settings.svg +1 -0
- package/icons/svg/storage.svg +1 -0
- package/icons/svg/terminal.svg +1 -0
- package/layouts/_partials/motifspec/filed-under.html +1 -1
- package/package.json +1 -1
- package/scripts/check.mjs +171 -23
- package/scripts/lib.mjs +64 -0
- package/tokens/color.json +16 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: disclosure
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
tokens:
|
|
6
|
+
- border.focus.offset
|
|
7
|
+
- border.focus.width
|
|
8
|
+
- border.width.hairline
|
|
9
|
+
- color.border.default
|
|
10
|
+
- color.focus.ring
|
|
11
|
+
- color.surface.hover
|
|
12
|
+
- color.text.primary
|
|
13
|
+
- font.weight.strong
|
|
14
|
+
- motion.duration.base
|
|
15
|
+
- motion.easing.standard
|
|
16
|
+
- size.target.control
|
|
17
|
+
- space.inline.sm
|
|
18
|
+
- space.inset.md
|
|
19
|
+
- space.inset.sm
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Disclosure
|
|
23
|
+
|
|
24
|
+
A native `<details>` that shows and hides a block of content under a labelled row.
|
|
25
|
+
|
|
26
|
+
## When to use
|
|
27
|
+
|
|
28
|
+
- For content some readers need and others can skip: a table view of a chart, an FAQ answer, advanced settings, a long list of groups in a navigation.
|
|
29
|
+
- When the content still makes sense on the page, opened, without any script.
|
|
30
|
+
|
|
31
|
+
## When not to use
|
|
32
|
+
|
|
33
|
+
- To hide content every reader needs. Put it on the page.
|
|
34
|
+
- For navigation between views of the same data; that is tabs.
|
|
35
|
+
- For a choice the reader makes; use a form control.
|
|
36
|
+
|
|
37
|
+
## Markup
|
|
38
|
+
|
|
39
|
+
```html preview
|
|
40
|
+
<details class="cx-disclosure">
|
|
41
|
+
<summary>Show as a table<svg class="cx-icon cx-icon--sm cx-disclosure__chevron" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg></summary>
|
|
42
|
+
<div class="cx-disclosure__body">
|
|
43
|
+
<p>The content that opens.</p>
|
|
44
|
+
</div>
|
|
45
|
+
</details>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Add `open` to `<details>` to start it open. Disclosures that follow each other share their borders.
|
|
49
|
+
|
|
50
|
+
## Do
|
|
51
|
+
|
|
52
|
+
- Write the summary as what opens: "Show as a table", "Advanced settings".
|
|
53
|
+
- Keep the chevron (`expand`) after the text, as `cx-disclosure__chevron`; it turns when open.
|
|
54
|
+
- Start a disclosure open when most readers will want what's inside, such as the group that holds the current page.
|
|
55
|
+
|
|
56
|
+
## Don't
|
|
57
|
+
|
|
58
|
+
- Don't nest disclosures more than one level.
|
|
59
|
+
- Don't put the only copy of important information inside one that starts closed.
|
|
60
|
+
- Don't replace `<details>` with a scripted panel.
|
|
61
|
+
|
|
62
|
+
## Accessibility
|
|
63
|
+
|
|
64
|
+
- `<details>` and `<summary>` give the button role, the expanded state and keyboard support (Enter and Space) with no script.
|
|
65
|
+
- The summary meets `size.target.control`; focus shows the system focus ring.
|
|
66
|
+
- The chevron is `aria-hidden`; the summary's text is the name.
|
|
67
|
+
- Pairs: `color.text.primary` on `color.surface.raised` and `color.surface.hover` (7:1).
|
|
68
|
+
|
|
69
|
+
## Behaviour
|
|
70
|
+
|
|
71
|
+
- No script. The browser opens and closes it, and keeps the `open` attribute in step.
|
|
72
|
+
- In a framework, render `<details>` and `<summary>` as they are. If the app needs to know the state, listen for the `toggle` event; don't control it from app state, because the browser already owns it.
|
|
73
|
+
- The chevron's turn uses `motion.duration.base` and stops under reduced motion.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: heading-anchor
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [portfolio, documentation]
|
|
4
5
|
tokens:
|
|
5
6
|
- border.focus.offset
|
|
6
7
|
- border.focus.width
|
|
@@ -27,7 +28,7 @@ A "#" link after a section heading, so readers can copy a link straight to that
|
|
|
27
28
|
|
|
28
29
|
## When to use
|
|
29
30
|
|
|
30
|
-
- On every `<h2>` that has an id: prose sections in posts and case studies, top-level sections of index and docs pages.
|
|
31
|
+
- On every `<h2>` that has an id in reading text: prose sections in posts and case studies, top-level sections of index and docs pages.
|
|
31
32
|
- On `<h3>` in long documentation where readers link to sub-sections.
|
|
32
33
|
|
|
33
34
|
## When not to use
|
|
@@ -35,6 +36,7 @@ A "#" link after a section heading, so readers can copy a link straight to that
|
|
|
35
36
|
- On the page `<h1>`; the page URL already points there.
|
|
36
37
|
- On headings without an id, or on card and list titles that are themselves links.
|
|
37
38
|
- On `<h4>` and below.
|
|
39
|
+
- On dashboard sections (`docs/layouts/dashboard.md`): they are places on a screen, not parts of an article. Give them an id and no anchor.
|
|
38
40
|
|
|
39
41
|
## Markup
|
|
40
42
|
|
package/docs/components/icon.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: icon
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [shared]
|
|
4
5
|
tokens:
|
|
5
6
|
- size.icon.lg
|
|
6
7
|
- size.icon.md
|
|
@@ -13,13 +14,13 @@ A Material Symbols glyph from the MotifSpec sprite, used to reinforce a control'
|
|
|
13
14
|
|
|
14
15
|
## When to use
|
|
15
16
|
|
|
16
|
-
- Only for the roles listed in `icons/manifest.json`: direction arrows on buttons, links and pagination; the theme toggle; the copy button and its confirmation; callout titles; RSS; external links; back to top; the disclosure chevron.
|
|
17
|
+
- Only for the roles listed in `icons/manifest.json`: direction arrows on buttons, links and pagination; the theme toggle; the copy button and its confirmation; callout titles; RSS; external links; back to top; the disclosure chevron; search, menu, close and edit; and, in the dashboard and documentation layouts, the items of a side navigation and the controls of a toolbar.
|
|
17
18
|
- Beside text that already says the same thing, so the icon is a second cue.
|
|
18
19
|
|
|
19
20
|
## When not to use
|
|
20
21
|
|
|
21
22
|
- As decoration, bullets or section markers. Decoration is the ornament set (Yarndings), not icons.
|
|
22
|
-
- In headings, tags, nav labels
|
|
23
|
+
- In headings, tags or body copy, or in nav labels other than a side navigation's items in the dashboard and documentation layouts. A portfolio's header nav has none.
|
|
23
24
|
- For anything not in the manifest. A new icon is a new manifest entry and a minor version.
|
|
24
25
|
- As the only label of a control, unless the control has an accessible name (`aria-label`).
|
|
25
26
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: keyboard-key
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
tokens:
|
|
6
|
+
- border.width.emphasis
|
|
7
|
+
- border.width.hairline
|
|
8
|
+
- color.border.strong
|
|
9
|
+
- color.surface.sunken
|
|
10
|
+
- font.family.mono
|
|
11
|
+
- font.size.code-inline
|
|
12
|
+
- radius.control
|
|
13
|
+
- space.inset.xs
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Keyboard key
|
|
17
|
+
|
|
18
|
+
A key the reader presses, set as a small keycap: Ctrl K, Esc, Enter.
|
|
19
|
+
|
|
20
|
+
## When to use
|
|
21
|
+
|
|
22
|
+
- To name a keyboard shortcut beside the control it opens, such as a search field's hint.
|
|
23
|
+
- In instructions that say which keys to press.
|
|
24
|
+
|
|
25
|
+
## When not to use
|
|
26
|
+
|
|
27
|
+
- For code or something the reader types; that is inline code (`prose.md`).
|
|
28
|
+
- For a button the reader clicks; write the button's label.
|
|
29
|
+
- Inside prose. Markdown and prose already style `<kbd>`, so add no class there.
|
|
30
|
+
|
|
31
|
+
## Markup
|
|
32
|
+
|
|
33
|
+
```html preview
|
|
34
|
+
<kbd class="cx-kbd">Ctrl</kbd> <kbd class="cx-kbd">K</kbd>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
One `<kbd>` per key, with a space between keys that are pressed together.
|
|
38
|
+
|
|
39
|
+
## Do
|
|
40
|
+
|
|
41
|
+
- Name keys as they're printed on most keyboards: Ctrl, Shift, Esc, Enter, the letter in capitals.
|
|
42
|
+
- Show both forms when they differ by platform, separated by "or": <kbd class="cx-kbd">Ctrl</kbd> <kbd class="cx-kbd">K</kbd> or <kbd class="cx-kbd">⌘</kbd> <kbd class="cx-kbd">K</kbd>.
|
|
43
|
+
|
|
44
|
+
## Don't
|
|
45
|
+
|
|
46
|
+
- Don't use it for decoration or emphasis.
|
|
47
|
+
- Don't show a shortcut that doesn't work in the browser the reader is using.
|
|
48
|
+
|
|
49
|
+
## Accessibility
|
|
50
|
+
|
|
51
|
+
- `<kbd>` is announced as text, so the keys read in order.
|
|
52
|
+
- A shortcut is never the only way in: the control it opens has its own visible label.
|
|
53
|
+
- Pairs: `color.text.primary` on `color.surface.sunken` (7:1).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ornament
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [portfolio, documentation]
|
|
4
5
|
tokens:
|
|
5
6
|
- border.width.hairline
|
|
6
7
|
- color.border.subtle
|
|
@@ -31,6 +32,7 @@ Yarndings 12 knitting-chart glyphs: the footer band, the prose divider, the arti
|
|
|
31
32
|
|
|
32
33
|
- As icons, bullets, status markers or anything that carries meaning.
|
|
33
34
|
- More than one ornament group in a viewport.
|
|
35
|
+
- On dashboards (`docs/layouts/dashboard.md`), which have no ornaments.
|
|
34
36
|
- Glyphs in `codex.glyphs.forbidden` (`u v w x y z [ ] { }`): faces, a robot, hearts and animals read as emoji and are never allowed.
|
|
35
37
|
|
|
36
38
|
## Markup
|
package/docs/components/prose.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: site-header
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [shared]
|
|
4
5
|
tokens:
|
|
5
6
|
- border.focus.offset
|
|
6
7
|
- border.focus.width
|
|
@@ -122,3 +123,12 @@ Copy the snippet as it is: the build fails if this doc and `js/theme-init.js` di
|
|
|
122
123
|
- The toggle's `aria-label` is its action ("Switch to light theme"); the visible tooltip repeats it and is `aria-hidden`. Escape hides the tooltip without moving the pointer (see `tooltip.md`).
|
|
123
124
|
- `aria-current` carries the current state for assistive tech; the outline is the visual cue.
|
|
124
125
|
- Pairs: `color.text.secondary` and `color.text.primary` on `color.surface.base` (7:1); `color.border.strong` on `color.surface.base` (current outline, 3:1). On a backdrop page the frost is measured as `color.surface.base`; the contour lines beneath it are not part of the check.
|
|
126
|
+
|
|
127
|
+
## Behaviour
|
|
128
|
+
|
|
129
|
+
`dist/codex.js` adds this; an app that renders the header itself does the same.
|
|
130
|
+
|
|
131
|
+
- **Theme toggle:** ships `hidden` and is shown by script. A click switches between light and dark: it sets `data-theme` on `<html>`, or removes it when the choice matches the system again, so the page follows the system from then on. The choice is stored as `cx-theme` in `localStorage` (`light` or `dark`; removed for system), and `dist/theme-init.js` applies it before first paint. The toggle's `aria-label` and tooltip always name the action ("Switch to dark theme").
|
|
132
|
+
- **System changes:** while following the system, a change to the system theme updates the toggle's label.
|
|
133
|
+
- **Header height:** `--_header-height` on `<html>` is kept equal to the header's height, for scroll padding and the docked table of contents. When the nav wraps below the wordmark, the header gets `data-wrapped`.
|
|
134
|
+
- **On a backdrop page:** the header sticks once script runs, and `data-scrolled="true"` fades its surface in as soon as the page leaves the top. Without script it scrolls away with the page.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: status
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
tokens:
|
|
6
|
+
- border.width.emphasis
|
|
7
|
+
- color.status.danger.text
|
|
8
|
+
- color.status.info.text
|
|
9
|
+
- color.status.success.text
|
|
10
|
+
- color.status.warning.text
|
|
11
|
+
- color.text.muted
|
|
12
|
+
- font.family.mono
|
|
13
|
+
- font.line-height.ui
|
|
14
|
+
- font.size.label
|
|
15
|
+
- font.tracking.label
|
|
16
|
+
- radius.round
|
|
17
|
+
- space.inline.xs
|
|
18
|
+
- space.inset.sm
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Status
|
|
22
|
+
|
|
23
|
+
A short mono label with a dot that names a state: online, degraded, down, live, archived.
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
- Beside something whose state changes and matters: a service, a node, a build, a project.
|
|
28
|
+
- In a table's state column (`td.is-state`), a card's meta line, an event in a feed.
|
|
29
|
+
- Wherever the state needs to be scanned at a glance, with the word carrying the meaning and the colour repeating it.
|
|
30
|
+
|
|
31
|
+
## When not to use
|
|
32
|
+
|
|
33
|
+
- For a topic or technology; that is a tag (`tag.md`).
|
|
34
|
+
- For a message the reader must read in full; that is a callout (`callout.md`).
|
|
35
|
+
- As the only sign of a problem on a page. A problem that needs action also gets a callout.
|
|
36
|
+
|
|
37
|
+
## Markup
|
|
38
|
+
|
|
39
|
+
```html preview
|
|
40
|
+
<span class="cx-status cx-status--success">Online</span>
|
|
41
|
+
<span class="cx-status cx-status--warning">Degraded</span>
|
|
42
|
+
<span class="cx-status cx-status--danger">Down</span>
|
|
43
|
+
<span class="cx-status cx-status--info">Updating</span>
|
|
44
|
+
<span class="cx-status cx-status--muted">Scheduled</span>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| Tone | For | Example words |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `--success` | Working, passing, done | Online, Running, Passed, Done |
|
|
50
|
+
| `--warning` | Needs attention soon, or in progress | Degraded, Restarting, High, Building |
|
|
51
|
+
| `--danger` | Failed or stopped | Down, Offline, Failed |
|
|
52
|
+
| `--info` | Neutral and informative | Updating, Update, New |
|
|
53
|
+
| `--muted` | Not active: waiting, paused or finished with | Scheduled, Paused, Archived |
|
|
54
|
+
|
|
55
|
+
A portfolio's project statuses are named variants of these: `cx-status--live` (success), `--building` (warning) and `--archived` (muted). Use them on cards and accession labels (`accession-label.md`).
|
|
56
|
+
|
|
57
|
+
## Do
|
|
58
|
+
|
|
59
|
+
- Write the state as a word, always. The dot and colour repeat it.
|
|
60
|
+
- Keep it to one or two words, in the reader's terms ("Down", not "HTTP 503").
|
|
61
|
+
- Use the same word for the same state everywhere on a page: in the navigation, the table and the feed.
|
|
62
|
+
|
|
63
|
+
## Don't
|
|
64
|
+
|
|
65
|
+
- Don't use a tone for decoration or to mean something else, such as a category. Status colours are reserved for status.
|
|
66
|
+
- Don't pick a tone by how a word sounds; pick it by what the reader should do.
|
|
67
|
+
- Don't animate the dot to draw attention.
|
|
68
|
+
|
|
69
|
+
## Accessibility
|
|
70
|
+
|
|
71
|
+
- The word is the text, so the state reads without colour. The dot is a CSS pseudo-element and isn't announced.
|
|
72
|
+
- `--muted` draws a ring instead of a solid dot, so it differs in shape as well as colour.
|
|
73
|
+
- Pairs: each tone's `color.status.*.text` on `color.surface.base`, `color.surface.raised` and `color.surface.hover` (4.5:1); `color.text.muted` on the same surfaces (4.5:1).
|
|
74
|
+
- A status that changes while the page is open isn't a live region on its own. Announce changes once, as `docs/layouts/dashboard.md` (Live data) says.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: table-of-contents
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [portfolio, documentation]
|
|
4
5
|
tokens:
|
|
5
6
|
- border.focus.offset
|
|
6
7
|
- border.focus.width
|
|
@@ -81,3 +82,11 @@ A numbered list of an article's sections, beside the text on wide screens and ab
|
|
|
81
82
|
- The active entry is announced through `aria-current`, not colour alone (it also gets the accent rule).
|
|
82
83
|
- Entries are at least 24px tall.
|
|
83
84
|
- Pairs: `color.text.secondary` on `color.surface.base` (7:1); active rule `color.accent.border` (3:1).
|
|
85
|
+
|
|
86
|
+
## Behaviour
|
|
87
|
+
|
|
88
|
+
`dist/codex.js` adds this; an app that renders the table of contents itself does the same.
|
|
89
|
+
|
|
90
|
+
- **Docking:** when the article is wide enough for the table of contents to sit beside the text, it gets `is-docked` and sticks below the header (`--_header-height`). It's checked again on resize.
|
|
91
|
+
- **Current section:** as the reader scrolls, the link to the section that enters the top 30% of the view gets `aria-current="true"` and the others `"false"` (an IntersectionObserver with a bottom margin of -70%).
|
|
92
|
+
- Without script, the table of contents is a plain open list, and its `<details>` opens and closes natively.
|
package/docs/components/tag.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tag
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [shared]
|
|
4
5
|
tokens:
|
|
5
6
|
- border.focus.offset
|
|
6
7
|
- border.focus.width
|
|
@@ -37,7 +38,7 @@ A small mono label for a topic or technology, optionally linking to its index.
|
|
|
37
38
|
|
|
38
39
|
## When not to use
|
|
39
40
|
|
|
40
|
-
- For status; use `
|
|
41
|
+
- For status; use `status.md`.
|
|
41
42
|
- For actions; use `button-and-link`.
|
|
42
43
|
- For more than three tags on a card or five on a post.
|
|
43
44
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tooltip
|
|
3
3
|
status: stable
|
|
4
|
+
layouts: [shared]
|
|
4
5
|
tokens:
|
|
5
6
|
- color.surface.inverse
|
|
6
7
|
- color.text.inverse
|
|
@@ -65,3 +66,8 @@ It opens below the control, aligned to its right edge. Add `cx-tooltip--start` t
|
|
|
65
66
|
- It shows on `:focus-visible` as well as `:hover`, so keyboard users see it too.
|
|
66
67
|
- Escape hides it without moving the pointer or focus (WCAG 1.4.13).
|
|
67
68
|
- Pair: `color.text.inverse` on `color.surface.inverse` (7:1 in both themes).
|
|
69
|
+
|
|
70
|
+
## Behaviour
|
|
71
|
+
|
|
72
|
+
- Showing is CSS: the tooltip appears while its control is hovered or has `:focus-visible`.
|
|
73
|
+
- `dist/codex.js` adds dismissal: Escape adds `is-tooltip-dismissed` to every tooltip's control, hiding it without moving the pointer or focus. The class is removed when the pointer leaves the control or focus moves away. An app that renders tooltips itself does the same.
|
package/docs/hugo.md
CHANGED
|
@@ -66,7 +66,7 @@ Every partial below is called as `partial "motifspec/<name>.html" <context>`.
|
|
|
66
66
|
| `table-of-contents.html` | `table-of-contents.md` | A page. `article.html` already calls it. |
|
|
67
67
|
| `tags.html` | `tag.md` | `dict "page" . "max" 3`. |
|
|
68
68
|
| `tag-filter.html` | `tag.md` | `dict "section" "work" "current" nil` on a section page, or `dict "section" "" "current" .` on a term page. |
|
|
69
|
-
| `filed-under.html` | `tag.md`, `docs/
|
|
69
|
+
| `filed-under.html` | `tag.md`, `docs/layouts/portfolio.md` | A page. "Filed under" and its tags, after an article. |
|
|
70
70
|
| `pagination-entries.html` | `pagination.md` | `dict "page" . "label" "Post navigation" "noun" "Post"`. Previous and next in the page's section, oldest first. |
|
|
71
71
|
| `pagination-pages.html` | `pagination.md` | `dict "pager" $pager "label" "Writing pages"`. Pages of a paginated list; nothing when it fits on one page. |
|
|
72
72
|
| `back-link.html` | `button-and-link.md` | `dict "href" "…" "label" "All work"`. |
|
|
@@ -125,7 +125,7 @@ const motifspec = mounts.split(/\n(?=\{)/).map((m) => JSON.parse(m)).find((m) =>
|
|
|
125
125
|
execFileSync('node', [join(motifspec.dir, 'scripts', 'check.mjs'), '.'], { stdio: 'inherit' });
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
It checks `layouts/` and `content/` for what the README's Commands section lists. In GitHub Actions each problem is also an annotation on the pull request; `--json` prints the problems as JSON. In CI, give the step the same `HUGO_CACHEDIR` and `HUGO_MODULE_PROXY` as the build, because `hugo config mounts` downloads the module if it isn't cached.
|
|
128
|
+
It checks `layouts/` and `content/` for what the README's Commands section lists, against the layout the site declares in `[params.motifspec]` (see the README's Layouts section; portfolio when it declares none). In GitHub Actions each problem is also an annotation on the pull request; `--json` prints the problems as JSON. In CI, give the step the same `HUGO_CACHEDIR` and `HUGO_MODULE_PROXY` as the build, because `hugo config mounts` downloads the module if it isn't cached.
|
|
129
129
|
|
|
130
130
|
## Overriding
|
|
131
131
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# À la carte
|
|
2
|
+
|
|
3
|
+
For a project that fits none of the layouts, such as an app built around a full-screen canvas or map. It takes MotifSpec's tokens and the components it chooses, and brings its own frame. Declare it with `layout = "a-la-carte"` and list the components it uses (see `README.md`, Layouts).
|
|
4
|
+
|
|
5
|
+
## What it gets
|
|
6
|
+
|
|
7
|
+
- Every shared component, without listing them.
|
|
8
|
+
- The layout components it lists by doc name (the file name in `docs/components/` without `.md`), such as `table-of-contents` or `heading-anchor`, from any layout.
|
|
9
|
+
|
|
10
|
+
The checker treats any other layout component as a problem, so a project can't borrow parts by accident: add a component to the list when you mean to use it.
|
|
11
|
+
|
|
12
|
+
## Its own frame
|
|
13
|
+
|
|
14
|
+
There is no MotifSpec shell. The project lays out its own frame, for example controls placed over a canvas. That is the one case where a project using MotifSpec may have a stylesheet of its own, and the checker holds it to these rules:
|
|
15
|
+
|
|
16
|
+
- Every colour, size, radius, border width and duration is a semantic token (`var(--cx-…)`), as in MotifSpec's own CSS.
|
|
17
|
+
- No selector targets a `cx-` class: MotifSpec's components aren't restyled or overridden. A component that needs to change is changed in MotifSpec.
|
|
18
|
+
- The project's own class names don't start with `cx-`.
|
|
19
|
+
|
|
20
|
+
Use the stylesheet for the frame only. Anything that looks like a component belongs in MotifSpec first.
|
|
21
|
+
|
|
22
|
+
## Decoration
|
|
23
|
+
|
|
24
|
+
The project decides, within `backdrop.md` and `ornament.md`.
|
|
25
|
+
|
|
26
|
+
## Headings
|
|
27
|
+
|
|
28
|
+
One `<h1>` per page. Use heading anchors only on headings that start sections of reading text.
|
|
29
|
+
|
|
30
|
+
## Choosing a stack
|
|
31
|
+
|
|
32
|
+
| The project | Use |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
|
|
35
|
+
| An app with state, live data or a lot of interaction | React, or the app's own framework, with `@aitrien/motifspec` from npm and the components' markup. |
|
|
36
|
+
| Mostly pages to read | Probably a layout, not à la carte: see `portfolio.md` and `documentation.md`. |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Dashboard layout
|
|
2
|
+
|
|
3
|
+
For tools and admin screens: an overview of systems, lists of things to act on, settings. Declare it with `layout = "dashboard"` (see `README.md`, Layouts).
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
In progress. The dashboard's own components arrive in later releases, so this file says what exists now and what doesn't.
|
|
8
|
+
|
|
9
|
+
- **Available now:** every shared component, including buttons and compact buttons, callouts, data tables with state and action cells, status labels in five tones, disclosures, keyboard keys, code blocks, tags, tooltips, and icons for navigation and tools (`icon.md`).
|
|
10
|
+
- **Not available yet:** the app shell, side navigation, panels, stat tiles, meters, sparklines and charts, resource cards, the facts list, the event feed, the segmented control, form controls and the dialog.
|
|
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.
|
|
13
|
+
|
|
14
|
+
## Shell
|
|
15
|
+
|
|
16
|
+
Planned: a side navigation column (wordmark, grouped links, the theme toggle and a context line at its foot) beside the main region. Below `size.breakpoint.md`, the side navigation becomes a bar with a Menu disclosure that ships closed. Until it ships, use the site header and footer.
|
|
17
|
+
|
|
18
|
+
## Page templates
|
|
19
|
+
|
|
20
|
+
| Template | Order | Dominant | Secondary |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| **Overview** | Page head (title, when the readings were last updated, page-wide controls) → alerts as callouts → headline figures → the main column and a side column of sections | Alerts and headline figures | Detail sections |
|
|
23
|
+
| **List** | Page head → filters → a data table with row actions → pagination | The table | Filters |
|
|
24
|
+
| **Detail** | Page head with the item's status → its facts → its readings → related lists | Status and readings | Related lists |
|
|
25
|
+
| **Form** | Page head → grouped fields → actions at the end of the form | The fields | Help text |
|
|
26
|
+
| **Empty and error** | Page head → what's missing or what failed, and what to do next | The message | Links back |
|
|
27
|
+
|
|
28
|
+
## Components
|
|
29
|
+
|
|
30
|
+
Every shared component, plus the components whose doc lists `dashboard` under `layouts:`. Portfolio parts (catalogue numbers, accession labels, project cards, post rows, plates) don't belong on a dashboard.
|
|
31
|
+
|
|
32
|
+
## Decoration
|
|
33
|
+
|
|
34
|
+
- The backdrop fills the background of the main area, behind the content, for now; review this once a real dashboard has been used.
|
|
35
|
+
- No ornaments.
|
|
36
|
+
|
|
37
|
+
## Headings
|
|
38
|
+
|
|
39
|
+
- One `<h1>` per page: the page title.
|
|
40
|
+
- Section headings are `<h2>` with an id. On dashboard sections they take no heading anchor: sections are places on a screen, not parts of an article.
|
|
41
|
+
|
|
42
|
+
## Live data
|
|
43
|
+
|
|
44
|
+
MotifSpec doesn't fetch data; where an app gets its readings is the project's decision. How readings appear:
|
|
45
|
+
|
|
46
|
+
- Readings that update on a schedule aren't live regions, so a screen reader isn't interrupted on every update. New alerts and state changes are announced once, through one polite live region (`role="status"`) per page.
|
|
47
|
+
- The page says when its readings were last updated, as a `<time>`. A source that has gone quiet says so ("No readings since 13:58"); old numbers are never shown as current.
|
|
48
|
+
- Values change in place, with no counting animation and nothing flashing.
|
|
49
|
+
- A section whose source fails says so and when it last worked; the rest of the page keeps working.
|
|
50
|
+
- Recommended: the page requests readings only from its own backend, on the same origin, and the backend queries each service. That keeps API keys off the browser and gives one place to notice a source that has stopped.
|
|
51
|
+
|
|
52
|
+
## Choosing a stack
|
|
53
|
+
|
|
54
|
+
| The project | Use |
|
|
55
|
+
|---|---|
|
|
56
|
+
| Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
|
|
57
|
+
| A dashboard with live data or a lot of interaction (most dashboards) | React, or the app's own framework, with `@aitrien/motifspec` from npm and the components' markup. |
|
|
58
|
+
| A dashboard of reports that can be rebuilt on a schedule | Hugo with the module. |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Documentation layout
|
|
2
|
+
|
|
3
|
+
For product and system documentation: guides, reference pages and a changelog. motifspec.com will be its first site. Declare it with `layout = "documentation"` (see `README.md`, Layouts).
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
In progress. The documentation shell and its own components arrive in a later release, so this file says what exists now and what doesn't.
|
|
8
|
+
|
|
9
|
+
- **Available now:** every shared component, including disclosures and keyboard keys, plus the table of contents, heading anchors and the ornaments.
|
|
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.
|
|
13
|
+
|
|
14
|
+
## Shell
|
|
15
|
+
|
|
16
|
+
Planned: a top bar (wordmark, search, section nav, version, theme toggle, repository link), grouped page navigation on the left, the article in the middle and "On this page" on the right. Below `size.breakpoint.md`, the page navigation sits behind a Menu disclosure and "On this page" moves above the article. Until it ships, use the site header and footer with the table of contents.
|
|
17
|
+
|
|
18
|
+
## Page templates
|
|
19
|
+
|
|
20
|
+
| Template | Order | Dominant | Secondary |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| **Docs home** | Header → statement (display h1, lede) → entry points to each section → what's new → footer | The statement and entry points | What's new |
|
|
23
|
+
| **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
|
+
| **Reference table** | Header → title and one-line intro → the table (tokens, icons, rules) → footer | The table | Intro |
|
|
25
|
+
| **Changelog** | Header → title → releases, newest first, each with its version, date and changes → footer | The releases | Dates |
|
|
26
|
+
| **404** | Header → h1 "Page not found" → links to the docs home and search → footer | Heading and the routes out | |
|
|
27
|
+
|
|
28
|
+
## Components
|
|
29
|
+
|
|
30
|
+
Every shared component, plus the components whose doc lists `documentation` under `layouts:`. Catalogue numbers, accession labels, project cards and post rows belong to the portfolio.
|
|
31
|
+
|
|
32
|
+
## Decoration
|
|
33
|
+
|
|
34
|
+
- The head of the backdrop on the docs home, and its foot behind the footer on every page.
|
|
35
|
+
- The footer band. No other ornaments in articles.
|
|
36
|
+
|
|
37
|
+
## Headings
|
|
38
|
+
|
|
39
|
+
- One `<h1>` per page.
|
|
40
|
+
- Every `<h2>` in an article has an id and a heading anchor; `<h3>`s in long pages may have one too (`heading-anchor.md`).
|
|
41
|
+
|
|
42
|
+
## Choosing a stack
|
|
43
|
+
|
|
44
|
+
| The project | Use |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
|
|
47
|
+
| A new documentation site | Hugo with the module (`docs/hugo.md`). |
|
|
48
|
+
| Documentation inside an app | The app's own framework, with `@aitrien/motifspec` from npm and the components' markup. |
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Portfolio layout
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
For a personal or studio portfolio: case studies, writing and an about page. aitrien.com uses it. Declare it with `layout = "portfolio"` (see `README.md`, Layouts); a project that declares nothing is checked as portfolio.
|
|
4
|
+
|
|
5
|
+
## Shell
|
|
6
|
+
|
|
7
|
+
The site header, the main region and the site footer, on a backdrop page. In Hugo the shell is the page shell in `docs/hugo.md`; elsewhere, copy the markup from `site-header.md`, `site-footer.md` and `backdrop.md`.
|
|
8
|
+
|
|
9
|
+
## Page templates
|
|
10
|
+
|
|
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.
|
|
4
12
|
|
|
5
13
|
| Template | Order | Dominant | Secondary |
|
|
6
14
|
|---|---|---|---|
|
|
@@ -11,11 +19,35 @@ Content hierarchy for the six page types. Every template sits on the backdrop (`
|
|
|
11
19
|
| **Blog post** | Header → back link "← All writing" → meta line (`cx-id`: number, date, reading time) → h1 and lede → article layout: TOC (when three or more h2s) + prose with figures, code blocks and callouts → end mark → "Filed under" tags → pagination → footer | The prose column | Meta, TOC |
|
|
12
20
|
| **404** | Header → sprout ornament (lg) → accession label "No. — / Not in collection" → h1 "Page not found" → the requested path in mono → three links: Home, Work, Writing → footer | Heading and the routes out | Ornament, path |
|
|
13
21
|
|
|
22
|
+
## Components
|
|
23
|
+
|
|
24
|
+
Every shared component, plus the components whose doc lists `portfolio` under `layouts:`: accession label, backdrop, heading anchor, ornament, post list item, project card, specimen plate and table of contents.
|
|
25
|
+
|
|
14
26
|
## Catalogue numbers
|
|
15
27
|
|
|
28
|
+
Catalogue numbers belong to this layout only.
|
|
29
|
+
|
|
16
30
|
- Work: `LM-W-001` onward. Writing: `LM-P-001` onward. Zero-padded, never reused, stored in front matter as `accession`.
|
|
17
31
|
- They appear on cards, post rows, post meta lines and case-study labels.
|
|
18
32
|
|
|
33
|
+
## Decoration
|
|
34
|
+
|
|
35
|
+
- The head of the backdrop on the home page, and its foot behind the footer on every page.
|
|
36
|
+
- Ornaments as `ornament.md` places them: the footer band, the prose divider, the article end mark and the 404 glyph.
|
|
37
|
+
|
|
38
|
+
## Headings
|
|
39
|
+
|
|
40
|
+
- One `<h1>` per page.
|
|
41
|
+
- Every `<h2>` section heading has an id and a heading anchor (`heading-anchor.md`).
|
|
42
|
+
|
|
19
43
|
## Front matter
|
|
20
44
|
|
|
21
45
|
The fields each template reads are in `docs/hugo.md` (Front matter the partials read).
|
|
46
|
+
|
|
47
|
+
## Choosing a stack
|
|
48
|
+
|
|
49
|
+
| The project | Use |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Already has a stack | Keep it. MotifSpec adapts to the project, not the reverse. |
|
|
52
|
+
| A new portfolio or content site | Hugo with the module (`docs/hugo.md`). |
|
|
53
|
+
| An app with state, live data or a lot of interaction | React, or the app's own framework, with `@aitrien/motifspec` from npm and the components' markup. |
|