Added docs for interfaces
This commit is contained in:
@@ -2,15 +2,11 @@
|
|||||||
import type { MapMarker, PlayerMarker } from '@/types/Leaflet';
|
import type { MapMarker, PlayerMarker } from '@/types/Leaflet';
|
||||||
import type { MapProps } from '@/types/Map';
|
import type { MapProps } from '@/types/Map';
|
||||||
import MarkerCreator from './overlay/MarkerCreator.vue';
|
import MarkerCreator from './overlay/MarkerCreator.vue';
|
||||||
import { t } from '@/i18n/store';
|
|
||||||
import { getLangFromUrl } from '@/i18n/utils';
|
|
||||||
import { normalizeString } from '@/utils/Strings';
|
|
||||||
import MarkerContent from './MarkerContent.astro';
|
import MarkerContent from './MarkerContent.astro';
|
||||||
|
|
||||||
interface Props extends MapProps {}
|
interface Props extends MapProps {}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
title,
|
|
||||||
mapKey,
|
mapKey,
|
||||||
zoomifyKey,
|
zoomifyKey,
|
||||||
mapHeight, //
|
mapHeight, //
|
||||||
|
|||||||
@@ -7,26 +7,90 @@ export type MapCoords = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type MapMarker = {
|
export type MapMarker = {
|
||||||
|
/**
|
||||||
|
* The title of the marker (must be unique).
|
||||||
|
*/
|
||||||
title: string,
|
title: string,
|
||||||
|
/**
|
||||||
|
* The coordinates of the marker.
|
||||||
|
* @example { x: 123, y: 456 }
|
||||||
|
*/
|
||||||
markerCoords: MapCoords,
|
markerCoords: MapCoords,
|
||||||
|
/**
|
||||||
|
* The description of the marker.
|
||||||
|
*/
|
||||||
description?: string,
|
description?: string,
|
||||||
|
/**
|
||||||
|
* The link that can appear on the marker title.
|
||||||
|
* @example https://example.com
|
||||||
|
*/
|
||||||
link?: string,
|
link?: string,
|
||||||
|
/**
|
||||||
|
* The ID of the map the marker is supposed to point to.
|
||||||
|
*
|
||||||
|
* This should be a valid path of the `maps/data` folder.
|
||||||
|
* @example "fr/aldys/borelis"
|
||||||
|
*/
|
||||||
mapId?: string,
|
mapId?: string,
|
||||||
|
/**
|
||||||
|
* The group that the marker belongs to.
|
||||||
|
* @example "capitals"
|
||||||
|
*/
|
||||||
group?: MapMarkerGroup,
|
group?: MapMarkerGroup,
|
||||||
|
/**
|
||||||
|
* The icon that the marker should use.
|
||||||
|
* @example "castle"
|
||||||
|
*/
|
||||||
icon?: MapMarkerIcon,
|
icon?: MapMarkerIcon,
|
||||||
|
/**
|
||||||
|
* Cover image for the marker.
|
||||||
|
* This should be a valid image in the public folder.
|
||||||
|
*
|
||||||
|
* @example "Ambrose.webp"
|
||||||
|
*/
|
||||||
cover?: string,
|
cover?: string,
|
||||||
|
/**
|
||||||
|
* The link to the cover image's source.
|
||||||
|
*/
|
||||||
coverLink?: string,
|
coverLink?: string,
|
||||||
|
/**
|
||||||
|
* The author of the cover image.
|
||||||
|
*/
|
||||||
coverAuthor?: string,
|
coverAuthor?: string,
|
||||||
|
/**
|
||||||
|
* Whether the cover image should be displayed in portrait mode.
|
||||||
|
*/
|
||||||
coverPortrait?: boolean
|
coverPortrait?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A marker that is used to display players' location on the map.
|
||||||
|
*/
|
||||||
export type PlayerMarker = {
|
export type PlayerMarker = {
|
||||||
|
/**
|
||||||
|
* The title of the marker (must be unique).
|
||||||
|
*/
|
||||||
title: string,
|
title: string,
|
||||||
|
/**
|
||||||
|
* The coordinates of the marker.
|
||||||
|
* @example { x: 123, y: 456 }
|
||||||
|
*/
|
||||||
markerCoords: MapCoords,
|
markerCoords: MapCoords,
|
||||||
|
/**
|
||||||
|
* The description of the marker.
|
||||||
|
*/
|
||||||
description?: string,
|
description?: string,
|
||||||
|
/**
|
||||||
|
* The link that can appear on the marker title.
|
||||||
|
* @example https://example.com
|
||||||
|
*/
|
||||||
link?: string,
|
link?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A marker that is used to display a custom location on the map.
|
||||||
|
* These are only used on the client side and are not saved anywhere else.
|
||||||
|
*/
|
||||||
export type CustomMarker = {
|
export type CustomMarker = {
|
||||||
lat: number,
|
lat: number,
|
||||||
lon: number,
|
lon: number,
|
||||||
|
|||||||
@@ -1,34 +1,105 @@
|
|||||||
import type { MapMarker, PlayerMarker } from "./Leaflet"
|
import type { MapMarker, PlayerMarker } from "./Leaflet"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A breadcrumb item.
|
||||||
|
*/
|
||||||
export interface BreadcrumbItem {
|
export interface BreadcrumbItem {
|
||||||
|
/**
|
||||||
|
* The label of the breadcrumb.
|
||||||
|
*/
|
||||||
name: string
|
name: string
|
||||||
|
/**
|
||||||
|
* The URL the breadcrumb points to.
|
||||||
|
*/
|
||||||
url: string
|
url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search configuration options for the map overlay.
|
||||||
|
* This is used to filter the markers on the map.
|
||||||
|
*/
|
||||||
export interface SearchConfig {
|
export interface SearchConfig {
|
||||||
|
/** Whether to disable the quests in the search bar. */
|
||||||
disableQuests?: boolean
|
disableQuests?: boolean
|
||||||
|
/** Whether to disable the capitals in the search bar. */
|
||||||
disableCapitals?: boolean
|
disableCapitals?: boolean
|
||||||
|
/** Whether to disable the landmarks in the search bar. */
|
||||||
disableLandmarks?: boolean
|
disableLandmarks?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MapProps {
|
export interface MapProps {
|
||||||
title: string
|
/**
|
||||||
|
* The ID of the map.
|
||||||
|
* This is used to identify the map and store custom markers in the local storage.
|
||||||
|
* @example "fr/aldys/borelis"
|
||||||
|
*/
|
||||||
mapKey: string
|
mapKey: string
|
||||||
|
/**
|
||||||
|
* The ID of the map in the zoomify folder.
|
||||||
|
*/
|
||||||
zoomifyKey: string
|
zoomifyKey: string
|
||||||
|
/**
|
||||||
|
* Height of the map in pixels.
|
||||||
|
* This information is generated by the zoomify tool.
|
||||||
|
* @example 30000
|
||||||
|
*/
|
||||||
mapHeight: number
|
mapHeight: number
|
||||||
|
/**
|
||||||
|
* Width of the map in pixels.
|
||||||
|
* This information is generated by the zoomify tool.
|
||||||
|
* @example 30000
|
||||||
|
*/
|
||||||
mapWidth: number
|
mapWidth: number
|
||||||
|
/**
|
||||||
|
* List of markers to display on the map.
|
||||||
|
*/
|
||||||
markers?: MapMarker[]
|
markers?: MapMarker[]
|
||||||
|
/**
|
||||||
|
* Current player position on the map.
|
||||||
|
*/
|
||||||
players?: PlayerMarker
|
players?: PlayerMarker
|
||||||
|
/**
|
||||||
|
* Main unit of the map.
|
||||||
|
*/
|
||||||
rulerMainUnit?: string
|
rulerMainUnit?: string
|
||||||
|
/**
|
||||||
|
* Ratio used to convert the map units to their relevant unit.
|
||||||
|
*/
|
||||||
rulerDistanceRatio?: number
|
rulerDistanceRatio?: number
|
||||||
|
/**
|
||||||
|
* Whether to show the walking distance in the ruler.
|
||||||
|
*/
|
||||||
rulerHideWalkDistance?: boolean
|
rulerHideWalkDistance?: boolean
|
||||||
|
/**
|
||||||
|
* Default background color of the map.
|
||||||
|
* @exemple "#FFF"
|
||||||
|
*/
|
||||||
backgroundColor?: string
|
backgroundColor?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MapOverlayProps {
|
export interface MapOverlayProps {
|
||||||
|
/**
|
||||||
|
* The ID of the map.
|
||||||
|
* This is used to identify the map and store custom markers in the local storage.
|
||||||
|
* @example "fr/aldys/borelis"
|
||||||
|
*/
|
||||||
mapKey: string
|
mapKey: string
|
||||||
|
/**
|
||||||
|
* List of markers to display on the map.
|
||||||
|
*/
|
||||||
markers?: MapMarker[]
|
markers?: MapMarker[]
|
||||||
|
/**
|
||||||
|
* Current player position on the map.
|
||||||
|
*/
|
||||||
players?: PlayerMarker
|
players?: PlayerMarker
|
||||||
|
/**
|
||||||
|
* Configuration for the search bar.
|
||||||
|
* This is used to filter the markers on the map.
|
||||||
|
* @example { disableQuests: true, disableCapitals: false, disableLandmarks: false }
|
||||||
|
*/
|
||||||
searchConfig?: SearchConfig
|
searchConfig?: SearchConfig
|
||||||
|
/**
|
||||||
|
* List of breadcrumbs to display.
|
||||||
|
*/
|
||||||
breadcrumbs?: BreadcrumbItem[]
|
breadcrumbs?: BreadcrumbItem[]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user