Skip to content

Commit 67bf791

Browse files
committed
Merge branch 'next' into feature/draw-migration
2 parents a823ad6 + c1f8354 commit 67bf791

12 files changed

Lines changed: 299 additions & 167 deletions

File tree

package-lock.json

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

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
"./plugins/*/store": {
3737
"types": "./dist/plugin-*-store.d.ts",
3838
"default": "./dist/plugin-*-store.js"
39+
},
40+
"./lib/*": {
41+
"types": "./dist/lib/*.d.ts",
42+
"default": "./dist/lib/*.js"
3943
}
4044
},
4145
"repository": {
@@ -127,23 +131,25 @@
127131
"magic-string": "^0.30.18",
128132
"ol": "10.9.0",
129133
"pinia": "^4.0.2",
130-
"postcss-html": "^1.8.1",
134+
"postcss-html": "^2.0.0",
131135
"prettier": "^3.9.6",
132136
"stylelint": "^17.14.1",
133-
"stylelint-config-recommended-vue": "^1.6.1",
137+
"stylelint-config-html": "^2.0.0",
138+
"stylelint-config-recommended": "^18.0.0",
139+
"stylelint-config-recommended-vue": "^2.0.0",
134140
"stylelint-value-no-unknown-custom-properties": "^6.1.1",
135141
"tsarch": "^5.4.1",
136142
"typedoc": "^0.28.20",
137143
"typedoc-plugin-vue": "^1.5.0",
138144
"typescript": "~5.9.2",
139145
"unplugin-dts": "^1.0.3",
140-
"vite": "^8.2.0",
146+
"vite": "^8.2.1",
141147
"vite-plugin-checker": "^0.14.5",
142148
"vite-plugin-commonjs": "^0.10.4",
143149
"vite-plugin-kern-extra-icons": "^1.0.1",
144150
"vite-plugin-vue-devtools": "^8.2.1",
145151
"vitest": "^4.1.10",
146-
"vue": "^3.5.40",
152+
"vue": "^3.5.41",
147153
"vue-tsc": "^3.3.9"
148154
},
149155
"//": "Relevant overrides until the respective packages fix these vulnerable versions themselves.",

src/lib/getCluster.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import VectorLayer from 'ol/layer/Vector'
88
* Helper function to retrieve the related cluster of a feature.
99
* Returns the feature if it's a cluster feature, or the cluster the feature is in.
1010
*/
11-
export default function (map: Map, feature: Feature, layerId: string): Feature {
11+
export default function getCluster(
12+
map: Map,
13+
feature: Feature,
14+
layerId: string
15+
): Feature {
1216
if (feature.get('features')) {
1317
return feature
1418
}

src/lib/getFeatures/bkg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function getRequestUrlQuery(
3434
return query
3535
}
3636

37-
export default async function (
37+
export default async function bkg(
3838
signal: AbortSignal,
3939
url: string,
4040
inputValue: string,

src/lib/getFeatures/mpapi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { transform } from 'ol/proj'
77

88
// AbortSignal is not used as the AbortController is implemented by @masterportal/masterportalapi
99

10-
export default async function (
10+
export default async function mpapi(
1111
_: AbortSignal,
1212
url: string,
1313
input: string,
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { Map } from 'ol'
2+
import type { Coordinate } from 'ol/coordinate'
3+
import type VectorSource from 'ol/source/Vector'
4+
import type { Ref } from 'vue'
5+
6+
import { Feature } from 'ol'
7+
import { Point } from 'ol/geom'
8+
import VectorLayer from 'ol/layer/Vector'
9+
import { Circle, Fill, Stroke, Style } from 'ol/style'
10+
import { onScopeDispose, watch } from 'vue'
11+
12+
export function useMarkerLayer(
13+
map: Map,
14+
markerSource: VectorSource,
15+
route: Ref<Coordinate[]>
16+
) {
17+
const layer = new VectorLayer({
18+
source: markerSource,
19+
style: new Style({
20+
image: new Circle({
21+
radius: 6,
22+
fill: new Fill({ color: '#1E90FF' }),
23+
stroke: new Stroke({ color: 'white', width: 2 }),
24+
}),
25+
}),
26+
})
27+
28+
map.addLayer(layer)
29+
onScopeDispose(() => {
30+
map.removeLayer(layer)
31+
})
32+
33+
watch(route, () => {
34+
markerSource.clear()
35+
route.value.forEach((coordinate) => {
36+
if (coordinate.length) {
37+
markerSource.addFeature(
38+
new Feature({
39+
geometry: new Point(coordinate),
40+
})
41+
)
42+
}
43+
})
44+
})
45+
}

src/plugins/routing/composables/useLayer.ts renamed to src/plugins/routing/composables/useRouteLayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import VectorLayer from 'ol/layer/Vector'
55
import { Stroke, Style } from 'ol/style'
66
import { onScopeDispose } from 'vue'
77

8-
export function useLayer(map: Map, routeSource: VectorSource) {
8+
export function useRouteLayer(map: Map, routeSource: VectorSource) {
99
const layer = new VectorLayer({
1010
source: routeSource,
1111
style: new Style({

src/plugins/routing/store.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import { computed, ref, watch } from 'vue'
2525
import { useCoreStore } from '@/core/stores'
2626
import { computedT } from '@/lib/computedT'
2727

28-
import { useLayer } from './composables/useLayer'
28+
import { useMarkerLayer } from './composables/useMarkerLayer'
29+
import { useRouteLayer } from './composables/useRouteLayer'
2930
import { PluginId } from './types'
3031
import { handleErrors } from './utils/handleErrors'
3132

@@ -40,6 +41,7 @@ export const useRoutingStore = defineStore('plugins/routing', () => {
4041
const coreStore = useCoreStore()
4142

4243
const routeSource = new VectorSource()
44+
const markerSource = new VectorSource()
4345
let abortController: AbortController | null = null
4446
let draw: Draw | undefined
4547

@@ -270,7 +272,8 @@ export const useRoutingStore = defineStore('plugins/routing', () => {
270272
selectedRouteTypesToAvoid.value = []
271273
})
272274

273-
useLayer(coreStore.map, routeSource)
275+
useRouteLayer(coreStore.map, routeSource)
276+
useMarkerLayer(coreStore.map, markerSource, route)
274277

275278
function setupPlugin() {
276279
initializeDraw()
@@ -312,6 +315,7 @@ export const useRoutingStore = defineStore('plugins/routing', () => {
312315
selectedRouteTypesToAvoid.value = []
313316
routingResponseData.value = null
314317
routeSource.clear()
318+
markerSource.clear()
315319

316320
if (abortController) {
317321
abortController.abort()

vite.config.github-io.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ export default defineConfig({
1818
}),
1919
],
2020
build: {
21-
outDir: resolve(__dirname, 'examples', 'github-io', 'dist'),
21+
outDir: resolve(import.meta.dirname, 'examples', 'github-io', 'dist'),
2222
emptyOutDir: true,
2323
rollupOptions: {
2424
external: ['@polar/polar', '@polar/polar/client', '@polar/polar/store'],
25-
input: resolve(__dirname, 'examples', 'github-io', 'index.html'),
25+
input: resolve(
26+
import.meta.dirname,
27+
'examples',
28+
'github-io',
29+
'index.html'
30+
),
2631
output: {
2732
entryFileNames: '[name].js',
2833
chunkFileNames: '[name].js',

vite.config.preview.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,25 @@ export default defineConfig({
2929
outDir: '.dist.preview',
3030
rollupOptions: {
3131
input: {
32-
main: resolve(__dirname, 'index.html'),
33-
snowbox: resolve(__dirname, 'examples', 'snowbox', 'index.html'),
34-
iceberg: resolve(__dirname, 'examples', 'iceberg', 'index.html'),
35-
githubIo: resolve(__dirname, 'examples', 'github-io', 'index.html'),
32+
main: resolve(import.meta.dirname, 'index.html'),
33+
snowbox: resolve(
34+
import.meta.dirname,
35+
'examples',
36+
'snowbox',
37+
'index.html'
38+
),
39+
iceberg: resolve(
40+
import.meta.dirname,
41+
'examples',
42+
'iceberg',
43+
'index.html'
44+
),
45+
githubIo: resolve(
46+
import.meta.dirname,
47+
'examples',
48+
'github-io',
49+
'index.html'
50+
),
3651
},
3752
},
3853
},

0 commit comments

Comments
 (0)