@usableapp/cardds 0.7.179 → 0.7.180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@
6
6
 
7
7
  ## ยังไม่ปล่อย
8
8
 
9
+ ## 0.7.180 — 2026-11-26
10
+
11
+ Components: AddRow, Avatar, AvatarPick, AvatarPickItem, AvatarStack, Banner, Body, Btn, BtnGroup, BtnGroupItem, BtnRow, Bubble, Calendar, CalendarWeeks, CallSheet, Callout, Card, CardArt, CardFeed, CardGrid, CardList, CardMedia, Centre, Chip, ChipChoice, ChipGrid, ChipPick, ChipRow, Composer, ComposerArea, Countdown, Dropdown, EmptyState, Fab, FeedCard, FeedEnd, FeedPost, Field, FileBtn, Foot, Head, Home, Icon, IconRow, JourneyBadge, Kv, KvCell, KvGrid, KvRow, Lead, Link, LinkBlock, MapArea, MapPick, MediaBeside, Menu, MenuItem, MessageBar, Modal, ModalAsk, Mosaic, NoteRow, NoteRows, NumberBand, NumberBandStack, Pager, Pages, Pane, Panes, Pin, Popup, PostBox, PostBoxCard, PostDesk, PostDeskLine, PostLetter, Postcard, Postmark, Ring, Route, Row, Rows, Screen, Sheet, SheetStack, SheetStep, SheetSteps, Snackbar, Spinner, Splash, StackBack, StackSheet, Stamp, StampBook, StampCell, StampOn, StampPlace, Step, Sticky, StickyAnswer, StickyPost, StickyThread, Text, Thread, Tile, TileGrid, Walkthrough, Was, Wave, Words
12
+
13
+ ### Changed
14
+ - **`StackSheet` tabs show their name under the icon; `tabLabels`** (cardds#236, cardds#237): before, every tab of a `StackSheet` head was a round icon `Btn`, its `label` only read aloud, so people could not tell what an icon meant. After: each tab is the icon over its `label` in one line of the caption type (`--fs-2xs`, normal letter width, never wrapped); the chosen tab, while its sheet is open, is a rounded frame round icon and name (`--stack-sheet-tab-radius`, default `--sp-4`), the others the card's muted ink; a `count` sits at the icon's top right and pushes nothing; the tabs stand `--stack-sheet-tabs-named-gap` (default `--sp-3`) apart, a finger's room. `--stack-step` grows by `--sp-6` so a peeking head shows the names (not in `--display` or `--fanned` stacks). `role="tab"`, `aria-selected` and the spoken name (`label` with the count) are as before. `tabLabels={false}` on `StackSheet`, `SheetStack` or `Home` is the old look: icon buttons alone, `--sp-6` apart, the old `--stack-step`; a sheet's own `tabLabels` wins over the stack's. Stories `SheetStack · TabNamesHome` · `TabNamesNeighbour` · `TabNamesHelp` · `TabNamesOff`; every `Home` story and `FrameScreens · HomeFrame` shift.
15
+
9
16
  ## 0.7.179 — 2026-11-19
10
17
 
11
18
  A notification can be one line of words, a `Bubble` can quote the message it answers, a `Mosaic` takes 2 to 10 photos, a centred box stands by its own 40% point, and `Thumb` is new.
package/bin/cardds.mjs CHANGED
@@ -6,11 +6,12 @@
6
6
  // `npx cardds codemod-head [--check] <files or folders…>` — rewrite every Head written with children to its variant and slots (scripts/codemod-head.mjs).
7
7
  // `npx cardds list | get <Name> | find [words…] [--represents a,b] [--shape s] [--interact k|none] | scaffold [id]` — the component catalog (lib/catalog.mjs) for an AI session; `npx cardds mcp` serves the same over MCP.
8
8
  import { existsSync, readFileSync, readdirSync, statSync, mkdirSync, copyFileSync } from 'node:fs';
9
- import { dirname, join, relative, resolve } from 'node:path';
9
+ import { basename, dirname, join, relative, resolve } from 'node:path';
10
10
  import { fileURLToPath } from 'node:url';
11
11
  import { checkSource } from '../lint/rules.mjs';
12
12
  import * as catalog from '../lib/catalog.mjs';
13
13
  import { GUIDE } from '../lib/guide.mjs';
14
+ import * as screens from '../lib/audit.mjs';
14
15
 
15
16
  const PKG = join(dirname(fileURLToPath(import.meta.url)), '..');
16
17
  const [cmd, ...args] = process.argv.slice(2);
@@ -154,7 +155,26 @@ function ask(cmd, argv) {
154
155
  return 0;
155
156
  }
156
157
 
158
+ const auditAsText = {
159
+ questions: (rules) => rules.flatMap((rule) => [`${rule.rule} ${rule.name}`, ...rule.questions.map((question) => ` - ${question}`)]).join('\n'),
160
+ items: (items, pages) => (items.length
161
+ ? items.map((item) => `rule ${item.rule} ${item.page ? `[${item.page}] ` : ''}${item.where}\n ${item.says}`).join('\n')
162
+ : `cardds audit: clean (${pages} page${pages === 1 ? '' : 's'} read)`),
163
+ };
164
+
165
+ function auditFiles(argv) {
166
+ const json = argv.includes('--json');
167
+ const files = argv.filter((arg) => arg !== '--json');
168
+ const missing = files.filter((file) => !existsSync(resolve(cwd, file)) || !statSync(resolve(cwd, file)).isFile());
169
+ if (missing.length) { for (const file of missing) console.error(`cardds audit: ${file}: no such file — \`npx cardds audit <file.html …>\``); return 2; }
170
+ const pages = files.map((file) => ({ name: basename(file), html: readFileSync(resolve(cwd, file), 'utf8') }));
171
+ const result = pages.length === 0 ? screens.audit() : pages.length === 1 ? screens.audit({ html: pages[0].html }) : screens.audit({ pages });
172
+ if (json) console.log(JSON.stringify(result));
173
+ else console.log(pages.length === 0 ? auditAsText.questions(result) : auditAsText.items(result, pages.length));
174
+ return pages.length && result.length ? 1 : 0;
175
+ }
176
+
157
177
  const codemod = (which, a) => import(`../scripts/${which}.mjs`).then((m) => m.main(a), (e) => { console.error(`cardds ${which}: ${e.code === 'ERR_MODULE_NOT_FOUND' ? 'it reads the TypeScript compiler: install `typescript` in the project' : e.message}`); return 2; });
158
- const code = cmd === 'check' ? check(args) : cmd === 'codemod-parts' || cmd === 'codemod-head' ? await codemod(cmd, args) : cmd === 'init' ? init() : cmd === 'guide' ? (process.stdout.write(GUIDE), 0) : ['list', 'get', 'find', 'scaffold', 'mcp'].includes(cmd) ? await ask(cmd, args)
159
- : (console.log('usage: cardds init | guide | check [dir…] | codemod-parts [--check] <files…> | codemod-head [--check] <files or folders…> | list | get <Name> [--html] | find [words…] [--represents a,b] [--shape s] [--interact k|none] | scaffold [id] [--html [--css <href>]] | mcp (list get find scaffold mcp: --root <path> --json)'), cmd ? 2 : 0);
178
+ const code = cmd === 'check' ? check(args) : cmd === 'audit' ? auditFiles(args) : cmd === 'codemod-parts' || cmd === 'codemod-head' ? await codemod(cmd, args) : cmd === 'init' ? init() : cmd === 'guide' ? (process.stdout.write(GUIDE), 0) : ['list', 'get', 'find', 'scaffold', 'mcp'].includes(cmd) ? await ask(cmd, args)
179
+ : (console.log('usage: cardds init | guide | check [dir…] | audit [--json] [file.html…] | codemod-parts [--check] <files…> | codemod-head [--check] <files or folders…> | list | get <Name> [--html] | find [words…] [--represents a,b] [--shape s] [--interact k|none] | scaffold [id] [--html [--css <href>]] | mcp (list get find scaffold mcp: --root <path> --json)'), cmd ? 2 : 0);
160
180
  process.exitCode = code; // not process.exit: a big answer piped to a reader is cut off by an exit before it is flushed
package/css/parts.css CHANGED
@@ -192,7 +192,10 @@
192
192
  .head:has(> .tile-badge:first-child + .head__chips) { row-gap: var(--head-words-gap, var(--sp-1)); }
193
193
  .head:has(> .tile-badge:first-child + .head__chips) > :is(.tile-badge:first-child, .head__chips) { margin-block-end: max(0rem, calc(var(--head-group-gap, var(--sp-5)) - var(--head-words-gap, var(--sp-1)))); } /* the date and its chips both keep it, so the stretched date stays as tall as the chips */
194
194
  .head__chips { grid-column: 2; grid-row: 1; align-self: stretch; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: var(--head-chips-gap, var(--head-col-gap, var(--sp-3))); }
195
- .head__chips-top { min-height: calc(round(down, calc(var(--fs-sm) * var(--chip-sm-line, var(--lh-body))), 1px) + 2 * var(--chip-sm-pad-y, var(--sp-0)) + 2 * var(--border-w)); } /* one small chip tall (actions.css: a head's chips) */
195
+ .head__chips-top, .head__fold { min-height: calc(round(down, calc(var(--fs-sm) * var(--chip-sm-line, var(--lh-body))), 1px) + 2 * var(--chip-sm-pad-y, var(--sp-0)) + 2 * var(--border-w)); } /* one small chip tall (actions.css: a head's chips) */
196
+ .head:has(> .tile-badge:first-child + :is(.chip-row, .head__chips)):has(> .head__fold) { grid-template-columns: auto minmax(0, 1fr) auto; }
197
+ .head:has(> .tile-badge:first-child + :is(.chip-row, .head__chips)) > .head__fold.head__fold { grid-column: 3; grid-row: 1; align-self: center; display: flex; align-items: center; }
198
+ .head:has(> .tile-badge:first-child + .head__chips) > .head__fold.head__fold { align-self: start; }
196
199
 
197
200
  /* a head that LEADS with a person or a thing (Lh 2026-10-28, timebank's welcome card; re-laid for a phone's width the same day): a `Head` whose
198
201
  first child is a `Lead`, an `Avatar` or an `AvatarStack` (a stamp in one) and whose second is the `Words` title. The lead at the left, as tall
package/css/stack.css CHANGED
@@ -301,7 +301,7 @@
301
301
  border-color var(--motion-sheet) var(--ease),
302
302
  box-shadow var(--motion-sheet) var(--ease);
303
303
  }
304
- .stack-sheet__tab > .stack-sheet__count { /* outranks .badge (numbers.css loads after this file) */
304
+ :is(.stack-sheet__tab, .stack-sheet__tab-icon) > .stack-sheet__count { /* outranks .badge (numbers.css loads after this file) */
305
305
  position: absolute;
306
306
  top: calc(-1 * var(--stack-sheet-count-out, var(--sp-2))); /* how far it stands OUT of the tab's corner, up and to the right: at sp-1 it
307
307
  sat exactly on the chosen tab's disc edge — it reads as a mark beside the icon, not part of the disc (Lh 2026-10-01) */
@@ -329,6 +329,48 @@
329
329
  sp-4 since Lh 2026-10-30 (was sp-2): the last tab's count badge still stood almost cropped by the corner */
330
330
  .head > .stack-sheet__tabs { margin-right: var(--stack-sheet-tabs-end, var(--sp-4)); }
331
331
 
332
+ .stack-sheet__tabs--named { align-items: flex-start; gap: var(--stack-sheet-tabs-named-gap, var(--sp-3)); }
333
+ .head > .stack-sheet__tabs--named { margin-right: 0; }
334
+ .stack-sheet__tab.stack-sheet__tab--named {
335
+ flex: none;
336
+ display: grid;
337
+ justify-items: center;
338
+ gap: var(--stack-sheet-tab-gap, var(--sp-0));
339
+ width: auto;
340
+ height: auto;
341
+ margin: 0;
342
+ padding: var(--stack-sheet-tab-pad, var(--sp-2) var(--sp-2) var(--sp-1));
343
+ border: 0;
344
+ border-radius: var(--stack-sheet-tab-radius, var(--sp-4));
345
+ background: transparent;
346
+ box-shadow: none;
347
+ color: var(--stack-sheet-tab-ink, var(--card-muted));
348
+ font: var(--fw-caption) var(--fs-2xs) / var(--lh-label) var(--face-caption);
349
+ white-space: nowrap;
350
+ text-align: center;
351
+ cursor: pointer;
352
+ touch-action: manipulation;
353
+ }
354
+ .stack-sheet__tab-icon { position: relative; display: inline-flex; }
355
+ .stack-sheet__tab-name { display: block; }
356
+ .stack-sheet__tab-icon > .stack-sheet__count {
357
+ right: auto;
358
+ left: calc(100% - var(--sp-1) - var(--sp-0));
359
+ }
360
+ .stack-sheet__tab.stack-sheet__tab--named[aria-selected="true"] {
361
+ background: var(--icon-btn-invert-bg, var(--btn-primary-bg, var(--accent)));
362
+ color: var(--icon-btn-invert-ink, var(--btn-primary-ink, var(--on-accent)));
363
+ }
364
+ .stack-sheet__tab--named:active { scale: var(--press-scale); }
365
+ .stack-sheet__tab--named:focus-visible { outline: var(--focus); outline-offset: var(--sp-1); }
366
+ .sheet-stack--tap > .card:not(.is-open) > .head .stack-sheet__tab.stack-sheet__tab--named[aria-selected="true"] {
367
+ background: transparent;
368
+ color: var(--stack-sheet-tab-ink, var(--card-muted));
369
+ }
370
+ .sheet-stack:not(.sheet-stack--display, .sheet-stack--fanned):has(.head .stack-sheet__tab--named) {
371
+ --stack-step: calc(var(--card-pad-rest) + var(--tap) + var(--card-gap-rest) + var(--sp-6));
372
+ }
373
+
332
374
  /* AT THE END (Lh 2026-09-29, the home): after the tabs, chevron down — the open sheet folds down. The head's end gives it its room
333
375
  while open; the last tab then sits on the inset (no reach into the padding) */
334
376
  :is(.sheet-stack--tap > .card, .sheet-stack--tap > :not(.card, .sheet-stack__base) > .card) > .head > .sheet-stack__back--end { left: auto; right: 0; } /* as specific as the rule that sets it at the start (above), so it wins: a shorter selector lost, and the back stood over the title */
package/dist/cardds.css CHANGED
@@ -2053,7 +2053,7 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
2053
2053
  border-color var(--motion-sheet) var(--ease),
2054
2054
  box-shadow var(--motion-sheet) var(--ease);
2055
2055
  }
2056
- .stack-sheet__tab > .stack-sheet__count { /* outranks .badge (numbers.css loads after this file) */
2056
+ :is(.stack-sheet__tab, .stack-sheet__tab-icon) > .stack-sheet__count { /* outranks .badge (numbers.css loads after this file) */
2057
2057
  position: absolute;
2058
2058
  top: calc(-1 * var(--stack-sheet-count-out, var(--sp-2))); /* how far it stands OUT of the tab's corner, up and to the right: at sp-1 it
2059
2059
  sat exactly on the chosen tab's disc edge — it reads as a mark beside the icon, not part of the disc (Lh 2026-10-01) */
@@ -2081,6 +2081,48 @@ button:enabled { cursor: pointer; } /* a disabled one keeps the arrow */
2081
2081
  sp-4 since Lh 2026-10-30 (was sp-2): the last tab's count badge still stood almost cropped by the corner */
2082
2082
  .head > .stack-sheet__tabs { margin-right: var(--stack-sheet-tabs-end, var(--sp-4)); }
2083
2083
 
2084
+ .stack-sheet__tabs--named { align-items: flex-start; gap: var(--stack-sheet-tabs-named-gap, var(--sp-3)); }
2085
+ .head > .stack-sheet__tabs--named { margin-right: 0; }
2086
+ .stack-sheet__tab.stack-sheet__tab--named {
2087
+ flex: none;
2088
+ display: grid;
2089
+ justify-items: center;
2090
+ gap: var(--stack-sheet-tab-gap, var(--sp-0));
2091
+ width: auto;
2092
+ height: auto;
2093
+ margin: 0;
2094
+ padding: var(--stack-sheet-tab-pad, var(--sp-2) var(--sp-2) var(--sp-1));
2095
+ border: 0;
2096
+ border-radius: var(--stack-sheet-tab-radius, var(--sp-4));
2097
+ background: transparent;
2098
+ box-shadow: none;
2099
+ color: var(--stack-sheet-tab-ink, var(--card-muted));
2100
+ font: var(--fw-caption) var(--fs-2xs) / var(--lh-label) var(--face-caption);
2101
+ white-space: nowrap;
2102
+ text-align: center;
2103
+ cursor: pointer;
2104
+ touch-action: manipulation;
2105
+ }
2106
+ .stack-sheet__tab-icon { position: relative; display: inline-flex; }
2107
+ .stack-sheet__tab-name { display: block; }
2108
+ .stack-sheet__tab-icon > .stack-sheet__count {
2109
+ right: auto;
2110
+ left: calc(100% - var(--sp-1) - var(--sp-0));
2111
+ }
2112
+ .stack-sheet__tab.stack-sheet__tab--named[aria-selected="true"] {
2113
+ background: var(--icon-btn-invert-bg, var(--btn-primary-bg, var(--accent)));
2114
+ color: var(--icon-btn-invert-ink, var(--btn-primary-ink, var(--on-accent)));
2115
+ }
2116
+ .stack-sheet__tab--named:active { scale: var(--press-scale); }
2117
+ .stack-sheet__tab--named:focus-visible { outline: var(--focus); outline-offset: var(--sp-1); }
2118
+ .sheet-stack--tap > .card:not(.is-open) > .head .stack-sheet__tab.stack-sheet__tab--named[aria-selected="true"] {
2119
+ background: transparent;
2120
+ color: var(--stack-sheet-tab-ink, var(--card-muted));
2121
+ }
2122
+ .sheet-stack:not(.sheet-stack--display, .sheet-stack--fanned):has(.head .stack-sheet__tab--named) {
2123
+ --stack-step: calc(var(--card-pad-rest) + var(--tap) + var(--card-gap-rest) + var(--sp-6));
2124
+ }
2125
+
2084
2126
  /* AT THE END (Lh 2026-09-29, the home): after the tabs, chevron down — the open sheet folds down. The head's end gives it its room
2085
2127
  while open; the last tab then sits on the inset (no reach into the padding) */
2086
2128
  :is(.sheet-stack--tap > .card, .sheet-stack--tap > :not(.card, .sheet-stack__base) > .card) > .head > .sheet-stack__back--end { left: auto; right: 0; } /* as specific as the rule that sets it at the start (above), so it wins: a shorter selector lost, and the back stood over the title */
@@ -4941,7 +4983,10 @@ a.bubble { color: inherit; text-decoration: none; }
4941
4983
  .head:has(> .tile-badge:first-child + .head__chips) { row-gap: var(--head-words-gap, var(--sp-1)); }
4942
4984
  .head:has(> .tile-badge:first-child + .head__chips) > :is(.tile-badge:first-child, .head__chips) { margin-block-end: max(0rem, calc(var(--head-group-gap, var(--sp-5)) - var(--head-words-gap, var(--sp-1)))); } /* the date and its chips both keep it, so the stretched date stays as tall as the chips */
4943
4985
  .head__chips { grid-column: 2; grid-row: 1; align-self: stretch; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: var(--head-chips-gap, var(--head-col-gap, var(--sp-3))); }
4944
- .head__chips-top { min-height: calc(round(down, calc(var(--fs-sm) * var(--chip-sm-line, var(--lh-body))), 1px) + 2 * var(--chip-sm-pad-y, var(--sp-0)) + 2 * var(--border-w)); } /* one small chip tall (actions.css: a head's chips) */
4986
+ .head__chips-top, .head__fold { min-height: calc(round(down, calc(var(--fs-sm) * var(--chip-sm-line, var(--lh-body))), 1px) + 2 * var(--chip-sm-pad-y, var(--sp-0)) + 2 * var(--border-w)); } /* one small chip tall (actions.css: a head's chips) */
4987
+ .head:has(> .tile-badge:first-child + :is(.chip-row, .head__chips)):has(> .head__fold) { grid-template-columns: auto minmax(0, 1fr) auto; }
4988
+ .head:has(> .tile-badge:first-child + :is(.chip-row, .head__chips)) > .head__fold.head__fold { grid-column: 3; grid-row: 1; align-self: center; display: flex; align-items: center; }
4989
+ .head:has(> .tile-badge:first-child + .head__chips) > .head__fold.head__fold { align-self: start; }
4945
4990
 
4946
4991
  /* a head that LEADS with a person or a thing (Lh 2026-10-28, timebank's welcome card; re-laid for a phone's width the same day): a `Head` whose
4947
4992
  first child is a `Lead`, an `Avatar` or an `AvatarStack` (a stamp in one) and whose second is the `Words` title. The lead at the left, as tall
@@ -82,7 +82,7 @@ export interface CardProps extends ComponentProps<'article'> {
82
82
  removeLabel?: string;
83
83
  /** THE FOLD — the card can fold to its head: folded, only its `Head` shows; a tap on the head (not on a control in it) opens the rest
84
84
  * (the content and the `Foot`), another folds it again. The rest opens and folds as a grid row, nothing jumps; folded it is `inert`.
85
- * The card draws its own chevron down as the head's last `end` (after the app's own ends), turned up while open, as a Banner's; it stands on the middle of the WHOLE head, not on the title's first line as the other ends do.
85
+ * The card draws its own chevron down as the head's last `end` (after the app's own ends), turned up while open, as a Banner's; it stands on the middle of the WHOLE head, not on the title's first line as the other ends do. In a `Head variant="date"` (with its date and chips) it stands instead at the head's top right, beside the chips, and takes no row under the title.
86
86
  * The keyboard and a screen reader meet ONE unseen button after the head, named by the head (or `openLabel`), that says open or folded.
87
87
  * The card finds its `Head` by type, as a two-faced card does. Not on a `row`, `sm`, `stack`, `paper="bands"` card, nor with `back` or `onPress`:
88
88
  * there it is ignored. A folding card is never pressed whole (the head is its press). Knob: none — the motion is the sheet's (`--motion-sheet`) */
@@ -153,7 +153,10 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, wide, band, as
153
153
  if (folding) {
154
154
  const headId = headKid.props.id ?? `${foldId}h`;
155
155
  const rest = kids.filter((c) => c !== headKid);
156
- return createElement(as, props, inner(_jsxs(_Fragment, { children: [cloneElement(headKid, { id: headId, end: _jsxs(_Fragment, { children: [headKid.props.end, _jsx("span", { className: "card__fold", children: _jsx(Icon, { name: "chevron-down", size: "sm", className: "card__chevron" }) })] }) }), _jsx("button", { type: "button", className: "card__open", "aria-expanded": opened, "aria-controls": `${foldId}r`, ...(openLabel ? { 'aria-label': openLabel } : { 'aria-labelledby': headId }), onClick: () => askOpen(!opened) }), _jsx("div", { className: "card__more", id: `${foldId}r`, inert: folded, children: _jsx("div", { className: "card__rest", children: rest }) })] })));
156
+ const chevron = _jsx(Icon, { name: "chevron-down", size: "sm", className: "card__chevron" });
157
+ const dateHead = headKid.props.variant === 'date' && headKid.props.lead != null && (headKid.props.chips != null || headKid.props.chipsBelow != null);
158
+ const foldMark = dateHead ? { fold: chevron } : { end: _jsxs(_Fragment, { children: [headKid.props.end, _jsx("span", { className: "card__fold", children: chevron })] }) };
159
+ return createElement(as, props, inner(_jsxs(_Fragment, { children: [cloneElement(headKid, { id: headId, ...foldMark }), _jsx("button", { type: "button", className: "card__open", "aria-expanded": opened, "aria-controls": `${foldId}r`, ...(openLabel ? { 'aria-label': openLabel } : { 'aria-labelledby': headId }), onClick: () => askOpen(!opened) }), _jsx("div", { className: "card__more", id: `${foldId}r`, inert: folded, children: _jsx("div", { className: "card__rest", children: rest }) })] })));
157
160
  }
158
161
  if (turns) {
159
162
  const ownHeadKid = kids.find((c) => isValidElement(c) && c.type === Head);