@zsherman/viz 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +373 -0
- package/README.md +13 -2
- package/THIRD_PARTY_NOTICES.md +79 -0
- package/dist/dom/flow/flow.js +370 -0
- package/dist/dom/flow/flow.styles.js +158 -0
- package/dist/dom/flow/index.js +4 -0
- package/dist/dom/flow/layout.js +51 -0
- package/dist/dom/geo-map/geo-map.js +1037 -0
- package/dist/dom/geo-map/geo-map.styles.js +184 -0
- package/dist/dom/geo-map/geometry.js +231 -0
- package/dist/dom/geo-map/index.js +3 -0
- package/dist/dom/geo-map/types.js +0 -0
- package/dist/dom/geo-map/world.js +15 -0
- package/dist/dom/index.js +6 -0
- package/dist/solid/flow/flow.jsx +180 -0
- package/dist/solid/flow/flow.styles.jsx +158 -0
- package/dist/solid/flow/index.jsx +4 -0
- package/dist/solid/flow/layout.jsx +51 -0
- package/dist/solid/geo-map/geo-map.jsx +698 -0
- package/dist/solid/geo-map/geo-map.styles.jsx +184 -0
- package/dist/solid/geo-map/geometry.jsx +231 -0
- package/dist/solid/geo-map/index.jsx +3 -0
- package/dist/solid/geo-map/types.jsx +0 -0
- package/dist/solid/geo-map/world.jsx +15 -0
- package/dist/solid/index.jsx +6 -0
- package/dist/styles.css +1 -0
- package/dist/types/flow/flow.d.ts +92 -0
- package/dist/types/flow/flow.styles.d.ts +137 -0
- package/dist/types/flow/index.d.ts +6 -0
- package/dist/types/flow/layout.d.ts +47 -0
- package/dist/types/geo-map/geo-map.d.ts +70 -0
- package/dist/types/geo-map/geo-map.styles.d.ts +188 -0
- package/dist/types/geo-map/geometry.d.ts +116 -0
- package/dist/types/geo-map/index.d.ts +4 -0
- package/dist/types/geo-map/types.d.ts +103 -0
- package/dist/types/geo-map/world.d.ts +11 -0
- package/dist/types/index.d.ts +2 -0
- package/docs/api.json +297 -0
- package/docs/flow.md +255 -0
- package/docs/geo-map.md +320 -0
- package/docs/llms.txt +43 -0
- package/docs/search-index.json +64 -0
- package/package.json +61 -4
package/docs/geo-map.md
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
# Geo map
|
|
2
|
+
|
|
3
|
+
<!-- search: world map, map, globe, connection map, network map, server map, locations, markers, pins, geography, choropleth -->
|
|
4
|
+
|
|
5
|
+
A world map of places and the lines between them: edge servers and the users on them, regions and their replication, offices and their links. Flat (pan and zoom) or a globe (turn and zoom), drawn as SVG with d3-geo's projections, so it renders on the server. The markers are a list you can Tab into and move through with the arrow keys; the kit's tooltip names what the pointer or the focus is on, and hovering or focusing a marker highlights its connections.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { GeoMap } from "@zsherman/viz/geo-map";
|
|
9
|
+
|
|
10
|
+
<GeoMap
|
|
11
|
+
label="Edge servers in Europe and the cities their users connect from"
|
|
12
|
+
markers={[
|
|
13
|
+
{ id: "fra", name: "Frankfurt", latitude: 50.11, longitude: 8.68, group: "server" },
|
|
14
|
+
{ id: "lon", name: "London", latitude: 51.51, longitude: -0.13, group: "server" },
|
|
15
|
+
{ id: "par", name: "Paris", latitude: 48.86, longitude: 2.35, group: "user", description: "31 users, 9 ms" },
|
|
16
|
+
]}
|
|
17
|
+
connections={[
|
|
18
|
+
{ source: "par", target: "fra", label: "9 ms" },
|
|
19
|
+
{ source: "fra", target: "lon", weight: 2.5, color: "neutral" },
|
|
20
|
+
]}
|
|
21
|
+
initialView="markers"
|
|
22
|
+
onMarkerSelect={(marker) => console.log(marker?.id)}
|
|
23
|
+
/>;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage guidelines
|
|
27
|
+
|
|
28
|
+
- Use it when where things are matters: which regions serve which users, where traffic comes from, how sites connect. For values by place that people compare exactly, add a table or a bar list (`@zsherman/charts/bar-list`) beside it; position isn't a number.
|
|
29
|
+
- Name it with `label`: what the markers are and the period ("Edge servers and their users, last hour").
|
|
30
|
+
- Give each marker a `name` (its accessible name and tooltip title) and, when there's more to say, a `description` ("31 users, 9 ms"): screen readers hear it too.
|
|
31
|
+
- Color by `group` and show a legend beside the map: colors alone don't say what a marker is. Keep to a few groups.
|
|
32
|
+
- Open on the markers (`initialView="markers"`) when they sit in one region; leave the world when they're spread out.
|
|
33
|
+
- A globe (`projection="orthographic"`) shows half the world at once: use it for a sense of place, a flat map to compare places.
|
|
34
|
+
|
|
35
|
+
## Anatomy
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<GeoMap
|
|
39
|
+
label="…" // required: the map's accessible name
|
|
40
|
+
markers={[{ id, name, latitude, longitude, group?, color?, radius?, description?, data? }]}
|
|
41
|
+
connections={[{ source, target, weight?, color?, label? }]}
|
|
42
|
+
projection="naturalEarth" // "mercator", "equirectangular", "albers", or "orthographic" (a globe)
|
|
43
|
+
arcStyle="greatCircle" // "quadratic" or "straight"
|
|
44
|
+
graticule // lines every 10°
|
|
45
|
+
initialView="world" // or "markers"
|
|
46
|
+
center={[10, 25]} // the place a globe faces first
|
|
47
|
+
interactive controls // pan, zoom and the zoom buttons (both on by default)
|
|
48
|
+
height={420} // without it the map is twice as wide as it is high
|
|
49
|
+
selected onMarkerSelect // the selected marker (click, Enter or Space)
|
|
50
|
+
onConnectionSelect // a click on a connection
|
|
51
|
+
highlighted // a marker to highlight from outside (a hovered table row)
|
|
52
|
+
animated // dashes flow along the connections
|
|
53
|
+
tooltip={(marker) => …} // the tooltip's content
|
|
54
|
+
worldData={world} // land as GeoJSON; loaded on demand without it
|
|
55
|
+
controller={(c) => …} // fit, zoomBy, centerOn, focus, view
|
|
56
|
+
labels={{ markers, zoomIn, zoomOut, fit, zoom, connections, map }}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
What renders: a root `div` (`data-slot="geo-map"`, `role="group"`, `aria-roledescription="map"`, named by `label`; `data-projection`, and `data-loading` until the land has loaded) holding an SVG hidden from assistive technology (`geo-map-base`: the sea `geo-map-water`, `geo-map-graticule`, `geo-map-land`, and `geo-map-connections` with one `geo-map-connection` group per line, `data-state="rest" | "active" | "dimmed"`), the markers' list (`geo-map-markers`, `role="listbox"`, only when there are markers) of `geo-map-marker` options (`data-id`, `data-group`, `data-active`, `data-dimmed`, `data-hidden` on a globe's far side, `aria-selected`), the zoom buttons (`geo-map-controls`) and the tooltip (`geo-map-tooltip`).
|
|
61
|
+
|
|
62
|
+
## Markers
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
interface GeoMapMarker<T = unknown> {
|
|
66
|
+
id: string; // unique; connections name markers by it
|
|
67
|
+
name: string; // accessible name and tooltip title
|
|
68
|
+
latitude: number;
|
|
69
|
+
longitude: number;
|
|
70
|
+
group?: string; // markers of a group share a color
|
|
71
|
+
color?: GeoMapColor; // overrides the group's
|
|
72
|
+
radius?: number; // the dot's radius in px (default 5), the same on screen at any zoom
|
|
73
|
+
description?: string; // the tooltip's second line, and the marker's description for screen readers
|
|
74
|
+
data?: T; // yours, handed back in onMarkerSelect and tooltip
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Every marker is a target at least 24px across (the dot inside is smaller), so dense markers overlap: zoom in to pick one apart, or use the keyboard, which moves to the nearest marker in each direction. A marker's accessible name is its `name`, and when the map has connections, its count ("Frankfurt, 5 connections").
|
|
79
|
+
|
|
80
|
+
## Connections
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
interface GeoMapConnection {
|
|
84
|
+
source: string; // a marker's id
|
|
85
|
+
target: string;
|
|
86
|
+
weight?: number; // line width in px (default 1.5), the same on screen at any zoom
|
|
87
|
+
color?: GeoMapColor; // defaults to the source marker's color
|
|
88
|
+
label?: string; // after "Paris → Frankfurt" in its tooltip ("9 ms")
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Connections naming a marker that isn't in `markers` are left out. `arcStyle` sets how they're drawn:
|
|
93
|
+
|
|
94
|
+
| `arcStyle` | Flat map | Globe |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| `greatCircle` (default) | a gentle curve, always bowed up the screen (its control point 0.2 of the distance off the middle), reading as the shortest way over the globe without wrapping round the map's edge | the true great circle (sampled at 50 points), ending at the horizon when it goes over it |
|
|
97
|
+
| `quadratic` | a stronger curve, 0.3 of the distance off the middle, to the left of the direction of travel (A→B and B→A bow apart) | the same between the projected ends, when both face the viewer |
|
|
98
|
+
| `straight` | a line | a line, when both ends face the viewer |
|
|
99
|
+
|
|
100
|
+
Hovering or focusing a marker highlights its connections and the markers at their other ends, and dims the rest; `highlighted` does the same from outside (pass `null` to clear, leave it out to follow the pointer and the focus). `animated` moves dashes along every connection from source to target; reduced motion stops them. A click on a connection calls `onConnectionSelect`; connections are named through their markers for keyboard and screen reader users (each marker says how many it has, and the tooltip names both ends).
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import { GeoMap } from "@zsherman/viz/geo-map";
|
|
104
|
+
import { createSignal } from "solid-js";
|
|
105
|
+
|
|
106
|
+
const [row, setRow] = createSignal<string | null>(null);
|
|
107
|
+
|
|
108
|
+
<GeoMap label="Regions" markers={regions} connections={links} highlighted={row()} />
|
|
109
|
+
<table>
|
|
110
|
+
{/* each row: onPointerEnter={() => setRow(region.id)} onPointerLeave={() => setRow(null)} */}
|
|
111
|
+
</table>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Colors and groups
|
|
115
|
+
|
|
116
|
+
Markers of a `group` share a color, and groups take the chart series colors in the order they first appear: the first group `--sui-chart-1`, the next `--sui-chart-2`, and so on. Without groups every marker is `--sui-chart-1`. `color` overrides it on one marker or connection.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
type GeoMapColor =
|
|
120
|
+
| "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | "chart-6" | "chart-7" | "chart-8"
|
|
121
|
+
| "accent" | "info" | "success" | "warning" | "danger" // the kit's status colors
|
|
122
|
+
| "neutral" // --sui-text-muted
|
|
123
|
+
| (string & {}); // any CSS color
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`geoMapColor(color)` turns one into CSS (`"chart-2"` → `var(--sui-chart-2)`), for a legend that matches:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import { geoMapColor } from "@zsherman/viz/geo-map";
|
|
130
|
+
|
|
131
|
+
<span style={{ display: "inline-flex", "align-items": "center", gap: "6px" }}>
|
|
132
|
+
<svg width="10" height="10" aria-hidden="true">
|
|
133
|
+
<circle cx="5" cy="5" r="5" fill={geoMapColor("chart-1")} />
|
|
134
|
+
</svg>
|
|
135
|
+
Edge server
|
|
136
|
+
</span>;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The base map is four tokens, in light and dark: `--sui-map-water` (the sea and the frame around a flat map), `--sui-map-land`, `--sui-map-land-border` (between countries and along coasts) and `--sui-map-graticule`. Override them like any token:
|
|
140
|
+
|
|
141
|
+
```css
|
|
142
|
+
:root {
|
|
143
|
+
--sui-map-land: light-dark(oklch(0.93 0.01 150), oklch(0.32 0.02 150));
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Each dot has a ring of `--sui-surface`, so it reads on land and on water. In forced colors the land and sea take the system's colors and markers stay in theirs (they're data).
|
|
148
|
+
|
|
149
|
+
## Globe
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { GeoMap } from "@zsherman/viz/geo-map";
|
|
153
|
+
|
|
154
|
+
<GeoMap
|
|
155
|
+
label="Database regions and the replication between them"
|
|
156
|
+
projection="orthographic"
|
|
157
|
+
height={420}
|
|
158
|
+
center={[20, 25]}
|
|
159
|
+
graticule
|
|
160
|
+
animated
|
|
161
|
+
markers={regions}
|
|
162
|
+
connections={replication}
|
|
163
|
+
/>;
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Drag to turn it; Ctrl or ⌘ + scroll, a pinch, the + and − keys or the buttons zoom it (from half size to eight times). `center` is the `[longitude, latitude]` it faces first (`[10, 25]` by default); with `initialView="markers"` it faces the markers' middle and zooms until they fit. Markers on the far side leave the view and the pointer's reach but stay in the list: focusing one turns the globe to it, animated (at once under reduced motion).
|
|
167
|
+
|
|
168
|
+
## Views and the controller
|
|
169
|
+
|
|
170
|
+
A flat map pans and zooms with ui-sdk's viewport: drag to pan once zoomed in, Ctrl or ⌘ + scroll (or a pinch) to zoom at the pointer, the + and − keys and buttons to zoom at the middle, 0 to go back to the whole world's size. At the whole world's size the wheel scrolls the page; zoomed in, it pans. The map never pans past the world's edges, and zooms from 1 to 12 times.
|
|
171
|
+
|
|
172
|
+
`initialView="markers"` opens on every marker, as close as they fit (up to six times); it follows the markers until someone pans or zooms. The Show all button does the same at any time (the whole world when there are no markers).
|
|
173
|
+
|
|
174
|
+
`controller` receives a `GeoMapController` once the map mounts, for your own buttons:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
interface GeoMapController {
|
|
178
|
+
fit(target?: "markers" | "world" | readonly string[]): void; // every marker, the world, or these ids
|
|
179
|
+
zoomBy(factor: number): void; // around the middle: 1.5 in, 1 / 1.5 out
|
|
180
|
+
centerOn(target: string | readonly [longitude: number, latitude: number]): void; // a marker's id or a place
|
|
181
|
+
focus(id: string): void; // moves keyboard focus to a marker
|
|
182
|
+
view(): GeoMapView; // { zoom, center: [longitude, latitude] }
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { Button } from "@zsherman/kit/button";
|
|
188
|
+
import { type GeoMapController, GeoMap } from "@zsherman/viz/geo-map";
|
|
189
|
+
|
|
190
|
+
let map: GeoMapController | undefined;
|
|
191
|
+
|
|
192
|
+
<Button onClick={() => map?.fit(["sin", "nrt", "syd"])}>Asia Pacific</Button>
|
|
193
|
+
<Button onClick={() => map?.centerOn("fra")}>Center on Frankfurt</Button>
|
|
194
|
+
<Button onClick={() => map?.fit("world")}>Whole world</Button>
|
|
195
|
+
<GeoMap label="Database regions" markers={regions} connections={links} controller={(c) => (map = c)} />
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`interactive={false}` fixes the view (no drag, wheel, keys or buttons; the markers still take focus and show their tooltips); `controls={false}` keeps the gestures and keys and drops the buttons.
|
|
199
|
+
|
|
200
|
+
## Selection and tooltips
|
|
201
|
+
|
|
202
|
+
A click on a marker, or Enter or Space on the focused one, selects it and calls `onMarkerSelect` with the marker (with `null` when the selected one is chosen again). The selected marker has a ring in its color and `aria-selected="true"`. Pass `selected` (an id or `null`) to control the selection, or `defaultSelected` to start with one.
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { GeoMap, type GeoMapMarker } from "@zsherman/viz/geo-map";
|
|
206
|
+
import { createSignal } from "solid-js";
|
|
207
|
+
|
|
208
|
+
type Site = { load: string };
|
|
209
|
+
const [picked, setPicked] = createSignal<GeoMapMarker<Site> | null>(null);
|
|
210
|
+
|
|
211
|
+
<GeoMap<Site> label="Servers" markers={servers} selected={picked()?.id ?? null} onMarkerSelect={setPicked} />
|
|
212
|
+
<p>{picked() ? `${picked()!.name}: ${picked()!.data?.load}` : "Select a server"}</p>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The tooltip (the kit's Tooltip, a chunk of its own loaded when the browser is idle after the first map mounts, or at the first hover or focus) shows the marker under the pointer, or the focused one after a key press: its name, its `description` and its connection count. `tooltip` replaces that content; it gets the marker, with your `data`:
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
<GeoMap<Site>
|
|
219
|
+
label="Servers"
|
|
220
|
+
markers={servers}
|
|
221
|
+
tooltip={(marker) => (
|
|
222
|
+
<>
|
|
223
|
+
<strong>{marker.name}</strong>
|
|
224
|
+
<span>{marker.data?.load}</span>
|
|
225
|
+
</>
|
|
226
|
+
)}
|
|
227
|
+
/>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Escape closes the tooltip; focus stays on the marker.
|
|
231
|
+
|
|
232
|
+
## World data
|
|
233
|
+
|
|
234
|
+
Without `worldData`, the map draws the sea (and the graticule, and the markers) at once and loads the land after it mounts: Natural Earth's countries at 1:110m (`world-atlas`, about 100 KB of TopoJSON, 35 KB compressed), a chunk of its own that the first map on a page starts and every map shares. `data-loading` is on the root until it lands.
|
|
235
|
+
|
|
236
|
+
To draw land on the server too, load it first and pass it in: `loadWorld()` returns the same countries as GeoJSON.
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import { GeoMap, loadWorld, type GeoMapWorld } from "@zsherman/viz/geo-map";
|
|
240
|
+
|
|
241
|
+
// In a route loader (or any async code that runs before the page renders):
|
|
242
|
+
const world: GeoMapWorld = await loadWorld();
|
|
243
|
+
|
|
244
|
+
<GeoMap label="Regions" markers={regions} worldData={world} />;
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
`worldData` takes any GeoJSON FeatureCollection of polygons in `[longitude, latitude]` degrees (what `topojson.feature` returns): a finer map, one country's regions, or land without borders.
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
interface GeoMapWorld {
|
|
251
|
+
type: "FeatureCollection";
|
|
252
|
+
features: readonly GeoMapFeature[];
|
|
253
|
+
}
|
|
254
|
+
interface GeoMapFeature {
|
|
255
|
+
type: "Feature";
|
|
256
|
+
id?: string | number;
|
|
257
|
+
geometry: GeoMapGeometry | null; // a GeoJSON geometry
|
|
258
|
+
properties?: Record<string, unknown> | null;
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Natural Earth is in the public domain; `world-atlas` and `topojson-client` are ISC.
|
|
263
|
+
|
|
264
|
+
## Keyboard and screen readers
|
|
265
|
+
|
|
266
|
+
The map is a group named by `label` ("Edge servers in Europe…, map"). Its markers are one listbox ("Locations"), so Tab reaches the map once, on the selected marker or the first.
|
|
267
|
+
|
|
268
|
+
| Key | Action |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| Tab | Focuses the markers (the selected one, else the one focused last, else the first), then the zoom buttons |
|
|
271
|
+
| Arrow keys | On a flat map, the nearest marker in that direction on screen; on a globe, the next or previous marker in the list (focusing one turns the globe to it) |
|
|
272
|
+
| Home, End | On a globe, the first and last marker |
|
|
273
|
+
| Enter, Space | Selects the focused marker (again: clears the selection) |
|
|
274
|
+
| + / − | Zooms in or out around the middle (announced, "Zoom 150%") |
|
|
275
|
+
| 0 | Back to the whole world's size (a flat map) or the fitted globe |
|
|
276
|
+
| Escape | Closes the tooltip |
|
|
277
|
+
|
|
278
|
+
A focused marker off screen is brought into view (the map pans the least it needs to). Each marker's name says how many connections it has, and its `description` is its description; the SVG is hidden from assistive technology. Put the numbers that matter in text beside the map, too.
|
|
279
|
+
|
|
280
|
+
## Gotchas
|
|
281
|
+
|
|
282
|
+
- Coordinates are degrees: `latitude` −90 to 90, `longitude` −180 to 180. A swapped pair lands in the wrong place without an error.
|
|
283
|
+
- Marker ids must be unique; connections and `selected` use them.
|
|
284
|
+
- The map takes its parent's width. Without `height` it's twice as wide as it is high; with it, set a height that suits the projection (a globe looks best about square).
|
|
285
|
+
- `albers` is a conic projection centered on the United States: use it for maps of North America.
|
|
286
|
+
- Overlapping markers (a dense map) are each still reachable by the keyboard, but a pointer reaches the top one: zoom in first.
|
|
287
|
+
|
|
288
|
+
## API reference: `@zsherman/viz/geo-map`
|
|
289
|
+
|
|
290
|
+
<!-- generated:props:geo-map (node tooling/props-doc.ts; edit the JSDoc in the source, not this table) -->
|
|
291
|
+
|
|
292
|
+
Generated from the types of `@zsherman/viz/geo-map`. Each part also takes its element's native and ARIA attributes.
|
|
293
|
+
|
|
294
|
+
#### `GeoMap`
|
|
295
|
+
|
|
296
|
+
| Prop | Type | Default | Description |
|
|
297
|
+
| --- | --- | --- | --- |
|
|
298
|
+
| `animated` | `boolean` | `false` | Moves dashes along every connection, from source to target. Still under reduced motion. |
|
|
299
|
+
| `arcStyle` | `"greatCircle" \| "quadratic" \| "straight"` | `"greatCircle"` | How connections are drawn. |
|
|
300
|
+
| `center` | `readonly [longitude: number, latitude: number]` | `[10, 25]` | The place a globe faces first, `[longitude, latitude]`. |
|
|
301
|
+
| `connections` | `readonly GeoMapConnection[]` | `[]` | Lines between markers, by their ids. Ones naming a missing marker are left out. |
|
|
302
|
+
| `controller` | `((controller: GeoMapController) => void)` | | Receives the map's controller once it mounts: fit, zoom and center from your own controls. |
|
|
303
|
+
| `controls` | `boolean` | `true` | Shows the zoom in, zoom out and Show all buttons (with `interactive`). |
|
|
304
|
+
| `defaultSelected` | `string \| null` | `null` | The marker selected at first, when the selection isn't controlled. |
|
|
305
|
+
| `graticule` | `boolean` | `false` | Draws lines of latitude and longitude every 10°. |
|
|
306
|
+
| `height` | `string \| number` | | The map's height (a number is pixels). Without it the map is twice as wide as it is high. |
|
|
307
|
+
| `highlighted` | `string \| null` | | A marker whose connections stand out while the rest dim, to control the highlight (from a table row your app hovers, say). Without it the marker under the pointer or the keyboard focus is highlighted. |
|
|
308
|
+
| `initialView` | `"markers" \| "world"` | `"world"` | What the map shows first: the whole world, or every marker as close as they fit (it follows the markers until someone pans or zooms). |
|
|
309
|
+
| `interactive` | `boolean` | `true` | Pan and zoom (a flat map) or turn and zoom (a globe) with the pointer, the wheel and the keys. |
|
|
310
|
+
| `label` (required) | `string` | | The map's accessible name: what it shows ("Servers and users, last hour"). |
|
|
311
|
+
| `labels` | `Partial<GeoMapLabels>` | | Built-in words; also settable for every map through `LocaleProvider`'s `geoMap`. |
|
|
312
|
+
| `markers` | `readonly GeoMapMarker<T>[]` | `[]` | The places to mark. |
|
|
313
|
+
| `onConnectionSelect` | `((connection: GeoMapConnection) => void)` | | Runs when a connection is clicked. |
|
|
314
|
+
| `onMarkerSelect` | `((marker: GeoMapMarker<T> \| null) => void)` | | Runs when a marker is clicked, or chosen with Enter or Space, with the marker (null when it's chosen again, which clears the selection). |
|
|
315
|
+
| `projection` | `"albers" \| "equirectangular" \| "mercator" \| "naturalEarth" \| "orthographic"` | `"naturalEarth"` | A flat world or a globe (`"orthographic"`). |
|
|
316
|
+
| `selected` | `string \| null` | | The selected marker's id, to control the selection. `null` selects none. |
|
|
317
|
+
| `tooltip` | `((marker: GeoMapMarker<T>) => Element)` | | The tooltip's content for a marker. Defaults to its name, description and connection count. |
|
|
318
|
+
| `worldData` | `GeoMapWorld` | | The land, as GeoJSON. Without it the map loads Natural Earth's countries (1:110m) on demand, after it mounts; pass `await loadWorld()` (or your own) to draw land on the server too. |
|
|
319
|
+
|
|
320
|
+
<!-- /generated:props:geo-map -->
|
package/docs/llms.txt
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @zsherman/viz
|
|
2
|
+
|
|
3
|
+
> Maps and graphs for @zsherman/kit: a world map of places and the connections between them (servers and the users on them, regions and replication), flat with pan and zoom or a globe that turns, drawn as SVG on the server and the client, read out and moved by keyboard; and flow graphs of steps and what moves between them (ETL pipelines, deploys, workflows) on solid-flow, with statuses, auto layout and an editing mode. Themed with the kit's `--sui-*` tokens. Your app does not need a StyleX compiler.
|
|
4
|
+
|
|
5
|
+
Read this file first, then the pages for what you use. These docs ship in the package, so they match the installed version.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @zsherman/viz @zsherman/kit solid-js@^2 @solidjs/web@^2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Load both stylesheets once, in the app entry, the kit's first:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import "@zsherman/kit/styles.css";
|
|
17
|
+
import "@zsherman/viz/styles.css";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`@zsherman/viz/styles.css` carries the parts' styles, solid-flow's stylesheet with xyflow's `--xy-*` variables mapped to the kit's tokens, the map's colors (`--sui-map-water`, `--sui-map-land`, `--sui-map-land-border`, `--sui-map-graticule`) and the chart series colors markers take (`--sui-chart-1` … `--sui-chart-8`), in the kit's cascade layers, so your own CSS wins without `!important`. The map follows the kit's light and dark schemes (`data-color-scheme`, `<Theme scheme>`) and its `LocaleProvider` for its words.
|
|
21
|
+
|
|
22
|
+
Common tasks:
|
|
23
|
+
|
|
24
|
+
- Servers and the users on them, linked, on a world map: [geo-map.md](./geo-map.md)
|
|
25
|
+
- A globe that turns: [geo-map.md#globe](./geo-map.md#globe)
|
|
26
|
+
- Open on the markers, zoom to a set of them, center on one from your own buttons: [geo-map.md#views-and-the-controller](./geo-map.md#views-and-the-controller)
|
|
27
|
+
- How connections curve (great circle, quadratic, straight): [geo-map.md#connections](./geo-map.md#connections)
|
|
28
|
+
- Marker colors and groups, a legend: [geo-map.md#colors-and-groups](./geo-map.md#colors-and-groups)
|
|
29
|
+
- Land on the server, your own land data, or none: [geo-map.md#world-data](./geo-map.md#world-data)
|
|
30
|
+
- Keyboard and screen readers: [geo-map.md#keyboard-and-screen-readers](./geo-map.md#keyboard-and-screen-readers)
|
|
31
|
+
- A pipeline or DAG of steps with statuses (an ETL run, a deploy): [flow.md](./flow.md)
|
|
32
|
+
- Place nodes that come without positions (auto layout): [flow.md#auto-layout](./flow.md#auto-layout)
|
|
33
|
+
- Let people edit a graph (drag, connect, delete): [flow.md#editing](./flow.md#editing)
|
|
34
|
+
- Data moving along an edge, edge colors: [flow.md#edges](./flow.md#edges)
|
|
35
|
+
- Your own node and edge types: [flow.md#your-own-nodes-and-edges](./flow.md#your-own-nodes-and-edges)
|
|
36
|
+
- Flow colors and xyflow's variables: [flow.md#theming](./flow.md#theming)
|
|
37
|
+
|
|
38
|
+
## Components
|
|
39
|
+
|
|
40
|
+
- `@zsherman/viz/geo-map` — `GeoMap`, `loadWorld`, `geoMapColor` — [geo-map.md](./geo-map.md)
|
|
41
|
+
- `@zsherman/viz/flow` — `Flow`, `FlowNode`, `FlowEdge`, `FlowBackground`, `FlowControls`, `FlowMiniMap`, `layoutFlow`, and solid-flow's stores, hooks and edge helpers (`createNodeStore`, `createEdgeStore`, `useSolidFlow`, `Handle`, …) — [flow.md](./flow.md)
|
|
42
|
+
|
|
43
|
+
`@zsherman/viz` re-exports them.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{"records":[
|
|
2
|
+
{"id":"flow.md","kind":"page","title":"Flow","page":"Flow","doc":"flow.md","entry":"@zsherman/viz/flow","keywords":"dag, graph, node graph, pipeline, workflow, data flow, flowchart, node editor, xyflow, react flow, dependency graph, lineage","text":"A pannable, zoomable graph of steps and what moves between them: an ETL pipeline, a deploy's jobs, a service map, a workflow someone builds. It's @dschz/solid-flow (xyflow's engine for Solid 2) in the kit's look: step nodes with a status, an icon, a title, a description and meta; edges in the kit's tones that can show data moving; themed background, controls and minimap; and layoutFlow to place graphs that arrive without positions. It's read-only by default (pan, zoom and select), and an editor with readOnly={false}. It renders on the server when nodes have a width and height."},
|
|
3
|
+
{"id":"flow.md#usage-guidelines","kind":"section","title":"Usage guidelines","page":"Flow","doc":"flow.md","anchor":"usage-guidelines","text":"Use it when the shape of the work matters: what feeds what, what runs side by side, where a failure stops the rest. For steps in order, a Trace (@zsherman/kit/trace) reads faster; put the two side by side for a run. Name it with label: what the graph is and its state (\"Nightly ETL: 2 running, 1 failed\"). Give every node a width and height: the server can't measure, layoutFlow uses them to place nodes, and the first paint is right. Keep it read-only for views (the default); readOnly={false} only where people edit the graph. Say what matters in text too (a failed step in a heading or a list): a graph is hard to read with a screen reader."},
|
|
4
|
+
{"id":"flow.md#anatomy","kind":"section","title":"Anatomy","page":"Flow","doc":"flow.md","anchor":"anatomy","text":"What renders: a root div (data-slot=\"flow\", data-readonly while read-only) around solid-flow's wrapper (role=\"application\", named by label) with the viewport, the nodes (.solid-flownode, focusable, aria-roledescription=\"node\"), the edges, and the background, controls and minimap. Each step node renders flow-node (data-status) with flow-node-icon, flow-node-title, flow-node-description and flow-node-meta; each kit edge renders flow-edge (data-flowing).","code":"Flow label defaultNodes nodes defaultEdges edges readOnly height controls background minimap nodeTypes edgeTypes onNodeClick onSelectionChange Panel position top-right"},
|
|
5
|
+
{"id":"flow.md#step-nodes","kind":"section","title":"Step nodes","page":"Flow","doc":"flow.md","anchor":"step-nodes","text":"A node with type: \"step\" (the Flow registers it) shows FlowNodeData: Statuses take Trace's icons and colors: pending a dashed circle, running the Spinner and an accent edge, success a check, warning a triangle and a warning edge, error an alert and a danger edge. The status word comes from the locale's trace.status (LocaleProvider), \"Succeeded\", \"Failed\" and so on in English. Handles sit on the sides layoutFlow gives the node (targetPosition, sourcePosition: left and right by default, top and bottom going down). In a read-only flow they're hidden but still anchor the edges.","code":"FlowStatus pending running success warning error FlowNodeData title description status icon IconNode meta FlowNodeItem Node step"},
|
|
6
|
+
{"id":"flow.md#edges","kind":"section","title":"Edges","page":"Flow","doc":"flow.md","anchor":"edges","text":"An edge with type: \"flow\" (the default type for edges without one) is a curve in a tone, with FlowEdgeData: solid-flow's built-in edge types (\"default\", \"straight\", \"step\", \"smoothstep\") work too, in the kit's border color; their animated: true stops under reduced motion as well.","code":"FlowEdgeData flowing tone neutral accent success warning danger FlowEdgeItem Edge flow"},
|
|
7
|
+
{"id":"flow.md#auto-layout","kind":"section","title":"Auto layout","page":"Flow","doc":"flow.md","anchor":"auto-layout","text":"layoutFlow(nodes, edges, options) places nodes that arrive without positions with dagre's layered layout: ranks along the edges, few crossings. It returns new nodes with position (top left), targetPosition and sourcePosition; the input isn't changed. To tidy an editable graph, lay out its current nodes and move them:","code":"LayoutFlowOptions direction nodeWidth nodeHeight rankGap nodeGap Flow label Build graph defaultNodes layoutFlow nodes edges defaultEdges placed Map map node position setNodes draft for get"},
|
|
8
|
+
{"id":"flow.md#editing","kind":"section","title":"Editing","page":"Flow","doc":"flow.md","anchor":"editing","text":"readOnly={false} turns on dragging, connecting and deleting (Backspace), and the wheel zooms. Keep the graph in solid-flow's stores: the flow writes positions and selection onto your rows, and you add the edges people connect in onConnect. To mix (drag but don't connect), set solid-flow's own props after readOnly: nodesDraggable, nodesConnectable, elementsSelectable, deleteKey, zoomOnScroll. Every solid-flow prop and event passes through (onNodeClick, onSelectionChange, fitViewOptions, …); useSolidFlow() inside the flow gives its commands (fitView, setCenter, addNodes, …).","code":"Connection FlowEdgeTypes FlowNodeTypes createEdgeStore createNodeStore Flow zsherman viz flow nodes setNodes step width height position data title New signup Send welcome email edges setEdges a-b source target connect draft push label Onboarding automation readOnly onConnect minimap"},
|
|
9
|
+
{"id":"flow.md#your-own-nodes-and-edges","kind":"section","title":"Your own nodes and edges","page":"Flow","doc":"flow.md","anchor":"your-own-nodes-and-edges","text":"nodeTypes and edgeTypes add to the Flow's (step, flow). Build them from solid-flow's parts, which this entry re-exports (Handle, Position, BaseEdge, getBezierPath, getSmoothStepPath, getStraightPath, Panel, useSolidFlow, and the types Node, Edge, NodeProps, EdgeProps, Connection):","code":"Flow Handle Position NodeProps zsherman viz flow Gate label gate div style padding border dashed sui-border-strong border-radius target position Left data source Right Release nodeTypes defaultNodes nodes defaultEdges edges"},
|
|
10
|
+
{"id":"flow.md#theming","kind":"section","title":"Theming","page":"Flow","doc":"flow.md","anchor":"theming","text":"@zsherman/viz/styles.css carries solid-flow's stylesheet (in the kit's base layer) and maps xyflow's --xy-* variables to the kit's tokens inside a Flow: the surface for nodes, controls and the minimap, --sui-border-strong for edges, handles and the grid, --sui-accent for selection. Override a variable on the Flow, or any token: The parts are exported for a flow you compose yourself on solid-flow's SolidFlow: FlowNode and FlowEdge (register them as types), FlowBackground (dots in the border color), FlowControls (zoom and fit) and FlowMiniMap.","code":"data-slot flow solid-flow xy-edge-stroke sui-text-muted xy-background-pattern-color sui-border"},
|
|
11
|
+
{"id":"flow.md#keyboard-and-screen-readers","kind":"section","title":"Keyboard and screen readers","page":"Flow","doc":"flow.md","anchor":"keyboard-and-screen-readers","text":"The flow is an application region named by label. Nodes are focusable; solid-flow describes the keys to screen readers and announces selection. Tab · Moves between nodes (and edges), then the controls Enter, Space · Selects the focused node Escape · Clears the selection Arrow keys · Move the selected nodes (when they're draggable: readOnly={false}) Backspace · Deletes the selection (readOnly={false}) A step node's name says its status first (\"Failed: Search index\"). Edges aren't named: say in text which steps feed which when it matters."},
|
|
12
|
+
{"id":"flow.md#gotchas","kind":"section","title":"Gotchas","page":"Flow","doc":"flow.md","anchor":"gotchas","text":"Nodes without width and height render on the server without a size and jump once measured; layoutFlow falls back to 200 × 56 for them. defaultNodes/defaultEdges seed the flow once (later changes are ignored); pass stores (nodes/edges) to change the graph from your code. Node ids must be unique, and every edge's source and target must name a node. A large graph fits whole at a small zoom (down to 0.1); give it a minimap, and zoom in to read."},
|
|
13
|
+
{"id":"flow.md#api-reference-zshermanvizflow","kind":"section","title":"API reference: @zsherman/viz/flow","page":"Flow","doc":"flow.md","anchor":"api-reference-zshermanvizflow","text":""},
|
|
14
|
+
{"id":"geo-map.md","kind":"page","title":"Geo map","page":"Geo map","doc":"geo-map.md","entry":"@zsherman/viz/geo-map","keywords":"world map, map, globe, connection map, network map, server map, locations, markers, pins, geography, choropleth","text":"A world map of places and the lines between them: edge servers and the users on them, regions and their replication, offices and their links. Flat (pan and zoom) or a globe (turn and zoom), drawn as SVG with d3-geo's projections, so it renders on the server. The markers are a list you can Tab into and move through with the arrow keys; the kit's tooltip names what the pointer or the focus is on, and hovering or focusing a marker highlights its connections."},
|
|
15
|
+
{"id":"geo-map.md#usage-guidelines","kind":"section","title":"Usage guidelines","page":"Geo map","doc":"geo-map.md","anchor":"usage-guidelines","text":"Use it when where things are matters: which regions serve which users, where traffic comes from, how sites connect. For values by place that people compare exactly, add a table or a bar list (@zsherman/charts/bar-list) beside it; position isn't a number. Name it with label: what the markers are and the period (\"Edge servers and their users, last hour\"). Give each marker a name (its accessible name and tooltip title) and, when there's more to say, a description (\"31 users, 9 ms\"): screen readers hear it too. Color by group and show a legend beside the map: colors alone don't say what a marker is. Keep to a few groups. Open on the markers (initialView=\"markers\") when they sit in one region; leave the world when they're spread out. A globe (projection=\"orthographic\") shows half the world at once: use it for a sense of place, a flat map to compare places."},
|
|
16
|
+
{"id":"geo-map.md#anatomy","kind":"section","title":"Anatomy","page":"Geo map","doc":"geo-map.md","anchor":"anatomy","text":"What renders: a root div (data-slot=\"geo-map\", role=\"group\", aria-roledescription=\"map\", named by label; data-projection, and data-loading until the land has loaded) holding an SVG hidden from assistive technology (geo-map-base: the sea geo-map-water, geo-map-graticule, geo-map-land, and geo-map-connections with one geo-map-connection group per line, data-state=\"rest\" | \"active\" | \"dimmed\"), the markers' list (geo-map-markers, role=\"listbox\", only when there are markers) of geo-map-marker options (data-id, data-group, data-active, data-dimmed, data-hidden on a globe's far side, aria-selected), the zoom buttons (geo-map-controls) and the tooltip (geo-map-tooltip).","code":"GeoMap label markers name latitude longitude group color radius description data connections source target weight projection naturalEarth arcStyle greatCircle graticule initialView world center interactive controls height selected onMarkerSelect onConnectionSelect highlighted animated tooltip marker worldData controller labels zoomIn zoomOut fit zoom map"},
|
|
17
|
+
{"id":"geo-map.md#markers","kind":"section","title":"Markers","page":"Geo map","doc":"geo-map.md","anchor":"markers","text":"Every marker is a target at least 24px across (the dot inside is smaller), so dense markers overlap: zoom in to pick one apart, or use the keyboard, which moves to the nearest marker in each direction. A marker's accessible name is its name, and when the map has connections, its count (\"Frankfurt, 5 connections\").","code":"GeoMapMarker name latitude longitude group color GeoMapColor radius description data"},
|
|
18
|
+
{"id":"geo-map.md#connections","kind":"section","title":"Connections","page":"Geo map","doc":"geo-map.md","anchor":"connections","text":"Connections naming a marker that isn't in markers are left out. arcStyle sets how they're drawn: greatCircle (default) · a gentle curve, always bowed up the screen (its control point 0.2 of the distance off the middle), reading as the shortest way over the globe without wrapping round the map's edge · the true great circle (sampled at 50 points), ending at the horizon when it goes over it quadratic · a stronger curve, 0.3 of the distance off the middle, to the left of the direction of travel (A→B and B→A bow apart) · the same between the projected ends, when both face the viewer straight · a line · a line, when both ends face the viewer Hovering or focusing a marker highlights its connections and the markers at their other ends, and dims the rest; highlighted does the same from outside (pass null to clear, leave it out to follow the pointer and the focus). animated moves dashes along every connection from source to target; reduced motion stops them. A click on a connection calls onConnectionSelect; connections are named through their markers for keyboard and screen reader users (each marker says how many it has, and the tooltip names both ends).","code":"GeoMapConnection source target weight color GeoMapColor label GeoMap zsherman viz geo-map createSignal row setRow Regions markers regions connections links highlighted table"},
|
|
19
|
+
{"id":"geo-map.md#colors-and-groups","kind":"section","title":"Colors and groups","page":"Geo map","doc":"geo-map.md","anchor":"colors-and-groups","text":"Markers of a group share a color, and groups take the chart series colors in the order they first appear: the first group --sui-chart-1, the next --sui-chart-2, and so on. Without groups every marker is --sui-chart-1. color overrides it on one marker or connection. geoMapColor(color) turns one into CSS (\"chart-2\" → var(--sui-chart-2)), for a legend that matches: The base map is four tokens, in light and dark: --sui-map-water (the sea and the frame around a flat map), --sui-map-land, --sui-map-land-border (between countries and along coasts) and --sui-map-graticule. Override them like any token: Each dot has a ring of --sui-surface, so it reads on land and on water. In forced colors the land and sea take the system's colors and markers stay in theirs (they're data).","code":"GeoMapColor chart-1 chart-2 chart-3 chart-4 chart-5 chart-6 chart-7 chart-8 accent info success warning danger neutral geoMapColor zsherman viz geo-map span style display inline-flex align-items center gap svg width height aria-hidden circle fill Edge server root sui-map-land light-dark oklch"},
|
|
20
|
+
{"id":"geo-map.md#globe","kind":"section","title":"Globe","page":"Geo map","doc":"geo-map.md","anchor":"globe","text":"Drag to turn it; Ctrl or ⌘ + scroll, a pinch, the + and − keys or the buttons zoom it (from half size to eight times). center is the [longitude, latitude] it faces first ([10, 25] by default); with initialView=\"markers\" it faces the markers' middle and zooms until they fit. Markers on the far side leave the view and the pointer's reach but stay in the list: focusing one turns the globe to it, animated (at once under reduced motion).","code":"GeoMap zsherman viz geo-map label Database regions and the replication between them projection orthographic height center graticule animated markers connections"},
|
|
21
|
+
{"id":"geo-map.md#views-and-the-controller","kind":"section","title":"Views and the controller","page":"Geo map","doc":"geo-map.md","anchor":"views-and-the-controller","text":"A flat map pans and zooms with ui-sdk's viewport: drag to pan once zoomed in, Ctrl or ⌘ + scroll (or a pinch) to zoom at the pointer, the + and − keys and buttons to zoom at the middle, 0 to go back to the whole world's size. At the whole world's size the wheel scrolls the page; zoomed in, it pans. The map never pans past the world's edges, and zooms from 1 to 12 times. initialView=\"markers\" opens on every marker, as close as they fit (up to six times); it follows the markers until someone pans or zooms. The Show all button does the same at any time (the whole world when there are no markers). controller receives a GeoMapController once the map mounts, for your own buttons: interactive={false} fixes the view (no drag, wheel, keys or buttons; the markers still take focus and show their tooltips); controls={false} keeps the gestures and keys and drops the buttons.","code":"GeoMapController fit target markers world readonly zoomBy factor centerOn longitude latitude focus view GeoMapView Button zsherman kit button GeoMap viz geo-map map onClick sin nrt syd Asia Pacific fra Center Frankfurt Whole label Database regions connections links controller"},
|
|
22
|
+
{"id":"geo-map.md#selection-and-tooltips","kind":"section","title":"Selection and tooltips","page":"Geo map","doc":"geo-map.md","anchor":"selection-and-tooltips","text":"A click on a marker, or Enter or Space on the focused one, selects it and calls onMarkerSelect with the marker (with null when the selected one is chosen again). The selected marker has a ring in its color and aria-selected=\"true\". Pass selected (an id or null) to control the selection, or defaultSelected to start with one. The tooltip (the kit's Tooltip, a chunk of its own loaded when the browser is idle after the first map mounts, or at the first hover or focus) shows the marker under the pointer, or the focused one after a key press: its name, its description and its connection count. tooltip replaces that content; it gets the marker, with your data: Escape closes the tooltip; focus stays on the marker.","code":"GeoMap GeoMapMarker zsherman viz geo-map createSignal Site load picked setPicked label Servers markers servers selected onMarkerSelect name data Select server tooltip marker strong span"},
|
|
23
|
+
{"id":"geo-map.md#world-data","kind":"section","title":"World data","page":"Geo map","doc":"geo-map.md","anchor":"world-data","text":"Without worldData, the map draws the sea (and the graticule, and the markers) at once and loads the land after it mounts: Natural Earth's countries at 1:110m (world-atlas, about 100 KB of TopoJSON, 35 KB compressed), a chunk of its own that the first map on a page starts and every map shares. data-loading is on the root until it lands. To draw land on the server too, load it first and pass it in: loadWorld() returns the same countries as GeoJSON. worldData takes any GeoJSON FeatureCollection of polygons in [longitude, latitude] degrees (what topojson.feature returns): a finer map, one country's regions, or land without borders. Natural Earth is in the public domain; world-atlas and topojson-client are ISC.","code":"GeoMap loadWorld GeoMapWorld zsherman viz geo-map world label Regions markers regions worldData FeatureCollection features readonly GeoMapFeature Feature geometry GeoMapGeometry properties Record"},
|
|
24
|
+
{"id":"geo-map.md#keyboard-and-screen-readers","kind":"section","title":"Keyboard and screen readers","page":"Geo map","doc":"geo-map.md","anchor":"keyboard-and-screen-readers","text":"The map is a group named by label (\"Edge servers in Europe…, map\"). Its markers are one listbox (\"Locations\"), so Tab reaches the map once, on the selected marker or the first. Tab · Focuses the markers (the selected one, else the one focused last, else the first), then the zoom buttons Arrow keys · On a flat map, the nearest marker in that direction on screen; on a globe, the next or previous marker in the list (focusing one turns the globe to it) Home, End · On a globe, the first and last marker Enter, Space · Selects the focused marker (again: clears the selection) + / − · Zooms in or out around the middle (announced, \"Zoom 150%\") 0 · Back to the whole world's size (a flat map) or the fitted globe Escape · Closes the tooltip A focused marker off screen is brought into view (the map pans the least it needs to). Each marker's name says how many connections it has, and its description is its description; the SVG is hidden from assistive technology. Put the numbers that matter in text beside the map, too."},
|
|
25
|
+
{"id":"geo-map.md#gotchas","kind":"section","title":"Gotchas","page":"Geo map","doc":"geo-map.md","anchor":"gotchas","text":"Coordinates are degrees: latitude −90 to 90, longitude −180 to 180. A swapped pair lands in the wrong place without an error. Marker ids must be unique; connections and selected use them. The map takes its parent's width. Without height it's twice as wide as it is high; with it, set a height that suits the projection (a globe looks best about square). albers is a conic projection centered on the United States: use it for maps of North America. Overlapping markers (a dense map) are each still reachable by the keyboard, but a pointer reaches the top one: zoom in first."},
|
|
26
|
+
{"id":"geo-map.md#api-reference-zshermanvizgeo-map","kind":"section","title":"API reference: @zsherman/viz/geo-map","page":"Geo map","doc":"geo-map.md","anchor":"api-reference-zshermanvizgeo-map","text":""},
|
|
27
|
+
{"id":"api:geo-map/GeoMap","kind":"part","title":"GeoMap","page":"Geo map","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"GeoMap from @zsherman/viz/geo-map.","code":"animated arcStyle center connections controller controls defaultSelected graticule height highlighted initialView interactive label labels markers onConnectionSelect onMarkerSelect projection selected tooltip worldData"},
|
|
28
|
+
{"id":"api:geo-map/GeoMap.animated","kind":"prop","title":"animated","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Moves dashes along every connection, from source to target. Still under reduced motion. Type: boolean. Default: false."},
|
|
29
|
+
{"id":"api:geo-map/GeoMap.arcStyle","kind":"prop","title":"arcStyle","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"How connections are drawn. Type: \"greatCircle\" | \"quadratic\" | \"straight\". Default: \"greatCircle\"."},
|
|
30
|
+
{"id":"api:geo-map/GeoMap.center","kind":"prop","title":"center","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The place a globe faces first, [longitude, latitude]. Type: readonly [longitude: number, latitude: number]. Default: [10, 25]."},
|
|
31
|
+
{"id":"api:geo-map/GeoMap.connections","kind":"prop","title":"connections","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Lines between markers, by their ids. Ones naming a missing marker are left out. Type: readonly GeoMapConnection[]. Default: []."},
|
|
32
|
+
{"id":"api:geo-map/GeoMap.controller","kind":"prop","title":"controller","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Receives the map's controller once it mounts: fit, zoom and center from your own controls. Type: ((controller: GeoMapController) => void)."},
|
|
33
|
+
{"id":"api:geo-map/GeoMap.controls","kind":"prop","title":"controls","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Shows the zoom in, zoom out and Show all buttons (with interactive). Type: boolean. Default: true."},
|
|
34
|
+
{"id":"api:geo-map/GeoMap.defaultSelected","kind":"prop","title":"defaultSelected","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The marker selected at first, when the selection isn't controlled. Type: string | null. Default: null."},
|
|
35
|
+
{"id":"api:geo-map/GeoMap.graticule","kind":"prop","title":"graticule","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Draws lines of latitude and longitude every 10°. Type: boolean. Default: false."},
|
|
36
|
+
{"id":"api:geo-map/GeoMap.height","kind":"prop","title":"height","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The map's height (a number is pixels). Without it the map is twice as wide as it is high. Type: string | number."},
|
|
37
|
+
{"id":"api:geo-map/GeoMap.highlighted","kind":"prop","title":"highlighted","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"A marker whose connections stand out while the rest dim, to control the highlight (from a table row your app hovers, say). Without it the marker under the pointer or the keyboard focus is highlighted. Type: string | null."},
|
|
38
|
+
{"id":"api:geo-map/GeoMap.initialView","kind":"prop","title":"initialView","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"What the map shows first: the whole world, or every marker as close as they fit (it follows the markers until someone pans or zooms). Type: \"markers\" | \"world\". Default: \"world\"."},
|
|
39
|
+
{"id":"api:geo-map/GeoMap.interactive","kind":"prop","title":"interactive","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Pan and zoom (a flat map) or turn and zoom (a globe) with the pointer, the wheel and the keys. Type: boolean. Default: true."},
|
|
40
|
+
{"id":"api:geo-map/GeoMap.label","kind":"prop","title":"label","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The map's accessible name: what it shows (\"Servers and users, last hour\"). Type: string. Required."},
|
|
41
|
+
{"id":"api:geo-map/GeoMap.labels","kind":"prop","title":"labels","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Built-in words; also settable for every map through LocaleProvider's geoMap. Type: Partial<GeoMapLabels>."},
|
|
42
|
+
{"id":"api:geo-map/GeoMap.markers","kind":"prop","title":"markers","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The places to mark. Type: readonly GeoMapMarker<T>[]. Default: []."},
|
|
43
|
+
{"id":"api:geo-map/GeoMap.onConnectionSelect","kind":"prop","title":"onConnectionSelect","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Runs when a connection is clicked. Type: ((connection: GeoMapConnection) => void)."},
|
|
44
|
+
{"id":"api:geo-map/GeoMap.onMarkerSelect","kind":"prop","title":"onMarkerSelect","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"Runs when a marker is clicked, or chosen with Enter or Space, with the marker (null when it's chosen again, which clears the selection). Type: ((marker: GeoMapMarker<T> | null) => void)."},
|
|
45
|
+
{"id":"api:geo-map/GeoMap.projection","kind":"prop","title":"projection","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"A flat world or a globe (\"orthographic\"). Type: \"albers\" | \"equirectangular\" | \"mercator\" | \"naturalEarth\" | \"orthographic\". Default: \"naturalEarth\"."},
|
|
46
|
+
{"id":"api:geo-map/GeoMap.selected","kind":"prop","title":"selected","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The selected marker's id, to control the selection. null selects none. Type: string | null."},
|
|
47
|
+
{"id":"api:geo-map/GeoMap.tooltip","kind":"prop","title":"tooltip","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The tooltip's content for a marker. Defaults to its name, description and connection count. Type: ((marker: GeoMapMarker<T>) => Element)."},
|
|
48
|
+
{"id":"api:geo-map/GeoMap.worldData","kind":"prop","title":"worldData","page":"Geo map","parent":"GeoMap","doc":"geo-map.md","anchor":"geomap","entry":"@zsherman/viz/geo-map","text":"The land, as GeoJSON. Without it the map loads Natural Earth's countries (1:110m) on demand, after it mounts; pass await loadWorld() (or your own) to draw land on the server too. Type: GeoMapWorld."},
|
|
49
|
+
{"id":"api:flow/Flow","kind":"part","title":"Flow","page":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"Flow from @zsherman/viz/flow.","code":"background controls height label minimap readOnly"},
|
|
50
|
+
{"id":"api:flow/Flow.background","kind":"prop","title":"background","page":"Flow","parent":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"Draws a dot grid behind the graph. Type: boolean. Default: true."},
|
|
51
|
+
{"id":"api:flow/Flow.controls","kind":"prop","title":"controls","page":"Flow","parent":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"Shows the zoom and fit buttons. Type: boolean. Default: true."},
|
|
52
|
+
{"id":"api:flow/Flow.height","kind":"prop","title":"height","page":"Flow","parent":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"The flow's height (a number is pixels). Without it the flow is 16:9. Type: string | number."},
|
|
53
|
+
{"id":"api:flow/Flow.label","kind":"prop","title":"label","page":"Flow","parent":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"The flow's accessible name: what the graph shows (\"Nightly ETL: 2 of 6 steps failed\"). Type: string. Required."},
|
|
54
|
+
{"id":"api:flow/Flow.minimap","kind":"prop","title":"minimap","page":"Flow","parent":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"Shows a minimap in the bottom corner. Type: boolean. Default: false."},
|
|
55
|
+
{"id":"api:flow/Flow.readOnly","kind":"prop","title":"readOnly","page":"Flow","parent":"Flow","doc":"flow.md","anchor":"flow-1","entry":"@zsherman/viz/flow","text":"A view of the graph: pan, zoom and select only (no dragging, connecting or deleting), and the wheel scrolls the page (pinch or Ctrl/⌘ + wheel zooms). false makes it an editor; set the interaction props (nodesDraggable, nodesConnectable, …) yourself to mix. Type: boolean. Default: true."},
|
|
56
|
+
{"id":"api:flow/FlowBackground","kind":"part","title":"FlowBackground","page":"Flow","doc":"flow.md","anchor":"flowbackground","entry":"@zsherman/viz/flow","text":"FlowBackground from @zsherman/viz/flow."},
|
|
57
|
+
{"id":"api:flow/FlowControls","kind":"part","title":"FlowControls","page":"Flow","doc":"flow.md","anchor":"flowcontrols","entry":"@zsherman/viz/flow","text":"FlowControls from @zsherman/viz/flow."},
|
|
58
|
+
{"id":"api:flow/FlowEdge","kind":"part","title":"FlowEdge","page":"Flow","doc":"flow.md","anchor":"flowedge","entry":"@zsherman/viz/flow","text":"FlowEdge from @zsherman/viz/flow."},
|
|
59
|
+
{"id":"api:flow/FlowMiniMap","kind":"part","title":"FlowMiniMap","page":"Flow","doc":"flow.md","anchor":"flowminimap","entry":"@zsherman/viz/flow","text":"FlowMiniMap from @zsherman/viz/flow."},
|
|
60
|
+
{"id":"api:flow/FlowNode","kind":"part","title":"FlowNode","page":"Flow","doc":"flow.md","anchor":"flownode","entry":"@zsherman/viz/flow","text":"FlowNode from @zsherman/viz/flow."},
|
|
61
|
+
{"id":"api:flow/BaseEdge","kind":"part","title":"BaseEdge","page":"Flow","doc":"flow.md","anchor":"baseedge","entry":"@zsherman/viz/flow","text":"BaseEdge from @zsherman/viz/flow."},
|
|
62
|
+
{"id":"api:flow/Handle","kind":"part","title":"Handle","page":"Flow","doc":"flow.md","anchor":"handle","entry":"@zsherman/viz/flow","text":"Handle from @zsherman/viz/flow."},
|
|
63
|
+
{"id":"api:flow/Panel","kind":"part","title":"Panel","page":"Flow","doc":"flow.md","anchor":"panel","entry":"@zsherman/viz/flow","text":"Panel from @zsherman/viz/flow."}
|
|
64
|
+
]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zsherman/viz",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Maps and graphs for @zsherman/kit: a world map of markers and the connections between them (flat or a globe, with pan, zoom and keyboard) and flow graphs of steps with statuses and auto layout (on solid-flow), themed with the kit's --sui-* tokens.",
|
|
5
|
+
"license": "MPL-2.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"docs",
|
|
9
|
+
"README.md",
|
|
10
|
+
"THIRD_PARTY_NOTICES.md",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"CHANGELOG.md"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"*.css"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"solid": "./dist/solid/index.jsx",
|
|
22
|
+
"default": "./dist/dom/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./geo-map": {
|
|
25
|
+
"types": "./dist/types/geo-map/index.d.ts",
|
|
26
|
+
"solid": "./dist/solid/geo-map/index.jsx",
|
|
27
|
+
"default": "./dist/dom/geo-map/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./flow": {
|
|
30
|
+
"types": "./dist/types/flow/index.d.ts",
|
|
31
|
+
"solid": "./dist/solid/flow/index.jsx",
|
|
32
|
+
"default": "./dist/dom/flow/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./styles.css": "./dist/styles.css",
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rm -rf dist && vp pack && node ../../tooling/compose-package-css.ts . --chart-tokens --map-tokens dist/solid/assets/stylex.css dist/dom/assets/stylex.css && node ../../tooling/css-guard.ts dist/styles.css && tsrs -p tsconfig.build.json && node ../../tooling/dts-extensions.ts dist/types",
|
|
42
|
+
"typecheck": "tsrs -p tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@dagrejs/dagre": "^3.1.4",
|
|
46
|
+
"@dschz/solid-flow": "^1.0.1",
|
|
47
|
+
"@stylexjs/stylex": "0.19.2",
|
|
48
|
+
"@ui-sdk/core": "0.1.0-beta.18",
|
|
49
|
+
"d3-geo": "^3.1.1",
|
|
50
|
+
"topojson-client": "^3.1.0",
|
|
51
|
+
"world-atlas": "^2.0.2"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/d3-geo": "3.1.0",
|
|
55
|
+
"@types/topojson-client": "3.1.5",
|
|
56
|
+
"@zsherman/kit": "0.1.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@solidjs/web": "^2.0.3",
|
|
60
|
+
"@zsherman/kit": "^0.1.0",
|
|
61
|
+
"solid-js": "^2.0.3"
|
|
62
|
+
}
|
|
63
|
+
}
|