mirror of
https://github.com/maputnik/editor.git
synced 2026-12-04 15:54:24 +00:00
3e6e558d638d1c36c29e49406ca060e248349e57
23
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3e6e558d63 |
Commit a layer rename once on Enter or blur (#2396)
Fixes #1269. Renaming a layer ran the whole rename on every keystroke: `onLayerIdChange` updated the style, which was validated, saved to localStorage and pushed to the map for each intermediate ID. The layer editor's ID field now keeps the draft in the input and commits it on Enter or blur, which is how `InputString` already behaves for other string fields. `FieldId` gets a `commitOnBlur` prop for this; the Add Layer dialog doesn't pass it, so it still updates its draft ID as you type. The issue suggests debouncing. I went with commit on Enter/blur instead because a debounced rename would still apply half-typed IDs whenever typing pauses, and each of those is a real rename of the layer in the style. No visual change: the field looks the same, the new ID is just applied when you leave the field. **Performance:** I typed a 20-character ID into the layer ID field with Playwright (`keyboard.type`, then Tab), 5 runs each in Chromium on the dev server, counting style writes to localStorage: | | Style saves per rename | Time to type the 20 characters (median) | |---|---|---| | `main` | 20 | 2105 ms | | this PR | 1 | 92 ms | The timings are from my Windows laptop with an e2e run going in the background, so only the ratio matters. ## Launch Checklist - [x] Briefly describe the changes in this PR. - [x] Link to related issues: fixes #1269. - [x] Include before/after visuals or gifs if this PR includes visual changes: no visual change. - [x] Write tests for all new functionality: the `id` test in `layer-editor.spec.ts` now checks that the saved style still has the old ID after typing, before the field loses focus. That check 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 `npx playwright test e2e/layer-editor.spec.ts` (52 passed). The updated `id` test fails when I run it against `main`. 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 test and this description. I've reviewed and tested the change and can answer questions about it. |
||
|
|
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 | |---|---| |  |  | 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. |
||
|
|
e1a1af0226 |
Label each variable anchor and offset for screen readers (#2395)
Follow-up to #2393. In each `text-variable-anchor-offset` row, the anchor dropdown and both offset fields shared the property name as their accessible label, so a screen reader announced the same name for every control in every row. Each control's label now adds its row and what it edits to the property label, for example "… row 2 X offset". The labels go through `t()` like the other strings in the component. I didn't add them to `src/locales/*`; they fall back to English until translated. There's no visual change; only the `aria-label` attributes differ. **Performance:** none. Only the label strings change. ## Launch Checklist - [x] Briefly describe the changes in this PR. - [x] Link to related issues: follow-up to #2393. - [x] Include before/after visuals or gifs if this PR includes visual changes: no visual change. - [x] Write tests for all new functionality: an e2e test in `layers-list.spec.ts` that adds a second row and checks the anchor, X offset and Y offset labels. 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 `npx playwright test e2e/layers-list.spec.ts` (48 passed). The new test fails when I run it against `main`. 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 test and this description. I've reviewed and tested the change and can answer questions about it. |
||
|
|
bb1cd631a2 |
Open icon-padding expressions in the expression editor (#2394)
Follow-up to #2391. The earlier change added a numeric list for one to four values. `FieldFunction` still sends every `padding` value to that list, including expressions made by **Convert to expression**. Recognize expression arrays before sending padding values to the number inputs. Numeric arrays and legacy scalar values still use the regular padding editor. Added a Playwright regression check that converts a saved padding value to a literal expression and verifies that the expression editor opens. The existing numeric padding tests also pass. |
||
|
|
c9f44b0cd6 |
Edit text-variable-anchor-offset as a list of anchors with offsets (#2393)
`text-variable-anchor-offset` is the only layer property whose spec type, `variableAnchorOffsetCollection`, had no input. `InputSpec` fell through to its `default` case, so the layer editor showed the label with nothing next to it, even when the layer had a value. It also logged `No proper field input for text-variable-anchor-offset` on every render (mentioned in #1524). HarelM suggested looking for spec properties that maputnik doesn't support yet in #2391, and this is the one I found for layers. The value is a flat list of anchors, each followed by its `[x, y]` offset, e.g. `["top", [0, 4], "left", [3, 0]]`. The new `InputVariableAnchorOffsetCollection` shows one row per anchor: an anchor dropdown (the same nine values as `text-variable-anchor`), then the x and y offsets. It reuses the add/remove row layout and the delete button from `InputDynamicArray`. "Add value" appends `center` with `[0, 0]`, and removing the last row unsets the property. `FieldFunction` used to route every value of this type to the plain input, including expressions. It now does that only for a literal list (`isVariableAnchorOffsetCollection` in `spec-helper.ts`). An expression, including the `["literal", ...]` that "Convert to expression" produces, opens the expression editor as it does for other properties. | Before | After | |---|---| |  |  | Both show a symbol layer with `"text-variable-anchor-offset": ["top", [0, 1], "left", [2, 0]]` in Chromium. **Performance:** none. The input only renders for this one property, and the type check is a single pass over a short array. ## Launch Checklist - [x] Briefly describe the changes in this PR. - [x] Link to related issues: #1524 (the console warning), follow-up to #2391. - [x] Include before/after visuals or gifs if this PR includes visual changes. - [x] Write tests for all new functionality: three e2e tests in `layers-list.spec.ts` (save an anchor with its offset, change the anchor, remove a row) and a unit test for `isVariableAnchorOffsetCollection`. All three e2e tests fail on `main`, and the anchor and remove tests fail when I change the expected anchor or skip the delete. - [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` (213 passed). I also checked it in the dev server: editing an offset, changing an anchor, adding and removing rows all save to the style, and a layer whose value is a `case` expression opens in the expression editor. 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. |
||
|
|
b8020ceae3 |
Edit icon-padding as a list of one to four numbers (#2391)
Fixes #950. `icon-padding` is the only property with the `padding` type, which takes one to four numbers. The editor rendered it as a fixed four-box `InputArray`, so: - an unset or single-value padding showed one number and three empty boxes, which is the "extra empty fields" from the last comment on the issue; - `InputArray` only calls `onChange` once every box is filled, so typing one, two or three values never reached the style. Now `padding` shares the `numberArray` case and uses `InputDynamicArray`, the same add/remove list as `hillshade-illumination-direction`. `InputDynamicArray` gets an optional `maxLength`, which hides "Add value" once there are four padding values. Nothing else passes `maxLength`, so the other array fields don't change. An unset `icon-padding` now shows one empty box, like other unset number arrays, instead of the default `2` as a placeholder. | Before | After | |---|---| |  |  | Both screenshots show the `icon-padding` field of a new symbol layer in Chromium. **Performance:** none. It's the component other array properties already use, and only `icon-padding` renders it here. ## 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: two e2e tests in `layers-list.spec.ts`. "should save a single icon-padding value" fails on `main`, and fails when I change the expected `[5]` to `[7]`. "should not offer a fifth icon-padding value" fails without the `maxLength` cap. - [x] Add an entry to `CHANGELOG.md` under the `## main` section. Tested locally: `npm run lint` clean, `npx tsc --noEmit` clean, `npx vitest run` (55 passed), `npx playwright test e2e/layers-list.spec.ts` (44 passed), and the full `npx playwright test` before adding the cap (everything passes; with 4 workers 19 tests in the modal, history and accessibility specs timed out on my machine, and all 19 pass when rerun with `--workers=1`). Assisted-By: Claude Opus 5.5 (Claude Code). It helped write the fix, the tests and this description. I've reviewed and tested the change and can answer questions about it. |
||
|
|
648831ac67 |
fix: improve previews for small sprites (#2370)
# fix: improve previews for small sprites ## Description Small sprites appeared at their original display size in the sprite picker, making them difficult to recognize when choosing an icon or pattern. - Render previews in a fixed 36 × 36 CSS pixel canvas. Scale and center each sprite while preserving its aspect ratio. - Prefer matching `@2x.json` metadata and `@2x.png` atlas for previews. Use the base atlas when `@2x` metadata is unavailable. - Size the canvas backing store for the display's device pixel ratio. Preserve query strings and fragments when building sprite URLs. Follow-up to [#2364](https://github.com/maplibre/maputnik/pull/2364), which extended sprite previews to all sprite-backed fields as part of [#1294](https://github.com/maplibre/maputnik/issues/1294). ## Visuals ### Before Small sprites appear at their original display size in the picker.  ### After The same sprites are scaled to fit the fixed-size preview using the `@2x` atlas.  ## Verification All checks for this change passed. - Playwright covers the `@2x` atlas, the centered 36 × 36 preview for a small rectangular sprite, the 72 × 72 canvas at device pixel ratio 2, and the base atlas fallback. Existing coverage exercises SDF, sprite selection, image failures, and catalog updates. - `npm run lint` - `npm run lint-css` - `npm run build` - `npm run test-unit -- --run` (55 passed) - `npm run test -- e2e/sprite-picker.spec.ts --workers=2` (21 passed) - Confirmed that deliberately changing the expected CSS width, backing canvas width, and fallback pixel color fails the corresponding tests. Restored the correct assertions. ## 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. Co-authored-by: FantasticSPM <asd507172@gmail.com> |
||
|
|
1a2c3363ce |
fix: preview sprites for all sprite-backed properties (#2364)
## Description The sprite picker added in #2359 only replaced the input for `icon-image`. Maputnik already treats `background-pattern`, `fill-pattern`, `line-pattern`, `fill-extrusion-pattern`, and `icon-image` as sprite-backed properties through the shared `iconProperties` list. The other four properties still rendered the text-only autocomplete, so their dropdowns could not preview the sprite atlas even though they use the same sprite catalog in the style spec. This change routes every property in `iconProperties` through `InputSprite`. Non-sprite string fields continue to use `InputString`, and free-form values, search, keyboard selection, and expression editing keep the behavior introduced in #2359. Having one special case for `icon-image` and another branch for the remaining sprite properties was redundant and left the UI inconsistent. This is a follow-up to #2359 and completes the sprite-preview behavior related to #1294 for all sprite-backed style properties. ## Visuals No new visual treatment is introduced. Before this change, the four pattern fields displayed the text-only autocomplete; after this change they display the same thumbnail/search/keyboard picker already shown for `icon-image` in #2359. ## Verification - Added Playwright coverage for `background-pattern`, `fill-pattern`, `line-pattern`, and `fill-extrusion-pattern`. Each case opens the picker, verifies rendered atlas thumbnails, selects a sprite, and asserts the persisted style value. - `npm run lint` - `npm run build` - `npm run test-unit -- --run` (55 tests passed) - `npm run test -- e2e/sprite-picker.spec.ts --workers=1` (19 tests passed) - Confirmed the new assertion fails when the expected option count is deliberately mutated, then restored the assertion. - Local `.npmrc` changes were not included in the commit. ## 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. Co-authored-by: FantasticSPM <asd507172@gmail.com> |
||
|
|
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) |
||
|
|
54f0ba140a |
feat: preview sprites in the icon-image picker (#2359)
## Description Add a dedicated sprite autocomplete for literal `icon-image` values. Each searchable option shows its thumbnail and name, and selection keeps the original sprite ID in the style. Keyboard selection and free-form text remain available; expressions continue to use the existing expression editor. Pattern fields keep their existing inputs. The preview uses atlas bounds and pixel ratios. SDF sprites are decoded into neutral black silhouettes using MapLibre's distance-field contour, rather than displaying the distance bitmap. This is a catalog preview, not a rendering of the layer's data/zoom-dependent paint or halos. Sprite arrays retain MapLibre namespaces, and URL query parameters remain after the JSON/PNG extension. Metadata responses from a previous style are ignored after the sprite source changes. Missing atlas images leave the names usable. The menu opens above the field when there is not enough space below it. Fixes #1294. Implements the scope proposed in the issue and welcomed by CommanderStorm; follows #1792's request for a separate sprite input with images in the option rows. No new dependencies or changes to the generic `InputAutocomplete` component. ## Visuals | Before | After | | --- | --- | |  |  | SDF preview beside the actual MapLibre render of the selected fixture:  [Isolated screenshots and provenance](https://github.com/jjohnnystwsss/maputnik/tree/d368f3509fbb7c308ecdce6c97701af982bff14c) (not part of the feature diff). ## Verification - Five new pure-logic tests cover URL handling, metadata namespaces/bounds, empty sources and SDF alpha conversion; all 55 unit tests pass. - Fifteen new driver-based browser cases cover actual option pixels, search, mouse/keyboard selection, viewport placement, persisted style values, expression editing, sprite replacement/removal, namespaces, broken images and delayed old responses. - On the untouched base, the thumbnail assertion fails while all four text options are present. - Deliberately changing the expected thumbnail color fails; disabling the stale-response guard also fails. Both mutations were reverted. - Full official `npm test -- --workers 2`: all 199 cases pass (184 existing + 15 new). Lint, SCSS lint and type-checked production build: passed. Small sprite fixtures were authored for this change and carry the repository's MIT license. No external tile, sprite or paid service is required by the new cases. Codex assisted with the design, implementation and tests; the preview and actual map output were inspected locally. ## 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. Co-authored-by: Codex <noreply@openai.com> |
||
|
|
2ff1a62d19 |
Show boolean properties that default to true as checked (#2298)
Fixes #747 Boolean properties that default to `true` (`fill-antialias`, `text-keep-upright`, `fill-extrusion-vertical-gradient`) showed an empty checkbox when unset, so the first click wrote `true` and nothing changed on the map. `InputCheckbox` now falls back to the spec default that `InputSpec` already passes (as `InputEnum` does), and a click toggles from what is shown. The Cluster checkbox in the sources modal passes no default, so it behaves as before. ## 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 two e2e tests on `fill-antialias` (checked when unset, one click writes `false`). ## Screenshots "Extrusion vertical gradient" on a `fill-extrusion` layer with the property unset, before and after: | Before | After | | --- | --- | |  |  | |  |  | ## Video The video shows the same row on a small extrusion style, and one click turning the gradient off. https://github.com/user-attachments/assets/8ebc2f5a-923b-4022-82da-07cbd1eda783 Fix written with Claude Code; video is an automated browser run of this branch recorded by User Stories Bot. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
2384adf517 |
feat: make sidebar panels resizable (#2094)
- Replaces #1870, which replaced #1682, #1677 This mostly uses the code from there and addresses the comments I've left. I didn't change the code much. ## Launch Checklist Makes the sidebar panel resizable <img width="707" height="511" alt="image" src="https://github.com/user-attachments/assets/d010df38-faac-441c-bf7f-a4960e471c61" /> - [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: Bart Louwers <bart.louwers@gmail.com> |
||
|
|
a3e9c91ce0 |
chore: stabilize Playwright E2E runs (#2164)
#1351 made `styleStore` initialization asynchronous in `componentDidMount`. `setStyle` currently treats `toolbar:link` appearing as the signal that loading is complete, but if the style network request (`empty-style.json` from jsdelivr) takes over ~1s, the `toolbar:link` can appear while `styleStore` is still null (because the request has not finished). Subsequent `saveStyle` calls in tests then silently do nothing, causing test failures (3 in #2157, and often 20+ on my machine). Changes are: 1. Mock the default empty style to avoid slow network E2E failures. 2. Also cap Playwright workers at 4 to avoid overloading Chromium on high-core machines. Fixes #2158. ## Launch Checklist <!-- Thanks for the PR! Feel free to add or remove items from the checklist. --> - [x] Briefly describe the changes in this PR. - [x] Link to related issues. - [ ] ~~Include before/after visuals or gifs if this PR includes visual changes.~~ - [ ] ~~Write tests for all new functionality.~~ - [ ] ~~Add an entry to `CHANGELOG.md` under the `## main` section.~~ (only minor test infra fix) Co-authored-by: liuly <me@liuly.moe> Co-authored-by: Harel M <harel.mazor@gmail.com> |
||
|
|
95bf5f2c55 |
Fix keyboard shortcuts being ignored while the map has focus (#2157)
## Launch Checklist
- [x] Briefly describe the changes in this PR.
- [x] Link to related issues.
- [ ] Include before/after visuals or gifs if this PR includes visual
changes. — not applicable, nothing visual changes.
- [x] Write tests for all new functionality.
- [x] Add an entry to `CHANGELOG.md` under the `## main` section.
### What changed
Keyboard shortcuts went dead as soon as the map had focus.
The global `keyup` handler in `App.tsx` gated shortcuts on
`document.activeElement === document.body`. That reads like "the user is
not
typing", but it actually asks "is nothing focused at all". Clicking the
map makes
`.maplibregl-canvas` the active element, so every shortcut stopped
working until the
map was blurred.
The `m` shortcut demonstrates the problem nicely: its entire job is to
focus that
canvas, so pressing `m` silently disabled all shortcuts until `Esc`.
That path is
covered by an existing test (`'m' should focus map`), which is why the
regression
was easy to miss.
### How
`isTextEntryElement()` now answers the question the guard was reaching
for, so
shortcuts are suppressed only for text entry targets:
`input`, `textarea`, `select`, and `contenteditable` — the last one
covering the
CodeMirror editor, which is a `contenteditable` `.cm-content`.
The check stays independent of either renderer's DOM. MapLibre's
`.maplibregl-canvas` and the OpenLayers viewport live in different
structures, so an
allow-list of canvas class names would have fixed one renderer and left
the other
broken.
### Behaviour change
Single-letter shortcuts now also fire while focus is on a button or a
panel, where
previously they did not. That is inherent to making the map case work —
the old
predicate simply excluded everything that was not `document.body`. Per
@HarelM, this
can be reverted if anyone complains.
### Tests
`e2e/keyboard.spec.ts` gains a `while the map has focus` block. Its
`beforeEach`
focuses the canvas through the `m` shortcut and asserts the canvas
really is focused,
then two independent tests check that `!` and `s` still open their
modals.
Verified the new tests fail without the fix:
```
Error: expect(locator).toBeVisible() failed
Locator: locator('[data-wd-key="modal:debug"]').first()
Expected: visible
Error: element(s) not found
```
and pass with it.
Local results:
| Check | Result |
|---|---|
| `npm run lint` | clean |
| `npx vitest run` | 9 files, 50 tests passed |
| `npx vite build --mode=production` | clean |
| `npx playwright test` | 170 passed, 3 failed |
The 3 failures — `modals › open › upload via drag and drop`,
`modals › global state › remove variable` and `modals › global state ›
edit variable key`
— also fail on unmodified `main`, so they are pre-existing and unrelated
to this
change.
Fixes #940
|
||
|
|
80c0d08179 |
Fix zoom property crash after deleting a stop (#2153)
## Launch Checklist <!-- Thanks for the PR! Feel free to add or remove items from the checklist. --> When a fixed paint value is converted to a zoom function, Maputnik creates exactly two stops. <img width="362" height="226" alt="image" src="https://github.com/user-attachments/assets/209aebbf-7bb3-4422-b0c7-1019e20a9ddb" /> Deleting either one of those two stops leaves a single remaining value. During the transition back to the ordinary field editor, `ZoomProperty` can render with `stops` undefined. It previously called `.map` unconditionally, causing the editor to crash. <img width="2551" height="1248" alt="image" src="https://github.com/user-attachments/assets/f5c2af59-dcae-4ffe-8245-f175eea9c843" /> This PR guards the stop list with optional chaining. The change only protects the render path and does not alter zoom-function conversion or value persistence. Now, the remaining stop's value will be restored after deleting the other stop: <img width="367" height="168" alt="image" src="https://github.com/user-attachments/assets/8d13236b-6140-451b-8613-0bc5f11893de" /> The regression test covers `circle-opacity`: 1. Convert a fixed value to a zoom function. 2. Change the second stop's value. 3. Delete the first of the two stops. 4. Verify that the ordinary field editor reappears. 5. Verify that the remaining stop's value is restored. 6. Edit the restored field and verify that the style updates successfully. - [x] Briefly describe the changes in this PR. - [ ] 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. |
||
|
|
1301dc03e7 |
Fix layer group expansion state after deletion (#2146)
Deleting a layer changes the starting indices of later groups, so their stored expansion state no longer matches. Preserve that state through surviving layer IDs when rebuilding the group keys. This keeps expanded groups open after deleting an earlier layer or the first layer of a group. Separate groups with the same prefix retain their own states; if deletion joins two groups, the merged group stays expanded when either was expanded. - Fixes #1781. Adds five deletion regression tests, a small style fixture, and a changelog entry. Validation: - All 33 layer-list E2E tests and 50 unit tests pass. - Lint and the production build, including TypeScript checking, pass. - Manually checked OSM Liberty: all 15 groups remain expanded after deleting the background layer. - The full E2E suite reports 160 passing tests and one failure in `modals > open > upload` (`Could not get styleItem from localStorage`). The same failure reproduces with the original production code restored. --------- Co-authored-by: Harel M <harel.mazor@gmail.com> |
||
|
|
c0f76dfff8 |
fix(layer-list): title visibility button with the action it performs (#2135)
- Fixes #1675 ## Problem In the layer list, the show/hide button's `title` tooltip named the layer's current visibility instead of what a click does. A visible layer's button read `show` while clicking it hides the layer, and a hidden layer's button read `hide` while clicking it shows the layer — exactly reversed. `LayerListItem.tsx` derived a single value from the layer state: ```ts const visibilityAction = visibility === "visible" ? "show" : "hide"; ``` and passed it to `IconAction` as `action`, which `IconAction` used for three different things: choosing the icon, building the `--show`/`--hide` CSS modifier, and rendering `title={this.props.action}`. The first two are correct as a state indicator; only the tooltip needs the opposite verb. ## Change - `IconAction` gets an optional `title` prop and falls back to `action` when it is not given, so the delete and duplicate buttons are unchanged. - `LayerListItem` keeps `visibilityAction` (icon + `maputnik-layer-list-icon-action__visibility--hide` CSS modifier, which `_layer.scss` relies on to keep the button visible for hidden layers) and adds `visibilityTitle` for the inverted tooltip. No icon, class name or click behaviour changes. ## Test New regression test in `e2e/layers-list.spec.ts`: it asserts the button is titled `hide` while the layer is visible, clicks it, and asserts it is titled `show` once the layer is hidden. Against the unpatched component the first assertion fails with `Expected: "hide"` / `Received: "show"`, reproducing the reported behaviour. `npm run lint`, `npx tsc --noEmit`, `npx vitest run` (50 tests) and `npx playwright test e2e/layers-list.spec.ts` (28 tests) all pass. ## Note The tooltips in this component (`delete`, `duplicate`, `show`, `hide`) are plain English literals and are not run through `t()` today, so this change keeps them as-is rather than introducing translation keys for one button. Also worth flagging separately: these buttons carry `aria-hidden="true"`, so the `title` never reaches assistive technology at all — out of scope here, but it means the label is a mouse-hover tooltip only. |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |