Skip to content

feat(shell): backdrop host, Sheet and view switch (phase 3) - #197

Merged
roncodes merged 2 commits into
feature/map-canvasfrom
feat/shell-phase-3-backdrop-sheet
Nov 28, 2026
Merged

roncodes merged 2 commits into
feature/map-canvasfrom
feat/shell-phase-3-backdrop-sheet

Conversation

@roncodes

@roncodes roncodes commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Shell phase 3, the ember-ui side: the backdrop host, Sheet, the view switch, and the resource panel rendered as a sheet. It works alongside ember-core's backdrop service (built in parallel) and the fleetops live-map registration.

The classic layout is unchanged. Everything new happens only when the canvas layout is on.

API summary

Layout::Canvas::BackdropHost (now the default backdrop of Layout::Canvas)

  • Reads service:backdrop through an optional lookup. It uses active, mounted (falling back to [active]) and state.
  • Renders each mounted registration ({ name, component, routes, priority, keepAlive }) once, keyed by name, in .fb-canvas-backdrop-slot[data-backdrop].
  • Only the active slot is visible. The others are hidden with visibility: hidden, inert and aria-hidden; they are never removed with {{#if}}.
  • Shows the dot grid when no backdrop is active or there is no service.
  • A class or component name receives @registration, @isActive, @state and @backdrop (the service, for setInstance and onReady).
  • An engine ExtensionComponent, or its #extension-component: string, renders through LazyEngineComponent and receives the same values as @params.*.
  • The host never sets pointer-events on the backdrop layer or its slots.
  • Pointer events: while a backdrop is active, .fb-canvas-content stops taking the pointer and only its direct children take it, so the map stays draggable around the cards. A page wrapper that spans the whole content area should get the fb-canvas-passthrough class.

<Sheet>

<Sheet @title @side="right|left" @width="sm|md|lg|<px>|<css length>" @resizable @minWidth @maxWidth @onResize
       @onClose @showClose @onPark @onActivate @stackIndex @stackSize @closeOnEscape @autofocus @onOpen @label>
  <:header as |s|>…</:header>  <:body as |s|>…</:body> (or the default block)  <:footer as |s|>…</:footer>
</Sheet>
  • Widths: the presets are 360, 440 (default) and 640px. The sheet is fixed to the content insets on its side, inside the content layer, so the floating chrome stays above it.
  • Resizing: drag the handle with the pointer, or use the keyboard (arrows, Home, End) on its role="separator". Width is clamped between 320 and 960 by default.
  • Stacking (B3): each sheet's depth is size - 1 - index. Each sheet behind the top one is pushed in 28px and shows a spine button that calls @onActivate. Its content stays mounted but is inert. Sheets more than three deep are hidden.
  • Focus: focus moves into the sheet on open and returns to where it was on close. Tab and Shift+Tab wrap inside the top sheet. It does not pull back focus that moves outside, so power-select and basic-dropdown popups still work.
  • Escape: the page-wide sheetStack (utils/sheet-stack) closes only the top sheet. It is a module singleton rather than a service so that sheets rendered inside engines share the same stack. It listens on window in the bubble phase, and does nothing if the event was already handled or a modal is open (modals-manager is looked up optionally).

<Layout::ViewSwitch>

@views=[{ id, label, count?, route?, models?, query? }] (defaults to Map, Table and Board), @selected, @onChange(id, view), @primaryAction={ label, icon?, onClick | action | route } or an <:actions> block, and @label.

  • The views are a radio group: arrow keys, Home and End move the selection.
  • With routes and no @selected, the view matching the current route is selected.
  • The pill is absolutely positioned top-centre (--fb-view-switch-top, 12px by default). Place it in the canvas <:chrome> block.

Layout::Resource::Panel and ResourceContextPanel

  • In the canvas layout, the panel renders through Sheet. The resource header goes in the sheet header and keeps its own cancel button. onLoad, onOverlayReady and onOpen receive the sheet API.
  • @layout="canvas|classic" overrides the layout on both components.
  • In canvas, ResourceContextPanel:
    • stacks overlays as sheets, keyed by id, so they are not re-created;
    • brings an overlay to the front when its spine is clicked;
    • maps sizes to presets (xxs→sm, xs/sm/md→md, lg/xl/fullscreen→lg), with overlay.width taking precedence;
    • leaves Escape to the sheets and draws no click-away backdrop.

New services

  • shell: layout (classic or canvas), isCanvas, setLayout(). The console should call setLayout('canvas') when it picks the canvas branch, and Layout::Canvas marks the layout as canvas while it is mounted.
    • The state itself is the page-wide shellState. Components read it directly, without injecting a service, because engine owners don't have ember-ui's services. This means no ember-core export is needed.
    • In tests, call resetShellState() or setupShellState(hooks) from @fleetbase/ember-ui/test-support. The dummy app resets before every test.
  • resource-context-panel additions for the phase 4 taskbar: park(id?), unpark(id), isParked(id), a tracked parked list, the events overlay.parked and overlay.unparked (the service is now Evented), and enableParking(bool). An overlay can also opt in with parkable: true or onPark. The park button is hidden until parking is enabled, because nothing can show a parked panel before phase 4.

Tests

New tests cover every component and state, including:

  • a keep-alive backdrop that is hidden but not torn down when switching between active and none, with the same element and no re-construction;
  • clicks reaching the map through gaps in the content layer;
  • Sheet stacking, spines and inert content;
  • Escape closing only the top sheet;
  • Tab and Shift+Tab wrapping, and focus returning on close;
  • pointer and keyboard resizing;
  • the view switch keyboard and routes;
  • the panel and resource-context-panel in the canvas layout;
  • park and unpark.

ember-core's backdrop is stubbed as BackdropStub in tests/helpers/shell-stubs.js.

Local COVERAGE=true ember test: 6522 of 6525 pass. The 3 failures also fail on the base branch in this environment (filter/model name path, and resource-component / resourceComponentName driver/pill).

Every new or changed file reached 100% coverage except one branch in sheet-stack.js. I added a test for that branch after the run; CI's coverage gate is the confirmation.

Shell phase 3, ember-ui side.

- Layout::Canvas::BackdropHost renders every registration in ember-core's
  backdrop.mounted once (keyed by name), shows the active one and hides the
  rest with visibility + inert instead of tearing them down; the dot grid
  shows when nothing is active or there is no backdrop service. It is now
  Layout::Canvas's default backdrop. Over a live backdrop the content layer
  passes the pointer through in its gaps (fb-canvas-passthrough for full-size
  page wrappers).
- Sheet: floating record card, right or left, sm/md/lg (360/440/640) or any
  width, pointer and keyboard resizing, header/body/footer blocks, close and
  park. Stacked sheets show as spines (B3) with inert, still-mounted content.
  The new sheet-stack service gives Escape and Tab wrapping to the top sheet.
- Layout::ViewSwitch: the top-centre Map/Table/Board radio pill with counts,
  route-aware selection and a primary action or actions block.
- Layout::Resource::Panel renders through Sheet in the canvas layout and is
  unchanged in classic. The new shell service says which layout is on
  (setLayout(), or a mounted Layout::Canvas); @layout overrides it.
- ResourceContextPanel in canvas: stacks overlays as sheets keyed by id,
  spine click brings to front, sizes map to sheet presets, sheets own Escape,
  no click-away backdrop. Classic is unchanged.
- resource-context-panel service: park/unpark/isParked, parked list,
  overlay.parked/overlay.unparked events and enableParking() for the phase 4
  taskbar.
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5d1c151) to head (85951c3).
⚠️ Report is 1 commits behind head on feature/map-canvas.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           feature/map-canvas      #197    +/-   ##
=====================================================
  Coverage              100.00%   100.00%            
=====================================================
  Files                     350       356     +6     
  Lines                    9876     10142   +266     
=====================================================
+ Hits                     9876     10142   +266     
Flag Coverage Δ
ember-ui 100.00% <100.00%> (ø)

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

Files with missing lines Coverage Δ
addon/components/layout/canvas.js 100.00% <100.00%> (ø)
addon/components/layout/canvas/backdrop-host.js 100.00% <100.00%> (ø)
addon/components/layout/resource/panel.js 100.00% <100.00%> (ø)
addon/components/layout/view-switch.js 100.00% <100.00%> (ø)
addon/components/resource-context-panel.js 100.00% <100.00%> (ø)
addon/components/sheet.js 100.00% <100.00%> (ø)
addon/services/resource-context-panel.js 100.00% <100.00%> (ø)
addon/services/shell.js 100.00% <100.00%> (ø)
addon/utils/sheet-stack.js 100.00% <100.00%> (ø)
🚀 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.

…nents

Panels and sheets also render inside engines, whose owners have no ember-ui
services, so @service shell / @service sheetStack threw there. The layout
now lives in a page-wide shellState and the open sheets in a module-level
sheetStack (the sheet-stack service is removed); the shell service stays
for setLayout(). Sheet looks up modals-manager optionally.

BackdropHost renders an engine ExtensionComponent (or its
#extension-component string) through LazyEngineComponent with the backdrop
values as @params.

test-support gains resetShellState()/setupShellState(hooks); the dummy
test helper resets before every test.
@roncodes
roncodes merged commit c0ea9e3 into feature/map-canvas Nov 28, 2026
7 checks passed
@roncodes
roncodes deleted the feat/shell-phase-3-backdrop-sheet branch November 28, 2026 07:36
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