strata-react 1.0.18 → 1.0.20
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 +5 -0
- package/UPGRADING.md +4 -0
- package/dist/components/key-glyphs.d.ts +5 -0
- package/dist/components/media-player.d.ts +90 -0
- package/dist/components/media.d.ts +3 -2
- package/dist/geo-C0jcFp4q.js +318 -0
- package/dist/geo-C0jcFp4q.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +497 -203
- package/dist/index.js.map +1 -1
- package/dist/lib/format.d.ts +12 -0
- package/dist/lib/geo.d.ts +44 -0
- package/dist/map/index.d.ts +1 -0
- package/dist/map/map-styles.d.ts +2 -0
- package/dist/map/route-map.d.ts +72 -0
- package/dist/map.js +400 -0
- package/dist/map.js.map +1 -0
- package/dist/query-CP78goXj.js +165 -0
- package/dist/query-CP78goXj.js.map +1 -0
- package/dist/{run-Yrgm5xIq.js → run-CKlcLpdN.js} +13 -2
- package/dist/run-CKlcLpdN.js.map +1 -0
- package/dist/strata.css +9 -0
- package/dist/testing.js +2 -1
- package/dist/testing.js.map +1 -1
- package/dist/{query-CIh1Dpgn.js → theme-BgTOESmN.js} +55 -164
- package/dist/theme-BgTOESmN.js.map +1 -0
- package/dist/visual/drop.d.ts +19 -0
- package/dist/visual/index.d.ts +1 -0
- package/dist/visual-cli.js +1 -1
- package/dist/visual.js +68 -1
- package/dist/visual.js.map +1 -0
- package/package.json +13 -1
- package/dist/query-CIh1Dpgn.js.map +0 -1
- package/dist/run-Yrgm5xIq.js.map +0 -1
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ it against the built files:
|
|
|
37
37
|
|---|---|---|
|
|
38
38
|
| `strata-react` | `react`, `react-dom`, `react-router`, `@tanstack/react-query`, `tailwindcss` | The stack is fixed: `DataTable` and `Tabs` keep sort and tab in the URL, `AppShell` links with `NavLink`, every remote read is `useLoad`. The barrel imports both libraries, so an app that uses only a `Button` still installs them (both are needed for anything past a static page) |
|
|
39
39
|
| `strata-react/testing` | the above, plus `@testing-library/react` | `renderWithStrata` and `renderRoutes` wrap Testing Library's `render` |
|
|
40
|
+
| `strata-react/map` | `leaflet` (optional peer, `^1.9.4`) | `RouteMap`: themed routes and a moving position on the tiles an app supplies |
|
|
40
41
|
| `strata-react/visual`, `strata-visual` | `playwright` (exact version), `msw`, `vite` | The screenshot runner; see [Visual regression for apps](#visual-regression-for-apps) |
|
|
41
42
|
|
|
42
43
|
The last three are optional peers: an app that never imports those entries never needs them.
|
|
@@ -141,7 +142,9 @@ strata-react is ESM-only (`exports` has only `import`), as is its peer `react-ro
|
|
|
141
142
|
| Overlays | `Dialog`, `DialogProps`, `AlertDialog`, `Popover`, `Tooltip` | React Aria underneath. A dialog always has a title and, via `actions`'s close render prop, a way out; `closable={false}` while work cannot stop; `placement="end"` is a sheet. `AlertDialog` is the only confirm: required verb on the confirm button, Cancel focused first, no outside dismiss, stays open with the reason when an async confirm fails. `Popover` needs a `label`. `Tooltip` opens on hover and focus and `IconButton` uses it. All portal onto the `layer-*` stacking utilities |
|
|
142
143
|
| Value controls | `NumberField`, `Slider`, `ColorField` | Set a number or colour precisely, inside `Field`. `NumberField` and `Slider` are React Aria's; the number field runs with `commitBehavior="validate"`, so a typed value outside `min`/`max` is kept on screen, explained in the `Field` ("Enter a value from 0% to 500%.") and never passed to `onChange`. A value that is not known is `null` and shows an en dash, never 0 or NaN. Digits and decimal mark follow `locale`. The unit sits inside the control, and in the slider's spoken value when `Intl` has it (%, °, ms, s, kB, MB, GB, kbps, Mbps). Arrows step, Home/End jump to the limits; `Slider editable` adds a number field. `ColorField`: platform picker, typed hex that is normalised, app suggestions, and a contrast note against `against`. No motion on value changes |
|
|
143
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
|
+
| 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 |
|
|
144
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). 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 |
|
|
145
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 |
|
|
146
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 |
|
|
147
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 |
|
|
@@ -207,6 +210,8 @@ vite build && npx strata-visual # compare; diffs land in tests/visual
|
|
|
207
210
|
npx strata-visual --filter review--error # only some shots
|
|
208
211
|
```
|
|
209
212
|
|
|
213
|
+
A shot's theme reaches the app itself: the runner stores it under the key `ThemeProvider` reads (`strata-color-scheme`) before the page loads, so light shots are light even in an app whose default is dark. To show a state that needs files dropped, use `dropFiles(page, "text=Drop files", [{ name: "clip.mp4", type: "video/mp4", content: bytes }])` from `strata-react/visual` in a `setup`: it dispatches the drag events with a data transfer that holds real `File`s and file-system entries (which React Aria's drop zones need) and a fixed `lastModified`, so a date shown from the file does not change between runs.
|
|
214
|
+
|
|
210
215
|
Baselines are named `route--state--viewport--theme.png` (`review--empty--phone--dark.png`) and
|
|
211
216
|
stories `story-id--theme.png`. A shot fails when it differs from its baseline, when any of its
|
|
212
217
|
text is drawn in a font installed on the machine rather than one the page loaded, when the page
|
package/UPGRADING.md
CHANGED
|
@@ -13,6 +13,10 @@ 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
|
+
- `SeekBar` with a `duration` of 0, `NaN` or `Infinity` (or `null`, now allowed) is drawn disabled; before it was enabled with the thumb at 0. Nothing to change unless a test seeks a bar with no duration.
|
|
17
|
+
- Arrows and macOS modifiers in `KeysLegend`, `CommandLegend`, menu shortcuts and tooltip hints are drawn as icons, each followed by a screen-reader name (`←` reads "left arrow", `⌘` "Command"), so the text no longer contains the symbol: a test that queries `"j or ↓"` queries `"j or down arrow"`, and `"⌘Z"` is `"Command Z"`. Their baselines change a little.
|
|
18
|
+
- The dim behind a `Dialog`, `AlertDialog`, `CommandMenu` and full-screen view is black at an alpha (the `scrim` utility), not `foreground`: in a dark theme it now dims the page instead of brightening it. Dark baselines of anything with an open overlay change.
|
|
19
|
+
- `strata-visual` stores each shot's theme under `strata-color-scheme` before the page loads, so a shot is in the theme it is named for even in an app whose `ThemeProvider` defaults to dark. An app that worked around it by clicking the theme in a `setup` can drop that; its baselines for the light shots change. New: `dropFiles` in `strata-react/visual`; a system-font failure now names the CSS `font-family` stack.
|
|
16
20
|
- `Timeline`'s lane header column is content-sized (at least `w-40`, at most `w-80`) instead of a fixed `w-40`; a screen with a long lane name or several header controls is now wider there. Lane height is `--lane-h` (one `--control-h` by default).
|
|
17
21
|
- `format.timecode` with `precision: "frames"` now returns four parts (`0:04:05:15`, was `4:05:15`); update tests that read it. `MissingFile`'s markup changed (the name wraps; status and Relink may sit on a second row).
|
|
18
22
|
React Aria Components is now the primitives layer (`react-aria-components`, installed with the
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** Why a player is not playing, for the app to word. */
|
|
3
|
+
export type MediaProblem = {
|
|
4
|
+
kind: "load";
|
|
5
|
+
message: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "blocked";
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
/** What `useMediaElement` returns: the element's state as values, and the requests a player makes of it. */
|
|
11
|
+
export type MediaElementState = {
|
|
12
|
+
playing: boolean;
|
|
13
|
+
/** Seconds. */
|
|
14
|
+
time: number;
|
|
15
|
+
/** Seconds, or null until the element knows it (a stream reports NaN or Infinity). */
|
|
16
|
+
duration: number | null;
|
|
17
|
+
/** Seconds buffered from the start of the range holding `time`. */
|
|
18
|
+
buffered: number;
|
|
19
|
+
/** 0 to 100; 0 while muted. */
|
|
20
|
+
volume: number;
|
|
21
|
+
muted: boolean;
|
|
22
|
+
rate: number;
|
|
23
|
+
ended: boolean;
|
|
24
|
+
/** Waiting for data (the first load, or a seek into what is not buffered yet). */
|
|
25
|
+
loading: boolean;
|
|
26
|
+
error: MediaProblem | null;
|
|
27
|
+
play: () => Promise<void>;
|
|
28
|
+
pause: () => void;
|
|
29
|
+
toggle: () => void;
|
|
30
|
+
/** Seeks; before the metadata has loaded, remembers the time and applies it when it has. */
|
|
31
|
+
seek: (time: number) => void;
|
|
32
|
+
/** 0 to 100. 0 mutes; more unmutes at that level. */
|
|
33
|
+
setVolume: (volume: number) => void;
|
|
34
|
+
setRate: (rate: number) => void;
|
|
35
|
+
/** Loads again, and plays if it was playing. For the error state's "Try again". */
|
|
36
|
+
retry: () => void;
|
|
37
|
+
};
|
|
38
|
+
/** Follows an `<audio>` or `<video>` and returns its state and the requests a player makes. Works with the browser's own controls too. */
|
|
39
|
+
export declare function useMediaElement(ref: React.RefObject<HTMLMediaElement | null>): MediaElementState;
|
|
40
|
+
/** One file in a sequence. */
|
|
41
|
+
export type MediaSource = {
|
|
42
|
+
src: string;
|
|
43
|
+
/** Names the source on the seek bar's marks and in "Chapter 2 of 5". */
|
|
44
|
+
title: string;
|
|
45
|
+
/** Seconds. When every source gives it, the seek bar spans the whole sequence. */
|
|
46
|
+
duration?: number;
|
|
47
|
+
};
|
|
48
|
+
/** Lock-screen and headset metadata (`navigator.mediaSession`). */
|
|
49
|
+
export type MediaSession = {
|
|
50
|
+
title: string;
|
|
51
|
+
artist?: string;
|
|
52
|
+
album?: string;
|
|
53
|
+
artwork?: string;
|
|
54
|
+
};
|
|
55
|
+
export type MediaPlayerProps = {
|
|
56
|
+
/** Names the player and its element. */
|
|
57
|
+
label: string;
|
|
58
|
+
kind?: "audio" | "video";
|
|
59
|
+
/** One file. */
|
|
60
|
+
src?: string;
|
|
61
|
+
/** Or a sequence; ending moves to the next and keeps playing. */
|
|
62
|
+
sources?: readonly MediaSource[];
|
|
63
|
+
/** The current source, when the app holds it (a chapter list beside the player). */
|
|
64
|
+
index?: number;
|
|
65
|
+
onIndexChange?: (index: number) => void;
|
|
66
|
+
/** Move to the next source when one ends. Default true. */
|
|
67
|
+
autoAdvance?: boolean;
|
|
68
|
+
/** `"auto"`: the browser's controls on a touch device, Strata's on a desktop. Default. */
|
|
69
|
+
controls?: "auto" | "native" | "strata";
|
|
70
|
+
autoPlay?: boolean;
|
|
71
|
+
poster?: string;
|
|
72
|
+
session?: MediaSession;
|
|
73
|
+
/** The playback speeds offered. Default 0.5 to 2; for speech use {@link SPEECH_RATES}. */
|
|
74
|
+
rates?: readonly number[];
|
|
75
|
+
/** Keys on the page (Space or K, J and L for 10 s, M). Default true; turn off when the screen binds its own. */
|
|
76
|
+
shortcuts?: boolean;
|
|
77
|
+
/** The last source has ended. */
|
|
78
|
+
onEnded?: () => void;
|
|
79
|
+
/** Called as the element plays, with the time in the whole sequence. */
|
|
80
|
+
onTimeChange?: (time: number) => void;
|
|
81
|
+
className?: string;
|
|
82
|
+
};
|
|
83
|
+
/** Playback speeds an audiobook or lecture listener expects. */
|
|
84
|
+
export declare const SPEECH_RATES: readonly number[];
|
|
85
|
+
/**
|
|
86
|
+
* Plays a file or a sequence: the element, its state, and Strata's controls (or the browser's own on
|
|
87
|
+
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
88
|
+
* parts and `useMediaElement` directly.
|
|
89
|
+
*/
|
|
90
|
+
export declare function MediaPlayer({ label, kind, src, sources, index: controlledIndex, onIndexChange, autoAdvance, controls, autoPlay, poster, session, rates, shortcuts, onEnded, onTimeChange, className, }: MediaPlayerProps): React.JSX.Element;
|
|
@@ -14,7 +14,8 @@ export declare function TimeReadout({ time, duration, precision, fps, className
|
|
|
14
14
|
}): React.JSX.Element;
|
|
15
15
|
export type SeekBarProps = TimeProps & {
|
|
16
16
|
time: number;
|
|
17
|
-
|
|
17
|
+
/** Seconds; null, NaN or 0 while it is not known (a stream before its metadata): the bar is drawn disabled, with no thumb. */
|
|
18
|
+
duration: number | null;
|
|
18
19
|
/** The viewer asked for this time (drag, click or key). */
|
|
19
20
|
onSeek: (time: number) => void;
|
|
20
21
|
/** Named points on the bar (chapters, markers). Pressing one seeks to it. */
|
|
@@ -33,7 +34,7 @@ export type SeekBarProps = TimeProps & {
|
|
|
33
34
|
className?: string;
|
|
34
35
|
};
|
|
35
36
|
/** A seek bar: dragged, clicked and moved by keys (arrows `step`, Page keys `bigStep`, Home and End), with its time as the accessible value. */
|
|
36
|
-
export declare function SeekBar({ time, duration, onSeek, marks, buffered, step, bigStep, label, precision, fps, disabled, className }: SeekBarProps): React.JSX.Element;
|
|
37
|
+
export declare function SeekBar({ time, duration: known, onSeek, marks, buffered, step, bigStep, label, precision, fps, disabled: off, className }: SeekBarProps): React.JSX.Element;
|
|
37
38
|
export type TransportProps = {
|
|
38
39
|
playing: boolean;
|
|
39
40
|
onPlayPause: () => void;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// src/lib/format.ts
|
|
2
|
+
var NBSP = "\xA0";
|
|
3
|
+
/** The placeholder printed for a value that is not known: an en dash. */
|
|
4
|
+
var MISSING = "–";
|
|
5
|
+
var BYTE_UNITS = [
|
|
6
|
+
"B",
|
|
7
|
+
"kB",
|
|
8
|
+
"MB",
|
|
9
|
+
"GB",
|
|
10
|
+
"TB",
|
|
11
|
+
"PB"
|
|
12
|
+
];
|
|
13
|
+
var BYTE_SIZE = Object.fromEntries(BYTE_UNITS.map((u, i) => [u, 1e3 ** i]));
|
|
14
|
+
/** A Date from a Date, an ISO string or epoch milliseconds; throws a RangeError naming the input when it is not a date. */
|
|
15
|
+
function toDate(value) {
|
|
16
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
17
|
+
if (Number.isNaN(date.getTime())) throw new RangeError(`Not a date: ${JSON.stringify(String(value))}`);
|
|
18
|
+
return date;
|
|
19
|
+
}
|
|
20
|
+
function callableDate(df, missing) {
|
|
21
|
+
const format = (value) => value == null ? missing : df.format(toDate(value));
|
|
22
|
+
return Object.assign(format, {
|
|
23
|
+
format,
|
|
24
|
+
formatToParts: (value) => df.formatToParts(toDate(value)),
|
|
25
|
+
formatRange: (start, end) => df.formatRange(toDate(start), toDate(end)),
|
|
26
|
+
resolvedOptions: () => df.resolvedOptions()
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function callable(nf, missing) {
|
|
30
|
+
const format = (value) => value == null ? missing : nf.format(value);
|
|
31
|
+
return Object.assign(format, {
|
|
32
|
+
format,
|
|
33
|
+
formatToParts: (value) => nf.formatToParts(value),
|
|
34
|
+
resolvedOptions: () => nf.resolvedOptions()
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
var DAY = 864e5;
|
|
38
|
+
var AGO_STEPS = [
|
|
39
|
+
["year", 365 * DAY],
|
|
40
|
+
["month", 30 * DAY],
|
|
41
|
+
["week", 7 * DAY],
|
|
42
|
+
["day", DAY],
|
|
43
|
+
["hour", 36e5],
|
|
44
|
+
["minute", 6e4]
|
|
45
|
+
];
|
|
46
|
+
/** 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. */
|
|
47
|
+
function createFormat(locale, options = {}) {
|
|
48
|
+
const { timeZone, missing = "–" } = options;
|
|
49
|
+
const dates = (opts) => callableDate(new Intl.DateTimeFormat(locale, {
|
|
50
|
+
...opts,
|
|
51
|
+
timeZone
|
|
52
|
+
}), missing);
|
|
53
|
+
const integer = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }), missing);
|
|
54
|
+
const decimal = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }), missing);
|
|
55
|
+
const percent = callable(new Intl.NumberFormat(locale, {
|
|
56
|
+
style: "percent",
|
|
57
|
+
maximumFractionDigits: 0
|
|
58
|
+
}), missing);
|
|
59
|
+
const compact = callable(new Intl.NumberFormat(locale, {
|
|
60
|
+
notation: "compact",
|
|
61
|
+
maximumFractionDigits: 1
|
|
62
|
+
}), missing);
|
|
63
|
+
const relative = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
64
|
+
const plurals = new Intl.PluralRules(locale);
|
|
65
|
+
const clock = dates({
|
|
66
|
+
hour: "2-digit",
|
|
67
|
+
minute: "2-digit"
|
|
68
|
+
});
|
|
69
|
+
const day = dates({
|
|
70
|
+
weekday: "long",
|
|
71
|
+
day: "numeric",
|
|
72
|
+
month: "long"
|
|
73
|
+
});
|
|
74
|
+
const shortDay = dates({
|
|
75
|
+
weekday: "short",
|
|
76
|
+
hour: "2-digit",
|
|
77
|
+
minute: "2-digit"
|
|
78
|
+
});
|
|
79
|
+
const date = dates({ dateStyle: "medium" });
|
|
80
|
+
const dateTime = dates({
|
|
81
|
+
dateStyle: "medium",
|
|
82
|
+
timeStyle: "short"
|
|
83
|
+
});
|
|
84
|
+
const withUnit = (value, unit, fmt = integer) => `${fmt.format(value)} ${unit}`;
|
|
85
|
+
return {
|
|
86
|
+
locale,
|
|
87
|
+
/** The zone times are shown in, or `undefined` for the viewer's own. */
|
|
88
|
+
timeZone,
|
|
89
|
+
/** Whole numbers with grouping: `format.integer(1222)` is "1,222". */
|
|
90
|
+
integer,
|
|
91
|
+
/** One decimal place at most: `format.decimal(3.14)` is "3.1". */
|
|
92
|
+
decimal,
|
|
93
|
+
/** A ratio as a whole percent: `format.percent(0.42)` is "42%". */
|
|
94
|
+
percent,
|
|
95
|
+
/**
|
|
96
|
+
* A part's share of a whole, as `percent` but never misleading at the ends: a part above 0 that
|
|
97
|
+
* rounds to 0 is "<1%", and one short of the whole that rounds to 100 is ">99%".
|
|
98
|
+
* `format.share(2.4 / 512)` is "<1%".
|
|
99
|
+
*/
|
|
100
|
+
share: (value) => {
|
|
101
|
+
if (value == null || Number.isNaN(value)) return missing;
|
|
102
|
+
if (value > 0 && value < .005) return `<${percent.format(.01)}`;
|
|
103
|
+
if (value >= .995 && value < 1) return `>${percent.format(.99)}`;
|
|
104
|
+
return percent.format(value);
|
|
105
|
+
},
|
|
106
|
+
/** 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. */
|
|
107
|
+
compact,
|
|
108
|
+
/**
|
|
109
|
+
* How long ago (or how far ahead) a time is, in the largest unit it reaches:
|
|
110
|
+
* "3 weeks ago", "yesterday", "in 2 hours", "now" under a minute. Pass `now` in tests.
|
|
111
|
+
*/
|
|
112
|
+
ago: (value, now = /* @__PURE__ */ new Date()) => {
|
|
113
|
+
if (value == null) return missing;
|
|
114
|
+
const diff = toDate(value).getTime() - toDate(now).getTime();
|
|
115
|
+
const span = Math.abs(diff);
|
|
116
|
+
for (const [unit, size] of AGO_STEPS) if (span >= size) return relative.format(Math.sign(diff) * Math.floor(span / size), unit);
|
|
117
|
+
return relative.format(0, "second");
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* A media running time from seconds, as a player shows it: "4:05", "1:02:09". Unknown
|
|
121
|
+
* (null, negative, not finite) prints the placeholder. Set it in `tabular-nums`.
|
|
122
|
+
*/
|
|
123
|
+
runningTime: (seconds) => {
|
|
124
|
+
if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;
|
|
125
|
+
const s = Math.floor(seconds);
|
|
126
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
127
|
+
const [h, m] = [Math.floor(s / 3600), Math.floor(s % 3600 / 60)];
|
|
128
|
+
return h > 0 ? `${h}:${two(m)}:${two(s % 60)}` : `${m}:${two(s % 60)}`;
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* A position in media as an editor shows it, to a chosen precision: "4:05" (seconds), "4:05.250"
|
|
132
|
+
* (`"ms"`), or "0:04:05:07" (`"frames"` at `fps`, the last part the frame). Hours appear only
|
|
133
|
+
* from one hour, except in frames. Frames are always four parts, hours included, as SMPTE
|
|
134
|
+
* timecode is (non-drop frame, with colons): a three-part "1:05:00" reads as one hour five, so
|
|
135
|
+
* a frame count must never be three. Editors write the same four parts (strata-react issue
|
|
136
|
+
* #122). Floors, never rounds up, so a time never reads ahead of the picture. Unknown (null,
|
|
137
|
+
* negative, not finite) prints the placeholder. Set it in `tabular-nums`.
|
|
138
|
+
*/
|
|
139
|
+
timecode: (seconds, { precision = "seconds", fps = 30 } = {}) => {
|
|
140
|
+
if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;
|
|
141
|
+
const whole = Math.floor(seconds);
|
|
142
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
143
|
+
const [h, m] = [Math.floor(whole / 3600), Math.floor(whole % 3600 / 60)];
|
|
144
|
+
const base = h > 0 ? `${h}:${two(m)}:${two(whole % 60)}` : `${m}:${two(whole % 60)}`;
|
|
145
|
+
if (precision === "ms") return `${base}.${String(Math.min(Math.floor((seconds - whole) * 1e3 + 1e-6), 999)).padStart(3, "0")}`;
|
|
146
|
+
if (precision === "frames") return `${h}:${two(m)}:${two(whole % 60)}:${two(Math.min(Math.floor((seconds - whole) * fps + 1e-6), Math.ceil(fps) - 1))}`;
|
|
147
|
+
return base;
|
|
148
|
+
},
|
|
149
|
+
/** What a missing value prints as: an en dash unless `createFormat`'s `missing` says otherwise. */
|
|
150
|
+
missing,
|
|
151
|
+
/** A time of day: `format.clock(at)` is "06:05". */
|
|
152
|
+
clock,
|
|
153
|
+
/** A day without its year, for this week's things: `format.day(at)` is "Sunday 8 November". */
|
|
154
|
+
day,
|
|
155
|
+
/** A weekday and time, for chart axes and recent rows: `format.shortDay(at)` is "Sun 06:05". */
|
|
156
|
+
shortDay,
|
|
157
|
+
/** A date with its year, for a record or a deadline: `format.date(at)` is "8 Nov 2026". */
|
|
158
|
+
date,
|
|
159
|
+
/** A date and time, for a log or history row: `format.dateTime(at)` is "8 Nov 2026, 06:05". */
|
|
160
|
+
dateTime,
|
|
161
|
+
/** A figure and its unit joined by a non-breaking space (`NBSP`), so they never wrap apart. */
|
|
162
|
+
withUnit,
|
|
163
|
+
/** A temperature in °C, joined by a non-breaking space. */
|
|
164
|
+
celsius: (value) => withUnit(value, "°C"),
|
|
165
|
+
/**
|
|
166
|
+
* A size in bytes in the largest decimal unit it reaches (kB, MB, GB, TB, as disks and
|
|
167
|
+
* networks are sold): one decimal below 10 ("5.2 GB"), whole above ("431 GB"). Pass `unit`
|
|
168
|
+
* to fix the unit, so figures compared side by side ("431 of 466 GB") share one.
|
|
169
|
+
*/
|
|
170
|
+
bytes: (value, unit) => {
|
|
171
|
+
const chosen = unit ?? [...BYTE_UNITS].reverse().find((u) => Math.abs(value) >= BYTE_SIZE[u]) ?? "B";
|
|
172
|
+
const scaled = value / BYTE_SIZE[chosen];
|
|
173
|
+
return withUnit(scaled, chosen, Math.abs(scaled) < 10 && chosen !== "B" ? decimal : integer);
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* A distance in metres as a person says it: metres under a kilometre ("850 m"), then
|
|
177
|
+
* kilometres, one decimal below 100 ("12.4 km"), whole above; `"imperial"` is feet under a
|
|
178
|
+
* tenth of a mile ("320 ft"), then miles ("7.7 mi").
|
|
179
|
+
*/
|
|
180
|
+
distance: (metres, system = "metric") => {
|
|
181
|
+
if (system === "imperial") {
|
|
182
|
+
const miles = metres / 1609.344;
|
|
183
|
+
return miles < .1 ? withUnit(metres * 3.28084, "ft") : withUnit(miles, "mi", miles < 100 ? decimal : integer);
|
|
184
|
+
}
|
|
185
|
+
return Math.abs(metres) < 1e3 ? withUnit(metres, "m") : withUnit(metres / 1e3, "km", Math.abs(metres) < 1e5 ? decimal : integer);
|
|
186
|
+
},
|
|
187
|
+
/** The unit `bytes` would choose for a value, to share it across a set of figures. */
|
|
188
|
+
byteUnit: (value) => [...BYTE_UNITS].reverse().find((u) => Math.abs(value) >= BYTE_SIZE[u]) ?? "B",
|
|
189
|
+
/**
|
|
190
|
+
* "1 piece", "6 pieces": the count and its noun, so copy never reads "1 pieces". They are
|
|
191
|
+
* joined by a non-breaking space (`NBSP`), not a plain one: in a test, match with the same
|
|
192
|
+
* call or a `\s` regex, not a typed "6 pieces" string in a role's `name`.
|
|
193
|
+
*/
|
|
194
|
+
count: (value, one, many = `${one}s`, { compact: short = false } = {}) => value == null ? missing : `${(short ? compact : integer).format(value)} ${plurals.select(value) === "one" ? one : many}`
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/** The en-GB formatters. */
|
|
198
|
+
var format = createFormat("en-GB");
|
|
199
|
+
// src/lib/geo.ts
|
|
200
|
+
var RAD = Math.PI / 180;
|
|
201
|
+
var EARTH_RADIUS_M = 6371e3;
|
|
202
|
+
/** Great-circle distance between two positions, in metres. */
|
|
203
|
+
function distance([lat1, lng1], [lat2, lng2]) {
|
|
204
|
+
const a = Math.sin((lat2 - lat1) * RAD / 2) ** 2 + Math.cos(lat1 * RAD) * Math.cos(lat2 * RAD) * Math.sin((lng2 - lng1) * RAD / 2) ** 2;
|
|
205
|
+
return 2 * EARTH_RADIUS_M * Math.asin(Math.sqrt(a));
|
|
206
|
+
}
|
|
207
|
+
/** The direction from `a` to `b` in degrees clockwise from north (0 to 360), for neighbouring points. */
|
|
208
|
+
function bearing([lat1, lng1], [lat2, lng2]) {
|
|
209
|
+
const dx = (lng2 - lng1) * Math.cos((lat1 + lat2) / 2 * Math.PI / 180);
|
|
210
|
+
const dy = lat2 - lat1;
|
|
211
|
+
return (Math.atan2(dx, dy) * 180 / Math.PI + 360) % 360;
|
|
212
|
+
}
|
|
213
|
+
/** The running distance along a route at each point, in metres, starting at 0. */
|
|
214
|
+
function cumulative(points) {
|
|
215
|
+
const out = points.length ? [0] : [];
|
|
216
|
+
for (let i = 1; i < points.length; i++) out.push(out[i - 1] + distance(points[i - 1], points[i]));
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
/** The length of a route in metres. */
|
|
220
|
+
function length(points) {
|
|
221
|
+
let total = 0;
|
|
222
|
+
for (let i = 1; i < points.length; i++) total += distance(points[i - 1], points[i]);
|
|
223
|
+
return total;
|
|
224
|
+
}
|
|
225
|
+
/** The south-west and north-east corners that hold every point, or null for none. */
|
|
226
|
+
function bounds(points) {
|
|
227
|
+
if (!points.length) return null;
|
|
228
|
+
let south = Infinity;
|
|
229
|
+
let north = -Infinity;
|
|
230
|
+
let west = Infinity;
|
|
231
|
+
let east = -Infinity;
|
|
232
|
+
for (const [lat, lng] of points) {
|
|
233
|
+
if (lat < south) south = lat;
|
|
234
|
+
if (lat > north) north = lat;
|
|
235
|
+
if (lng < west) west = lng;
|
|
236
|
+
if (lng > east) east = lng;
|
|
237
|
+
}
|
|
238
|
+
return [[south, west], [north, east]];
|
|
239
|
+
}
|
|
240
|
+
/** The position `metres` along a route (clamped to its ends), by linear interpolation, or null for no points. */
|
|
241
|
+
function pointAlong(points, metres, along = cumulative(points)) {
|
|
242
|
+
if (!points.length) return null;
|
|
243
|
+
const total = along[along.length - 1];
|
|
244
|
+
const d = Math.min(Math.max(metres, 0), total);
|
|
245
|
+
if (points.length === 1 || total === 0) return points[0];
|
|
246
|
+
let lo = 1;
|
|
247
|
+
let hi = points.length - 1;
|
|
248
|
+
while (lo < hi) {
|
|
249
|
+
const mid = lo + hi >> 1;
|
|
250
|
+
if (along[mid] < d) lo = mid + 1;
|
|
251
|
+
else hi = mid;
|
|
252
|
+
}
|
|
253
|
+
const [p, q] = [points[lo - 1], points[lo]];
|
|
254
|
+
const t = (d - along[lo - 1]) / (along[lo] - along[lo - 1] || 1);
|
|
255
|
+
return [p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t];
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* `count` positions evenly spaced by distance along a route (the ends skipped), each with the
|
|
259
|
+
* direction of travel there. The direction is smoothed: the bearing from a point a fraction
|
|
260
|
+
* (`window`) of the spacing before to one the same distance after, so GPS jitter and a tight bend
|
|
261
|
+
* do not turn a chevron sideways.
|
|
262
|
+
*/
|
|
263
|
+
function arrows(points, count = 5, window = .4) {
|
|
264
|
+
if (points.length < 2 || count < 1) return [];
|
|
265
|
+
const along = cumulative(points);
|
|
266
|
+
const total = along[along.length - 1];
|
|
267
|
+
if (total === 0) return [];
|
|
268
|
+
const spacing = total / (count + 1);
|
|
269
|
+
const half = spacing * window;
|
|
270
|
+
return Array.from({ length: count }, (_, i) => {
|
|
271
|
+
const target = spacing * (i + 1);
|
|
272
|
+
const before = pointAlong(points, target - half, along);
|
|
273
|
+
const after = pointAlong(points, target + half, along);
|
|
274
|
+
return {
|
|
275
|
+
position: pointAlong(points, target, along),
|
|
276
|
+
bearing: bearing(before, after)
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/** The first and last positions, and whether they are within `loopWithin` metres of each other (a loop), or null for no route. */
|
|
281
|
+
function ends(points, loopWithin = 50) {
|
|
282
|
+
if (!points.length) return null;
|
|
283
|
+
const start = points[0];
|
|
284
|
+
const finish = points[points.length - 1];
|
|
285
|
+
return {
|
|
286
|
+
start,
|
|
287
|
+
finish,
|
|
288
|
+
loop: distance(start, finish) <= loopWithin
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/** The index of the point nearest `position`, for "where on the route is this?". */
|
|
292
|
+
function nearest(points, position) {
|
|
293
|
+
let best = -1;
|
|
294
|
+
let bestD = Infinity;
|
|
295
|
+
points.forEach((p, i) => {
|
|
296
|
+
const d = distance(p, position);
|
|
297
|
+
if (d < bestD) {
|
|
298
|
+
bestD = d;
|
|
299
|
+
best = i;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
return best;
|
|
303
|
+
}
|
|
304
|
+
/** Route geometry helpers: `geo.distance`, `bearing`, `length`, `cumulative`, `bounds`, `pointAlong`, `arrows`, `ends`, `nearest`. */
|
|
305
|
+
var geo = {
|
|
306
|
+
distance,
|
|
307
|
+
bearing,
|
|
308
|
+
cumulative,
|
|
309
|
+
length,
|
|
310
|
+
bounds,
|
|
311
|
+
pointAlong,
|
|
312
|
+
arrows,
|
|
313
|
+
ends,
|
|
314
|
+
nearest
|
|
315
|
+
};
|
|
316
|
+
export { format as a, createFormat as i, MISSING as n, toDate as o, NBSP as r, geo as t };
|
|
317
|
+
|
|
318
|
+
//# sourceMappingURL=geo-C0jcFp4q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo-C0jcFp4q.js","names":[],"sources":["../src/lib/format.ts","../src/lib/geo.ts"],"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/** Route geometry helpers: `geo.distance`, `bearing`, `length`, `cumulative`, `bounds`, `pointAlong`, `arrows`, `ends`, `nearest`. */\nexport const geo = { distance, bearing, cumulative, length, bounds, pointAlong, arrows, ends, nearest };\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;;AAgC7E,SAAgB,OAAO,OAAwB;CAC7C,MAAM,OAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;CAC3D,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG,MAAM,IAAI,WAAW,eAAe,KAAK,UAAU,OAAO,KAAK,CAAC,GAAG;CACrG,OAAO;AACT;AAEA,SAAS,aAAa,IAAyB,SAAgC;CAC7E,MAAM,UAAU,UAAyC,SA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,SAAS,QAAQ,QAAQ,KAAK;EAAE;CACzF,CAAC;AACH;;AAGA,SAAgB,KAAK,QAA2B,aAAa,IAA6D;CACxH,IAAI,CAAC,OAAO,QAAQ,OAAO;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,OAAO,OAAO,SAAS;CACtC,OAAO;EAAE;EAAO;EAAQ,MAAM,SAAS,OAAO,MAAM,KAAK;CAAW;AACtE;;AAGA,SAAgB,QAAQ,QAA2B,UAA0B;CAC3E,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,OAAO,SAAS,GAAG,MAAM;EACvB,MAAM,IAAI,SAAS,GAAG,QAAQ;EAC9B,IAAI,IAAI,OAAO;GACb,QAAQ;GACR,OAAO;EACT;CACF,CAAC;CACD,OAAO;AACT;;AAGA,IAAa,MAAM;CAAE;CAAU;CAAS;CAAY;CAAQ;CAAQ;CAAY;CAAQ;CAAM;AAAQ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { useInView, type InViewOptions } from './lib/in-view';
|
|
|
11
11
|
export type { IconComponent } from './lib/icon';
|
|
12
12
|
export { Button, IconButton, RowAction, buttonVariants, type ButtonProps, type IconButtonProps, type RowActionProps, } from './components/button';
|
|
13
13
|
export { Menu, ContextMenu, CommandMenu, CommandLegend, useCommands, commandShortcut, labelOf, type Command, type MenuEntry, type MenuProps, type ContextMenuProps, type CommandMenuProps, type CommandsOptions, } from './components/commands';
|
|
14
|
+
export { geo, type LatLng } from './lib/geo';
|
|
14
15
|
export { formatChord, matchesChord, parseChord, isReservedChord, detectPlatform, type Platform } from './lib/chords';
|
|
15
16
|
export { Toolbar, ToolbarSeparator, type ToolbarProps } from './components/toolbar';
|
|
16
17
|
export { Toggle, ToggleGroup, type ToggleProps, type ToggleGroupProps, type ToggleOption } from './components/toggle';
|
|
@@ -34,6 +35,7 @@ export { useClientWork, type ClientWork, type WorkContext, type WorkPhase } from
|
|
|
34
35
|
export { JobStatus, type JobStatusProps, type JobFailure, type JobWords } from './components/job-status';
|
|
35
36
|
export { Thumbnail, ThumbnailSkeleton, type ThumbnailProps, type AspectRatio } from './components/thumbnail';
|
|
36
37
|
export { DataTable, TableSkeleton, parseSort, serialiseSort, type CellValue, type Column, type Sort, type DataTableProps, type RowSelection, type RowExpansion, } from './components/data-table';
|
|
38
|
+
export { MediaPlayer, useMediaElement, SPEECH_RATES, type MediaPlayerProps, type MediaElementState, type MediaProblem, type MediaSource, type MediaSession } from './components/media-player';
|
|
37
39
|
export { Transport, TimeReadout, SeekBar, VolumeControl, RateChoice, MediaStage, StageGuides, transportShortcuts, type TransportProps, type SeekBarProps, type VolumeControlProps, type Precision } from './components/media';
|
|
38
40
|
export { Timeline, TimelineZoomControls, useTimelineZoom, noOverlap, type TimelineProps, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelineChange, type TimelineDrop } from './components/timeline';
|
|
39
41
|
export { tickStep, ticksBetween, tickLabel } from './lib/timeline';
|