Commit Graph
9 Commits
Author SHA1 Message Date
SHAIK KHADEER BASHA 26a909ced7 Set min and max zoom for PMTiles sources (#2402)
Fixes #1028.

The PMTiles source editor only had a URL field, so there was no way to
set `minzoom` or `maxzoom` on a PMTiles source from Maputnik. That
matters when the file's header says one thing and you want another, for
example to overzoom past the last zoom level in the file. It now has Min
Zoom and Max Zoom fields, the same ones the tile URL editor uses.
MapLibre already lets a key in the source override the value it reads
from the PMTiles TileJSON (`load_tilejson.ts` uses `fromOptions.maxzoom
?? fromTileJSON.maxzoom`).

Unlike the tile URL editor, the fields stay empty until you set them,
rather than showing 0 and 22. That way a source you don't touch keeps
the zoom range from the PMTiles header.

**Before / after** (Data Sources → Add New Source → Vector (PMTiles)):

| Before | After |
|---|---|
| <img
src="https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-1028/before-pmtiles-source.png"
width="400"> | <img
src="https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-1028/after-pmtiles-source.png"
width="400"> |

**Performance:** no impact. This adds two inputs to the source modal;
nothing runs on the map's render path.

## Launch Checklist

 - [x] Briefly describe the changes in this PR.
 - [x] Link to related issues: fixes #1028.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
- [x] Write tests for all new functionality: `add new pmtiles source
with a max zoom` in `modals.spec.ts`. It fails on `main`.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

Tested locally: `npm run lint` clean, `npx tsc --noEmit` clean, `npx
vitest run` (57 passed) and the full `npx playwright test` suite (221
passed). The new test fails when I put back `main`'s
`ModalSourcesTypeEditor.tsx`.

Assisted-By: Claude Opus 5.5 (Claude Code). It helped write the change,
the test and this description. I've reviewed and tested the change and
can answer questions about it.
2026-12-04 18:22:55 +02:00
SHAIK KHADEER BASHA 1f90a7de65 Edit generated and promoted feature IDs in Data Sources (#2397)
Fixes #805.

The Data Sources editor had no way to set `generateId` or `promoteId`,
so these had to be added by hand in the style JSON. This adds a
`SourceFeatureIdFields` block under the existing fields for GeoJSON and
vector sources:

- GeoJSON (inline and URL): a **Generate feature IDs** checkbox and a
**Feature ID property** field. As the issue points out, the two are
mutually exclusive, so turning one on clears the other.
- Vector (TileJSON, tile URLs and PMTiles): a **Feature ID property**
field for a single property, and a **Feature ID properties by source
layer** JSON field for the per-layer form (`{"roads": "road_id"}`). An
object that doesn't map names to strings shows an error and isn't saved.

Edits keep the rest of the source configuration.

| Before | After |
|---|---|
|
![before](https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-2397/before.png)
|
![after](https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-2397/after.png)
|

Both show the Data Sources modal with an inline GeoJSON source and a
vector tile source, in Chromium.

**Open question:** the issue asked how the UI should look, and nobody
had decided yet. For vector sources I used two fields because
`promoteId` can be either a string or an object. Setting the single
property replaces a per-layer mapping, and the other way round. If you'd
prefer one field, for example a single JSON field, I can change that.

**Performance:** none. The fields only render inside the Data Sources
modal, for GeoJSON and vector sources.

## Launch Checklist

 - [x] Briefly describe the changes in this PR.
 - [x] Link to related issues: fixes #805.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
- [x] Write tests for all new functionality: three e2e tests in
`modals.spec.ts` (generate IDs for a new GeoJSON source, set a vector
source's ID property, save a per-layer mapping). I ran the GeoJSON one
against `main` and it fails; the other two look for fields that don't
exist on `main`.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

Tested locally: `npm run lint` clean, `npx tsc --noEmit` clean, `npx
vitest run` (57 passed) and `npx playwright test e2e/modals.spec.ts` (64
passed). I also checked that focusing and leaving the empty "Feature ID
property" field keeps an existing per-layer mapping. I didn't run the
full e2e suite locally (it times out on Windows with several workers);
it passes in CI on this PR.

Assisted-By: Claude Opus 5.5 (Claude Code). It helped write the change,
the tests and this description. I've reviewed and tested the change and
can answer questions about it.
2026-12-04 10:24:16 +02:00
zstadler 129111357c Save global state values as JSON instead of strings, if possible (#2363)
To keep numbers, booleans, arrays and objects working in styles, the
Global State dialog now shows each non-string value as JSON. It also
saves entered values as JSON instead of a string, if possible. Text that
isn't valid JSON (like "value" or "#ff0000" without the quotes) is still
saved as a string. String values that look like JSON will be shown and
can be entered with quotes, e.g. `"9"`.

Resolves #2362

Created with [Claude AI](https://claude.ai)
2026-11-24 23:25:26 +02:00
shkomg 3f3ca9a13b Fix debug modal options missing for the mbgljs renderer (#2293)
Fixes #1548

The Debug modal only listed the map options for `mlgljs`, so an `mbgljs`
style got an empty "Options". It now checks `renderer !== "ol"`, as
suggested in the issue, which is how `App.tsx` picks the map anyway.

## Launch Checklist

 - [x] Briefly describe the changes in this PR.
 - [x] Link to related issues.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
 - [x] Write tests for all new functionality.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

Added an e2e case with a small `mbgljs` fixture.

## Video

Debug modal for an `mbgljs` style on this branch:


https://github.com/user-attachments/assets/41a7bc71-85cf-44ae-a56e-91af7fbb3904

Fix written with Claude Code; video is an automated browser run of this
branch recorded by User Stories Bot.
2026-11-03 08:16:19 +02:00
Harel M 68c81fc7a3 feat: Add ability to control the max zoom of the map (#2201)
- Resolves #2202

## Launch Checklist

The map max zoom was increased to 24 without the ability to change it.
- https://github.com/maplibre/maputnik/issues/593

The default is 22 for all maplibre instances if you don't override it in
your code.
The zoom levels to over scale is dependent on max zoom, which can affect
how the map looks.
This PR adds the ability to change this.
This was added to the debug dialog:
<img width="446" height="446" alt="image"
src="https://github.com/user-attachments/assets/ea68c392-309f-4476-8922-790670762d56"
/>


 - [x] Briefly describe the changes in this PR.
 - [x] Link to related issues.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
 - [x] Write tests for all new functionality.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.
2026-10-05 15:49:55 +03:00
Harel M 560478410a Add font-faces, sky, roll and centerAltitude (#2189)
After: 
<img width="425" height="366" alt="image"
src="https://github.com/user-attachments/assets/f737de31-57e8-4445-b114-a5acdabb619c"
/>



## Launch Checklist

 - [x] Briefly describe the changes in this PR.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
 - [x] Write tests for all new functionality.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.
2026-09-27 20:05:23 +03:00
f14eeae38b Increase coverage (#1997)
## Launch Checklist

This PR increases coverage by adding unit tests to lib folde, replace
the skipped end to end placeholder with actual tests and adds more end
to end tests.

This was mostly done by AI (Claude opus 4.8) and I reviewed it and
requested changes where needed.

 - [x] Briefly describe the changes in this PR.
 - [x] Link to related issues.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
 - [x] Write tests for all new functionality.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-12 15:46:30 +03:00
2e0b7cdb8c Replace cypress with playwright (#1988)
## Launch Checklist

This PR replaces cypress with playwright.
<img width="1907" height="933" alt="image"
src="https://github.com/user-attachments/assets/b52075b3-eb3b-45dc-93dc-8c5e9cfd35dd"
/>

I hope this will make the end-to-end debugging and fixing easier due to
the async await support of playwright which is missing in cypress.

This is a pure refactoring change.

 - [x] Briefly describe the changes in this PR.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-10 18:18:48 +00:00
Harel MandClaude Opus 4.8 be9456d11b Relocate e2e tests (#1989)
## Launch Checklist

Renames the e2e test and reduces changes as a preparation step from
playwright in the following PR:
- #1988

This is to keep as much history as possible.
<img width="1907" height="933" alt="image"
src="https://github.com/user-attachments/assets/b52075b3-eb3b-45dc-93dc-8c5e9cfd35dd"
/>

 - [x] Briefly describe the changes in this PR.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 11:38:59 +03:00