@alis-build/design-system 0.52.1 → 0.54.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
@@ -54,14 +54,15 @@ subfolder, the rules are under that folder's `node_modules`. Never copy the
54
54
  rules into your repo: a copy stops moving with the version.
55
55
 
56
56
  **2. Check your styles.** Add `stylelint` (16.11 or later) as a dev dependency,
57
- with `postcss-html` if you have `<style>` blocks in Svelte or Vue files and
58
- `postcss-scss` if any of them is `lang="scss"` (without it those blocks are
59
- skipped, silently). Then in `stylelint.config.js`:
57
+ with `postcss-html` if you have Svelte, Vue, HTML or templ files (it reads
58
+ their `<style>` blocks and static `style=""` attributes) and `postcss-scss` if
59
+ any block is `lang="scss"` (without it those blocks are skipped, silently).
60
+ Then in `stylelint.config.js`:
60
61
 
61
62
  ```js
62
63
  export default {
63
64
  extends: ['@alis-build/design-system/stylelint'],
64
- overrides: [{ files: ['**/*.svelte', '**/*.vue'], customSyntax: 'postcss-html' }],
65
+ overrides: [{ files: ['**/*.svelte', '**/*.vue', '**/*.html', '**/*.templ'], customSyntax: 'postcss-html' }],
65
66
  }
66
67
  ```
67
68
 
@@ -109,7 +110,9 @@ export default {
109
110
  rule on that line), gives no reason, or silences nothing.
110
111
 
111
112
  - It reads what is written in CSS. A value held in a Sass variable or a mixin,
112
- or a literal behind a custom property of your own (`--pad: 13px`), is not seen.
113
+ or a literal behind a custom property of your own (`--pad: 13px`), is not seen,
114
+ and nor is a bound style (`:style`, `style={ … }`). A templ `css` component
115
+ can't be read at all, so `alisx-check styles` stops on one.
113
116
 
114
117
  **3. Run the checks in your build.**
115
118
 
@@ -143,6 +146,9 @@ export default {
143
146
  - `alisx-check words` fails on a name `words.json` has retired ("idea" for a
144
147
  project, "Access and ownership" for Sharing) in text a person reads: text
145
148
  between tags, and quoted text that holds a space or starts with a capital.
149
+ In a templ file the Go is code, read as script is: outside a component, its
150
+ `if`, `for`, `switch` and `case` lines, and an `@Component(…)` call's
151
+ arguments.
146
152
  Its baseline, `alisx-words-baseline.json`, works as the styles one does. A
147
153
  use that must stay is marked on its line or the line above:
148
154
  `alisx-words-ignore -- the reason`.
package/alisx.css CHANGED
@@ -646,11 +646,20 @@ a.app-row,a.app-card{text-decoration:none}
646
646
  /* ── Dialog · white at level 3, text actions, affirmative last ── */
647
647
  .app-scrim{position:fixed;inset:0;z-index:3;display:grid;place-items:center;padding:var(--space-24);background:color-mix(in srgb,var(--scrim) 32%,transparent)}
648
648
  .app-scrim--inline{position:static;inset:auto}
649
- .app-dialog{display:flex;flex-direction:column;gap:var(--space-16);width:min(560px,100%);padding:var(--space-24);border-radius:var(--radius-lg);background:var(--surface-container-high);color:var(--on-surface);box-shadow:var(--elevation-3)}
649
+ .app-dialog{display:flex;flex-direction:column;gap:var(--space-16);width:min(560px,100%);max-height:100%;min-height:0;box-sizing:border-box;padding:var(--space-24);border-radius:var(--radius-lg);background:var(--surface-container-high);color:var(--on-surface);box-shadow:var(--elevation-3)}
650
650
  @media (min-width:600px){.app-dialog{padding:var(--card-padding-wide)}}
651
651
  .app-dialog__title{margin:0}
652
652
  .app-dialog:focus{outline:none}
653
- .app-dialog__body{margin:0}
653
+ .app-dialog__body{margin:0;min-height:0;overflow:auto;overscroll-behavior:contain}
654
+ /* Past the window, only the body scrolls: a hairline under the title once scrolled, one over the actions while there is more */
655
+ .app-dialog__body.is-scrolled{box-shadow:inset 0 1px 0 var(--outline-variant)}
656
+ .app-dialog__body.is-more{box-shadow:inset 0 -1px 0 var(--outline-variant)}
657
+ .app-dialog__body.is-scrolled.is-more{box-shadow:inset 0 1px 0 var(--outline-variant),inset 0 -1px 0 var(--outline-variant)}
658
+ /* On a phone every dialog docks to the foot: full width, its top corners rounded, riding on the keyboard (--app-keyboard) */
659
+ @media (max-width:599px){
660
+ .app-scrim:not(.app-scrim--inline){place-items:end stretch;padding:var(--space-48) 0 var(--app-keyboard,0px)}
661
+ .app-scrim:not(.app-scrim--inline)>.app-dialog{width:100%;border-radius:var(--radius-lg) var(--radius-lg) 0 0;padding-bottom:calc(var(--space-24) + env(safe-area-inset-bottom,0px))}
662
+ }
654
663
 
655
664
  /* ── Skeleton · the layout with the words taken out ── */
656
665
  .app-skel{display:flex;flex-direction:column;gap:var(--space-16)}
@@ -1435,6 +1444,7 @@ a.app-token,button.app-token{border:0;font:inherit;font-weight:600;cursor:pointe
1435
1444
  @keyframes app-fade-in{from{opacity:0}}
1436
1445
  @keyframes app-fade-out{to{opacity:0}}
1437
1446
  @keyframes app-from-end{from{translate:var(--space-24) 0}}
1447
+ @keyframes app-from-foot{from{translate:0 100%}}
1438
1448
  @keyframes app-from-start{from{translate:calc(var(--space-24) * -1) 0}}
1439
1449
  /* Reveals: the clip opens along one axis, 40px outside the box so the deepest shadow shows, and is gone once it has played */
1440
1450
  @keyframes app-reveal-down{from{clip-path:inset(-40px -40px calc(100% + 40px) -40px)}to{clip-path:inset(-40px)}}
@@ -1490,6 +1500,8 @@ a.app-token,button.app-token{border:0;font:inherit;font-weight:600;cursor:pointe
1490
1500
  /* A dialog comes from nowhere: it fades in place, with its scrim */
1491
1501
  .app-dialog{animation:app-fade-in var(--spring-default-effects);transition:opacity var(--spring-fast-effects)}
1492
1502
  .app-scrim[hidden]>.app-dialog{opacity:0}
1503
+ /* On a phone it rises from the foot, where it docks; it leaves as a fade, as everything does */
1504
+ @media (max-width:599px){.app-scrim:not(.app-scrim--inline)>.app-dialog{animation:app-from-foot var(--spring-default-spatial),app-fade-in var(--spring-fast-effects)}}
1493
1505
  /* Alis's ask, arriving while you watch, grows up out of the composer, then its words fade in */
1494
1506
  .app-ask{min-block-size:0}
1495
1507
  .app-ask.is-arriving{overflow:clip;transition:block-size var(--spring-default-spatial),padding-block var(--spring-default-spatial),opacity var(--spring-default-effects) var(--spring-fast-effects-duration)}
@@ -1555,6 +1567,7 @@ a.app-token,button.app-token{border:0;font:inherit;font-weight:600;cursor:pointe
1555
1567
  .app-disclosure::details-content{transition:block-size 0s var(--spring-fast-effects-duration),content-visibility var(--spring-fast-effects) allow-discrete,overflow-y 0s allow-discrete}
1556
1568
  }
1557
1569
  @media (prefers-reduced-motion:reduce) and (max-width:599px){
1570
+ .app-scrim:not(.app-scrim--inline)>.app-dialog{animation:app-fade-in var(--spring-default-effects)}
1558
1571
  .app-shell__nav{opacity:0;transition:opacity var(--spring-fast-effects),display var(--spring-fast-effects) allow-discrete}
1559
1572
  .app-shell--nav-open .app-shell__nav{opacity:1}
1560
1573
  @starting-style{.app-shell--nav-open .app-shell__nav{opacity:0}}
package/check.mjs CHANGED
@@ -41,6 +41,10 @@
41
41
  // person reads. Lines of the field code or alias are code, and so is what
42
42
  // is in backticks, a printf verb (%s) or a placeholder (<id>). The baseline
43
43
  // counts each block's place, so one gaining a retired name fails.
44
+ //
45
+ // Svelte, Vue, HTML and templ files are read as markup. In templ, the Go is
46
+ // script: outside a component, and inside one its statement lines (if, for,
47
+ // switch, case) and the arguments of an @Component(…) call.
44
48
  import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs'
45
49
  import { spawnSync } from 'node:child_process'
46
50
  import { tmpdir } from 'node:os'
@@ -81,7 +85,7 @@ function names() {
81
85
  const prefixes = (options.prefix.length ? options.prefix : ['app-', 'text-']).map(escape).join('|')
82
86
  const allowed = options.allow.map((glob) => new RegExp(`^${glob.split('*').map(escape).join('.*')}$`))
83
87
 
84
- const sources = ['.svelte', '.vue', '.html', '.jsx', '.tsx', '.js', '.ts', '.mjs', '.css', '.scss', '.less']
88
+ const sources = ['.svelte', '.vue', '.html', '.templ', '.jsx', '.tsx', '.js', '.ts', '.mjs', '.css', '.scss', '.less']
85
89
  const missing = [...paths, ...options.declared].filter((path) => !existsSync(path))
86
90
  if (missing.length) stop(`alisx-check names: no such path: ${missing.join(', ')}`)
87
91
  const files = paths.flatMap((path) => walk(resolve(path))).filter((file) => sources.includes(extname(file)))
@@ -172,10 +176,16 @@ function styles() {
172
176
  for (const each of result.invalidOptionWarnings ?? []) broken.push(each.text)
173
177
  for (const each of result.parseErrors ?? []) broken.push(`${result.source}: ${each.text}`)
174
178
  for (const each of result.warnings) if (each.rule === 'CssSyntaxError') broken.push(`${result.source}:${each.line}: ${each.text}`)
179
+ // A templ css component is a stylesheet stylelint can't parse out of Go.
180
+ if (extname(result.source) === '.templ') {
181
+ const text = readFileSync(result.source, 'utf8')
182
+ for (const match of text.matchAll(/^css\s+\w+/gm))
183
+ broken.push(`${result.source}:${text.slice(0, match.index).split('\n').length}: a templ css component is not read. Write it in a stylesheet or a <style> block.`)
184
+ }
175
185
  }
176
186
  if (broken.length)
177
187
  stop(
178
- `alisx-check styles: the check could not run as configured, so nothing was compared.\n\n ${[...new Set(broken)].join('\n ')}\n\nA file with a <style> block needs its syntax in your stylelint config (postcss-html; postcss-scss for lang="scss").`,
188
+ `alisx-check styles: the check could not run as configured, so nothing was compared.\n\n ${[...new Set(broken)].join('\n ')}\n\nA Svelte, Vue, HTML or templ file needs its syntax in your stylelint config (postcss-html; postcss-scss for lang="scss").`,
179
189
  )
180
190
 
181
191
  // Keyed by the file's path from the baseline's own directory, so the same
@@ -255,7 +265,7 @@ function words() {
255
265
  .sort((a, b) => b.text.length - a.text.length)
256
266
  .map((each) => ({ ...each, pattern: new RegExp(`(?<![\\w./-])${escape(each.text).replace(/ /g, '\\s+')}(?![\\w/-]|\\.\\w)`, 'gi') }))
257
267
 
258
- const sources = ['.svelte', '.vue', '.html', '.jsx', '.tsx', '.js', '.ts', '.mjs']
268
+ const sources = ['.svelte', '.vue', '.html', '.templ', '.jsx', '.tsx', '.js', '.ts', '.mjs']
259
269
  const missing = paths.filter((path) => !existsSync(path))
260
270
  if (missing.length) stop(`alisx-check words: no such path: ${missing.join(', ')}`)
261
271
  const files = paths
@@ -357,23 +367,29 @@ function readable(text, ext) {
357
367
  const human = (value) => /[A-Za-z]/.test(value) && (/\S\s+\S/.test(value) || /^\s*[A-Z][a-z]/.test(value))
358
368
  // What a log or a console prints is read by nobody on screen.
359
369
  const script = (code, offset) => quoted(unlogged(code), (start, value) => human(value) && pieces.push({ start: offset + start, value }))
360
- if (!['.vue', '.svelte', '.html'].includes(ext)) {
370
+ if (!['.vue', '.svelte', '.html', '.templ'].includes(ext)) {
361
371
  script(text, 0)
362
372
  return pieces
363
373
  }
364
374
 
365
375
  // Script blocks are script; style blocks and comments are nobody's text.
366
376
  const blank = (match) => match.replace(/[^\n]/g, ' ')
367
- let markup = text.replace(/<!--[\s\S]*?-->/g, blank).replace(/<style\b[\s\S]*?<\/style>/gi, blank)
377
+ let markup = ext === '.templ' ? templ(text, script, blank) : text
378
+ markup = markup.replace(/<!--[\s\S]*?-->/g, blank).replace(/<style\b[\s\S]*?<\/style>/gi, blank)
368
379
  markup = markup.replace(/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi, (match, open, code, close, index) => {
369
380
  script(code, index + open.length)
370
381
  return blank(match)
371
382
  })
372
- // An expression in markup ({{ … }} or { … }) is script.
373
- markup = markup.replace(/\{\{([\s\S]*?)\}\}|\{([^{}]*)\}/g, (match, mustache, single, index) => {
374
- script(mustache ?? single, index + (mustache === undefined ? 1 : 2))
375
- return blank(match)
376
- })
383
+ // An expression in markup ({{ … }} or { … }) is script. A templ expression
384
+ // may hold a Go literal's braces (Props{…}), so its file is read until none is left.
385
+ for (let before = null; before !== markup; ) {
386
+ before = markup
387
+ markup = markup.replace(/\{\{([\s\S]*?)\}\}|\{([^{}]*)\}/g, (match, mustache, single, index) => {
388
+ script(mustache ?? single, index + (mustache === undefined ? 1 : 2))
389
+ return blank(match)
390
+ })
391
+ if (ext !== '.templ') break
392
+ }
377
393
  // An attribute: code when bound (:x, @x, #x, v-x, on:x, bind:x), nobody's
378
394
  // text when it names a class, a route or a key; otherwise it may be read.
379
395
  const code = /^(?:[:@#]|v-|on:|bind:)/
@@ -389,6 +405,44 @@ function readable(text, ext) {
389
405
  return pieces
390
406
  }
391
407
 
408
+ // A templ file as markup, every offset kept. Go outside a component (package,
409
+ // import, func, var) is script. Inside one, a statement line (if, for, switch,
410
+ // case, a closing brace) is script and leaves its markup; @Component(…) is a
411
+ // call, so its name is blanked and its arguments are script. The braces a line
412
+ // leaves would otherwise read as one expression around the markup it holds,
413
+ // and the text in it would go unread. A component starts at `templ Name(…) {`
414
+ // and ends at the `}` that starts a line, as templ fmt writes it.
415
+ function templ(text, script, blank) {
416
+ const out = []
417
+ let go = 0 // where the Go outside a component starts; null inside one
418
+ let at = 0
419
+ for (const line of text.split('\n')) {
420
+ const start = at
421
+ at += line.length + 1
422
+ const trimmed = line.trim()
423
+ if (go !== null) {
424
+ if (/^templ\s.*\{\s*$/.test(line)) {
425
+ script(text.slice(go, start), go)
426
+ go = null
427
+ }
428
+ out.push(blank(line))
429
+ } else if (/^\}/.test(line)) {
430
+ go = at
431
+ out.push(blank(line))
432
+ } else if (/^\/\//.test(trimmed)) out.push(blank(line))
433
+ else if (/^(?:if|for|switch|case|default)\b|^\}\s*(?:else\b.*)?$/.test(trimmed)) {
434
+ script(line, start)
435
+ out.push(blank(line))
436
+ } else if (/^@[\w.]+/.test(trimmed)) {
437
+ const call = line.indexOf('@') + /^@[\w.]+/.exec(trimmed)[0].length
438
+ script(' '.repeat(call) + line.slice(call), start)
439
+ out.push(blank(line))
440
+ } else out.push(line)
441
+ }
442
+ if (go !== null) script(text.slice(go), go)
443
+ return out.join('\n')
444
+ }
445
+
392
446
  // The text in a words file a person reads, each line with where it starts and
393
447
  // the place its block names. A code span that a long line wrapped carries on
394
448
  // to the next line of its block.
package/classes.json CHANGED
@@ -430,6 +430,7 @@
430
430
  "is-leaving",
431
431
  "is-loading",
432
432
  "is-locked",
433
+ "is-more",
433
434
  "is-muted",
434
435
  "is-numeric",
435
436
  "is-open",
@@ -1,15 +1,34 @@
1
1
  # AppDialog
2
2
 
3
- A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-title, a body message, Cancel as text and the affirmative filled.
3
+ A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-title, a body, Cancel as text and the affirmative filled. Centred on a wide screen; docked to the foot on a phone.
4
4
 
5
5
  ## Use / don't use
6
6
 
7
+ - **A dialog holds one decision, in one screen.** It does one of four jobs: **confirm** what is hard to undo, take **a short form** with no sections, **choose** from a list when choosing is the whole task, or **show** something that stays read-only (Sharing, seen by a Viewer). Steps or sections make it a page: its own route, the form card at the prose measure, back leading the bar ([page.md](../rules/page.md) § A form in steps). Never a stepper in a dialog.
7
8
  - Actions are [AppButton](AppButton.md)s on the trailing edge, affirmative last. A dialog is a screen of its own, so the affirmative is filled when it commits (`app-btn--filled`, with `app-btn--error` when it destroys) and the rest, Cancel always among them, are text. An affirmative that only opens, copies or reads stays text, so the whole dialog is text. The affirmative names the outcome ("Delete environment", not "OK"). A dialog is never heavier than what it interrupts, and never dark.
9
+ - **One width: 560**, Material's widest, which holds a body at the prose measure inside its padding. Never another width; what needs more room is a page or a full-size view (§ Not a dialog).
10
+ - **It grows with its content** to the window less 24 above and below. Past that only the body scrolls: the title and the action row stay, a hairline appears under the title once the body has scrolled (`is-scrolled`) and over the actions while there is more below (`is-more`), as the title bar's edge does ([AppTitleBar](AppTitleBar.md)).
11
+ - **Always a title**, in object-title, and nothing beside it: no glyph, no chip, no avatar. A confirm asks a question ("Delete staging?"); a form says what it does ("Invite people"); a list says what you're choosing ("Choose a project"); one that shows names what it shows ("Sharing").
12
+ - **It leaves by Cancel, never by an icon**: no ✕ ([page.md](../rules/page.md) § Close or back). One that only shows has **Close** instead, as text. Escape, a press on the scrim and the phone's back gesture all do what Cancel does, except that a form ignores Escape and the scrim, so a stray press loses nothing.
8
13
  - **Confirm** what is hard to undo or reaches past the user: deleting, sending to people, deploying to production. Restate it in the title as a question ("Delete staging?") and say what goes with it in the body.
14
+ - **A form in a dialog** (Invite people) follows the form rules: fields 24 apart, validated on submit, and persistent (Escape and the scrim don't close it). The dialog is the confirmation, so its affirmative ("Send 3 invites") needs no second one; it is the dialog's filled button. Cancel discards what was typed without asking: the guard against leaving with unsaved changes is for screens and panes, never a second dialog over this one. A failure that belongs to no field is an error [AppAlert](AppAlert.md) at the top of the dialog, with the fields kept ([errors.md](../rules/errors.md)).
15
+ - **Choosing from a list** (Choose a project, Choose files and artifacts) is a dialog when the choice is the whole task. A search field ([page.md](../rules/page.md) § Search) sits under the title, fixed, once the list passes about eight rows; the rows scroll in the body. Several are checkboxes and one is radios ([AppCheckbox](AppCheckbox.md)); the affirmative counts what it will do ("Add 3 files"). A choice that only goes somewhere (switching project) is a menu ([AppMenu](AppMenu.md)); a choice inside a form is a field ([AppCombobox](AppCombobox.md)), never a dialog over a dialog.
9
16
  - **Signed out** is the one dialog with no Cancel: there is nothing to go back to. It sits over the screen as it was, Escape and the scrim don't close it, and Sign in again opens sign-in in a new tab, so nothing underneath reloads ([errors.md](../rules/errors.md)).
10
17
  - **Asking for access** ([access.md](../rules/access.md) § Asking for more) is a form in a dialog. The title asks for the role ("Ask for Editor access?"), the body names who will be asked ("Ruan Spies, the Owner of Renewal calls, will be asked."), one field takes an optional note ("Note for Ruan (optional)"), and Send request is the filled affirmative. After it sends, the control that opened it is replaced by "Request sent".
11
18
  - **Sharing, seen by someone who can't change it**, lists the people with their roles as text (no role menus, no Remove), says what each role can do in the words of `words.json`, and has one line, "Only Owners can change Sharing.". Its actions are Close and, when they may ask, Request Editor access, both text: neither commits.
12
- - **A form in a dialog** (Invite people) follows the form rules: fields 24 apart, validated on submit, and persistent (Escape and the scrim don't close it). The dialog is the confirmation, so its affirmative ("Send 3 invites") needs no second one; it is the dialog's filled button.
19
+ - **Leaving with unsaved changes** is a dialog over the screen being left ([page.md](../rules/page.md) § Forms): "Discard changes?", a body naming what wasn't saved, then Keep editing as text and Discard changes filled in `error`. Keep editing takes Cancel's place in this one dialog, where "Cancel" could mean the edits or the leaving.
20
+
21
+ ### On a phone
22
+
23
+ Below 600 every dialog docks to the foot: the same dialog, full width, its top corners rounded, its title, body and actions unchanged. It rises from the foot and grows with its content to 48 short of the top, where the screen it covers still shows under the scrim; then its body scrolls. While the keyboard is up it rides on top of it, so the action stays in sight. No ✕, no back arrow and no handle: Cancel is at the thumb, and the phone's back gesture is Cancel.
24
+
25
+ ### Not a dialog
26
+
27
+ - **A flow in steps, or a form in sections** is a page ([page.md](../rules/page.md) § A form in steps).
28
+ - **Something shown full size** (an image, a video, a diagram, a document, a field expanded to edit at length) is a full-size view over the screen ([page.md](../rules/page.md) § A full-size view). A file Alis made opens in the [AppFilePane](AppFilePane.md).
29
+ - **An explanation** is a fold beside what it explains ([AppDisclosure](AppDisclosure.md)), a tooltip for one line, or the docs; never a dialog that ends in "Got it" ([register.md](../rules/register.md)). Your own agent's door is an [AppHandOff](AppHandOff.md).
30
+ - **A success** shows the result in place, with a snackbar when it's easy to miss ([page.md](../rules/page.md) § Forms). **A failure** is an alert where it happened ([errors.md](../rules/errors.md)).
31
+ - **What Alis or a person asks of you** is an [AppAsk](AppAsk.md) on the composer.
13
32
 
14
33
  ## Markup
15
34
 
@@ -27,6 +46,39 @@ A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-
27
46
  </div>
28
47
  </div>
29
48
 
49
+ <!-- Choosing from a list: search fixed under the title, rows scrolling in the body, the affirmative counts -->
50
+ <div class="app-scrim">
51
+ <div role="dialog" aria-modal="true" aria-labelledby="d-pick-t" tabindex="-1" class="app-dialog">
52
+ <h2 id="d-pick-t" class="app-dialog__title text-object-title">Choose files and artifacts</h2>
53
+ <label class="app-search" role="search">
54
+ <span class="app-icon" aria-hidden="true">search</span>
55
+ <input class="app-search__input" type="search" placeholder="Search files" aria-label="Search files">
56
+ </label>
57
+ <div class="app-dialog__body is-scrolled is-more" role="group" aria-label="Files and artifacts">
58
+ <label class="app-check-row"><input type="checkbox" class="app-checkbox" checked><span class="app-check-row__text"><span class="text-body">Renewal interview guide.pdf</span></span></label>
59
+ <label class="app-check-row"><input type="checkbox" class="app-checkbox" checked><span class="app-check-row__text"><span class="text-body">Customer journey map</span></span></label>
60
+ <label class="app-check-row"><input type="checkbox" class="app-checkbox"><span class="app-check-row__text"><span class="text-body">Q3 churn notes.docx</span></span></label>
61
+ <label class="app-check-row"><input type="checkbox" class="app-checkbox" checked><span class="app-check-row__text"><span class="text-body">Pricing page draft</span></span></label>
62
+ </div>
63
+ <div class="app-btn-row">
64
+ <button type="button" class="app-btn app-state app-target">Cancel</button>
65
+ <button type="button" class="app-btn app-state app-target app-btn--filled">Add 3 files</button>
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <!-- Leaving with unsaved changes: Keep editing in Cancel's place -->
71
+ <div class="app-scrim">
72
+ <div role="dialog" aria-modal="true" aria-labelledby="d-leave-t" tabindex="-1" class="app-dialog">
73
+ <h2 id="d-leave-t" class="app-dialog__title text-object-title">Discard changes?</h2>
74
+ <div class="app-dialog__body text-body">Your changes to Branding haven't been saved.</div>
75
+ <div class="app-btn-row">
76
+ <button type="button" class="app-btn app-state app-target">Keep editing</button>
77
+ <button type="button" class="app-btn app-state app-target app-btn--filled app-btn--error">Discard changes</button>
78
+ </div>
79
+ </div>
80
+ </div>
81
+
30
82
  <!-- Signed out: the one dialog with no Cancel -->
31
83
  <div class="app-scrim">
32
84
  <div role="dialog" aria-modal="true" aria-labelledby="d-out-t" tabindex="-1" class="app-dialog">
@@ -56,7 +108,7 @@ A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-
56
108
  </div>
57
109
  </div>
58
110
 
59
- <!-- Sharing, seen by a Viewer: roles as text, what each can do, one line -->
111
+ <!-- Sharing, seen by a Viewer: roles as text, what each can do, one line, Close -->
60
112
  <div class="app-scrim">
61
113
  <div role="dialog" aria-modal="true" aria-labelledby="d-share-t" tabindex="-1" class="app-dialog">
62
114
  <h2 id="d-share-t" class="app-dialog__title text-object-title">Sharing</h2>
@@ -75,7 +127,7 @@ A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-
75
127
  </div>
76
128
  </div>
77
129
 
78
- <!-- In the flow, for docs: no scrim, no aria-modal, no focus handling -->
130
+ <!-- In the flow, for docs: no scrim, no aria-modal, no focus handling; it stays centred at every width -->
79
131
  <div class="app-scrim app-scrim--inline">…</div>
80
132
  <!-- or the .app-dialog alone -->
81
133
  ```
@@ -85,6 +137,8 @@ A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-
85
137
  - **Open**: remember `document.activeElement`, then focus the first focusable element inside the dialog (the first field, else the first action, which is Cancel), or a chosen element; fall back to the dialog itself (`tabindex="-1"`).
86
138
  - **Trap focus**: on Tab from the last focusable element go to the first, and on Shift+Tab from the first go to the last.
87
139
  - **Close** on Escape, on a press of the scrim itself (`mousedown` whose target is the `.app-scrim`, not the dialog), and on Cancel. A persistent dialog (a form) ignores Escape and the scrim.
140
+ - **The scroll edges**: while the body's `scrollTop` is above 0 it takes `is-scrolled`; while there is more below (`scrollTop + clientHeight < scrollHeight`) it takes `is-more`. Check on open, on scroll and when the content changes.
141
+ - **On a phone**: push a history entry on open, so the back gesture closes the dialog as Cancel does instead of leaving the screen; drop it when the dialog closes any other way. While the keyboard is up, set `--app-keyboard` on the scrim to the height it covers (`innerHeight - visualViewport.height - visualViewport.offsetTop`, on the visual viewport's `resize`), so the dialog rides on it. On Android, `interactive-widget=resizes-content` in the viewport tag does this without the script.
88
142
  - **On close**: set `hidden` on the scrim and remove it after `--spring-fast-effects-duration`, so it fades ([motion.md](../rules/motion.md)); return focus to the remembered element if it is still in the document.
89
143
  - Mount one dialog at a time.
90
144
  - **Signed out**: Sign in again opens sign-in in a new tab from the click itself; where the tab is blocked, reload through sign-in instead. Close the dialog when that tab reports back, or when the window regains focus and the session is back. Back as someone else, reload the page.
@@ -92,4 +146,4 @@ A dialog: `surface-container-high` (white in light) at `elevation-3`, an object-
92
146
 
93
147
  ## Classes
94
148
 
95
- `.app-scrim`, `.app-scrim--inline`, `.app-dialog`, `.app-dialog__title`, `.app-dialog__body`, `.app-btn-row`.
149
+ `.app-scrim`, `.app-scrim--inline`, `.app-dialog`, `.app-dialog__title`, `.app-dialog__body`, `.is-scrolled`, `.is-more`, `.app-btn-row`. The custom property `--app-keyboard` on the scrim.
@@ -12,8 +12,8 @@ See [page.md](../rules/page.md) § A form in steps for when a form takes steps a
12
12
  - **A done step is a button back to it**, with `app-state`. A later step is not: the flow's Continue checks the step before it moves on. Editing something that already exists, every step has been reached, so every step is a button.
13
13
  - **No step is a button while a save runs, or once going back can't undo what a step made** (an instance created before its configuration): those steps stay done, as `<span>`s.
14
14
  - **A step that no longer holds** (an edit elsewhere broke it, or the server refused it) is `is-invalid`: its segment and name in `error`, the `error` glyph before the name.
15
- - **It leads the flow's surface**: the top of the instrument card on a page, under the title in a dialog. Never a panel of its own, and never "Step 1 of 2" written beside it. On a sign-in card ([AppSignIn](AppSignIn.md)) it takes the logo's place from the first stepped card: the person has just seen the logo.
16
- - **Narrower than 480** (its own width, so a narrow dialog counts too) the names leave and one caption under the bars names the current step and counts ("Contact", "2 of 3"). The names stay for assistive technology.
15
+ - **It leads the flow's surface**: the top of the instrument card on the page; never in a dialog ([page.md](../rules/page.md) § A form in steps). Never a panel of its own, and never "Step 1 of 2" written beside it. On a sign-in card ([AppSignIn](AppSignIn.md)) it takes the logo's place from the first stepped card: the person has just seen the logo.
16
+ - **Narrower than 480** (its own width, so a narrow card counts too) the names leave and one caption under the bars names the current step and counts ("Contact", "2 of 3"). The names stay for assistive technology.
17
17
  - Not for work the system runs: that is [AppProgress](AppProgress.md) and its steps. Not for views of one thing: that is an [AppSegmented](AppSegmented.md).
18
18
 
19
19
  ## Markup
@@ -69,7 +69,7 @@ See [page.md](../rules/page.md) § A form in steps for when a form takes steps a
69
69
 
70
70
  - **Move the states** as the person moves: `is-done` on every step behind them, `is-current` and `aria-current="step"` on theirs, nothing on the rest. Swap a step's `<span>` for a `<button>` once it is done.
71
71
  - **Continue checks the step**: on a failure it stays, turns each field `error` with its supporting line, and moves focus to the first; it is never disabled ([page.md](../rules/page.md) § Forms).
72
- - **Keep the step in the URL** (`?step=review`): each step pushes a history entry, so the browser's back steps back and a refresh stays. A dialog with no URL of its own keeps the step in the dialog; closing it discards the step.
72
+ - **Keep the step in the URL** (`?step=review`): each step pushes a history entry, so the browser's back steps back and a refresh stays.
73
73
  - **Update the caption** with the current step's name and count; it is `aria-hidden`, because the list already says it.
74
74
 
75
75
  ## Classes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alis-build/design-system",
3
- "version": "0.52.1",
3
+ "version": "0.54.0",
4
4
  "description": "The AlisX design system for coding agents: tokens, product CSS, component markup, capability marks, words and rules.",
5
5
  "keywords": ["alisx", "design-system", "design-tokens", "css"],
6
6
  "homepage": "https://alisx.com",
package/rules/buttons.md CHANGED
@@ -225,7 +225,8 @@ The rest:
225
225
  interview"), and a control that works a thing in place (Start recording).
226
226
  - **Dialogs:** a dialog is its own screen, so
227
227
  its affirmative is filled when it commits, in `error` when it destroys, and
228
- the rest are text. "Cancel" is always text. An affirmative that doesn't commit
228
+ the rest are text. "Cancel" is always text; leaving with unsaved changes says
229
+ "Keep editing" in its place ([AppDialog](../components/AppDialog.md)). An affirmative that doesn't commit
229
230
  (it opens, copies or reads: "Open app", "Copy message") is text too, so the
230
231
  whole dialog is text. "Try again" is filled when it retries a write. A
231
232
  "Continue" names no outcome: rename it to what happens.
@@ -10,6 +10,7 @@ What the system doesn't decide yet, in one place. When you hit one, take the qui
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
11
  - **A standalone bulk uploader**, beyond conversation attachments. Conversation uploads are covered by [AppAttachment](../components/AppAttachment.md) and [AppComposer](../components/AppComposer.md).
12
12
  - **A dismissible alert**.
13
+ - **A full-size view** ([page.md](page.md) § A full-size view) has no classes yet: build its bar from the title bar's parts and its ground from `machine-surface`'s black stage or `surface`, and mark it `GAP`.
13
14
 
14
15
  ## Open patterns
15
16
 
package/rules/motion.md CHANGED
@@ -56,7 +56,8 @@ The curve is CSS `linear()`, drawn from the spring itself, every wobble of it.
56
56
  from the right edge, the phone's navigation pane from the left, the composer's
57
57
  bands up out of the composer, a menu out of its trigger, a snackbar up from the
58
58
  foot. A dialog comes from nowhere: it fades in place, with its scrim, and
59
- nothing about it moves.
59
+ nothing about it moves. On a phone it docks to the foot, so it rises from there
60
+ ([AppDialog](../components/AppDialog.md)).
60
61
  - **Leaving is quicker than arriving.** Something within the screen leaves as a
61
62
  fade on fast effects, without moving. A pane goes back over its edge.
62
63
  - **Grow, never scale.** A surface arrives by revealing itself along one axis (a
@@ -112,7 +113,7 @@ needs nothing from the site.
112
113
  | An icon changing its meaning (Send to Stop, Copy to ✓) | `.app-icon-swap` turns one glyph away and springs the other in | Put both glyphs in it and toggle `is-swapped` ([AppIconButton](../components/AppIconButton.md)) |
113
114
  | Selection that travels | `app-tabs--travel` and `app-seg--travel` draw one indicator that travels | Set `--indicator-left` and `--indicator-width` to the selected item's `offsetLeft` and `offsetWidth`, then add the modifier, so it is drawn in place and moves only on a change ([AppTitleBar](../components/AppTitleBar.md), [AppSegmented](../components/AppSegmented.md)) |
114
115
  | Expand and collapse | A disclosure and a turn's steps open to their height, then their rows fade in | Toggle `open` or `hidden`, as already |
115
- | A menu, tooltip, snackbar or dialog | A menu or snackbar arrives growing out of where it lives; a tooltip and a dialog fade in place. Each leaves as a fade when it's `hidden`. Nothing is clipped once it has arrived, so a field's panel inside it shows whole | Toggle `hidden`, or set it and remove the element once it has gone (§ Removing what has left). Removed at once, it just goes |
116
+ | A menu, tooltip, snackbar or dialog | A menu or snackbar arrives growing out of where it lives; a tooltip and a dialog fade in place, and a dialog on a phone rises from the foot. Each leaves as a fade when it's `hidden`. Nothing is clipped once it has arrived, so a field's panel inside it shows whole | Toggle `hidden`, or set it and remove the element once it has gone (§ Removing what has left). Removed at once, it just goes |
116
117
  | Alis's ask | Grows up out of the composer | Render it with `is-arriving` when it opens while someone is there |
117
118
  | The conversation | A turn that arrives fades in, and yours rises out of the composer; each status fades in; each run of a reply fades in as it lands | `is-arriving` on a turn that arrives while the thread is open; each step's words in a new element inside the one status; each arriving run in `.app-turn__chunk` ([AppTurn](../components/AppTurn.md)) |
118
119
  | A list that changes | A row that arrives opens its space and is tinted for a moment; one that leaves folds away | `is-arriving` on a row that arrives while the list is open; `is-leaving`, then remove it once it has gone ([AppListRow](../components/AppListRow.md)) |
package/rules/page.md CHANGED
@@ -89,7 +89,8 @@ One test: **is what you were on still there behind it?**
89
89
  - **Either one leads the bar**, its glyph on the 24px edge. Never on the trailing
90
90
  edge, and never both.
91
91
  - **Never an icon to leave a dialog, a message or a step.** A dialog leaves by
92
- Cancel ([AppDialog](../components/AppDialog.md)). A snackbar goes by itself and
92
+ Cancel ([AppDialog](../components/AppDialog.md)), on a phone too: there it docks
93
+ to the foot over the screen, which still shows above it, so it covers nothing. A snackbar goes by itself and
93
94
  an alert stays until you act ([AppAlert](../components/AppAlert.md)). A step in
94
95
  a flow goes back by a Back text button at the row's start
95
96
  ([AppStepper](../components/AppStepper.md)).
@@ -98,6 +99,24 @@ One test: **is what you were on still there behind it?**
98
99
  [AppAttachment](../components/AppAttachment.md)). Never to delete, deny or
99
100
  reject: those take words.
100
101
 
102
+ ## A full-size view
103
+
104
+ **Something shown full size covers the window; it is not a dialog.** An image
105
+ or a video, a diagram, a document, a field expanded to edit at length.
106
+
107
+ - **Close (`close`) leads**, the thing's name beside it, its verbs on the
108
+ trailing edge (Download, Copy); the screen is still behind it (§ Close or
109
+ back). Esc closes it, and on a phone so does the back gesture.
110
+ - **Its ground**: an image or a video sits on black, the media stage
111
+ ([styling.md](styling.md)); a diagram, a document or an editor sits on
112
+ `surface`.
113
+ - **Several images step** with ← and → and the chevrons at the sides, the place
114
+ counted at the foot ("2 of 4").
115
+ - **An expanded field** is the same field, larger: `close_fullscreen`
116
+ ("Collapse") leads instead of close, and what was typed stays.
117
+ - **A file Alis made** opens beside the conversation instead
118
+ ([AppFilePane](../components/AppFilePane.md)), and expands from there.
119
+
101
120
  ## Where back goes
102
121
 
103
122
  **Back returns to where you came from, and its name says where.**
@@ -309,6 +328,14 @@ leads its content with it, or leaves it out. What a failure shows, and where, is
309
328
  its evidence is off-screen or easy to miss, a snackbar confirms it ("Saved",
310
329
  "Deleted staging"); a result someone needs to read stays as a success alert
311
330
  at the top.
331
+ - **Leaving with unsaved changes** (a link, back, closing a pane) asks first, in
332
+ one dialog over the screen: "Discard changes?", a body naming what wasn't saved
333
+ ("Your changes to Branding haven't been saved."), Keep editing as text and
334
+ Discard changes filled in `error` ([AppDialog](../components/AppDialog.md)).
335
+ Saving stays on the screen, where it can show its errors. Reloading or closing
336
+ the tab gets the browser's own prompt, whose words aren't ours. A form in a
337
+ dialog needs no guard: Escape and the scrim can't close it, so Cancel discards.
338
+ Never the browser's `confirm()` for it.
312
339
  - **A switch** applies at once on its own, and with the rest on Save inside a form.
313
340
  - **A provider's payment form** (Stripe's Payment Element) is themed once, from
314
341
  the tokens, through its own appearance options: Nunito Sans through its fonts
@@ -347,9 +374,14 @@ Should this form take steps?
347
374
  └─ Views of one thing, or work the system runs → not steps: AppSegmented, AppProgress
348
375
  ```
349
376
 
377
+ **Steps or sections make a page, never a dialog.** A dialog holds one decision
378
+ in one screen ([AppDialog](../components/AppDialog.md)); a flow in steps, or a form
379
+ in sections, gets its own route with the form card at the prose measure, back
380
+ leading the bar and naming where it returns ("Back to Workstations").
381
+
350
382
  - **Two to five steps, each named in a word or two.** More than five is two flows.
351
383
  - **[AppStepper](../components/AppStepper.md) leads the flow's surface**: the top
352
- of its card on a page, under the title in a dialog. No panel round it, and no
384
+ of its card on the page. No panel round it, and no
353
385
  "Step 1 of 2" beside it. On a sign-in card it takes the logo's place
354
386
  ([AppSignIn](../components/AppSignIn.md)).
355
387
  - **One action row at the foot.** Back is text, on the leading edge, from the
@@ -364,9 +396,8 @@ Should this form take steps?
364
396
  title asks the question ("Publish this interview?"), it lists what was chosen,
365
397
  and its button names the outcome. No dialog after it.
366
398
  - **A result is not a step.** When the flow ends, show the thing it made.
367
- - **On a page the step is in the URL** (`?step=review`), so a refresh keeps it
368
- and the browser's back steps back. A dialog with no URL of its own keeps the
369
- step in the dialog, and closing it discards the step.
399
+ - **The step is in the URL** (`?step=review`), so a refresh keeps it and the
400
+ browser's back steps back.
370
401
  - **A step that made something going back can't undo** stops being a way back,
371
402
  and so does every step while a save runs.
372
403
 
@@ -68,6 +68,8 @@ AppShell
68
68
  | 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) |
69
69
  | A result that passes ("Saved", "Deleted") | `AppSnackbar` |
70
70
  | A confirmation | `AppDialog` with `onClose`: Cancel as text, the affirmative last and filled (`tone="error"` when it destroys) |
71
+ | A choice from a list, when choosing is the whole task | `AppDialog` with a search field under the title, checkbox or radio rows in the body, the affirmative counting ("Add 3 files") |
72
+ | A flow in steps, or a form in sections | A page with its own route, never a dialog (`page.md` § A form in steps) |
71
73
  | Waiting, shape known | `AppSkeleton` in the content's shape |
72
74
  | Waiting, shape unknown | `AppLoader` |
73
75
  | Work you can count (a deploy, an upload) | `AppProgress`, with `AppSteps` for named stages |
package/rules/styling.md CHANGED
@@ -96,7 +96,8 @@ The package ships what can be linted, so every app checks the same things
96
96
  radius and shadow written without their tokens, local type, a forced
97
97
  priority, and a selector on a system class. It reads the token and class
98
98
  names from the package, so a new token needs no edit to the check. In a
99
- Svelte or Vue file it reads the `<style>` block and a static `style=""`.
99
+ Svelte, Vue, HTML or templ file it reads the `<style>` block and a static
100
+ `style=""`, under the same rules.
100
101
  - **A gap is said where it is**, by rule and with a reason:
101
102
  `/* stylelint-disable-next-line <rule> -- GAP: what this needs */`. A disable
102
103
  is itself reported when it names no rule, gives no reason, or silences
package/stylelint.mjs CHANGED
@@ -9,7 +9,7 @@
9
9
  //
10
10
  // export default {
11
11
  // extends: ['@alis-build/design-system/stylelint'],
12
- // overrides: [{ files: ['**/*.svelte', '**/*.vue'], customSyntax: 'postcss-html' }],
12
+ // overrides: [{ files: ['**/*.svelte', '**/*.vue', '**/*.html', '**/*.templ'], customSyntax: 'postcss-html' }],
13
13
  // }
14
14
  //
15
15
  // A rule you set under the same name REPLACES the system's: stylelint never
@@ -24,6 +24,7 @@
24
24
  // A disable is itself reported when it names no rule (it would silence every
25
25
  // rule on that line), gives no reason after `--`, or silences nothing.
26
26
  import { readFileSync } from 'node:fs'
27
+ import stylelint from 'stylelint'
27
28
 
28
29
  export const guide = 'rules/styling.md in @alis-build/design-system'
29
30
 
@@ -114,12 +115,33 @@ export const allowed = {
114
115
  /** Every allowed part, as the default config uses them. */
115
116
  export const allowedValues = Object.values(allowed)
116
117
 
117
- /** Type belongs to a text-* class. Refused in a rule; an @font-face is not one. */
118
+ /** Type belongs to a text-* class. Refused in a rule and in a style attribute; an @font-face is neither. */
118
119
  export const refusedProperties = {
119
120
  properties: ['font', 'font-family', 'font-size', 'font-weight', 'font-variation-settings', 'line-height', 'letter-spacing', 'text-transform', 'text-shadow'],
120
121
  message: (selector, property) => `${property} is appearance: a text-* class carries type (${guide}).`,
121
122
  }
122
123
 
124
+ // rule-selector-property-disallowed-list reads a declaration only inside a rule,
125
+ // so a static style="" (a stylesheet without the tag, styling.md) needs its own:
126
+ // a declaration with no rule or at-rule around it is one an attribute holds.
127
+ // Nothing in a rule is read here, so nothing is reported twice.
128
+ const inlineType = 'alisx/inline-type'
129
+ const inlineTypeRule = (on) => (root, result) => {
130
+ if (!on) return
131
+ root.walkDecls((declaration) => {
132
+ if (declaration.parent?.type !== 'root' || !refusedProperties.properties.includes(declaration.prop.toLowerCase())) return
133
+ stylelint.utils.report({
134
+ ruleName: inlineType,
135
+ result,
136
+ node: declaration,
137
+ word: declaration.prop,
138
+ message: `${declaration.prop} in a style attribute is appearance: a text-* class carries type (${guide}).`,
139
+ })
140
+ })
141
+ }
142
+ inlineTypeRule.ruleName = inlineType
143
+ inlineTypeRule.messages = {}
144
+
123
145
  /** A site never restyles a system class. Exact names, so .app-bar-search of your own is yours. */
124
146
  export const refusedSelectors = {
125
147
  selectors: [new RegExp(`\\.(?:${escaped(systemClasses)})(?![\\w-])`)],
@@ -169,6 +191,7 @@ export default {
169
191
  reportDescriptionlessDisables: true,
170
192
  reportUnscopedDisables: true,
171
193
  reportNeedlessDisables: true,
194
+ plugins: [stylelint.createPlugin(inlineType, inlineTypeRule)],
172
195
  rules: {
173
196
  // A named colour is a hex by another name. Hex is refused with the other
174
197
  // literal colours below, so a mask may use either.
@@ -176,6 +199,7 @@ export default {
176
199
  'declaration-property-value-disallowed-list': refuse(refusedValues),
177
200
  'declaration-property-value-allowed-list': allow(allowedValues),
178
201
  'rule-selector-property-disallowed-list': [{ '/.*/': refusedProperties.properties }, { message: refusedProperties.message }],
202
+ [inlineType]: true,
179
203
  'declaration-no-important': [true, { message: `!important fights the system: settle it once, in the theme, or not at all (${guide}).` }],
180
204
  'selector-disallowed-list': [refusedSelectors.selectors, { message: refusedSelectors.message }],
181
205
  },
package/words.json CHANGED
@@ -541,6 +541,7 @@
541
541
  { "name": "Upload", "means": "Files from your device (buttons.md § Naming the action)." },
542
542
  { "name": "Delete", "means": "It stops existing for everyone, and nobody can bring it back from the product." },
543
543
  { "name": "Discard", "means": "It was never kept, and goes for good: a recording, a draft. Its glyph is Delete's (buttons.md § The form)." },
544
+ { "name": "Keep editing", "means": "Stays on the screen with the changes still there: the text action when leaving with unsaved changes asks \"Discard changes?\" (AppDialog), in Cancel's place there and nowhere else." },
544
545
  { "name": "Remove", "means": "It leaves this place and still exists: a person from Sharing, a project from a collection, a file from a message." },
545
546
  { "name": "Archive", "means": "Only where there is a place to find archived things and bring them back. Otherwise it is Delete." },
546
547
  { "name": "Share", "means": "Opens Sharing." },