Skip to content

feat(layout): add design tokens and Layout::Canvas - #194

Merged
roncodes merged 4 commits into
feature/map-canvasfrom
feat/canvas-layout
Nov 27, 2026
Merged

roncodes merged 4 commits into
feature/map-canvasfrom
feat/canvas-layout

Conversation

@roncodes

Copy link
Copy Markdown
Member

Adds design tokens and a new Layout::Canvas component: the groundwork for an optional layout where floating UI sits over a full-bleed backdrop, such as a live map or a dot grid. Nothing changes for existing layouts or components.

Supersedes #193, which is the same change on a different branch name.

Design tokens

addon/styles/tokens.css defines --fb-* CSS variables for light and dark themes. The theme follows the nearest data-theme attribute, and the light values are also set on :root.

Group Tokens
Surfaces and text surface, subtle, border, text, muted, accent, accent-fg, focus, chrome, chrome-border
Status info, warn, ok, critical, each with a -subtle background
Map map-land, map-water, map-road, map-route
Canvas canvas-bg, canvas-dot, canvas-grid (22px), canvas-dot-size
Shape radius-control, radius-card, radius-chrome, radius-dock, shadow-chrome, shadow-sheet
Content insets inset-left, inset-top, inset-bottom, inset-right

The tokens are available as Tailwind utilities: bg-surface, text-muted, border-border, bg-info-subtle, bg-map-land, rounded-chrome, shadow-chrome, pl-canvas-left, and so on. Because each utility resolves a variable, a single class works in both themes without a dark: variant.

Layout::Canvas

<Layout::Canvas @theme="dark">
  <:backdrop><MyMap /></:backdrop>
  <:default>{{outlet}}</:default>
  <:chrome><nav class="rounded-chrome bg-chrome shadow-chrome">…</nav></:chrome>
</Layout::Canvas>
  • Backdrop: fills the canvas. If no <:backdrop> block is passed, it renders <Layout::Canvas::Backdrop::DotGrid />.
  • Content: a <main> inset from the edges by the --fb-inset-* variables, so it clears the floating UI.
  • Chrome: the layer on top. The layer ignores pointer events and its direct children accept them, so the backdrop and content stay clickable around the floating UI. It renders only when a <:chrome> block is passed.
  • @theme (optional) scopes a theme to the canvas. Without it, the canvas follows the page theme.

Layout::Canvas::Backdrop::DotGrid is decorative (aria-hidden). Override its spacing with style="--fb-canvas-grid: 16px".

Test helpers

@fleetbase/ember-ui/test-support exports helpers for testing components rendered on the canvas:

import { setupShellTheme, eachShellTheme, renderShell, shellToken } from '@fleetbase/ember-ui/test-support';

setupShellTheme(hooks); // restores <body data-theme> after each test

eachShellTheme((theme) => {
  test(`renders in ${theme}`, async function (assert) {
    const canvas = await renderShell(hbs`<Layout::Canvas />`, { theme });
    assert.strictEqual(shellToken('canvas-bg', canvas), theme === 'dark' ? '#0b1220' : '#eef1f5');
  });
});

Also exported: SHELL_THEMES, setShellTheme and snapshotShellTheme.

Tests

  • Rendering tests for each Layout::Canvas block combination in both themes, covering layer order, pointer pass-through, inset geometry and inset overrides.
  • DotGrid rendering, sizing and colours.
  • Every token's value in light, dark and with no theme set.
  • The test-support helpers.
  • tests/node/tokens-tailwind-test.cjs checks that the Tailwind utilities compile to the token variables and that every referenced variable is defined (node --test tests/node).

All new files are at 100% statement, branch, function and line coverage.

Adds the groundwork for an opt-in canvas layout, where floating UI sits
over a full-bleed backdrop such as a map or a dot grid. Existing layout
components are unchanged.

- styles/tokens.css: --fb-* CSS variables for light and dark themes
  (surfaces, text, accent, status, map, canvas, radius, shadow and
  content insets), exposed as Tailwind utilities such as bg-surface,
  text-muted and rounded-chrome.
- Layout::Canvas: backdrop, content and chrome layers. The backdrop
  defaults to Layout::Canvas::Backdrop::DotGrid; the chrome layer passes
  pointer events through to the content except on its own children.
- @fleetbase/ember-ui/test-support: helpers for rendering in either
  theme and reading token values.
@roncodes
roncodes changed the base branch from main to feature/map-canvas November 27, 2026 04:17
ember-template-lint's no-inline-styles also covers templates in tests.
Chrome 158 serialises a computed `align-items: flex-start` as
`flow-start`, so the exact-match assertion fails on current Chrome
regardless of the stylesheet.
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feature/map-canvas@8afc2ed). Learn more about missing BASE report.

Additional details and impacted files
@@                  Coverage Diff                   @@
##             feature/map-canvas      #194   +/-   ##
======================================================
  Coverage                      ?   100.00%           
======================================================
  Files                         ?       338           
  Lines                         ?      9369           
  Branches                      ?         0           
======================================================
  Hits                          ?      9369           
  Misses                        ?         0           
  Partials                      ?         0           
Flag Coverage Δ
ember-ui 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@roncodes
roncodes merged commit 3fda6b7 into feature/map-canvas Nov 27, 2026
7 checks passed
@roncodes
roncodes deleted the feat/canvas-layout branch November 27, 2026 09:13
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