@aitrien/motifspec 1.25.1 → 1.27.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.
@@ -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 | |
@@ -9,11 +9,11 @@
9
9
  "icons": {
10
10
  "arrow-forward": {
11
11
  "symbol": "arrow_forward",
12
- "use": "Forward journeys: primary and secondary buttons, standalone links, Next in pagination."
12
+ "use": "Forward journeys: primary and secondary buttons, standalone links, Next in pagination and in a calendar."
13
13
  },
14
14
  "arrow-back": {
15
15
  "symbol": "arrow_back",
16
- "use": "Back links at the top of posts and case studies; Previous in pagination."
16
+ "use": "Back links at the top of posts and case studies; Previous in pagination and in a calendar."
17
17
  },
18
18
  "arrow-upward": {
19
19
  "symbol": "arrow_upward",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "danger": {
55
55
  "symbol": "report",
56
- "use": "Title of a danger callout."
56
+ "use": "Title of a danger callout or alert, and a field’s error message."
57
57
  },
58
58
  "rss": {
59
59
  "symbol": "rss_feed",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "expand": {
63
63
  "symbol": "keyboard_arrow_down",
64
- "use": "Disclosure indicator on <summary>; rotates when open."
64
+ "use": "Disclosure indicator on <summary>, rotating when open; the arrow of a select, and of a calendar’s month and year buttons."
65
65
  },
66
66
  "pause": {
67
67
  "symbol": "pause",
@@ -122,6 +122,10 @@
122
122
  "logs": {
123
123
  "symbol": "terminal",
124
124
  "use": "Logs and consoles: a link or action that opens them."
125
+ },
126
+ "calendar": {
127
+ "symbol": "calendar_today",
128
+ "use": "The button that opens a date field’s calendar, and the native date field’s picker."
125
129
  }
126
130
  }
127
131
  }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M140-100v-694.61h131.54v-70h50.38v70h317.69v-70h49.23v70H820V-100H140Zm45.39-45.39h589.22V-555H185.39v409.61Zm0-454.99h589.22v-148.85H185.39v148.85Zm0 0v-148.85 148.85Z"/></svg>
@@ -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 }}
@@ -0,0 +1,53 @@
1
+ {{- /* field.md (and date-picker.md). Context: dict "id" "…" "label" "…", plus any of:
2
+ "type" ("text" by default; "email", "number", "date"…; "select" with "options" (a slice); "textarea"; "date-picker"),
3
+ "name", "value", "placeholder" (an example, shown once the reader is in the field), "hint", "error",
4
+ "optional" true, "required" true, "disabled" true, "mono" true, "short" true, "inputmode", "autocomplete".
5
+ A date picker takes "choose" too, its button's name ("Choose a date of birth"). */ -}}
6
+ {{- if not (and .id .label) }}{{ errorf "motifspec/field.html: a field needs \"id\" and \"label\"." }}{{ end }}
7
+ {{- $type := .type | default "text" }}
8
+ {{- $describe := slice }}
9
+ {{- if .hint }}{{ $describe = $describe | append (printf "%s-hint" .id) }}{{ end }}
10
+ {{- if .error }}{{ $describe = $describe | append (printf "%s-error" .id) }}{{ end }}
11
+ {{- $class := "cx-field__control" }}
12
+ {{- if or .mono (eq $type "date-picker") }}{{ $class = printf "%s cx-field__control--mono" $class }}{{ end }}
13
+ {{- if .short }}{{ $class = printf "%s cx-field__control--short" $class }}{{ end }}
14
+ {{- $attrs := printf "class=%q id=%q" $class .id }}
15
+ {{- with .name }}{{ $attrs = printf "%s name=%q" $attrs . }}{{ end }}
16
+ {{- if .required }}{{ $attrs = printf "%s required" $attrs }}{{ end }}
17
+ {{- if .disabled }}{{ $attrs = printf "%s disabled" $attrs }}{{ end }}
18
+ {{- if .error }}{{ $attrs = printf "%s aria-invalid=\"true\"" $attrs }}{{ end }}
19
+ {{- with $describe }}{{ $attrs = printf "%s aria-describedby=%q" $attrs (delimit . " ") }}{{ end }}
20
+ {{- $box := "cx-field__box" }}
21
+ {{- if eq $type "textarea" }}{{ $box = printf "%s cx-field__box--area" $box }}{{ end }}
22
+ {{- if eq $type "date-picker" }}{{ $box = printf "%s cx-field__box--date" $box }}{{ end }}
23
+ <div class="cx-field">
24
+ <div class="{{ $box }}"{{ if eq $type "date-picker" }} data-date-picker{{ end }}>
25
+ {{- if eq $type "select" }}
26
+ <select {{ $attrs | safeHTMLAttr }}>
27
+ {{- range .options }}<option{{ if eq . $.value }} selected{{ end }}>{{ . }}</option>{{ end }}
28
+ </select>
29
+ {{- else }}
30
+ {{- $more := printf "placeholder=%q" (.placeholder | default (cond (eq $type "date-picker") "DD/MM/YYYY" " ")) }}
31
+ {{- with .inputmode }}{{ $more = printf "%s inputmode=%q" $more . }}{{ else }}{{ if eq $type "date-picker" }}{{ $more = printf "%s inputmode=\"numeric\"" $more }}{{ end }}{{ end }}
32
+ {{- with .autocomplete }}{{ $more = printf "%s autocomplete=%q" $more . }}{{ end }}
33
+ {{- if eq $type "textarea" }}
34
+ <textarea {{ $attrs | safeHTMLAttr }} {{ $more | safeHTMLAttr }}>{{ .value }}</textarea>
35
+ {{- else }}
36
+ <input {{ $attrs | safeHTMLAttr }} {{ $more | safeHTMLAttr }} type="{{ if eq $type "date-picker" }}text{{ else }}{{ $type }}{{ end }}"{{ with .value }} value="{{ . }}"{{ end }}>
37
+ {{- end }}
38
+ {{- end }}
39
+ <label class="cx-field__label" for="{{ .id }}">{{ .label }}{{ if .optional }} <span class="cx-field__optional">(optional)</span>{{ end }}</label>
40
+ {{- if eq $type "select" }}
41
+ <svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-expand"></use></svg>
42
+ {{- end }}
43
+ {{- if eq $type "date-picker" }}
44
+ <button class="cx-date__button" type="button" aria-label="{{ .choose | default "Choose a date" }}" aria-haspopup="dialog" hidden><svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-calendar"></use></svg></button>
45
+ {{- end }}
46
+ </div>
47
+ {{- with .hint }}
48
+ <p class="cx-field__hint" id="{{ $.id }}-hint">{{ . }}</p>
49
+ {{- end }}
50
+ {{- with .error }}
51
+ <p class="cx-field__error" id="{{ $.id }}-error"><svg class="cx-icon cx-icon--sm" aria-hidden="true" focusable="false"><use href="#cx-icon-danger"></use></svg>{{ . }}</p>
52
+ {{- end }}
53
+ </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitrien/motifspec",
3
- "version": "1.25.1",
3
+ "version": "1.27.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,11 @@ 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'],
289
+ 'field': ['.cx-field', '.cx-fieldset'],
290
+ 'choice': ['.cx-choice', '.cx-choices'],
291
+ 'date-picker': ['.cx-date__button', '.cx-calendar'],
292
+ 'dialog': ['.cx-dialog'],
286
293
  };
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}"
@@ -937,6 +937,15 @@
937
937
  "dark": "{primitive.color.sap.800}"
938
938
  }
939
939
  }
940
+ },
941
+ "selected": {
942
+ "$value": "{primitive.color.sap.100}",
943
+ "$description": "The chosen item among options the reader picks from: a calendar's date, month or year (date-picker.md). With color.text.primary. Never for large areas or decoration.",
944
+ "$extensions": {
945
+ "codex.modes": {
946
+ "dark": "{primitive.color.sap.800}"
947
+ }
948
+ }
940
949
  }
941
950
  },
942
951
  "text": {
@@ -968,6 +977,10 @@
968
977
  "token": "color.surface.highlight",
969
978
  "min": 7
970
979
  },
980
+ {
981
+ "token": "color.surface.selected",
982
+ "min": 7
983
+ },
971
984
  {
972
985
  "token": "color.status.success.surface",
973
986
  "min": 7
@@ -1062,7 +1075,7 @@
1062
1075
  },
1063
1076
  "inverse": {
1064
1077
  "$value": "{primitive.color.ash.50}",
1065
- "$description": "Text on color.surface.inverse (tooltips). Only there.",
1078
+ "$description": "Text on color.surface.inverse (tooltips and toasts), and the focus ring inside a toast. Only there.",
1066
1079
  "$extensions": {
1067
1080
  "codex.modes": {
1068
1081
  "dark": "{primitive.color.ash.900}"
@@ -1093,6 +1106,25 @@
1093
1106
  }
1094
1107
  ]
1095
1108
  }
1109
+ },
1110
+ "on-danger": {
1111
+ "$value": "{primitive.color.ash.0}",
1112
+ "$description": "Text and icons on color.status.danger.fill and its hover, such as a danger button’s label. Only there.",
1113
+ "$extensions": {
1114
+ "codex.modes": {
1115
+ "dark": "{primitive.color.ash.1000}"
1116
+ },
1117
+ "codex.pairsWith": [
1118
+ {
1119
+ "token": "color.status.danger.fill",
1120
+ "min": 4.5
1121
+ },
1122
+ {
1123
+ "token": "color.status.danger.fill-hover",
1124
+ "min": 4.5
1125
+ }
1126
+ ]
1127
+ }
1096
1128
  }
1097
1129
  },
1098
1130
  "link": {
@@ -1457,6 +1489,48 @@
1457
1489
  }
1458
1490
  ]
1459
1491
  }
1492
+ },
1493
+ "fill": {
1494
+ "$value": "{primitive.color.madder.700}",
1495
+ "$description": "Fill of a button that deletes or stops something, in a dialog asking to confirm it (cx-button--danger, button-and-link.md). Its label says what it does; never the only sign.",
1496
+ "$extensions": {
1497
+ "codex.modes": {
1498
+ "dark": "{primitive.color.madder.300}"
1499
+ },
1500
+ "codex.pairsWith": [
1501
+ {
1502
+ "token": "color.surface.base",
1503
+ "min": 3
1504
+ },
1505
+ {
1506
+ "token": "color.surface.raised",
1507
+ "min": 3
1508
+ },
1509
+ {
1510
+ "token": "color.surface.sunken",
1511
+ "min": 3
1512
+ }
1513
+ ]
1514
+ }
1515
+ },
1516
+ "fill-hover": {
1517
+ "$value": "{primitive.color.madder.800}",
1518
+ "$description": "Fill of a danger button while hovered or pressed.",
1519
+ "$extensions": {
1520
+ "codex.modes": {
1521
+ "dark": "{primitive.color.madder.200}"
1522
+ },
1523
+ "codex.pairsWith": [
1524
+ {
1525
+ "token": "color.surface.raised",
1526
+ "min": 3
1527
+ },
1528
+ {
1529
+ "token": "color.surface.sunken",
1530
+ "min": 3
1531
+ }
1532
+ ]
1533
+ }
1460
1534
  }
1461
1535
  },
1462
1536
  "info": {
@@ -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.6}",
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}",