Add precommit check (#1080)

Keeps the repo clean, same as several other of our repos

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Yuri Astrakhan
2025-02-25 05:01:15 -05:00
committed by GitHub
parent c58191ff62
commit 9540686b40
77 changed files with 143 additions and 177 deletions

View File

@@ -8,4 +8,3 @@ assignees: ''
--- ---
<!-- Thanks for reaching out! If you are having general Maputnik mapping questions, please asking them at https://gis.stackexchange.com/ using the 'maputnik' tag https://gis.stackexchange.com/questions/tagged/maputnik and read https://gis.stackexchange.com/help/how-to-ask before you do so (please keep in mind that you're asking there in a general GIS forum, not a dedicated support channel) --> <!-- Thanks for reaching out! If you are having general Maputnik mapping questions, please asking them at https://gis.stackexchange.com/ using the 'maputnik' tag https://gis.stackexchange.com/questions/tagged/maputnik and read https://gis.stackexchange.com/help/how-to-ask before you do so (please keep in mind that you're asking there in a general GIS forum, not a dedicated support channel) -->

View File

@@ -8,4 +8,3 @@
- [ ] Include before/after visuals or gifs if this PR includes visual changes. - [ ] Include before/after visuals or gifs if this PR includes visual changes.
- [ ] Write tests for all new functionality. - [ ] Write tests for all new functionality.
- [ ] Add an entry to `CHANGELOG.md` under the `## main` section. - [ ] Add an entry to `CHANGELOG.md` under the `## main` section.

View File

@@ -14,8 +14,8 @@ jobs:
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: docker build -t test-docker-image-build . - run: docker build -t test-docker-image-build .
# build the editor # build the editor
build-node: build-node:
@@ -27,17 +27,17 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ ubuntu-latest, windows-latest, macos-latest ]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run lint - run: npm run lint
- run: npm run lint-css - run: npm run lint-css
@@ -47,53 +47,53 @@ jobs:
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- name: artifacts/maputnik - name: artifacts/maputnik
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: maputnik name: maputnik
path: dist path: dist
# Build and upload desktop CLI artifacts # Build and upload desktop CLI artifacts
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: ^1.23.x go-version: ^1.23.x
cache-dependency-path: desktop/go.sum cache-dependency-path: desktop/go.sum
id: go id: go
- name: Build desktop artifacts - name: Build desktop artifacts
run: npm run build-desktop run: npm run build-desktop
- name: Artifacts/linux - name: Artifacts/linux
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: maputnik-linux name: maputnik-linux
path: ./desktop/bin/linux/ path: ./desktop/bin/linux/
- name: Artifacts/darwin - name: Artifacts/darwin
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: maputnik-darwin name: maputnik-darwin
path: ./desktop/bin/darwin/ path: ./desktop/bin/darwin/
- name: Artifacts/windows
uses: actions/upload-artifact@v4
with:
name: maputnik-windows
path: ./desktop/bin/windows/
- name: Artifacts/windows
uses: actions/upload-artifact@v4
with:
name: maputnik-windows
path: ./desktop/bin/windows/
e2e-tests: e2e-tests:
name: "E2E tests using ${{ matrix.browser }}" name: "E2E tests using ${{ matrix.browser }}"
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
browser: [chrome] browser: [ chrome ]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:

View File

@@ -20,7 +20,7 @@ jobs:
- name: Install - name: Install
run: npm ci run: npm ci
- name: Build - name: Build
run: npm run build run: npm run build
- name: Upload to GitHub Pages - name: Upload to GitHub Pages
@@ -28,7 +28,7 @@ jobs:
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist publish_dir: dist
# publish docker to GitHub registry # publish docker to GitHub registry
deploy-docker: deploy-docker:
name: deploy/docker name: deploy/docker
@@ -40,12 +40,12 @@ jobs:
fail-fast: false fail-fast: false
steps: steps:
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: docker build -t ghcr.io/maplibre/maputnik:main . - run: docker build -t ghcr.io/maplibre/maputnik:main .
- run: docker push ghcr.io/maplibre/maputnik:main - run: docker push ghcr.io/maplibre/maputnik:main

View File

@@ -2,7 +2,7 @@ name: Release
on: on:
push: push:
branches: [main] branches: [ main ]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -99,4 +99,3 @@ jobs:
allowUpdates: true allowUpdates: true
draft: false draft: false
prerelease: false prerelease: false

24
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-json
exclude: 'tsconfig(\.node)?\.json'
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-yaml
args: [ --allow-multiple-documents ]
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ --fix=lf ]
- id: trailing-whitespace

View File

@@ -32,4 +32,3 @@
## 1.7.0 ## 1.7.0
- See release notes at https://maputnik.github.io/blog/2020/04/23/release-v1.7.0 - See release notes at https://maputnik.github.io/blog/2020/04/23/release-v1.7.0

View File

@@ -20,4 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.

View File

@@ -36,7 +36,7 @@ Maputnik is written in typescript and is using [React](https://github.com/facebo
We ensure building and developing Maputnik works with the [current active LTS Node.js version and above](https://github.com/nodejs/Release#release-schedule). We ensure building and developing Maputnik works with the [current active LTS Node.js version and above](https://github.com/nodejs/Release#release-schedule).
Check out our [Internationalization guide](./src/locales/README.md) for UI text related changes. Check out our [Internationalization guide](./src/locales/README.md) for UI text related changes.
### Getting Involved ### Getting Involved
Join the #maplibre or #maputnik slack channel at OSMUS: get an invite at https://slack.openstreetmap.us/ Read the the below guide in order to get familiar with how we do things around here. Join the #maplibre or #maputnik slack channel at OSMUS: get an invite at https://slack.openstreetmap.us/ Read the the below guide in order to get familiar with how we do things around here.

View File

@@ -1,6 +1,6 @@
# Build Scripts # Build Scripts
This folder holds common build scripts used by some of the Github workflows. This folder holds common build scripts used by some of the Github workflows.
The scripts are borrowed from [maplibre/maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js/tree/bc70bc559cea5c987fa1b79fd44766cef68bbe28/build). The scripts are borrowed from [maplibre/maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js/tree/bc70bc559cea5c987fa1b79fd44766cef68bbe28/build).

View File

@@ -497,7 +497,7 @@ describe("layers", () => {
describe("layereditor jsonlint should error", ()=>{ describe("layereditor jsonlint should error", ()=>{
it("add", () => { it("add", () => {
const id = when.modal.fillLayers({ const id = when.modal.fillLayers({
type: "circle", type: "circle",
@@ -515,10 +515,10 @@ describe("layers", () => {
}); });
const sourceText = get.elementByText('"source"'); const sourceText = get.elementByText('"source"');
sourceText.click(); sourceText.click();
sourceText.type("\""); sourceText.type("\"");
const error = get.element('.CodeMirror-lint-marker-error'); const error = get.element('.CodeMirror-lint-marker-error');
error.should('exist'); error.should('exist');
}); });

View File

@@ -23,7 +23,7 @@ describe("map", () => {
); );
}); });
}); });
describe("search", () => { describe("search", () => {
it('should exist', () => { it('should exist', () => {
then(get.searchControl()).shouldBeVisible(); then(get.searchControl()).shouldBeVisible();

View File

@@ -240,14 +240,14 @@ describe("modals", () => {
it("inlcude API key when change renderer", () => { it("inlcude API key when change renderer", () => {
when.click("modal:settings.close-modal") when.click("modal:settings.close-modal")
when.click("nav:open"); when.click("nav:open");
get.elementByAttribute('aria-label', "MapTiler Basic").should('exist').click(); get.elementByAttribute('aria-label', "MapTiler Basic").should('exist').click();
when.click("nav:settings"); when.click("nav:settings");
when.select("modal:settings.maputnik:renderer", "mlgljs"); when.select("modal:settings.maputnik:renderer", "mlgljs");
then(get.inputValue("modal:settings.maputnik:renderer")).shouldEqual( then(get.inputValue("modal:settings.maputnik:renderer")).shouldEqual(
"mlgljs" "mlgljs"
@@ -259,7 +259,7 @@ describe("modals", () => {
); );
given.intercept("https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=*", "tileRequest", "GET"); given.intercept("https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=*", "tileRequest", "GET");
when.select("modal:settings.maputnik:renderer", "mlgljs"); when.select("modal:settings.maputnik:renderer", "mlgljs");
then(get.inputValue("modal:settings.maputnik:renderer")).shouldEqual( then(get.inputValue("modal:settings.maputnik:renderer")).shouldEqual(
"mlgljs" "mlgljs"
@@ -269,7 +269,7 @@ describe("modals", () => {
when.waitForResponse("tileRequest").its("request").its("url").should("include", `https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=${tokens.openmaptiles}`); when.waitForResponse("tileRequest").its("request").its("url").should("include", `https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=${tokens.openmaptiles}`);
when.waitForResponse("tileRequest").its("request").its("url").should("include", `https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=${tokens.openmaptiles}`); when.waitForResponse("tileRequest").its("request").its("url").should("include", `https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=${tokens.openmaptiles}`);
}); });
}); });
describe("sources", () => { describe("sources", () => {

View File

@@ -15,4 +15,3 @@
} }
] ]
} }

View File

@@ -31,4 +31,4 @@
"glyphs": "https://example.local/fonts/{fontstack}/{range}.pbf", "glyphs": "https://example.local/fonts/{fontstack}/{range}.pbf",
"sprites": "https://example.local/fonts/{fontstack}/{range}.pbf", "sprites": "https://example.local/fonts/{fontstack}/{range}.pbf",
"layers": [] "layers": []
} }

View File

@@ -26,4 +26,4 @@
"glyphs": "https://example.local/fonts/{fontstack}/{range}.pbf", "glyphs": "https://example.local/fonts/{fontstack}/{range}.pbf",
"sprites": "https://example.local/fonts/{fontstack}/{range}.pbf", "sprites": "https://example.local/fonts/{fontstack}/{range}.pbf",
"layers": [] "layers": []
} }

View File

@@ -15,4 +15,4 @@
"glyphs": "https://example.local/fonts/{fontstack}/{range}.pbf", "glyphs": "https://example.local/fonts/{fontstack}/{range}.pbf",
"sprites": "https://example.local/fonts/{fontstack}/{range}.pbf", "sprites": "https://example.local/fonts/{fontstack}/{range}.pbf",
"layers": [] "layers": []
} }

View File

@@ -34,4 +34,4 @@
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// } // }
// } // }
// } // }

View File

@@ -102,4 +102,3 @@ export default class Block extends React.Component<BlockProps, BlockState> {
</label> </label>
} }
} }

View File

@@ -31,4 +31,3 @@ export default class Collapse extends React.Component<CollapseProps> {
} }
} }
} }

View File

@@ -16,4 +16,3 @@ export default class Collapser extends React.Component<CollapserProps> {
return this.props.isCollapsed ? <MdArrowDropUp style={iconStyle}/> : <MdArrowDropDown style={iconStyle} /> return this.props.isCollapsed ? <MdArrowDropUp style={iconStyle}/> : <MdArrowDropDown style={iconStyle} />
} }
} }

View File

@@ -16,4 +16,3 @@ export default class FieldArray extends React.Component<FieldArrayProps> {
</Fieldset> </Fieldset>
} }
} }

View File

@@ -15,4 +15,3 @@ export default class FieldAutocomplete extends React.Component<FieldAutocomplete
</Block> </Block>
} }
} }

View File

@@ -15,4 +15,3 @@ export default class FieldCheckbox extends React.Component<FieldCheckboxProps> {
</Block> </Block>
} }
} }

View File

@@ -18,4 +18,3 @@ export default class FieldColor extends React.Component<FieldColorProps> {
</Block> </Block>
} }
} }

View File

@@ -13,4 +13,3 @@ export default class FieldDynamicArray extends React.Component<FieldDynamicArray
</Fieldset> </Fieldset>
} }
} }

View File

@@ -3,7 +3,7 @@ import InputEnum, {InputEnumProps} from './InputEnum'
import Fieldset from './Fieldset'; import Fieldset from './Fieldset';
type FieldEnumProps = InputEnumProps & { type FieldEnumProps = InputEnumProps & {
label?: string; label?: string;
fieldSpec?: { fieldSpec?: {
doc: string doc: string
@@ -17,4 +17,4 @@ export default class FieldEnum extends React.Component<FieldEnumProps> {
<InputEnum {...this.props} /> <InputEnum {...this.props} />
</Fieldset> </Fieldset>
} }
} }

View File

@@ -404,4 +404,3 @@ export default class FieldFunction extends React.Component<FieldFunctionProps, F
</div> </div>
} }
} }

View File

@@ -10,4 +10,3 @@ export default class FieldJson extends React.Component<FieldJsonProps> {
return <InputJson {...this.props} /> return <InputJson {...this.props} />
} }
} }

View File

@@ -15,4 +15,3 @@ export default class FieldMultiInput extends React.Component<FieldMultiInputProp
</Fieldset> </Fieldset>
} }
} }

View File

@@ -18,5 +18,3 @@ export default class FieldSelect extends React.Component<FieldSelectProps> {
</Block> </Block>
} }
} }

View File

@@ -22,8 +22,8 @@ class FieldSourceLayerInternal extends React.Component<FieldSourceLayerInternalP
render() { render() {
const t = this.props.t; const t = this.props.t;
return <Block return <Block
label={t("Source Layer")} label={t("Source Layer")}
fieldSpec={latest.layer['source-layer']} fieldSpec={latest.layer['source-layer']}
data-wd-key="layer-source-layer" data-wd-key="layer-source-layer"
error={this.props.error} error={this.props.error}

View File

@@ -20,4 +20,3 @@ export default class FieldUrl extends React.Component<FieldUrlProps> {
); );
} }
} }

View File

@@ -255,8 +255,8 @@ class FilterEditorInternal extends React.Component<FilterEditorInternalProps, Fi
value={combiningOp} value={combiningOp}
onChange={(v: [string, any]) => this.onFilterPartChanged(0, v)} onChange={(v: [string, any]) => this.onFilterPartChanged(0, v)}
options={[ options={[
["all", t("every filter matches")], ["all", t("every filter matches")],
["none", t("no filter matches")], ["none", t("no filter matches")],
["any", t("any filter matches")] ["any", t("any filter matches")]
]} ]}
/> />

View File

@@ -11,5 +11,3 @@ export default class IconBackground extends React.Component {
) )
} }
} }

View File

@@ -11,5 +11,3 @@ export default class IconCircle extends React.Component {
) )
} }
} }

View File

@@ -11,5 +11,3 @@ export default class IconFill extends React.Component {
) )
} }
} }

View File

@@ -30,4 +30,3 @@ export default class IconLayer extends React.Component<IconLayerProps> {
} }
} }
} }

View File

@@ -11,5 +11,3 @@ export default class IconLine extends React.Component {
) )
} }
} }

View File

@@ -13,6 +13,3 @@ export default class IconSymbol extends React.Component {
) )
} }
} }

View File

@@ -115,4 +115,3 @@ export default class FieldArray extends React.Component<FieldArrayProps, FieldAr
) )
} }
} }

View File

@@ -98,5 +98,3 @@ export default class InputAutocomplete extends React.Component<InputAutocomplete
</div> </div>
} }
} }

View File

@@ -30,4 +30,4 @@ export default class InputButton extends React.Component<InputButtonProps> {
{this.props.children} {this.props.children}
</button> </button>
} }
} }

View File

@@ -34,4 +34,4 @@ export default class InputCheckbox extends React.Component<InputCheckboxProps> {
</div> </div>
</div> </div>
} }
} }

View File

@@ -133,4 +133,3 @@ export default class InputColor extends React.Component<InputColorProps> {
</div> </div>
} }
} }

View File

@@ -22,7 +22,7 @@ export type FieldDynamicArrayProps = {
} }
'aria-label'?: string 'aria-label'?: string
label: string label: string
} }
type FieldDynamicArrayInternalProps = FieldDynamicArrayProps & WithTranslation; type FieldDynamicArrayInternalProps = FieldDynamicArrayProps & WithTranslation;
@@ -67,7 +67,7 @@ class FieldDynamicArrayInternal extends React.Component<FieldDynamicArrayInterna
const t = this.props.t; const t = this.props.t;
const i18nProps = { t, i18n: this.props.i18n, tReady: this.props.tReady }; const i18nProps = { t, i18n: this.props.i18n, tReady: this.props.tReady };
const inputs = this.values.map((v, i) => { const inputs = this.values.map((v, i) => {
const deleteValueBtn= <DeleteValueInputButton const deleteValueBtn= <DeleteValueInputButton
onClick={this.deleteValue.bind(this, i)} onClick={this.deleteValue.bind(this, i)}
{...i18nProps} {...i18nProps}
/>; />;
@@ -152,4 +152,3 @@ class DeleteValueInputButton extends React.Component<DeleteValueInputButtonProps
</InputButton> </InputButton>
} }
} }

View File

@@ -47,4 +47,3 @@ export default class InputEnum extends React.Component<InputEnumProps> {
} }
} }
} }

View File

@@ -37,5 +37,3 @@ export default class InputMultiInput extends React.Component<InputMultiInputProp
</fieldset> </fieldset>
} }
} }

View File

@@ -157,7 +157,7 @@ export default class InputNumber extends React.Component<InputNumberProps, Input
render() { render() {
if( if(
Object.prototype.hasOwnProperty.call(this.props, "min") && Object.prototype.hasOwnProperty.call(this.props, "min") &&
Object.prototype.hasOwnProperty.call(this.props, "max") && Object.prototype.hasOwnProperty.call(this.props, "max") &&
this.props.min !== undefined && this.props.max !== undefined && this.props.min !== undefined && this.props.max !== undefined &&
this.props.allowRange this.props.allowRange
@@ -244,5 +244,3 @@ export default class InputNumber extends React.Component<InputNumberProps, Input
} }
} }
} }

View File

@@ -30,5 +30,3 @@ export default class InputSelect extends React.Component<InputSelectProps> {
</select> </select>
} }
} }

View File

@@ -97,5 +97,3 @@ export default class InputString extends React.Component<InputStringProps, Input
}); });
} }
} }

View File

@@ -326,10 +326,10 @@ class LayerEditorInternal extends React.Component<LayerEditorInternalProps, Laye
onSelection={handleSelection} onSelection={handleSelection}
closeOnSelection={false} closeOnSelection={false}
> >
<Button <Button
id="skip-target-layer-editor" id="skip-target-layer-editor"
data-wd-key="skip-target-layer-editor" data-wd-key="skip-target-layer-editor"
className='more-menu__button' className='more-menu__button'
title={"Layer options"}> title={"Layer options"}>
<MdMoreVert className="more-menu__button__svg" /> <MdMoreVert className="more-menu__button__svg" />
</Button> </Button>

View File

@@ -287,9 +287,9 @@ class LayerListContainerInternal extends React.Component<LayerListContainerInter
data-wd-key="skip-target-layer-list" data-wd-key="skip-target-layer-list"
onClick={this.toggleLayers} onClick={this.toggleLayers}
className="maputnik-button"> className="maputnik-button">
{this.state.areAllGroupsExpanded === true ? {this.state.areAllGroupsExpanded === true ?
t("Collapse") t("Collapse")
: :
t("Expand") t("Expand")
} }
</button> </button>

View File

@@ -134,7 +134,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
this.state.inspect!.render(); this.state.inspect!.render();
}, 500); }, 500);
} }
} }
componentDidMount() { componentDidMount() {

View File

@@ -27,7 +27,7 @@ class ModalLoadingInternal extends React.Component<ModalLoadingInternalProps> {
underlayClickExits={false} underlayClickExits={false}
underlayProps={{ underlayProps={{
// @ts-ignore // @ts-ignore
onClick: (e: Event) => underlayProps(e) onClick: (e: Event) => underlayProps(e)
}} }}
title={this.props.title} title={this.props.title}
onOpenToggle={() => this.props.onCancel()} onOpenToggle={() => this.props.onCancel()}

View File

@@ -56,8 +56,8 @@ export default class PropertyGroup extends React.Component<PropertyGroupProps> {
const paint = this.props.layer.paint || {} const paint = this.props.layer.paint || {}
const layout = this.props.layer.layout || {} const layout = this.props.layer.layout || {}
const fieldValue = fieldName in paint const fieldValue = fieldName in paint
? paint[fieldName as keyof typeof paint] ? paint[fieldName as keyof typeof paint]
: layout[fieldName as keyof typeof layout] : layout[fieldName as keyof typeof layout]
const fieldType = fieldName in paint ? 'paint' : 'layout'; const fieldType = fieldName in paint ? 'paint' : 'layout';

View File

@@ -11,4 +11,3 @@ export default class ScrollContainer extends React.Component<ScrollContainerProp
</div> </div>
} }
} }

View File

@@ -90,4 +90,3 @@ export default class SingleFilterEditor extends React.Component<SingleFilterEdit
</div> </div>
} }
} }

View File

@@ -44,4 +44,3 @@ export default class SpecField extends React.Component<SpecFieldProps> {
</TypeBlock> </TypeBlock>
} }
} }

View File

@@ -91,7 +91,7 @@ class ExpressionPropertyInternal extends React.Component<ExpressionPropertyInter
function getValue(data: any) { function getValue(data: any) {
return stringifyPretty(data, {indent: 2, maxLength: 38}) return stringifyPretty(data, {indent: 2, maxLength: 38})
} }
if (jsonError) { if (jsonError) {
foundErrors.push({message: "Invalid JSON"}); foundErrors.push({message: "Invalid JSON"});
} }

View File

@@ -29,8 +29,8 @@ export default class SpecProperty extends React.Component<SpecPropertyProps> {
const functionBtn = <FunctionButtons const functionBtn = <FunctionButtons
fieldSpec={this.props.fieldSpec} fieldSpec={this.props.fieldSpec}
onZoomClick={this.props.onZoomClick} onZoomClick={this.props.onZoomClick}
onDataClick={this.props.onDataClick} onDataClick={this.props.onDataClick}
onExpressionClick={this.props.onExpressionClick} onExpressionClick={this.props.onExpressionClick}
/> />
const error = errors![fieldType+"."+fieldName as any] as any; const error = errors![fieldType+"."+fieldName as any] as any;

View File

@@ -31,7 +31,7 @@ function tryToParse(text: string) {
last_line: parseInt(errorMatch[1], 10), last_line: parseInt(errorMatch[1], 10),
last_column: parseInt(errorMatch[2], 10) last_column: parseInt(errorMatch[2], 10)
}; };
// const loc = hash.loc; // const loc = hash.loc;
found.push({ found.push({
from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
@@ -49,7 +49,7 @@ CodeMirror.registerHelper("lint", "json", (text: string) => {
}); });
CodeMirror.registerHelper("lint", "mgl", (text: string, opts: any, doc: any) => { CodeMirror.registerHelper("lint", "mgl", (text: string, opts: any, doc: any) => {
const found: MarkerRangeWithMessage[] = tryToParse(text); const found: MarkerRangeWithMessage[] = tryToParse(text);
const {context} = opts; const {context} = opts;

View File

@@ -11,4 +11,4 @@ export function undoMessages(beforeStyle: StyleSpecification, afterStyle: StyleS
} }
export function redoMessages(beforeStyle: StyleSpecification, afterStyle: StyleSpecification) { export function redoMessages(beforeStyle: StyleSpecification, afterStyle: StyleSpecification) {
return diffMessages(beforeStyle, afterStyle).map(m => 'Redo ' + m) return diffMessages(beforeStyle, afterStyle).map(m => 'Redo ' + m)
} }

View File

@@ -24,4 +24,3 @@ export function changeSource(mapStyle: StyleSpecification, sourceId: string, sou
sources: changedSources sources: changedSources
} }
} }

View File

@@ -14,10 +14,10 @@ export default class ZoomControl {
this._container.setAttribute("data-wd-key", "maplibre:ctrl-zoom"); this._container.setAttribute("data-wd-key", "maplibre:ctrl-zoom");
this.setLabel("Zoom:"); this.setLabel("Zoom:");
this.addEventListeners(); this.addEventListeners();
return this._container; return this._container;
} }
updateZoomLevel() { updateZoomLevel() {
this._textEl!.innerHTML = this._map!.getZoom().toFixed(2); this._textEl!.innerHTML = this._map!.getZoom().toFixed(2);
} }
@@ -29,7 +29,7 @@ export default class ZoomControl {
this._textEl = this._container!.querySelector("span"); this._textEl = this._container!.querySelector("span");
this.updateZoomLevel(); this.updateZoomLevel();
} }
addEventListeners (){ addEventListeners (){
this._map!.on('render', () => this.updateZoomLevel()); this._map!.on('render', () => this.updateZoomLevel());
this._map!.on('zoomIn', () => this.updateZoomLevel()); this._map!.on('zoomIn', () => this.updateZoomLevel());

View File

@@ -46,16 +46,14 @@ The following users can help you with the relevant languages:
| ISO Code | Language | User | | ISO Code | Language | User |
|----------|--------------------|--------------------------------------------| |----------|--------------------|--------------------------------------------|
| de | German | [@josxha](https://github.com/josxha) | | de | German | [@josxha](https://github.com/josxha) |
| en | English | [@HarelM](https://github.com/HarelM) | | en | English | [@HarelM](https://github.com/HarelM) |
| fr | French | [@lhapaipai](https://github.com/lhapaipai) | | fr | French | [@lhapaipai](https://github.com/lhapaipai) |
| hr | Hebrew | [@HarelM](https://github.com/HarelM) | | hr | Hebrew | [@HarelM](https://github.com/HarelM) |
| it | Italian | [@napo](https://github.com/napo) | | it | Italian | [@napo](https://github.com/napo) |
| ja | Japanese | [@keichan34](https://github.com/keichan34) | | ja | Japanese | [@keichan34](https://github.com/keichan34) |
| zh | Simplified Chinese | [@jieme](https://github.com/jieme) | | zh | Simplified Chinese | [@jieme](https://github.com/jieme) |
You can test the UI in different languages using the dropdown in the top menu You can test the UI in different languages using the dropdown in the top menu
Note that Maputnik automatically localize based on browser language settings and stores this language in local storage. Note that Maputnik automatically localize based on browser language settings and stores this language in local storage.
You can use incognito mode to check a first time usage. You can use incognito mode to check a first time usage.

View File

@@ -88,4 +88,3 @@
.maplibregl-ctrl-map { .maplibregl-ctrl-map {
background-image: url('data:image/svg+xml;charset=utf8,<svg%20xmlns="http://www.w3.org/2000/svg"%20fill="#8e8e8e%22%20viewBox=%22-10%20-10%2060%2060%22%20preserveAspectRatio=%22xMidYMid%20meet%22%3E%3Cg%3E%3Cpath%20d=%22m25%2031.640000000000004v-19.766666666666673l-10-3.511666666666663v19.766666666666666z%20m9.140000000000008-26.640000000000004q0.8599999999999923%200%200.8599999999999923%200.8600000000000003v25.156666666666666q0%200.625-0.625%200.783333333333335l-9.375%203.1999999999999993-10-3.5133333333333354-8.906666666666668%203.4383333333333326-0.2333333333333334%200.07833333333333314q-0.8616666666666664%200-0.8616666666666664-0.8599999999999994v-25.156666666666663q0-0.625%200.6233333333333331-0.7833333333333332l9.378333333333334-3.198333333333334%2010%203.5133333333333336%208.905000000000001-3.4383333333333344z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E'); background-image: url('data:image/svg+xml;charset=utf8,<svg%20xmlns="http://www.w3.org/2000/svg"%20fill="#8e8e8e%22%20viewBox=%22-10%20-10%2060%2060%22%20preserveAspectRatio=%22xMidYMid%20meet%22%3E%3Cg%3E%3Cpath%20d=%22m25%2031.640000000000004v-19.766666666666673l-10-3.511666666666663v19.766666666666666z%20m9.140000000000008-26.640000000000004q0.8599999999999923%200%200.8599999999999923%200.8600000000000003v25.156666666666666q0%200.625-0.625%200.783333333333335l-9.375%203.1999999999999993-10-3.5133333333333354-8.906666666666668%203.4383333333333326-0.2333333333333334%200.07833333333333314q-0.8616666666666664%200-0.8616666666666664-0.8599999999999994v-25.156666666666663q0-0.625%200.6233333333333331-0.7833333333333332l9.378333333333334-3.198333333333334%2010%203.5133333333333336%208.905000000000001-3.4383333333333344z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E');
} }

View File

@@ -71,7 +71,7 @@
} }
to { to {
opacity: 0; opacity: 0;
} }
} }
.JSONEditor__message { .JSONEditor__message {

View File

@@ -308,4 +308,3 @@
color: currentColor; color: currentColor;
cursor: pointer; cursor: pointer;
} }

View File

@@ -229,7 +229,7 @@
} }
&:hover { &:hover {
background-color: vars.$color-gray; background-color: vars.$color-gray;

View File

@@ -323,4 +323,3 @@
margin-left: 4px; margin-left: 4px;
} }
} }

View File

@@ -13,8 +13,8 @@ b, u, i, center,
dl, dt, dd, ol, ul, li, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td, table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup, figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary, menu, nav, output, ruby, section, summary,
time, mark, audio, video { time, mark, audio, video {
margin: 0; margin: 0;
@@ -25,7 +25,7 @@ time, mark, audio, video {
vertical-align: baseline; vertical-align: baseline;
} }
/* HTML5 display-role reset for older browsers */ /* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section { footer, header, hgroup, menu, nav, section {
display: block; display: block;
} }

View File

@@ -12,7 +12,7 @@
padding-left: 2px; padding-left: 2px;
padding-right: 2px; padding-right: 2px;
} }
// Styling for Firefox // Styling for Firefox
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: #666 #26282e; scrollbar-color: #666 #26282e;

View File

@@ -154,4 +154,3 @@
border-color: vars.$color-lowgray; border-color: vars.$color-lowgray;
} }
} }

View File

@@ -155,4 +155,3 @@
overflow: hidden; overflow: hidden;
} }
} }

View File

@@ -6,7 +6,7 @@
"types": ["geojson", "@types/wicg-file-system-access"], "types": ["geojson", "@types/wicg-file-system-access"],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
@@ -14,7 +14,7 @@
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
/* Linting */ /* Linting */
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,

View File

@@ -8,4 +8,3 @@
}, },
"include": ["vite.config.ts"] "include": ["vite.config.ts"]
} }