@usableapp/cardds 0.7.134 → 0.7.136

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.
@@ -1,4 +1,4 @@
1
- import type { ComponentProps, ReactNode, Ref } from 'react';
1
+ import { type ComponentProps, type ReactNode, type Ref } from 'react';
2
2
  export interface MapAreaProps extends ComponentProps<'div'> {
3
3
  /** IN FLOW instead of behind a stage: the map is a box in a card or a sheet's body, the ring and the hint in its own box.
4
4
  * The only thing in a sheet's Body, it fills the body: the sheet's head stays on top, its foot under it */
@@ -34,5 +34,7 @@ export interface MapAreaProps extends ComponentProps<'div'> {
34
34
  * its tip on the point the ring's centre would be (the engine reads the pin's bottom-centre). The ring stays for a rough area.
35
35
  * Variation `mark="none"`: no centre mark at all — the app's engine draws its own marks on the map; nothing stands at the centre.
36
36
  * Variation `bleed` (with `inline`): the map edge to edge of what holds it, no corner, for the map under a step's controls.
37
+ * The box OWNS ITS GESTURES (`data-gestures="own"`): a touch or drag that starts in it moves only the map — never the sheet's body,
38
+ * the page or a sheet round it; the engine still gets every touch. The app adds nothing.
37
39
  */
38
- export declare function MapArea({ inline, bleed, hint, credit, mark, ringLabel, ringRef, className, children, ...rest }: MapAreaProps): import("react").JSX.Element;
40
+ export declare function MapArea({ inline, bleed, hint, credit, mark, ringLabel, ringRef, className, children, ref, ...rest }: MapAreaProps): import("react").JSX.Element;
@@ -1,4 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { setRefs, useOwnGestures } from '../state.js';
2
4
  import { cx } from '../cx.js';
3
5
  import { Icon } from '../type/Icon.js';
4
6
  /**
@@ -12,9 +14,13 @@ import { Icon } from '../type/Icon.js';
12
14
  * its tip on the point the ring's centre would be (the engine reads the pin's bottom-centre). The ring stays for a rough area.
13
15
  * Variation `mark="none"`: no centre mark at all — the app's engine draws its own marks on the map; nothing stands at the centre.
14
16
  * Variation `bleed` (with `inline`): the map edge to edge of what holds it, no corner, for the map under a step's controls.
17
+ * The box OWNS ITS GESTURES (`data-gestures="own"`): a touch or drag that starts in it moves only the map — never the sheet's body,
18
+ * the page or a sheet round it; the engine still gets every touch. The app adds nothing.
15
19
  */
16
- export function MapArea({ inline, bleed, hint, credit, mark = 'ring', ringLabel = mark === 'pin' ? 'จุดนัด' : 'ย่านของคุณโดยประมาณ', ringRef, className, children, ...rest }) {
17
- return (_jsxs("div", { className: cx('map', inline && 'map--inline', inline && bleed && 'map--bleed', className), ...rest, children: [children, mark === 'pin'
20
+ export function MapArea({ inline, bleed, hint, credit, mark = 'ring', ringLabel = mark === 'pin' ? 'จุดนัด' : 'ย่านของคุณโดยประมาณ', ringRef, className, children, ref, ...rest }) {
21
+ const own = useRef(null);
22
+ useOwnGestures(own);
23
+ return (_jsxs("div", { className: cx('map', inline && 'map--inline', inline && bleed && 'map--bleed', className), "data-gestures": "own", ...rest, ref: setRefs(own, ref), children: [children, mark === 'pin'
18
24
  ? _jsx("span", { ref: ringRef, className: "map__pin", role: "img", "aria-label": ringLabel, children: _jsx(Icon, { name: "map-pin" }) })
19
25
  : mark === 'ring' && _jsx("span", { ref: ringRef, className: "map__ring", role: "img", "aria-label": ringLabel }), hint != null && _jsx("span", { className: "map__hint", children: hint }), credit != null && _jsx("span", { className: "map__credit", children: credit })] }));
20
26
  }
@@ -3,7 +3,7 @@
3
3
  This card renders what those two mean: the place classes, the grip, the pull. Nothing stamps them on afterwards. */
4
4
  import { createContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
5
5
  import { flushSync } from 'react-dom';
6
- import { focusWhenActive } from '../state.js';
6
+ import { focusWhenActive, ownsGestures } from '../state.js';
7
7
  const SLOP_REM = 0.5;
8
8
  const COMMIT_REM = 4.5;
9
9
  /** the head's title is a tab stop while this sheet is the one Enter acts on: every title when none is open, only the open one otherwise */
@@ -187,7 +187,7 @@ export function useStackCard(ref, place, swallow) {
187
187
  const ask = placeRef.current;
188
188
  if (!primary(e) || headPull.current || bodyPull.current || !ask?.onRefresh || (ask.open && ask.refreshing))
189
189
  return;
190
- if (scroller.scrollTop > 0)
190
+ if (scroller.scrollTop > 0 || ownsGestures(e.target))
191
191
  return;
192
192
  if (e.target instanceof Element && ownHead(card, e.target))
193
193
  return;
@@ -259,7 +259,7 @@ export function useStackCard(ref, place, swallow) {
259
259
  const t = e.touches[0];
260
260
  const ask = placeRef.current;
261
261
  const inHead = e.target instanceof Element && !!ownHead(card, e.target);
262
- touch = e.touches.length === 1 && t && ask?.onRefresh && !(ask.open && ask.refreshing) && scroller.scrollTop <= 0 && !inHead
262
+ touch = e.touches.length === 1 && t && ask?.onRefresh && !(ask.open && ask.refreshing) && scroller.scrollTop <= 0 && !inHead && !ownsGestures(e.target)
263
263
  ? { x: t.clientX, y: t.clientY, ours: null } : null;
264
264
  };
265
265
  const onTouchMove = (e) => {
package/dist/state.d.ts CHANGED
@@ -16,6 +16,15 @@ export declare function useDisclosure(open: boolean | undefined, defaultOpen?: b
16
16
  export declare const setRefs: <T extends Element>(own: {
17
17
  current: Element | null;
18
18
  }, ref: Ref<T> | undefined) => (node: T | null) => void;
19
+ /** A REGION THAT OWNS ITS GESTURES (a map, a canvas): the box carries `data-gestures="own"` and every touch or drag that starts in it
20
+ * moves only what is in it. base.css gives the box `touch-action: none` and `overscroll-behavior: contain`; a gesture of a component
21
+ * round it (a stack's pull, a walk's swipe) asks `ownsGestures(target)` and stays out. Give the region's element to `useOwnGestures` */
22
+ export declare const ownsGestures: (target: EventTarget | null) => boolean;
23
+ /** iOS: a finger's move in the region never scrolls what holds it — a non-passive `touchmove` refuses the browser's own pan. The
24
+ * region's engine (Google Maps, Leaflet) still gets every touch: its listeners sit inside and run first */
25
+ export declare function useOwnGestures(ref: {
26
+ current: Element | null;
27
+ }): void;
19
28
  /** the latest value in a ref — for a handler that a timer, an observer or a listener set up once calls later */
20
29
  export declare function useLatest<T>(value: T): import("react").RefObject<T>;
21
30
  /** watch boxes for a size change (the keyboard, a font arriving, a wrap): `fn` on each — once at the start too, as the browser
package/dist/state.js CHANGED
@@ -38,6 +38,23 @@ export const setRefs = (own, ref) => (node) => {
38
38
  else if (ref)
39
39
  ref.current = node;
40
40
  };
41
+ /** A REGION THAT OWNS ITS GESTURES (a map, a canvas): the box carries `data-gestures="own"` and every touch or drag that starts in it
42
+ * moves only what is in it. base.css gives the box `touch-action: none` and `overscroll-behavior: contain`; a gesture of a component
43
+ * round it (a stack's pull, a walk's swipe) asks `ownsGestures(target)` and stays out. Give the region's element to `useOwnGestures` */
44
+ export const ownsGestures = (target) => target instanceof Element && !!target.closest('[data-gestures="own"]');
45
+ /** iOS: a finger's move in the region never scrolls what holds it — a non-passive `touchmove` refuses the browser's own pan. The
46
+ * region's engine (Google Maps, Leaflet) still gets every touch: its listeners sit inside and run first */
47
+ export function useOwnGestures(ref) {
48
+ useEffect(() => {
49
+ const el = ref.current;
50
+ if (!el)
51
+ return;
52
+ const hold = (e) => { if (e.cancelable)
53
+ e.preventDefault(); };
54
+ el.addEventListener('touchmove', hold, { passive: false });
55
+ return () => el.removeEventListener('touchmove', hold);
56
+ }, [ref]);
57
+ }
41
58
  /** the latest value in a ref — for a handler that a timer, an observer or a listener set up once calls later */
42
59
  export function useLatest(value) {
43
60
  const ref = useRef(value);
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useLayoutEffect, useRef } from 'react';
3
- import { swipeOf, useControlled } from '../state.js';
3
+ import { ownsGestures, swipeOf, useControlled } from '../state.js';
4
4
  import { Screen } from '../scaffold/Screen.js';
5
5
  import { Step } from '../sheets/Step.js';
6
6
  import { Page } from '../scaffold/Page.js';
@@ -35,7 +35,7 @@ export function Walkthrough({ pages, at: atProp, defaultAt = 0, onAtChange, cta,
35
35
  (touch-action: pan-y); a swipe must be mostly sideways and long enough, so a scroll never turns a page */
36
36
  const start = useRef(null);
37
37
  const swipe = {
38
- onPointerDown: (e) => { start.current = { x: e.clientX, y: e.clientY }; },
38
+ onPointerDown: (e) => { start.current = ownsGestures(e.target) ? null : { x: e.clientX, y: e.clientY }; },
39
39
  onPointerUp: (e) => {
40
40
  const s0 = start.current;
41
41
  start.current = null;
package/docs/reference.md CHANGED
@@ -84,8 +84,6 @@ The iOS Simulator's Safari shows the iOS keyboard too (⌘K if it hides); deskto
84
84
  PWA needs https — a tunnel (`cloudflared tunnel --url http://localhost:<port>`), then Add to Home Screen. `host: true`
85
85
  lets anyone on the same network open the dev server: use it on a network you trust.
86
86
 
87
- `tests/fixtures/*.html` are the pages the geometry tests measure — not a demo. Nothing here is verified by eye.
88
-
89
87
  ### In another project
90
88
 
91
89
  **React (the main way, 2026-09-16):** the package is `@usableapp/cardds` on npm
@@ -102,9 +100,9 @@ import './theme.css'; // the project's look, after card
102
100
  ```
103
101
 
104
102
  **One way in, one step** (2026-09-29): `npx cardds init` — writes the project's `theme.css` (a copy of the
105
- template), adds `npm run cardds:check`, and says what to import. Then a screen is a template (`Walkthrough` · `Home` ·
103
+ template) and says what to import. Then a screen is a template (`Walkthrough` · `Home` ·
106
104
  `CallSheet` · `Splash`) or components composed — IMPORTED, never their markup copied: the behaviour lives in the
107
- component. `npx cardds check [dir]` runs the rules (`lint/rules.mjs`): a hand-written cardds class is an error; a
105
+ component. `npx cardds check [dir]` is a person's tool, never a session's step; it runs the rules (`lint/rules.mjs`): a hand-written cardds class is an error; a
108
106
  `Sheet` that cannot move (`state` without `onStateChange`) or leaves by vanishing (on a condition without
109
107
  `onSettled`) is a warning; a bar after `</Screen>` or pinned by hand is an error. The same rules in ESLint (flat
110
108
  config): `import cardds from '@usableapp/cardds/eslint'` → `cardds.configs.recommended`. A deliberate exception:
@@ -154,7 +152,7 @@ npx cardds find [words…] [--represents person] [--shape group] [--interact pic
154
152
  npx cardds scaffold <id> # a whole file from a screen: tsx (the code) or --html (a static document linking cardds.css)
155
153
  npx cardds get <Name> [--html] # one component: its role, props (a ReactNode prop is a slot), what it composes, its knobs + variations with code
156
154
  npx cardds list # every name by what it is for: one · group-brief · group-detail, the show-only first, then by what the member can do
157
- npx cardds check <dir> # the rules, before a screen is called done
155
+ npx cardds check <dir> # the rules — a person's tool, never a session's step
158
156
  npx cardds guide # the few rules no checker sees, in one short text
159
157
  ```
160
158
 
@@ -337,8 +335,6 @@ of `Screen`:
337
335
  A `FloatBar` in `bottom` floats the same way.
338
336
  - **A screen with a `Sheet` has no bottom.** The sheet finishes on its own `Foot`; `Screen` warns once when both
339
337
  are there.
340
- - **Checked:** `validateScreen` (`scripts/validate.mjs`, run on every story and template by
341
- `tests/composition.spec.js`) fails a bar after `</Screen>` or a pinned bar, warns on a Sheet + ActionBar.
342
338
  - **Templates** are `Screen`s with the three parts filled (`Walkthrough` = top `lead` · content `Pages` · bottom
343
339
  `ActionBar`); the gallery draws those parts on a template's page. The gallery's nav groups a screen's
344
340
  *top* and *bottom*, then each frame with the pieces that fill it: *card* (Card, its head, body and foot),
@@ -545,7 +541,7 @@ between at 40% down the screen (see *Anatomy*, "Where the centre is"):
545
541
  behind a peeked sheet the words keep `--sheet-peek` of room (the box declares the token), so the buttons under
546
542
  it scroll clear.
547
543
  **Never a form taken apart** — one sheet per field, a "send" left on the base: a form lives whole in ONE sheet.
548
- Fixture `tests/fixtures/calls.html`, tests `tests/calls.spec.js`, stories `Step · Walks` / `Step · Calls`.
544
+ Stories `Step · Walks` / `Step · Calls`.
549
545
  - **A pager bar turns pages of words, never a screen with a sheet** (Lh 2026-09-20). A
550
546
  sheet means this screen has work that cannot be walked past: no ← →, no bar at all — the sheet's
551
547
  own foot finishes it. (Guidance — not enforced.)
@@ -595,7 +591,8 @@ between at 40% down the screen (see *Anatomy*, "Where the centre is"):
595
591
  `Icon name="x" size="xs"` leading (`<Foot split><Link sm><Icon name="pencil" size="xs" /> Edit</Link><Link sm
596
592
  error><Icon name="x" size="xs" /> Cancel request</Link></Foot>`, stories `Btn · OwnItemFoot`, `Foot · SplitLinks`).
597
593
  Each link fills its half (the whole half is the tap target, a status row's height, at least `--tap`), its icon and
598
- words centred at the link's small size, never wrapped. Two `Btn`s (`Btn warn` for the cancel) still work as the
594
+ words centred at the link's small size, never wrapped. An `Icon` in any `Link` is the words' x-height (`1ex`, knob `--link-icon-size`)
595
+ and stands on their x-height band (its bottom on the baseline, the line centred in the link's height), whatever its `size`: `size="xs"` may stay or go. Two `Btn`s (`Btn warn` for the cancel) still work as the
599
596
  halves (story `Foot · Split`): the label words then (knob `--foot-split-font-size`), one short word each. The foot's status
600
597
  `Rows` follow the two halves in the same `Foot split` and stand under them, a rule between, the same row pitch
601
598
  (`<Foot split><Link sm>…</Link><Link sm error>…</Link><Rows>…</Rows></Foot>`, story `Foot · SplitOverStatus`).
@@ -693,6 +690,16 @@ between at 40% down the screen (see *Anatomy*, "Where the centre is"):
693
690
  only when the centre is the choice. When the app's map engine draws its own
694
691
  pins, `mark="none"` leaves the centre empty and `ringRef` is not passed
695
692
  (gallery `MapArea/NoMark`).
693
+ - **A map owns its gestures.** A touch or drag that starts in a `MapArea`
694
+ moves only the map, never the sheet's body, the page or a sheet round it:
695
+ the box carries `data-gestures="own"` (`touch-action: none`, a non-passive
696
+ `touchmove` for iOS) and a stack's pull or a walk's swipe stays out of it.
697
+ The engine still gets every touch; the app adds nothing. Any region can
698
+ take the same attribute (gallery `MapArea/OwnsGestures`).
699
+ - **An inline map sits in a thin frame**, the joined `BtnGroup look="choice"`'s
700
+ edge (`--border-w`, `--outline`, `--r-chip`), the map clipped to its corner.
701
+ Knobs `--map-area-edge-ink`, `--map-radius`; `bleed` keeps only the top and
702
+ bottom rules.
696
703
  - **Days on CalendarWeeks: one, a span, or several ranges.** `selected` is one
697
704
  day; `span` is one run (a tap on the first day and one on the last, or a
698
705
  drag); `ranges` + `onRangesChange` (or `defaultRanges`) holds several runs
@@ -1083,10 +1090,6 @@ question and hunts for its answer. Rules 11–13 serve that:
1083
1090
  padding), the hidden scrollbar and user-select in `css/base.css`. A trait
1084
1091
  is a zero-specificity `:where()` list (the user-select list is a plain
1085
1092
  list of single selectors), so a component's own rule always wins.
1086
- `tests/overrides.spec.js` fails on any override; `tests/overrides.json`,
1087
- which held the 184 there were on 2026-10-20, is empty and stays so.
1088
- One rule that can do neither is named, with why, in `KEPT`
1089
- (`tests/helpers.js`).
1090
1093
 
1091
1094
  ## A project's theme
1092
1095
 
@@ -1150,9 +1153,6 @@ Rules:
1150
1153
 
1151
1154
  Try it live: the gallery's nav (`npm run dev`) has a slider per size base, and
1152
1155
  palette `own` shows a colour well per colour base.
1153
- `tests/tokens.spec.js` holds the defaults to the px they always were and the
1154
- template to the defaults; the step / centre geometry runs at two extreme
1155
- themes (`tight`, `loose`).
1156
1156
 
1157
1157
  ## Ink follows its ground
1158
1158
 
@@ -1182,27 +1182,21 @@ check's tick, a switch's knob, the pager's dots.
1182
1182
  }
1183
1183
  ```
1184
1184
 
1185
- `tests/ink.spec.js` holds the gallery to exactly that block: every story, every tone, 0 pieces short.
1186
-
1187
- Check your own theme where it is loaded. `inkGrounds()` walks every visible word, field value, icon and glyph inside a root and
1185
+ Read your own theme where it is loaded. `inkGrounds()` walks every visible word, field value, icon and glyph inside a root and
1188
1186
  returns one row per piece, with the side its ground declares and the ink set its colour is:
1189
1187
 
1190
1188
  ```ts
1191
1189
  import { inkGrounds } from '@usableapp/cardds';
1192
1190
  console.table(inkGrounds().filter((r) => !r.pass)); // a dev page
1193
1191
 
1194
- // a Playwright test on your app (Playwright sends the function to the page)
1195
- const short = (await page.evaluate(inkGrounds)).filter((r) => !r.pass).map((r) => r.problem);
1196
- expect(short).toEqual([]);
1192
+ // a row that is short reads:
1197
1193
  // '.t-caption.t-muted "since May" on .card.card--3 (light side): #575757 (--card-muted = --ink-onlight-muted) on #141414 (--card-bg) is 2.55:1, words need 4.5:1'
1198
1194
  ```
1199
1195
 
1200
1196
  A side and an ink set that disagree with the ground (`light side` on a dark fill) say the ground declared the wrong side. It
1201
1197
  reports and changes nothing. It does not measure a piece on a picture (a `url()` ground; a gradient counts as decoration unless it
1202
1198
  is one colour), a disabled control, a hidden one, words drawn by CSS `content`, decoration colours (`--dot-a`, `--dot-b`, the
1203
- highlights), or what lies under a positioned element that is not its ancestor (a scrim drawn by `::after`). cardds holds itself to
1204
- the same function: `tests/ink.spec.js` renders every gallery story in every stock palette and in the dark mode above, as written
1205
- and with every card turned to each tone 1–5, about 27,000 pieces a pass, in `npm run ci`.
1199
+ highlights), or what lies under a positioned element that is not its ancestor (a scrim drawn by `::after`).
1206
1200
 
1207
1201
  ## Can the member see the card?
1208
1202
 
@@ -1211,17 +1205,13 @@ next to it). A card stands apart from the ground it stands on by its FILL. In co
1211
1205
  (`--card-border: transparent`; print and ink draw their own line as part of the finish); the wireframe keeps its black line. A card the
1212
1206
  member cannot see is answered by its fill or its ground, never by a border (Lh 2026-10-18).
1213
1207
 
1214
- Your theme decides the colours, so run the check on your theme. `cardGrounds()` builds a card of each tone (1–5) on each ground a card
1208
+ Your theme decides the colours, so read it on your theme. `cardGrounds()` builds a card of each tone (1–5) on each ground a card
1215
1209
  stands on (the screen, a sheet's body, a `paper` sheet's body) where your theme is loaded, reads what the browser draws and returns one
1216
1210
  row per pair:
1217
1211
 
1218
1212
  ```ts
1219
1213
  import { cardGrounds } from '@usableapp/cardds';
1220
1214
  console.table(cardGrounds()); // a dev page: ground · tone · fill · edge · pass · problem
1221
-
1222
- // a Playwright test on your app (Playwright sends the function to the page)
1223
- const rows = await page.evaluate(cardGrounds);
1224
- expect(rows.filter((r) => !r.pass).map((r) => r.problem)).toEqual([]);
1225
1215
  ```
1226
1216
 
1227
1217
  A failing row names the tokens and the shortfall, for example
@@ -1315,12 +1305,10 @@ reads every value from a token in `css/tokens.css` (or a palette, a finish, a pr
1315
1305
  (`--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
1306
  h1 with it (gallery `Text · HeadingWraps`).
1317
1307
 
1318
- A knob's default is one of these too, so a knob read from nowhere still shows the theme. `npm run check` reads
1319
- every declaration of every component file and every literal of an inline `style` in `src/` and `.design-sync/previews/`
1320
- (`lint/values.mjs`, before the tests run) and fails on a value written in place, naming the file, the line, the kind and
1321
- the value: a knob's fallback (`z-index: var(--x, 5)`), a number inside `calc()` in a leading or a tracking, `scale` and
1308
+ A knob's default is one of these too, so a knob read from nowhere still shows the theme. No value is written in place in
1309
+ a component file or an inline `style` in `src/` and `.design-sync/previews/` (`lint/values.mjs` names what counts): a knob's fallback (`z-index: var(--x, 5)`), a number inside `calc()` in a leading or a tracking, `scale` and
1322
1310
  `scale()`, `filter: opacity()`, a fade in %, a unit in capitals and every CSS colour name included; a number on a length
1323
- in a `style` object is px. A sign or an identity (`* -1`, `0`, `1`, `100%`) is not a value. `tests/tokens.spec.js` holds it at none.
1311
+ in a `style` object is px. A sign or an identity (`* -1`, `0`, `1`, `100%`) is not a value.
1324
1312
 
1325
1313
  ## Icons & touch targets
1326
1314
 
package/lib/guide.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  // lib/guide.mjs — the few rules of using cardds that no checker can see, for an AI session: ONE text, two doors —
2
2
  // `npx cardds guide` (bin/cardds.mjs) prints it, the MCP server (lib/mcp.mjs) hands it over as its `instructions` at start.
3
3
  // Short on purpose: an MCP client may truncate server instructions, so the trigger and the order come first. A component's own rules are
4
- // not here — they are in its JSDoc (get_component) and in lint/rules.mjs (check).
4
+ // not here — they are in its JSDoc (get_component) and in lint/rules.mjs.
5
5
  export const GUIDE = `cardds — BEFORE drawing any phone-width / mobile screen in a project with @usableapp/cardds, or that Lh asks to build "with cardds": load these tools (ToolSearch "cardds" if deferred) and call find_components. Even when the request only says prototype, poc, mock-up, sketch, "show me a design", หน้า, หน้าจอ, ขึ้นหน้า, ขอดู prototype — a screen, card, bottom sheet, sheet stack, form step, sticky note / post-it, chat of notes, stamp, postcard, home. Never hand-write HTML, CSS or emoji for what it has.
6
- ORDER: find → scaffold or get → write → check. First question: has cardds drawn this screen already? find BOTH ways: by the axes (represents · shape · interact) and by the task's English noun ("sticky", "stamp", "chat").
7
- TOOLS: find_components · scaffold_screen · get_component · list_components · check_source. No MCP: npx cardds find|scaffold|get|list|check (all take --json).
6
+ ORDER: find → scaffold or get → write. First question: has cardds drawn this screen already? find BOTH ways: by the axes (represents · shape · interact) and by the task's English noun ("sticky", "stamp", "chat").
7
+ TOOLS: find_components · scaffold_screen · get_component · list_components. No MCP: npx cardds find|scaffold|get|list (all take --json). check / check_source: a person's tool, never a session's step.
8
8
  What no checker sees:
9
9
  1. cardds is a framework you take from outside. Never edit, commit to or release cardds from a consumer project, never node_modules. What cannot be set from outside is a framework gap: STOP, tell the user what you needed.
10
10
  2. Adjust from outside only, widest first: theme.css bases → knobs (--<component>-<what>) → props/slots. Theme values are the user's call, never yours. cardGrounds() names a card the member cannot see on that theme; inkGrounds() a word or glyph they cannot read (docs/reference.md).
@@ -12,6 +12,6 @@ What no checker sees:
12
12
  4. Import components, never copy their markup or classes: a component is the look AND the behaviour.
13
13
  5. Mobile only, big targets, never adapted to desktop.
14
14
  6. Option row: title = the answer; meta = only the deciding difference, all or none (docs/reference.md).
15
- An HTML prototype (scaffold --html) is a still picture, never a screen; when it warns, run the tsx. check is tsx only.
16
- A component's own rules: get_component; check enforces them.
15
+ An HTML prototype (scaffold --html) is a still picture, never a screen; when it warns, write the tsx.
16
+ A component's own rules: get_component.
17
17
  `;
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…). Call it on each screen before you call it done; an empty list means clean, an error must be fixed.',
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
@@ -1,7 +1,6 @@
1
1
  // lint/rules.mjs — how a PROJECT uses cardds, as code. ONE rule set, two front doors (Lh 2026-09-29, "one standard"):
2
2
  // • `npx cardds check [dir]` (bin/cardds.mjs) — no dependency, runs anywhere
3
3
  // • the ESLint plugin (lint/eslint.mjs, `@usableapp/cardds/eslint`) — the same findings in the editor and CI
4
- // cardds's own tests run it on the gallery's stories (tests/lint.spec.js) and on the screens (tests/composition.spec.js).
5
4
  // Plain text in, findings out: { rule, level: 'error' | 'warn', file, line, message }. No parser — any .tsx/.jsx/.ts/.js.
6
5
  import { readFileSync, readdirSync } from 'node:fs';
7
6
  import { dirname, join } from 'node:path';
package/lint/values.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // lint/values.mjs — a value cardds writes for itself (Lh 2026-10-20: "the gallery is a component catalog: a component that slips out of the tokens or
2
2
  // the theme is a problem, because that is how a hard-coded look gets made that cannot be taken out and used"). Every declaration of a component's css
3
3
  // and every literal in an inline `style` of the package's own .tsx is read; what it may not hold is named by kind. The foundation files are where the
4
- // values live, so they are not read. `npm run check` reports these before the tests run (scripts/own-values.mjs); tests/tokens.spec.js holds them at none.
4
+ // values live, so they are not read.
5
5
  import { readFileSync, readdirSync, statSync } from 'node:fs';
6
6
  import { join } from 'node:path';
7
7
  import { blankComments, braceAt, lineOf, styleEntries } from './rules.mjs';
@@ -66,7 +66,7 @@ export function ownIn(prop, raw) {
66
66
  return out;
67
67
  }
68
68
 
69
- /** a component's css rules (tests/helpers.js cssRules) → every value written in place, at the line of its declaration */
69
+ /** a component's css rules → every value written in place, at the line of its declaration */
70
70
  export function ownValues(rules) {
71
71
  return rules.flatMap((r) => r.decls.flatMap((d, i) => {
72
72
  const at = d.indexOf(':'), prop = d.slice(0, at).trim(), raw = d.slice(at + 1).trim();
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.134",
3
+ "version": "0.7.136",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
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), tests/ measures the geometry.",
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).",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+ssh://git@github.com/everysundays/cardds.git"
@@ -11,21 +11,15 @@
11
11
  "scripts": {
12
12
  "dev": "vite --config gallery/vite.config.ts",
13
13
  "build": "node scripts/build-icons.mjs && tsc -p tsconfig.json && node scripts/flatten-css.mjs && node scripts/build-catalog.mjs",
14
- "validate:inbox": "node scripts/validate-inbox.mjs",
15
14
  "release": "node scripts/publish.mjs",
16
15
  "release:check": "node scripts/publish.mjs --check",
17
16
  "prepack": "npm run build",
18
- "knobs": "node scripts/knobs.mjs",
19
- "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p gallery/tsconfig.json --noEmit",
20
- "dup": "jscpd",
21
- "check": "node scripts/own-values.mjs && node bin/cardds.mjs check .design-sync/previews gallery/src"
17
+ "knobs": "node scripts/knobs.mjs"
22
18
  },
23
19
  "devDependencies": {
24
- "@playwright/test": "1.58.2",
25
20
  "@types/react": "^19.3.0",
26
21
  "@types/react-dom": "^19.3.0",
27
22
  "@vitejs/plugin-react": "^6.1.1",
28
- "jscpd": "4.3.0",
29
23
  "react": "^19.3.0",
30
24
  "react-dom": "^19.3.0",
31
25
  "react-router": "^8.3.1",