Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
91ab04e
refactor(pins): add basic plugin skeleton
dopenguin Sep 29, 2025
556ea7f
refactor(pins): add basic description from README and package.json to…
dopenguin Sep 29, 2025
142e9d0
refactor(pins): add types as well as state and getters
dopenguin Sep 30, 2025
b35b076
refactor(pins): add locales
dopenguin Sep 30, 2025
b5f1af0
refactor(pins): implement pins store and utility functions in pinia
dopenguin Oct 2, 2025
1893147
refactor(pins): move isCoordinateInBoundaryLayer to a separate file
dopenguin Oct 2, 2025
c696701
refactor(pins): add description for pins store
dopenguin Oct 6, 2025
38b35aa
refactor(pins): update todo
dopenguin Oct 6, 2025
aeebf9b
refactor(pins): update another todo to be tackled later
dopenguin Oct 6, 2025
eabad28
Merge branch 'vue3/migrate-lib-passes-boundary-check' into vue3/migra…
dopenguin Oct 21, 2025
5d7ea96
refactor: add pins resources to type
dopenguin Oct 21, 2025
97c0b9f
fix(pins): add missing empty lines
dopenguin Oct 21, 2025
2e2ced5
refactor(pins): add implementation to check whether a coordinate is i…
dopenguin Oct 21, 2025
9f15648
refactor(pins): update todo to be tackled later
dopenguin Oct 21, 2025
c4550e7
fix(pins): add missing empty lines
dopenguin Oct 21, 2025
25fcef9
fix(pins): await calls to isCoordinateInBoundaryLayer and subsequent …
dopenguin Oct 21, 2025
5895a62
Merge branch 'next' into vue3/migrate-plugin-pins
dopenguin Oct 21, 2025
bb8feca
fix(pins): use relative import to fix cyclic dependency
dopenguin Oct 21, 2025
38eec3c
Merge branch 'next' into vue3/migrate-plugin-pins
dopenguin Oct 21, 2025
97743b9
fix(pins): add missing space
dopenguin Oct 21, 2025
af285b3
refactor(pins): update configuration parameter coordinateSource to al…
dopenguin Oct 21, 2025
2002afd
fix(pins): use correct parameter in example
dopenguin Oct 21, 2025
2f6c0d3
feat(pins): add tsdoc to coordinate
dopenguin Oct 21, 2025
84aadd5
feat(pins): add possibility to configure a different SVG
dopenguin Oct 21, 2025
0acb11d
feat: add pins example to snowbox
dopenguin Oct 21, 2025
3ce54b8
Merge branch 'next' into vue3/migrate-plugin-pins
dopenguin Oct 28, 2025
4d0611b
Merge branch 'next' into vue3/migrate-plugin-pins
dopenguin Oct 29, 2025
98049bb
Merge branch 'vue3/refactor-enhance-defaulted-configuration' into vue…
dopenguin Nov 12, 2025
a4c9401
refactor(pins): remove now redundant type assertions
dopenguin Nov 12, 2025
5d9523d
Merge branch 'vue3/refactor-enhance-defaulted-configuration' into vue…
dopenguin Nov 14, 2025
52b0eda
Merge branch 'next' into vue3/migrate-plugin-pins
dopenguin Dec 3, 2025
8afe81f
fix(pins): return correct value for getter latLon
dopenguin Dec 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion examples/snowbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pluginIconMenu from '@polar/polar/plugins/iconMenu'
import pluginLayerChooser from '@polar/polar/plugins/layerChooser'
import pluginLoadingIndicator from '@polar/polar/plugins/loadingIndicator'
import pluginPins from '@polar/polar/plugins/pins'
import pluginToast from '@polar/polar/plugins/toast'
import EmptyComponent from './EmptyComponent.vue'
import styleJsonUrl from './style.json?url'
Expand All @@ -22,7 +23,7 @@
const ausgleichsflaechen = '1454'
const reports = '6059'
const denkmal = 'denkmaelerWMS'
// const hamburgBorder = '1693' // boundary layer for pins / geolocalization
const hamburgBorder = '1693'

let colorScheme = 'light'
// eslint-disable-next-line no-unused-vars
Expand Down Expand Up @@ -58,7 +59,7 @@
},
}

// TODO: Re-enable with isSelectable

Check warning on line 62 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: Re-enable with isSelectable'
/*
// arbitrary condition for testing
const isEvenId = (mmlid) => Number(mmlid.slice(-1)) % 2 === 0
Expand All @@ -78,7 +79,7 @@
colorScheme,
startCenter: [573364, 6028874],
layers: [
// TODO: Add internalization to snowbox

Check warning on line 82 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: Add internalization to snowbox'
{
id: basemapId,
visibility: true,
Expand All @@ -91,6 +92,13 @@
name: 'Basemap.de (Grau)',
maxZoom: 6,
},
{
id: hamburgBorder,
visibility: true,
hideInMenu: true,
type: 'mask',
name: 'meldemichel.layers.hamburgBorder',
},
{
id: reports,
type: 'mask',
Expand Down Expand Up @@ -151,14 +159,14 @@
stroke: '#FFFFFF',
fill: '#333333',
},
// TODO(dopenguin): Has some HMR issues, needs to be fixed

Check warning on line 162 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO(dopenguin): Has some HMR issues,...'
// isSelectable: isReportSelectable,
},
],
clusterClickZoom: true,
},
// theme: dataportTheme,
/*

Check warning on line 169 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO(dopenguin): Surrounding application...'
TODO(dopenguin): Surrounding application should be able give information about dark or light mode via update of a state parameter; light mode by default
*/
locales: [
Expand Down Expand Up @@ -224,6 +232,19 @@
loaderStyle: 'BasicLoader',
})
)
addPlugin(
map,
pluginPins({
boundary: {
layerId: hamburgBorder,
},
movable: 'drag',
style: {
fill: '#FF0019',
},
toZoomLevel: 7,
})
)
addPlugin(
map,
pluginIconMenu({
Expand All @@ -241,7 +262,7 @@
},
],
menus: [
// TODO: Delete the mock plugins including the components once the correct plugins have been implemented

Check warning on line 265 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: Delete the mock plugins including...'
[
{
plugin: pluginGeoLocation({
Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"@material-symbols/svg-400": "^0.38.0",
"@pinia/testing": "^1.0.2",
"@repositoryname/noop": "^1.0.6",
"@types/geojson": "7946.0.16",
"@types/node": "^24.3.1",
"@vitejs/plugin-vue": "^6.0.1",
"@vitest/coverage-v8": "^3.2.4",
Expand Down
25 changes: 9 additions & 16 deletions src/core/types/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import type { GeoLocationPluginOptions } from '@/plugins/geoLocation'
import type { IconMenuPluginOptions } from '@/plugins/iconMenu'
import type { LoadingIndicatorOptions } from '@/plugins/loadingIndicator'
import type { PinsPluginOptions } from '@/plugins/pins'
import type { ToastPluginOptions } from '@/plugins/toast'

export interface ServiceAvailabilityCheck {
Expand Down Expand Up @@ -286,32 +287,24 @@
theme?: PolarTheme
// Plugins are not sorted alphabetical, but listed last.
// Remember to sort them alphabetical inside their space.
// TODO: Generate this section via types/plugin.ts

Check warning on line 290 in src/core/types/main.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: Generate this section via...'
/* eslint-disable perfectionist/sort-interfaces */

/**
* Configuration for fullscreen plugin.
*/
/** Configuration for fullscreen plugin. */
fullscreen?: FullscreenPluginOptions

/**
* Configuration for geoLocation plugin.
*/
/** Configuration for geoLocation plugin. */
geoLocation?: GeoLocationPluginOptions

/**
* Configuration for iconMenu plugin.
*/
/** Configuration for iconMenu plugin. */
iconMenu?: IconMenuPluginOptions

/**
* Configuration for loadingIndicator plugin.
*/
/** Configuration for loadingIndicator plugin. */
loadingIndicator?: LoadingIndicatorOptions

/**
* Configuration for toast plugin.
*/
/** Configuration for pins plugin. */
pins?: PinsPluginOptions

/** Configuration for toast plugin. */
toast?: ToastPluginOptions
/* eslint-enable perfectionist/sort-interfaces */
}
Expand Down
7 changes: 7 additions & 0 deletions src/core/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
import type { PluginId as LoadingIndicatorId } from '@/plugins/loadingIndicator'
import type { useLoadingIndicatorStore as LoadingIndicatorStore } from '@/plugins/loadingIndicator/store'

import type { PluginId as PinsPluginId } from '@/plugins/pins'
import type { usePinsStore as PinsStore } from '@/plugins/pins/store'
import type { resourcesEn as PinsResources } from '@/plugins/pins/locales'

import type { PluginId as ToastPluginId } from '@/plugins/toast'
import type { useToastStore as ToastStore } from '@/plugins/toast/store'
import type { resourcesEn as ToastResources } from '@/plugins/toast/locales'
Expand Down Expand Up @@ -80,12 +84,13 @@
| typeof IconMenuPluginId
| typeof LayerChooserPluginId
| typeof LoadingIndicatorId
| typeof PinsPluginId
| typeof ToastPluginId

type GetPluginStore<
T extends BundledPluginId,
I extends BundledPluginId,
// TODO: This fixes the type error, but relaxes type-checking for the plugin store too much.

Check warning on line 93 in src/core/types/plugin.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: This fixes the type error, but...'
// However, it is not clear if Pinia's type system allows for stronger checks at the moment.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
S extends PolarPluginStore<any>,
Expand All @@ -98,6 +103,7 @@
| GetPluginStore<T, typeof IconMenuPluginId, typeof IconMenuStore>
| GetPluginStore<T, typeof LayerChooserPluginId, typeof LayerChooserStore>
| GetPluginStore<T, typeof LoadingIndicatorId, typeof LoadingIndicatorStore>
| GetPluginStore<T, typeof PinsPluginId, typeof PinsStore>
| GetPluginStore<T, typeof ToastPluginId, typeof ToastStore>

type GetPluginResources<
Expand All @@ -120,6 +126,7 @@
typeof LayerChooserPluginId,
typeof LayerChooserResources
>
| GetPluginResources<T, typeof PinsPluginId, typeof PinsResources>
| GetPluginResources<T, typeof ToastPluginId, typeof ToastResources>

/** @internal */
Expand Down
33 changes: 33 additions & 0 deletions src/plugins/pins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable tsdoc/syntax */
/**
* @module \@polar/polar/plugins/pins
*/
/* eslint-enable tsdoc/syntax */

import locales from './locales'
import { usePinsStore } from './store'
import { PluginId, type PinsPluginOptions } from './types'
import type { PluginContainer, PolarPluginStore } from '@/core'

/**
* Pins plugin for POLAR that adds map interactions to client that allow users
* to indicate a specific point on the map.
*
* The plugin handles marking locations. Embedding processes can then use that
* coordinate for further steps. The plugin may react to other plugins,
* especially address searches.
*
* @returns Plugin for use with {@link addPlugin}.
*/
export default function pluginPins(
options: PinsPluginOptions
): PluginContainer {
return {
id: PluginId,
locales,
storeModule: usePinsStore as PolarPluginStore,
options,
}
}

export * from './types'
51 changes: 51 additions & 0 deletions src/plugins/pins/locales.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable tsdoc/syntax */
/**
* This is the documentation for the locales keys in the pins plugin.
* These locales are *NOT* exported, but documented only.
*
* @module locales/plugins/pins
*/
/* eslint-enable tsdoc/syntax */

import type { Locale } from '@/core'

/**
* German locales for pins plugin.
* For overwriting these values, use the plugin's ID as namespace.
*/
export const resourcesDe = {
boundaryError:
'Die Überprüfung der Koordinate ist fehlgeschlagen. Bitte versuchen Sie es später erneut oder wenden Sie sich an einen Administrator, wenn das Problem bestehen bleibt.',
notInBoundary: 'Diese Koordinate kann nicht gewählt werden.',
} as const

/**
* English locales for pins plugin.
* For overwriting these values, use the plugin's ID as namespace.
*/
export const resourcesEn = {
boundaryError:
'Validating the coordinate failed. Please try again later or contact an administrator if the issue persists.',
notInBoundary: 'It is not possible to select this coordinate.',
} as const

/**
* Pins plugin locales.
*
* @privateRemarks
* The first entry will be used as fallback.
*
* @internal
*/
const locales: Locale[] = [
{
type: 'de',
resources: resourcesDe,
},
{
type: 'en',
resources: resourcesEn,
},
]

export default locales
Loading
Loading