strata-react 1.0.32 → 1.0.33
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 +1 -1
- package/UPGRADING.md +1 -0
- package/dist/components/cursor.d.ts +44 -0
- package/dist/components/line-chart.d.ts +92 -3
- package/dist/components/media.d.ts +6 -1
- package/dist/{geo-C0jcFp4q.js → cursor-DplHNzj3.js} +173 -3
- package/dist/cursor-DplHNzj3.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +505 -176
- package/dist/index.js.map +1 -1
- package/dist/lib/geo.d.ts +17 -1
- package/dist/map/fan.d.ts +15 -0
- package/dist/map/index.d.ts +3 -1
- package/dist/map/markers.d.ts +60 -0
- package/dist/map/route-map.d.ts +53 -1
- package/dist/map.js +624 -40
- package/dist/map.js.map +1 -1
- package/package.json +1 -1
- package/dist/geo-C0jcFp4q.js.map +0 -1
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ strata-react is ESM-only (`exports` has only `import`), as is its peer `react-ro
|
|
|
144
144
|
| Notices and progress | `Alert`, `toast`, `StrataToastRegion`, `useClientWork`, `JobStatus` | Three weights. A `toast` confirms finished work and goes by itself (5 s plus 40 ms a character, 8 s minimum with an action, paused under the pointer or focus, always dismissable); it has no danger tone, because an error a person must act on is an inline `Alert` with its recovery as `action` (`announce` makes it `role="alert"` only when it answers something the person just did). `StrataToastRegion` goes once at the app root. `useClientWork` runs browser work with progress, cancel (aborts its `signal`, ends `cancelled`, never `failed`) and a double-start guard; `JobStatus` shows it exactly as it shows a server job, with `onCancel`, `cancelled` and `onDismiss` |
|
|
145
145
|
| Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES` | Play a file or a sequence of chapters without the event glue: the element, its state, Strata's controls (or the browser's own on a touch device, `controls="auto"`), a load error with Try again, `navigator.mediaSession` metadata, the seek bar spanning the whole sequence. `useMediaElement(ref)` alone follows an element drawn with the browser's controls |
|
|
146
146
|
| Media playback | `Transport`, `SeekBar`, `TimeReadout`, `VolumeControl`, `RateChoice`, `MediaStage`, `StageGuides`, `transportShortcuts`, `format.timecode` | The controls around anything that plays, wired to a player the app owns (HTML media, Web Audio, a canvas, a data replay). Every control is a named icon button in one toolbar; the play button's name is "Play" or "Pause". `SeekBar` has the formatted time as its accessible value, arrows step 5 s and Page keys 30 s by default, and optional marks. `VolumeControl` shows its percent, and muting remembers the level. `transportShortcuts` is the one list for `useHotkeys` and `KeysLegend` (Space and K, J and L, the arrows by a frame, Home and End). `format.timecode` prints m:ss, m:ss.mmm or m:ss:ff. `MediaStage` fits a picture of any aspect ratio into the pane with a letterbox on the sunken surface role, and takes overlays such as `StageGuides` |
|
|
147
|
-
| 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 |
|
|
147
|
+
| 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. Items on the map (`markers`): pins in states that are shapes as well as colour (circle, ringed, diamond), a stretch of a route drawn heavier, a close group fanned out deterministically around its true place with leader lines, only those near the view drawn, a card per marker, a key; `cursor` shows a shared reading from a `CursorScope`; `onViewChange` reports the settled view, `view` restores one, and a reset control returns to the fit; `picking` + `onPick` chooses a place by click or by arrow keys, with the nearest point on each route. Leaflet's stylesheet is injected once, so an app imports nothing. `geo` (distance, bearing, bounds, `pointAlong`, `arrows`, `ends`, `snap`, `slice`) and `format.distance` need no map library |
|
|
148
148
|
| 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 |
|
|
149
149
|
| 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 |
|
|
150
150
|
| File intake | `FileButton`, `FileDropZone`, `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. `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
|
@@ -13,6 +13,7 @@ Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Chang
|
|
|
13
13
|
|
|
14
14
|
## After v0.1.17 (2026-11-11 to 2026-11-12)
|
|
15
15
|
|
|
16
|
+
- `RouteMap` draws a "Reset view" button under the zoom control; a test that counts the map's buttons, and any `RouteMap` visual baseline, will see it.
|
|
16
17
|
- `MediaPlayer`: the `<audio>`/`<video>` element is now labelled "<label>, audio" (or "video") and the group keeps "<label>"; a test that queried the element by the bare label queries the group or the longer name. With several players on a page, Space, K, J, L and M go to the one last played, focused or pressed (a single player is unchanged); `shortcuts={false}` still opts out.
|
|
17
18
|
- `Switch` and `Checkbox` `detail` is now the control's accessible description, not part of its name: `getByRole("switch", { name: "Show 1 video" })` finds it, and a test that matched the name with a regex to include the detail should query the exact label (and `toHaveAccessibleDescription` for the detail).
|
|
18
19
|
- `renderWithStrata` and `renderRoutes` render a `StrataToastRegion` and clear the toast queue before each render. A test whose route tree already renders the region (a root layout route) passes `toasts: false`, or finds every toast twice.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** Who set the cursor: a pointer or key over a member, or playback (a player's clock). */
|
|
3
|
+
export type CursorOwner = "pointer" | "playback";
|
|
4
|
+
/** How a member's own x relates to the scope's unit. Both default to the identity. */
|
|
5
|
+
export type CursorMapping = {
|
|
6
|
+
/** From this member's x to the scope's unit (a chart in seconds in a scope in metres: look it up in the series). */
|
|
7
|
+
toCursor?: (x: number) => number;
|
|
8
|
+
/** From the scope's unit to this member's x. */
|
|
9
|
+
fromCursor?: (at: number) => number;
|
|
10
|
+
};
|
|
11
|
+
type Snapshot = {
|
|
12
|
+
/** The position now: the pointer's while there is one, else playback's; null when neither is set. */
|
|
13
|
+
at: number | null;
|
|
14
|
+
/** Who wrote `at`; a member ignores a position it wrote. */
|
|
15
|
+
source: string | null;
|
|
16
|
+
owner: CursorOwner | null;
|
|
17
|
+
};
|
|
18
|
+
export type CursorScopeProps = {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/** Words for the position in the scope's unit ("12.4 km along", "1:23"), for the polite announcement. Without it nothing is announced. */
|
|
21
|
+
format?: (at: number) => string;
|
|
22
|
+
/** Milliseconds between announcements. Default 1000. */
|
|
23
|
+
announceEvery?: number;
|
|
24
|
+
};
|
|
25
|
+
/** Holds one cursor position for the charts, map and seek bar inside it, with a throttled polite announcement of where a pointer or key has put it. */
|
|
26
|
+
export declare function CursorScope({ children, format, announceEvery }: CursorScopeProps): React.JSX.Element;
|
|
27
|
+
/** What a member reads and writes. */
|
|
28
|
+
export type SharedCursor = Snapshot & {
|
|
29
|
+
/** This member's own id: positions it writes are not drawn back at it. */
|
|
30
|
+
source: string;
|
|
31
|
+
/** The position another member (or playback) put there, in the scope's unit; null when none or when this member wrote it. */
|
|
32
|
+
other: number | null;
|
|
33
|
+
/** The pointer or keyboard is at `at` over this member (the scope's unit). `null`: it left. */
|
|
34
|
+
setPointer: (at: number | null) => void;
|
|
35
|
+
/** Playback is at `at` (the scope's unit). Call it from the player's clock; `null` when it stops. */
|
|
36
|
+
setPlayback: (at: number | null) => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Join the nearest `CursorScope` as one member. Returns null outside a scope, so a component can take a
|
|
40
|
+
* `cursor` prop and do nothing when the app has not set one up. `source` is this member's id; the
|
|
41
|
+
* default is a unique one.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useSharedCursor(source?: string): SharedCursor | null;
|
|
44
|
+
export {};
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
import { CursorMapping } from './cursor';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
export type Point = {
|
|
3
4
|
x: number;
|
|
4
5
|
y: number;
|
|
5
6
|
};
|
|
7
|
+
/** Shading tones for `spans`: the role's subtle fill. */
|
|
8
|
+
export type SpanTone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
9
|
+
/** A stretch of x shaded behind the line (stops, usable footage, a chosen stretch). */
|
|
10
|
+
export type ChartSpan = {
|
|
11
|
+
from: number;
|
|
12
|
+
to: number;
|
|
13
|
+
label: string;
|
|
14
|
+
tone?: SpanTone;
|
|
15
|
+
};
|
|
16
|
+
/** A labelled point on the line, as a control. */
|
|
17
|
+
export type ChartMark = {
|
|
18
|
+
x: number;
|
|
19
|
+
/** Its name: "Clip 4". Said with its x, listed for screen readers and shown on hover and focus. */
|
|
20
|
+
label: string;
|
|
21
|
+
/** Any CSS colour, normally a role. Default the foreground. */
|
|
22
|
+
colour?: string;
|
|
23
|
+
selected?: boolean;
|
|
24
|
+
};
|
|
6
25
|
export type LineChartProps = {
|
|
7
26
|
/** What the chart shows, as a sentence. Used as the accessible name and the table caption. */
|
|
8
27
|
label: string;
|
|
@@ -18,8 +37,29 @@ export type LineChartProps = {
|
|
|
18
37
|
/** What x is, as the screen-reader table's first column heading: "Distance", "Day". Default "Time". */
|
|
19
38
|
xLabel?: string;
|
|
20
39
|
formatY: (y: number) => string;
|
|
21
|
-
/** Where to put x labels, in x units. The chart drops every other one (and so on) when they would overlap at its width. */
|
|
22
|
-
xTicks: number[]
|
|
40
|
+
/** Where to put x labels, in x units, or a function of the visible range (so labels can switch between clock time and distance). The chart drops every other one (and so on) when they would overlap at its width. */
|
|
41
|
+
xTicks: number[] | ((range: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
}) => number[]);
|
|
45
|
+
/** A fixed x range, for charts that share one axis (`LineChartGroup` sets it). Default: the series' own. */
|
|
46
|
+
xDomain?: readonly [number, number];
|
|
47
|
+
/** `"none"` draws no x labels: the upper charts of a stack. Default `"labels"`. */
|
|
48
|
+
xAxis?: "labels" | "none";
|
|
49
|
+
/** `"log"` for a quantity that spans decades (pace, a magnitude). Ticks are 1, 2, 5 steps chosen here; a reading at or below zero is not drawn and is counted under the chart. Default `"linear"`. */
|
|
50
|
+
yScale?: "linear" | "log";
|
|
51
|
+
/** The smaller value at the top (pace: faster is up). */
|
|
52
|
+
yInvert?: boolean;
|
|
53
|
+
/** Stretches shaded behind the line, named in the key and the text for screen readers. */
|
|
54
|
+
spans?: readonly ChartSpan[];
|
|
55
|
+
/** Labelled points on the line. One tab stop; arrows move between them. */
|
|
56
|
+
marks?: readonly ChartMark[];
|
|
57
|
+
/** A mark was pressed (a click, Enter or Space). */
|
|
58
|
+
onMarkSelect?: (mark: ChartMark) => void;
|
|
59
|
+
/** What shows beside a mark on hover and focus: words, as in `Tooltip`. Default the mark's label and x. */
|
|
60
|
+
renderMarkCard?: (mark: ChartMark) => React.ReactNode;
|
|
61
|
+
/** Join the nearest `CursorScope`: hovering or arrowing here puts a rule and this chart's reading in every member, and theirs shows here. `true` when x is the scope's unit; a mapping when it is not (time here, distance there). */
|
|
62
|
+
cursor?: boolean | CursorMapping;
|
|
23
63
|
/** Pin the bottom of the y-axis (default: 0, or lower if a reading is negative). A reading below it still shows. */
|
|
24
64
|
yMin?: number;
|
|
25
65
|
/** Pin the top of the y-axis, for a bounded quantity such as a percentage (`yMax={100}`), so a low reading looks low. Choose a range that divides into four steps. A reading above it still shows. */
|
|
@@ -65,10 +105,59 @@ export declare function yScale(values: number[], pin?: {
|
|
|
65
105
|
max: number;
|
|
66
106
|
ticks: number[];
|
|
67
107
|
};
|
|
108
|
+
/** What a y scale gives the chart: its ends, ticks and where a value falls between them (0 at `min`, 1 at `max`). */
|
|
109
|
+
export type YScale = {
|
|
110
|
+
min: number;
|
|
111
|
+
max: number;
|
|
112
|
+
ticks: number[];
|
|
113
|
+
at: (v: number) => number;
|
|
114
|
+
log: boolean;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* A logarithmic y axis over the positive values: the ends are the nearest 1, 2, 5 steps outside the
|
|
118
|
+
* data, the ticks are those steps, thinned to whole decades and then every k-th decade when there are
|
|
119
|
+
* more than seven. Values at or below zero are ignored (the chart reports them). A pinned end is used as
|
|
120
|
+
* given when it is positive and does not cut a reading off.
|
|
121
|
+
*/
|
|
122
|
+
export declare function logScale(values: number[], pin?: {
|
|
123
|
+
min?: number;
|
|
124
|
+
max?: number;
|
|
125
|
+
}): YScale;
|
|
126
|
+
/** The value of a series at x, read between the two readings either side (flat beyond the ends). Series need not be sorted. */
|
|
127
|
+
export declare function valueAt(series: readonly Point[], x: number): number;
|
|
68
128
|
/**
|
|
69
129
|
* The x ticks that fit at this width: every k-th tick, the smallest k for which neighbouring labels
|
|
70
130
|
* leave a gap, so the spacing stays even. `scale` maps an x value to a pixel.
|
|
71
131
|
*/
|
|
72
132
|
export declare function fitTicks(ticks: number[], scale: (x: number) => number, widthOf: (t: number) => number, gap?: number): number[];
|
|
73
133
|
/** One measured series, drawn in real pixels, with the peak and current readings labelled on the chart and every reading in a screen-reader table. Optional plan, threshold band and `colourScale`. */
|
|
74
|
-
export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel, formatY, xTicks, yMin, yMax, colour, colourScale, colourScaleLabel, current, end, formatCurrent, readout, onPick, area, height, className, }: LineChartProps): React.JSX.Element;
|
|
134
|
+
export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel, formatY, xTicks, xDomain, xAxis, yScale: yMode, yInvert, spans, marks, onMarkSelect, renderMarkCard, cursor: cursorProp, yMin, yMax, colour, colourScale, colourScaleLabel, current, end, formatCurrent, readout, onPick, area, height, className, }: LineChartProps): React.JSX.Element;
|
|
135
|
+
/** One chart of a `LineChartGroup`: the props that differ per chart. The group owns the x axis, the cursor, `current` and `onPick`. */
|
|
136
|
+
export type GroupedChart = Omit<LineChartProps, "formatX" | "xLabel" | "xTicks" | "xDomain" | "xAxis" | "current" | "onPick" | "cursor" | "readout" | "label"> & {
|
|
137
|
+
/** Names this chart in the group's reading and its own accessible name. Default `seriesLabel`. */
|
|
138
|
+
label?: string;
|
|
139
|
+
};
|
|
140
|
+
export type LineChartGroupProps = {
|
|
141
|
+
/** What the stack shows, as a sentence. */
|
|
142
|
+
label: string;
|
|
143
|
+
charts: readonly GroupedChart[];
|
|
144
|
+
formatX: (x: number) => string;
|
|
145
|
+
xLabel?: string;
|
|
146
|
+
xTicks: LineChartProps["xTicks"];
|
|
147
|
+
/** Drawn on every chart (a chart's own `spans` and `marks` replace them). */
|
|
148
|
+
spans?: readonly ChartSpan[];
|
|
149
|
+
marks?: readonly ChartMark[];
|
|
150
|
+
onMarkSelect?: (mark: ChartMark) => void;
|
|
151
|
+
renderMarkCard?: (mark: ChartMark) => React.ReactNode;
|
|
152
|
+
/** The current x, drawn on every chart. */
|
|
153
|
+
current?: number;
|
|
154
|
+
onPick?: (x: number) => void;
|
|
155
|
+
className?: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Charts stacked on one x axis: one shared range, labels on the last chart only, and one cursor, so
|
|
159
|
+
* hovering or arrowing in any chart puts a rule and that chart's own reading in all of them (read
|
|
160
|
+
* together, and announced as one sentence, politely, at most once a second). Inside a `CursorScope`
|
|
161
|
+
* already, it joins that scope (a map beside the charts moves with them); otherwise it makes its own.
|
|
162
|
+
*/
|
|
163
|
+
export declare function LineChartGroup({ label, charts, formatX, xLabel, xTicks, spans, marks, onMarkSelect, renderMarkCard, current, onPick, className }: LineChartGroupProps): React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Shortcut } from './hotkeys';
|
|
2
|
+
import { CursorMapping } from './cursor';
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
export type Precision = "seconds" | "ms" | "frames";
|
|
4
5
|
type TimeProps = {
|
|
@@ -36,10 +37,14 @@ export type SeekBarProps = TimeProps & {
|
|
|
36
37
|
bigStep?: number;
|
|
37
38
|
label?: string;
|
|
38
39
|
disabled?: boolean;
|
|
40
|
+
/** Join the nearest `CursorScope` (strata-react issue #184): a pointer over the bar puts its time in every member, another member's position shows as a faint tick, and the bar's own time is the scope's playback position (`playback: false` to leave that to the app). A mapping when the scope's unit is not seconds (a route's metres). */
|
|
41
|
+
cursor?: boolean | (CursorMapping & {
|
|
42
|
+
playback?: boolean;
|
|
43
|
+
});
|
|
39
44
|
className?: string;
|
|
40
45
|
};
|
|
41
46
|
/** A seek bar: dragged, clicked and moved by keys (arrows `step`, Page keys `bigStep`, Home and End), with its time as the accessible value. */
|
|
42
|
-
export declare function SeekBar({ time, duration: known, onSeek, marks, onMarkPress, buffered, step, bigStep, label, precision, fps, disabled: off, className }: SeekBarProps): React.JSX.Element;
|
|
47
|
+
export declare function SeekBar({ time, duration: known, onSeek, marks, onMarkPress, buffered, step, bigStep, label, precision, fps, disabled: off, cursor: cursorProp, className }: SeekBarProps): React.JSX.Element;
|
|
43
48
|
export type TransportProps = {
|
|
44
49
|
playing: boolean;
|
|
45
50
|
onPlayPause: () => void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
3
|
// src/lib/format.ts
|
|
2
4
|
var NBSP = "\xA0";
|
|
3
5
|
/** The placeholder printed for a value that is not known: an en dash. */
|
|
@@ -301,7 +303,53 @@ function nearest(points, position) {
|
|
|
301
303
|
});
|
|
302
304
|
return best;
|
|
303
305
|
}
|
|
304
|
-
/**
|
|
306
|
+
/** The part of a route between two distances along it (metres, clamped, either order): the cut ends and every point between. Empty for no route. */
|
|
307
|
+
function slice(points, from, to, along = cumulative(points)) {
|
|
308
|
+
if (!points.length) return [];
|
|
309
|
+
const [a, b] = from <= to ? [from, to] : [to, from];
|
|
310
|
+
const start = pointAlong(points, a, along);
|
|
311
|
+
const end = pointAlong(points, b, along);
|
|
312
|
+
const lo = Math.max(a, 0);
|
|
313
|
+
const hi = Math.min(b, along[along.length - 1]);
|
|
314
|
+
return [
|
|
315
|
+
start,
|
|
316
|
+
...points.filter((_, i) => along[i] > lo && along[i] < hi),
|
|
317
|
+
end
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The nearest point on a route to `position`, not only its vertices: where it lies, how far along the
|
|
322
|
+
* route that is, and how far `position` is from the route. The inverse of `pointAlong` (a cursor on a
|
|
323
|
+
* map is a distance on a chart). Each leg is flattened around its own latitude, which is exact enough
|
|
324
|
+
* for any leg a recording has; `index` is the leg's first point. Null for fewer than one point.
|
|
325
|
+
*/
|
|
326
|
+
function snap(points, position, along = cumulative(points)) {
|
|
327
|
+
if (!points.length) return null;
|
|
328
|
+
if (points.length === 1) return {
|
|
329
|
+
position: points[0],
|
|
330
|
+
metres: 0,
|
|
331
|
+
offset: distance(points[0], position),
|
|
332
|
+
index: 0
|
|
333
|
+
};
|
|
334
|
+
let best = null;
|
|
335
|
+
for (let i = 1; i < points.length; i++) {
|
|
336
|
+
const [p, q] = [points[i - 1], points[i]];
|
|
337
|
+
const k = Math.cos((p[0] + q[0]) / 2 * Math.PI / 180);
|
|
338
|
+
const [dx, dy] = [(q[1] - p[1]) * k, q[0] - p[0]];
|
|
339
|
+
const len2 = dx * dx + dy * dy;
|
|
340
|
+
const t = len2 === 0 ? 0 : Math.min(1, Math.max(0, ((position[1] - p[1]) * k * dx + (position[0] - p[0]) * dy) / len2));
|
|
341
|
+
const at = [p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t];
|
|
342
|
+
const offset = distance(at, position);
|
|
343
|
+
if (!best || offset < best.offset) best = {
|
|
344
|
+
position: at,
|
|
345
|
+
metres: along[i - 1] + (along[i] - along[i - 1]) * t,
|
|
346
|
+
offset,
|
|
347
|
+
index: i - 1
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
return best;
|
|
351
|
+
}
|
|
352
|
+
/** Route geometry helpers: `geo.distance`, `bearing`, `length`, `cumulative`, `bounds`, `pointAlong`, `snap` (its inverse), `slice`, `arrows`, `ends`, `nearest`. */
|
|
305
353
|
var geo = {
|
|
306
354
|
distance,
|
|
307
355
|
bearing,
|
|
@@ -309,10 +357,132 @@ var geo = {
|
|
|
309
357
|
length,
|
|
310
358
|
bounds,
|
|
311
359
|
pointAlong,
|
|
360
|
+
snap,
|
|
361
|
+
slice,
|
|
312
362
|
arrows,
|
|
313
363
|
ends,
|
|
314
364
|
nearest
|
|
315
365
|
};
|
|
316
|
-
|
|
366
|
+
// src/components/cursor.tsx
|
|
367
|
+
var EMPTY = {
|
|
368
|
+
at: null,
|
|
369
|
+
source: null,
|
|
370
|
+
owner: null
|
|
371
|
+
};
|
|
372
|
+
var CursorStore = class {
|
|
373
|
+
pointer = null;
|
|
374
|
+
playback = null;
|
|
375
|
+
listeners = /* @__PURE__ */ new Set();
|
|
376
|
+
snapshot = EMPTY;
|
|
377
|
+
subscribe = (fn) => {
|
|
378
|
+
this.listeners.add(fn);
|
|
379
|
+
return () => void this.listeners.delete(fn);
|
|
380
|
+
};
|
|
381
|
+
publish() {
|
|
382
|
+
const e = this.pointer ?? this.playback;
|
|
383
|
+
const owner = this.pointer ? "pointer" : this.playback ? "playback" : null;
|
|
384
|
+
if (e?.at === this.snapshot.at && e?.source === this.snapshot.source && owner === this.snapshot.owner) return;
|
|
385
|
+
this.snapshot = e ? {
|
|
386
|
+
at: e.at,
|
|
387
|
+
source: e.source,
|
|
388
|
+
owner
|
|
389
|
+
} : EMPTY;
|
|
390
|
+
for (const l of this.listeners) l();
|
|
391
|
+
}
|
|
392
|
+
/** A pointer or key over a member. `null` means it left: it clears only if the pointer was this member's, so a stale leave cannot remove another member's position. */
|
|
393
|
+
setPointer(at, source) {
|
|
394
|
+
if (at === null) {
|
|
395
|
+
if (this.pointer?.source !== source) return;
|
|
396
|
+
this.pointer = null;
|
|
397
|
+
} else this.pointer = {
|
|
398
|
+
at,
|
|
399
|
+
source
|
|
400
|
+
};
|
|
401
|
+
this.publish();
|
|
402
|
+
}
|
|
403
|
+
setPlayback(at, source) {
|
|
404
|
+
this.playback = at === null ? null : {
|
|
405
|
+
at,
|
|
406
|
+
source
|
|
407
|
+
};
|
|
408
|
+
this.publish();
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var Scope = React.createContext(null);
|
|
412
|
+
/** Holds one cursor position for the charts, map and seek bar inside it, with a throttled polite announcement of where a pointer or key has put it. */
|
|
413
|
+
function CursorScope({ children, format, announceEvery = 1e3 }) {
|
|
414
|
+
const store = React.useRef(null);
|
|
415
|
+
store.current ??= new CursorStore();
|
|
416
|
+
return /* @__PURE__ */ jsxs(Scope.Provider, {
|
|
417
|
+
value: store.current,
|
|
418
|
+
children: [children, format && /* @__PURE__ */ jsx(CursorAnnouncer, {
|
|
419
|
+
store: store.current,
|
|
420
|
+
format,
|
|
421
|
+
every: announceEvery
|
|
422
|
+
})]
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
/** The live region: the latest pointer position, at most once per `every` ms (a throttle, so a pointer that never rests is still announced). */
|
|
426
|
+
function CursorAnnouncer({ store, format, every }) {
|
|
427
|
+
const snap = React.useSyncExternalStore(store.subscribe, () => store.snapshot, () => EMPTY);
|
|
428
|
+
const [text, setText] = React.useState("");
|
|
429
|
+
const latest = React.useRef({
|
|
430
|
+
snap,
|
|
431
|
+
format
|
|
432
|
+
});
|
|
433
|
+
latest.current = {
|
|
434
|
+
snap,
|
|
435
|
+
format
|
|
436
|
+
};
|
|
437
|
+
const last = React.useRef(0);
|
|
438
|
+
const timer = React.useRef(void 0);
|
|
439
|
+
React.useEffect(() => {
|
|
440
|
+
if (snap.owner !== "pointer" || snap.at === null) return;
|
|
441
|
+
const speak = () => {
|
|
442
|
+
timer.current = void 0;
|
|
443
|
+
last.current = Date.now();
|
|
444
|
+
const { snap: s, format: f } = latest.current;
|
|
445
|
+
if (s.owner === "pointer" && s.at !== null) setText(f(s.at));
|
|
446
|
+
};
|
|
447
|
+
const wait = last.current + every - Date.now();
|
|
448
|
+
if (wait <= 0) speak();
|
|
449
|
+
else timer.current ??= window.setTimeout(speak, wait);
|
|
450
|
+
}, [snap, every]);
|
|
451
|
+
React.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
452
|
+
return /* @__PURE__ */ jsx("p", {
|
|
453
|
+
role: "status",
|
|
454
|
+
"aria-live": "polite",
|
|
455
|
+
className: "sr-only",
|
|
456
|
+
children: text
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Join the nearest `CursorScope` as one member. Returns null outside a scope, so a component can take a
|
|
461
|
+
* `cursor` prop and do nothing when the app has not set one up. `source` is this member's id; the
|
|
462
|
+
* default is a unique one.
|
|
463
|
+
*/
|
|
464
|
+
function useSharedCursor(source) {
|
|
465
|
+
const store = React.useContext(Scope);
|
|
466
|
+
const own = React.useId();
|
|
467
|
+
const id = source ?? own;
|
|
468
|
+
const subscribe = React.useCallback((fn) => store ? store.subscribe(fn) : () => {}, [store]);
|
|
469
|
+
const snap = React.useSyncExternalStore(subscribe, () => store?.snapshot ?? EMPTY, () => EMPTY);
|
|
470
|
+
const setPointer = React.useCallback((at) => store?.setPointer(at, id), [store, id]);
|
|
471
|
+
const setPlayback = React.useCallback((at) => store?.setPlayback(at, id), [store, id]);
|
|
472
|
+
return React.useMemo(() => store ? {
|
|
473
|
+
...snap,
|
|
474
|
+
source: id,
|
|
475
|
+
other: snap.at !== null && snap.source !== id ? snap.at : null,
|
|
476
|
+
setPointer,
|
|
477
|
+
setPlayback
|
|
478
|
+
} : null, [
|
|
479
|
+
store,
|
|
480
|
+
snap,
|
|
481
|
+
id,
|
|
482
|
+
setPointer,
|
|
483
|
+
setPlayback
|
|
484
|
+
]);
|
|
485
|
+
}
|
|
486
|
+
export { NBSP as a, toDate as c, MISSING as i, useSharedCursor as n, createFormat as o, geo as r, format as s, CursorScope as t };
|
|
317
487
|
|
|
318
|
-
//# sourceMappingURL=
|
|
488
|
+
//# sourceMappingURL=cursor-DplHNzj3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-DplHNzj3.js","names":[],"sources":["../src/lib/format.ts","../src/lib/geo.ts","../src/components/cursor.tsx"],"sourcesContent":["// Every number and date on screen goes through Intl, once, here. Units are joined with a\n// non-breaking space so \"212 °C\" never wraps between figure and unit. A product that is not\n// en-GB calls createFormat with its locale once and exports the result from its own lib.\n//\n// The number formatters are callable (`format.integer(n)`) because that is the form people reach\n// for (strata-react issue #12), and they keep Intl's methods (`format.integer.format(n)`,\n// `formatToParts`, `resolvedOptions`) so existing calls and Intl knowledge still work.\n//\n// Dates follow the same shape. Every date formatter is callable with a Date, an ISO string or\n// epoch milliseconds (`format.dateTime(row.at)`), because rows arrive from an API as ISO strings\n// and an app that has to wrap each one in `new Date(...)` soon builds its own Intl.DateTimeFormat\n// beside it instead (strata-react issue #31, from the Bright Horizons History screen). An invalid\n// date throws a RangeError naming the input rather than printing \"Invalid Date\" into a row.\n// `date` and `dateTime` use Intl's medium/short styles, so the locale decides the order\n// (\"8 Nov 2026, 06:05\" in en-GB, \"Nov 8, 2026, 6:05 AM\" in en-US) and nobody hand-writes a\n// pattern. `timeZone` is optional: left out, times are the viewer's; a product that shows a place's\n// times (a kiln in one room, a shop's opening hours) passes that place's zone once.\n//\n// Tests: the non-breaking space is a real character in the DOM. Testing Library's text matchers\n// (`getByText`, `toHaveTextContent`) collapse whitespace and match \"6 pieces\", but accessible-name\n// matching (`getByRole(\"heading\", { name: \"6 pieces\" })`) compares the name exactly and does not.\n// Build the expected string with the same formatter (`{ name: format.count(6, \"piece\") }`), or\n// use a regex with `\\s` (`/6\\spieces/`), which matches U+00A0.\n//\n// A value that is not known (`null` or `undefined`: a count the source does not give, a date for\n// something never synced) prints as the placeholder, an en dash unless `createFormat`'s `missing`\n// says otherwise, from every number and date formatter (strata-react issue #47). Each screen used\n// to pick its own (\"–\", \"Never\", blank), so tables and cards disagreed. An invalid date still\n// throws: that is a bug, not a missing value.\n//\n// Three formatters came from the Tubes viewer, which wrote its own (strata-react issue #52): `ago`\n// (\"3 weeks ago\", from Intl.RelativeTimeFormat, with `now` passed in by tests), `compact` (\"1.2k\"\n// in en-GB, and `count`'s `{ compact: true }` for \"1.2k views\") and `runningTime` (\"4:05\", \"1:02:09\"), the\n// m:ss of a media player, which Intl.DurationFormat's long form is not. `share` is `percent` for a\n// part of a whole (strata-react issue #43): a part that is there never prints as \"0%\", nor a part\n// short of the whole as \"100%\".\n\nexport const NBSP = \" \";\n\n/** The placeholder printed for a value that is not known: an en dash. */\nexport const MISSING = \"–\";\n\n/** The decimal byte units `format.bytes` writes. */\nexport type ByteUnit = \"B\" | \"kB\" | \"MB\" | \"GB\" | \"TB\" | \"PB\";\nconst BYTE_UNITS: readonly ByteUnit[] = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\"];\nconst BYTE_SIZE = Object.fromEntries(BYTE_UNITS.map((u, i) => [u, 1000 ** i])) as Record<ByteUnit, number>;\n\n/** An `Intl.NumberFormat` that can also be called directly: `f(n)` is `f.format(n)`. `null` or `undefined` prints the placeholder. */\nexport type NumberFormatter = ((value: number | bigint | Intl.StringNumericLiteral | null | undefined) => string) & {\n format: (value: number | bigint | Intl.StringNumericLiteral | null | undefined) => string;\n} & Pick<Intl.NumberFormat, \"formatToParts\" | \"resolvedOptions\">;\n\n/** What a date formatter accepts: a Date, an ISO 8601 string, or epoch milliseconds. */\nexport type DateInput = Date | string | number;\n\n/** An `Intl.DateTimeFormat` that can also be called directly, with a Date, an ISO string or epoch milliseconds. */\nexport type DateFormatter = ((value: DateInput | null | undefined) => string) & {\n format: (value: DateInput | null | undefined) => string;\n formatToParts: (value: DateInput) => Intl.DateTimeFormatPart[];\n formatRange: (start: DateInput, end: DateInput) => string;\n} & Pick<Intl.DateTimeFormat, \"resolvedOptions\">;\n\n/** Options shared by every date formatter one `createFormat` call makes. */\nexport interface FormatOptions {\n /** An IANA zone (\"Europe/London\", \"UTC\") to show times in. Left out, times are the viewer's own. */\n timeZone?: string;\n /** What a missing value (`null`, `undefined`) prints as. Default an en dash (`MISSING`). */\n missing?: string;\n}\n\n/** Options for `format.count`. */\nexport interface CountOptions {\n /** Write the figure compactly: \"1.2k views\". The noun still agrees with the exact count. */\n compact?: boolean;\n}\n\n/** A Date from a Date, an ISO string or epoch milliseconds; throws a RangeError naming the input when it is not a date. */\nexport function toDate(value: DateInput): Date {\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) throw new RangeError(`Not a date: ${JSON.stringify(String(value))}`);\n return date;\n}\n\nfunction callableDate(df: Intl.DateTimeFormat, missing: string): DateFormatter {\n const format = (value: DateInput | null | undefined) => (value == null ? missing : df.format(toDate(value)));\n return Object.assign(format, {\n format,\n formatToParts: (value: DateInput) => df.formatToParts(toDate(value)),\n formatRange: (start: DateInput, end: DateInput) => df.formatRange(toDate(start), toDate(end)),\n resolvedOptions: () => df.resolvedOptions(),\n });\n}\n\nfunction callable(nf: Intl.NumberFormat, missing: string): NumberFormatter {\n const format = (value: number | bigint | Intl.StringNumericLiteral | null | undefined) => (value == null ? missing : nf.format(value));\n return Object.assign(format, {\n format,\n formatToParts: (value: number | bigint) => nf.formatToParts(value),\n resolvedOptions: () => nf.resolvedOptions(),\n });\n}\n\n// Largest first: `ago` says a span in the largest unit it fills at least once, rounded down, so\n// 13 days is \"last week\" and 20 days \"2 weeks ago\", never \"3 weeks\" too early.\nconst DAY = 86_400_000;\nconst AGO_STEPS: readonly [Intl.RelativeTimeFormatUnit, number][] = [\n [\"year\", 365 * DAY],\n [\"month\", 30 * DAY],\n [\"week\", 7 * DAY],\n [\"day\", DAY],\n [\"hour\", 3_600_000],\n [\"minute\", 60_000],\n];\n\n/** Intl formatters for one locale (and optionally one time zone): integers, decimals, percent, dates, times, units with a non-breaking space, byte sizes, and counted nouns. */\nexport function createFormat(locale: string, options: FormatOptions = {}) {\n const { timeZone, missing = MISSING } = options;\n const dates = (opts: Intl.DateTimeFormatOptions) => callableDate(new Intl.DateTimeFormat(locale, { ...opts, timeZone }), missing);\n const integer = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }), missing);\n const decimal = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }), missing);\n const percent = callable(new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 }), missing);\n const compact = callable(new Intl.NumberFormat(locale, { notation: \"compact\", maximumFractionDigits: 1 }), missing);\n const relative = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n const plurals = new Intl.PluralRules(locale);\n const clock = dates({ hour: \"2-digit\", minute: \"2-digit\" });\n const day = dates({ weekday: \"long\", day: \"numeric\", month: \"long\" });\n const shortDay = dates({ weekday: \"short\", hour: \"2-digit\", minute: \"2-digit\" });\n const date = dates({ dateStyle: \"medium\" });\n const dateTime = dates({ dateStyle: \"medium\", timeStyle: \"short\" });\n const withUnit = (value: number, unit: string, fmt: Pick<Intl.NumberFormat, \"format\"> = integer) =>\n `${fmt.format(value)}${NBSP}${unit}`;\n return {\n locale,\n /** The zone times are shown in, or `undefined` for the viewer's own. */\n timeZone,\n /** Whole numbers with grouping: `format.integer(1222)` is \"1,222\". */\n integer,\n /** One decimal place at most: `format.decimal(3.14)` is \"3.1\". */\n decimal,\n /** A ratio as a whole percent: `format.percent(0.42)` is \"42%\". */\n percent,\n /**\n * A part's share of a whole, as `percent` but never misleading at the ends: a part above 0 that\n * rounds to 0 is \"<1%\", and one short of the whole that rounds to 100 is \">99%\".\n * `format.share(2.4 / 512)` is \"<1%\".\n */\n share: (value: number | null | undefined) => {\n if (value == null || Number.isNaN(value)) return missing;\n if (value > 0 && value < 0.005) return `<${percent.format(0.01)}`;\n if (value >= 0.995 && value < 1) return `>${percent.format(0.99)}`;\n return percent.format(value);\n },\n /** A figure in short form for counts that run to thousands: `format.compact(1234)` is \"1.2k\" in en-GB, \"1.2K\" in en-US. */\n compact,\n /**\n * How long ago (or how far ahead) a time is, in the largest unit it reaches:\n * \"3 weeks ago\", \"yesterday\", \"in 2 hours\", \"now\" under a minute. Pass `now` in tests.\n */\n ago: (value: DateInput | null | undefined, now: DateInput = new Date()) => {\n if (value == null) return missing;\n const diff = toDate(value).getTime() - toDate(now).getTime();\n const span = Math.abs(diff);\n for (const [unit, size] of AGO_STEPS) {\n if (span >= size) return relative.format(Math.sign(diff) * Math.floor(span / size), unit);\n }\n return relative.format(0, \"second\");\n },\n /**\n * A media running time from seconds, as a player shows it: \"4:05\", \"1:02:09\". Unknown\n * (null, negative, not finite) prints the placeholder. Set it in `tabular-nums`.\n */\n runningTime: (seconds: number | null | undefined) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n const s = Math.floor(seconds);\n const two = (n: number) => String(n).padStart(2, \"0\");\n const [h, m] = [Math.floor(s / 3600), Math.floor((s % 3600) / 60)];\n return h > 0 ? `${h}:${two(m)}:${two(s % 60)}` : `${m}:${two(s % 60)}`;\n },\n /**\n * A position in media as an editor shows it, to a chosen precision: \"4:05\" (seconds), \"4:05.250\"\n * (`\"ms\"`), or \"0:04:05:07\" (`\"frames\"` at `fps`, the last part the frame). Hours appear only\n * from one hour, except in frames. Frames are always four parts, hours included, as SMPTE\n * timecode is (non-drop frame, with colons): a three-part \"1:05:00\" reads as one hour five, so\n * a frame count must never be three. Editors write the same four parts (strata-react issue\n * #122). Floors, never rounds up, so a time never reads ahead of the picture. Unknown (null,\n * negative, not finite) prints the placeholder. Set it in `tabular-nums`.\n */\n timecode: (seconds: number | null | undefined, { precision = \"seconds\", fps = 30 }: { precision?: \"seconds\" | \"ms\" | \"frames\"; fps?: number } = {}) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n const whole = Math.floor(seconds);\n const two = (n: number) => String(n).padStart(2, \"0\");\n const [h, m] = [Math.floor(whole / 3600), Math.floor((whole % 3600) / 60)];\n const base = h > 0 ? `${h}:${two(m)}:${two(whole % 60)}` : `${m}:${two(whole % 60)}`;\n if (precision === \"ms\") return `${base}.${String(Math.min(Math.floor((seconds - whole) * 1000 + 1e-6), 999)).padStart(3, \"0\")}`;\n if (precision === \"frames\") return `${h}:${two(m)}:${two(whole % 60)}:${two(Math.min(Math.floor((seconds - whole) * fps + 1e-6), Math.ceil(fps) - 1))}`;\n return base;\n },\n /** What a missing value prints as: an en dash unless `createFormat`'s `missing` says otherwise. */\n missing,\n /** A time of day: `format.clock(at)` is \"06:05\". */\n clock,\n /** A day without its year, for this week's things: `format.day(at)` is \"Sunday 8 November\". */\n day,\n /** A weekday and time, for chart axes and recent rows: `format.shortDay(at)` is \"Sun 06:05\". */\n shortDay,\n /** A date with its year, for a record or a deadline: `format.date(at)` is \"8 Nov 2026\". */\n date,\n /** A date and time, for a log or history row: `format.dateTime(at)` is \"8 Nov 2026, 06:05\". */\n dateTime,\n /** A figure and its unit joined by a non-breaking space (`NBSP`), so they never wrap apart. */\n withUnit,\n /** A temperature in °C, joined by a non-breaking space. */\n celsius: (value: number) => withUnit(value, \"°C\"),\n /**\n * A size in bytes in the largest decimal unit it reaches (kB, MB, GB, TB, as disks and\n * networks are sold): one decimal below 10 (\"5.2 GB\"), whole above (\"431 GB\"). Pass `unit`\n * to fix the unit, so figures compared side by side (\"431 of 466 GB\") share one.\n */\n bytes: (value: number, unit?: ByteUnit) => {\n const chosen = unit ?? [...BYTE_UNITS].reverse().find((u) => Math.abs(value) >= BYTE_SIZE[u]) ?? \"B\";\n const scaled = value / BYTE_SIZE[chosen];\n return withUnit(scaled, chosen, Math.abs(scaled) < 10 && chosen !== \"B\" ? decimal : integer);\n },\n /**\n * A distance in metres as a person says it: metres under a kilometre (\"850 m\"), then\n * kilometres, one decimal below 100 (\"12.4 km\"), whole above; `\"imperial\"` is feet under a\n * tenth of a mile (\"320 ft\"), then miles (\"7.7 mi\").\n */\n distance: (metres: number, system: \"metric\" | \"imperial\" = \"metric\") => {\n if (system === \"imperial\") {\n const miles = metres / 1609.344;\n return miles < 0.1 ? withUnit(metres * 3.28084, \"ft\") : withUnit(miles, \"mi\", miles < 100 ? decimal : integer);\n }\n return Math.abs(metres) < 1000 ? withUnit(metres, \"m\") : withUnit(metres / 1000, \"km\", Math.abs(metres) < 100_000 ? decimal : integer);\n },\n /** The unit `bytes` would choose for a value, to share it across a set of figures. */\n byteUnit: (value: number): ByteUnit => [...BYTE_UNITS].reverse().find((u) => Math.abs(value) >= BYTE_SIZE[u]) ?? \"B\",\n /**\n * \"1 piece\", \"6 pieces\": the count and its noun, so copy never reads \"1 pieces\". They are\n * joined by a non-breaking space (`NBSP`), not a plain one: in a test, match with the same\n * call or a `\\s` regex, not a typed \"6 pieces\" string in a role's `name`.\n */\n count: (value: number | null | undefined, one: string, many = `${one}s`, { compact: short = false }: CountOptions = {}) =>\n value == null\n ? missing\n : `${(short ? compact : integer).format(value)}${NBSP}${plurals.select(value) === \"one\" ? one : many}`,\n };\n}\n\nexport type Format = ReturnType<typeof createFormat>;\n\n/** The en-GB formatters. */\nexport const format = createFormat(\"en-GB\");\n","// Geometry for routes on a map (strata-react issue #80; the helpers jonathanburnhams.com wrote by\n// hand for its activity maps). Pure functions on `[latitude, longitude]` pairs in degrees, no map\n// library, so they live in the main entry and an app can use them for a text alternative or a\n// profile without installing the map's peer.\n//\n// Distances are great-circle (haversine) on a 6,371 km sphere, which is within half a percent of\n// the true figure at any route length a person runs, rides or drives. Bearings use a flat\n// approximation between neighbouring points (the longitude scaled by the cosine of the mean\n// latitude), fine for the short hops a chevron or a heading needs and wrong for a leg of hundreds\n// of kilometres: `bearing` is for neighbouring points, not for a flight.\n\n/** A position: `[latitude, longitude]` in degrees. */\nexport type LatLng = readonly [lat: number, lng: number];\n\nconst RAD = Math.PI / 180;\nconst EARTH_RADIUS_M = 6_371_000;\n\n/** Great-circle distance between two positions, in metres. */\nexport function distance([lat1, lng1]: LatLng, [lat2, lng2]: LatLng): number {\n const a = Math.sin(((lat2 - lat1) * RAD) / 2) ** 2 + Math.cos(lat1 * RAD) * Math.cos(lat2 * RAD) * Math.sin(((lng2 - lng1) * RAD) / 2) ** 2;\n return 2 * EARTH_RADIUS_M * Math.asin(Math.sqrt(a));\n}\n\n/** The direction from `a` to `b` in degrees clockwise from north (0 to 360), for neighbouring points. */\nexport function bearing([lat1, lng1]: LatLng, [lat2, lng2]: LatLng): number {\n const dx = (lng2 - lng1) * Math.cos((((lat1 + lat2) / 2) * Math.PI) / 180);\n const dy = lat2 - lat1;\n return ((Math.atan2(dx, dy) * 180) / Math.PI + 360) % 360;\n}\n\n/** The running distance along a route at each point, in metres, starting at 0. */\nexport function cumulative(points: readonly LatLng[]): number[] {\n const out = points.length ? [0] : [];\n for (let i = 1; i < points.length; i++) out.push(out[i - 1] + distance(points[i - 1], points[i]));\n return out;\n}\n\n/** The length of a route in metres. */\nexport function length(points: readonly LatLng[]): number {\n let total = 0;\n for (let i = 1; i < points.length; i++) total += distance(points[i - 1], points[i]);\n return total;\n}\n\n/** The south-west and north-east corners that hold every point, or null for none. */\nexport function bounds(points: readonly LatLng[]): [LatLng, LatLng] | null {\n if (!points.length) return null;\n let south = Infinity;\n let north = -Infinity;\n let west = Infinity;\n let east = -Infinity;\n for (const [lat, lng] of points) {\n if (lat < south) south = lat;\n if (lat > north) north = lat;\n if (lng < west) west = lng;\n if (lng > east) east = lng;\n }\n return [\n [south, west],\n [north, east],\n ];\n}\n\n/** The position `metres` along a route (clamped to its ends), by linear interpolation, or null for no points. */\nexport function pointAlong(points: readonly LatLng[], metres: number, along: readonly number[] = cumulative(points)): LatLng | null {\n if (!points.length) return null;\n const total = along[along.length - 1];\n const d = Math.min(Math.max(metres, 0), total);\n if (points.length === 1 || total === 0) return points[0];\n let lo = 1;\n let hi = points.length - 1;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (along[mid] < d) lo = mid + 1;\n else hi = mid;\n }\n const [p, q] = [points[lo - 1], points[lo]];\n const t = (d - along[lo - 1]) / (along[lo] - along[lo - 1] || 1);\n return [p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t];\n}\n\n/**\n * `count` positions evenly spaced by distance along a route (the ends skipped), each with the\n * direction of travel there. The direction is smoothed: the bearing from a point a fraction\n * (`window`) of the spacing before to one the same distance after, so GPS jitter and a tight bend\n * do not turn a chevron sideways.\n */\nexport function arrows(points: readonly LatLng[], count = 5, window = 0.4): { position: LatLng; bearing: number }[] {\n if (points.length < 2 || count < 1) return [];\n const along = cumulative(points);\n const total = along[along.length - 1];\n if (total === 0) return [];\n const spacing = total / (count + 1);\n const half = spacing * window;\n return Array.from({ length: count }, (_, i) => {\n const target = spacing * (i + 1);\n const before = pointAlong(points, target - half, along)!;\n const after = pointAlong(points, target + half, along)!;\n return { position: pointAlong(points, target, along)!, bearing: bearing(before, after) };\n });\n}\n\n/** The first and last positions, and whether they are within `loopWithin` metres of each other (a loop), or null for no route. */\nexport function ends(points: readonly LatLng[], loopWithin = 50): { start: LatLng; finish: LatLng; loop: boolean } | null {\n if (!points.length) return null;\n const start = points[0];\n const finish = points[points.length - 1];\n return { start, finish, loop: distance(start, finish) <= loopWithin };\n}\n\n/** The index of the point nearest `position`, for \"where on the route is this?\". */\nexport function nearest(points: readonly LatLng[], position: LatLng): number {\n let best = -1;\n let bestD = Infinity;\n points.forEach((p, i) => {\n const d = distance(p, position);\n if (d < bestD) {\n bestD = d;\n best = i;\n }\n });\n return best;\n}\n\n/** The part of a route between two distances along it (metres, clamped, either order): the cut ends and every point between. Empty for no route. */\nexport function slice(points: readonly LatLng[], from: number, to: number, along: readonly number[] = cumulative(points)): LatLng[] {\n if (!points.length) return [];\n const [a, b] = from <= to ? [from, to] : [to, from];\n const start = pointAlong(points, a, along)!;\n const end = pointAlong(points, b, along)!;\n const lo = Math.max(a, 0);\n const hi = Math.min(b, along[along.length - 1]);\n const inside = points.filter((_, i) => along[i] > lo && along[i] < hi);\n return [start, ...inside, end];\n}\n\n/**\n * The nearest point on a route to `position`, not only its vertices: where it lies, how far along the\n * route that is, and how far `position` is from the route. The inverse of `pointAlong` (a cursor on a\n * map is a distance on a chart). Each leg is flattened around its own latitude, which is exact enough\n * for any leg a recording has; `index` is the leg's first point. Null for fewer than one point.\n */\nexport function snap(points: readonly LatLng[], position: LatLng, along: readonly number[] = cumulative(points)): { position: LatLng; metres: number; offset: number; index: number } | null {\n if (!points.length) return null;\n if (points.length === 1) return { position: points[0], metres: 0, offset: distance(points[0], position), index: 0 };\n let best: { position: LatLng; metres: number; offset: number; index: number } | null = null;\n for (let i = 1; i < points.length; i++) {\n const [p, q] = [points[i - 1], points[i]];\n const k = Math.cos((((p[0] + q[0]) / 2) * Math.PI) / 180);\n const [dx, dy] = [(q[1] - p[1]) * k, q[0] - p[0]];\n const len2 = dx * dx + dy * dy;\n const t = len2 === 0 ? 0 : Math.min(1, Math.max(0, (((position[1] - p[1]) * k) * dx + (position[0] - p[0]) * dy) / len2));\n const at: LatLng = [p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t];\n const offset = distance(at, position);\n if (!best || offset < best.offset) best = { position: at, metres: along[i - 1] + (along[i] - along[i - 1]) * t, offset, index: i - 1 };\n }\n return best;\n}\n\n/** Route geometry helpers: `geo.distance`, `bearing`, `length`, `cumulative`, `bounds`, `pointAlong`, `snap` (its inverse), `slice`, `arrows`, `ends`, `nearest`. */\nexport const geo = { distance, bearing, cumulative, length, bounds, pointAlong, snap, slice, arrows, ends, nearest };\n","import * as React from \"react\";\n\n// A shared cursor: one position that a map, several charts and a seek bar all show at once (strata-react\n// issue #184, from strata-360, where the cursor on the elevation and pace charts is the marker on the\n// route). Each of those components already draws one position well; what an app lacked was the wiring.\n//\n// One position in a canonical unit the app chooses (metres along a route, or seconds), and every member\n// says how its own x maps to it (`CursorMapping`; the identity when they already agree). The rules:\n//\n// - **A writer never reacts to its own writes.** Every member has a `source` id, and a position whose\n// source is its own is not drawn back at it (a chart's own pointer already draws its own rule).\n// - **Two owners, and the pointer wins.** Playback sets the cursor (sixty times a second); a pointer or\n// key over any member sets it too, and holds it until it leaves, and then playback's position is\n// still there. Stored as two entries, not one value, so \"pointer left\" has something to fall back to.\n// - **It is not announced as it moves.** The scope has one polite live region, written at most once a\n// second and only for a pointer or key (never playback): sixty announcements a second are worse than\n// silence (§3.22).\n// - **A store, not state in the scope.** Members subscribe to it; the scope's children do not render\n// when the cursor moves, only the members that read it.\n//\n// Checked: React Aria has no shared-pointer part; `useSyncExternalStore` is React's own.\n\n/** Who set the cursor: a pointer or key over a member, or playback (a player's clock). */\nexport type CursorOwner = \"pointer\" | \"playback\";\n\n/** How a member's own x relates to the scope's unit. Both default to the identity. */\nexport type CursorMapping = {\n /** From this member's x to the scope's unit (a chart in seconds in a scope in metres: look it up in the series). */\n toCursor?: (x: number) => number;\n /** From the scope's unit to this member's x. */\n fromCursor?: (at: number) => number;\n};\n\ntype Entry = { at: number; source: string };\ntype Snapshot = {\n /** The position now: the pointer's while there is one, else playback's; null when neither is set. */\n at: number | null;\n /** Who wrote `at`; a member ignores a position it wrote. */\n source: string | null;\n owner: CursorOwner | null;\n};\n\nconst EMPTY: Snapshot = { at: null, source: null, owner: null };\n\nclass CursorStore {\n private pointer: Entry | null = null;\n private playback: Entry | null = null;\n private listeners = new Set<() => void>();\n snapshot: Snapshot = EMPTY;\n subscribe = (fn: () => void) => {\n this.listeners.add(fn);\n return () => void this.listeners.delete(fn);\n };\n private publish() {\n const e = this.pointer ?? this.playback;\n const owner: CursorOwner | null = this.pointer ? \"pointer\" : this.playback ? \"playback\" : null;\n if (e?.at === this.snapshot.at && e?.source === this.snapshot.source && owner === this.snapshot.owner) return;\n this.snapshot = e ? { at: e.at, source: e.source, owner } : EMPTY;\n for (const l of this.listeners) l();\n }\n /** A pointer or key over a member. `null` means it left: it clears only if the pointer was this member's, so a stale leave cannot remove another member's position. */\n setPointer(at: number | null, source: string) {\n if (at === null) {\n if (this.pointer?.source !== source) return;\n this.pointer = null;\n } else this.pointer = { at, source };\n this.publish();\n }\n setPlayback(at: number | null, source: string) {\n this.playback = at === null ? null : { at, source };\n this.publish();\n }\n}\n\nconst Scope = React.createContext<CursorStore | null>(null);\n\nexport type CursorScopeProps = {\n children: React.ReactNode;\n /** Words for the position in the scope's unit (\"12.4 km along\", \"1:23\"), for the polite announcement. Without it nothing is announced. */\n format?: (at: number) => string;\n /** Milliseconds between announcements. Default 1000. */\n announceEvery?: number;\n};\n\n/** Holds one cursor position for the charts, map and seek bar inside it, with a throttled polite announcement of where a pointer or key has put it. */\nexport function CursorScope({ children, format, announceEvery = 1000 }: CursorScopeProps) {\n const store = React.useRef<CursorStore | null>(null);\n store.current ??= new CursorStore();\n return (\n <Scope.Provider value={store.current}>\n {children}\n {format && <CursorAnnouncer store={store.current} format={format} every={announceEvery} />}\n </Scope.Provider>\n );\n}\n\n/** The live region: the latest pointer position, at most once per `every` ms (a throttle, so a pointer that never rests is still announced). */\nfunction CursorAnnouncer({ store, format, every }: { store: CursorStore; format: (at: number) => string; every: number }) {\n const snap = React.useSyncExternalStore(store.subscribe, () => store.snapshot, () => EMPTY);\n const [text, setText] = React.useState(\"\");\n const latest = React.useRef({ snap, format });\n latest.current = { snap, format };\n const last = React.useRef(0);\n const timer = React.useRef<number | undefined>(undefined);\n React.useEffect(() => {\n // Playback moves the cursor every frame and is never spoken; a pointer leaving says nothing.\n if (snap.owner !== \"pointer\" || snap.at === null) return;\n const speak = () => {\n timer.current = undefined;\n last.current = Date.now();\n const { snap: s, format: f } = latest.current;\n if (s.owner === \"pointer\" && s.at !== null) setText(f(s.at));\n };\n const wait = last.current + every - Date.now();\n if (wait <= 0) speak();\n else timer.current ??= window.setTimeout(speak, wait);\n }, [snap, every]);\n React.useEffect(() => () => window.clearTimeout(timer.current), []);\n return (\n <p role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {text}\n </p>\n );\n}\n\n/** What a member reads and writes. */\nexport type SharedCursor = Snapshot & {\n /** This member's own id: positions it writes are not drawn back at it. */\n source: string;\n /** The position another member (or playback) put there, in the scope's unit; null when none or when this member wrote it. */\n other: number | null;\n /** The pointer or keyboard is at `at` over this member (the scope's unit). `null`: it left. */\n setPointer: (at: number | null) => void;\n /** Playback is at `at` (the scope's unit). Call it from the player's clock; `null` when it stops. */\n setPlayback: (at: number | null) => void;\n};\n\n/**\n * Join the nearest `CursorScope` as one member. Returns null outside a scope, so a component can take a\n * `cursor` prop and do nothing when the app has not set one up. `source` is this member's id; the\n * default is a unique one.\n */\nexport function useSharedCursor(source?: string): SharedCursor | null {\n const store = React.useContext(Scope);\n const own = React.useId();\n const id = source ?? own;\n const subscribe = React.useCallback((fn: () => void) => (store ? store.subscribe(fn) : () => {}), [store]);\n const snap = React.useSyncExternalStore(subscribe, () => store?.snapshot ?? EMPTY, () => EMPTY);\n const setPointer = React.useCallback((at: number | null) => store?.setPointer(at, id), [store, id]);\n const setPlayback = React.useCallback((at: number | null) => store?.setPlayback(at, id), [store, id]);\n return React.useMemo(\n () => (store ? { ...snap, source: id, other: snap.at !== null && snap.source !== id ? snap.at : null, setPointer, setPlayback } : null),\n [store, snap, id, setPointer, setPlayback],\n );\n}\n"],"mappings":";;;AAqCA,IAAa,OAAO;;AAGpB,IAAa,UAAU;AAIvB,IAAM,aAAkC;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;AAAI;AAC1E,IAAM,YAAY,OAAO,YAAY,WAAW,KAAK,GAAG,MAAM,CAAC,GAAG,OAAQ,CAAC,CAAC,CAAC;;AAg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c,MAAM,aAAa,OAAsB,OAAO,YAAY,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;CACpG,OAAO,MAAM,cACJ,QAAQ;EAAE,GAAG;EAAM,QAAQ;EAAI,OAAO,KAAK,OAAO,QAAQ,KAAK,WAAW,KAAK,KAAK,KAAK;EAAM;EAAY;CAAY,IAAI,MAClI;EAAC;EAAO;EAAM;EAAI;EAAY;CAAW,CAC3C;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export { BulkBar, useSelection, type InitialSelection } from './components/selec
|
|
|
48
48
|
export { SelectableGrid, type SelectableGridProps, type TileAspect, type TileSize, } from './components/selectable-grid';
|
|
49
49
|
export { VirtualList } from './components/virtual-list';
|
|
50
50
|
export { InfiniteList, LoadMore, type InfiniteListProps, type LoadMoreProps } from './components/infinite-list';
|
|
51
|
-
export { LineChart, type LineChartProps, type Point } from './components/line-chart';
|
|
51
|
+
export { LineChart, LineChartGroup, logScale, valueAt, type ChartMark, type ChartSpan, type GroupedChart, type LineChartGroupProps, type LineChartProps, type Point, type SpanTone, type YScale } from './components/line-chart';
|
|
52
|
+
export { CursorScope, useSharedCursor, type CursorMapping, type CursorOwner, type CursorScopeProps, type SharedCursor } from './components/cursor';
|
|
52
53
|
export { PageHeader } from './components/page-header';
|
|
53
54
|
export { UndoBar, useUndoable, type PendingRemoval, type FailedRemoval, type Undoable, type UndoableOptions, } from './components/undo';
|
|
54
55
|
export { Done } from './components/done';
|