Skip to content

Restyle the Chart tool on the theme's design tokens - #321

Merged
sandesh-sp merged 1 commit into
developmentfrom
fix/chart-tool-styling
Aug 13, 2026
Merged

Restyle the Chart tool on the theme's design tokens#321
sandesh-sp merged 1 commit into
developmentfrom
fix/chart-tool-styling

Conversation

@sandesh-sp

Copy link
Copy Markdown
Collaborator

Moves the Chart plugin onto the global design tokens, following #318 for the AOI tool.

Tokens

The plugin carried its own layer in theme.css — every value a literal of its own choosing (a teal accent, 4px/6px radii, a Source Sans stack). None of it reached the design system, so the tool drifted from the rest of the app. That file is deleted; everything now reads --theme-* directly, the same way AOI, MapControl, and LayerManager do.

Old --chart-* Token Resolves to
bg #ffffff --theme-color-white #ffffff
bg-muted #f6f7f8 --theme-color-base-lightest #f6f6f6
fg #1b1b1b --theme-color-ink #17171b
fg-muted #565c65 --theme-color-base-dark #58585b
accent #137480 --theme-color-primary #1c67e3
border #dfe1e2 --theme-color-base-lighter #e3e3e3
radius-sm / radius-md 4px/6px --theme-radius-sm 2px
space-1space-5 --theme-spacing-053 4/8/12/16/24px

I compiled the horizon bundle to confirm what these resolve to rather than assuming, which is what settled the type steps. The old sheet's four sizes — 13/14/16/24px — have no one-for-one equivalent on the theme's scale, so they map to the hierarchy the panel actually has:

Role Token Resolves to
Stat labels, card subtitles, headline meta --theme-font-size-3xs 12px
Body copy, card titles, stat values --theme-font-size-2xs ~14px
Panel title --theme-font-size-sm ~16px
Headline mean --theme-font-size-lg ~22px (was 24px)

Two literals stay: the 16px title glyph and the 18px close glyph, both icon sizes rather than type steps.

Three changes beyond a straight swap

  • .chart-tool-host is removed. Nothing in the repo applies that class — I grepped for it and for any dynamically-suffixed -host. It claimed to position the panel at top: 70px; right: 16px; width: 372px with a shadow, so a reader would reasonably believe it did. The panel owns placement; .chart-tool spans what it is given.
  • .chart-tool__exit is removed for the same reason — no element in ChartComponent.tsx carries it.
  • A :focus-visible ring is added. Core's global *:focus { outline: none } strips the native one and the close button had no replacement. Matches the block AOI added.

The histogram

It is painted by script rather than by the stylesheet, so ChartComponent.tsx reads the same three tokens off the canvas via getComputedStyle, with fallbacks matching the sheet.

Verification

tsc --noEmit is clean. There are no tests under src/essence/Tools/Chart, so nothing exercises this beyond the type check — the panel is worth a look in a running instance before merging. Trigger it by drawing an area and running an analysis, since Chart mounts on plugin:fetch-stats:analysisReady.

The plugin carried its own token layer in theme.css — a teal accent, 4px
and 6px radii, its own Source Sans stack — none of which reached the
design system, so the panel drifted from the rest of the app. That file
is deleted; ChartComponent.css reads --theme-* directly, the same way
AOI, MapControl, and LayerManager do, with the horizon value as each
fallback.

The horizon bundle was compiled to confirm what the tokens resolve to
rather than assuming. That settled the type steps: the old sheet's four
sizes (13/14/16/24px) have no one-for-one equivalent on the theme's
scale, so labels and subtitles take 3xs, body copy and stat values 2xs,
the panel title sm, and the headline mean lg. Two literals stay, the
16px title glyph and the 18px close glyph, both icon sizes rather than
type steps.

.chart-tool-host and .chart-tool__exit are removed. Nothing applies
either class, and the host rule claimed to position the panel at a fixed
offset with a shadow of its own — the panel owns placement, and the tool
spans whatever it is given.

Core's global `*:focus { outline: none }` strips the native focus ring
and the close button had no replacement, so the plugin restores one.

The histogram is painted by script rather than by the stylesheet, so
ChartComponent.tsx reads the same three tokens off the canvas.
@sandesh-sp
sandesh-sp merged commit e18f01e into development Aug 13, 2026
4 checks 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.

2 participants