MapLibre map provider (useCommandMap) that follows the theme, draws status-ring clusters on demand and runs one hover-card system for every layer.
$ npx shadcn@latest add @highcommand/mapCopies the source into your project and pulls in what it needs (5 other items). First time? Add the registry to components.json.
High Command's map canvas on MapLibre.
labelrequiredstring—Accessible name of the map region.
providerBasemapProvider—Where the tiles come from. Default OpenFreeMap (free, keyless, worldwide).
operationalbooleantrueThe operational tone: curated place labels instead of the tiles' own, quiet roads at low zoom. Default true.
themeTheme—Force a theme; default follows <html data-theme>, else the OS.
glyphsUrlstring—Glyph server override (must serve `fonts`).
fontsBasemapFontsFONTSFont stacks the layers use; default matches the default glyph server.
centerLngLat[-96, 38]Opening camera.
zoomnumber3.4Opening zoom (default 3.4).
boundsLngLatBoundsLike—Opening view as a box, used instead of `center`/`zoom` on the first camera only (a theme switch keeps the camera it had).
minZoomnumber1.5Lowest zoom the person can reach (default 1.5); changing it rebuilds the map.
maxZoomnumber17Highest zoom the person can reach (default 17); changing it rebuilds the map.
controlsbooleantrueZoom buttons, top right. Default true.
cardsbooleantrueHover cards for the layers' objects. Default true.
onMap(map: MlMap) => void—Called with each new map (one per theme).
classNamestring—Extra classes on the map's root element (`hq-map`).
styleCSSProperties—Inline style on the map's root element; give it a height, the map fills it.
childrenReactNode—Layer components (they read the map from useCommandMap and draw once it is loaded) and any overlay.
<CardShell />6 propsThe one card, placed beside its object (right of it, or left where the right has no room) and kept inside the map.krequiredstring | null—What the card is about (an object key); a new value fades the new content in as the card glides, null fades the card out.
atrequired{ x: number; y: number } | null—The object's point on the map in CSS px, or null for no card.
Wrequirednumber—Width of the map in CSS px, to keep the card inside it.
Hrequirednumber—Height of the map in CSS px, to keep the card inside it.
childrenrequiredReactNode—The card's content (ShipCard, OwnCard and the like).
commitRef{ current: (() => void) | null }—Set by the shell: expand the card into the panel that is opening (a click committed to it).
<Head />4 propsThe card's head: status dot, identity, what kind of thing, and its state in words.colorrequiredStatusColor—Status colour of the dot and the state word.
idrequiredReactNode—The identity, in bold mono (a reference, a unit number).
kindReactNode—What kind of thing it is, after the identity.
statestring—Its state in words, at the right in the status colour.
<Od />2 propsOrigin to destination.arequiredstring—Origin.
brequiredstring—Destination.
<Figs />1 propsThree to five key figures: label, value, optional status colour.itemsrequired[string, ReactNode, StatusColor?][]—One `[label, value, status colour?]` per figure; the label also keys the row, so keep labels unique.
<Hint />1 propsWhat a click does.childrenrequiredReactNode—The hint text.
<ShipCard />15 propsThe hover card for a shipment (see ShipCardProps).referencerequiredstring—The shipment's reference, shown as the card's identity.
moderequiredstring—Its mode ("ftl", "air"...), shown upper-cased beside the reference.
colorrequiredStatusColor—Status colour of the dot and the state word.
originrequiredstring—Where it started, by name.
destinationrequiredstring—Where it is going, by name.
statestring—Its state in words (default the status colour's word).
accountstring | null—The customer account, in the meta line.
carrierstring | null—The carrier, in the meta line after the account.
etastring | null—ISO time.
confidencestring | null—"high", "medium" or "low" (any case); shown as High, Med or Low, other text as given.
progressnumber | null—0..1 of the way.
offRouteMnumber | null—Metres off its planned road (the dotted line is the way it has come).
reasonstring | null—Why it is off plan, in a line under the figures.
timeZonestring—IANA zone for the ETA.
touchboolean—True on touch screens: the hint reads "Tap again" instead of "Click".
<OwnCard />10 propsThe hover card for one of your own vehicles (see OwnCardProps).unitrequiredstring—The vehicle's unit number, shown as the card's identity.
kindrequiredstring—`cargo_van`, `box_truck` or `tractor` (shown as Van, Box truck, Tractor; other text as given).
colorrequiredStatusColor—Status colour of the dot and the state word.
routestring | null—Today's route code; null or omitted shows "No route today".
driverstring | null—The driver's name, after the route code.
stopsDonenumber0Stops finished (default 0).
stopsTotalnumber0Stops on the route (default 0; 0 shows a dash).
delayMinnumber | nullnullMinutes against plan (null: unknown or not on a route).
carriesnumber0How many shipments it carries (default 0).
touchboolean—True on touch screens: the hint reads "Tap again" instead of "Click".
<LaneCard />5 propsA lane: its two ends by name, modes, volume, how many late and at risk, carriers.lanerequiredPick<Lane, 'color' | 'modes' | 'n' | 'counts'>—The lane: its status colour, modes, shipment count and counts per status.
fromrequiredstring—Name of the lane's origin end.
torequiredstring—Name of the lane's destination end.
carriersnumber—How many carriers run it; omit to leave the figure out.
touchboolean—True on touch screens: the hint reads "Tap again" instead of "Click".
<ClusterCard />6 propsA cluster's members, worst first: about six, then how many more (a click zooms in to split them).nrequirednumber—How many things the cluster holds, the card's identity.
countsrequiredRecord<StatusColor, number> | null—Members per status for the split line; null leaves it out (the head colour then follows the first member).
membersrequiredClusterMember[] | null—The member rows, worst first; null while they load.
ownboolean—True for your own vehicles: the hint offers to list them instead of zooming in.
nounstring—What the cluster holds ("shipments here", "vehicles here").
touchboolean—True on touch screens: the hint reads "Tap again" instead of "Click".
<Split />2 propsA line of status counts, worst first, each with its dot and word; statuses with a zero count are left out.countsrequiredRecord<StatusColor, number>—How many per status.
labelsRecord<StatusColor, string>STATUS_LABELThe word for each status (default STATUS_LABEL).
<SiteCard />4 propsThe hover card for one of your sites (a DC): what is due in, waiting to leave, late and in exception.namerequiredstring—The site's name, the card's identity.
factsrequiredSiteFacts—Counts of what it has coming and going.
cityNamestring | null—The city it is in, under the head.
touchboolean—True on touch screens: the hint reads "Tap again" instead of "Click".
<MarkCard />3 propsThe hover card for a "needs attention" mark on the map.labelrequiredstring—What needs attention, in a line under the head.
colorrequiredStatusColor—Status colour of the head's dot.
touchboolean—True on touch screens: the hint reads "Tap again" instead of "Click".
<VehicleCard />13 propsThe hover card for a Fleet map vehicle (see VehicleCardProps).unitrequiredstring—The vehicle's unit number, shown as the card's identity.
kindrequiredstring—`cargo_van`, `box_truck` or `tractor` (shown as Van, Box truck, Tractor; other text as given).
colorrequiredStatusColor—Status colour of the dot and the state word.
staterequiredstring—Its state in words.
driverstring | null—The driver's name; null or omitted shows "No driver".
routestring | null—Today's route code, after the driver.
stopsDonenumber0Stops finished (default 0).
stopsTotalnumber0Stops on the route (default 0; the figure shows a dash with no route or no stops).
delayMinnumber | nullnullMinutes against plan (null: unknown).
speedKmhnumber | nullnullSpeed in km/h, rounded; null (the default) shows a dash.
atstring | null—ISO time of the last fix; the card shows its age against `now`.
trackerOfflineboolean—True adds "Tracker offline" to the card.
nowstring—"Now" (ISO) for the fix's age.
useCommandTheme(): ThemeHigh Command's theme: `data-theme` on <html>, else the OS setting; dark on the server (High Command is dark-first).
framePoints(map: Map$1, pts: readonly { lat: number; lng: number; }[], opts?: { padding?: number | { top: number; bottom: number; left: number; right: number; } | undefined; maxZoom?: number | undefined; animate?: boolean | undefi…Frame points the short way round the globe, easing in unless motion is reduced. A small screen cannot hold a global network: when the box would need a zoom under the map's minimum, it frames where most of it is (within 2,500 km of its middle) instead.
removeAll(map: Map$1, layers: string[], sources?: string[], images?: string[]): voidRemove layers, sources and images a layer component added (a theme switch or unmount may already have taken the map).
useLatest<T>(value: T): RefObject<T>The latest value, for map handlers and frame loops made once (updated after each render).
cssVar(n: string, fallback?: string): stringA colour token as the page has it now; before the stylesheet is in, the dark theme's value from tokens.ts, never a hex of its own.
rgba(hex: string, a: number): string`#rrggbb` as `rgba(r,g,b,a)` for MapLibre paint; anything that is not a 6-digit hex comes back unchanged.
slotId(s: "heat" | "contours" | "paths" | "lanes" | "route" | "places" | "sites" | "clusters" | "trails" | "own" | "markers" | "trace"): stringThe MapLibre layer id of a slot's marker (`hq-slot-<slot>`); a layer inserts its own layers just under it.
useCommandMap(): CommandMapContextThe map, whether it has loaded, the theme and its colours, and the hover system. Use inside <CommandMap>.
addAt(map: Map$1, slot: "heat" | "contours" | "paths" | "lanes" | "route" | "places" | "sites" | "clusters" | "trails" | "own" | "markers" | "trace", layer: AddLayerObject): Map$1Add a layer at its slot's depth (just under the slot's marker).
waterLayer(map: Map$1): string | undefinedThe basemap's first water layer: the land texture and the dot lens go under it, so only land shows them.
useLayerId(): stringA prefix for one layer component's MapLibre ids, so two of them on one map never collide.
glyphOfMode(mode: string, leg?: number | undefined, legs?: number | undefined): GlyphKeyThe glyph for a shipment's mode. Modes arrive as "ftl", "ocean+ltl", "Parcel", "Air" (any case); a multi-mode shipment shows the mode of the leg it is on (`leg`, when its path has one point per leg end), else its first, long-haul mode.
canvas(cssW: number, cssH?: number): { ctx: CanvasRenderingContext2D; done: () => Img; }A 2D canvas of cssW x cssH CSS px (cssH defaults to cssW) drawn at 2x; `done()` returns its pixels as an Img for map.addImage.
glyphPath(ctx: CanvasRenderingContext2D | Path2D, key: GlyphKey): voidAdds the outline of a carrier glyph (truck, parcel, ship, plane), centred on 0,0 and about 14 px across, to a canvas context or Path2D.
badgePath(ctx: CanvasRenderingContext2D | Path2D, shape: BadgeShape, x: number, y: number, r: number): voidThe status shape (as on every status dot: at risk triangle, late diamond, blocked square; on track has none, neutral is a hollow ring) centred on (x, y), with a panel-coloured outline so it reads on top of a ring or a glyph. Colour is never the only cue.
drawBadge(ctx: CanvasRenderingContext2D, shape: BadgeShape, x: number, y: number, r: number, color: string, panel: string): voidDraws the status shape at (x, y) with radius r in `color` and a `panel`-coloured outline; draws nothing for on_track.
drawChip(key: GlyphKey, ring: string, fill: string, status?: BadgeShape): ImgA round chip: panel-coloured disc, status-coloured ring, status-coloured glyph, and the status's shape as a badge at the top right (none for on track). A shipment that is not moving gets a dashed ring.
drawOwn(ring: string, fill: string, status?: BadgeShape): ImgOne of the tenant's own vehicles (Fleet): a rounded square with the truck glyph, calm (the panel colour, a quiet outline), so it reads apart from the round carrier chips; the status shape only when the vehicle's route needs attention. `kind` picks a van, a box truck or a tractor outline width; the shape is the same.
drawOwnStack(ring: string, fill: string, status?: BadgeShape): ImgSeveral of our own vehicles in one place (a depot): two stacked rounded squares, the count drawn over the front one by the map, in the same quiet outline as one vehicle; a status badge only when one of them needs attention. Never a ring: rings are shipment clusters.
drawSite(stroke: string, fill: string): ImgOur DC: a squared hub mark (never a status colour) — outer square, inner solid core.
drawPlace(kind: PlaceGlyph, stroke: string, fill: string): ImgReference-place marks, all neutral: a dot for a city, a diamond for a port, a small plane for an air-cargo hub.
drawRing(size: "s" | "m" | "l" | "x", parts: number[], colors: string[], fill: string, track: string, worst?: { shape: BadgeShape; color: string; } | undefined): ImgA cluster as a ring chart: the ring is split by status (exceptions first, clockwise from 12 o'clock), the centre carries the count (drawn by the symbol's text). `parts` are step counts out of RING_STEPS in STATUS order; any part > 0 gets at least one step.
drawChevron(kind?: "single" | "double" | "bar"): ImgA chevron pointing along +x, drawn white for SDF tinting: shows a lane's direction of travel without motion. `kind` makes the lane's status readable without its colour: at risk one chevron, late two, blocked a chevron against a bar.
drawMark(color: string, panel: string, status: BadgeShape): ImgA queue item on the map (the exception lens): its status shape alone (late diamond, at risk triangle, neutral hollow ring) in the status colour, ringed in the panel colour so it reads on any basemap. Never a chip: chips are shipments.
Install this free piece now; the Pro pieces drop in on top of it, in the same app. Pro is $79 once.