Compare commits

...

7 Commits

Author SHA1 Message Date
Harel M b8267508c4 Merge branch 'main' into sidebar-resize-panels 2026-09-09 18:04:52 +03:00
liuly 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.
2026-09-09 18:04:32 +03:00
dependabot[bot] 1f475cf715 chore(deps): Bump @maplibre/maplibre-gl-style-spec from 26.4.1 to 26.4.2 (#2154)
Bumps
[@maplibre/maplibre-gl-style-spec](https://github.com/maplibre/maplibre-style-spec)
from 26.4.1 to 26.4.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/maplibre/maplibre-style-spec/releases">@​maplibre/maplibre-gl-style-spec's
releases</a>.</em></p>
<blockquote>
<h2>v26.4.2</h2>
<h3> Features and improvements</h3>
<ul>
<li>Allow negative <code>fill-extrusion-base</code> and
<code>fill-extrusion-height</code> values, extruding below ground level
(e.g. underground floors) (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/pull/1794">#1794</a>)
(by <a
href="https://github.com/clement-igonet"><code>@​clement-igonet</code></a>)</li>
<li>Add SDK support tracking for SDF fill pattern colorization (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/pull/1854">#1854</a>)
(by <a
href="https://github.com/deniial00"><code>@​deniial00</code></a>)</li>
</ul>
<h3>🐞 Bug fixes</h3>
<ul>
<li>Validate <code>-transition</code> properties on <code>sky</code> the
same way <code>light</code> already does, so
<code>sky-color-transition</code> and similar keys no longer report as
unknown properties (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/pull/1867">#1867</a>)
(by <a
href="https://github.com/Yasser-Ameur"><code>@​Yasser-Ameur</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/maplibre/maplibre-style-spec/blob/main/CHANGELOG.md">@​maplibre/maplibre-gl-style-spec's
changelog</a>.</em></p>
<blockquote>
<h2>26.4.2</h2>
<h3> Features and improvements</h3>
<ul>
<li>Allow negative <code>fill-extrusion-base</code> and
<code>fill-extrusion-height</code> values, extruding below ground level
(e.g. underground floors) (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/pull/1794">#1794</a>)
(by <a
href="https://github.com/clement-igonet"><code>@​clement-igonet</code></a>)</li>
<li>Add SDK support tracking for SDF fill pattern colorization (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/pull/1854">#1854</a>)
(by <a
href="https://github.com/deniial00"><code>@​deniial00</code></a>)</li>
</ul>
<h3>🐞 Bug fixes</h3>
<ul>
<li>Validate <code>-transition</code> properties on <code>sky</code> the
same way <code>light</code> already does, so
<code>sky-color-transition</code> and similar keys no longer report as
unknown properties (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/pull/1867">#1867</a>)
(by <a
href="https://github.com/Yasser-Ameur"><code>@​Yasser-Ameur</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/4453d2f4a1e755bc1cbc351103d0cdd9fde72b08"><code>4453d2f</code></a>
Bump js version to 26.4.2 (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1868">#1868</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/79bc668ac44589b474584589b6c30c9d1d71a9ff"><code>79bc668</code></a>
Validate sky transition properties like light does (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1867">#1867</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/487a7ad67e216306ebbd4ffb4d762c7774dce3ad"><code>487a7ad</code></a>
build(deps-dev): bump oxfmt from 0.65.0 to 0.66.0 (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1862">#1862</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/e5589ff0619251a8824c7e57d7999453b742e8de"><code>e5589ff</code></a>
build(deps-dev): bump <code>@​types/node</code> from 26.4.0 to 26.4.1
(<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1863">#1863</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/139dea1e02a5521b421e7816b115b5fdd8065493"><code>139dea1</code></a>
build(deps-dev): bump rolldown from 1.2.6 to 1.2.7 (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1864">#1864</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/72778539dd53a4d69dcf4b4eee83b73124842de0"><code>7277853</code></a>
build(deps-dev): bump <code>@​typescript-eslint/eslint-plugin</code> (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1857">#1857</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/e7e13161d94b5094224b3dec388f2c7c2c83bc8e"><code>e7e1316</code></a>
build(deps-dev): bump globals from 17.11.0 to 17.12.0 (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1858">#1858</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/187f3c3633a9dd5b37148c1ca2686b438f8f7946"><code>187f3c3</code></a>
Document SDK support for SDF fill pattern colorization (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1854">#1854</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/d1b5935d9895e6a1b3f554812ba55c4673c3264c"><code>d1b5935</code></a>
ci: cancel superseded pull request runs (<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1853">#1853</a>)</li>
<li><a
href="https://github.com/maplibre/maplibre-style-spec/commit/3ae6da3d6592ca765b04ff693dc1e59d57765e46"><code>3ae6da3</code></a>
build(deps-dev): bump <code>@​humanfs/node</code> from 0.16.6 to 0.16.8
(<a
href="https://redirect.github.com/maplibre/maplibre-style-spec/issues/1852">#1852</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/maplibre/maplibre-style-spec/compare/v26.4.1...v26.4.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@maplibre/maplibre-gl-style-spec&package-manager=npm_and_yarn&previous-version=26.4.1&new-version=26.4.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-09 13:55:05 +00:00
Harel M 3c9cf15bf0 Merge branch 'main' into sidebar-resize-panels 2026-08-28 17:43:28 +03:00
HarelM 2b7a092ad3 Remove comment 2026-08-21 13:58:48 +03:00
HarelM 705233241f Fix double sidebars 2026-08-21 13:47:44 +03:00
HarelM 3c1c3b6a74 Adopted changes to have a sidebar that's dragable 2026-08-21 13:02:35 +03:00
19 changed files with 282 additions and 70 deletions
+3
View File
@@ -5,9 +5,12 @@
- Upgrade to MapLibre GL JS 6 and Vite 8, and update the remaining dependencies
- Serve the RTL text plugin from `@mapbox/mapbox-gl-rtl-text` instead of a pinned CDN URL, so its version is tracked in `package.json`
- Exported HTML now loads MapLibre GL JS as an ES module, since v6 no longer ships a UMD bundle
- The sidebar can now be resized, both as a whole and in the split between the layer list and the layer editor
- _...Add new stuff here..._
### 🐞 Bug fixes
- Prevent a crash when converting a function to an expression
- Prevent a crash when deleting either stop from a function with two stops
- Preserve expanded layer groups when deleting layers, including the first layer of a group
- The map's data listener now fires on tile loads again, so source and vector layer field autocompletion is populated
- The `maputnik` desktop binary now opens the default browser automatically on startup (opt out with `--no-browser`)
+16 -1
View File
@@ -289,6 +289,20 @@ describe("layer editor", () => {
});
});
test("should leave a plain editable value after deleting a stop", async () => {
await when.setFunctionStopValue("circle-radius", "Output value", 1, "0");
await when.deleteFunctionStop("circle-radius");
await then(get.elementByTestId("spec-field:circle-radius")).shouldBeVisible();
await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
layers: [{ id, paint: { "circle-radius": 0 } }],
});
await when.setValue("spec-field-input:circle-radius", "7");
await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
layers: [{ id, paint: { "circle-radius": 7 } }],
});
});
test("should set the base", async () => {
await when.setFunctionBase("circle-radius", "2");
await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
@@ -310,8 +324,9 @@ describe("layer editor", () => {
});
});
test("should convert to an expression", async () => {
test("should convert to an expression without crashing", async () => {
await when.makeExpression("circle-radius");
await then(get.element("[data-wd-key='spec-field-container:circle-radius'] .maputnik-expression-editor")).shouldBeVisible();
await then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
layers: [{ id, paint: { "circle-radius": ["interpolate", ["linear"], ["zoom"], 6, 5, 10, 5] } }],
});
+18
View File
@@ -122,6 +122,8 @@ export class Assertable<T> {
// Value assertions (auto-retrying for Query targets).
shouldEqual = (value: any) => this.assertValue((actual) => expect(actual).toBe(value));
shouldBeGreaterThan = (value: number) => this.assertValue((actual) => expect(actual).toBeGreaterThan(value));
shouldInclude = (value: any) =>
this.assertValue((actual) => {
if (typeof value === "object" && value !== null) {
@@ -349,6 +351,15 @@ export class PlaywrightHelper {
await this.page.mouse.up();
},
/** Presses at the centre of an element and drags it by the given offset. */
dragBy: async (testId: string, deltaX: number, deltaY = 0) => {
const { x, y } = await centerOf(this.testId(testId));
await this.page.mouse.move(x, y);
await this.page.mouse.down();
await this.page.mouse.move(x + deltaX, y + deltaY, { steps: 10 });
await this.page.mouse.up();
},
clickCenter: async (testId: string) => {
const { x, y } = await centerOf(this.testId(testId));
await this.page.mouse.move(x, y);
@@ -446,6 +457,13 @@ export class PlaywrightHelper {
inputValue: (testId: string) => new Query<string>(() => this.testId(testId).first().inputValue()),
elementWidth: (testId: string) =>
new Query<number>(async () => {
const box = await this.testId(testId).first().boundingBox();
if (!box) throw new Error(`Element "${testId}" has no bounding box`);
return box.width;
}),
elementsText: (testId: string) => new Query<string>(() => this.testId(testId).first().innerText()),
locationHash: () => new Query<string>(async () => new URL(this.page.url()).hash),
+27
View File
@@ -0,0 +1,27 @@
import { beforeEach, describe, test } from "./utils/fixtures";
import { MaputnikDriver } from "./maputnik-driver";
describe("sidebar resize", () => {
const { given, get, when, then } = new MaputnikDriver();
beforeEach(async () => {
await given.setupMockBackedResponses();
await when.setStyle("layer");
});
test("dragging the outer handle widens the sidebar", async () => {
const initialWidth = await get.elementWidth("sidebar-panel").get();
await when.dragBy("sidebar-resize-handle", 100);
await then(get.elementWidth("sidebar-panel")).shouldBeGreaterThan(initialWidth + 50);
});
test("dragging the inner handle widens the layer list", async () => {
const initialWidth = await get.elementWidth("layer-list-panel").get();
await when.dragBy("inner-resize-handle", 50);
await then(get.elementWidth("layer-list-panel")).shouldBeGreaterThan(initialWidth + 20);
});
});
+15 -4
View File
@@ -20,7 +20,7 @@
"@mapbox/mapbox-gl-rtl-text": "^0.4.0",
"@maplibre/maplibre-gl-geocoder": "^1.9.4",
"@maplibre/maplibre-gl-inspect": "^1.9.0",
"@maplibre/maplibre-gl-style-spec": "^26.4.1",
"@maplibre/maplibre-gl-style-spec": "^26.4.2",
"array-move": "^4.0.0",
"buffer": "^6.0.3",
"classnames": "^2.5.1",
@@ -58,6 +58,7 @@
"react-i18next": "^17.0.13",
"react-icons": "^5.7.0",
"react-markdown": "^10.1.0",
"react-resizable-panels": "^4.11.0",
"reconnecting-websocket": "^4.4.0",
"slugify": "^1.6.9",
"string-hash": "^1.1.3",
@@ -1700,9 +1701,9 @@
}
},
"node_modules/@maplibre/maplibre-gl-style-spec": {
"version": "26.4.1",
"resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-26.4.1.tgz",
"integrity": "sha512-I/qcIKVFHFSg1Meu/eqHrkSTjIez0gCsSaK56TNPutM3TkE61aSq6F1cZ4Kg4KiNs3cpViLtubDjfyRcQCdEJQ==",
"version": "26.4.2",
"resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-26.4.2.tgz",
"integrity": "sha512-6J0vZqMZvRAJKtdWJdDGHEh1YJ2ZHG08/GOur8gCArYhO8ZkM//OXqtI2AAEz4jc2G+Wq4MfcePg8qNK5TZ4Kg==",
"license": "ISC",
"dependencies": {
"@mapbox/jsonlint-lines-primitives": "^2.0.3",
@@ -10732,6 +10733,16 @@
"react": ">=18"
}
},
"node_modules/react-resizable-panels": {
"version": "4.11.0",
"resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-4.11.0.tgz",
"integrity": "sha512-LPk/AkFDGkg7SsbOyL93ojrE6E7lhrxxDwnYNjfmnSeI6BE7Sje6dB24PXgZk8DeugdeXNk1LO+ohRqIjhxiLw==",
"license": "MIT",
"peerDependencies": {
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
}
},
"node_modules/reactcss": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/reactcss/-/reactcss-1.2.3.tgz",
+2 -1
View File
@@ -38,7 +38,7 @@
"@mapbox/mapbox-gl-rtl-text": "^0.4.0",
"@maplibre/maplibre-gl-geocoder": "^1.9.4",
"@maplibre/maplibre-gl-inspect": "^1.9.0",
"@maplibre/maplibre-gl-style-spec": "^26.4.1",
"@maplibre/maplibre-gl-style-spec": "^26.4.2",
"array-move": "^4.0.0",
"buffer": "^6.0.3",
"classnames": "^2.5.1",
@@ -76,6 +76,7 @@
"react-i18next": "^17.0.13",
"react-icons": "^5.7.0",
"react-markdown": "^10.1.0",
"react-resizable-panels": "^4.11.0",
"reconnecting-websocket": "^4.4.0",
"slugify": "^1.6.9",
"string-hash": "^1.1.3",
+117 -38
View File
@@ -1,9 +1,23 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { Group, Panel, Separator, useDefaultLayout } from "react-resizable-panels";
import { ScrollContainer } from "./ScrollContainer";
import { type WithTranslation, withTranslation } from "react-i18next";
import { useTranslation } from "react-i18next";
import { IconContext } from "react-icons";
type AppLayoutInternalProps = {
// Keep these in sync with $layout-list-width/$layout-editor-width in _vars.scss
const DEFAULT_LIST_WIDTH = 200;
const DEFAULT_DRAWER_WIDTH = 370;
const DEFAULT_SIDEBAR_WIDTH = DEFAULT_LIST_WIDTH + DEFAULT_DRAWER_WIDTH;
const PANEL_STYLE: React.CSSProperties = { overflow: "hidden" };
const SIDEBAR_LAYOUT_ID = "maputnik:sidebar-layout";
const SIDEBAR_INNER_LAYOUT_ID = "maputnik:sidebar-inner-layout";
const SIDEBAR_PANEL_ID = "sidebar";
const MAP_PANEL_ID = "map";
const LIST_PANEL_ID = "list";
const DRAWER_PANEL_ID = "drawer";
type AppLayoutProps = {
toolbar: React.ReactElement
layerList: React.ReactElement
layerEditor?: React.ReactElement
@@ -11,43 +25,108 @@ type AppLayoutInternalProps = {
map: React.ReactElement
bottom?: React.ReactElement
modals?: React.ReactNode
} & WithTranslation;
};
class AppLayoutInternal extends React.Component<AppLayoutInternalProps> {
export const AppLayout: React.FC<AppLayoutProps> = (props) => {
const { t, i18n } = useTranslation();
render() {
document.body.dir = this.props.i18n.dir();
const sidebarLayout = useDefaultLayout({
id: SIDEBAR_LAYOUT_ID,
panelIds: [SIDEBAR_PANEL_ID, MAP_PANEL_ID],
});
const innerLayout = useDefaultLayout({
id: SIDEBAR_INNER_LAYOUT_ID,
panelIds: [LIST_PANEL_ID, DRAWER_PANEL_ID],
});
return <IconContext.Provider value={{size: "14px"}}>
<div className="maputnik-layout">
{this.props.toolbar}
<div className="maputnik-layout-main">
{this.props.codeEditor && <div className="maputnik-layout-code-editor">
<ScrollContainer>
{this.props.codeEditor}
// The bottom panel is position: fixed, so it can't be a flex sibling of the
// map panel; it follows the sidebar through this custom property instead.
const [sidebarWidth, setSidebarWidth] = useState(DEFAULT_SIDEBAR_WIDTH);
useEffect(() => {
document.body.dir = i18n.dir();
}, [i18n, i18n.language]);
return <IconContext.Provider value={{size: "14px"}}>
<div
className="maputnik-layout"
style={{"--sidebar-width": `${sidebarWidth}px`} as React.CSSProperties}
>
{props.toolbar}
<div className="maputnik-layout-main">
<Group
className="maputnik-layout-panels"
orientation="horizontal"
id={SIDEBAR_LAYOUT_ID}
defaultLayout={sidebarLayout.defaultLayout}
onLayoutChanged={sidebarLayout.onLayoutChanged}
>
<Panel
id={SIDEBAR_PANEL_ID}
data-wd-key="sidebar-panel"
className={props.codeEditor ? "maputnik-layout-code-editor" : "maputnik-layout-sidebar"}
style={PANEL_STYLE}
defaultSize={`${DEFAULT_SIDEBAR_WIDTH}px`}
minSize="280px"
onResize={({inPixels}) => setSidebarWidth(inPixels)}
>
{props.codeEditor && <ScrollContainer>
{props.codeEditor}
</ScrollContainer>
</div>
}
{!this.props.codeEditor && <>
<div className="maputnik-layout-list">
{this.props.layerList}
</div>
<div className="maputnik-layout-drawer">
<ScrollContainer>
{this.props.layerEditor}
</ScrollContainer>
</div>
</>}
{this.props.map}
</div>
{this.props.bottom && <div className="maputnik-layout-bottom">
{this.props.bottom}
</div>
}
{this.props.modals}
}
{!props.codeEditor && <Group
className="maputnik-layout-sidebar-panels"
orientation="horizontal"
id={SIDEBAR_INNER_LAYOUT_ID}
defaultLayout={innerLayout.defaultLayout}
onLayoutChanged={innerLayout.onLayoutChanged}
>
<Panel
id={LIST_PANEL_ID}
data-wd-key="layer-list-panel"
className="maputnik-layout-list"
style={PANEL_STYLE}
defaultSize={`${DEFAULT_LIST_WIDTH}px`}
minSize="100px"
>
{props.layerList}
</Panel>
<Separator
className="maputnik-layout-resize-handle"
data-wd-key="inner-resize-handle"
title={t("Drag to resize the layer list")}
aria-label={t("Drag to resize the layer list")}
/>
<Panel
id={DRAWER_PANEL_ID}
className="maputnik-layout-drawer"
style={PANEL_STYLE}
defaultSize={`${DEFAULT_DRAWER_WIDTH}px`}
minSize="150px"
>
<ScrollContainer>
{props.layerEditor}
</ScrollContainer>
</Panel>
</Group>
}
</Panel>
<Separator
className="maputnik-layout-resize-handle"
data-wd-key="sidebar-resize-handle"
title={t("Drag to resize the sidebar")}
aria-label={t("Drag to resize the sidebar")}
/>
<Panel id={MAP_PANEL_ID} className="maputnik-layout-map" style={PANEL_STYLE} minSize="200px">
{props.map}
</Panel>
</Group>
</div>
</IconContext.Provider>;
}
}
export const AppLayout = withTranslation()(AppLayoutInternal);
{props.bottom && <div className="maputnik-layout-bottom">
{props.bottom}
</div>
}
{props.modals}
</div>
</IconContext.Provider>;
};
+6 -12
View File
@@ -129,16 +129,10 @@ type FieldFunctionProps = {
* https://www.mapbox.com/mapbox-gl-style-spec/#types-function-zoom-property
*/
export const FieldFunction: React.FC<FieldFunctionProps> = (props) => {
const [dataType, setDataType] = React.useState(
getDataType(props.value, props.fieldSpec)
);
const [isEditing, setIsEditing] = React.useState(false);
React.useEffect(() => {
if (!isEditing) {
setDataType(getDataType(props.value, props.fieldSpec));
}
}, [props.value, props.fieldSpec, isEditing]);
// Keep the expression editor mounted while typing, but otherwise select the
// editor from the current value so a collapsed function never renders as stops.
const dataType = isEditing ? "expression" : getDataType(props.value, props.fieldSpec);
const getFieldFunctionType = (fieldSpec: any) => {
if (fieldSpec.expression.interpolated) {
@@ -173,7 +167,7 @@ export const FieldFunction: React.FC<FieldFunctionProps> = (props) => {
const deleteExpression = () => {
const { fieldSpec, fieldName } = props;
props.onChange(fieldName, fieldSpec.default);
setDataType("value");
setIsEditing(false);
};
const deleteStop = (stopIdx: number) => {
@@ -233,10 +227,10 @@ export const FieldFunction: React.FC<FieldFunctionProps> = (props) => {
type: "identity",
property: value[1],
});
setDataType("value");
setIsEditing(false);
} else if (isLiteralExpression(value)) {
props.onChange(fieldName, value[1]);
setDataType("value");
setIsEditing(false);
}
};
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "Ausdruck löschen",
"Delete filter block": "Filterblock löschen",
"Deuteranopia filter": "Deuteranopie-Filter",
"Drag to resize the layer list": "Ziehen, um die Ebenenliste zu skalieren",
"Drag to resize the sidebar": "Ziehen, um die Seitenleiste zu skalieren",
"Duplicate": "Duplizieren",
"Encoding": "Kodierung",
"Enter URL...": "URL eingeben...",
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "Supprimer l'expression",
"Delete filter block": "Supprimer le bloc de filtre",
"Deuteranopia filter": "Filtre Deutéranopie",
"Drag to resize the layer list": "Glisser pour redimensionner la liste des calques",
"Drag to resize the sidebar": "Glisser pour redimensionner la barre latérale",
"Duplicate": "Dupliquer",
"Encoding": "Encodage",
"Enter URL...": "Entrez l'URL...",
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "מחיקת ביטוי",
"Delete filter block": "מחיקת גוש מסנן",
"Deuteranopia filter": "Deuteranopia filter",
"Drag to resize the layer list": "יש לגרור כדי לשנות את גודל רשימת השכבות",
"Drag to resize the sidebar": "יש לגרור כדי לשנות את גודל סרגל הצד",
"Duplicate": "שכפול",
"Encoding": "קידוד",
"Enter URL...": "הכנסו כתובת",
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "Elimina espressione",
"Delete filter block": "Elimina blocco filtro",
"Deuteranopia filter": "Filtro deuteranopia",
"Drag to resize the layer list": "Trascina per ridimensionare l'elenco dei livelli",
"Drag to resize the sidebar": "Trascina per ridimensionare la barra laterale",
"Duplicate": "Duplica",
"Encoding": "Codifica",
"Enter URL...": "Inserisci URL...",
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "式を削除",
"Delete filter block": "フィルタブロックを削除",
"Deuteranopia filter": "緑色盲フィルタ",
"Drag to resize the layer list": "ドラッグしてレイヤーリストのサイズを変更",
"Drag to resize the sidebar": "ドラッグしてサイドバーのサイズを変更",
"Duplicate": "複製",
"Encoding": "エンコーディング",
"Enter URL...": "URLを入力",
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "표현식 삭제",
"Delete filter block": "필터 블록 삭제",
"Deuteranopia filter": "녹색맹 필터",
"Drag to resize the layer list": "드래그하여 레이어 목록 크기 조정",
"Drag to resize the sidebar": "드래그하여 사이드바 크기 조정",
"Duplicate": "복제",
"Encoding": "인코딩",
"Enter URL...": "URL 입력...",
+2
View File
@@ -55,6 +55,8 @@
"Delete filter block": "Filtre bloğunu sil",
"Deuteranopia filter": "Döteranopi filtresi",
"Drag and drop a style JSON file here or click to browse": "Bir stil JSON dosyasını buraya sürükleyip bırakın veya göz atmak için tıklayın",
"Drag to resize the layer list": "Katman listesini yeniden boyutlandırmak için sürükleyin",
"Drag to resize the sidebar": "Kenar çubuğunu yeniden boyutlandırmak için sürükleyin",
"Duplicate": "Kopyala",
"Encoding": "Kodlama",
"Enter URL...": "URL girin...",
+2
View File
@@ -54,6 +54,8 @@
"Delete expression": "删除表达式",
"Delete filter block": "删除过滤器块",
"Deuteranopia filter": "绿色盲滤镜",
"Drag to resize the layer list": "拖动以调整图层列表大小",
"Drag to resize the sidebar": "拖动以调整侧边栏大小",
"Duplicate": "复制",
"Encoding": "编码",
"Enter URL...": "输入URL...",
+2 -1
View File
@@ -6,7 +6,8 @@
.maputnik-map__container {
background: white;
display: flex;
width: vars.$layout-map-width;
width: 100%;
height: 100%;
&--error {
align-items: center;
+60 -12
View File
@@ -13,6 +13,9 @@
//APP LAYOUT
.maputnik-layout {
// Kept up to date by AppLayout as the sidebar is resized.
--sidebar-width: #{vars.$layout-list-width + vars.$layout-editor-width};
font-family: vars.$font-family;
color: vars.$color-white;
@@ -28,31 +31,76 @@
display: flex;
}
&-list {
width: 200px;
background-color: vars.$color-black;
// The resizable panel group filling the main area.
&-panels {
flex: 1;
min-width: 0;
height: 100%;
}
&-sidebar-panels,
&-sidebar,
&-code-editor,
&-list,
&-drawer,
&-map {
height: 100%;
// scroll-container is position: absolute
position: relative;
}
&-sidebar,
&-code-editor,
&-list,
&-drawer {
width: 370px;
background-color: vars.$color-black;
// scroll-container is position: absolute
position: relative;
}
&-code-editor {
width: 570px;
background-color: vars.$color-black;
// scroll-container is position: absolute
&-resize-handle {
width: 5px;
background-color: transparent;
position: relative;
z-index: 5;
transition: background-color 0.15s ease;
&:hover,
&:active,
&:focus-visible {
background-color: rgba(vars.$color-lowgray, 0.5);
}
// The separator is keyboard resizable, so it needs a visible focus ring.
&:focus-visible {
outline: #8e8e8e auto 1px;
}
&::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 3px;
height: 30px;
border-radius: 2px;
background-color: vars.$color-lowgray;
opacity: 0;
transition: opacity 0.15s ease;
}
&:hover::after,
&:active::after,
&:focus-visible::after {
opacity: 0.7;
}
}
&-bottom {
position: fixed;
bottom: 0;
right: 0;
z-index: 10;
width: vars.$layout-map-width;
inset-inline-start: var(--sidebar-width);
inset-inline-end: 0;
background-color: vars.$color-black;
}
}
-1
View File
@@ -23,7 +23,6 @@ $toolbar-offset: 0;
$layout-list-width: 200px;
$layout-editor-width: 370px;
$layout-map-width: calc(100% - #{$layout-list-width + $layout-editor-width});
// 'menu-down' from 'https://materialdesignicons.com/'
// See <https://github.com/Templarian/MaterialDesign/blob/master/LICENSE>