@usableapp/cardds 0.7.139 → 0.7.141
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 +22 -0
- package/css/actions.css +5 -5
- package/css/card.css +2 -0
- package/css/choice.css +23 -22
- package/css/forms.css +3 -3
- package/css/parts.css +2 -2
- package/css/sheet.css +2 -2
- package/css/theme.template.css +1 -1
- package/css/tokens.css +13 -5
- package/dist/cardds.css +50 -39
- package/dist/cards/Card.d.ts +5 -2
- package/dist/cards/Card.js +4 -4
- package/dist/catalog.json +1 -1
- package/dist/forms/Field.d.ts +3 -3
- package/dist/forms/Field.js +3 -3
- package/dist/forms/Pin.d.ts +1 -1
- package/dist/forms/Pin.js +1 -1
- package/dist/parts/Words.d.ts +5 -2
- package/dist/parts/Words.js +6 -5
- package/dist/type/textScale.d.ts +4 -1
- package/dist/type/textScale.js +4 -1
- package/docs/reference.md +12 -7
- package/lint/rules.mjs +3 -2
- package/package.json +1 -1
package/dist/forms/Field.d.ts
CHANGED
|
@@ -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
|
|
41
|
-
*
|
|
42
|
-
* (
|
|
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:
|
package/dist/forms/Field.js
CHANGED
|
@@ -20,9 +20,9 @@ export function applyMask(v, mask) {
|
|
|
20
20
|
return out;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Field — the flat outlined input
|
|
24
|
-
*
|
|
25
|
-
* (
|
|
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:
|
package/dist/forms/Pin.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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`.
|
package/dist/parts/Words.d.ts
CHANGED
|
@@ -4,10 +4,13 @@ export interface WordsProps extends Omit<ComponentProps<'span'>, 'title'> {
|
|
|
4
4
|
title?: ReactNode;
|
|
5
5
|
/** the caption under it (may hold a Dot); on an option row, only the difference that decides, one line, on every option of the list or on none */
|
|
6
6
|
meta?: ReactNode;
|
|
7
|
+
/** the caption OVER the title (who asks, over the ask): it and the title stand together as one block, so beside a `Stamp` both lines take the
|
|
8
|
+
* words' column and the title wraps there as it does without it */
|
|
9
|
+
over?: ReactNode;
|
|
7
10
|
/** the title as a heading element in that type level; without it the title is a span in title type. In a `Head` the title is always a heading: `h2` unless this says otherwise (`h1` for the one-feature page) */
|
|
8
11
|
level?: 'h1' | 'h2' | 'display';
|
|
9
12
|
}
|
|
10
|
-
/** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption;
|
|
13
|
+
/** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption, maybe under an `over` caption;
|
|
11
14
|
* its children come under them, or instead of them (a Wave for a voice note). In a `Head` there is no box round them: the title and the meta
|
|
12
15
|
* stand in the head, and a `className`, an `id` or any other attribute goes on the title. */
|
|
13
|
-
export declare function Words({ title, meta, level, className, children, ...rest }: WordsProps): import("react").JSX.Element;
|
|
16
|
+
export declare function Words({ title, meta, over, level, className, children, ...rest }: WordsProps): import("react").JSX.Element;
|
package/dist/parts/Words.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { cx } from '../cx.js';
|
|
4
4
|
import { HeadCtx, onTitleKey } from './headCtx.js';
|
|
5
|
-
/** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption;
|
|
5
|
+
/** Words — the words of a line, filling the room between the lead and the end: a `title` over a `meta` caption, maybe under an `over` caption;
|
|
6
6
|
* its children come under them, or instead of them (a Wave for a voice note). In a `Head` there is no box round them: the title and the meta
|
|
7
7
|
* stand in the head, and a `className`, an `id` or any other attribute goes on the title. */
|
|
8
|
-
export function Words({ title, meta, level, className, children, ...rest }) {
|
|
8
|
+
export function Words({ title, meta, over, level, className, children, ...rest }) {
|
|
9
9
|
const head = useContext(HeadCtx);
|
|
10
10
|
if (head) {
|
|
11
11
|
const as = level ?? 'h2';
|
|
@@ -13,8 +13,9 @@ export function Words({ title, meta, level, className, children, ...rest }) {
|
|
|
13
13
|
const { onKeyDown, ...own } = rest;
|
|
14
14
|
const attrs = head.tab != null ? { tabIndex: head.tab, onKeyDown: (e) => { onKeyDown?.(e); if (!e.defaultPrevented)
|
|
15
15
|
onTitleKey(e); } } : { onKeyDown };
|
|
16
|
-
|
|
16
|
+
const titled = title != null && _jsx(Title, { className: cx('words__title', `t-${as}`, head.long && 'is-long', className), ...own, ...attrs, children: title });
|
|
17
|
+
return (_jsxs(_Fragment, { children: [over != null ? _jsxs("div", { className: "words__over-title", children: [_jsx("span", { className: "words__over t-caption", children: over }), titled] }) : titled, meta != null && _jsx("span", { className: "words__meta t-caption t-muted", children: meta }), children] }));
|
|
17
18
|
}
|
|
18
19
|
const Title = level === 'h1' ? 'h1' : level ? 'h2' : 'span';
|
|
19
|
-
return (_jsxs("span", { className: cx('words', className), ...rest, children: [title != null && _jsx(Title, { className: cx('words__title', level && `t-${level}`), children: title }), meta != null && _jsx("span", { className: "words__meta", children: meta }), children] }));
|
|
20
|
+
return (_jsxs("span", { className: cx('words', className), ...rest, children: [over != null && _jsx("span", { className: "words__over t-caption", children: over }), title != null && _jsx(Title, { className: cx('words__title', level && `t-${level}`), children: title }), meta != null && _jsx("span", { className: "words__meta", children: meta }), children] }));
|
|
20
21
|
}
|
package/dist/type/textScale.d.ts
CHANGED
|
@@ -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
|
*/
|
package/dist/type/textScale.js
CHANGED
|
@@ -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
|
|
669
|
-
a form
|
|
670
|
-
|
|
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
|
|
@@ -871,7 +875,8 @@ it up. cardds draws the paper; the pictures, their words and which stamp a membe
|
|
|
871
875
|
middle and the words and link under it centre. In a card's head — `<Card foot={<Btn primary block>…</Btn>}><Head><Words title={name} meta={greeting} /><Stamp bare …/></Head></Card>` — the words stand at the left and the stamp at the right,
|
|
872
876
|
beside both lines (`Stamp under`: the words keep no room for it, they run the head's whole width over the stamp, which lies under them in
|
|
873
877
|
its place and size — for a long title); in a head that leads with a date (a `JourneyBadge`, then a `ChipRow`) it stands on a row of its own under the
|
|
874
|
-
date and the chips, in the order given.
|
|
878
|
+
date and the chips, in the order given. Who asks over the ask is `Words over`: `<Head><Words level="h1" over="Somsri asks for help" title={ask} /><Stamp …/></Head>`
|
|
879
|
+
— the caption over the title, the two one block beside the stamp, the title wrapping there. The card's one button presses it whole. In an `AvatarStack` it is a head, the small size
|
|
875
880
|
(`more="+9"` for the count).
|
|
876
881
|
- **`StampOn`** — a stamp stuck on a surface. `at` is the stamp's middle as a share of the surface (`{ x, y }`, 0 to 1),
|
|
877
882
|
`turn` its angle in degrees. With `onAtChange` the member drags it (the arrow keys move it too) and it asks with the
|
|
@@ -1159,7 +1164,7 @@ Rules:
|
|
|
1159
1164
|
Both name the tokens to move.
|
|
1160
1165
|
- The member's text-size setting is the same `--fs-base`, written on `<html>`
|
|
1161
1166
|
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.)
|
|
1167
|
+
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
1168
|
|
|
1164
1169
|
Try it live: the gallery's nav (`npm run dev`) has a slider per size base, and
|
|
1165
1170
|
palette `own` shows a colour well per colour base.
|
|
@@ -1277,7 +1282,7 @@ platform's: the initial value of a registered length (`@property`), which may no
|
|
|
1277
1282
|
lengths a script measures off the page (`--kb`, a sheet's peek, a pulled sheet).
|
|
1278
1283
|
An app with its own text-size setting calls `setTextScale(percent)`, which writes
|
|
1279
1284
|
`--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
|
|
1285
|
+
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
1286
|
Components never write a raw length: spacing from `--sp-*`, control sizes from
|
|
1282
1287
|
`--tap`, `--tap-lg`, `--btn-h`, `--bar-h`, `--header-h`, `--fab`, `--badge`, container
|
|
1283
1288
|
padding from `--screen-pad` / `--card-pad`, radii from
|
|
@@ -1311,7 +1316,7 @@ reads every value from a token in `css/tokens.css` (or a palette, a finish, a pr
|
|
|
1311
1316
|
- **type**: the eight kinds (display, h1, h2, title, body, label, caption, stat) each have `--face-<kind>`, `--fw-<kind>`,
|
|
1312
1317
|
`--fs-<kind>`, `--lh-<kind>` and `--track-<kind>`, and `--type-<kind>` is made of them. A piece set on a size outside the
|
|
1313
1318
|
kinds composes its `font:` from the scales: `--fs-*`, weight `--fw-regular` … `--fw-black`, leading `--lh-mark` … `--lh-ruled`.
|
|
1314
|
-
Gallery `Text · Kinds` shows them resolved. An h1's caption, over it or under it, keeps to the heading's leading
|
|
1319
|
+
Gallery `Text · Kinds` shows them resolved. An h1's caption, over it (`Words over`) or under it (`Words meta`), keeps to the heading's leading
|
|
1315
1320
|
(`--lh-h1-caption`); a caption over an h1 that wraps starts where a one-line one does, its next line goes down and the
|
|
1316
1321
|
h1 with it (gallery `Text · HeadingWraps`).
|
|
1317
1322
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.7.141",
|
|
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).",
|