← Back to Pull requests

feat(plugins): dock Layer Swipe in the side panel and follow the dark theme #2845

Open
unknown opened this pull request with 402 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 03, 2026 17:34 UTC
Author

Layer Swipe's settings used to float over the map as a MapLibre control with its own toolbar button and a position submenu. They now open in GeoLibre's dockable side panel, sharing the Style sidebar like Basemaps and GeoAgent. The slider and the clipped comparison map stay on the map.

How it docks

  • The control stays mounted on the map (via addMapControl) for the plugin's whole lifetime, and the dock only adopts its panel element while the dock shows it. Opening another docked panel (e.g. Basemaps) runs the swipe panel's render cleanup, and that must not stop the swipe, so the generic mountMapControlInPanel bridge (which ties the control to the panel) is not used here.

  • maplibre-gl-swipe builds its panel late when it has to fetch a basemap style first, so a MutationObserver on the map container catches it. Basemap rebuilds and project restores therefore land in the dock too, and the panel never flashes in its old floating spot.

  • Closing the dock deactivates the plugin, as with the other docked plugins. Collapsing it to the rail keeps the swipe running. The toolbar button is hidden and the position submenu is gone, since the dock owns placement.
  • Upstream: maplibre-gl-swipe 0.14.0

  • opengeos/maplibre-gl-swipe#35 builds the comparison pane as soon as the style is readable. Opening the dock resizes the map on activation, and while the new tiles loaded the control waited for a styledata event that might not come, which made the Mapbox swipe E2E flaky (6/6 on main, intermittent on this branch). With 0.14.0 the affected specs passed 21/21.

  • opengeos/maplibre-gl-swipe#36 adds a dark color scheme with a theme option and setTheme(). GeoLibre passes the in-app theme (not the system one) and updates it when the theme is toggled; in dark mode the --swipe- variables map onto the app's design tokens. The select proxy, its menu and the checkboxes are GeoLibre's own and get dark rules in swipe-style.ts.

  • The lockfile change is limited to maplibre-gl-swipe.
  • Tests

  • e2e/mapbox-swipe.spec.ts and e2e/plugin-deep-link.spec.ts updated for the docked panel and the plain Layer Swipe menu item (no Activate submenu); both pass 3× in a row.

  • Frontend suite passes.

  • Verified in the web app with Playwright: the panel docks with the slider and comparison map on the map; Basemaps displaces it without stopping the swipe and the rail reopens it; orientation changes work from the dock; a basemap change rebuilds the control and the new panel lands in the dock, both when the dock is showing it and when it is displaced; closing the dock removes the slider; the panel follows a live light/dark toggle even when the system scheme differs.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Layer Swipe settings now open in the right-side dock and remain available while switching basemaps.
    Swipe controls and menus now use the app’s dark theme.

    Updates
    Layer Swipe’s toolbar button is hidden while its docked panel is in use.
    * Map-control placement is no longer configurable through the swipe plugin.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 402 lines (+301 / -101) across 5 files Reviewer: github-actions[bot] Review duration: 13m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 402 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #2845"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.7% (MEDIUM) · Higher = larger blast radius
    44.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.8% · Safe to merge
    23.8%