strata-react 1.0.31 → 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 +2 -2
- package/UPGRADING.md +1 -0
- package/dist/components/compare-parts.d.ts +2 -0
- package/dist/components/compare-video-grid.d.ts +48 -0
- package/dist/components/compare-video.d.ts +2 -5
- 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/components/video-clock.d.ts +60 -0
- package/dist/{geo-C0jcFp4q.js → cursor-DplHNzj3.js} +173 -3
- package/dist/cursor-DplHNzj3.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1056 -424
- 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 +74 -3
- package/dist/map.js +712 -54
- package/dist/map.js.map +1 -1
- package/dist/{run-CKlcLpdN.js → run-BqZGKhW9.js} +10 -1
- package/dist/run-BqZGKhW9.js.map +1 -0
- package/dist/visual-cli.js +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/geo-C0jcFp4q.js.map +0 -1
- package/dist/run-CKlcLpdN.js.map +0 -1
package/dist/lib/geo.d.ts
CHANGED
|
@@ -30,7 +30,21 @@ export declare function ends(points: readonly LatLng[], loopWithin?: number): {
|
|
|
30
30
|
} | null;
|
|
31
31
|
/** The index of the point nearest `position`, for "where on the route is this?". */
|
|
32
32
|
export declare function nearest(points: readonly LatLng[], position: LatLng): number;
|
|
33
|
-
/**
|
|
33
|
+
/** 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. */
|
|
34
|
+
export declare function slice(points: readonly LatLng[], from: number, to: number, along?: readonly number[]): LatLng[];
|
|
35
|
+
/**
|
|
36
|
+
* The nearest point on a route to `position`, not only its vertices: where it lies, how far along the
|
|
37
|
+
* route that is, and how far `position` is from the route. The inverse of `pointAlong` (a cursor on a
|
|
38
|
+
* map is a distance on a chart). Each leg is flattened around its own latitude, which is exact enough
|
|
39
|
+
* for any leg a recording has; `index` is the leg's first point. Null for fewer than one point.
|
|
40
|
+
*/
|
|
41
|
+
export declare function snap(points: readonly LatLng[], position: LatLng, along?: readonly number[]): {
|
|
42
|
+
position: LatLng;
|
|
43
|
+
metres: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
index: number;
|
|
46
|
+
} | null;
|
|
47
|
+
/** Route geometry helpers: `geo.distance`, `bearing`, `length`, `cumulative`, `bounds`, `pointAlong`, `snap` (its inverse), `slice`, `arrows`, `ends`, `nearest`. */
|
|
34
48
|
export declare const geo: {
|
|
35
49
|
distance: typeof distance;
|
|
36
50
|
bearing: typeof bearing;
|
|
@@ -38,6 +52,8 @@ export declare const geo: {
|
|
|
38
52
|
length: typeof length;
|
|
39
53
|
bounds: typeof bounds;
|
|
40
54
|
pointAlong: typeof pointAlong;
|
|
55
|
+
snap: typeof snap;
|
|
56
|
+
slice: typeof slice;
|
|
41
57
|
arrows: typeof arrows;
|
|
42
58
|
ends: typeof ends;
|
|
43
59
|
nearest: typeof nearest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A marker's true place in world pixels. */
|
|
2
|
+
export type FanInput = {
|
|
3
|
+
id: string;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
/** Where it is drawn; `fanned` is true when that is not its true place (draw a leader line back). */
|
|
8
|
+
export type FanOutput = {
|
|
9
|
+
id: string;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
fanned: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Move apart markers closer than `gap` pixels. Output is in input order. */
|
|
15
|
+
export declare function fanOut(items: readonly FanInput[], gap?: number): FanOutput[];
|
package/dist/map/index.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { RouteMap, type MapRoute, type RouteMapProps, type TileSource } from './route-map';
|
|
1
|
+
export { RouteMap, type MapPosition, type MapRoute, type MapView, type PickNearest, type RouteMapProps, type TileSource } from './route-map';
|
|
2
|
+
export { type MapMarker, type MarkerKeyWords } from './markers';
|
|
3
|
+
export { fanOut, type FanInput, type FanOutput } from './fan';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as L } from 'leaflet';
|
|
2
|
+
import { LatLng } from '../lib/geo';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** The words the key uses for each marker state. */
|
|
5
|
+
export type MarkerKeyWords = {
|
|
6
|
+
marker?: string;
|
|
7
|
+
selected?: string;
|
|
8
|
+
highlighted?: string;
|
|
9
|
+
};
|
|
10
|
+
/** An item on the map: a place, or a stretch of a route (drawn heavier, the marker at its middle). */
|
|
11
|
+
export type MapMarker = {
|
|
12
|
+
/** Stable between renders. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** A place, or a stretch of a route between two distances along it (metres). */
|
|
15
|
+
at: LatLng | {
|
|
16
|
+
routeId: string;
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
};
|
|
20
|
+
/** Its name: the button's accessible name and the card's default words. */
|
|
21
|
+
label: string;
|
|
22
|
+
selected?: boolean;
|
|
23
|
+
/** Marked by the app (a diamond): the newest draft's choice, a flagged item. */
|
|
24
|
+
highlighted?: boolean;
|
|
25
|
+
/** Any CSS colour, normally a role; overrides the state's. */
|
|
26
|
+
colour?: string;
|
|
27
|
+
};
|
|
28
|
+
/** A marker with where it really is and where it is drawn. */
|
|
29
|
+
export type Placed = {
|
|
30
|
+
marker: MapMarker;
|
|
31
|
+
at: LatLng;
|
|
32
|
+
shown: LatLng;
|
|
33
|
+
fanned: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** The running distance at each point of a route, kept per route array so a long route is walked once. */
|
|
36
|
+
export declare function alongOf(points: readonly LatLng[]): number[];
|
|
37
|
+
/** Where a marker really is: its place, or the middle of its stretch. Null when its route is not on the map. */
|
|
38
|
+
export declare function markerPlace(m: MapMarker, routes: readonly {
|
|
39
|
+
id: string;
|
|
40
|
+
points: readonly LatLng[];
|
|
41
|
+
}[]): LatLng | null;
|
|
42
|
+
/** The markers near the view, with the overlapping ones fanned apart for this zoom. */
|
|
43
|
+
export declare function placeMarkers(map: L.Map, markers: readonly MapMarker[], routes: readonly {
|
|
44
|
+
id: string;
|
|
45
|
+
points: readonly LatLng[];
|
|
46
|
+
}[]): Placed[];
|
|
47
|
+
type LayerProps = {
|
|
48
|
+
map: L.Map;
|
|
49
|
+
placed: readonly Placed[];
|
|
50
|
+
onSelect?: (id: string) => void;
|
|
51
|
+
card?: (m: MapMarker) => React.ReactNode;
|
|
52
|
+
};
|
|
53
|
+
/** The pins for the markers near the view, as one roving group: one tab stop, arrows between them. */
|
|
54
|
+
export declare function MarkerLayer({ map, placed, onSelect, card }: LayerProps): React.JSX.Element;
|
|
55
|
+
/** The key to the marker states that are on the map, each with its shape and its words. */
|
|
56
|
+
export declare function MarkerKey({ markers, words }: {
|
|
57
|
+
markers: readonly MapMarker[];
|
|
58
|
+
words?: MarkerKeyWords;
|
|
59
|
+
}): React.JSX.Element | null;
|
|
60
|
+
export {};
|
package/dist/map/route-map.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LatLng } from '../lib/geo';
|
|
2
|
+
import { MapMarker, MarkerKeyWords } from './markers';
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
/** A source of map tiles: a URL template the app's provider documents, and the attribution it requires. */
|
|
4
5
|
export type TileSource = {
|
|
@@ -27,6 +28,37 @@ export type MapRoute = {
|
|
|
27
28
|
/** Start and finish marks. Default on for a single route. */
|
|
28
29
|
ends?: boolean;
|
|
29
30
|
};
|
|
31
|
+
/** One moving position, for a map with more than one (two runners on the same loop). */
|
|
32
|
+
export type MapPosition = {
|
|
33
|
+
/** Stable between renders: the marker is kept by it and moved, never recreated. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Where it is now; null hides it. */
|
|
36
|
+
at: LatLng | null;
|
|
37
|
+
/** What it is called in the text alternative ("Runner A"). */
|
|
38
|
+
label: string;
|
|
39
|
+
/** The route it travels. Its marker takes that route's colour and the text alternative says how far along it is. */
|
|
40
|
+
routeId?: string;
|
|
41
|
+
/** Any CSS colour, normally a role. Overrides the route's. Default: the route's colour, else the theme's primary. */
|
|
42
|
+
colour?: string;
|
|
43
|
+
};
|
|
44
|
+
/** The view the map settled on. */
|
|
45
|
+
export type MapView = {
|
|
46
|
+
bounds: [LatLng, LatLng];
|
|
47
|
+
zoom: number;
|
|
48
|
+
center: LatLng;
|
|
49
|
+
};
|
|
50
|
+
/** The route nearest a picked place. */
|
|
51
|
+
export type PickNearest = {
|
|
52
|
+
routeId: string;
|
|
53
|
+
/** The leg of the route (its first point's index) the place is nearest. */
|
|
54
|
+
index: number;
|
|
55
|
+
/** How far the place is from the route, in metres. */
|
|
56
|
+
distanceM: number;
|
|
57
|
+
/** How far along the route the nearest point is, in metres. */
|
|
58
|
+
alongM: number;
|
|
59
|
+
/** The nearest point on the route. */
|
|
60
|
+
position: LatLng;
|
|
61
|
+
};
|
|
30
62
|
export type RouteMapProps = {
|
|
31
63
|
/** Names the map ("Route of Wednesday's run"). */
|
|
32
64
|
label: string;
|
|
@@ -40,8 +72,47 @@ export type RouteMapProps = {
|
|
|
40
72
|
position?: LatLng | null;
|
|
41
73
|
/** What the position is called in the text alternative. Default "Current position". */
|
|
42
74
|
positionLabel?: string;
|
|
43
|
-
/**
|
|
44
|
-
|
|
75
|
+
/** More moving positions, each in its route's colour and named in the text alternative. Moved without redrawing any route; `position` may be used beside them. */
|
|
76
|
+
positions?: readonly MapPosition[];
|
|
77
|
+
/** Which position `follow` tracks: a `positions` id. Default `position`, else the first of `positions` that is shown. */
|
|
78
|
+
followId?: string;
|
|
79
|
+
/** `true` pans only when the position leaves the inner 80% of the view; `"centre"` keeps it exactly in the centre on every update, with no animation (a frame is deterministic), at `zoom` when that is set, else the zoom the map has. */
|
|
80
|
+
follow?: boolean | "centre";
|
|
81
|
+
/** The zoom level, any number (12, 14.5): it may change every frame without redrawing routes. Unset, the map fits its routes and the person zooms. */
|
|
82
|
+
zoom?: number;
|
|
83
|
+
/** Items on the map: places, or stretches of a route. Keep the array stable between renders. */
|
|
84
|
+
markers?: readonly MapMarker[];
|
|
85
|
+
/** A marker was pressed (click, Enter or Space). */
|
|
86
|
+
onMarkerSelect?: (id: string) => void;
|
|
87
|
+
/** The words shown beside a marker on hover and focus (as `Tooltip`; not interactive). Default its label. */
|
|
88
|
+
renderMarkerCard?: (marker: MapMarker) => React.ReactNode;
|
|
89
|
+
/** The words of the marker key; `false` leaves the key out. */
|
|
90
|
+
markerKey?: MarkerKeyWords | false;
|
|
91
|
+
/** Join the nearest `CursorScope`: a pointer near a route puts its distance along it in every member, and another member's distance shows as a ring on the route. `{ routeId }` picks the route (default the first). */
|
|
92
|
+
cursor?: boolean | {
|
|
93
|
+
routeId?: string;
|
|
94
|
+
};
|
|
95
|
+
/** The view settled after the person moved or zoomed it: bounds, zoom and centre. Not called for moves the app caused through props. */
|
|
96
|
+
onViewChange?: (view: MapView) => void;
|
|
97
|
+
/** Milliseconds the view must be still before `onViewChange`. Default 250. */
|
|
98
|
+
settle?: number;
|
|
99
|
+
/** Also call `onViewChange` for moves the app caused through props (the first fit, `zoom`, `view`, `follow`). */
|
|
100
|
+
reportAppMoves?: boolean;
|
|
101
|
+
/** A view to show: centre and zoom, as a saved view or the app's own. The person can still move away from it; set it again to go back. Wins over fitting the routes. */
|
|
102
|
+
view?: {
|
|
103
|
+
center: LatLng;
|
|
104
|
+
zoom: number;
|
|
105
|
+
};
|
|
106
|
+
/** Choose a place on the map. While set, a click or Enter picks and route lines do not take clicks. */
|
|
107
|
+
picking?: boolean;
|
|
108
|
+
/** A place was chosen, with the nearest route to it when there is one. */
|
|
109
|
+
onPick?: (at: LatLng, info: {
|
|
110
|
+
nearest: PickNearest | null;
|
|
111
|
+
}) => void;
|
|
112
|
+
/** Escape was pressed while picking: the app turns `picking` off. */
|
|
113
|
+
onPickCancel?: () => void;
|
|
114
|
+
/** The banner for pick mode ("Click the map to set the point; Escape cancels"), shown top centre. */
|
|
115
|
+
pickBanner?: React.ReactNode;
|
|
45
116
|
/** The route drawn heavier, with the others lighter. */
|
|
46
117
|
selectedId?: string | null;
|
|
47
118
|
/** A route line was pressed. Give the app's own list of routes the same action for the keyboard. */
|
|
@@ -69,4 +140,4 @@ export type RouteMapProps = {
|
|
|
69
140
|
className?: string;
|
|
70
141
|
};
|
|
71
142
|
/** A map of one or more routes with a position that moves along them, on tiles the app supplies, themed from its roles. Leaflet, behind `strata-react/map`. */
|
|
72
|
-
export declare function RouteMap({ label, routes, tiles, position, positionLabel, follow, selectedId, onSelect, colourScale, colourScaleLabel, formatValue, summary, units, scrollZoom, topEnd, bottomStart, className, }: RouteMapProps): React.JSX.Element;
|
|
143
|
+
export declare function RouteMap({ label, routes, tiles, position, positionLabel, positions, followId, follow, zoom, markers, onMarkerSelect, renderMarkerCard, markerKey, cursor: cursorProp, onViewChange, settle, reportAppMoves, view, picking, onPick, onPickCancel, pickBanner, selectedId, onSelect, colourScale, colourScaleLabel, formatValue, summary, units, scrollZoom, topEnd, bottomStart, className, }: RouteMapProps): React.JSX.Element;
|