Skip to content

feat: map kit — map tokens and style, map pieces (tokens 0.2.0, ui 0.8.0) - #9

Merged
mindsers merged 3 commits into
mainfrom
feat/map-kit
Nov 12, 2026
Merged

mindsers merged 3 commits into
mainfrom
feat/map-kit

Conversation

@mindsers

Copy link
Copy Markdown
Contributor

The map kit for MapLibre: the map's colours and style in @unitae/tokens, the pieces drawn over a map in @unitae/ui. It replaces the Google look on every on-screen map with a quiet grey ground where only the app's pins wear colour.

@unitae/tokens 0.2.0

  • Eleven map tokens, light and dark: ground, building, road, road casing, landuse, park, water, rail, boundary, label, label halo. Available as --u-map-* and in hexColors.
  • @unitae/tokens/map-style (new entry point, optional peer @protomaps/basemaps):
    • mapStyle({ mode, tiles, glyphs, lang }) returns a MapLibre style for Protomaps vector tiles, every colour taken from a map token.
    • Left out: places, shields, one-way arrows and house numbers. The pins already carry the numbers the lists show.
    • Nothing draws an icon, so the style needs no sprite (the town dots below zoom 8 keep their label, lose their icon).
    • MAP_FONTS: labels use IBM Plex Sans Regular, Medium and Italic glyph stacks. Names written in Devanagari keep the Noto face Protomaps asks for.
    • MAP_ATTRIBUTION: the Protomaps and OpenStreetMap credits to show wherever the map is.
    • Light and dark change colours, never layers: rebuild the style when the theme changes.
  • Tests, in both modes:
    • labels reach 4.5:1 on their halo, which is the ground;
    • a pin (primary in a surface ring) reaches 3:1;
    • the style uses only map tokens;
    • no map fill is more than a hint of colour.

@unitae/ui 0.8.0

The pieces drawn over a map. They know nothing of the map engine: the app places them (as MapLibre markers or inside the map's frame) and wires their callbacks to the map.

Component What it is
MapPin A place, numbered like the list beside it; a button with hovered / selected states
MapDot An entrance's state in an editor: on, free, elsewhere, to add, to remove
MapCluster Places too close to tell apart: a disc with their count, a button that zooms in
MapControls Zoom and « Recentrer »; MapControlGroup / MapControlButton for more
MapCaption A line about the map, top left
MapCard A picked place's card: in the corner, full width below 1280 px, above the attribution; Escape closes it
MapAttribution The data credit, always visible, bottom right
MapStatus Loading or failed tiles, in the middle of the frame
  • Labels are props, as everywhere in the library.
  • Pins and controls reach 44 px on a touch screen (pointer-coarse:).
  • ui still accepts @unitae/tokens 0.1 as a peer (^0.1.0 || ^0.2.0).

Test plan

  • pnpm test:lint, pnpm test:typecheck, pnpm test (tokens 108, ui 47), pnpm build
  • Mutation checks: removing the « something inside handled the key » guard fails the MapCard Escape test; keeping the town icons fails the no-sprite test
  • Rendered in the app (the first consumer, the territory maps) before tagging

Releasing

  1. One-time: add the npm trusted publisher for @unitae/tokens (this repository, release.yml). The package has not been published through the workflow yet; without it the first run fails on publish.
  2. Tag tokens-v0.2.0 and ui-v0.8.0 once the pieces have been checked in the app.

Eleven map tokens, light and dark (--u-map-*, hexColors), and a new entry
point, @unitae/tokens/map-style: mapStyle() paints Protomaps vector tiles
with them for MapLibre. Only the app's pins wear colour: no places,
shields, one-way arrows or house numbers, and no icon, so no sprite.
Labels use the IBM Plex glyph stacks in MAP_FONTS; MAP_ATTRIBUTION holds
the credits to show. @protomaps/basemaps is an optional peer.

Tests check both modes: labels reach 4.5:1 on their halo, a pin reaches
3:1, the style uses only map tokens and no fill is more than a hint of
colour.
MapPin, MapDot, MapCluster, MapControls (with MapControlGroup and
MapControlButton), MapCaption, MapCard, MapAttribution and MapStatus:
the pieces drawn over a map, independent of the map engine. Pins and
controls reach 44 px on a touch screen; the card leaves the attribution
visible and closes on Escape.
@mindsers
mindsers merged commit 9c0a016 into main Nov 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant