feat: add first-party map package - #457
Merged
Merged
Conversation
Bundle ReportChanges will increase total bundle size by 196.03kB (4.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
bambamboole
force-pushed
the
agent/map-package
branch
from
August 14, 2026 07:48
d57c9c6 to
3423b7a
Compare
The Composer plugin entry is now a small source shell: the map component loads lazily from source and the OpenStreetMap renderer loads Leaflet through the self-contained dist artifact on first map render. Pages without a map no longer pay for Leaflet; the workbench app chunk drops from 1.16MB to 400KB with the renderer in its own 160KB lazy chunk. No-build apps keep using dist/plugin.js via the standalone key.
…llback The height maximum was policy without a need — full-bleed maps are now possible; the 160px minimum matching the CSS min-height stays. The 'openstreetmap' fallback in prepareMap was unreachable because mergeConfigFrom always supplies the key. Also merges the duplicated .leaflet-control rule blocks in map.css.
The standalone build redirects every @lattice-php/* import in a dist plugin to the runtime barrel, but useExtensionRegistry was never re-exported there — rendering the map through dist/plugin.js (no-build apps, stale-discovery dev servers) crashed with 'useExtensionRegistry is not a function'. A browser test now renders the artifact's own map component against the barrel so a missing re-export fails the suite.
Namespace JSON nests each PHP lang file under its basename, so client keys must be 'map.loading', not 'loading' — the bare keys missed on every lookup, rendered only the English defaults, and fired an i18next saveMissing POST per key, which queued up on the single-worker Testbench server and froze the workbench UI. The dist artifact is rebuilt with the prefixed keys.
The root vite config maintains its /css aliases by hand and had none for map, so '@lattice-php/map/css' fell through to the broader package alias and the import was silently dropped — Leaflet's structural CSS never loaded and tiles scattered across the page. Adds the alias, the workbench app.css import, and documents the css import for build-step consumers.
- Marker::icon() (BackedEnum|string via Wire::scalar) and Marker::color() (Color|ColorName|string via Color::from), rendered through an IconRenderer portal into the pin and the lt-tone class/vars, so custom icon renderers keep working in source, Composer, and dist builds. - Pins point down again: the teardrop needs rotate -45deg, not 45deg. - The view is set before markers are added — Leaflet only creates layer elements once the map has a view, so pin styling and the aria-label actually apply now. - Cmd/Ctrl+wheel (and trackpad pinch) zooms while plain scrolling keeps scrolling the page; scrollZoom() still enables the bare wheel. - coerceColor/toneProps join the runtime barrel for the dist build; the workbench demo grows to 600px with an iconed, colored Potsdam marker.
bambamboole
marked this pull request as ready for review
August 14, 2026 12:58
bambamboole
enabled auto-merge (squash)
August 14, 2026 12:58
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.
Summary
lattice-php/mappackage with an OpenStreetMap/Leaflet provider: server-driven markers, automatic or click-opened popups, and complete Lattice component schemas inside popup contentdist/plugin.jsviaphp artisan lattice:assetsVisual
Before: Lattice had no first-party map renderer or map demo.
After:
/components/mapin the Workbench renders Berlin and Potsdam markers on themed Leaflet tiles, opens the Berlin popup from the server configuration, and switches to the Potsdam server-provided schema when its marker is clicked.Validation
composer checkandnpm run checkgreen, CI 27/27Release prerequisite
lattice-php/mapsplit repository before this package is released