strata-react 2.1.6 → 2.1.7
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
|
@@ -247,7 +247,7 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
|
|
|
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
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", a blue info ring), put it in a place ("Put apple in the basket"; every place that takes it gets the same ring); tap it again to put it down, or tap its gap in the pile ("Put … back"). Or drag it there by pointer (from the press, no long press). With one place a tap moves at once, in or out (a big X on hover). `limit` caps a place: a piece put in a full one sends the one there back ("in place of 4"). The pile keeps a slot per piece and each place room for all it can hold (a lone place takes the row), so nothing moves during a round (the held word sits over its piece's foot; the Check keeps its room once locked). 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 (`check` draws its big Check, `Button size="lg"` with a tick either side); `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 |
|
|
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", a blue info ring), put it in a place ("Put apple in the basket"; every place that takes it gets the same ring); tap it again to put it down, or tap its gap in the pile ("Put … back"). Or drag it there by pointer (from the press, no long press). With one place a tap moves at once, in or out (a big X on hover). `limit` caps a place: a piece put in a full one sends the one there back ("in place of 4"). The pile keeps a slot per piece and each place room for all it can hold (a lone place takes the row), so nothing moves during a round (the held word sits over its piece's foot; the Check keeps its room once locked). 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 (`check` draws its big Check, `Button size="lg"` with a tick either side; `check.untilPlaced` greys it out until the pile is empty, for a round with a set number of answers); `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
|
| Seeing for a moment | `Glimpse`, `useCountdown` | Something shown briefly and then hidden ("How many did you see?"). A 3-2-1 (`count`) before every look, then the content for `ms` with a bar under it that empties as the time goes (`drain`), then hidden with its room kept, so nothing under it moves. Changing `again` shows it again, count and timer included (after a wrong answer); `peeks` offers that many looks again on a "Look again" button in the empty box, gone once used. `onLook` reports each look and why (`first`, `again`, `peek`). `useCountdown(running, seconds, onDone)` is the whole-second count on its own (an auto Next) |
|
|
252
252
|
| 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 |
|
|
253
253
|
| 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 |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AsyncActionOptions, B as RowAction, C as useColorScheme, D as DensityName, E as Density, F as useAsyncAction, H as buttonVariants, I as Button, L as ButtonProps, M as AsyncLabels, N as FieldErrors, O as DensityProps, P as Phase, R as IconButton, S as palettes, T as useSystemColorScheme, U as ControlSize, V as RowActionProps, W as IconComponent, _ as PaletteOption, a as browserMicrophone, b as colorSchemeScript, c as COLOR_SCHEME_STORAGE_KEY, d as ColorSchemeLabels, f as ColorSchemePreference, g as PaletteChoice, h as PALETTE_STORAGE_KEY, i as MicrophoneStream, j as AsyncButton, k as AsyncAction, l as ColorScheme, m as DEFAULT_PALETTE, n as MicrophoneContext, o as explainMicrophoneError, p as ColorSchemeState, r as MicrophoneError, s as useMicrophone, t as Microphone, u as ColorSchemeChoice, v as PaletteState, w as usePalette, x as paletteScript, y as ThemeProvider, z as IconButtonProps } from "./microphone-
|
|
1
|
+
import { A as AsyncActionOptions, B as RowAction, C as useColorScheme, D as DensityName, E as Density, F as useAsyncAction, H as buttonVariants, I as Button, L as ButtonProps, M as AsyncLabels, N as FieldErrors, O as DensityProps, P as Phase, R as IconButton, S as palettes, T as useSystemColorScheme, U as ControlSize, V as RowActionProps, W as IconComponent, _ as PaletteOption, a as browserMicrophone, b as colorSchemeScript, c as COLOR_SCHEME_STORAGE_KEY, d as ColorSchemeLabels, f as ColorSchemePreference, g as PaletteChoice, h as PALETTE_STORAGE_KEY, i as MicrophoneStream, j as AsyncButton, k as AsyncAction, l as ColorScheme, m as DEFAULT_PALETTE, n as MicrophoneContext, o as explainMicrophoneError, p as ColorSchemeState, r as MicrophoneError, s as useMicrophone, t as Microphone, u as ColorSchemeChoice, v as PaletteState, w as usePalette, x as paletteScript, y as ThemeProvider, z as IconButtonProps } from "./microphone-xGKxcK6p.js";
|
|
2
2
|
import { n as geo, t as LatLng } from "./geo-DfKa9JtK.js";
|
|
3
3
|
import { $ as ChartMark, A as SpanOutcome, B as StageGuides, C as MediaSpanData, Ct as PlayerWarning, D as SpanActionsNotice, E as SpanActions, F as RateChoice, G as VolumeControlProps, H as Transport, I as SeekBar, J as KeysLegend, K as transportShortcuts, L as SeekBarProps, M as useMediaSpans, N as MediaStage, O as SpanBehaviour, P as Precision, Q as useHotkeys, R as SeekBarSpan, S as MediaProgress, St as skipAction, T as PlayerNotice, Tt as usePlayerWarnings, U as TransportProps, V as TimeReadout, W as VolumeControl, X as isTypingTarget, Y as Shortcut, Z as keyName, _ as MediaStat, _t as MediaMark, a as MediaPlayerProps, at as LineChartProps, b as mediaStatRows, bt as SkipSteps, c as MediaSource, ct as YScale, d as SPEECH_RATES, dt as CursorMapping, et as ChartSpan, f as SourceAttacher, ft as CursorOwner, g as useMediaElement, gt as useSharedCursor, h as useAttachedSource, ht as SharedCursor, i as MediaPlayer, it as LineChartGroupProps, j as SpanWords, k as SpanKind, l as MediaWindow, lt as logScale, m as StreamContext, mt as CursorScopeProps, n as MediaElementState, nt as LineChart, o as MediaProblem, ot as Point, p as StreamAttachment, pt as CursorScope, q as HotkeysOptions, r as MediaHeading, rt as LineChartGroup, s as MediaSession, st as SpanTone, t as MediaElementOptions, tt as GroupedChart, u as ResumeWords, ut as valueAt, v as MediaStats, vt as SkipAction, w as MediaSpansState, wt as PlayerWarningEvent, x as useMediaStats, xt as marksFor, y as StreamStats, yt as SkipLevel, z as SpanStrip } from "./media-player-C6j069Aa.js";
|
|
4
4
|
import { ClassValue } from "clsx";
|
|
@@ -3169,11 +3169,15 @@ type PlaceBoardProps<P, S> = {
|
|
|
3169
3169
|
beckonMs?: number;
|
|
3170
3170
|
/** How many pieces a place holds at most (an order's slot: 1). A piece put in a full place sends the one there back to the pile, so a learner can put a piece on top of another instead of moving that one out first. Default: no limit. */
|
|
3171
3171
|
limit?: (place: S) => number;
|
|
3172
|
-
/**
|
|
3172
|
+
/**
|
|
3173
|
+
* The app's check, drawn as the board's big button under the places while it is not locked ("Check", with a tick either side); once locked it holds its room, invisible and inert.
|
|
3174
|
+
* `untilPlaced`: greyed out and inert until no piece is left in the pile, for a round with a set number of answers (match each to its pair, put all in order), where checking half an answer only teaches that the button does nothing. Leave it off where how many to place is the challenge (give a number, pick out the ones that belong), so the Check is ready from the start.
|
|
3175
|
+
*/
|
|
3173
3176
|
check?: {
|
|
3174
3177
|
label: string;
|
|
3175
3178
|
onCheck: () => void;
|
|
3176
3179
|
disabled?: boolean;
|
|
3180
|
+
untilPlaced?: boolean;
|
|
3177
3181
|
};
|
|
3178
3182
|
className?: string;
|
|
3179
3183
|
};
|
package/dist/index.js
CHANGED
|
@@ -13198,7 +13198,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
13198
13198
|
variant: "default",
|
|
13199
13199
|
size: "lg",
|
|
13200
13200
|
onClick: check.onCheck,
|
|
13201
|
-
disabled: check.disabled,
|
|
13201
|
+
disabled: check.disabled || check.untilPlaced && pieces.some((p) => where(p) === null),
|
|
13202
13202
|
children: [
|
|
13203
13203
|
/* @__PURE__ */ jsx(Check, {
|
|
13204
13204
|
"aria-hidden": true,
|