Skip to content
Open
Changes from all commits
Commits
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
30 changes: 30 additions & 0 deletions src/core/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,36 @@
import type { NineLayoutTag } from '../utils/NineLayoutTag'
import type { Locale } from './locales'

/**
* Generic options for all plugins.
*
* ## Custom Plugin Positioning ({@link MapConfiguration.layout | Standard Layout})
*
* When `layout` is set to `'standard'`, a custom plugin can be rendered in one of two ways:
*
* 1. **As part of the IconMenu**: Set {@link PluginOptions.renderType | renderType}
* to `'iconMenu'` and configure the plugin in the IconMenu's
* {@link IconMenuPluginOptions.menus | `menus`} configuration.
* The IconMenu will handle positioning and rendering the plugin at the designated location.
*
* 2. **Independent with CSS positioning**: Set {@link PluginOptions.renderType | renderType}
* to `'independent'` (default). The plugin is responsible for its own positioning
* using CSS (e.g., `position: absolute`) within the map container.
*/
export interface PluginOptions {
/**
* Should the component be visible at all.
* Only relevant if {@link MapConfiguration.layout | layout} is set to `'nineRegions'`.
*
* @defaultValue `false`
*/
displayComponent?: boolean

/**
* The region where the plugin should be rendered.
* Required if {@link MapConfiguration.layout | layout} is set to `'nineRegions'`,
* ignored otherwise.
*/
layoutTag?: keyof typeof NineLayoutTag
}

Expand Down Expand Up @@ -106,7 +134,7 @@
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 137 in src/core/types/plugin.ts

View workflow job for this annotation

GitHub Actions / Linting

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 Down Expand Up @@ -194,6 +222,8 @@
* The component will be rendered by POLAR over the map.
* The position is either to be determined by the plugin if `layout === 'standard'`
* or will be determined by the layout.
*
* @see {@link PluginOptions} for configuration details
*/
component?: Component

Expand Down
Loading