Skip to content

Commit 908787c

Browse files
authored
Type fixes (#37)
* chore(release): 1.0.14 * chore(release): 1.0.15 * update Style type fix
1 parent 7e9ccbe commit 908787c

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [1.0.15](https://github.com/BryonLewis/vue-maplibre-compare/compare/v1.0.4...v1.0.15) (2025-12-12)
6+
7+
### [1.0.14](https://github.com/BryonLewis/vue-maplibre-compare/compare/v1.0.4...v1.0.14) (2025-12-12)
8+
59
### [1.0.13](https://github.com/BryonLewis/vue-maplibre-compare/compare/v1.0.12...v1.0.13) (2025-12-03)
610

711
### [1.0.12](https://github.com/BryonLewis/vue-maplibre-compare/compare/v1.0.11...v1.0.12) (2025-12-02)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-maplibre-compare",
3-
"version": "1.0.13",
3+
"version": "1.0.15",
44
"description": "A Vue 3 component for comparing MapLibre maps side-by-side with a slider",
55
"type": "module",
66
"main": "./dist/vue-maplibre-compare.umd.js",

src/use/useStyleCompare.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ export function useStyleCompare(options: StyleCompareOptions) {
1717
// Store current styles
1818
let currentStyleA = baseStyleA;
1919
let currentStyleB = baseStyleB;
20-
function updateStyle(targetMap: 'A' | 'B', newStyle: StyleSpecification) {
20+
function updateStyle(targetMap: 'A' | 'B', newStyle: StyleSpecification | string) {
21+
if (typeof newStyle === 'string') return;
2122
const currentStyle = targetMap === 'A' ? currentStyleA : currentStyleB;
2223
// Check the sources and layers for the new map
2324
const currentSourceKeys = new Set(Object.keys(currentStyle.sources || {}));
24-
const newSourceKeys = new Set(Object.keys(newStyle.sources || {}));
25+
const newSourceKeys = new Set(Object.keys(typeof newStyle === 'string' ? {} : newStyle?.sources || {}));
2526
// Get new and removed sources
2627
const sourcesToAdd = Array.from(newSourceKeys).filter((key) => !currentSourceKeys.has(key));
2728
const sourcesToRemove = Array.from(currentSourceKeys).filter((key) => !newSourceKeys.has(key));
@@ -46,7 +47,7 @@ export function useStyleCompare(options: StyleCompareOptions) {
4647
});
4748
// then add new sources
4849
sourcesToAdd.forEach((sourceId) => {
49-
const sourceDef = newStyle.sources ? newStyle.sources[sourceId] : undefined;
50+
const sourceDef = newStyle?.sources ? newStyle.sources[sourceId] : undefined;
5051
if (sourceDef) {
5152
if (!targetMapInstance.getSource(sourceId)) {
5253
targetMapInstance.addSource(sourceId, sourceDef);

0 commit comments

Comments
 (0)