@usableapp/cardds 0.7.155 → 0.7.156

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.
@@ -29,8 +29,10 @@ export interface MessageBarProps extends Omit<ComponentProps<'textarea'>, 'value
29
29
  * MessageBar — the box a chat's message is typed in, at the foot of a conversation (a `Thread` of `Bubble`s): lead · the box · send.
30
30
  * The box starts one line tall and grows with the words up to five lines (`--message-bar-input-max-h`), then scrolls. The send button
31
31
  * (an `IconBtn invert`) is off while the box holds only blanks; pressing it hands the words to `onSend` and asks for an empty box, and
32
- * the cursor stays in the box, so the keyboard stays up. The Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`): a layer over
33
- * the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it. Controlled like an
32
+ * the cursor stays in the box, so the keyboard stays up. Two homes: the Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`), a layer over
33
+ * the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it; or a SHEET's foot — a chat that
34
+ * opens as a Sheet (`<Foot><MessageBar…/></Foot>`): the bar takes the foot's line and its padding, stands on the sheet's bottom edge above the
35
+ * keyboard, and the body stops above it however tall it grows. Controlled like an
34
36
  * input: `value` + `onValueChange`, or `defaultValue`. `people` turns on naming with `@` (a comment that names a neighbour): the
35
37
  * matching names are listed above the box, a pick writes `@name ` and reports it to `onMention`; a written name is marked and a
36
38
  * backspace takes it whole.
@@ -8,8 +8,10 @@ import { IconBtn } from '../actions/IconBtn.js';
8
8
  * MessageBar — the box a chat's message is typed in, at the foot of a conversation (a `Thread` of `Bubble`s): lead · the box · send.
9
9
  * The box starts one line tall and grows with the words up to five lines (`--message-bar-input-max-h`), then scrolls. The send button
10
10
  * (an `IconBtn invert`) is off while the box holds only blanks; pressing it hands the words to `onSend` and asks for an empty box, and
11
- * the cursor stays in the box, so the keyboard stays up. The Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`): a layer over
12
- * the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it. Controlled like an
11
+ * the cursor stays in the box, so the keyboard stays up. Two homes: the Screen's `bottom` (`<Screen fill bottom={<MessageBar…>}>`), a layer over
12
+ * the content's foot that rides above the keyboard (`--kb`), the conversation's last words scroll clear of it; or a SHEET's foot — a chat that
13
+ * opens as a Sheet (`<Foot><MessageBar…/></Foot>`): the bar takes the foot's line and its padding, stands on the sheet's bottom edge above the
14
+ * keyboard, and the body stops above it however tall it grows. Controlled like an
13
15
  * input: `value` + `onValueChange`, or `defaultValue`. `people` turns on naming with `@` (a comment that names a neighbour): the
14
16
  * matching names are listed above the box, a pick writes `@name ` and reports it to `onMention`; a written name is marked and a
15
17
  * backspace takes it whole.
@@ -24,6 +24,6 @@ export interface FootProps extends ComponentProps<'div'> {
24
24
  * centred — for a foot whose one button should not fill the card. With `round` it is the foot of a few round `IconBtn`s (`size="xl"`, one
25
25
  * `primary` with a word, the others with icons): one centred group, a fixed gap between them. With `split` it is two small `Link`s (or `Btn`s) that are the
26
26
  * card's foot, each half its width, edge to edge on its bottom edge, a rule between (the member's own item: Edit · Cancel). In a `Sheet` it stands on the box's bottom edge
27
- * at every state. A `Card` finds its `Foot` by type (a turning card draws it on both faces), so a consumer's own component that wraps a `Foot`
27
+ * at every state; a chat in a sheet puts its `MessageBar` there instead of Btns (`<Foot><MessageBar…/></Foot>`), the bar alone on the line. A `Card` finds its `Foot` by type (a turning card draws it on both faces), so a consumer's own component that wraps a `Foot`
28
28
  * is not found. */
29
29
  export declare function Foot({ link, round, joined, split, className, children, ...rest }: FootProps): import("react").JSX.Element;
@@ -6,7 +6,7 @@ import { joinDots } from '../actions/joined.js';
6
6
  * centred — for a foot whose one button should not fill the card. With `round` it is the foot of a few round `IconBtn`s (`size="xl"`, one
7
7
  * `primary` with a word, the others with icons): one centred group, a fixed gap between them. With `split` it is two small `Link`s (or `Btn`s) that are the
8
8
  * card's foot, each half its width, edge to edge on its bottom edge, a rule between (the member's own item: Edit · Cancel). In a `Sheet` it stands on the box's bottom edge
9
- * at every state. A `Card` finds its `Foot` by type (a turning card draws it on both faces), so a consumer's own component that wraps a `Foot`
9
+ * at every state; a chat in a sheet puts its `MessageBar` there instead of Btns (`<Foot><MessageBar…/></Foot>`), the bar alone on the line. A `Card` finds its `Foot` by type (a turning card draws it on both faces), so a consumer's own component that wraps a `Foot`
10
10
  * is not found. */
11
11
  export function Foot({ link, round, joined, split, className, children, ...rest }) {
12
12
  return (_jsxs("div", { className: cx('foot', link != null && 'foot--link', round && 'foot--round', joined && 'foot--joined', split && 'foot--split', className), ...rest, children: [joined ? joinDots(children) : children, link != null && _jsx("div", { className: "foot__link", children: link })] }));
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from 'react';
1
2
  import type { ComponentProps } from 'react';
2
3
  import { type Resting } from './sheetMeasure.js';
3
4
  /** how far the sheet slid. `away` = not on the screen (slid out, inert) — a state the app sets, never one a drag or a tap lands on */
@@ -33,12 +34,17 @@ export interface SheetProps extends Omit<ComponentProps<'article'>, 'onChange'>
33
34
  paper?: boolean;
34
35
  /** coming up, the sheet leaves the cursor where it is: it gives it to none of its fields and not to its handle. For a sheet that comes up under a field outside it that has the cursor (a `StickyAnswer` note being written) — the keyboard stays up */
35
36
  leaveCursor?: boolean;
37
+ /** a ROW PINNED under the head (a `Row`: the request a chat is about, its time, an arrow to its card) — as `Screen topRow`: it never scrolls
38
+ * away, the body starts under it however tall it grows. Edge to edge on the sheet's ground, right under the `Head` (first, with no Head) */
39
+ topRow?: ReactNode;
36
40
  }
37
41
  /**
38
42
  * Sheet — the SINGLE sheet: one card as a bottom sheet holding what the member ACTS on. Always the full height of its
39
43
  * box — a Step or a SheetStage — a state is only how far it slid (translate; the material never changes size).
40
- * ONE SHAPE, written top-down: handle · head (a Head — pinned, never scrolls) · Body (scrolls, as far as
41
- * it needs) · Foot (the button that finishes the sheet — at the bottom, above the keyboard; gone at peek).
44
+ * ONE SHAPE, written top-down: handle · head (a Head — pinned, never scrolls) · `topRow` (optional, pinned under it) · Body (scrolls, as far as
45
+ * it needs) · Foot (the button that finishes the sheet — or a chat's `MessageBar` — at the bottom, above the keyboard; gone at peek).
46
+ * A CHAT as a sheet: `<SheetStage over dim><Sheet state="full" states="full" handle={false}>` · Head (the name, a ✕ IconBtn) · Body (a `Thread`
47
+ * or a `StickyThread lapped`) · `<Foot><MessageBar …/></Foot>` — or, for notes, a `StickyAnswer` as the sheet's last child instead of the Foot.
42
48
  *
43
49
  * It is a COMPONENT, not a wiring: it knows nothing of what opens it. The app owns `state` and sets it from whatever it
44
50
  * likes — a button, a route, a timer: `<Btn onClick={() => setSheet('full')}>` … `<Sheet state={sheet} onStateChange={setSheet}>`.
@@ -57,4 +63,4 @@ export interface SheetProps extends Omit<ComponentProps<'article'>, 'onChange'>
57
63
  * The CURSOR is cardds's too: once it has come up it waits in the field marked `data-autofocus`, else the first field, else the heading — write no `autoFocus` or `.focus()` for it. `leaveCursor`: it
58
64
  * moves the cursor nowhere (a field over the sheet is being written in).
59
65
  */
60
- export declare function Sheet({ state, defaultState, onStateChange, onSettled, half, states, handle, mark, refreshing, tone, paper, leaveCursor, className, style, children, onFocus, ...rest }: SheetProps): import("react").JSX.Element;
66
+ export declare function Sheet({ state, defaultState, onStateChange, onSettled, half, states, handle, mark, refreshing, tone, paper, leaveCursor, topRow, className, style, children, onFocus, ...rest }: SheetProps): import("react").JSX.Element;
@@ -16,11 +16,20 @@ function markLong(node, long) {
16
16
  return node;
17
17
  return cloneElement(node, { long: true });
18
18
  }
19
+ /** the pinned row goes right after the sheet's Head (first, when there is none) */
20
+ function withTopRow(parts, topRow) {
21
+ if (topRow == null)
22
+ return parts;
23
+ const at = parts.findIndex((node) => isValidElement(node) && node.type === Head) + 1;
24
+ return [...parts.slice(0, at), _jsx("div", { className: "sheet__top-row", children: topRow }, "sheet-top-row"), ...parts.slice(at)];
25
+ }
19
26
  /**
20
27
  * Sheet — the SINGLE sheet: one card as a bottom sheet holding what the member ACTS on. Always the full height of its
21
28
  * box — a Step or a SheetStage — a state is only how far it slid (translate; the material never changes size).
22
- * ONE SHAPE, written top-down: handle · head (a Head — pinned, never scrolls) · Body (scrolls, as far as
23
- * it needs) · Foot (the button that finishes the sheet — at the bottom, above the keyboard; gone at peek).
29
+ * ONE SHAPE, written top-down: handle · head (a Head — pinned, never scrolls) · `topRow` (optional, pinned under it) · Body (scrolls, as far as
30
+ * it needs) · Foot (the button that finishes the sheet — or a chat's `MessageBar` — at the bottom, above the keyboard; gone at peek).
31
+ * A CHAT as a sheet: `<SheetStage over dim><Sheet state="full" states="full" handle={false}>` · Head (the name, a ✕ IconBtn) · Body (a `Thread`
32
+ * or a `StickyThread lapped`) · `<Foot><MessageBar …/></Foot>` — or, for notes, a `StickyAnswer` as the sheet's last child instead of the Foot.
24
33
  *
25
34
  * It is a COMPONENT, not a wiring: it knows nothing of what opens it. The app owns `state` and sets it from whatever it
26
35
  * likes — a button, a route, a timer: `<Btn onClick={() => setSheet('full')}>` … `<Sheet state={sheet} onStateChange={setSheet}>`.
@@ -39,7 +48,7 @@ function markLong(node, long) {
39
48
  * The CURSOR is cardds's too: once it has come up it waits in the field marked `data-autofocus`, else the first field, else the heading — write no `autoFocus` or `.focus()` for it. `leaveCursor`: it
40
49
  * moves the cursor nowhere (a field over the sheet is being written in).
41
50
  */
42
- export function Sheet({ state, defaultState = 'half', onStateChange, onSettled, half, states, handle = true, mark = 'line', refreshing, tone, paper, leaveCursor, className, style, children, onFocus, ...rest }) {
51
+ export function Sheet({ state, defaultState = 'half', onStateChange, onSettled, half, states, handle = true, mark = 'line', refreshing, tone, paper, leaveCursor, topRow, className, style, children, onFocus, ...rest }) {
43
52
  const [current, request] = useControlled(state, defaultState, onStateChange);
44
53
  const ref = useRef(null);
45
54
  const handleRef = useRef(null);
@@ -72,7 +81,8 @@ export function Sheet({ state, defaultState = 'half', onStateChange, onSettled,
72
81
  for the lowest of its states, from the current one (or `atLeast`) upward, that has room; if none has, its highest. */
73
82
  const reveal = useCallback((target, reason, atLeast) => {
74
83
  const el = ref.current;
75
- if (!el || !target || !el.contains(target) || target.closest('.sheet__handle') || current === 'away')
84
+ /* only the body scrolls: a control in the head, the top row or the foot (a MessageBar) already stands in sight, above the keyboard */
85
+ if (!el || !target || !el.querySelector(':scope > .body')?.contains(target) || current === 'away')
76
86
  return;
77
87
  const control = target.closest('.field') ?? target; // the control's box, not the bare input inside it
78
88
  const list = allowed(), stops = stopsOf(el);
@@ -131,5 +141,5 @@ export function Sheet({ state, defaultState = 'half', onStateChange, onSettled,
131
141
  return; // the click that follows a drag is not a tap
132
142
  request(current === 'peek' ? (allowed().includes(home.current) ? home.current : allowed().find((s) => s !== 'peek') ?? 'half') : 'peek', 'tap');
133
143
  };
134
- return (_jsxs("article", { ref: ref, className: cx('card sheet', tone && tone !== 1 && `card--${tone}`, paper && 'sheet--paper', `sheet--${shown}`, refreshing && 'is-loading', className), "aria-busy": refreshing || undefined, inert: current === 'away' || held || undefined, onFocus: focus, style: half ? { ...style, '--sheet-half': (10 - half) / 10 } : style, ...rest, children: [handle !== false && (_jsx("button", { ref: handleRef, className: cx('sheet__handle', mark === 'dots' && 'sheet__handle--dots'), type: "button", "aria-label": typeof handle === 'string' ? handle : word('resize'), onClick: tap, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up })), Children.map(children, (node) => markLong(node, titleLong))] }));
144
+ return (_jsxs("article", { ref: ref, className: cx('card sheet', tone && tone !== 1 && `card--${tone}`, paper && 'sheet--paper', `sheet--${shown}`, refreshing && 'is-loading', className), "aria-busy": refreshing || undefined, inert: current === 'away' || held || undefined, onFocus: focus, style: half ? { ...style, '--sheet-half': (10 - half) / 10 } : style, ...rest, children: [handle !== false && (_jsx("button", { ref: handleRef, className: cx('sheet__handle', mark === 'dots' && 'sheet__handle--dots'), type: "button", "aria-label": typeof handle === 'string' ? handle : word('resize'), onClick: tap, onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up })), withTopRow(Children.map(children, (node) => markLong(node, titleLong)) ?? [], topRow)] }));
135
145
  }
@@ -19,7 +19,8 @@ export interface StickyAnswerProps extends ComponentProps<'div'> {
19
19
  * a `placeholder`: the pale word). AT REST it waits at the screen's foot, near the right, three quarters of it in sight. A touch on it puts
20
20
  * the cursor in the field, and the holder ASKS to write: the note goes to the top of the screen, the screen behind is washed pale and takes
21
21
  * no touch, and `tools` and `tray` wake under it (inert until then). The note keeps the one size in both places. A child of the `Screen`,
22
- * a layer over it. Controlled like an input: `writing` + `onWritingChange(writing, reason)`, or `defaultWriting`; the words, the paper and
22
+ * a layer over it — or the last child of a `Sheet` (a chat that opens as a sheet): a layer of the sheet, it waits at the sheet's foot and
23
+ * writes under the sheet's head, the keyboard's room being the sheet's. Controlled like an input: `writing` + `onWritingChange(writing, reason)`, or `defaultWriting`; the words, the paper and
23
24
  * what is stuck on the note are the app's, on the parts it passes in. When writing ends the cursor leaves the note, so the keyboard goes down.
24
25
  * THE MAKE-A-NOTE FORM: `sheet` instead of `tools`/`tray` — a `Sheet` under the note, from its bottom edge to the screen's foot, holding what the
25
26
  * app picks for the note. While the cursor is in the note, a press on a control under it (a swatch, a stamp, a button — not a field) leaves the
@@ -9,7 +9,8 @@ const TYPED = 'textarea, select, [contenteditable="true"], input:not([type=check
9
9
  * a `placeholder`: the pale word). AT REST it waits at the screen's foot, near the right, three quarters of it in sight. A touch on it puts
10
10
  * the cursor in the field, and the holder ASKS to write: the note goes to the top of the screen, the screen behind is washed pale and takes
11
11
  * no touch, and `tools` and `tray` wake under it (inert until then). The note keeps the one size in both places. A child of the `Screen`,
12
- * a layer over it. Controlled like an input: `writing` + `onWritingChange(writing, reason)`, or `defaultWriting`; the words, the paper and
12
+ * a layer over it — or the last child of a `Sheet` (a chat that opens as a sheet): a layer of the sheet, it waits at the sheet's foot and
13
+ * writes under the sheet's head, the keyboard's room being the sheet's. Controlled like an input: `writing` + `onWritingChange(writing, reason)`, or `defaultWriting`; the words, the paper and
13
14
  * what is stuck on the note are the app's, on the parts it passes in. When writing ends the cursor leaves the note, so the keyboard goes down.
14
15
  * THE MAKE-A-NOTE FORM: `sheet` instead of `tools`/`tray` — a `Sheet` under the note, from its bottom edge to the screen's foot, holding what the
15
16
  * app picks for the note. While the cursor is in the note, a press on a control under it (a swatch, a stamp, a button — not a field) leaves the
package/docs/reference.md CHANGED
@@ -370,6 +370,13 @@ of `Screen`:
370
370
  - **A row pinned under the top is `topRow`** (Lh 2026-10-26) — `<Screen fill top={<TopBar…/>} topRow={<Row>…</Row>}>`: a row
371
371
  of the column, so it never scrolls away and the content starts under it at its real height; it touches the bar, edge to
372
372
  edge, on the screen's ground (`--top-row-bg`). On a scrolling screen it sticks to the top once the bar has gone.
373
+ - **A chat that opens as a sheet** (Lh 2026-10-28) — over a home rather than a page of its own: `<SheetStage over dim>` ›
374
+ `<Sheet state="full" states="full" handle={false}>` · `Head` (the friend's name, an `IconBtn sm icon="x"` that sets `away`) ·
375
+ `Body` (the `Thread`, or a `StickyThread lapped`) · `<Foot><MessageBar…/></Foot>`. The `MessageBar` is the foot's one child
376
+ and takes its line and its padding; it stands on the sheet's bottom edge above the keyboard, and the body stops above it
377
+ however tall it grows. The sheet's `topRow` is its pinned row under the head (the request the chat is about), as the
378
+ Screen's. In the sticky look the sheet's last child is a `StickyAnswer` in place of the Foot. Opening at, and following,
379
+ the last words is the app's (`scrollIntoView({ block: 'end' })` on the thread). Stories: `Bubble/ChatSheet`, `StickyScreens/ChatSheet`.
373
380
  - **A screen with a `Sheet` has no bottom.** The sheet finishes on its own `Foot`; `Screen` warns once when both
374
381
  are there.
375
382
  - **Templates** are `Screen`s with the three parts filled (`Walkthrough` = top `lead` · content `Pages` · bottom
@@ -853,7 +860,9 @@ A sticky note is a square of paper with a few words on it. The family is in `src
853
860
  cursor in the field and the holder asks to write: `writing` + `onWritingChange(writing, reason)`, or
854
861
  `defaultWriting`. While writing, the note stands at the top, the screen behind is washed pale and takes no touch,
855
862
  and `tools` (the paper chooser, the send button) and `tray` (the writer's stamp) stand under it. A touch outside or
856
- Escape asks to stop. The words, the paper and the stamps on the note are the app's. It is a child of the `Screen`.
863
+ Escape asks to stop. The words, the paper and the stamps on the note are the app's. It is a child of the `Screen` —
864
+ or the last child of a `Sheet` (a chat that opens as a sheet, 2026-10-28): it waits at the sheet's foot, writes under
865
+ the sheet's head, and leaves the keyboard's room to the sheet, which has already given it.
857
866
  The make-a-note form: `sheet` in place of `tools`/`tray` — a `Sheet` standing under the note while it is written on,
858
867
  from the note's edge to the screen's foot, above the keyboard. What it holds (a `StickyPick`, a stamp strip, a `Foot`
859
868
  with the send button) and its `state` (`writing ? 'full' : 'away'`) are the app's; give it `leaveCursor`. The cursor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.155",
3
+ "version": "0.7.156",
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).",