Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
korywka committed Jun 25, 2024
1 parent c608f76 commit 64a2091
Show file tree
Hide file tree
Showing 25 changed files with 781 additions and 1,160 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@
- **StyleControl**: update types
- **ImageControl**: add error hint for missing layers
- Update dependencies

## 2.1.0

- Update `@turf` package from alpha version to release version
- Fix Vite SSR for icons
- Update dependencies
11 changes: 7 additions & 4 deletions packages/compass/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@mapbox-controls/compass",
"version": "2.0.0",
"version": "2.1.0",
"description": "Indicate map direction",
"type": "module",
"main": "./src/index.js",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@mapbox-controls/helpers": "2.0.0"
"@mapbox-controls/helpers": "2.1.0"
},
"devDependencies": {
"@types/mapbox-gl": "3.1.0",
Expand All @@ -18,11 +18,14 @@
"mapbox-gl": ">=1.0.0 <4.0.0"
},
"types": "./types/index.d.ts",
"files": ["src", "types"],
"files": [
"src",
"types"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": "korywka/mapbox-controls",
"license": "MIT"
}
}
20 changes: 11 additions & 9 deletions packages/compass/src/icons.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { parseSVG } from '@mapbox-controls/helpers';

const compass = parseSVG(`
<svg viewBox="0 0 24 24" width="22" height="22" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h24v24H0z"/>
<path fill="#f44336" d="M12 3l4 8H8z"/>
<path fill="#9E9E9E" d="M12 21l-4-8h8z"/>
</g>
</svg>
`);
function compass() {
return parseSVG(`
<svg viewBox="0 0 24 24" width="22" height="22" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h24v24H0z"/>
<path fill="#f44336" d="M12 3l4 8H8z"/>
<path fill="#9E9E9E" d="M12 21l-4-8h8z"/>
</g>
</svg>
`);
}

export const icons = {
compass,
Expand Down
4 changes: 2 additions & 2 deletions packages/compass/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class CompassControl {
constructor(options = {}) {
this.options = { ...options };
this.container = controlContainer('mapbox-ctrl-compass');
this.icon = icons.compass;
this.icon = icons.compass();
this.button = controlButton({
title: 'Compass',
icon: icons.compass,
icon: this.icon,
onClick: () => this.onControlButtonClick(),
});
}
Expand Down
9 changes: 6 additions & 3 deletions packages/helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapbox-controls/helpers",
"version": "2.0.0",
"version": "2.1.0",
"description": "Helpers for mapbox controls",
"type": "module",
"main": "./src/index.js",
Expand All @@ -16,11 +16,14 @@
"mapbox-gl": ">=1.0.0 <4.0.0"
},
"types": "./types/index.d.ts",
"files": ["src", "types"],
"files": [
"src",
"types"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": "korywka/mapbox-gl-controls",
"license": "MIT"
}
}
27 changes: 15 additions & 12 deletions packages/image/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "@mapbox-controls/image",
"version": "2.0.0",
"version": "2.1.0",
"description": "Move, scale and rotate image on a map",
"type": "module",
"main": "./src/index.js",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@mapbox-controls/helpers": "2.0.0",
"@turf/bearing": "7.0.0-alpha.2",
"@turf/centroid": "7.0.0-alpha.2",
"@turf/helpers": "7.0.0-alpha.2",
"@turf/rhumb-bearing": "7.0.0-alpha.2",
"@turf/rhumb-distance": "7.0.0-alpha.2",
"@turf/transform-rotate": "7.0.0-alpha.2",
"@turf/transform-scale": "7.0.0-alpha.2",
"@turf/transform-translate": "7.0.0-alpha.2"
"@mapbox-controls/helpers": "2.1.0",
"@turf/bearing": "7.0.0",
"@turf/centroid": "7.0.0",
"@turf/helpers": "7.0.0",
"@turf/rhumb-bearing": "7.0.0",
"@turf/rhumb-distance": "7.0.0",
"@turf/transform-rotate": "7.0.0",
"@turf/transform-scale": "7.0.0",
"@turf/transform-translate": "7.0.0"
},
"devDependencies": {
"@types/geojson": "7946.0.14",
Expand All @@ -27,11 +27,14 @@
"mapbox-gl": ">=1.0.0 <4.0.0"
},
"types": "./types/index.d.ts",
"files": ["src", "types"],
"files": [
"src",
"types"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": "korywka/mapbox-controls",
"license": "MIT"
}
}
68 changes: 39 additions & 29 deletions packages/image/src/icons.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
import { parseSVG } from '@mapbox-controls/helpers';

const image = parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
</svg>
`);
function image() {
return parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
</svg>
`);
}

const move = parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"/>
</svg>
`);
function move() {
return parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"/>
</svg>
`);
}

const scale = parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<rect fill="none" height="24" width="24"/>
<polygon points="21,11 21,3 13,3 16.29,6.29 6.29,16.29 3,13 3,21 11,21 7.71,17.71 17.71,7.71"/>
</svg>
`);
function scale() {
return parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<rect fill="none" height="24" width="24"/>
<polygon points="21,11 21,3 13,3 16.29,6.29 6.29,16.29 3,13 3,21 11,21 7.71,17.71 17.71,7.71"/>
</svg>
`);
}

const rotate = parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="22" width="22" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"/>
</svg>
`);
function rotate() {
return parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="22" width="22" fill="currentColor">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"/>
</svg>
`);
}

const remove = parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" height="22" width="22" fill="currentColor">
<path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/>
</svg>
`);
function remove() {
return parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" height="22" width="22" fill="currentColor">
<path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/>
</svg>
`);
}

export const icons = {
move,
Expand Down
12 changes: 6 additions & 6 deletions packages/image/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ class ImageControl {
this.fileInput = createFileInput();
this.buttonAdd = controlButton({
title: 'Add image',
icon: icons.image,
icon: icons.image(),
className: 'mapbox-ctrl-image-add',
onClick: () => this.fileInput.click(),
});
this.buttonMove = controlButton({
disabled: true,
title: 'Move image',
icon: icons.move,
icon: icons.move(),
onClick: () => this.setMode('move'),
});
this.buttonScale = controlButton({
disabled: true,
title: 'Scale image',
icon: icons.scale,
icon: icons.scale(),
onClick: () => this.setMode('scale'),
});
this.buttonRotate = controlButton({
disabled: true,
title: 'Rotate image',
icon: icons.rotate,
icon: icons.rotate(),
onClick: () => this.setMode('rotate'),
});
if (options.removeButton) {
this.buttonRemove = controlButton({
hidden: true,
title: 'Remove image',
icon: icons.remove,
icon: icons.remove(),
onClick: () => this.removeRaster(),
});
}
Expand Down Expand Up @@ -220,7 +220,7 @@ class ImageControl {
onMapClick = (event) => {
if (!this.map) throw Error('map is undefined');
const layersId = Object.values(this.rasters).map((i) => i.fillLayer.id);
// sometimes layers are removed from the map without destroing the control, e.g. style was changed
// sometimes layers are removed from the map without destroying the control, e.g. style was changed
const errorLayerId = layersId.find((id) => {
return !this.map?.getLayer(id);
});
Expand Down
11 changes: 7 additions & 4 deletions packages/inspect/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@mapbox-controls/inspect",
"version": "2.0.0",
"version": "2.1.0",
"description": "Debug map style layers and sources",
"type": "module",
"main": "./src/index.js",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@mapbox-controls/helpers": "2.0.0"
"@mapbox-controls/helpers": "2.1.0"
},
"devDependencies": {
"@types/mapbox-gl": "3.1.0",
Expand All @@ -18,11 +18,14 @@
"mapbox-gl": ">=1.0.0 <4.0.0"
},
"types": "./types/index.d.ts",
"files": ["src", "types"],
"files": [
"src",
"types"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": "korywka/mapbox-gl-controls",
"license": "MIT"
}
}
14 changes: 8 additions & 6 deletions packages/inspect/src/icons.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { parseSVG } from '@mapbox-controls/helpers';

const inspect = parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"/>
</svg>
`);
function inspect() {
return parseSVG(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"/>
</svg>
`);
}

export const icons = {
inspect,
Expand Down
2 changes: 1 addition & 1 deletion packages/inspect/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class InspectControl {
this.container = controlContainer('mapbox-ctrl-inspect');
this.button = controlButton({
title: 'Inspect',
icon: icons.inspect,
icon: icons.inspect(),
onClick: () => this.onControlButtonClick(),
});
this.isActive = false;
Expand Down
9 changes: 6 additions & 3 deletions packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapbox-controls/language",
"version": "2.0.0",
"version": "2.1.0",
"description": "Change map language",
"type": "module",
"main": "./src/index.js",
Expand All @@ -15,11 +15,14 @@
"mapbox-gl": ">=1.0.0 <4.0.0"
},
"types": "./types/index.d.ts",
"files": ["src", "types"],
"files": [
"src",
"types"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": "korywka/mapbox-controls",
"license": "MIT"
}
}
Loading

0 comments on commit 64a2091

Please sign in to comment.