@usableapp/cardds 0.7.138 → 0.7.140

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.
@@ -37,9 +37,9 @@ export interface FieldProps extends Omit<ComponentProps<'input'>, 'className' |
37
37
  /** the digits of `v`, written into `mask`; a mark is written only when a digit comes after it */
38
38
  export declare function applyMask(v: string, mask: string): string;
39
39
  /**
40
- * Field — the flat outlined input, and where a form field goes is the SHEET: the paper the member fills in, never a Card (Lh 2026-10-18).
41
- * It stands on a Sheet's `Body`, in a `SheetStep`, or on a stack sheet, 1–3 per step; a card is for reading and pressing buttons
42
- * (`cardds check` rule `field-in-card` flags a Field, or any control the member fills or picks, inside a `<Card>`).
40
+ * Field — the flat outlined input. A form's fields stand on the SHEET, the paper the member fills in (Lh 2026-10-18): a Sheet's `Body`, a
41
+ * `SheetStep`, or a stack sheet, 1–3 per step. One Field may also stand on a `Card`, either face — words written on the card itself, a
42
+ * thank-you (Lh 2026-10-26); the other controls the member fills or picks never do (`cardds check` rule `field-in-card`).
43
43
  * The LABEL IS THE PLACEHOLDER. 48px tall (56px with an action inside).
44
44
  * Variation `rows={n}`: several lines in the same frame, for what the member writes in words (the request and its reason on the ask
45
45
  * sheet: `<Field rows={4} />` over `<Field rows={2} />`). A frame says "tap me", so a framed write-in is a Field, never a Composer:
@@ -20,9 +20,9 @@ export function applyMask(v, mask) {
20
20
  return out;
21
21
  }
22
22
  /**
23
- * Field — the flat outlined input, and where a form field goes is the SHEET: the paper the member fills in, never a Card (Lh 2026-10-18).
24
- * It stands on a Sheet's `Body`, in a `SheetStep`, or on a stack sheet, 1–3 per step; a card is for reading and pressing buttons
25
- * (`cardds check` rule `field-in-card` flags a Field, or any control the member fills or picks, inside a `<Card>`).
23
+ * Field — the flat outlined input. A form's fields stand on the SHEET, the paper the member fills in (Lh 2026-10-18): a Sheet's `Body`, a
24
+ * `SheetStep`, or a stack sheet, 1–3 per step. One Field may also stand on a `Card`, either face — words written on the card itself, a
25
+ * thank-you (Lh 2026-10-26); the other controls the member fills or picks never do (`cardds check` rule `field-in-card`).
26
26
  * The LABEL IS THE PLACEHOLDER. 48px tall (56px with an action inside).
27
27
  * Variation `rows={n}`: several lines in the same frame, for what the member writes in words (the request and its reason on the ask
28
28
  * sheet: `<Field rows={4} />` over `<Field rows={2} />`). A frame says "tap me", so a framed write-in is a Field, never a Composer:
@@ -31,7 +31,7 @@ export interface PinProps extends Omit<ComponentProps<'div'>, 'onChange' | 'defa
31
31
  autoFocus?: boolean;
32
32
  }
33
33
  /**
34
- * Pin — big code entry, one digit per pill; a filled cell turns accent. Lives on a sheet, never in a Card: the sheet is the paper the member fills in (Lh 2026-10-18).
34
+ * Pin — big code entry, one digit per pill; a filled cell turns accent. Lives on a sheet (the paper the member fills in, Lh 2026-10-18), or on a `Card`, either face — a code typed on the card itself (Lh 2026-10-26).
35
35
  * Its own behaviour, inside it: typing a digit moves to the next cell, Backspace in an empty cell moves back and clears, the
36
36
  * arrows walk the cells, a pasted code fills them from the one it landed in; only digits stay. The first cell takes the SMS
37
37
  * one-time-code autofill. The code is a VALUE, controlled like an input: `value` + `onChange`, or `defaultValue`.
package/dist/forms/Pin.js CHANGED
@@ -7,7 +7,7 @@ import { word } from '../words.js';
7
7
  import { useStepCursor } from '../sheets/stepCursor.js';
8
8
  const RESET_MS = 900; // a code that does not match: red + shake this long, then the cells empty for a new try
9
9
  /**
10
- * Pin — big code entry, one digit per pill; a filled cell turns accent. Lives on a sheet, never in a Card: the sheet is the paper the member fills in (Lh 2026-10-18).
10
+ * Pin — big code entry, one digit per pill; a filled cell turns accent. Lives on a sheet (the paper the member fills in, Lh 2026-10-18), or on a `Card`, either face — a code typed on the card itself (Lh 2026-10-26).
11
11
  * Its own behaviour, inside it: typing a digit moves to the next cell, Backspace in an empty cell moves back and clears, the
12
12
  * arrows walk the cells, a pasted code fills them from the one it landed in; only digits stay. The first cell takes the SMS
13
13
  * one-time-code autofill. The code is a VALUE, controlled like an input: `value` + `onChange`, or `defaultValue`.
@@ -9,6 +9,8 @@ export interface StackSheetTab {
9
9
  label: string;
10
10
  /** a small count over the icon: what waits there (alerts, new asks); 0 or none = no circle */
11
11
  count?: number;
12
+ /** words before the count in its circle, the app's: `'+'` draws "+1" (new ones came). Shown only with a count; a screen reader hears it with the count */
13
+ countPrefix?: string;
12
14
  }
13
15
  export interface StackSheetProps extends Omit<ComponentProps<'article'>, 'title'> {
14
16
  /** the SHEET HEAD's title — an h2 (the page's h1 is its own) */
@@ -43,7 +45,7 @@ export interface StackSheetProps extends Omit<ComponentProps<'article'>, 'title'
43
45
  * StackSheet — ONE sheet of a `SheetStack`, in the one sheet shape: SHEET HEAD (back · title · tabs or an icon) pinned at the top ·
44
46
  * `top` (pinned under the head, optional) · SHEET BODY (the children; scrolls) · SHEET FOOT (`foot`, the CTA) at the bottom. Its tabs are icon buttons. The chosen one is filled
45
47
  * only while this sheet is open — a closed home shows every icon plain; the disc fades in with the rise and out with the fold.
46
- * A count shows as a small circle over its icon. The body is the app's: render the page of the chosen tab (and nothing while the sheet
48
+ * A count shows as a small circle over its icon (`countPrefix` writes before it: "+1"), and is read with the tab's name. The body is the app's: render the page of the chosen tab (and nothing while the sheet
47
49
  * is closed — see `Home`). A direct child of `SheetStack`. Once open, cardds puts the cursor in the field marked `data-autofocus`, else the first field, else the heading — write no focus code.
48
50
  */
49
51
  export declare function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defaultTab, onTabChange, top, foot, backLabel, backAt, stack, className, children, ...rest }: StackSheetProps): import("react").JSX.Element;
@@ -17,7 +17,7 @@ import { runOver } from './sheetMeasure.js';
17
17
  * StackSheet — ONE sheet of a `SheetStack`, in the one sheet shape: SHEET HEAD (back · title · tabs or an icon) pinned at the top ·
18
18
  * `top` (pinned under the head, optional) · SHEET BODY (the children; scrolls) · SHEET FOOT (`foot`, the CTA) at the bottom. Its tabs are icon buttons. The chosen one is filled
19
19
  * only while this sheet is open — a closed home shows every icon plain; the disc fades in with the rise and out with the fold.
20
- * A count shows as a small circle over its icon. The body is the app's: render the page of the chosen tab (and nothing while the sheet
20
+ * A count shows as a small circle over its icon (`countPrefix` writes before it: "+1"), and is read with the tab's name. The body is the app's: render the page of the chosen tab (and nothing while the sheet
21
21
  * is closed — see `Home`). A direct child of `SheetStack`. Once open, cardds puts the cursor in the field marked `data-autofocus`, else the first field, else the heading — write no focus code.
22
22
  */
23
23
  export function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defaultTab, onTabChange, top, foot, backLabel = word('back'), backAt = 'none', stack, className, children, ...rest }) {
@@ -34,5 +34,8 @@ export function StackSheet({ title, tone, paper, icon, tabs, tab: tabProp, defau
34
34
  measure();
35
35
  return watchSize([h, run], measure);
36
36
  }, [title]);
37
- return (_jsxs(Card, { stack: stack, tone: tone, paper: paper, className: cx('stack-sheet', className), ...rest, children: [_jsxs(Head, { ref: headRef, long: long, children: [backAt === 'start' && _jsx(StackBack, { label: backLabel }), _jsx(Words, { title: _jsx("span", { className: "stack-sheet__run", children: title }) }), tabs?.length ? (_jsx("span", { className: "stack-sheet__tabs", role: "tablist", children: tabs.map((t) => (_jsxs(IconBtn, { sm: true, invert: t.id === tab, role: "tab", "aria-selected": t.id === tab, label: t.label, className: "stack-sheet__tab", onClick: () => pick(t.id), children: [_jsx(Icon, { name: t.icon }), t.count ? _jsx(Badge, { className: "stack-sheet__count", children: t.count > 99 ? '99+' : t.count }) : null] }, t.id))) })) : icon, backAt === 'end' && _jsx(StackBack, { end: true, label: backLabel })] }), top != null && _jsx("div", { className: "stack-sheet__top", children: top }), _jsx(Body, { role: tabs?.length ? 'tabpanel' : undefined, children: children }), foot != null && _jsx(Foot, { children: foot })] }));
37
+ return (_jsxs(Card, { stack: stack, tone: tone, paper: paper, className: cx('stack-sheet', className), ...rest, children: [_jsxs(Head, { ref: headRef, long: long, children: [backAt === 'start' && _jsx(StackBack, { label: backLabel }), _jsx(Words, { title: _jsx("span", { className: "stack-sheet__run", children: title }) }), tabs?.length ? (_jsx("span", { className: "stack-sheet__tabs", role: "tablist", children: tabs.map((t) => {
38
+ const count = t.count ? `${t.countPrefix ?? ''}${t.count > 99 ? '99+' : t.count}` : '';
39
+ return (_jsxs(IconBtn, { sm: true, invert: t.id === tab, role: "tab", "aria-selected": t.id === tab, label: count ? `${t.label} ${count}` : t.label, className: "stack-sheet__tab", onClick: () => pick(t.id), children: [_jsx(Icon, { name: t.icon }), count ? _jsx(Badge, { className: "stack-sheet__count", children: count }) : null] }, t.id));
40
+ }) })) : icon, backAt === 'end' && _jsx(StackBack, { end: true, label: backLabel })] }), top != null && _jsx("div", { className: "stack-sheet__top", children: top }), _jsx(Body, { role: tabs?.length ? 'tabpanel' : undefined, children: children }), foot != null && _jsx(Foot, { children: foot })] }));
38
41
  }
@@ -3,11 +3,14 @@
3
3
  * a fixed size (a round with a number, a button, the top bar) is drawn for the theme's text — at a larger text the words outgrew
4
4
  * it; growing the things at the same rate would zoom the whole UI and leave no room for content (Lh 2026-10-03, pairs set by
5
5
  * measuring the gallery: 115 → 107.5 · 130 → 115 · 145 → 122.5 · 160 → 130). A smaller text never shrinks a control.
6
+ * The FORM controls are not on this rate: a field, a button, a chip, a Pin cell, a switch, a check, a segmented choice follow the
7
+ * words in full (Lh 2026-10-26 — tokens.css `--form-tap`, `--btn-h`: the larger of their `--tap-base` and the same share of `--fs-base`).
6
8
  */
7
9
  export declare const controlsFor: (percent: number) => number;
8
10
  /**
9
11
  * The member's text size: `--fs-base` on <html> as a share of the theme's own base (100 = as the theme set it), and with it
10
- * `--tap-base` — the things grow half as much as the words (`controlsFor`), so a larger text still fits what holds it.
12
+ * `--tap-base` — the things grow half as much as the words (`controlsFor`), so a larger text still fits what holds it; the form
13
+ * controls (fields, buttons, chips, Pin, switches) grow as much as the words, being sized on `--fs-base` too.
11
14
  * The bases are read from the CSS (cardds's default or the project's theme.css) — never copied into app code. Keeping the choice
12
15
  * (localStorage, an account) is the app's.
13
16
  */
@@ -3,11 +3,14 @@
3
3
  * a fixed size (a round with a number, a button, the top bar) is drawn for the theme's text — at a larger text the words outgrew
4
4
  * it; growing the things at the same rate would zoom the whole UI and leave no room for content (Lh 2026-10-03, pairs set by
5
5
  * measuring the gallery: 115 → 107.5 · 130 → 115 · 145 → 122.5 · 160 → 130). A smaller text never shrinks a control.
6
+ * The FORM controls are not on this rate: a field, a button, a chip, a Pin cell, a switch, a check, a segmented choice follow the
7
+ * words in full (Lh 2026-10-26 — tokens.css `--form-tap`, `--btn-h`: the larger of their `--tap-base` and the same share of `--fs-base`).
6
8
  */
7
9
  export const controlsFor = (percent) => 100 + Math.max(0, percent - 100) / 2;
8
10
  /**
9
11
  * The member's text size: `--fs-base` on <html> as a share of the theme's own base (100 = as the theme set it), and with it
10
- * `--tap-base` — the things grow half as much as the words (`controlsFor`), so a larger text still fits what holds it.
12
+ * `--tap-base` — the things grow half as much as the words (`controlsFor`), so a larger text still fits what holds it; the form
13
+ * controls (fields, buttons, chips, Pin, switches) grow as much as the words, being sized on `--fs-base` too.
11
14
  * The bases are read from the CSS (cardds's default or the project's theme.css) — never copied into app code. Keeping the choice
12
15
  * (localStorage, an account) is the app's.
13
16
  */
package/docs/reference.md CHANGED
@@ -665,9 +665,13 @@ between at 40% down the screen (see *Anatomy*, "Where the centre is"):
665
665
  and `ComposerArea`, `Pin`, `Dropdown`, `Slider`, `Toggle`, `Check`,
666
666
  `ChipPick`, `Calendar`, `CalendarWeeks`, `HourGrid`, `DayStrip` and `Day`, `Picker`, `Mood`,
667
667
  `AvatarPick`, `FileBtn`, `AddRow`, `MapPick`, a `Tile pick` and a
668
- `Tile upload`. A card is for reading and pressing buttons only; never put
669
- a form, or one control of it, in a card. `cardds check` rule
670
- `field-in-card` (error) flags a control written inside a `<Card>`. A `Card`
668
+ `Tile upload`. A card is for reading and pressing buttons; never put
669
+ a form in a card. Two exceptions (Lh 2026-10-26): a `Pin` and a `Field`
670
+ may stand on a `Card`, on either face — a code typed on the card itself
671
+ (the helper's code on a turned card's back), words written on it (a
672
+ thank-you on its front). Every other control stays on a sheet. `cardds
673
+ check` rule `field-in-card` (error) flags the others written inside a
674
+ `<Card>`. A `Card`
671
675
  that is a sheet of a `SheetStack` is that stack's sheet, so it may hold
672
676
  them. Seen in timebank's help-ask prototype: a Composer, a Dropdown and a
673
677
  map on white cards inside the help sheet, the cards the colour of the
@@ -1159,7 +1163,7 @@ Rules:
1159
1163
  Both name the tokens to move.
1160
1164
  - The member's text-size setting is the same `--fs-base`, written on `<html>`
1161
1165
  at run time by `setTextScale(percent)` (a share of the theme's base; 100 = the
1162
- theme's own): the words grow, and the things grow HALF as much (`--tap-base`; `controlsFor(percent)` — 130% text → 115% controls, 160% → 130%), so a larger text still fits what holds it. (`--text-scale`, which multiplied the root and zoomed the UI too, is gone.)
1166
+ theme's own): the words grow, and the things grow HALF as much (`--tap-base`; `controlsFor(percent)` — 130% text → 115% controls, 160% → 130%), so a larger text still fits what holds it. The FORM controls grow as much as the words (Lh 2026-10-26): `Field`, `Btn`, `Chip`/`ChipPick`, `Pin`, `Toggle`, `Check`, `Slider`, `Dropdown`, `BtnGroup look="choice"`, a `SheetStep`'s bar, `Composer` — each is the larger of its size of things and the same share of `--fs-base` (`--form-tap`, `--form-tap-sm`, `--form-tap-lg`, `--btn-h`, `--chip-h`; equal at the default bases), so the field and the words typed in it use the same tokens. (`--text-scale`, which multiplied the root and zoomed the UI too, is gone.)
1163
1167
 
1164
1168
  Try it live: the gallery's nav (`npm run dev`) has a slider per size base, and
1165
1169
  palette `own` shows a colour well per colour base.
@@ -1277,7 +1281,7 @@ platform's: the initial value of a registered length (`@property`), which may no
1277
1281
  lengths a script measures off the page (`--kb`, a sheet's peek, a pulled sheet).
1278
1282
  An app with its own text-size setting calls `setTextScale(percent)`, which writes
1279
1283
  `--fs-base` on `<html>` from the theme's base (100% = the theme's; 160% = 2.2rem by default): the type and its holders (the count
1280
- badge, the inline icon) grow, the controls grow half as much (`--tap-base`), spacing and radii keep their size.
1284
+ badge, the inline icon) and the form controls grow, the other things grow half as much (`--tap-base`), spacing and radii keep their size.
1281
1285
  Components never write a raw length: spacing from `--sp-*`, control sizes from
1282
1286
  `--tap`, `--tap-lg`, `--btn-h`, `--bar-h`, `--header-h`, `--fab`, `--badge`, container
1283
1287
  padding from `--screen-pad` / `--card-pad`, radii from
package/lib/mcp.mjs CHANGED
@@ -71,7 +71,7 @@ const TOOLS = [
71
71
  },
72
72
  {
73
73
  name: 'check_source',
74
- description: 'Run cardds\'s rules over code you wrote (a hand-written cardds class, a Sheet that cannot move, a bar with a sheet…). A person's tool, never a session's step; an empty list means clean.',
74
+ description: "Run cardds's rules over code you wrote (a hand-written cardds class, a Sheet that cannot move, a bar with a sheet…). A person's tool, never a session's step; an empty list means clean.",
75
75
  inputSchema: { type: 'object', properties: { code: str('the .tsx/.jsx source'), filename: str('its file name, for the report (default screen.tsx)') }, required: ['code'] },
76
76
  run: (_cat, a) => catalog.check(a.code, a.filename),
77
77
  },
package/lint/rules.mjs CHANGED
@@ -233,7 +233,7 @@ export function checkSource(source, file, { classes = carddsClasses() } = {}) {
233
233
  }
234
234
 
235
235
  // 10 · the sheet is the paper the member fills in (Lh 2026-10-18): every control the member fills or picks stands on a Sheet's body, a SheetStep
236
- // or a stack sheet; a card is for reading and pressing buttons. A Card that is a sheet of a SheetStack IS a sheet (the stack's material)
236
+ // or a stack sheet; a card is for reading, pressing buttons and typing in a Pin or a Field (Lh 2026-10-26). A Card that is a sheet of a SheetStack IS a sheet (the stack's material)
237
237
  // a `<` right after a name is a type argument (`Record<Step, string>`, `useState<Step>`), not a tag; an element that never closes holds nothing
238
238
  const span = (re) => [...text.matchAll(re)].filter((m) => !/[\w$)\].]/.test(text[m.index - 1] ?? '')).map((m) => {
239
239
  const open = tagAt(text, m.index), el = elementAt(text, m.index), closed = open.endsWith('/>') || el.endsWith(`</${m[0].slice(1).match(/^[\w.]+/)[0]}>`);
@@ -275,10 +275,11 @@ export function checkSource(source, file, { classes = carddsClasses() } = {}) {
275
275
  if (onSheet(c.index) === false) add('field-off-sheet', 'error', c.index, `<${kind ? `Tile ${kind}` : c[1]}> on the ground: a form is never on the ground, it sits only on a sheet (Lh 2026-10-18). A Page, Pages, Step or Screen is the base, not a sheet. Put the control in a Sheet's <Body>, in a <SheetStep>, or on a stack sheet — a form over a screen is a <Sheet> in a <SheetStage over dim> (Home/AskSheet).`);
276
276
  continue;
277
277
  }
278
+ if (c[1] === 'Pin' || c[1] === 'Field') continue; // a code or words typed on the card itself, either face (Lh 2026-10-26, timebank: the helper's code on the card's back, the thank-you on its front)
278
279
  const stack = stacks.filter((s) => card.at >= s.body && card.at < s.end).at(-1);
279
280
  if (stack && !cards.some((o) => o !== card && within(card.at, o) && o.at >= stack.body)) continue;
280
281
  const name = kind ? `Tile ${kind}` : c[1];
281
- add('field-in-card', 'error', c.index, `<${name}> inside a <Card>: the sheet is the paper the member fills in (Lh 2026-10-18) — a card is for reading and pressing buttons. Put the ${name} straight in a Sheet's <Body>, in a <SheetStep>, or on a stack sheet, with no card round it.`);
282
+ add('field-in-card', 'error', c.index, `<${name}> inside a <Card>: the sheet is the paper the member fills in (Lh 2026-10-18) — a card is for reading, pressing buttons and typing in a Pin or a Field. Put the ${name} straight in a Sheet's <Body>, in a <SheetStep>, or on a stack sheet, with no card round it.`);
282
283
  }
283
284
 
284
285
  // 11 · a worded pager bar: back and next never carry the same signal — the forward Btn (the last) is `primary`, the back one is not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.138",
3
+ "version": "0.7.140",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "description": "card-first mobile design system, React-first: the components in src/ are thin wrappers over the CSS contract (css/*.css stays the only truth); gallery/ shows every story live (npm run dev).",