@aitrien/motifspec 1.25.1 → 1.26.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 +13 -0
- package/dist/codex.css +69 -4
- package/dist/codex.js +63 -1
- package/dist/tokens.css +5 -3
- package/dist/tokens.js +21 -5
- package/dist/tokens.json +21 -5
- package/docs/components/_groups.json +1 -0
- package/docs/components/alert.md +134 -0
- package/docs/components/breadcrumb.md +76 -0
- package/docs/components/callout.md +2 -1
- package/docs/components/docs-shell.md +7 -1
- package/docs/components/status.md +1 -1
- package/docs/components/toast.md +101 -0
- package/docs/hugo.md +3 -1
- package/docs/layouts/dashboard.md +2 -2
- package/docs/layouts/documentation.md +1 -1
- package/layouts/_partials/motifspec/alert.html +21 -0
- package/layouts/_partials/motifspec/breadcrumb.html +12 -0
- package/package.json +1 -1
- package/scripts/lib.mjs +3 -0
- package/tokens/color.json +2 -2
- package/tokens/motion.json +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Every release of MotifSpec (named brand-codex until 1.10.0), newest first. Entries before 1.10.0 keep the names they were released under. Versions follow the rules in `CONVENTIONS.md`: renaming or removing a semantic token is major, adding tokens, components or icons is minor, and changing a value or fixing a description is a patch. `npm run build` fails if the version in `package.json` has no entry here.
|
|
4
4
|
|
|
5
|
+
## [1.26.0] - 2026-11-18
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Alert (`alert.md`, shared): a message about the page or the system at the top of the main column, in four kinds (info, success, warning and danger) with an optional dismiss button. With a key, a dismissed alert stays dismissed on later pages. In Hugo, `motifspec/alert.html` writes one.
|
|
9
|
+
- Toast (`toast.md`, shared): a short confirmation at the bottom of the screen, sent with a `cx-toast` event and shown by `codex.js` in one polite live region per page. It stays for the new `motion.duration.toast` (6 seconds), and the time starts again while the pointer or focus is on it.
|
|
10
|
+
- Breadcrumb (`breadcrumb.md`, documentation layout): the trail from the home page to the page's section, first in the page head. In Hugo, `motifspec/breadcrumb.html` writes it from the page's ancestors.
|
|
11
|
+
- A Messages group on the Components page, with the callout, alert and toast.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- The dashboard layout's alerts are alerts (`alert.md`), not callouts. motifspec.com shows a deprecated page's notice as an alert, and the breadcrumb on every page below a section.
|
|
15
|
+
- `color.surface.inverse` and `color.text.inverse` are for toasts as well as tooltips.
|
|
16
|
+
- The primitive behind `motion.duration.drift` is now `primitive.motion.duration.7`; its value hasn't changed.
|
|
17
|
+
|
|
5
18
|
## [1.25.1] - 2026-11-18
|
|
6
19
|
|
|
7
20
|
### Changed
|
package/dist/codex.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono-latin-wght.woff2") format("woff2"); font-weight: 100 900; 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.26.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 {
|
|
@@ -194,7 +194,8 @@
|
|
|
194
194
|
--cx-primitive-motion-duration-3: 320ms;
|
|
195
195
|
--cx-primitive-motion-duration-4: 1600ms;
|
|
196
196
|
--cx-primitive-motion-duration-5: 3200ms;
|
|
197
|
-
--cx-primitive-motion-duration-6:
|
|
197
|
+
--cx-primitive-motion-duration-6: 6000ms;
|
|
198
|
+
--cx-primitive-motion-duration-7: 60000ms;
|
|
198
199
|
|
|
199
200
|
/* primitive.motion.easing */
|
|
200
201
|
--cx-primitive-motion-easing-out-strong: cubic-bezier(0.2, 0, 0, 1);
|
|
@@ -212,8 +213,9 @@
|
|
|
212
213
|
--cx-motion-duration-base: var(--cx-primitive-motion-duration-2);
|
|
213
214
|
--cx-motion-duration-slow: var(--cx-primitive-motion-duration-3);
|
|
214
215
|
--cx-motion-duration-plate: var(--cx-primitive-motion-duration-4);
|
|
215
|
-
--cx-motion-duration-drift: var(--cx-primitive-motion-duration-
|
|
216
|
+
--cx-motion-duration-drift: var(--cx-primitive-motion-duration-7);
|
|
216
217
|
--cx-motion-duration-settle: var(--cx-primitive-motion-duration-5);
|
|
218
|
+
--cx-motion-duration-toast: var(--cx-primitive-motion-duration-6);
|
|
217
219
|
--cx-motion-duration-pulse: var(--cx-primitive-motion-duration-5); /* Deprecated: Unused since the contour plate; removed in 2.0.0. */
|
|
218
220
|
|
|
219
221
|
/* motion.easing */
|
|
@@ -517,7 +519,7 @@ p, li, dd, figcaption { text-wrap: pretty; }
|
|
|
517
519
|
.cx-skip-link:focus { transform: none; }
|
|
518
520
|
|
|
519
521
|
/* Shared label voice: mono, uppercase, tracked. */
|
|
520
|
-
.cx-eyebrow, .cx-label dt, .cx-table thead th, .cx-toc summary, .cx-code__bar, .cx-callout__title, .cx-footer h2, .cx-figure__plate, .cx-catalogue__name {
|
|
522
|
+
.cx-eyebrow, .cx-label dt, .cx-table thead th, .cx-toc summary, .cx-code__bar, .cx-callout__title, .cx-footer h2, .cx-figure__plate, .cx-catalogue__name, .cx-breadcrumb {
|
|
521
523
|
font-family: var(--cx-font-family-mono);
|
|
522
524
|
font-size: var(--cx-font-size-label);
|
|
523
525
|
font-weight: var(--cx-font-weight-ui);
|
|
@@ -1018,6 +1020,18 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
|
|
|
1018
1020
|
.cx-link:hover, .cx-back:hover { color: var(--cx-color-link-hover); text-decoration-thickness: var(--cx-border-width-emphasis); }
|
|
1019
1021
|
.cx-back { 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; text-decoration: none; }
|
|
1020
1022
|
|
|
1023
|
+
/* ------------------------------------------------------------ breadcrumb (breadcrumb.md, documentation layout) */
|
|
1024
|
+
/* The trail from the home page to the page's parent, above the h1. The separators are hidden from assistive
|
|
1025
|
+
technology (the alternative text after the slash is empty); the list already says how the links relate. */
|
|
1026
|
+
.cx-breadcrumb__list { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--cx-space-inline-sm); margin: 0; padding: 0; list-style: none; }
|
|
1027
|
+
.cx-breadcrumb__list > li { display: inline-flex; align-items: center; gap: var(--cx-space-inline-sm); margin: 0; }
|
|
1028
|
+
.cx-breadcrumb__list > li + li::before { content: "/"; content: "/" / ""; color: var(--cx-color-text-muted); }
|
|
1029
|
+
.cx-breadcrumb a {
|
|
1030
|
+
display: inline-flex; align-items: center; min-height: var(--cx-size-target-min); color: var(--cx-color-text-secondary);
|
|
1031
|
+
text-decoration: none; text-underline-offset: var(--cx-space-inline-xs);
|
|
1032
|
+
}
|
|
1033
|
+
.cx-breadcrumb a:hover { color: var(--cx-color-text-primary); text-decoration: underline; text-decoration-thickness: var(--cx-border-width-hairline); }
|
|
1034
|
+
|
|
1021
1035
|
/* ------------------------------------------------------------ prose */
|
|
1022
1036
|
.cx-prose { min-width: 0; }
|
|
1023
1037
|
.cx-prose > * { margin-block: 0; }
|
|
@@ -1164,6 +1178,57 @@ a.cx-tag:hover { border-color: var(--cx-color-accent-border); color: var(--cx-co
|
|
|
1164
1178
|
.cx-callout--warning { --_border: var(--cx-color-status-warning-border); --_bg: var(--cx-color-status-warning-surface); --_title: var(--cx-color-status-warning-text); }
|
|
1165
1179
|
.cx-callout--danger { --_border: var(--cx-color-status-danger-border); --_bg: var(--cx-color-status-danger-surface); --_title: var(--cx-color-status-danger-text); }
|
|
1166
1180
|
|
|
1181
|
+
/* ------------------------------------------------------------ alert (alert.md) */
|
|
1182
|
+
/* A message about the page or the system, at the top of the main column: icon, body, and an optional dismiss button
|
|
1183
|
+
that codex.js shows. The emphasis rule along the top sets it apart from a callout, which sits in the running text. */
|
|
1184
|
+
.cx-alert {
|
|
1185
|
+
--_border: var(--cx-color-status-info-border); --_bg: var(--cx-color-status-info-surface); --_ink: var(--cx-color-status-info-text);
|
|
1186
|
+
display: flex; align-items: flex-start; gap: var(--cx-space-inline-md); padding: var(--cx-space-inset-md);
|
|
1187
|
+
border: var(--cx-border-width-hairline) solid var(--_border); border-block-start-width: var(--cx-border-width-emphasis);
|
|
1188
|
+
background: var(--_bg); color: var(--cx-color-text-primary); line-height: var(--cx-font-line-height-ui);
|
|
1189
|
+
flex: 1 1 100%; /* a whole row, in a flex container too */
|
|
1190
|
+
}
|
|
1191
|
+
.cx-alert[hidden] { display: none; }
|
|
1192
|
+
:where(main) > .cx-alert { margin-block-end: var(--cx-space-stack-lg); }
|
|
1193
|
+
.cx-alert__icon { flex: none; color: var(--_ink); margin-block-start: calc((1lh - var(--cx-size-icon-md)) / 2); } /* centred on the first line */
|
|
1194
|
+
.cx-alert__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--cx-space-stack-xs); }
|
|
1195
|
+
.cx-alert__body > * { margin: 0; max-width: var(--cx-size-measure-prose); }
|
|
1196
|
+
.cx-alert__title { font-weight: var(--cx-font-weight-strong); }
|
|
1197
|
+
.cx-alert--success { --_border: var(--cx-color-status-success-border); --_bg: var(--cx-color-status-success-surface); --_ink: var(--cx-color-status-success-text); }
|
|
1198
|
+
.cx-alert--warning { --_border: var(--cx-color-status-warning-border); --_bg: var(--cx-color-status-warning-surface); --_ink: var(--cx-color-status-warning-text); }
|
|
1199
|
+
.cx-alert--danger { --_border: var(--cx-color-status-danger-border); --_bg: var(--cx-color-status-danger-surface); --_ink: var(--cx-color-status-danger-text); }
|
|
1200
|
+
.cx-alert__dismiss, .cx-toast__dismiss {
|
|
1201
|
+
flex: none; display: inline-grid; place-items: center; inline-size: var(--cx-size-target-min); block-size: var(--cx-size-target-min);
|
|
1202
|
+
margin: calc(var(--cx-space-inset-xs) * -1); padding: 0; border: 0; border-radius: var(--cx-radius-control);
|
|
1203
|
+
background: transparent; color: inherit; cursor: pointer;
|
|
1204
|
+
}
|
|
1205
|
+
.cx-alert__dismiss[hidden] { display: none; }
|
|
1206
|
+
.cx-alert__dismiss:hover { background: var(--cx-color-surface-hover); }
|
|
1207
|
+
.cx-alert__dismiss:focus-visible { outline: var(--cx-border-focus-width) solid var(--cx-color-focus-ring); outline-offset: var(--cx-border-focus-offset); }
|
|
1208
|
+
|
|
1209
|
+
/* ------------------------------------------------------------ toast (toast.md) */
|
|
1210
|
+
/* codex.js keeps one region per page, fixed at the end of the viewport, and adds a toast to it on a cx-toast event.
|
|
1211
|
+
The region is a polite live region, so each toast is read once without moving focus. */
|
|
1212
|
+
.cx-toasts {
|
|
1213
|
+
position: fixed; z-index: 40; inset-block-end: var(--cx-space-gutter-page); inset-inline: var(--cx-space-gutter-page);
|
|
1214
|
+
display: flex; flex-direction: column; align-items: flex-end; gap: var(--cx-space-stack-sm); pointer-events: none;
|
|
1215
|
+
}
|
|
1216
|
+
.cx-toast {
|
|
1217
|
+
display: flex; align-items: center; gap: var(--cx-space-inline-sm); max-width: var(--cx-size-column-card);
|
|
1218
|
+
padding: var(--cx-space-inset-sm) var(--cx-space-inset-sm) var(--cx-space-inset-sm) var(--cx-space-inset-md);
|
|
1219
|
+
border-radius: var(--cx-radius-control); background: var(--cx-color-surface-inverse); color: var(--cx-color-text-inverse);
|
|
1220
|
+
font-size: var(--cx-font-size-small); line-height: var(--cx-font-line-height-ui); pointer-events: auto;
|
|
1221
|
+
}
|
|
1222
|
+
.cx-toast__text { flex: 1; min-width: 0; margin: 0; }
|
|
1223
|
+
.cx-toast__dismiss { margin: 0; }
|
|
1224
|
+
.cx-toast__dismiss:focus-visible { outline: var(--cx-border-focus-width) solid var(--cx-color-text-inverse); outline-offset: calc(var(--cx-border-focus-width) * -2); }
|
|
1225
|
+
.cx-toasts .cx-toast {
|
|
1226
|
+
opacity: 0; transform: translateY(var(--cx-motion-distance-nudge));
|
|
1227
|
+
transition: opacity var(--cx-motion-duration-base) var(--cx-motion-easing-enter), transform var(--cx-motion-duration-base) var(--cx-motion-easing-enter);
|
|
1228
|
+
}
|
|
1229
|
+
.cx-toasts .cx-toast.is-shown { opacity: 1; transform: none; }
|
|
1230
|
+
.cx-toasts .cx-toast.is-leaving { transition-timing-function: var(--cx-motion-easing-exit); }
|
|
1231
|
+
|
|
1167
1232
|
/* ------------------------------------------------------------ data table */
|
|
1168
1233
|
.cx-table { position: relative; min-width: 0; overflow-x: auto; border: var(--cx-border-width-hairline) solid var(--cx-color-border-default); background: var(--cx-color-surface-raised); }
|
|
1169
1234
|
.cx-table table { width: 100%; border-collapse: collapse; font-size: var(--cx-font-size-small); line-height: var(--cx-font-line-height-ui); }
|
package/dist/codex.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// MotifSpec behaviour: theme toggle, the backdrop header's scroll state, tooltip dismissal, code copy buttons,
|
|
2
|
-
// TOC docking and active section.
|
|
2
|
+
// TOC docking and active section, alert dismissal and toasts.
|
|
3
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>.
|
|
@@ -282,6 +282,68 @@
|
|
|
282
282
|
});
|
|
283
283
|
});
|
|
284
284
|
|
|
285
|
+
// Alerts (alert.md): show each dismiss button, and hide its alert when pressed. With a key, data-alert-dismiss="x",
|
|
286
|
+
// the alert stays hidden on later pages too (localStorage "cx-alert:x"). Focus moves to the main column, since the
|
|
287
|
+
// button it was on has gone. One listener on the document, so an alert an app adds later works the same way.
|
|
288
|
+
var dismissed = function (key) { try { return Boolean(key) && localStorage.getItem('cx-alert:' + key) === 'dismissed'; } catch (e) { return false; } };
|
|
289
|
+
document.querySelectorAll('.cx-alert [data-alert-dismiss]').forEach(function (btn) {
|
|
290
|
+
var alert = btn.closest('.cx-alert');
|
|
291
|
+
if (dismissed(btn.dataset.alertDismiss)) alert.hidden = true; else btn.hidden = false;
|
|
292
|
+
});
|
|
293
|
+
document.addEventListener('click', function (e) {
|
|
294
|
+
var btn = e.target.closest && e.target.closest('.cx-alert [data-alert-dismiss]');
|
|
295
|
+
if (!btn) return;
|
|
296
|
+
var key = btn.dataset.alertDismiss;
|
|
297
|
+
btn.closest('.cx-alert').hidden = true;
|
|
298
|
+
if (key) { try { localStorage.setItem('cx-alert:' + key, 'dismissed'); } catch (err) { /* storage blocked: hidden for this view only */ } }
|
|
299
|
+
var main = document.getElementById('main');
|
|
300
|
+
if (main) main.focus({ preventScroll: true });
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// Toasts (toast.md): document.dispatchEvent(new CustomEvent('cx-toast', { detail: { text: 'Saved', kind: 'success' } })).
|
|
304
|
+
// One polite live region per page, made here if the page has none, holds up to three; each goes after
|
|
305
|
+
// motion.duration.toast, a time that starts again while the pointer or focus is on it. Escape inside one, or its
|
|
306
|
+
// button, closes it. The text is set as text, never as HTML.
|
|
307
|
+
var region = document.querySelector('.cx-toasts');
|
|
308
|
+
if (!region) {
|
|
309
|
+
region = document.createElement('div'); region.className = 'cx-toasts'; region.setAttribute('role', 'status');
|
|
310
|
+
document.body.appendChild(region);
|
|
311
|
+
}
|
|
312
|
+
var toastIcon = function (id, cls) {
|
|
313
|
+
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
314
|
+
svg.setAttribute('class', 'cx-icon cx-icon--sm' + (cls ? ' ' + cls : '')); svg.setAttribute('aria-hidden', 'true'); svg.setAttribute('focusable', 'false');
|
|
315
|
+
var use = document.createElementNS('http://www.w3.org/2000/svg', 'use'); use.setAttribute('href', '#cx-icon-' + id);
|
|
316
|
+
svg.appendChild(use); return svg;
|
|
317
|
+
};
|
|
318
|
+
var closeToast = function (toast) {
|
|
319
|
+
if (toast.classList.contains('is-leaving')) return;
|
|
320
|
+
clearTimeout(toast._cxTimer);
|
|
321
|
+
var hadFocus = toast.contains(document.activeElement);
|
|
322
|
+
toast.classList.add('is-leaving'); toast.classList.remove('is-shown');
|
|
323
|
+
setTimeout(function () { toast.remove(); }, ms('--cx-motion-duration-base'));
|
|
324
|
+
if (hadFocus) { var main = document.getElementById('main'); if (main) main.focus({ preventScroll: true }); }
|
|
325
|
+
};
|
|
326
|
+
document.addEventListener('cx-toast', function (e) {
|
|
327
|
+
var d = e.detail || {};
|
|
328
|
+
if (!d.text) return;
|
|
329
|
+
var toast = document.createElement('div'); toast.className = 'cx-toast';
|
|
330
|
+
if (d.kind === 'success') toast.appendChild(toastIcon('check'));
|
|
331
|
+
var p = document.createElement('p'); p.className = 'cx-toast__text'; p.textContent = d.text; toast.appendChild(p);
|
|
332
|
+
var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'cx-toast__dismiss'; btn.setAttribute('aria-label', 'Dismiss');
|
|
333
|
+
btn.appendChild(toastIcon('close')); btn.addEventListener('click', function () { closeToast(toast); }); toast.appendChild(btn);
|
|
334
|
+
var wait = function () { clearTimeout(toast._cxTimer); toast._cxTimer = setTimeout(function () { closeToast(toast); }, ms('--cx-motion-duration-toast')); };
|
|
335
|
+
var hold = function () { clearTimeout(toast._cxTimer); };
|
|
336
|
+
toast.addEventListener('mouseenter', hold); toast.addEventListener('focusin', hold);
|
|
337
|
+
toast.addEventListener('mouseleave', function () { if (!toast.contains(document.activeElement)) wait(); });
|
|
338
|
+
toast.addEventListener('focusout', function (ev) { if (!toast.contains(ev.relatedTarget) && !toast.matches(':hover')) wait(); });
|
|
339
|
+
toast.addEventListener('keydown', function (ev) { if (ev.key === 'Escape') { ev.stopPropagation(); closeToast(toast); } });
|
|
340
|
+
var live = region.querySelectorAll('.cx-toast:not(.is-leaving)');
|
|
341
|
+
if (live.length >= 3) closeToast(live[0]);
|
|
342
|
+
region.appendChild(toast);
|
|
343
|
+
window.requestAnimationFrame(function () { window.requestAnimationFrame(function () { toast.classList.add('is-shown'); }); });
|
|
344
|
+
wait();
|
|
345
|
+
});
|
|
346
|
+
|
|
285
347
|
// Docs navigation: dock it (sticky, scrolling on its own) while it sits beside the main column, as the TOC does.
|
|
286
348
|
document.querySelectorAll('.cx-docs').forEach(function (docs) {
|
|
287
349
|
var nav = docs.querySelector('.cx-docs-nav');
|
package/dist/tokens.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* MotifSpec 1.
|
|
1
|
+
/* MotifSpec 1.26.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 {
|
|
@@ -190,7 +190,8 @@
|
|
|
190
190
|
--cx-primitive-motion-duration-3: 320ms;
|
|
191
191
|
--cx-primitive-motion-duration-4: 1600ms;
|
|
192
192
|
--cx-primitive-motion-duration-5: 3200ms;
|
|
193
|
-
--cx-primitive-motion-duration-6:
|
|
193
|
+
--cx-primitive-motion-duration-6: 6000ms;
|
|
194
|
+
--cx-primitive-motion-duration-7: 60000ms;
|
|
194
195
|
|
|
195
196
|
/* primitive.motion.easing */
|
|
196
197
|
--cx-primitive-motion-easing-out-strong: cubic-bezier(0.2, 0, 0, 1);
|
|
@@ -208,8 +209,9 @@
|
|
|
208
209
|
--cx-motion-duration-base: var(--cx-primitive-motion-duration-2);
|
|
209
210
|
--cx-motion-duration-slow: var(--cx-primitive-motion-duration-3);
|
|
210
211
|
--cx-motion-duration-plate: var(--cx-primitive-motion-duration-4);
|
|
211
|
-
--cx-motion-duration-drift: var(--cx-primitive-motion-duration-
|
|
212
|
+
--cx-motion-duration-drift: var(--cx-primitive-motion-duration-7);
|
|
212
213
|
--cx-motion-duration-settle: var(--cx-primitive-motion-duration-5);
|
|
214
|
+
--cx-motion-duration-toast: var(--cx-primitive-motion-duration-6);
|
|
213
215
|
--cx-motion-duration-pulse: var(--cx-primitive-motion-duration-5); /* Deprecated: Unused since the contour plate; removed in 2.0.0. */
|
|
214
216
|
|
|
215
217
|
/* motion.easing */
|
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.26.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 = [
|
|
@@ -571,7 +571,7 @@ export const tokens = [
|
|
|
571
571
|
"referencesDark": "primitive.color.ash.100",
|
|
572
572
|
"value": "#252a28",
|
|
573
573
|
"valueDark": "#eaf1ee",
|
|
574
|
-
"description": "Background of tooltips and other small transient labels that must stand out from every surface. Never for panels or cards."
|
|
574
|
+
"description": "Background of tooltips, toasts and other small transient labels that must stand out from every surface. Never for panels or cards."
|
|
575
575
|
},
|
|
576
576
|
{
|
|
577
577
|
"name": "color.surface.highlight",
|
|
@@ -721,7 +721,7 @@ export const tokens = [
|
|
|
721
721
|
"referencesDark": "primitive.color.ash.900",
|
|
722
722
|
"value": "#f4f8f6",
|
|
723
723
|
"valueDark": "#252a28",
|
|
724
|
-
"description": "Text on color.surface.inverse (tooltips). Only there.",
|
|
724
|
+
"description": "Text on color.surface.inverse (tooltips and toasts), and the focus ring inside a toast. Only there.",
|
|
725
725
|
"pairsWith": [
|
|
726
726
|
{
|
|
727
727
|
"token": "color.surface.inverse",
|
|
@@ -1737,6 +1737,13 @@ export const tokens = [
|
|
|
1737
1737
|
"css": "--cx-primitive-motion-duration-6",
|
|
1738
1738
|
"tier": "primitive",
|
|
1739
1739
|
"type": "duration",
|
|
1740
|
+
"value": "6000ms"
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
"name": "primitive.motion.duration.7",
|
|
1744
|
+
"css": "--cx-primitive-motion-duration-7",
|
|
1745
|
+
"tier": "primitive",
|
|
1746
|
+
"type": "duration",
|
|
1740
1747
|
"value": "60000ms"
|
|
1741
1748
|
},
|
|
1742
1749
|
{
|
|
@@ -1831,7 +1838,7 @@ export const tokens = [
|
|
|
1831
1838
|
"css": "--cx-motion-duration-drift",
|
|
1832
1839
|
"tier": "semantic",
|
|
1833
1840
|
"type": "duration",
|
|
1834
|
-
"references": "primitive.motion.duration.
|
|
1841
|
+
"references": "primitive.motion.duration.7",
|
|
1835
1842
|
"value": "60000ms",
|
|
1836
1843
|
"description": "Time the specimen plate's terrain takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one plate per page, with a visible pause control, stopped under prefers-reduced-motion. The backdrop doesn't drift."
|
|
1837
1844
|
},
|
|
@@ -1844,6 +1851,15 @@ export const tokens = [
|
|
|
1844
1851
|
"value": "3200ms",
|
|
1845
1852
|
"description": "The backdrop's response time. The home page's contours settle into place over it on arrival and then stay still, and a hill the pointer warms takes about two-thirds of it to rise and twice it to flatten. Under five seconds, so nothing runs long enough to need a pause control; none of it happens under prefers-reduced-motion."
|
|
1846
1853
|
},
|
|
1854
|
+
{
|
|
1855
|
+
"name": "motion.duration.toast",
|
|
1856
|
+
"css": "--cx-motion-duration-toast",
|
|
1857
|
+
"tier": "semantic",
|
|
1858
|
+
"type": "duration",
|
|
1859
|
+
"references": "primitive.motion.duration.6",
|
|
1860
|
+
"value": "6000ms",
|
|
1861
|
+
"description": "How long a toast (toast.md) stays before it goes on its own. The time starts again while the pointer or focus is on it, and isn't shortened under prefers-reduced-motion: it is time to read, not motion."
|
|
1862
|
+
},
|
|
1847
1863
|
{
|
|
1848
1864
|
"name": "motion.duration.pulse",
|
|
1849
1865
|
"css": "--cx-motion-duration-pulse",
|
|
@@ -1870,7 +1886,7 @@ export const tokens = [
|
|
|
1870
1886
|
"type": "cubicBezier",
|
|
1871
1887
|
"references": "primitive.motion.easing.decelerate",
|
|
1872
1888
|
"value": "cubic-bezier(0, 0, 0.2, 1)",
|
|
1873
|
-
"description": "Elements appearing: disclosures opening, a toast arriving."
|
|
1889
|
+
"description": "Elements appearing: disclosures opening, a toast arriving (toast.md)."
|
|
1874
1890
|
},
|
|
1875
1891
|
{
|
|
1876
1892
|
"name": "motion.easing.exit",
|
package/dist/tokens.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.26.0",
|
|
3
3
|
"changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
|
|
4
4
|
"showcase": "https://motifspec.com",
|
|
5
5
|
"tokens": [
|
|
@@ -571,7 +571,7 @@
|
|
|
571
571
|
"referencesDark": "primitive.color.ash.100",
|
|
572
572
|
"value": "#252a28",
|
|
573
573
|
"valueDark": "#eaf1ee",
|
|
574
|
-
"description": "Background of tooltips and other small transient labels that must stand out from every surface. Never for panels or cards."
|
|
574
|
+
"description": "Background of tooltips, toasts and other small transient labels that must stand out from every surface. Never for panels or cards."
|
|
575
575
|
},
|
|
576
576
|
{
|
|
577
577
|
"name": "color.surface.highlight",
|
|
@@ -721,7 +721,7 @@
|
|
|
721
721
|
"referencesDark": "primitive.color.ash.900",
|
|
722
722
|
"value": "#f4f8f6",
|
|
723
723
|
"valueDark": "#252a28",
|
|
724
|
-
"description": "Text on color.surface.inverse (tooltips). Only there.",
|
|
724
|
+
"description": "Text on color.surface.inverse (tooltips and toasts), and the focus ring inside a toast. Only there.",
|
|
725
725
|
"pairsWith": [
|
|
726
726
|
{
|
|
727
727
|
"token": "color.surface.inverse",
|
|
@@ -1737,6 +1737,13 @@
|
|
|
1737
1737
|
"css": "--cx-primitive-motion-duration-6",
|
|
1738
1738
|
"tier": "primitive",
|
|
1739
1739
|
"type": "duration",
|
|
1740
|
+
"value": "6000ms"
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
"name": "primitive.motion.duration.7",
|
|
1744
|
+
"css": "--cx-primitive-motion-duration-7",
|
|
1745
|
+
"tier": "primitive",
|
|
1746
|
+
"type": "duration",
|
|
1740
1747
|
"value": "60000ms"
|
|
1741
1748
|
},
|
|
1742
1749
|
{
|
|
@@ -1831,7 +1838,7 @@
|
|
|
1831
1838
|
"css": "--cx-motion-duration-drift",
|
|
1832
1839
|
"tier": "semantic",
|
|
1833
1840
|
"type": "duration",
|
|
1834
|
-
"references": "primitive.motion.duration.
|
|
1841
|
+
"references": "primitive.motion.duration.7",
|
|
1835
1842
|
"value": "60000ms",
|
|
1836
1843
|
"description": "Time the specimen plate's terrain takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one plate per page, with a visible pause control, stopped under prefers-reduced-motion. The backdrop doesn't drift."
|
|
1837
1844
|
},
|
|
@@ -1844,6 +1851,15 @@
|
|
|
1844
1851
|
"value": "3200ms",
|
|
1845
1852
|
"description": "The backdrop's response time. The home page's contours settle into place over it on arrival and then stay still, and a hill the pointer warms takes about two-thirds of it to rise and twice it to flatten. Under five seconds, so nothing runs long enough to need a pause control; none of it happens under prefers-reduced-motion."
|
|
1846
1853
|
},
|
|
1854
|
+
{
|
|
1855
|
+
"name": "motion.duration.toast",
|
|
1856
|
+
"css": "--cx-motion-duration-toast",
|
|
1857
|
+
"tier": "semantic",
|
|
1858
|
+
"type": "duration",
|
|
1859
|
+
"references": "primitive.motion.duration.6",
|
|
1860
|
+
"value": "6000ms",
|
|
1861
|
+
"description": "How long a toast (toast.md) stays before it goes on its own. The time starts again while the pointer or focus is on it, and isn't shortened under prefers-reduced-motion: it is time to read, not motion."
|
|
1862
|
+
},
|
|
1847
1863
|
{
|
|
1848
1864
|
"name": "motion.duration.pulse",
|
|
1849
1865
|
"css": "--cx-motion-duration-pulse",
|
|
@@ -1870,7 +1886,7 @@
|
|
|
1870
1886
|
"type": "cubicBezier",
|
|
1871
1887
|
"references": "primitive.motion.easing.decelerate",
|
|
1872
1888
|
"value": "cubic-bezier(0, 0, 0.2, 1)",
|
|
1873
|
-
"description": "Elements appearing: disclosures opening, a toast arriving."
|
|
1889
|
+
"description": "Elements appearing: disclosures opening, a toast arriving (toast.md)."
|
|
1874
1890
|
},
|
|
1875
1891
|
{
|
|
1876
1892
|
"name": "motion.easing.exit",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
{"key": "actions", "title": "Actions"},
|
|
3
3
|
{"key": "navigation", "title": "Navigation"},
|
|
4
4
|
{"key": "content", "title": "Content"},
|
|
5
|
+
{"key": "messages", "title": "Messages"},
|
|
5
6
|
{"key": "collections", "title": "Cards and lists"},
|
|
6
7
|
{"key": "labels", "title": "Labels and status"},
|
|
7
8
|
{"key": "data", "title": "Data"},
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: alert
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
group: messages
|
|
6
|
+
tokens:
|
|
7
|
+
- border.focus.offset
|
|
8
|
+
- border.focus.width
|
|
9
|
+
- border.width.emphasis
|
|
10
|
+
- border.width.hairline
|
|
11
|
+
- color.focus.ring
|
|
12
|
+
- color.status.danger.border
|
|
13
|
+
- color.status.danger.surface
|
|
14
|
+
- color.status.danger.text
|
|
15
|
+
- color.status.info.border
|
|
16
|
+
- color.status.info.surface
|
|
17
|
+
- color.status.info.text
|
|
18
|
+
- color.status.success.border
|
|
19
|
+
- color.status.success.surface
|
|
20
|
+
- color.status.success.text
|
|
21
|
+
- color.status.warning.border
|
|
22
|
+
- color.status.warning.surface
|
|
23
|
+
- color.status.warning.text
|
|
24
|
+
- color.surface.hover
|
|
25
|
+
- color.text.primary
|
|
26
|
+
- font.line-height.ui
|
|
27
|
+
- font.weight.strong
|
|
28
|
+
- radius.control
|
|
29
|
+
- size.icon.md
|
|
30
|
+
- size.measure.prose
|
|
31
|
+
- size.target.min
|
|
32
|
+
- space.inline.md
|
|
33
|
+
- space.inset.md
|
|
34
|
+
- space.inset.xs
|
|
35
|
+
- space.stack.lg
|
|
36
|
+
- space.stack.xs
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Alert
|
|
40
|
+
|
|
41
|
+
A message about the page or the system, at the top of the main column: an outage, a change that affects the reader, the result of a form that failed.
|
|
42
|
+
|
|
43
|
+
## When to use
|
|
44
|
+
|
|
45
|
+
- For something the reader should know before they use the page: a deprecation, planned maintenance, an incident, readings that have stopped.
|
|
46
|
+
- For the result of an action that the reader has to do something about, such as a form that couldn't be sent. It stays until they deal with it or dismiss it.
|
|
47
|
+
- On a dashboard's overview, for each alert in its sources (`docs/layouts/dashboard.md`).
|
|
48
|
+
|
|
49
|
+
## When not to use
|
|
50
|
+
|
|
51
|
+
- For a note about the text around it; that's a callout (`callout.md`), inside the article.
|
|
52
|
+
- To confirm that something worked and needs nothing more; that's a toast (`toast.md`).
|
|
53
|
+
- For a state shown beside the thing it describes; that's a status (`status.md`).
|
|
54
|
+
|
|
55
|
+
## Markup
|
|
56
|
+
|
|
57
|
+
```html {preview=true}
|
|
58
|
+
<div class="cx-alert cx-alert--warning">
|
|
59
|
+
<svg class="cx-icon cx-alert__icon" aria-hidden="true" focusable="false"><use href="#cx-icon-warning"></use></svg>
|
|
60
|
+
<div class="cx-alert__body">
|
|
61
|
+
<p class="cx-alert__title">Planned maintenance</p>
|
|
62
|
+
<p>Readings pause on Saturday 12 December from 02:00 to 03:00 NZDT. <a class="cx-link" href="/guide/">What stays available</a></p>
|
|
63
|
+
</div>
|
|
64
|
+
<button class="cx-alert__dismiss" type="button" data-alert-dismiss aria-label="Dismiss" hidden><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
65
|
+
</div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<!-- caption: Alert kinds -->
|
|
69
|
+
| Kind | Class | Icon | For |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Info | `cx-alert` | `note` | Something the reader should know, with nothing wrong |
|
|
72
|
+
| Success | `cx-alert--success` | `check` | A result that stays on the page, such as an import that finished with a report to read |
|
|
73
|
+
| Warning | `cx-alert--warning` | `warning` | Something that will affect the reader soon, or works only in part |
|
|
74
|
+
| Danger | `cx-alert--danger` | `danger` | Something has failed or stopped, and the reader may need to act |
|
|
75
|
+
|
|
76
|
+
In Hugo, `motifspec/alert.html` writes one (`docs/hugo.md`): `dict "kind" "warning" "title" "Planned maintenance" "text" "…" "dismiss" "maintenance-1212"`.
|
|
77
|
+
|
|
78
|
+
## Do
|
|
79
|
+
|
|
80
|
+
- Put it at the top of the main column, under the page head, so it's read before the content it affects.
|
|
81
|
+
- Say what happened and what the reader can do, in one or two sentences. A title helps when there are two.
|
|
82
|
+
- Link to more, or to the next step, with a text link (`button-and-link.md`).
|
|
83
|
+
- Let the reader dismiss an alert that's for information. Give the dismiss button a key when the alert shows on every page, so it stays dismissed.
|
|
84
|
+
- Take it away when the cause has gone: the incident is over, the form has been sent.
|
|
85
|
+
|
|
86
|
+
## Don't
|
|
87
|
+
|
|
88
|
+
- Don't show more than one or two on a page. If there are more, the page has a bigger problem than the alerts can describe.
|
|
89
|
+
- Don't let a danger alert about something unresolved be dismissed.
|
|
90
|
+
- Don't use one for marketing or announcements; that isn't a message about the page.
|
|
91
|
+
- Don't pick a kind for its colour. Pick it by what the reader should do.
|
|
92
|
+
|
|
93
|
+
## Accessibility
|
|
94
|
+
|
|
95
|
+
- An alert in the page when it loads is read in order, with the page; it has no live role, so it isn't announced over the page's title.
|
|
96
|
+
- An alert added after the page has loaded is announced once: give it `role="status"`, or `role="alert"` for a danger alert the reader must act on now.
|
|
97
|
+
- The kind is in the words (the title or the first sentence) as well as the icon and colour. The icon is hidden from assistive technology.
|
|
98
|
+
- The dismiss button is named "Dismiss" and is at least `size.target.min`. Dismissing moves focus to the main column, so it isn't lost.
|
|
99
|
+
- Pairs: `color.text.primary` on each `color.status.*.surface`; the icon is that kind's `color.status.*.text`, the rule its `color.status.*.border`.
|
|
100
|
+
|
|
101
|
+
## Behaviour
|
|
102
|
+
|
|
103
|
+
`dist/codex.js` does this; an app that renders alerts itself does the same.
|
|
104
|
+
|
|
105
|
+
- **Showing the button:** each `[data-alert-dismiss]` in an alert is `hidden` until the script shows it, so there's no button that does nothing without script.
|
|
106
|
+
- **Dismissing:** the button hides its alert and moves focus to `#main`. With a key, `data-alert-dismiss="maintenance-1212"`, it stores `cx-alert:maintenance-1212` in `localStorage`, and the alert is hidden on later pages until the key changes. Storage that's blocked is ignored.
|
|
107
|
+
- **Added later:** the script listens on the document, so an alert added after the page loads dismisses the same way.
|
|
108
|
+
|
|
109
|
+
## Specimens
|
|
110
|
+
|
|
111
|
+
```html {specimen="Info, dismissible" wide=true}
|
|
112
|
+
<div class="cx-alert">
|
|
113
|
+
<svg class="cx-icon cx-alert__icon" aria-hidden="true" focusable="false"><use href="#cx-icon-note"></use></svg>
|
|
114
|
+
<div class="cx-alert__body">
|
|
115
|
+
<p>Version 2.0.0 removes the deprecated tokens. <a class="cx-link" href="/reference/changelog/">See what changes</a></p>
|
|
116
|
+
</div>
|
|
117
|
+
<button class="cx-alert__dismiss" type="button" aria-label="Dismiss"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
118
|
+
</div>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```html {specimen="Success, warning, danger" wide=true}
|
|
122
|
+
<div class="cx-alert cx-alert--success">
|
|
123
|
+
<svg class="cx-icon cx-alert__icon" aria-hidden="true" focusable="false"><use href="#cx-icon-check"></use></svg>
|
|
124
|
+
<div class="cx-alert__body"><p>Imported 214 readings. 3 were skipped.</p></div>
|
|
125
|
+
</div>
|
|
126
|
+
<div class="cx-alert cx-alert--warning">
|
|
127
|
+
<svg class="cx-icon cx-alert__icon" aria-hidden="true" focusable="false"><use href="#cx-icon-warning"></use></svg>
|
|
128
|
+
<div class="cx-alert__body"><p>No readings from the rain gauge since 13:58.</p></div>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="cx-alert cx-alert--danger">
|
|
131
|
+
<svg class="cx-icon cx-alert__icon" aria-hidden="true" focusable="false"><use href="#cx-icon-danger"></use></svg>
|
|
132
|
+
<div class="cx-alert__body"><p class="cx-alert__title">Storage is down</p><p>New readings are queued and will be saved when it's back.</p></div>
|
|
133
|
+
</div>
|
|
134
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: breadcrumb
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [documentation]
|
|
5
|
+
group: navigation
|
|
6
|
+
tokens:
|
|
7
|
+
- border.width.hairline
|
|
8
|
+
- color.text.muted
|
|
9
|
+
- color.text.primary
|
|
10
|
+
- color.text.secondary
|
|
11
|
+
- font.family.mono
|
|
12
|
+
- font.line-height.ui
|
|
13
|
+
- font.size.label
|
|
14
|
+
- font.tracking.label
|
|
15
|
+
- font.weight.ui
|
|
16
|
+
- size.target.min
|
|
17
|
+
- space.inline.sm
|
|
18
|
+
- space.inline.xs
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Breadcrumb
|
|
22
|
+
|
|
23
|
+
The trail from the home page to the page's section, above its title, so a reader who arrived from search sees where the page sits.
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
- On every page in the docs shell below a section: a guide page, a component, a reference page.
|
|
28
|
+
|
|
29
|
+
## When not to use
|
|
30
|
+
|
|
31
|
+
- On a section's own page, or a page at the top level; the trail would only be the home page, and the header's wordmark already goes there. `motifspec/breadcrumb.html` writes nothing for these.
|
|
32
|
+
- On the landing page.
|
|
33
|
+
- In a portfolio, whose pages are one level deep; a case study or post has the back link to its list instead (`button-and-link.md`).
|
|
34
|
+
|
|
35
|
+
## Markup
|
|
36
|
+
|
|
37
|
+
```html {preview=true}
|
|
38
|
+
<nav class="cx-breadcrumb" aria-label="Breadcrumb" data-pagefind-ignore>
|
|
39
|
+
<ol class="cx-breadcrumb__list">
|
|
40
|
+
<li><a href="/">MotifSpec</a></li>
|
|
41
|
+
<li><a href="/components/">Components</a></li>
|
|
42
|
+
</ol>
|
|
43
|
+
</nav>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
It goes first in the page head, before the h1 (`docs-shell.md`). In Hugo, `partial "motifspec/breadcrumb.html" .` writes it from the page's ancestors: the home page as `site.Title`, then each section by its link title (`docs/hugo.md`).
|
|
47
|
+
|
|
48
|
+
## Do
|
|
49
|
+
|
|
50
|
+
- End the trail at the page's parent. The h1 straight after it names the page.
|
|
51
|
+
- Use the names the navigation uses, so the trail and the open group in the navigation agree.
|
|
52
|
+
- Keep it to one line on a phone; with sections one or two words long, it is.
|
|
53
|
+
|
|
54
|
+
## Don't
|
|
55
|
+
|
|
56
|
+
- Don't add the current page as a last item; it would repeat the h1.
|
|
57
|
+
- Don't use it for steps in a process; that's steps (`steps.md`).
|
|
58
|
+
- Don't put it in the header or above the docs shell. It belongs to the page, so it's in the main column, marked `data-pagefind-ignore` so search (`search.md`) doesn't index the trail as the page's text.
|
|
59
|
+
|
|
60
|
+
## Accessibility
|
|
61
|
+
|
|
62
|
+
- It's a `nav` named "Breadcrumb", so it's a landmark a screen reader can list, and the trail is an ordered list, so its length is announced.
|
|
63
|
+
- The slashes are drawn by CSS with empty alternative text, so they aren't read out between the links.
|
|
64
|
+
- Each link is at least `size.target.min` tall.
|
|
65
|
+
- Pairs: `color.text.secondary` for the links and `color.text.muted` for the slashes, on `color.surface.base`; `color.text.primary` on hover.
|
|
66
|
+
|
|
67
|
+
## Specimens
|
|
68
|
+
|
|
69
|
+
```html {specimen="To the section"}
|
|
70
|
+
<nav class="cx-breadcrumb" aria-label="Breadcrumb">
|
|
71
|
+
<ol class="cx-breadcrumb__list">
|
|
72
|
+
<li><a href="/">MotifSpec</a></li>
|
|
73
|
+
<li><a href="/components/">Components</a></li>
|
|
74
|
+
</ol>
|
|
75
|
+
</nav>
|
|
76
|
+
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: callout
|
|
3
3
|
status: stable
|
|
4
4
|
layouts: [shared]
|
|
5
|
-
group:
|
|
5
|
+
group: messages
|
|
6
6
|
tokens:
|
|
7
7
|
- border.width.emphasis
|
|
8
8
|
- border.width.hairline
|
|
@@ -45,6 +45,7 @@ A tinted note set apart from running text, in four kinds: note, tip, warning and
|
|
|
45
45
|
- More than twice per article. Callouts lose force when repeated.
|
|
46
46
|
- For quotations; use `<blockquote>`.
|
|
47
47
|
- For decoration or to make a paragraph "pop".
|
|
48
|
+
- For a message about the page or the system rather than the text around it; use an alert (`alert.md`) at the top of the main column.
|
|
48
49
|
|
|
49
50
|
## Markup
|
|
50
51
|
|
|
@@ -50,7 +50,7 @@ The frame of a documentation page: grouped page navigation on the left, the page
|
|
|
50
50
|
|
|
51
51
|
## Markup
|
|
52
52
|
|
|
53
|
-
The site header (`site-header.md`) and footer (`site-footer.md`) go around it as on any page. The main column holds the page head and a `cx-article`, whose table of contents (`table-of-contents.md`) is "On this page".
|
|
53
|
+
The site header (`site-header.md`) and footer (`site-footer.md`) go around it as on any page. The main column holds the page head, which starts with the breadcrumb (`breadcrumb.md`), and a `cx-article`, whose table of contents (`table-of-contents.md`) is "On this page".
|
|
54
54
|
|
|
55
55
|
```html {preview=true}
|
|
56
56
|
<div class="cx-container cx-docs">
|
|
@@ -77,6 +77,12 @@ The site header (`site-header.md`) and footer (`site-footer.md`) go around it as
|
|
|
77
77
|
</nav>
|
|
78
78
|
<main id="main" class="cx-docs__main" tabindex="-1" data-pagefind-body>
|
|
79
79
|
<div class="cx-page-head">
|
|
80
|
+
<nav class="cx-breadcrumb" aria-label="Breadcrumb" data-pagefind-ignore>
|
|
81
|
+
<ol class="cx-breadcrumb__list">
|
|
82
|
+
<li><a href="/">MotifSpec</a></li>
|
|
83
|
+
<li><a href="/guide/">Guide</a></li>
|
|
84
|
+
</ol>
|
|
85
|
+
</nav>
|
|
80
86
|
<h1>Getting started</h1>
|
|
81
87
|
<p class="cx-lede">Install the module, import it, and check your site.</p>
|
|
82
88
|
</div>
|
|
@@ -33,7 +33,7 @@ A short mono label with a dot that names a state: online, degraded, down, live,
|
|
|
33
33
|
|
|
34
34
|
- For a topic or technology; that is a tag (`tag.md`).
|
|
35
35
|
- For a message the reader must read in full; that is a callout (`callout.md`).
|
|
36
|
-
- As the only sign of a problem on a page. A problem that needs action also gets
|
|
36
|
+
- As the only sign of a problem on a page. A problem that needs action also gets an alert (`alert.md`).
|
|
37
37
|
|
|
38
38
|
## Markup
|
|
39
39
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: toast
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
group: messages
|
|
6
|
+
tokens:
|
|
7
|
+
- border.focus.width
|
|
8
|
+
- color.surface.inverse
|
|
9
|
+
- color.text.inverse
|
|
10
|
+
- font.line-height.ui
|
|
11
|
+
- font.size.small
|
|
12
|
+
- motion.distance.nudge
|
|
13
|
+
- motion.duration.base
|
|
14
|
+
- motion.easing.enter
|
|
15
|
+
- motion.easing.exit
|
|
16
|
+
- radius.control
|
|
17
|
+
- size.column.card
|
|
18
|
+
- size.target.min
|
|
19
|
+
- space.gutter.page
|
|
20
|
+
- space.inline.sm
|
|
21
|
+
- space.inset.md
|
|
22
|
+
- space.inset.sm
|
|
23
|
+
- space.inset.xs
|
|
24
|
+
- space.stack.sm
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Toast
|
|
28
|
+
|
|
29
|
+
A short confirmation that something the reader just did has worked, shown at the bottom of the screen for a few seconds.
|
|
30
|
+
|
|
31
|
+
## When to use
|
|
32
|
+
|
|
33
|
+
- After an action whose result isn't otherwise visible where the reader is: settings saved, a link copied, an item moved to another list.
|
|
34
|
+
- When the message needs nothing from the reader, and missing it costs nothing.
|
|
35
|
+
|
|
36
|
+
## When not to use
|
|
37
|
+
|
|
38
|
+
- For an error, or anything the reader has to act on; that's an alert (`alert.md`), which stays until it's dealt with.
|
|
39
|
+
- When the control can say it itself, as a copy button does by changing to "Copied" (`code-block.md`, `page-actions.md`).
|
|
40
|
+
- For a message the reader didn't cause, such as a new reading arriving; show it where it happened.
|
|
41
|
+
|
|
42
|
+
## Markup
|
|
43
|
+
|
|
44
|
+
`dist/codex.js` makes the toasts. A page sends one with an event:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
document.dispatchEvent(new CustomEvent('cx-toast', { detail: { text: 'Settings saved', kind: 'success' } }));
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`text` is required, and is set as text, not HTML. `kind: 'success'` adds the check icon; leave it out for a plain message. The script keeps one region per page for them, `<div class="cx-toasts" role="status">` at the end of `<body>`, and makes it if the page has none. Each toast it adds:
|
|
51
|
+
|
|
52
|
+
```html {preview=true}
|
|
53
|
+
<div class="cx-toast">
|
|
54
|
+
<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-check"></use></svg>
|
|
55
|
+
<p class="cx-toast__text">Settings saved</p>
|
|
56
|
+
<button class="cx-toast__dismiss" type="button" aria-label="Dismiss"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Do
|
|
61
|
+
|
|
62
|
+
- Say what happened in a few words, in the past tense: "Settings saved", "Link copied".
|
|
63
|
+
- Send it as soon as the action has worked, not before.
|
|
64
|
+
- Keep one toast to one result. Three or more at once means the page should say it some other way.
|
|
65
|
+
|
|
66
|
+
## Don't
|
|
67
|
+
|
|
68
|
+
- Don't put a link or another control in it; the reader may not reach it before it goes. Anything they might need afterwards goes on the page.
|
|
69
|
+
- Don't send one when the page loads; nothing has happened yet.
|
|
70
|
+
- Don't make it the only record of something the reader needs to see again.
|
|
71
|
+
|
|
72
|
+
## Accessibility
|
|
73
|
+
|
|
74
|
+
- The region is a polite live region (`role="status"`), so a toast is read once, after what the screen reader is saying, and focus stays where it is.
|
|
75
|
+
- It stays for `motion.duration.toast`, and the time starts again while the pointer or focus is on it, so it can be read at any pace. Escape, inside it, or its button closes it.
|
|
76
|
+
- The dismiss button is named "Dismiss" and is at least `size.target.min`; its focus ring is `color.text.inverse`, which shows on the toast.
|
|
77
|
+
- It appears with a short fade and rise; under `prefers-reduced-motion` it appears at once.
|
|
78
|
+
- Pairs: `color.text.inverse` on `color.surface.inverse` (7:1).
|
|
79
|
+
|
|
80
|
+
## Behaviour
|
|
81
|
+
|
|
82
|
+
`dist/codex.js` does this; an app that renders toasts itself does the same.
|
|
83
|
+
|
|
84
|
+
- **Adding:** a `cx-toast` event on the document adds a `cx-toast` to the region, at the bottom of the stack, and shows it with `is-shown`.
|
|
85
|
+
- **Limit:** three at a time. A fourth closes the oldest.
|
|
86
|
+
- **Going:** each closes after `motion.duration.toast`, read from the token. The time stops while the pointer is over it or focus is in it, and starts again in full when both have left. Its button, or Escape with focus in it, closes it at once. If focus was in it, focus moves to `#main`.
|
|
87
|
+
- **Without script:** there are no toasts, so nothing a reader needs can depend on one.
|
|
88
|
+
|
|
89
|
+
## Specimens
|
|
90
|
+
|
|
91
|
+
```html {specimen="Plain, success"}
|
|
92
|
+
<div class="cx-toast">
|
|
93
|
+
<p class="cx-toast__text">Moved to Archived</p>
|
|
94
|
+
<button class="cx-toast__dismiss" type="button" aria-label="Dismiss"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="cx-toast">
|
|
97
|
+
<svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-check"></use></svg>
|
|
98
|
+
<p class="cx-toast__text">Settings saved</p>
|
|
99
|
+
<button class="cx-toast__dismiss" type="button" aria-label="Dismiss"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
100
|
+
</div>
|
|
101
|
+
```
|
package/docs/hugo.md
CHANGED
|
@@ -72,7 +72,7 @@ A site using the documentation layout (`docs/layouts/documentation.md`) puts the
|
|
|
72
72
|
|
|
73
73
|
With `params.motifspec.layout = "documentation"`, `body-start.html` writes the side of the backdrop on every page but the home page, and `cx-backdrop-page--side` puts it down the left edge; below `size.breakpoint.lg` the foot shows instead (`backdrop.md`). The home page is the landing page: full width, outside the docs shell, with `<body class="cx-backdrop-page">` and the head of the backdrop, as in the page shell above.
|
|
74
74
|
|
|
75
|
-
An article page's `main` block, in order: the page head with `page-actions.html` after the lede
|
|
75
|
+
An article page's `main` block, in order: the page head, with `breadcrumb.html` before the h1 and `page-actions.html` after the lede; any alerts (`alert.html`); `article.html`, `page-footer.html`, then `pagination-docs.html`.
|
|
76
76
|
|
|
77
77
|
### A Markdown copy of each page
|
|
78
78
|
|
|
@@ -142,6 +142,8 @@ Every partial below is called as `partial "motifspec/<name>.html" <context>`.
|
|
|
142
142
|
| `search.html` | `search.md` | A page. The search trigger and dialog; `site-header.html` calls it when `params.motifspec.search` is true. |
|
|
143
143
|
| `theme-toggle.html` | `site-header.md` | A page. The theme toggle; `site-header.html` writes it in the bar and, on a documentation site, in the menu. |
|
|
144
144
|
| `back-link.html` | `button-and-link.md` | `dict "href" "…" "label" "All work"`. |
|
|
145
|
+
| `alert.html` | `alert.md` | `dict "kind" "warning" "title" "…" "text" "…"`: kind `info` (the default), `success`, `warning` or `danger`; text in Markdown; optional `"dismiss" true`, or a key to keep it dismissed on later pages. |
|
|
146
|
+
| `breadcrumb.html` | `breadcrumb.md` | A page. The trail from the home page to its parent, in a documentation site's page head; nothing when its parent is the home page. |
|
|
145
147
|
| `section-heading.html` | `heading-anchor.md` | `dict "id" "work" "title" "Selected work"`, inside a `<section id="work" aria-labelledby="work-title">`. |
|
|
146
148
|
| `tokens.html` | | Call with `partialCached "motifspec/tokens.html" "tokens"`. A map from token name to its entry in `dist/tokens.json`, for templates that need a token's value at build time. |
|
|
147
149
|
| `h2s.html` | | A page. Its h2 headings with their h3 children; used by the article and the TOC. |
|
|
@@ -20,7 +20,7 @@ Planned: a side navigation column (wordmark, grouped links, the theme toggle and
|
|
|
20
20
|
<!-- caption: Page templates -->
|
|
21
21
|
| Template | Order | Dominant | Secondary |
|
|
22
22
|
|---|---|---|---|
|
|
23
|
-
| **Overview** | Page head (title, when the readings were last updated, page-wide controls) → alerts
|
|
23
|
+
| **Overview** | Page head (title, when the readings were last updated, page-wide controls) → alerts (`alert.md`) → headline figures → the main column and a side column of sections | Alerts and headline figures | Detail sections |
|
|
24
24
|
| **List** | Page head → filters → a data table with row actions → pagination | The table | Filters |
|
|
25
25
|
| **Detail** | Page head with the item's status → its facts → its readings → related lists | Status and readings | Related lists |
|
|
26
26
|
| **Form** | Page head → grouped fields → actions at the end of the form | The fields | Help text |
|
|
@@ -44,7 +44,7 @@ Every shared component, plus the components whose doc lists `dashboard` under `l
|
|
|
44
44
|
|
|
45
45
|
MotifSpec doesn't fetch data; where an app gets its readings is the project's decision. How readings appear:
|
|
46
46
|
|
|
47
|
-
- 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
|
+
- 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; an alert added after the page loads has it (`alert.md`).
|
|
48
48
|
- 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.
|
|
49
49
|
- Values change in place, with no counting animation and nothing flashing.
|
|
50
50
|
- A section whose source fails says so and when it last worked; the rest of the page keeps working.
|
|
@@ -18,7 +18,7 @@ The site header and footer, and between them, on every page but the landing page
|
|
|
18
18
|
| Template | Order | Dominant | Secondary |
|
|
19
19
|
|---|---|---|---|
|
|
20
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 |
|
|
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 |
|
|
21
|
+
| **Article** | Header → breadcrumb, title and lede → any alerts about the page, such as a deprecation (`alert.md`) → TOC + prose with figures, code blocks, callouts and tables → edit link and last updated → previous and next → footer | The prose column | TOC, page actions |
|
|
22
22
|
| **Reference table** | Header → title and one-line intro → the table (tokens, icons, rules) → footer | The table | Intro |
|
|
23
23
|
| **Changelog** | Header → title → releases, newest first, each with its version, date and changes → footer | The releases | Dates |
|
|
24
24
|
| **404** | Header → h1 "Page not found" → links to the docs home and search → footer | Heading and the routes out | |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{- /* alert.md. Context: dict "kind" ("info", the default, "success", "warning" or "danger") "title" "…" "text" "…"
|
|
2
|
+
(Markdown, one or two sentences), plus "dismiss" true for a dismiss button, or a key ("maintenance-0412") to
|
|
3
|
+
keep it dismissed on later pages. */ -}}
|
|
4
|
+
{{- $icons := dict "info" "note" "success" "check" "warning" "warning" "danger" "danger" }}
|
|
5
|
+
{{- $kind := .kind | default "info" }}
|
|
6
|
+
{{- $icon := index $icons $kind }}
|
|
7
|
+
{{- if not $icon }}{{ errorf "motifspec/alert.html: kind %q isn't an alert. Use info, success, warning or danger." $kind }}{{ end }}
|
|
8
|
+
{{- if not .text }}{{ errorf "motifspec/alert.html: an alert needs \"text\"." }}{{ end }}
|
|
9
|
+
<div class="cx-alert{{ if ne $kind "info" }} cx-alert--{{ $kind }}{{ end }}">
|
|
10
|
+
<svg class="cx-icon cx-alert__icon" aria-hidden="true" focusable="false"><use href="#cx-icon-{{ $icon }}"></use></svg>
|
|
11
|
+
<div class="cx-alert__body">
|
|
12
|
+
{{- with .title }}
|
|
13
|
+
<p class="cx-alert__title">{{ . }}</p>
|
|
14
|
+
{{- end }}
|
|
15
|
+
{{- $text := .text | markdownify | strings.TrimSpace | safeHTML }}
|
|
16
|
+
{{ if strings.HasPrefix $text "<p>" }}{{ $text }}{{ else }}<p>{{ $text }}</p>{{ end }}
|
|
17
|
+
</div>
|
|
18
|
+
{{- with .dismiss }}
|
|
19
|
+
<button class="cx-alert__dismiss" type="button" data-alert-dismiss{{ if not (eq . true) }}="{{ . }}"{{ end }} aria-label="Dismiss" hidden><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-close"></use></svg></button>
|
|
20
|
+
{{- end }}
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{{- /* breadcrumb.md (documentation layout). Context: a page. The trail from the home page to the page's parent; nothing
|
|
2
|
+
when the parent is the home page, since the header's wordmark already goes there. */ -}}
|
|
3
|
+
{{- $trail := .Ancestors.Reverse }}
|
|
4
|
+
{{- if gt (len $trail) 1 }}
|
|
5
|
+
<nav class="cx-breadcrumb" aria-label="Breadcrumb" data-pagefind-ignore>
|
|
6
|
+
<ol class="cx-breadcrumb__list">
|
|
7
|
+
{{- range $trail }}
|
|
8
|
+
<li><a href="{{ .RelPermalink }}">{{ if .IsHome }}{{ site.Title }}{{ else }}{{ .LinkTitle }}{{ end }}</a></li>
|
|
9
|
+
{{- end }}
|
|
10
|
+
</ol>
|
|
11
|
+
</nav>
|
|
12
|
+
{{- end }}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aitrien/motifspec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Liam Marshall's design system: DTCG tokens and layered component rules that AI assistants read a layer at a time, with generated CSS, Hugo templates and a rule checker.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
package/scripts/lib.mjs
CHANGED
|
@@ -283,4 +283,7 @@ export const DOC_SELECTORS = {
|
|
|
283
283
|
'tabs': ['.cx-tabs'],
|
|
284
284
|
'token-table': ['.cx-token-table', '.cx-swatch', '.cx-palette', '.cx-token-sample', '.cx-token-bar', '.cx-pair-sample'],
|
|
285
285
|
'catalogue-grid': ['.cx-catalogue'],
|
|
286
|
+
'alert': ['.cx-alert'],
|
|
287
|
+
'toast': ['.cx-toasts', '.cx-toast'],
|
|
288
|
+
'breadcrumb': ['.cx-breadcrumb'],
|
|
286
289
|
};
|
package/tokens/color.json
CHANGED
|
@@ -922,7 +922,7 @@
|
|
|
922
922
|
},
|
|
923
923
|
"inverse": {
|
|
924
924
|
"$value": "{primitive.color.ash.900}",
|
|
925
|
-
"$description": "Background of tooltips and other small transient labels that must stand out from every surface. Never for panels or cards.",
|
|
925
|
+
"$description": "Background of tooltips, toasts and other small transient labels that must stand out from every surface. Never for panels or cards.",
|
|
926
926
|
"$extensions": {
|
|
927
927
|
"codex.modes": {
|
|
928
928
|
"dark": "{primitive.color.ash.100}"
|
|
@@ -1062,7 +1062,7 @@
|
|
|
1062
1062
|
},
|
|
1063
1063
|
"inverse": {
|
|
1064
1064
|
"$value": "{primitive.color.ash.50}",
|
|
1065
|
-
"$description": "Text on color.surface.inverse (tooltips). Only there.",
|
|
1065
|
+
"$description": "Text on color.surface.inverse (tooltips and toasts), and the focus ring inside a toast. Only there.",
|
|
1066
1066
|
"$extensions": {
|
|
1067
1067
|
"codex.modes": {
|
|
1068
1068
|
"dark": "{primitive.color.ash.900}"
|
package/tokens/motion.json
CHANGED
|
@@ -58,6 +58,15 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"6": {
|
|
61
|
+
"$value": {
|
|
62
|
+
"value": 6000,
|
|
63
|
+
"unit": "ms"
|
|
64
|
+
},
|
|
65
|
+
"$extensions": {
|
|
66
|
+
"codex.tier": "primitive"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"7": {
|
|
61
70
|
"$value": {
|
|
62
71
|
"value": 60000,
|
|
63
72
|
"unit": "ms"
|
|
@@ -163,13 +172,17 @@
|
|
|
163
172
|
"$description": "The specimen plate's single draw-in on load. Decoration only; never for content."
|
|
164
173
|
},
|
|
165
174
|
"drift": {
|
|
166
|
-
"$value": "{primitive.motion.duration.
|
|
175
|
+
"$value": "{primitive.motion.duration.7}",
|
|
167
176
|
"$description": "Time the specimen plate's terrain takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one plate per page, with a visible pause control, stopped under prefers-reduced-motion. The backdrop doesn't drift."
|
|
168
177
|
},
|
|
169
178
|
"settle": {
|
|
170
179
|
"$value": "{primitive.motion.duration.5}",
|
|
171
180
|
"$description": "The backdrop's response time. The home page's contours settle into place over it on arrival and then stay still, and a hill the pointer warms takes about two-thirds of it to rise and twice it to flatten. Under five seconds, so nothing runs long enough to need a pause control; none of it happens under prefers-reduced-motion."
|
|
172
181
|
},
|
|
182
|
+
"toast": {
|
|
183
|
+
"$value": "{primitive.motion.duration.6}",
|
|
184
|
+
"$description": "How long a toast (toast.md) stays before it goes on its own. The time starts again while the pointer or focus is on it, and isn't shortened under prefers-reduced-motion: it is time to read, not motion."
|
|
185
|
+
},
|
|
173
186
|
"pulse": {
|
|
174
187
|
"$value": "{primitive.motion.duration.5}",
|
|
175
188
|
"$description": "One full cycle of the specimen plate's outward pulse. The only looping motion in the system; it must have a visible pause control and stop under prefers-reduced-motion.",
|
|
@@ -184,7 +197,7 @@
|
|
|
184
197
|
},
|
|
185
198
|
"enter": {
|
|
186
199
|
"$value": "{primitive.motion.easing.decelerate}",
|
|
187
|
-
"$description": "Elements appearing: disclosures opening, a toast arriving."
|
|
200
|
+
"$description": "Elements appearing: disclosures opening, a toast arriving (toast.md)."
|
|
188
201
|
},
|
|
189
202
|
"exit": {
|
|
190
203
|
"$value": "{primitive.motion.easing.accelerate}",
|