@alis-build/design-system 0.19.0 → 0.21.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/README.md CHANGED
@@ -47,9 +47,11 @@ node_modules/@alis-build/design-system/rules/README.md and follow its "Where to
47
47
  start". The rules there are the version this app has installed.
48
48
  ```
49
49
 
50
- Never copy the rules into your repo: a copy stops moving with the version.
50
+ Write the path from where that file sits: if your `package.json` is in a
51
+ subfolder, the rules are under that folder's `node_modules`. Never copy the
52
+ rules into your repo: a copy stops moving with the version.
51
53
 
52
- **2. Check your styles.** Add `stylelint` (16 or later) as a dev dependency,
54
+ **2. Check your styles.** Add `stylelint` (16.11 or later) as a dev dependency,
53
55
  with `postcss-html` if you have `<style>` blocks in Svelte or Vue files and
54
56
  `postcss-scss` if any of them is `lang="scss"` (without it those blocks are
55
57
  skipped, silently). Then in `stylelint.config.js`:
@@ -63,7 +65,7 @@ export default {
63
65
 
64
66
  - **A rule you set under the same name replaces the system's**: stylelint never
65
67
  merges two lists. To add to one, carry the system's part along. The config
66
- exports its parts (`refusedValues`, `allowedValues`, `refusedProperties`,
68
+ exports its lists (`refusedValues`, `allowedValues`, `refusedProperties`,
67
69
  `refusedSelectors`) and two builders:
68
70
 
69
71
  ```js
@@ -79,15 +81,31 @@ export default {
79
81
  }
80
82
  ```
81
83
 
84
+ - **A file that keeps one part of a rule picks that part by name**:
85
+ `refused.literalColour`, `refused.blend`, `refused.spacing`, `allowed.radius`,
86
+ `allowed.shadow`. Never by its message or its place in a list. A name a
87
+ release changes then stops the check instead of thinning the rule.
88
+
89
+ ```js
90
+ import { refuse, refused } from '@alis-build/design-system/stylelint'
91
+ // in overrides: the one file where a client's theme meets the system
92
+ { files: ['**/theme-bridge.css'], rules: {
93
+ 'declaration-property-value-disallowed-list': refuse([refused.literalColour]),
94
+ } }
95
+ ```
96
+
82
97
  - **When nothing in `rules/styling.md` fits, the system has a gap.** Say so on
83
- the line above, and name it when you hand the work back. A disable with no
84
- reason is itself reported.
98
+ the line above, by rule and with a reason, and name it when you hand the work
99
+ back.
85
100
 
86
101
  ```css
87
102
  /* stylelint-disable-next-line declaration-no-important -- GAP: a hidden element stays hidden */
88
103
  [hidden] { display: none !important; }
89
104
  ```
90
105
 
106
+ A disable is itself reported when it names no rule (it would silence every
107
+ rule on that line), gives no reason, or silences nothing.
108
+
91
109
  - It reads what is written in CSS. A value held in a Sass variable or a mixin,
92
110
  or a literal behind a custom property of your own (`--pad: 13px`), is not seen.
93
111
 
@@ -103,8 +121,14 @@ export default {
103
121
 
104
122
  - `alisx-check names` fails on a system class (`app-*`, `text-*`) or a custom
105
123
  property this version doesn't have: a misspelling, or a name a release
106
- removed. Pass `--prefix app-` if your app has `text-*` utilities of its own,
107
- and `--allow '--brand-*'` for a property that arrives from outside your source.
124
+ removed. Pass `--prefix app-` if your app has `text-*` utilities of its own.
125
+ For a property that arrives from outside your source, name the file that
126
+ declares it: `--declared e2e/fixtures/theme.json` reads any text file or
127
+ folder (a stylesheet inside JSON, server code) and counts its names as known
128
+ by their exact spelling. The path must exist wherever the build runs: an
129
+ image build may copy only the app. Where no file declares it (a library sets
130
+ it from script), pass `--allow` with the exact name; a pattern such as
131
+ `--allow '--brand-*'` lets a misspelling by.
108
132
  - `alisx-check styles` is a gate: any violation fails. An app with a backlog
109
133
  records it once (`lint:styles:record`) and commits
110
134
  `alisx-style-baseline.json`; from then on it is a ratchet, failing only when a
package/alisx.css CHANGED
@@ -1068,6 +1068,75 @@ a.app-token,button.app-token{border:0;font:inherit;font-weight:600;cursor:pointe
1068
1068
  .app-shortcuts__note[hidden]{display:none}
1069
1069
  /* The foot stays in view while the groups scroll under it */
1070
1070
  .app-shortcuts__foot{position:sticky;bottom:0;margin-top:auto;padding-top:var(--space-16);border-top:1px solid var(--outline-variant);background:var(--background)}
1071
+ /* ── Avatar · someone or something with a name: a person is round, a thing is a square tile ── */
1072
+ .app-avatar{display:inline-flex;align-items:center;justify-content:center;flex:none;vertical-align:middle;width:36px;height:36px;border-radius:var(--radius-pill);background:var(--surface-container-highest);color:var(--on-surface);font-family:var(--font-sans);font-size:14px;line-height:20px;font-weight:600;letter-spacing:0;overflow:hidden;object-fit:cover;user-select:none}
1073
+ .app-avatar--small{width:24px;height:24px;font-size:12px;line-height:16px}
1074
+ .app-avatar--large{width:80px;height:80px;font-size:28px;line-height:36px}
1075
+ .app-avatar--thing{border-radius:var(--radius-sm)}
1076
+ .app-avatar--thing.app-avatar--small{border-radius:var(--radius-xs)}
1077
+ .app-avatar--thing.app-avatar--large{border-radius:var(--radius-lg)}
1078
+ .app-avatar--large>.app-icon{font-size:40px}
1079
+ /* A logo and the Alis mark arrive with their own ground (rules/chips-alerts.md) */
1080
+ .app-avatar--logo,.app-avatar--alis{background:transparent}
1081
+ .app-avatar--logo{object-fit:contain}
1082
+ .app-avatar--cat1{background:var(--cat1-container);color:var(--on-cat1-container)}.app-avatar--cat2{background:var(--cat2-container);color:var(--on-cat2-container)}.app-avatar--cat3{background:var(--cat3-container);color:var(--on-cat3-container)}.app-avatar--cat4{background:var(--cat4-container);color:var(--on-cat4-container)}.app-avatar--cat5{background:var(--cat5-container);color:var(--on-cat5-container)}.app-avatar--cat6{background:var(--cat6-container);color:var(--on-cat6-container)}
1083
+ /* Several people: side by side, never overlapped, so no ring has to guess the ground under it */
1084
+ .app-avatar-group{display:inline-flex;align-items:center;gap:var(--space-4)}
1085
+ .app-avatar-group__more{font-variant-numeric:tabular-nums}
1086
+
1087
+ /* ── Checkbox and radio · native inputs; the row is the target ── */
1088
+ .app-check-group{display:flex;flex-direction:column}
1089
+ .app-check-row{position:relative;display:flex;align-items:flex-start;gap:var(--space-12);min-height:var(--control-height);padding:6px 0;color:var(--on-surface);cursor:pointer}
1090
+ @media (pointer:coarse){.app-check-row{min-height:var(--touch-target-coarse);padding:var(--space-12) 0}}
1091
+ .app-check-row__text{display:flex;flex-direction:column;flex:1;min-width:0}
1092
+ .app-check-row__text .text-supporting{color:var(--on-surface-variant)}
1093
+ .app-checkbox,.app-radio{position:relative;flex:none;width:18px;height:18px;margin:3px;border:2px solid var(--on-surface-variant);background:transparent;appearance:none;-webkit-appearance:none;cursor:pointer;transition:background-color var(--dur-effects) var(--motion-effects),border-color var(--dur-effects) var(--motion-effects),box-shadow var(--dur-effects) var(--motion-effects)}
1094
+ .app-checkbox{border-radius:var(--radius-xs)}
1095
+ .app-radio{width:20px;height:20px;margin:2px;border-radius:var(--radius-pill)}
1096
+ .app-checkbox:checked,.app-checkbox:indeterminate,.app-checkbox.is-checked{border-color:var(--primary);background:var(--primary)}
1097
+ .app-checkbox:checked::before,.app-checkbox.is-checked::before{content:"";position:absolute;left:3px;top:-1px;width:5px;height:10px;border:solid var(--on-primary);border-width:0 2px 2px 0;transform:rotate(45deg)}
1098
+ .app-checkbox:indeterminate::before{content:"";position:absolute;left:2px;right:2px;top:6px;height:2px;background:var(--on-primary)}
1099
+ .app-radio:checked{border-color:var(--primary)}
1100
+ .app-radio:checked::before{content:"";position:absolute;inset:3px;border-radius:inherit;background:var(--primary)}
1101
+ .app-checkbox:focus-visible,.app-radio:focus-visible{outline:2px solid var(--primary);outline-offset:1px}
1102
+ .app-check-row:hover :is(.app-checkbox,.app-radio):not(:disabled),:is(.app-checkbox,.app-radio):hover:not(:disabled){box-shadow:0 0 0 8px color-mix(in srgb,var(--on-surface) calc(var(--state-hover) * 100%),transparent)}
1103
+ .app-check-row:active :is(.app-checkbox,.app-radio):not(:disabled){box-shadow:0 0 0 8px color-mix(in srgb,var(--on-surface) calc(var(--state-pressed) * 100%),transparent)}
1104
+ .app-field.is-error :is(.app-checkbox,.app-radio):not(:checked),.app-fieldset.is-error :is(.app-checkbox,.app-radio):not(:checked){border-color:var(--error)}
1105
+ .app-fieldset.is-error .app-fieldset__support{color:var(--error)}
1106
+ :is(.app-checkbox,.app-radio):disabled{cursor:default}
1107
+ .app-check-row.is-disabled{opacity:.38;cursor:default}
1108
+
1109
+ /* ── Combobox · the select's box opens a menu with a search at its head ── */
1110
+ .app-combo{position:relative}
1111
+ .app-combo__trigger{width:100%;font-family:var(--font-sans);font-size:16px;line-height:24px;text-align:left;cursor:pointer;outline:none}
1112
+ .app-combo__trigger:focus-visible,.app-combo__trigger[aria-expanded="true"]{border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary)}
1113
+ .app-combo__trigger>.app-icon{flex:none;transition:transform var(--dur-effects) var(--motion-effects)}
1114
+ .app-combo__trigger[aria-expanded="true"]>.app-icon{transform:rotate(180deg)}
1115
+ .app-combo__value{display:flex;align-items:center;gap:var(--space-8);flex:1;min-width:0;color:var(--on-surface)}
1116
+ .app-combo__value.is-placeholder{color:var(--on-surface-variant)}
1117
+ .app-combo__text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1118
+ .app-combo__panel{position:absolute;top:calc(100% + var(--space-4));left:0;right:0;z-index:2;min-width:240px;max-width:none;max-height:none;padding:0;overflow:visible}
1119
+ /* The search is the menu's first line: no box of its own, its glyph on the rows' leading edge */
1120
+ .app-combo__search{display:flex;align-items:center;gap:var(--space-12);flex:none;min-height:48px;padding:0 var(--space-16) 0 calc(var(--space-8) + var(--space-12));border-bottom:1px solid var(--outline-variant);color:var(--on-surface-variant)}
1121
+ .app-combo__input{flex:1;min-width:0;padding:0;border:0;background:transparent;color:var(--on-surface);font-family:var(--font-sans);font-size:14px;line-height:20px;outline:none}
1122
+ .app-combo__input::placeholder{color:var(--on-surface-variant);opacity:1}
1123
+ @media (pointer:coarse){.app-combo__input{font-size:16px;line-height:24px}}
1124
+ .app-combo__list{display:flex;flex-direction:column;max-height:min(280px,40vh);overflow-y:auto;overscroll-behavior:contain;margin:0;padding:var(--space-8);list-style:none}
1125
+ /* Several: each option leads with a drawn checkbox, and the box alone says it is chosen */
1126
+ .app-menu__item>.app-checkbox{margin:1px;cursor:inherit}
1127
+
1128
+ /* ── Disclosure · detail most people don't need, folded under its title ── */
1129
+ .app-disclosure{min-width:0;color:var(--on-surface)}
1130
+ .app-disclosure__summary{display:flex;align-items:center;gap:var(--space-12);min-height:max(48px,var(--touch-target));margin:0 calc(var(--space-8) * -1);padding:var(--space-4) var(--space-8);border-radius:var(--radius-sm);list-style:none}
1131
+ .app-disclosure__summary::-webkit-details-marker{display:none}
1132
+ .app-disclosure__text{display:flex;flex-direction:column;flex:1;min-width:0}
1133
+ .app-disclosure__text .text-supporting{color:var(--on-surface-variant)}
1134
+ .app-disclosure__summary>.app-icon:last-child{flex:none;color:var(--on-surface-variant);transition:transform var(--dur-effects) var(--motion-effects)}
1135
+ .app-disclosure[open]>.app-disclosure__summary>.app-icon:last-child{transform:rotate(180deg)}
1136
+ .app-disclosure__body{padding:var(--space-4) 0 var(--space-16)}
1137
+ .app-disclosure-group{display:flex;flex-direction:column}
1138
+ .app-disclosure-group>.app-disclosure+.app-disclosure{border-top:1px solid var(--outline-variant)}
1139
+
1071
1140
  /* ── Drop target, while something is dragged over it ── */
1072
1141
  .drop-target{outline:2px dashed var(--primary);outline-offset:-2px;background-color:color-mix(in srgb,var(--primary) calc(var(--state-dragged) * 100%),transparent)}
1073
1142
 
package/check.mjs CHANGED
@@ -2,13 +2,18 @@
2
2
  // alisx-check: the two checks an app built on @alis-build/design-system runs in
3
3
  // its build. Neither needs a framework; both read your source as text.
4
4
  //
5
- // alisx-check names <path…> [--prefix app-] [--allow '--brand-*']
5
+ // alisx-check names <path…> [--prefix app-] [--declared <path>] [--allow '--brand-*']
6
6
  // Fails on a system class or a custom property this version of the package
7
7
  // doesn't have: a misspelling, or a name a release removed. Without it a
8
8
  // wrong name renders unstyled and nothing says so.
9
- // --prefix the class prefixes that belong to the system (default: app-
10
- // and text-; an app with its own text-* utilities passes app-)
11
- // --allow a custom property that arrives from outside your source
9
+ // --prefix the class prefixes that belong to the system (default: app-
10
+ // and text-; an app with its own text-* utilities passes app-)
11
+ // --declared a file or folder outside your source that declares custom
12
+ // properties: a theme a server sends, a test fixture, server
13
+ // code. Any text file, JSON included. Its names count as
14
+ // known by their exact spelling; nothing in it is checked.
15
+ // --allow a custom property no file declares (a library sets it from
16
+ // script). Prefer --declared: a pattern lets a misspelling by.
12
17
  // It reads a class where one is written (a selector, a class attribute, a
13
18
  // class directive, classList), not a name held in a script string.
14
19
  //
@@ -27,15 +32,15 @@ import { fileURLToPath } from 'node:url'
27
32
 
28
33
  const here = dirname(fileURLToPath(import.meta.url))
29
34
  const { version } = JSON.parse(readFileSync(join(here, 'package.json'), 'utf8'))
30
- const usage = 'usage: alisx-check names <path…> [--prefix app-] [--allow <property>]\n alisx-check styles <glob…> [--baseline <file>] [--update]'
35
+ const usage = 'usage: alisx-check names <path…> [--prefix app-] [--declared <path>] [--allow <property>]\n alisx-check styles <glob…> [--baseline <file>] [--update]'
31
36
  const [command, ...argv] = process.argv.slice(2)
32
37
 
33
38
  const paths = []
34
- const options = { prefix: [], allow: [], baseline: 'alisx-style-baseline.json', update: false }
39
+ const options = { prefix: [], allow: [], declared: [], baseline: 'alisx-style-baseline.json', update: false }
35
40
  for (let i = 0; i < argv.length; i++) {
36
41
  const arg = argv[i]
37
42
  if (arg === '--update') options.update = true
38
- else if (arg === '--baseline' || arg === '--prefix' || arg === '--allow') {
43
+ else if (arg === '--baseline' || arg === '--prefix' || arg === '--allow' || arg === '--declared') {
39
44
  const value = argv[++i]
40
45
  // --allow takes a property, which itself starts with two dashes.
41
46
  if (!value || (arg !== '--allow' && value.startsWith('--'))) stop(`${arg} needs a value.\n${usage}`)
@@ -57,16 +62,28 @@ function names() {
57
62
  const allowed = options.allow.map((glob) => new RegExp(`^${glob.split('*').map(escape).join('.*')}$`))
58
63
 
59
64
  const sources = ['.svelte', '.vue', '.html', '.jsx', '.tsx', '.js', '.ts', '.mjs', '.css', '.scss', '.less']
60
- const missing = paths.filter((path) => !existsSync(path))
65
+ const missing = [...paths, ...options.declared].filter((path) => !existsSync(path))
61
66
  if (missing.length) stop(`alisx-check names: no such path: ${missing.join(', ')}`)
62
67
  const files = paths.flatMap((path) => walk(resolve(path))).filter((file) => sources.includes(extname(file)))
63
68
  if (!files.length) stop(`alisx-check names: no source files under ${paths.join(', ')}.`)
64
69
  const texts = new Map(files.map((file) => [file, readFileSync(file, 'utf8')]))
65
70
 
66
- // A property your own source declares is yours, wherever it is used.
67
- // Declared: `--x: …` in a rule or an object, style:--x on an element,
68
- // setProperty('--x', …) in script.
71
+ // A property your own source declares is yours, wherever it is used, and so
72
+ // is one a --declared file declares. Declared: `--x: …` in a rule or an
73
+ // object, style:--x on an element, setProperty('--x', …) in script.
69
74
  const declared = [/(?:^|[\s{;"'`])(--[\w-]+)["'`]?\s*:/g, /\bstyle:(--[\w-]+)/g, /setProperty\(\s*["'`](--[\w-]+)/g]
75
+ for (const path of options.declared) {
76
+ let found = 0
77
+ for (const text of walk(resolve(path)).map(readDeclared))
78
+ for (const pattern of declared)
79
+ for (const [, name] of text.matchAll(pattern)) {
80
+ properties.add(name)
81
+ found++
82
+ }
83
+ // A path that declares nothing is a wrong path or a changed format, and the
84
+ // names it used to cover would fail below with no hint why.
85
+ if (!found) stop(`alisx-check names: no custom property is declared in ${path}.`)
86
+ }
70
87
  for (const text of texts.values())
71
88
  for (const pattern of declared) for (const [, name] of text.matchAll(pattern)) properties.add(name)
72
89
 
@@ -108,7 +125,12 @@ function names() {
108
125
 
109
126
  function styles() {
110
127
  const bin = findUp(join('node_modules', '.bin', 'stylelint'))
111
- if (!bin) stop('alisx-check styles: stylelint is not installed in this app. Add stylelint 16 or later as a dev dependency.')
128
+ if (!bin) stop('alisx-check styles: stylelint is not installed in this app. Add stylelint 16.11 or later as a dev dependency.')
129
+ // The config asks for reports stylelint gained in 16.11. An older one skips
130
+ // them and says nothing, which would read as a clean result.
131
+ const installed = (spawnSync(bin, ['--version'], { encoding: 'utf8' }).stdout ?? '').trim()
132
+ const [major, minor] = installed.split('.').map(Number)
133
+ if (!(major > 16 || (major === 16 && minor >= 11))) stop(`alisx-check styles: stylelint ${installed || 'of an unknown version'} is installed, and the check needs 16.11 or later.`)
112
134
 
113
135
  // The report goes to a file: stylelint's own stream for it changed between
114
136
  // versions, and it also echoes the report, so the pipe must not cap it.
@@ -203,6 +225,20 @@ function styles() {
203
225
  process.exit(1)
204
226
  }
205
227
 
228
+ // A --declared file, as text. In JSON a stylesheet is a string with its line
229
+ // breaks escaped, so its strings are read as they would arrive too.
230
+ function readDeclared(file) {
231
+ const text = readFileSync(file, 'utf8')
232
+ if (extname(file) !== '.json') return text
233
+ const strings = [text]
234
+ try {
235
+ JSON.parse(text, (key, value) => (typeof value === 'string' && strings.push(value), value))
236
+ } catch {
237
+ // Not JSON after all: the text as written is all there is.
238
+ }
239
+ return strings.join('\n')
240
+ }
241
+
206
242
  function walk(path) {
207
243
  if (!statSync(path).isDirectory()) return [path]
208
244
  return readdirSync(path, { withFileTypes: true })
package/classes.json CHANGED
@@ -33,6 +33,20 @@
33
33
  "app-attachment__external",
34
34
  "app-attachment__glyph",
35
35
  "app-attachment__text",
36
+ "app-avatar",
37
+ "app-avatar--alis",
38
+ "app-avatar--cat1",
39
+ "app-avatar--cat2",
40
+ "app-avatar--cat3",
41
+ "app-avatar--cat4",
42
+ "app-avatar--cat5",
43
+ "app-avatar--cat6",
44
+ "app-avatar--large",
45
+ "app-avatar--logo",
46
+ "app-avatar--small",
47
+ "app-avatar--thing",
48
+ "app-avatar-group",
49
+ "app-avatar-group__more",
36
50
  "app-brand",
37
51
  "app-brand__wordmark",
38
52
  "app-btn",
@@ -49,6 +63,10 @@
49
63
  "app-card--statement",
50
64
  "app-card__inset",
51
65
  "app-card__title",
66
+ "app-check-group",
67
+ "app-check-row",
68
+ "app-check-row__text",
69
+ "app-checkbox",
52
70
  "app-chip",
53
71
  "app-chip--cat1",
54
72
  "app-chip--cat2",
@@ -66,6 +84,14 @@
66
84
  "app-chip--warning",
67
85
  "app-chip-group",
68
86
  "app-chip__close",
87
+ "app-combo",
88
+ "app-combo__input",
89
+ "app-combo__list",
90
+ "app-combo__panel",
91
+ "app-combo__search",
92
+ "app-combo__text",
93
+ "app-combo__trigger",
94
+ "app-combo__value",
69
95
  "app-compact-only",
70
96
  "app-composer",
71
97
  "app-composer__box",
@@ -89,6 +115,11 @@
89
115
  "app-dialog",
90
116
  "app-dialog__body",
91
117
  "app-dialog__title",
118
+ "app-disclosure",
119
+ "app-disclosure-group",
120
+ "app-disclosure__body",
121
+ "app-disclosure__summary",
122
+ "app-disclosure__text",
92
123
  "app-empty",
93
124
  "app-empty-field",
94
125
  "app-empty-line",
@@ -165,6 +196,7 @@
165
196
  "app-qa__a",
166
197
  "app-qa__pair",
167
198
  "app-qa__q",
199
+ "app-radio",
168
200
  "app-row",
169
201
  "app-row--agent-chat",
170
202
  "app-row--divided",
@@ -294,6 +326,7 @@
294
326
  "drop-target",
295
327
  "is-active",
296
328
  "is-alis",
329
+ "is-checked",
297
330
  "is-current",
298
331
  "is-disabled",
299
332
  "is-done",
@@ -308,6 +341,7 @@
308
341
  "is-muted",
309
342
  "is-numeric",
310
343
  "is-open",
344
+ "is-placeholder",
311
345
  "is-played",
312
346
  "is-selected",
313
347
  "mono",
@@ -0,0 +1,70 @@
1
+ # AppAvatar
2
+
3
+ Someone or something with a name, drawn small: a person is round, a thing is a square tile.
4
+
5
+ ## Use / don't use
6
+
7
+ See [chips-alerts.md](../rules/chips-alerts.md) § Avatars.
8
+
9
+ - **A person is round**: their photo, else their initials. **A thing is a square tile** (`app-avatar--thing`): an organisation by its logo or initials, anything else by its icon. The shape says which before the words do, so never a round organisation or a square person.
10
+ - **Alis is the mark**, with no ground (`app-avatar--alis`, [AlisMark](AlisMark.md)).
11
+ - **Three sizes, nothing between.** 24 (`app-avatar--small`) in a line of text: a who-line, a menu row, a table cell. 36 (the default, `control-height`) leading a row or a card with two lines. 80 (`app-avatar--large`) once, on the page that is about them. An icon tile is 36 or 80; at 24 the icon stands alone.
12
+ - **Initials are two letters**, the first of the first and last names ("Thandi Mokoena" is TM); one when there is one name. An organisation takes the first letters of its first two words. Uppercase is typed in the data, never transformed.
13
+ - **Neutral**: `surface-container-highest` behind `on-surface` ink. People are never coloured by their name. A category colour (`app-avatar--cat1` to `--cat6`) is for a thing whose category the screen already colours, and matches it. Never `primary`, never a status role: a state is a chip beside the name.
14
+ - **A logo takes no ground** (`app-avatar--logo`): it arrives with its own, so no tile and no white plate behind it.
15
+ - **Several people** sit side by side at 24 in an `.app-avatar-group`: three at most, then a count ("+4"). Never overlapped.
16
+ - **Not a control.** The row, the name or a button is what you press; an avatar inside it adds no target. No presence dot and no badge on it.
17
+ - **An icon tile leads a row or a card whose subject has no picture of its own**: an action to take ("Invite your team"), a kind of thing (a guide, a flow). Inside a control (a button, a chip, a menu row, the rail) an icon is never tiled, and a file is an [AppAttachment](AppAttachment.md).
18
+
19
+ ## Markup
20
+
21
+ ```html
22
+ <!-- A person: a photo, else initials. Beside their name it is decoration -->
23
+ <img class="app-avatar" src="…" alt="">
24
+ <span class="app-avatar" aria-hidden="true">TM</span>
25
+
26
+ <!-- Leading a row -->
27
+ <div class="app-row app-state app-row--divided" role="listitem">
28
+ <span class="app-avatar" aria-hidden="true">TM</span>
29
+ <span class="app-row__text">
30
+ <a class="app-row__hit text-object-title" href="/people/thandi">Thandi Mokoena</a>
31
+ <span class="text-supporting">Build specialist</span>
32
+ </span>
33
+ </div>
34
+
35
+ <!-- Small, in a line; large, on their own page -->
36
+ <span class="app-avatar app-avatar--small" aria-hidden="true">TM</span>
37
+ <span class="app-avatar app-avatar--large" aria-hidden="true">TM</span>
38
+
39
+ <!-- Alone, with no name beside it: it carries the name -->
40
+ <span class="app-avatar app-avatar--small" role="img" aria-label="Thandi Mokoena">TM</span>
41
+
42
+ <!-- A thing: an organisation's initials, its logo, or an icon -->
43
+ <span class="app-avatar app-avatar--thing" aria-hidden="true">AE</span>
44
+ <img class="app-avatar app-avatar--thing app-avatar--logo" src="…" alt="">
45
+ <span class="app-avatar app-avatar--thing" aria-hidden="true"><span class="app-icon" aria-hidden="true">menu_book</span></span>
46
+
47
+ <!-- A thing in its category's colour -->
48
+ <span class="app-avatar app-avatar--thing app-avatar--cat2" aria-hidden="true"><span class="app-icon" aria-hidden="true">forum</span></span>
49
+
50
+ <!-- Alis -->
51
+ <span class="app-avatar app-avatar--small app-avatar--alis" aria-hidden="true"><svg …></svg></span>
52
+
53
+ <!-- Several people, then a count -->
54
+ <span class="app-avatar-group" role="group" aria-label="Thandi Mokoena, Jan Krynauw, Priya Naidoo and 4 more">
55
+ <span class="app-avatar app-avatar--small" aria-hidden="true">TM</span>
56
+ <span class="app-avatar app-avatar--small" aria-hidden="true">JK</span>
57
+ <span class="app-avatar app-avatar--small" aria-hidden="true">PN</span>
58
+ <span class="app-avatar app-avatar--small app-avatar-group__more" aria-hidden="true">+4</span>
59
+ </span>
60
+ ```
61
+
62
+ ## Behaviour you must supply
63
+
64
+ - **A photo that fails to load** becomes the initials: swap the `<img>` for the `<span>` on `error`. With no name either, a person is the `person` icon and an organisation the `domain` icon.
65
+ - **The name**: beside its name an avatar is hidden from assistive technology (`aria-hidden`, or `alt=""`). Alone, it carries the name (`role="img"` and `aria-label`, or `alt`); a group carries everyone's on the group.
66
+ - **The count** is the number left out, never the total.
67
+
68
+ ## Classes
69
+
70
+ `.app-avatar`, `.app-avatar--small`, `.app-avatar--large`, `.app-avatar--thing`, `.app-avatar--logo`, `.app-avatar--alis`, `.app-avatar--cat1` to `.app-avatar--cat6`; `.app-avatar-group`, `.app-avatar-group__more`.
@@ -0,0 +1,88 @@
1
+ # AppCheckbox
2
+
3
+ A checkbox for several of a list, or one thing you agree to; a radio for one of a few short options. Native inputs, and the whole row is the target.
4
+
5
+ ## Use / don't use
6
+
7
+ See [page.md](../rules/page.md) § Which control.
8
+
9
+ - **A checkbox** is for choosing several from a list (the materials to include, the rows of a table), and for one statement you confirm before you send ("I've reviewed the interview screens."). It waits for Save or Send.
10
+ - **A setting that is on or off is an [AppSwitch](AppSwitch.md)**, never a checkbox: a switch says it applies.
11
+ - **A radio** is for one of 2 to 5 options that a few words each can name, all visible ("Only the people I add", "Anyone with the link"). Options that need a sentence each are [AppSelectTile](AppSelectTile.md)s; 2 to 5 that change the content in place are an [AppSegmented](AppSegmented.md); 6 or more are an [AppSelect](AppSelect.md).
12
+ - **The box**: 18px with a 2px `on-surface-variant` edge and `radius-xs`; a radio is a 20px ring. On, it takes `primary`, with the check or the dot in it, because it is a control you press ([colour.md](../rules/colour.md)). Hovering the row shows the state layer as a halo round the box.
13
+ - **The label** is body text and says the thing itself, as a statement: "Include participant names", never "Enable …" or a question. One supporting line at most. Options are never pre-ticked to nudge a choice.
14
+ - **A set is labelled once**, by a field set's legend in label type ([AppTextField](AppTextField.md)); rows stack with no gap in an `.app-check-group`, the most likely first. A radio set always has one option chosen.
15
+ - **In a table or a dense list** the bare box leads the row and takes an `aria-label` naming the row; the header's box selects all and is mixed when only some are chosen. The row's selection is the fill plus the checked box ([selection.md](../rules/selection.md)).
16
+
17
+ ## Markup
18
+
19
+ ```html
20
+ <!-- One checkbox: a statement you confirm -->
21
+ <label for="c-rev" class="app-check-row">
22
+ <input id="c-rev" type="checkbox" class="app-checkbox">
23
+ <span class="app-check-row__text"><span class="text-body">I've reviewed the interview screens.</span></span>
24
+ </label>
25
+
26
+ <!-- Several of a list, labelled once -->
27
+ <fieldset class="app-fieldset">
28
+ <legend class="app-fieldset__legend text-label">Include in the report</legend>
29
+ <div class="app-check-group">
30
+ <label for="c-1" class="app-check-row">
31
+ <input id="c-1" type="checkbox" class="app-checkbox" checked>
32
+ <span class="app-check-row__text"><span class="text-body">Participant names</span></span>
33
+ </label>
34
+ <label for="c-2" class="app-check-row">
35
+ <input id="c-2" type="checkbox" class="app-checkbox" aria-describedby="c-2-s">
36
+ <span class="app-check-row__text">
37
+ <span class="text-body">Recordings</span>
38
+ <span id="c-2-s" class="text-supporting">Anyone who can open the report can play them.</span>
39
+ </span>
40
+ </label>
41
+ </div>
42
+ </fieldset>
43
+
44
+ <!-- One of a few: radios share a name -->
45
+ <fieldset class="app-fieldset">
46
+ <legend class="app-fieldset__legend text-label">Who can take part</legend>
47
+ <div class="app-check-group">
48
+ <label for="r-1" class="app-check-row">
49
+ <input id="r-1" type="radio" name="access" class="app-radio" checked>
50
+ <span class="app-check-row__text"><span class="text-body">Only the people I add</span></span>
51
+ </label>
52
+ <label for="r-2" class="app-check-row">
53
+ <input id="r-2" type="radio" name="access" class="app-radio">
54
+ <span class="app-check-row__text"><span class="text-body">Anyone with the link, once they sign in</span></span>
55
+ </label>
56
+ </div>
57
+ </fieldset>
58
+
59
+ <!-- Error: is-error on the field set, the support line says what to do -->
60
+ <fieldset class="app-fieldset is-error">
61
+ <legend class="app-fieldset__legend text-label">Before you send</legend>
62
+ <label for="c-e" class="app-check-row">
63
+ <input id="c-e" type="checkbox" class="app-checkbox" aria-invalid="true" aria-describedby="c-e-s">
64
+ <span class="app-check-row__text"><span class="text-body">I've reviewed the interview screens.</span></span>
65
+ </label>
66
+ <p id="c-e-s" class="app-fieldset__support text-supporting">Tick this to send the interview.</p>
67
+ </fieldset>
68
+
69
+ <!-- Disabled -->
70
+ <label for="c-x" class="app-check-row is-disabled">
71
+ <input id="c-x" type="checkbox" class="app-checkbox" disabled>
72
+ <span class="app-check-row__text"><span class="text-body">Recordings</span></span>
73
+ </label>
74
+
75
+ <!-- Bare, leading a table row; the header's box is mixed while some rows are chosen -->
76
+ <input type="checkbox" class="app-checkbox" aria-label="Select staging">
77
+ ```
78
+
79
+ ## Behaviour you must supply
80
+
81
+ - The native inputs toggle, group (radios by `name`) and move with the arrow keys themselves. Read them on submit.
82
+ - **Mixed**: set the header box's `indeterminate` property in script while some, not all, rows are chosen; pressing it selects all.
83
+ - **Error**: on submit, `is-error` on the field set, `aria-invalid="true"` on the input, and the support line says what to do; focus the first invalid input.
84
+ - **Disabled**: `disabled` on the input and `is-disabled` on the row.
85
+
86
+ ## Classes
87
+
88
+ `.app-check-row`, `.app-check-row__text`, `.app-check-row.is-disabled`, `.app-check-group`, `.app-checkbox`, `.app-radio`; `.app-checkbox.is-checked` for a box drawn on a menu's option ([AppCombobox](AppCombobox.md)); with `.app-fieldset`, `.app-fieldset__legend`, `.app-fieldset__support`, `.is-error`.
@@ -0,0 +1,117 @@
1
+ # AppCombobox
2
+
3
+ One choice, or several, from a list too long to scan: the select's box opens a menu with a search at its head.
4
+
5
+ ## Use / don't use
6
+
7
+ - **Use it past about ten options**, or when the list comes from a server (people, projects, countries, time zones). A list you can see whole is an [AppSelect](AppSelect.md); it needs no search ([page.md](../rules/page.md) § Search).
8
+ - **The box shows the choice, never what you are typing.** It looks like the select ([AppSelect](AppSelect.md)): label above, the field's box, the choice in ink, a trailing `expand_more` that turns while it is open. With no choice yet it names one in `on-surface-variant` ("Choose a country"). A person leads with their small [AppAvatar](AppAvatar.md).
9
+ - **Pressing it opens the menu** ([AppMenu](AppMenu.md)) under the box, at the box's width. **The search is the menu's first line**: a `search` glyph and the words you type, no box of its own, a hairline under it. The rows are the menu's: its type, its second line, its headings.
10
+ - **One choice**: the chosen row is the menu's checked row (the selection fill, a trailing `check`). Choosing closes the menu.
11
+ - **Several**: each row leads with a checkbox and takes no fill; the box alone says it is chosen. The menu stays open while you tick, and what is already chosen comes first each time it opens.
12
+ - **Several, in a form: the box only adds, and the chosen are a list under it.** The box reads what you would add ("Add owners"), in `on-surface-variant`, whatever is chosen. Each choice is a row below ([AppListRow](AppListRow.md)): a person's avatar, their name and one supporting line, and a small `close` icon button that removes that one. Owners, members and who has access are sets people manage, so every one stays in view and nothing is cut short. Never chips, never names joined in the box.
13
+ - **Only what the list holds.** Free text you add yourself (an email address, a tag) is the text field's Add action ([AppTextField](AppTextField.md)), not this.
14
+ - **In the filter row** the trigger is the button that names its choice ([page.md](../rules/page.md) § The filter row); it opens this same menu when its list is long. With several chosen it reads as a count ("4 people"); with one, its name. A filter only has to say how much it narrows.
15
+ - **Nothing found** is one line that echoes what you typed: *No country matches "atlantis"*. **Searching** a server past 300 ms is one line with the loader.
16
+
17
+ ## Markup
18
+
19
+ ```html
20
+ <!-- One choice, open -->
21
+ <div class="app-field">
22
+ <span id="cb-country-l" class="app-field__label text-label">Billing country</span>
23
+ <div class="app-combo">
24
+ <button type="button" id="cb-country" class="app-field__box app-combo__trigger" aria-haspopup="listbox" aria-expanded="true" aria-controls="cb-country-p" aria-labelledby="cb-country-l cb-country-v">
25
+ <span id="cb-country-v" class="app-combo__value"><span class="app-combo__text">South Africa</span></span>
26
+ <span class="app-icon" aria-hidden="true">expand_more</span>
27
+ </button>
28
+ <div class="app-menu app-combo__panel" id="cb-country-p">
29
+ <label class="app-combo__search">
30
+ <span class="app-icon" aria-hidden="true">search</span>
31
+ <input class="app-combo__input" role="combobox" aria-autocomplete="list" aria-expanded="true" aria-controls="cb-country-o" autocomplete="off" placeholder="Search countries" aria-label="Search countries">
32
+ </label>
33
+ <ul class="app-combo__list" id="cb-country-o" role="listbox" aria-label="Countries">
34
+ <li class="app-menu__item app-state" id="cb-country-1" role="option" aria-selected="false"><span class="app-menu__text"><span>Somalia</span></span></li>
35
+ <li class="app-menu__item app-state is-selected" id="cb-country-2" role="option" aria-selected="true"><span class="app-menu__text"><span>South Africa</span></span><span class="app-icon" aria-hidden="true">check</span></li>
36
+ <li class="app-menu__item app-state" id="cb-country-3" role="option" aria-selected="false"><span class="app-menu__text"><span>South Korea</span></span></li>
37
+ </ul>
38
+ </div>
39
+ </div>
40
+ </div>
41
+
42
+ <!-- Several, in a form: the box only adds; each choice is a row under it. The chosen come first in the menu -->
43
+ <div class="app-field">
44
+ <span id="cb-owners-l" class="app-field__label text-label">Owners</span>
45
+ <div class="app-combo">
46
+ <button type="button" id="cb-owners" class="app-field__box app-combo__trigger" aria-haspopup="listbox" aria-expanded="true" aria-controls="cb-owners-p" aria-labelledby="cb-owners-l cb-owners-v">
47
+ <span id="cb-owners-v" class="app-combo__value is-placeholder"><span class="app-combo__text">Add owners</span></span>
48
+ <span class="app-icon" aria-hidden="true">expand_more</span>
49
+ </button>
50
+ <div class="app-menu app-combo__panel" id="cb-owners-p">
51
+ <label class="app-combo__search">
52
+ <span class="app-icon" aria-hidden="true">search</span>
53
+ <input class="app-combo__input" role="combobox" aria-autocomplete="list" aria-expanded="true" aria-controls="cb-owners-o" autocomplete="off" placeholder="Search people" aria-label="Search people">
54
+ </label>
55
+ <ul class="app-combo__list" id="cb-owners-o" role="listbox" aria-label="People" aria-multiselectable="true">
56
+ <li class="app-menu__item app-state" id="cb-owners-1" role="option" aria-selected="true"><span class="app-checkbox is-checked" aria-hidden="true"></span><span class="app-avatar app-avatar--small" aria-hidden="true">TM</span><span class="app-menu__text"><span>Thandi Mokoena</span><span class="app-menu__support">thandi@example.com</span></span></li>
57
+ <li class="app-menu__item app-state" id="cb-owners-2" role="option" aria-selected="true"><span class="app-checkbox is-checked" aria-hidden="true"></span><span class="app-avatar app-avatar--small" aria-hidden="true">JK</span><span class="app-menu__text"><span>Jan Krynauw</span><span class="app-menu__support">jan@example.com</span></span></li>
58
+ <li class="app-menu__item app-state" id="cb-owners-3" role="option" aria-selected="false"><span class="app-checkbox" aria-hidden="true"></span><span class="app-avatar app-avatar--small" aria-hidden="true">PN</span><span class="app-menu__text"><span>Priya Naidoo</span><span class="app-menu__support">priya@example.com</span></span></li>
59
+ </ul>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <!-- The same field closed: the chosen, each with its own remove -->
65
+ <div class="app-field">
66
+ <span id="cb-own2-l" class="app-field__label text-label">Owners</span>
67
+ <div class="app-combo">
68
+ <button type="button" id="cb-own2" class="app-field__box app-combo__trigger" aria-haspopup="listbox" aria-expanded="false" aria-labelledby="cb-own2-l cb-own2-v">
69
+ <span id="cb-own2-v" class="app-combo__value is-placeholder"><span class="app-combo__text">Add owners</span></span>
70
+ <span class="app-icon" aria-hidden="true">expand_more</span>
71
+ </button>
72
+ </div>
73
+ <div class="app-list" role="list" aria-labelledby="cb-own2-l">
74
+ <div class="app-row app-row--divided" role="listitem">
75
+ <span class="app-avatar" aria-hidden="true">TM</span>
76
+ <span class="app-row__text"><span class="text-object-title">Thandi Mokoena</span><span class="text-supporting">thandi@example.com</span></span>
77
+ <span class="app-row__trailing"><button type="button" class="app-icon-btn app-state app-icon-btn--small" aria-label="Remove Thandi Mokoena" title="Remove"><span class="app-icon" aria-hidden="true">close</span></button></span>
78
+ </div>
79
+ <div class="app-row app-row--divided" role="listitem">
80
+ <span class="app-avatar" aria-hidden="true">JK</span>
81
+ <span class="app-row__text"><span class="text-object-title">Jan Krynauw</span><span class="text-supporting">jan@example.com</span></span>
82
+ <span class="app-row__trailing"><button type="button" class="app-icon-btn app-state app-icon-btn--small" aria-label="Remove Jan Krynauw" title="Remove"><span class="app-icon" aria-hidden="true">close</span></button></span>
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
+ <!-- Closed, with no choice yet: the box names the choice -->
88
+ <div class="app-field">
89
+ <span id="cb-tz-l" class="app-field__label text-label">Time zone</span>
90
+ <div class="app-combo">
91
+ <button type="button" id="cb-tz" class="app-field__box app-combo__trigger" aria-haspopup="listbox" aria-expanded="false" aria-labelledby="cb-tz-l cb-tz-v">
92
+ <span id="cb-tz-v" class="app-combo__value is-placeholder"><span class="app-combo__text">Choose a time zone</span></span>
93
+ <span class="app-icon" aria-hidden="true">expand_more</span>
94
+ </button>
95
+ </div>
96
+ </div>
97
+
98
+ <!-- Searching, and nothing found -->
99
+ <li class="app-menu__empty app-loader app-loader--line" role="presentation"><svg …></svg>Searching</li>
100
+ <li class="app-menu__empty" role="presentation">No country matches “atlantis”</li>
101
+ ```
102
+
103
+ `.app-combo` wraps the box and its panel, so the panel opens under the box and over the supporting line. Closed, the panel carries `hidden` and the trigger `aria-expanded="false"`. Error and disabled are the text field's: `is-error` or `is-disabled` on `.app-field`, and `disabled` on the trigger.
104
+
105
+ ## Behaviour you must supply
106
+
107
+ - **Open** on a press of the box, on Enter, Space or Down, and on a letter typed while the box has focus, which also starts the search with that letter. Focus moves to the search. **Close** on a choice (one choice), Escape, Tab or a press outside, and return focus to the box. Toggle `hidden` on the panel and `aria-expanded` on the trigger.
108
+ - **Filter as you type** a list already loaded, on what a row shows (name and second line); a server search waits for a pause in typing.
109
+ - **The active row** (`is-active`, `aria-activedescendant` on the search) shows once the keyboard is in use: the first match when you type, then wherever Down and Up take it. Enter chooses it. A menu opened with the pointer shows none.
110
+ - **Choosing**: one choice sets `aria-selected`, `is-selected` and the trailing `check` together, writes the name into the box and closes. Several toggle `aria-selected` and `is-checked` on the row's checkbox, keep the menu open and clear the search. In a form, a tick adds that row under the box and an untick removes it; the row's own remove button unticks it. Rows keep the order they were added in.
111
+ - **What the box says**: one choice, its name, or the placeholder with `is-placeholder` when there is none. Several in a form, always what you would add ("Add owners"). Several in the filter row, the count and its noun.
112
+ - **Order**: when several can be chosen, list the chosen first each time it opens, and hold the order while it is open. With one choice, scroll the chosen row into view as it opens.
113
+ - **Ignore keys while `isComposing`.** Place the panel under the box (the CSS does it), above when there isn't room below.
114
+
115
+ ## Classes
116
+
117
+ `.app-combo`, `.app-combo__trigger`, `.app-combo__value`, `.app-combo__text`, `.is-placeholder`, `.app-combo__panel`, `.app-combo__search`, `.app-combo__input`, `.app-combo__list`; `.app-checkbox.is-checked` on a row; `.app-list` and `.app-row` for what is chosen; with `.app-field` and its parts, and `.app-menu`, `.app-menu__item`, `.app-menu__text`, `.app-menu__support`, `.app-menu__empty`, `.is-active`, `.is-selected`.
@@ -0,0 +1,61 @@
1
+ # AppDisclosure
2
+
3
+ Detail most people don't need, folded under its title: press the title and it opens in place.
4
+
5
+ ## Use / don't use
6
+
7
+ - **For what a few people need some of the time**: advanced settings, a long explanation, the raw detail behind a summary. Closed by default; open only when the screen is about it.
8
+ - **Never to hide what the screen is for**: the main content, a required field, an error, or the one action that moves you forward. If most people open it, it shouldn't fold.
9
+ - **The title is a row** 48 tall with a trailing `expand_more` that turns when open. It says what is inside, in label type; when it names a thing, object-title with one supporting line. No icon button of its own: the whole row is the target.
10
+ - **No card round it.** It sits on the surface it is in; several in a row are an `.app-disclosure-group`, divided by hairlines.
11
+ - **Each opens and closes by itself.** Opening one never closes another, and nothing is nested inside another.
12
+ - **Not a view switch.** Views that replace each other are an [AppSegmented](AppSegmented.md) ([page.md](../rules/page.md) § Where things go). **Not navigation**: a destination is a row or a link.
13
+ - Alis's working steps fold the same way, drawn by [AppTurn](AppTurn.md).
14
+
15
+ ## Markup
16
+
17
+ ```html
18
+ <details class="app-disclosure">
19
+ <summary class="app-disclosure__summary app-state">
20
+ <span class="app-disclosure__text"><span class="text-label">Advanced settings</span></span>
21
+ <span class="app-icon" aria-hidden="true">expand_more</span>
22
+ </summary>
23
+ <div class="app-disclosure__body">
24
+ <p class="text-supporting">Fields, prose or a table: whatever the title promised.</p>
25
+ </div>
26
+ </details>
27
+
28
+ <!-- Several, divided; a title that names a thing takes a second line -->
29
+ <div class="app-disclosure-group">
30
+ <details class="app-disclosure" open>
31
+ <summary class="app-disclosure__summary app-state">
32
+ <span class="app-disclosure__text">
33
+ <span class="text-object-title">Cloud Run</span>
34
+ <span class="text-supporting">2 services · europe-west1</span>
35
+ </span>
36
+ <span class="app-icon" aria-hidden="true">expand_more</span>
37
+ </summary>
38
+ <div class="app-disclosure__body"><p class="text-supporting">orders-api and orders-worker, both on revision 42.</p></div>
39
+ </details>
40
+ <details class="app-disclosure">
41
+ <summary class="app-disclosure__summary app-state">
42
+ <span class="app-disclosure__text">
43
+ <span class="text-object-title">Spanner</span>
44
+ <span class="text-supporting">1 database</span>
45
+ </span>
46
+ <span class="app-icon" aria-hidden="true">expand_more</span>
47
+ </summary>
48
+ <div class="app-disclosure__body"><p class="text-supporting">orders, in europe-west1.</p></div>
49
+ </details>
50
+ </div>
51
+ ```
52
+
53
+ ## Behaviour you must supply
54
+
55
+ - None: the native `<details>` opens, closes, takes Enter and Space, and announces its state. Add `open` to start one open.
56
+ - **Remember** what a person opened for as long as they stay on the screen; a refetch never closes it.
57
+ - **A field with an error inside a closed one**: open it before focusing the field.
58
+
59
+ ## Classes
60
+
61
+ `.app-disclosure`, `.app-disclosure__summary`, `.app-disclosure__text`, `.app-disclosure__body`, `.app-disclosure-group`, with `.app-state` on the summary.
@@ -10,7 +10,7 @@ A list of acts or places that opens from a control or from what you type, and cl
10
10
  | **Suggestion menu** (`role="listbox"`) | Typing `/` or `@` in an editor | In a composer, a band on its surface above the editor (`.app-menu--suggest`), like an [AppAsk](AppAsk.md). In a document, at the caret | Stays in the editor; the active row follows the arrows |
11
11
 
12
12
  - **Not a form.** A field, a checkbox or a type-to-confirm inside a menu is an [AppDialog](AppDialog.md); the item that opens it ends in an ellipsis ("Deploy to production…").
13
- - **Not a value in a form.** That's an [AppSelect](AppSelect.md). A searchable picker is a known gap.
13
+ - **Not a value in a form.** That's an [AppSelect](AppSelect.md), or an [AppCombobox](AppCombobox.md) when the list is long: this menu, with a search as its first line.
14
14
  - **Never a submenu.** Flatten it with a heading, or open a dialog. **Never on hover**: a tooltip names a control; a menu opens when you press.
15
15
  - **Not for the verbs a person uses often.** Those stay visible as buttons; the menu holds the rest. A split action is a button and a `more_vert` whose menu holds the alternatives ([page.md](../rules/page.md)).
16
16
 
@@ -31,7 +31,7 @@ A list of acts or places that opens from a control or from what you type, and cl
31
31
 
32
32
  - **Add** (`add`, an action menu opening upward from the button) lists what you can bring in first (Upload files, Record screen, a connected source), then a divider and **Commands**, each with its /name as the hint and no second line. Pointer users find the commands; the hint teaches `/`.
33
33
  - **`/`** opens only at the very start of a message, so "and/or" and a path never trigger it. It lists only the commands, label and second line and /name, filtered on both as you type. **A command leads the message**; choosing another replaces it.
34
- - **`@`** opens at the start or after a space. **People first**, then the things the product offers in this conversation: files, ideas, skills, agents, each group under its heading. A person has their 24px avatar (a photo, else initials); a thing has its icon. In a group thread a mention notifies the person; in a one-to-one with Alis it points her at them.
34
+ - **`@`** opens at the start or after a space. **People first**, then the things the product offers in this conversation: files, ideas, skills, agents, each group under its heading. A person has their small [AppAvatar](AppAvatar.md); a thing has its icon. In a group thread a mention notifies the person; in a one-to-one with Alis it points her at them.
35
35
  - **While it's open**: the first match is active. Up and Down move, Enter or Tab chooses, Escape closes and keeps what you typed. **Enter never sends while a suggestion menu is open** ([AppComposer](AppComposer.md)).
36
36
  - **Searching** past 300 ms is one line with the loader: *Searching*. **Nothing found** is one line that echoes what you typed (*No commands match "/pricing"*, *No one or nothing called "thandi"*); a space or Escape then closes the band and your text stays text.
37
37
  - **With an ask open**, the band sits between the ask and the editor, closest to the caret; the ask stays where it is.
@@ -8,6 +8,7 @@ See [selection.md](../rules/selection.md).
8
8
 
9
9
  - One pill track filled `surface-container-low`, with no border so it never reads as an outlined button, `control-height` tall with 4px of padding, so it lines up with the buttons and fields beside it. The selected segment is a white pill with an `outline-variant` edge, in `on-surface` at weight 700; the rest transparent in `on-surface-variant` at 500. No dividers ([selection.md](../rules/selection.md)).
10
10
  - A filter that narrows one list belongs in the filter row as one of these ([page.md](../rules/page.md)); a route is a tab in [AppTitleBar](AppTitleBar.md), not a segment.
11
+ - **Views that switch in place inside a pane, a section or a dialog are one of these**, at the head of what they switch (Preview and Code in [AppFilePane](AppFilePane.md)). The underlined tab belongs to the title bar's routes and appears nowhere else.
11
12
  - If the options don't fit (a narrow pane, long labels, a phone), use an [AppSelect](AppSelect.md) with an `aria-label` instead; a segmented control never hides options.
12
13
 
13
14
  ## Markup
@@ -5,10 +5,10 @@ One choice from a list you can name in advance: a native select in the text fiel
5
5
  ## Use / don't use
6
6
 
7
7
  - Everything about it is [AppTextField](AppTextField.md)'s: label above, a `control-height` box at `radius-lg`, one supporting or error line. A chevron (`expand_more`) at the trailing edge says it opens. The list itself is the platform's own, so it is accessible and right on every device.
8
- - Use it for 6 or more options, or when space is short. 2 to 5 options that change the content in place are an [AppSegmented](AppSegmented.md); choices that need a sentence each are [AppSelectTile](AppSelectTile.md)s.
8
+ - Use it for 6 or more options, or when space is short. 2 to 5 options that change the content in place are an [AppSegmented](AppSegmented.md); 2 to 5 short options in a form are radios ([AppCheckbox](AppCheckbox.md)); choices that need a sentence each are [AppSelectTile](AppSelectTile.md)s.
9
9
  - A placeholder names the choice when there is no default ("Choose a branch"); prefer a sensible default.
10
10
  - Without a visible label (a select in the filter row, left of the main control), give the select an `aria-label`.
11
- - A searchable or multi-value picker (a combobox) is not in the set yet.
11
+ - Past about ten options, or to choose several, use an [AppCombobox](AppCombobox.md).
12
12
 
13
13
  ## Markup
14
14
 
@@ -9,7 +9,7 @@ See [selection.md](../rules/selection.md).
9
9
  - Unselected it is the statement surface, and the check holds its place unseen; selected it takes `secondary-container`, the filled check and weight 700, at the same size so nothing moves. Padded like a card (24, 28 from 600px).
10
10
  - One of a set is a radio, so the group is a radiogroup; when several may be chosen each is a checkbox. Label the set with a field set ([AppTextField](AppTextField.md)).
11
11
  - Never a tint, a ring or a border swap.
12
- - Check the shape first: 2 to 5 options that re-parameterise content in place are an [AppSegmented](AppSegmented.md); a data-driven set is filter [AppChip](AppChip.md)s; a list is [AppListRow](AppListRow.md)s.
12
+ - Check the shape first: options a few words can name are radios or checkboxes ([AppCheckbox](AppCheckbox.md)); 2 to 5 options that re-parameterise content in place are an [AppSegmented](AppSegmented.md); a data-driven set is filter [AppChip](AppChip.md)s; a list is [AppListRow](AppListRow.md)s.
13
13
 
14
14
  ## Markup
15
15
 
@@ -102,7 +102,7 @@ Usage lives here, never in a title bar: it measures the account, not the screen
102
102
  - **The drawer** (below 600px): the title bar's menu button (`aria-expanded`, `aria-controls` on the nav) adds `app-shell--nav-open`. While it's open, make `.app-shell__main` `inert` and move focus to its close. It closes from its close, on a route change and on Escape, and focus returns to the menu button. Remove the class at 600px and up.
103
103
  - **The detail pane's history**: opening it pushes a history entry with its parameter; choosing another row while it's open replaces that entry, so back doesn't step through every row you looked at; close goes back. At every width.
104
104
  - The account card opens the account menu (toggle `aria-expanded`).
105
- - No photo: the person's initial in `<span class="app-account__avatar text-label" aria-hidden="true">R</span>`.
105
+ - No photo: the person's initials ([AppAvatar](AppAvatar.md)) in `<span class="app-account__avatar text-label" aria-hidden="true">RS</span>`.
106
106
  - The brand link keeps its `aria-label`, since the wordmark is decorative.
107
107
 
108
108
  ## Classes
@@ -7,6 +7,7 @@ An on/off setting: a label and one supporting line on the left, the switch on th
7
7
  - The M3 switch: a 52×32 track. Off: `surface-container-highest` with an `outline` border and a 16px `outline` handle. On: `primary` with a 24px `on-primary` handle, because a switch is a control you press.
8
8
  - **On its own, a switch applies at once**, like a light switch: no Save.
9
9
  - **Inside a form with a Save button** it is one of the form's answers and applies with the rest when the user saves. That needs no extra wording.
10
+ - **Something you agree to, or several of a list, is an [AppCheckbox](AppCheckbox.md)**: it waits for Save or Send, where a switch says it applies.
10
11
  - The label says what is on, as a statement: "Deploy on every push", not "Auto-deploy?". Never "Enable …".
11
12
  - Hovering the row shows the state layer as a halo round the switch (the CSS does it).
12
13
 
@@ -9,7 +9,7 @@ A labelled text input: label above, an outlined box, one supporting or error lin
9
9
  - **An error** replaces the supporting line, in `error` with the `error` icon (outlined: FILL 1 is for selection), and turns the border `error`. Say what to do, as a sentence with a full stop: "Enter a full email address.", not "Invalid".
10
10
  - A `<textarea>` for longer answers. A leading icon only for a conventional glyph (mail, search, link).
11
11
  - **Action**: one text [AppButton](AppButton.md) beside the box (Add, Copy), for a field that collects several values or acts on its own value. Collected values are input [AppChip](AppChip.md)s between the box and the supporting line. With none yet, show nothing; the supporting line says the format ("One per line, as NAME=value.").
12
- - **A choice from a list** is an [AppSelect](AppSelect.md); an on/off setting is an [AppSwitch](AppSwitch.md).
12
+ - **A choice from a list** is an [AppSelect](AppSelect.md), or an [AppCombobox](AppCombobox.md) when the list is long; an on/off setting is an [AppSwitch](AppSwitch.md) ([page.md](../rules/page.md) § Which control).
13
13
  - **A set of choices** (tiles, checkboxes) is labelled with a field set: a legend in label type, an optional supporting line.
14
14
  - **A form** is one column at the prose measure, fields 24px apart (`.app-form`), with its one filled action last. [page.md](../rules/page.md) § Forms says where errors go.
15
15
 
@@ -61,7 +61,7 @@ A labelled text input: label above, an outlined box, one supporting or error lin
61
61
  <fieldset class="app-fieldset">
62
62
  <legend class="app-fieldset__legend text-label">Plan</legend>
63
63
  <p class="app-fieldset__support text-supporting text-on-surface-variant">You can change it later.</p>
64
- <!-- AppSelectTiles in .app-tile-group, or checkboxes -->
64
+ <!-- AppSelectTiles in .app-tile-group, or AppCheckbox rows in .app-check-group -->
65
65
  </fieldset>
66
66
 
67
67
  <div class="app-btn-row">
@@ -17,7 +17,7 @@ One turn in a conversation, in an `.app-thread`. **You write in a bubble; Alis w
17
17
  | **Anyone else** | A bubble on the left, same fill and corner, under a who-line | `.app-turn--them` |
18
18
 
19
19
  - **Markdown in a bubble.** With Alis, your words stay as written and markdown isn't rendered. In a conversation with people, where messages also arrive from the CLI and from agents, every bubble renders its markdown: `.prose` on the bubble keeps body type, and headings step down to body size at 600, so lists, code and links read and nothing outgrows the bubble.
20
- - **The who-line** appears only when someone besides you and Alis is in the thread, and opens each run of turns by anyone but you: a 24px avatar (a photo, else initials), the name in label, then role and time in meta. **Alis's avatar is the mark**, so in a group thread it marks each of her runs. Two bubbles in one run sit 8 apart under one who-line.
20
+ - **The who-line** appears only when someone besides you and Alis is in the thread, and opens each run of turns by anyone but you: a 24px avatar (a photo, else initials: [AppAvatar](AppAvatar.md)), the name in label, then role and time in meta. **Alis's avatar is the mark**, so in a group thread it marks each of her runs. Two bubbles in one run sit 8 apart under one who-line.
21
21
  - **The mark is where Alis is now.** In a one-to-one it stands only at the top of her latest turn, 20px, in the turn's head: animated while she thinks, still once she writes, and it moves on to her next turn. Earlier turns carry none: a column of red marks stops meaning *Alis is on it*. In a group thread the who-line carries it instead.
22
22
 
23
23
  ## Her work
@@ -22,15 +22,19 @@ Shared conventions: `app-state` gives anything pressable its hover, focus and pr
22
22
  | AppIconButton | A glyph that performs one action; or a toggle | [AppIconButton.md](AppIconButton.md) |
23
23
  | AppTextField | A labelled input; the field set and the form | [AppTextField.md](AppTextField.md) |
24
24
  | AppSelect | One choice from a list, native select | [AppSelect.md](AppSelect.md) |
25
+ | AppCombobox | One or several from a long list: the select's box, with a search in its menu | [AppCombobox.md](AppCombobox.md) |
25
26
  | AppSwitch | An on/off setting | [AppSwitch.md](AppSwitch.md) |
27
+ | AppCheckbox | Several of a list, or something you agree to; the radio for one of a few | [AppCheckbox.md](AppCheckbox.md) |
26
28
  | AppTooltip | Names a control that shows no words, and carries its keys | [AppTooltip.md](AppTooltip.md) |
27
29
  | AppKeys | A keyboard shortcut, one cap per key, written for the platform | [AppKeys.md](AppKeys.md) |
28
30
  | AppFilePane | A file Alis made, opened beside the conversation: Preview / Code, each kind's body, its states | [AppFilePane.md](AppFilePane.md) |
29
31
  | AppShortcutSheet | Every key the screen answers to, opened by `?`, in the detail pane's place | [AppShortcutSheet.md](AppShortcutSheet.md) |
32
+ | AppAvatar | A person (round) or a thing (a square tile), at 24, 36 or 80 | [AppAvatar.md](AppAvatar.md) |
30
33
  | AppChip | A small fact: status, label, category, filter, input | [AppChip.md](AppChip.md) |
31
34
  | AppAlert | A statement carrying one status; the snackbar | [AppAlert.md](AppAlert.md) |
32
35
  | AppDialog | A confirmation or short form over a scrim | [AppDialog.md](AppDialog.md) |
33
36
  | AppCard | Statement and instrument surfaces | [AppCard.md](AppCard.md) |
37
+ | AppDisclosure | Detail few people need, folded under its title | [AppDisclosure.md](AppDisclosure.md) |
34
38
  | AppLattice | Content you read; the transcript and `.prose` | [AppLattice.md](AppLattice.md) |
35
39
  | AppComposer | Where you write to Alis, an agent or a person; voice and live calls | [AppComposer.md](AppComposer.md) |
36
40
  | AppAttachment | A file, a thing shared into the conversation, or a queued message, in the composer's tray and in the sent message | [AppAttachment.md](AppAttachment.md) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alis-build/design-system",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "The AlisX design system for coding agents: tokens, product CSS, component markup, capability marks and rules.",
5
5
  "keywords": ["alisx", "design-system", "design-tokens", "css"],
6
6
  "homepage": "https://alisx.com",
@@ -8,7 +8,7 @@
8
8
  "style": "alisx.css",
9
9
  "sideEffects": ["*.css"],
10
10
  "bin": {
11
- "alisx-check": "./check.mjs"
11
+ "alisx-check": "check.mjs"
12
12
  },
13
13
  "exports": {
14
14
  "./alisx.css": "./alisx.css",
@@ -40,7 +40,7 @@
40
40
  "NOTICE"
41
41
  ],
42
42
  "peerDependencies": {
43
- "stylelint": ">=16.0.0"
43
+ "stylelint": ">=16.11.0"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "stylelint": {
@@ -54,8 +54,17 @@ tint allowed is a diff's, beside + and − (a drawing, [styling.md](styling.md))
54
54
 
55
55
  ## Avatars
56
56
 
57
+ [AppAvatar](../components/AppAvatar.md). **A person is round and a thing is a
58
+ square tile**: a person by their photo or initials, an organisation by its logo
59
+ or initials, anything else by its icon. Alis is the mark.
60
+
57
61
  Icon tiles and initials take `surface-container-highest` with `on-surface` ink; a
58
62
  categorical avatar takes a `catN-container` with its `on-catN-container` ink. Never a status role, never `primary`.
63
+ People are never coloured by their name.
64
+
65
+ **Three sizes: 24 in a line, 36 leading a row, 80 on the page about them.**
66
+ Several people sit side by side at 24, three then a count, never overlapped: a
67
+ ring round each would have to match whatever ground is under it.
59
68
 
60
69
  **A logo takes no ground.** It arrives with its own, so no disc and no white plate
61
70
  behind it. The tile returns only when the logo is absent and a drawn mark stands
package/rules/colour.md CHANGED
@@ -6,7 +6,7 @@
6
6
  it is not something you press. The reverse does not hold: most things you press
7
7
  are ink. `primary` is spent on four things only: the filled button, a link, the
8
8
  composer's trailing button, and a control while you use it (the focus outline, a
9
- focused field, a switch that is on, a drop target). Text and outlined buttons are
9
+ focused field, a switch, checkbox or radio that is on, a drop target). Text and outlined buttons are
10
10
  ink ([buttons.md](buttons.md)), and so is a progress bar.
11
11
 
12
12
  ## The decision
@@ -4,11 +4,11 @@ What the system doesn't decide yet, in one place. When you hit one, take the qui
4
4
 
5
5
  ## Components not in the set
6
6
 
7
- - **Comboboxes** (a searchable or multi-value select) and **date and time pickers**. Use `AppSelect` or a text field with a format hint.
8
- - **Checkboxes and radios** as standalone controls. A labelled set of choices is `AppSelectTile`s in an `AppFieldset`; an on/off setting is `AppSwitch`.
7
+ - **Date and time pickers**. Use a text field with a format hint.
8
+ - **A bar of actions for several chosen rows** ("3 selected"). [AppCheckbox](../components/AppCheckbox.md) chooses them; what acts on them has no pattern yet.
9
9
  - **The marketing components** (`.ax-*`, alisx.com) are not in this package: it covers the product register. A layout class for a grid of lattices is missing too.
10
10
  - **What the Skill store and the Specialists offer**, beyond their one-line descriptions in [README.md](README.md). Marketing copy about them needs a product brief.
11
- - **Tabs outside the title bar**, **avatars** as a component ([chips-alerts.md](chips-alerts.md) has the rule), **file upload**, and a **dismissible alert**.
11
+ - **File upload**, and a **dismissible alert**.
12
12
 
13
13
  ## Open patterns
14
14
 
package/rules/page.md CHANGED
@@ -14,13 +14,19 @@ Where does this go?
14
14
  ├─ A filter that scopes the page: account,
15
15
  │ product, period, status, target, or tabs
16
16
  │ that narrow one list → the filter row
17
+ ├─ Views that switch in place inside a pane,
18
+ │ a section or a dialog → a segmented control at its head
17
19
  └─ A filter or a search inside one pane or
18
20
  one section → that pane or section's header
19
21
  ```
20
22
 
21
23
  **A tab that changes the route is navigation; a tab that narrows one list is a
22
24
  filter**, and a filter belongs in the filter row as a segmented control
23
- ([selection.md](selection.md)).
25
+ ([selection.md](selection.md)). **Inside content there are no tabs**: views that
26
+ replace each other in a pane, a section or a dialog are a segmented control at
27
+ the head of what they switch, and past five, a button that names its choice
28
+ (§ The filter row). The underlined tab is the title bar's alone, so it always
29
+ means another route.
24
30
 
25
31
  ## The title bar
26
32
 
@@ -112,7 +118,9 @@ scrolling with it: **one row that narrows the list**, and wraps.
112
118
  - **A choice among several options is a button that names its choice**, with a
113
119
  trailing `expand_more`, opening a menu whose chosen row is checked (§ Menus).
114
120
  It keeps the row at the control height, where a field wouldn't. A select field
115
- ([AppSelect](../components/AppSelect.md)) belongs in a form.
121
+ ([AppSelect](../components/AppSelect.md)) belongs in a form. A long list gets a
122
+ search as the menu's first line, and with several chosen the button reads as a
123
+ count, "4 people" ([AppCombobox](../components/AppCombobox.md)).
116
124
  - **The count closes the row**, at the far end, and answers it: what the scope
117
125
  produces ("24 projects"), and "3 of 24" while a query or a filter narrows.
118
126
  - One row of controls before the first result, never two.
@@ -180,6 +188,9 @@ leads its content with it, or leaves it out.
180
188
  one filled action last and labelled with its outcome.
181
189
  - **A field is labelled above**, in label type. A set of choices (tiles,
182
190
  checkboxes, radios) is labelled once, as a group, the same way.
191
+ - **Detail few people need folds** under its title
192
+ ([AppDisclosure](../components/AppDisclosure.md)): advanced settings, never a
193
+ required field.
183
194
  - **A field that collects several values** (email addresses, tags) takes one text
184
195
  action beside it ("Add"); added values show below as input chips. Enter adds
185
196
  too.
@@ -210,6 +221,23 @@ leads its content with it, or leaves it out.
210
221
  at the top.
211
222
  - **A switch** applies at once on its own, and with the rest on Save inside a form.
212
223
 
224
+ ### Which control
225
+
226
+ ```
227
+ What is the person choosing?
228
+ ├─ On or off, a setting → AppSwitch
229
+ ├─ Something they agree to before sending,
230
+ │ or several of a list → checkboxes (AppCheckbox)
231
+ ├─ One of 2 to 5
232
+ │ ├─ it changes the content in place → AppSegmented
233
+ │ ├─ a few words name each → radios (AppCheckbox)
234
+ │ └─ each needs a sentence → AppSelectTile
235
+ ├─ One of 6 to about ten → AppSelect
236
+ ├─ One or several of a longer list, or a
237
+ │ list from a server (people, countries) → AppCombobox
238
+ └─ Values they type themselves (emails, tags) → AppTextField with Add
239
+ ```
240
+
213
241
  ## The drafting field
214
242
 
215
243
  The alisx.com hero grid (the `DraftingField` component, or its classes).
@@ -51,9 +51,13 @@ AppShell
51
51
  | The keys a screen answers to | `AppShortcutSheet`, opened by `?` and from the account menu, in the detail pane's place |
52
52
  | A form | `.app-form` of fields, one filled action last (see § Forms) |
53
53
  | Text | `AppTextField` (with `action` for one that collects several values, shown as input `AppChip`s below) |
54
- | One choice from a list | `AppSelect` |
54
+ | One choice from a list | `AppSelect`; past about ten options, or to choose several, `AppCombobox` |
55
55
  | An on/off setting | `AppSwitch` |
56
+ | Several of a list, or something to agree to | `AppCheckbox`; one of a few short options is its radio ([page.md](page.md) § Which control) |
56
57
  | A choice among cards, labelled | `AppSelectTile`s in an `AppFieldset` |
58
+ | A person, an organisation, or an icon leading a row | `AppAvatar`: a person round, a thing a square tile; 24, 36 or 80 |
59
+ | Detail few people need | `AppDisclosure`, closed by default |
60
+ | Views that switch in place inside a pane or a dialog | `AppSegmented` at its head; never tabs |
57
61
  | Rendered markdown | `.prose` on the container |
58
62
  | A status on a panel | `AppAlert` (the panel is the status) or `AppChip` (the panel has one); states map to tones in [AppChip](../components/AppChip.md) |
59
63
  | A result that passes ("Saved", "Deleted") | `AppSnackbar` |
@@ -74,8 +74,10 @@ rows; a toggle is [buttons.md](buttons.md) § Icon buttons.
74
74
  - **A content-plane list row takes the full fill** and the selected weight
75
75
  ([AppListRow](../components/AppListRow.md)).
76
76
  - **A dense row may use a checked control as its second property.** Where a
77
- checkbox already reports the state, the fill plus the checked box is the pair
78
- and weight is left alone.
77
+ checkbox ([AppCheckbox](../components/AppCheckbox.md)) already reports the state, the fill plus the checked box is the pair
78
+ and weight is left alone. **An option in a menu that takes several is not a
79
+ selected row**: its checkbox says it, and the row takes no fill
80
+ ([AppCombobox](../components/AppCombobox.md)).
79
81
  - **A selected filter chip** takes the selection fill
80
82
  ([AppChip](../components/AppChip.md)).
81
83
 
package/rules/styling.md CHANGED
@@ -85,8 +85,10 @@ The package ships what can be linted, so every app checks the same things
85
85
  priority, and a selector on a system class. It reads the token and class
86
86
  names from the package, so a new token needs no edit to the check. In a
87
87
  Svelte or Vue file it reads the `<style>` block and a static `style=""`.
88
- - **A gap is said where it is**: `/* stylelint-disable-next-line <rule> -- GAP:
89
- what this needs */`. A disable with no reason is reported.
88
+ - **A gap is said where it is**, by rule and with a reason:
89
+ `/* stylelint-disable-next-line <rule> -- GAP: what this needs */`. A disable
90
+ is itself reported when it names no rule, gives no reason, or silences
91
+ nothing.
90
92
  - **`alisx-check styles`** runs it as a gate. An app with a backlog records a
91
93
  baseline and it becomes a ratchet, failing when a file gains violations of a
92
94
  rule, so the backlog doesn't block new work. Re-record the baseline only
@@ -94,7 +96,8 @@ The package ships what can be linted, so every app checks the same things
94
96
  why the number moved.
95
97
  - **`alisx-check names`** fails on a system class or a custom property the
96
98
  installed version doesn't have (`classes.json`): a misspelt class renders
97
- unstyled and says nothing.
99
+ unstyled and says nothing. A property that arrives at run time (a client's
100
+ theme) is known once the file that declares it is named.
98
101
 
99
102
  Check by hand what a linter can't see: a computed style binding, a value behind
100
103
  a variable of your own, and a case transform in code (`toUpperCase()` on
package/stylelint.mjs CHANGED
@@ -5,7 +5,7 @@
5
5
  // opinion. The names it accepts (tokens, classes) are read from classes.json,
6
6
  // so a token added to the system is accepted without an edit here.
7
7
  //
8
- // Use it from your stylelint config (stylelint 16 or later):
8
+ // Use it from your stylelint config (stylelint 16.11 or later):
9
9
  //
10
10
  // export default {
11
11
  // extends: ['@alis-build/design-system/stylelint'],
@@ -13,14 +13,16 @@
13
13
  // }
14
14
  //
15
15
  // A rule you set under the same name REPLACES the system's: stylelint never
16
- // merges two lists. To add to one, carry the system's part along (the named
17
- // exports below) and build the rule with refuse() or allow().
16
+ // merges two lists. To add to one, or to keep one part of it for a file, carry
17
+ // the system's parts along (the named exports below) and build the rule with
18
+ // refuse() or allow().
18
19
  //
19
20
  // When nothing in styling.md fits, the system has a gap. Say so where it is:
20
21
  //
21
22
  // /* stylelint-disable-next-line <rule> -- GAP: what this needs */
22
23
  //
23
- // A disable with no reason after `--` is itself reported.
24
+ // A disable is itself reported when it names no rule (it would silence every
25
+ // rule on that line), gives no reason after `--`, or silences nothing.
24
26
  import { readFileSync } from 'node:fs'
25
27
 
26
28
  export const guide = 'rules/styling.md in @alis-build/design-system'
@@ -52,44 +54,50 @@ const blendedColour =
52
54
  const literalLength = /(?<!--[\w-]*)(?<![\w.])\d*\.?\d+(?:px|r?em|ch|ex|pt|pc|cm|mm|in|vw|vh|vmin|vmax|[sld]v[wh])\b/i
53
55
  const unknownSpace = new RegExp(`var\\(\\s*--space-(?!(?:${escaped(spaces.map((name) => name.slice('space-'.length)))})\\s*[,)])`)
54
56
 
55
- // The parts, exported so an app can add to a rule without losing the system's.
57
+ // The parts, exported so an app can add to a rule, or keep one part of it for
58
+ // a file, without losing the rest. Each part has a name, so an app picks it by
59
+ // that name and never by its message or its place in a list.
56
60
  // A key is a property name or a "/regex/" string, as stylelint reads them.
57
61
 
58
- /** Values no declaration may carry. */
59
- export const refusedValues = [
60
- {
62
+ /** Values no declaration may carry, each part by name. */
63
+ export const refused = {
64
+ literalColour: {
61
65
  // A mask reads alpha only, and a filter's shadow is the same in both themes.
62
66
  properties: '/^(?!(?:-webkit-)?(?:mask|filter|backdrop-filter))/',
63
67
  values: [literalColour],
64
68
  message: `A literal colour is the same in both themes: name a role (${guide}).`,
65
69
  },
66
- {
70
+ blend: {
67
71
  // "A role at an alpha is allowed for an area or a band in a drawing, and
68
72
  // for the scrim behind text on an image. Nowhere else."
69
73
  properties: '/^(?!(?:fill|stroke|stop-color)$)/',
70
74
  values: [blendedColour],
71
75
  message: `A role at an alpha or a blend belongs to a drawing (fill, stroke) or the scrim. Elsewhere, name the nearest role (${guide}).`,
72
76
  },
73
- {
77
+ spacing: {
74
78
  properties: '/^(?:(?:margin|padding|scroll-margin|scroll-padding)(?:-|$)|(?:grid-)?(?:row-|column-)?gap$)/',
75
79
  values: [literalLength, unknownSpace],
76
80
  message: (property) => `Spacing comes from the scale: write ${property} with ${spaces.map((name) => `var(--${name})`).join(', ')}, or 0 (${guide}).`,
77
81
  },
78
- ]
82
+ }
83
+ /** Every refused part, as the default config uses them. */
84
+ export const refusedValues = Object.values(refused)
79
85
 
80
- /** Properties whose every value must be one of these. */
81
- export const allowedValues = [
82
- {
86
+ /** Properties whose every value must be one of these, each part by name. */
87
+ export const allowed = {
88
+ radius: {
83
89
  properties: '/radius$/',
84
90
  values: [new RegExp(`^(?:(?:var\\(--(?:${escaped(radii)})\\)|0|50%|inherit)(?:\\s*\\/\\s*|\\s+|$))+$`)],
85
91
  message: `A radius is ${radii.map((name) => `var(--${name})`).join(', ')}, 0, or 50% for a circle (${guide}).`,
86
92
  },
87
- {
93
+ shadow: {
88
94
  properties: '/^(?:-webkit-|-moz-)?box-shadow$/',
89
95
  values: ['none', 'inherit', new RegExp(`^var\\(--(?:${escaped(elevations)})\\)$`)],
90
96
  message: `A shadow is ${elevations.map((name) => `var(--${name})`).join(', ')}, or none (${guide}).`,
91
97
  },
92
- ]
98
+ }
99
+ /** Every allowed part, as the default config uses them. */
100
+ export const allowedValues = Object.values(allowed)
93
101
 
94
102
  /** Type belongs to a text-* class. Refused in a rule; an @font-face is not one. */
95
103
  export const refusedProperties = {
@@ -111,6 +119,10 @@ const applies = (key, property) => {
111
119
  const matches = (pattern, value) => (typeof pattern === 'string' ? pattern === value : pattern.test(value))
112
120
  const said = (entry, property, value) => (typeof entry.message === 'function' ? entry.message(property, value) : entry.message)
113
121
  const listed = (entries) => {
122
+ // A part this version doesn't have (a name a release changed) must stop the
123
+ // check, never thin the rule out quietly.
124
+ if (entries.some((entry) => !entry?.properties || !entry.values))
125
+ throw new Error(`@alis-build/design-system/stylelint: refuse() or allow() was given a part this version doesn't have. Its parts are refused.{${Object.keys(refused).join(', ')}} and allowed.{${Object.keys(allowed).join(', ')}}.`)
114
126
  const list = {}
115
127
  for (const entry of entries) (list[entry.properties] ??= []).push(...entry.values)
116
128
  return list
@@ -135,8 +147,13 @@ export function allow(entries) {
135
147
  }
136
148
 
137
149
  export default {
138
- // An exemption says why: `-- GAP: …` after the rule name.
150
+ // An exemption names its rule and says why: `<rule> -- GAP: …`. One that
151
+ // names no rule would silence every rule on its line; one that silences
152
+ // nothing (the code changed, the rule is off for this file, the name is
153
+ // misspelt) is a leftover.
139
154
  reportDescriptionlessDisables: true,
155
+ reportUnscopedDisables: true,
156
+ reportNeedlessDisables: true,
140
157
  rules: {
141
158
  // A named colour is a hex by another name. Hex is refused with the other
142
159
  // literal colours below, so a mask may use either.