Repository navigation
feat(layout): add design tokens and Layout::Canvas - #194
Merged
Merged
Conversation
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.
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds design tokens and a new
Layout::Canvascomponent: 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.cssdefines--fb-*CSS variables for light and dark themes. The theme follows the nearestdata-themeattribute, and the light values are also set on:root.surface,subtle,border,text,muted,accent,accent-fg,focus,chrome,chrome-borderinfo,warn,ok,critical, each with a-subtlebackgroundmap-land,map-water,map-road,map-routecanvas-bg,canvas-dot,canvas-grid(22px),canvas-dot-sizeradius-control,radius-card,radius-chrome,radius-dock,shadow-chrome,shadow-sheetinset-left,inset-top,inset-bottom,inset-rightThe 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 adark:variant.Layout::Canvas<:backdrop>block is passed, it renders<Layout::Canvas::Backdrop::DotGrid />.<main>inset from the edges by the--fb-inset-*variables, so it clears the floating UI.<:chrome>block is passed.@theme(optional) scopes a theme to the canvas. Without it, the canvas follows the page theme.Layout::Canvas::Backdrop::DotGridis decorative (aria-hidden). Override its spacing withstyle="--fb-canvas-grid: 16px".Test helpers
@fleetbase/ember-ui/test-supportexports helpers for testing components rendered on the canvas:Also exported:
SHELL_THEMES,setShellThemeandsnapshotShellTheme.Tests
Layout::Canvasblock combination in both themes, covering layer order, pointer pass-through, inset geometry and inset overrides.DotGridrendering, sizing and colours.tests/node/tokens-tailwind-test.cjschecks 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.