strata-react 1.3.27 → 2.0.0

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/README.md CHANGED
@@ -246,8 +246,8 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
246
246
  | Marking text | `MarkableText`, `Mark`, `MarkSummary`; `rangeBetween` | Select words by drag, Shift+click and Shift+arrows (ids in document order, so it holds across virtualised rows), apply the app's marks from a bar or single-key chords, marks drawn by role, pattern and text, summarised and announced |
247
247
  | Maps | `strata-react/map`: `RouteMap`; `geo`, `LatLng` (main entry) | Routes and a position that moves along them, on Leaflet (no react-leaflet), behind its own entry. Tiles are the app's (`tiles.light`, `tiles.dark`, each with its attribution); the dark scheme uses the dark set or a filter over the light one. Route colours are roles resolved at draw time; `values` with `colourScale` colour a route by value in runs of one step, with a key that names the steps; a single route gets direction chevrons and start/finish marks (a loop is one mark). The position is one marker moved with `setLatLng`: no route is redrawn for it (keep `routes` stable). As picture content (a route inset over footage): `zoom` sets any zoom (animate it per frame), `follow="centre"` holds the view exactly on a position with no animation (a frame is deterministic), and `positions` draws several, each tied to a route, in its colour and named in the text alternative; routes are not redrawn for any of it. Leaflet's keyboard pan and zoom stay; the map is named by `label` and described by a generated text alternative (routes, lengths, position along). Overlay slots `topEnd` and `bottomStart` avoid Leaflet's own controls and attribution. Leaflet's stylesheet is injected once, so an app imports nothing. `geo` (distance, bearing, bounds, `pointAlong`, `arrows`, `ends`) and `format.distance` need no map library |
248
248
  | Timeline | `Timeline`, `useTimelineZoom`, `TimelineZoomControls`, `noOverlap` | Items with a start and a length in lanes on a zoomable time axis, for media edits, bookings, rotas and plans. The timeline draws and the app decides: every move, trim, lane change, selection and current-time change is reported (`onItemChange`, `onSelect`, `onPositionChange`) and the app applies it; `validate` refuses a change with a reason shown in words while it is made. One tab stop for the items; arrows move between them, Ctrl+arrows nudge and change lane, Alt+arrows trim, the current time is its own slider, `+` `-` `0` zoom, and each change is announced ("run-02.mp4 moved to 0:13"). The ruler picks steps people write on a scale so labels never collide. Lanes take drops from outside (`dropTypes`, `onDrop` with the lane and snapped time, `validateDrop`, and React Aria's keyboard drag landing at the current time), `laneRows` makes them taller, `kindColours` fixes each kind's stripe, and the header column fits its content. Only items near the view are rendered |
249
- | Answering by tap | `ChoiceGrid`, `ChoiceGridSkeleton`, `ChoiceState`; the `type-picture` step | One question, large picture tiles, one right answer, for someone who may not read yet (a child's learning game). Each tile is `open`, `wrong` (greyed, never red), `right` or `answer` (shown after the tries ran out), always with its word; a choice with no answer key ("Which one next?", a rating) uses `picked` (primary border, neutral word, `marks={{ picked }}`), which closes the grid so a slow request cannot be tapped twice; the app owns the answer key. Answered tiles cannot be pressed again and the grid closes once the answer shows. React Aria's `GridList`: arrows across and down, Enter answers. Tiles at least 120px (`md`) or 160px (`lg`) |
250
- | Answering by placing | `PlaceBoard`, `PlaceState` | An answer that is an arrangement (give a number, put in order, match pairs, sort), for someone who may not read yet. Two taps: pick a piece up (`aria-pressed`, "Picked up"), put it in a place ("Put apple in the basket"); tap it again to put it down, "Put … back" returns a placed one. Same presses by touch, mouse, keyboard and screen reader; places are disabled until a piece is held, so Tab walks the pieces, then the places; focus follows a moved piece. The app owns `placement`, applies `onMove` and checks; `placeState` marks a place `right` or `wrong` (neutral, never red) with its word, `locked` ends the round. Pieces 96px or more in the pile, 72px once placed |
249
+ | Answering by tap | `ChoiceGrid`, `ChoiceGridSkeleton`, `ChoiceState`; the `type-picture` step | One question, large picture tiles, one right answer, for someone who may not read yet (a child's learning game). Each tile is `open`, `wrong` (greyed, never red), `right` or `answer` (shown after the tries ran out), always with its word; a choice with no answer key ("Which one next?", a rating) uses `picked` (primary border, neutral word, `marks={{ picked }}`), which closes the grid so a slow request cannot be tapped twice; the app owns the answer key. Answered tiles cannot be pressed again and the grid closes once the answer shows. React Aria's `GridList`: arrows across and down, Enter answers. Tiles at least 120px (`md`) or 160px (`lg`); `stretch` shares the row out so a few tiles fill a wide screen; `beckon` pulses the open tiles one at a time in a random order until the grid closes |
250
+ | Answering by placing | `PlaceBoard`, `PlaceState` | An answer that is an arrangement (give a number, put in order, match pairs, sort), for someone who may not read yet. Two taps: pick a piece up (`aria-pressed`, "Picked up"), put it in a place ("Put apple in the basket"); tap it again to put it down, "Put … back" returns a placed one. Same presses by touch, mouse, keyboard and screen reader; places are disabled until a piece is held, so Tab walks the pieces, then the places; focus follows a moved piece. The app owns `placement`, applies `onMove` and checks; `placeState` marks a place `right` or `wrong` (neutral, never red) with its word, `locked` ends the round. Pieces 96px or more in the pile, 72px once placed; `beckon` pulses the pile's pieces one at a time while none is held; `stretch` shares the pile's and places' rows out; a picture never outgrows its tile |
251
251
  | Sortable list | `SortableList` | Reorder a list and move items between lists, by pointer and by keyboard. React Aria's `GridList` with `useDragAndDrop` (no `@dnd-kit`): a grip per row is the drag handle, so clicking a row selects it and its own actions still work; Enter on the grip picks up, arrows and Tab choose a position or list, Enter drops, Escape cancels, with React Aria's screen-reader announcements. Items carry a kind (`getKind`); a list takes the kinds in `accepts` and says why it refuses another (`refuses`, shown with an icon while that kind is dragged over it). The list never changes the data: `onReorder` and `onInsert` report the move and the app applies it, undoably |
252
252
  | Drag source | `DragSource` | A row that is dragged onto a drop target elsewhere (a `Timeline` lane), by pointer or from the keyboard. React Aria's `useDrag` with a drag button: a grip named "Drag <label>" picks it up with Enter, Tab moves between targets that take its types, Enter drops, Escape cancels, with React Aria's announcements; the pointer can pick up the whole row and the row's own buttons still work. `items` returns the drag's data (`DragData`, a type to a value), read by the target |
253
253
  | File intake | `FileButton`, `FileDropZone`, `FileDropOverlay`, `FileOutcomes`, `MissingFile`, `useFileIntake` | Pick or drop local files, then one outcome per file. `FileButton` is React Aria's `FileTrigger` behind a real named button (the keyboard and phone route); `FileDropZone` is its `DropZone` and says what it takes while a drag is over it; `FileDropOverlay` (also `Workspace onFiles`) is the whole window as the target, with an overlay that names what it takes; it ignores the app's own drags (every `DragSource`'s, and any type named in `refuseTypes`), so a keyboard drag to a timeline lane does not stop on it. `useFileIntake({ accept, acceptLabel, process })` judges each file after the drop, so a wrong one is named with its reason (type, `maxBytes`, your `check`), runs your own `process` per file (a throw becomes `Failed` with its message and a retry), and never blocks the rest. `FileOutcomes` draws the rows and announces one summary per batch. `MissingFile` is a status word and a "Relink" that opens the picker for that item; the name wraps in a narrow pane and a `thumbnail` can lead it. Nothing assumes a server |
package/UPGRADING.md CHANGED
@@ -11,6 +11,10 @@ time. While the version is 0.x, any release may break.
11
11
 
12
12
  Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Changelog").
13
13
 
14
+ ## 2026-11-27 (ChoiceGrid and PlaceBoard tiles cap their pictures)
15
+
16
+ - `ChoiceGrid` tiles and `PlaceBoard` pieces are size containers, and a picture is drawn at `type-picture` but never more than 75% of its tile. Visual baselines of these may move by a few pixels, and a held `PlaceBoard` piece no longer grows past its square; look at the diffs and update.
17
+
14
18
  ## 2026-11-26 (built with Vite+)
15
19
 
16
20
  - The package is now built by `vp pack` (tsdown). The type declarations are one bundled file per entry (`dist/testing.d.ts`, `dist/visual.d.ts`, ...) instead of a `dist/<entry>/index.d.ts` tree. Imports through the package's `exports` are unchanged; only an app that reached into `dist/` by path (do not) needs to change.
package/dist/index.d.ts CHANGED
@@ -3093,14 +3093,22 @@ type ChoiceGridProps<T> = {
3093
3093
  onChoose: (item: T) => void;
3094
3094
  /** Default `md`. */
3095
3095
  size?: ChoiceSize;
3096
+ /** Share the row out between the tiles there are, so a few tiles fill a wide screen; default off (tiles keep to their minimum and the rest of the row is empty). */
3097
+ stretch?: boolean;
3098
+ /** Pulse the open tiles one at a time in a random order, every `beckonMs`, until the grid closes. */
3099
+ beckon?: boolean;
3100
+ /** Time between pulses while `beckon`; default 1600. */
3101
+ beckonMs?: number;
3096
3102
  className?: string;
3097
3103
  };
3098
3104
  /** A grid of large picture tiles for answering one question with a tap: each tile open, wrong, right, shown as the answer or (no answer key) picked, with its word; answered tiles cannot be pressed again, and the grid closes once the answer shows. */
3099
- export declare function ChoiceGrid<T>({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size, className }: ChoiceGridProps<T>): React.JSX.Element;
3105
+ export declare function ChoiceGrid<T>({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size, stretch, beckon, beckonMs, className }: ChoiceGridProps<T>): React.JSX.Element;
3100
3106
  /** The loading shape of a `ChoiceGrid`: `count` tiles at the same size, for a `DataView` skeleton. */
3101
- export declare function ChoiceGridSkeleton({ count, size, className }: {
3107
+ export declare function ChoiceGridSkeleton({ count, size, stretch, className }: {
3102
3108
  count?: number;
3103
3109
  size?: ChoiceSize;
3110
+ /** As the grid it stands in for. */
3111
+ stretch?: boolean;
3104
3112
  className?: string;
3105
3113
  }): React.JSX.Element;
3106
3114
  /** A place after the app has checked the arrangement: not checked, or right or wrong. */
@@ -3137,10 +3145,16 @@ type PlaceBoardProps<P, S> = {
3137
3145
  };
3138
3146
  /** The round is over: no piece can be picked up. */
3139
3147
  locked?: boolean;
3148
+ /** Share each row out between the pieces and places there are (as ChoiceGrid's `stretch`), so a few fill a wide screen. */
3149
+ stretch?: boolean;
3150
+ /** Pulse the pieces in the pile one at a time in a random order, every `beckonMs`, while none is held and the board is not locked. */
3151
+ beckon?: boolean;
3152
+ /** Time between pulses while `beckon`; default 1600. */
3153
+ beckonMs?: number;
3140
3154
  className?: string;
3141
3155
  };
3142
3156
  /** Pictures put into places with two taps (pick up, put down) for an answer that is an arrangement: give a number, order, match, sort. The app owns where each piece is and checks it; the board only moves what the learner asks. */
3143
- export declare function PlaceBoard<P, S>({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState, marks, locked, className }: PlaceBoardProps<P, S>): React.JSX.Element;
3157
+ export declare function PlaceBoard<P, S>({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState, marks, locked, stretch, beckon, beckonMs, className }: PlaceBoardProps<P, S>): React.JSX.Element;
3144
3158
  /** A list that renders only its visible rows (React Aria's GridList and Virtualizer) from `virtualizeFrom` items, with arrow-key navigation between rows. */
3145
3159
  export declare function VirtualList<T>({ label, items, itemKey, children, estimateSize, rowHeight, height, virtualizeFrom, bounded, footer, className }: {
3146
3160
  label: string;
package/dist/index.js CHANGED
@@ -12414,18 +12414,63 @@ function ViewOptions({ view, shown, total, label = "View options", className })
12414
12414
  });
12415
12415
  }
12416
12416
 
12417
+ // src/lib/beckon.ts
12418
+ /** The thing to pulse next: any of `open` but `last`, at random (or the only one). */
12419
+ function nextBeckon(open, last) {
12420
+ const others = open.length > 1 ? open.filter((k) => k !== last) : open;
12421
+ return others[Math.floor(Math.random() * others.length)] ?? null;
12422
+ }
12423
+ const SEP$1 = "\0";
12424
+ /** Which of `open` pulses now, moving every `ms` while `on`; null when off or none is open. The class alternates
12425
+ * between two names of the same pulse each beat: a CSS animation runs again only when its name changes, so the last
12426
+ * open tile, lit beat after beat, still pulses each time (Codex on #400). */
12427
+ function useBeckon(on, open, ms) {
12428
+ const [lit, setLit] = React.useState(null);
12429
+ const openKey = open.join(SEP$1);
12430
+ React.useEffect(() => {
12431
+ if (!on || openKey === "") return;
12432
+ const keys = openKey.split(SEP$1);
12433
+ let last = null;
12434
+ let beat = 0;
12435
+ const t = setInterval(() => {
12436
+ last = nextBeckon(keys, last);
12437
+ beat += 1;
12438
+ setLit(last === null ? null : {
12439
+ key: last,
12440
+ beat
12441
+ });
12442
+ }, ms);
12443
+ return () => {
12444
+ clearInterval(t);
12445
+ setLit(null);
12446
+ };
12447
+ }, [
12448
+ on,
12449
+ openKey,
12450
+ ms
12451
+ ]);
12452
+ return lit !== null && open.includes(lit.key) ? {
12453
+ key: lit.key,
12454
+ className: lit.beat % 2 ? "beckon" : "beckon-again"
12455
+ } : null;
12456
+ }
12457
+ /** A tile's picture: the `type-picture` step, but never more than 75% of the tile it sits in (the tile is a size
12458
+ * container), so an app that grows the step on a wide screen does not push a picture out of a small tile. */
12459
+ const pictureInTile = { fontSize: "min(var(--type-picture-size, 4.5rem), 75cqi)" };
12460
+
12417
12461
  // src/components/choice-grid.tsx
12418
12462
  const minSide = {
12419
12463
  md: 120,
12420
12464
  lg: 160
12421
12465
  };
12422
12466
  const closed = (s) => s === "right" || s === "answer" || s === "picked";
12423
- const columns = (size) => ({ gridTemplateColumns: `repeat(auto-fill, minmax(min(${minSide[size]}px, 100%), 1fr))` });
12467
+ const columns = (size, stretch = false) => ({ gridTemplateColumns: `repeat(${stretch ? "auto-fit" : "auto-fill"}, minmax(min(${minSide[size]}px, 100%), 1fr))` });
12424
12468
  /** A grid of large picture tiles for answering one question with a tap: each tile open, wrong, right, shown as the answer or (no answer key) picked, with its word; answered tiles cannot be pressed again, and the grid closes once the answer shows. */
12425
- function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size = "md", className }) {
12469
+ function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size = "md", stretch = false, beckon = false, beckonMs = 1600, className }) {
12426
12470
  const byKey = new Map(items.map((item) => [itemKey(item), item]));
12427
12471
  const over = items.some((item) => closed(state(item)));
12428
12472
  const disabledKeys = items.filter((item) => over || state(item) !== "open").map(itemKey);
12473
+ const lit = useBeckon(beckon && !over, items.filter((item) => state(item) === "open").map(itemKey), beckonMs);
12429
12474
  return /* @__PURE__ */ jsx(GridList, {
12430
12475
  "aria-label": label,
12431
12476
  layout: "grid",
@@ -12436,7 +12481,7 @@ function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, ma
12436
12481
  if (item !== void 0) onChoose(item);
12437
12482
  },
12438
12483
  className: cn("grid min-w-0 gap-4 outline-none", className),
12439
- style: columns(size),
12484
+ style: columns(size, stretch),
12440
12485
  children: items.map((item) => {
12441
12486
  const key = itemKey(item);
12442
12487
  const s = state(item);
@@ -12446,10 +12491,12 @@ function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, ma
12446
12491
  textValue: itemLabel(item),
12447
12492
  "aria-label": mark ? `${itemLabel(item)}, ${mark.toLowerCase()}` : itemLabel(item),
12448
12493
  "data-choice": s,
12449
- className: cn("flex aspect-square min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-2 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", (s === "right" || s === "answer") && "border-4 border-success bg-success-subtle disabled:hover:border-success", s === "picked" && "border-4 border-primary bg-surface-sunken disabled:hover:border-primary"),
12494
+ "data-beckon": key === lit?.key || void 0,
12495
+ className: cn("@container flex aspect-square min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-2 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", key === lit?.key && cn(lit.className, "border-primary"), (s === "right" || s === "answer") && "border-4 border-success bg-success-subtle disabled:hover:border-success", s === "picked" && "border-4 border-primary bg-surface-sunken disabled:hover:border-primary"),
12450
12496
  children: [/* @__PURE__ */ jsx("span", {
12451
12497
  "aria-hidden": true,
12452
12498
  className: cn("type-picture transition-state", s === "wrong" && "opacity-40"),
12499
+ style: pictureInTile,
12453
12500
  children: renderPicture(item)
12454
12501
  }), mark && /* @__PURE__ */ jsx(Status, {
12455
12502
  tone: s === "wrong" || s === "picked" ? "neutral" : "success",
@@ -12461,11 +12508,11 @@ function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, ma
12461
12508
  });
12462
12509
  }
12463
12510
  /** The loading shape of a `ChoiceGrid`: `count` tiles at the same size, for a `DataView` skeleton. */
12464
- function ChoiceGridSkeleton({ count = 4, size = "md", className }) {
12511
+ function ChoiceGridSkeleton({ count = 4, size = "md", stretch = false, className }) {
12465
12512
  return /* @__PURE__ */ jsx("div", {
12466
12513
  "aria-hidden": true,
12467
12514
  className: cn("grid min-w-0 gap-4", className),
12468
- style: columns(size),
12515
+ style: columns(size, stretch),
12469
12516
  children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx("span", { className: "block aspect-square rounded-overlay bg-muted" }, i))
12470
12517
  });
12471
12518
  }
@@ -12476,7 +12523,8 @@ const placedSide = 72;
12476
12523
  const placedPicture = { "--type-picture-size": "2.5rem" };
12477
12524
  const placeSide = 160;
12478
12525
  /** Pictures put into places with two taps (pick up, put down) for an answer that is an arrangement: give a number, order, match, sort. The app owns where each piece is and checks it; the board only moves what the learner asks. */
12479
- function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState = () => "open", marks, locked = false, className }) {
12526
+ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState = () => "open", marks, locked = false, stretch = false, beckon = false, beckonMs = 1600, className }) {
12527
+ const fill = stretch ? "auto-fit" : "auto-fill";
12480
12528
  const [heldKey, setHeld] = React.useState(null);
12481
12529
  const [follow, setFollow] = React.useState(null);
12482
12530
  const buttons = React.useRef(/* @__PURE__ */ new Map());
@@ -12487,6 +12535,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
12487
12535
  };
12488
12536
  const held = locked ? void 0 : pieces.find((p) => pieceKey(p) === heldKey);
12489
12537
  const heldAt = held === void 0 ? null : where(held);
12538
+ const lit = useBeckon(beckon && !locked && held === void 0, pieces.filter((p) => where(p) === null).map(pieceKey), beckonMs);
12490
12539
  React.useEffect(() => {
12491
12540
  if (follow === null) return;
12492
12541
  buttons.current.get(follow)?.focus();
@@ -12512,11 +12561,15 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
12512
12561
  isDisabled: locked,
12513
12562
  "aria-label": isHeld ? `${pieceLabel(p)}, ${marks.held.toLowerCase()}` : pieceLabel(p),
12514
12563
  "data-held": isHeld || void 0,
12515
- className: cn("flex aspect-square min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-1 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", "selected:border-4 selected:border-primary selected:bg-muted"),
12564
+ "data-beckon": key === lit?.key || void 0,
12565
+ className: cn("@container flex aspect-square min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-1 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", "selected:border-4 selected:border-primary selected:bg-muted", key === lit?.key && cn(lit.className, "border-primary")),
12516
12566
  children: [/* @__PURE__ */ jsx("span", {
12517
12567
  "aria-hidden": true,
12518
12568
  className: "type-picture",
12519
- style: placed ? placedPicture : void 0,
12569
+ style: placed ? {
12570
+ ...placedPicture,
12571
+ ...pictureInTile
12572
+ } : pictureInTile,
12520
12573
  children: renderPiece(p)
12521
12574
  }), isHeld && /* @__PURE__ */ jsx(Status, {
12522
12575
  tone: "info",
@@ -12529,7 +12582,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
12529
12582
  role: "group",
12530
12583
  "aria-label": name,
12531
12584
  className: "grid min-w-0 gap-2",
12532
- style: { gridTemplateColumns: `repeat(auto-fill, minmax(min(${side}px, 100%), 1fr))` },
12585
+ style: { gridTemplateColumns: `repeat(${side === placedSide ? "auto-fill" : fill}, minmax(min(${side}px, 100%), 1fr))` },
12533
12586
  children: inside.map((p) => piece(p, side === placedSide))
12534
12587
  });
12535
12588
  const pile = pieces.filter((p) => where(p) === null);
@@ -12545,7 +12598,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
12545
12598
  })]
12546
12599
  }), /* @__PURE__ */ jsx("div", {
12547
12600
  className: "grid min-w-0 gap-4",
12548
- style: { gridTemplateColumns: `repeat(auto-fill, minmax(min(${placeSide}px, 100%), 1fr))` },
12601
+ style: { gridTemplateColumns: `repeat(${fill}, minmax(min(${placeSide}px, 100%), 1fr))` },
12549
12602
  children: places.map((s) => {
12550
12603
  const key = placeKey(s);
12551
12604
  const state = placeState(s);