Reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2022-09-08 21:40:48 +02:00
parent e22d189376
commit b541d3eab4
382 changed files with 50893 additions and 35566 deletions

View file

@ -1,7 +1,6 @@
import {TagConfigJson} from "./TagConfigJson";
import { TagConfigJson } from "./TagConfigJson"
export interface DeleteConfigJson {
/***
* By default, three reasons to delete a point are shown:
*
@ -21,7 +20,7 @@ export interface DeleteConfigJson {
/**
* The text that will be shown to the user - translatable
*/
explanation: string | any,
explanation: string | any
/**
* The text that will be uploaded into the changeset or will be used in the fixme in case of a soft deletion
* Should be a few words, in english
@ -41,12 +40,12 @@ export interface DeleteConfigJson {
* The tags that will be given to the object.
* This must remove tags so that the 'source/osmTags' won't match anymore
*/
if: TagConfigJson,
if: TagConfigJson
/**
* The human explanation for the options
*/
then: string | any,
}[],
then: string | any
}[]
/**
* In some cases, the contributor is not allowed to delete the current feature (e.g. because it isn't a point, the point is referenced by a relation or the user isn't experienced enough).
@ -67,11 +66,10 @@ export interface DeleteConfigJson {
* }
* ```
*/
softDeletionTags?: TagConfigJson,
softDeletionTags?: TagConfigJson
/***
* By default, the contributor needs 20 previous changesets to delete points edited by others.
* For some small features (e.g. bicycle racks) this is too much and this requirement can be lowered or dropped, which can be done here.
*/
neededChangesets?: number
}
}

View file

@ -1,7 +1,7 @@
export default interface ExtraLinkConfigJson {
icon?: string,
text?: string | any,
href: string,
newTab?: false | boolean,
icon?: string
text?: string | any
href: string
newTab?: false | boolean
requirements?: ("iframe" | "no-iframe" | "welcome-message" | "no-welcome-message")[]
}
}

View file

@ -1,10 +1,10 @@
import {TagConfigJson} from "./TagConfigJson";
import { TagConfigJson } from "./TagConfigJson"
export default interface FilterConfigJson {
/**
* An id/name for this filter, used to set the URL parameters
*/
id: string,
id: string
/**
* The options for a filter
* If there are multiple options these will be a list of radio buttons
@ -12,15 +12,15 @@ export default interface FilterConfigJson {
* Filtering is done based on the given osmTags that are compared to the objects in that layer.
*/
options: {
question: string | any;
osmTags?: TagConfigJson,
default?: boolean,
question: string | any
osmTags?: TagConfigJson
default?: boolean
fields?: {
/**
* If name is `search`, use "_first_comment~.*{search}.*" as osmTags
*/
name: string,
name: string
type?: string | "string"
}[]
}[];
}
}[]
}

View file

@ -1,13 +1,13 @@
import {TagConfigJson} from "./TagConfigJson";
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
import FilterConfigJson from "./FilterConfigJson";
import {DeleteConfigJson} from "./DeleteConfigJson";
import UnitConfigJson from "./UnitConfigJson";
import MoveConfigJson from "./MoveConfigJson";
import PointRenderingConfigJson from "./PointRenderingConfigJson";
import LineRenderingConfigJson from "./LineRenderingConfigJson";
import {QuestionableTagRenderingConfigJson} from "./QuestionableTagRenderingConfigJson";
import RewritableConfigJson from "./RewritableConfigJson";
import { TagConfigJson } from "./TagConfigJson"
import { TagRenderingConfigJson } from "./TagRenderingConfigJson"
import FilterConfigJson from "./FilterConfigJson"
import { DeleteConfigJson } from "./DeleteConfigJson"
import UnitConfigJson from "./UnitConfigJson"
import MoveConfigJson from "./MoveConfigJson"
import PointRenderingConfigJson from "./PointRenderingConfigJson"
import LineRenderingConfigJson from "./LineRenderingConfigJson"
import { QuestionableTagRenderingConfigJson } from "./QuestionableTagRenderingConfigJson"
import RewritableConfigJson from "./RewritableConfigJson"
/**
* Configuration for a single layer
@ -17,7 +17,7 @@ export interface LayerConfigJson {
* The id of this layer.
* This should be a simple, lowercase, human readable string that is used to identify the layer.
*/
id: string;
id: string
/**
* The name of this layer
@ -31,8 +31,7 @@ export interface LayerConfigJson {
* A description for this layer.
* Shown in the layer selections and in the personel theme
*/
description?: string | any;
description?: string | any
/**
* This determines where the data for the layer is fetched: from OSM or from an external geojson dataset.
@ -42,69 +41,69 @@ export interface LayerConfigJson {
* Every source _must_ define which tags _must_ be present in order to be picked up.
*
*/
source:
({
/**
* Every source must set which tags have to be present in order to load the given layer.
*/
osmTags: TagConfigJson
/**
* The maximum amount of seconds that a tile is allowed to linger in the cache
*/
maxCacheAge?: number
}) &
({
/**
* If set, this custom overpass-script will be used instead of building one by using the OSM-tags.
* Specifying OSM-tags is still obligatory and will still hide non-matching items and they will be used for the rest of the pipeline.
* _This should be really rare_.
*
* For example, when you want to fetch all grass-areas in parks and which are marked as publicly accessible:
* ```
* "source": {
* "overpassScript":
* "way[\"leisure\"=\"park\"];node(w);is_in;area._[\"leisure\"=\"park\"];(way(area)[\"landuse\"=\"grass\"]; node(w); );",
* "osmTags": "access=yes"
* }
* ```
*
*/
overpassScript?: string
} |
{
/**
* The actual source of the data to load, if loaded via geojson.
*
* # A single geojson-file
* source: {geoJson: "https://my.source.net/some-geo-data.geojson"}
* fetches a geojson from a third party source
*
* # A tiled geojson source
* source: {geoJson: "https://my.source.net/some-tile-geojson-{layer}-{z}-{x}-{y}.geojson", geoJsonZoomLevel: 14}
* to use a tiled geojson source. The web server must offer multiple geojsons. {z}, {x} and {y} are substituted by the location; {layer} is substituted with the id of the loaded layer
*
* Some API's use a BBOX instead of a tile, this can be used by specifying {y_min}, {y_max}, {x_min} and {x_max}
*/
geoJson: string,
/**
* To load a tiled geojson layer, set the zoomlevel of the tiles
*/
geoJsonZoomLevel?: number,
/**
* Indicates that the upstream geojson data is OSM-derived.
* Useful for e.g. merging or for scripts generating this cache
*/
isOsmCache?: boolean,
/**
* Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this
*/
mercatorCrs?: boolean,
/**
* Some API's have an id-field, but give it a different name.
* Setting this key will rename this field into 'id'
*/
idKey?: string
})
source: {
/**
* Every source must set which tags have to be present in order to load the given layer.
*/
osmTags: TagConfigJson
/**
* The maximum amount of seconds that a tile is allowed to linger in the cache
*/
maxCacheAge?: number
} & (
| {
/**
* If set, this custom overpass-script will be used instead of building one by using the OSM-tags.
* Specifying OSM-tags is still obligatory and will still hide non-matching items and they will be used for the rest of the pipeline.
* _This should be really rare_.
*
* For example, when you want to fetch all grass-areas in parks and which are marked as publicly accessible:
* ```
* "source": {
* "overpassScript":
* "way[\"leisure\"=\"park\"];node(w);is_in;area._[\"leisure\"=\"park\"];(way(area)[\"landuse\"=\"grass\"]; node(w); );",
* "osmTags": "access=yes"
* }
* ```
*
*/
overpassScript?: string
}
| {
/**
* The actual source of the data to load, if loaded via geojson.
*
* # A single geojson-file
* source: {geoJson: "https://my.source.net/some-geo-data.geojson"}
* fetches a geojson from a third party source
*
* # A tiled geojson source
* source: {geoJson: "https://my.source.net/some-tile-geojson-{layer}-{z}-{x}-{y}.geojson", geoJsonZoomLevel: 14}
* to use a tiled geojson source. The web server must offer multiple geojsons. {z}, {x} and {y} are substituted by the location; {layer} is substituted with the id of the loaded layer
*
* Some API's use a BBOX instead of a tile, this can be used by specifying {y_min}, {y_max}, {x_min} and {x_max}
*/
geoJson: string
/**
* To load a tiled geojson layer, set the zoomlevel of the tiles
*/
geoJsonZoomLevel?: number
/**
* Indicates that the upstream geojson data is OSM-derived.
* Useful for e.g. merging or for scripts generating this cache
*/
isOsmCache?: boolean
/**
* Some API's use a mercator-projection (EPSG:900913) instead of WGS84. Set the flag `mercatorCrs: true` in the source for this
*/
mercatorCrs?: boolean
/**
* Some API's have an id-field, but give it a different name.
* Setting this key will rename this field into 'id'
*/
idKey?: string
}
)
/**
*
@ -126,13 +125,13 @@ export interface LayerConfigJson {
* ]
*
*/
calculatedTags?: string[];
calculatedTags?: string[]
/**
* If set, this layer will not query overpass; but it'll still match the tags above which are by chance returned by other layers.
* Works well together with 'passAllFeatures', to add decoration
*/
doNotDownload?: boolean;
doNotDownload?: boolean
/**
* If set, only features matching this extra tag will be shown.
@ -143,7 +142,7 @@ export interface LayerConfigJson {
*
* The default value is 'yes'
*/
isShown?: TagConfigJson;
isShown?: TagConfigJson
/**
* Advanced option - might be set by the theme compiler
@ -152,30 +151,28 @@ export interface LayerConfigJson {
*/
forceLoad?: false | boolean
/**
* The minimum needed zoomlevel required before loading of the data start
* Default: 0
*/
minzoom?: number;
minzoom?: number
/**
* Indicates if this layer is shown by default;
* can be used to hide a layer from start, or to load the layer but only to show it where appropriate (e.g. for snapping to it)
*/
shownByDefault?: true | boolean;
shownByDefault?: true | boolean
/**
* The zoom level at which point the data is hidden again
* Default: 100 (thus: always visible
*/
minzoomVisible?: number;
minzoomVisible?: number
/**
* The title shown in a popup for elements of this layer.
*/
title?: string | TagRenderingConfigJson;
title?: string | TagRenderingConfigJson
/**
* Small icons shown next to the title.
@ -185,12 +182,23 @@ export interface LayerConfigJson {
*
* Type: icon[]
*/
titleIcons?: (string | TagRenderingConfigJson)[] | ["defaults"];
titleIcons?: (string | TagRenderingConfigJson)[] | ["defaults"]
/**
* Visualisation of the items on the map
*/
mapRendering: null | (PointRenderingConfigJson | LineRenderingConfigJson | RewritableConfigJson<LineRenderingConfigJson | PointRenderingConfigJson | LineRenderingConfigJson[] | PointRenderingConfigJson[]>)[]
mapRendering:
| null
| (
| PointRenderingConfigJson
| LineRenderingConfigJson
| RewritableConfigJson<
| LineRenderingConfigJson
| PointRenderingConfigJson
| LineRenderingConfigJson[]
| PointRenderingConfigJson[]
>
)[]
/**
* If set, this layer will pass all the features it receives onto the next layer.
@ -220,18 +228,18 @@ export interface LayerConfigJson {
*
* Do _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!
*/
title: string | any,
title: string | any
/**
* The tags to add. It determines the icon too
*/
tags: string[],
tags: string[]
/**
* The _first sentence_ of the description is shown on the button of the `add` menu.
* The full description is shown in the confirmation dialog.
*
* (The first sentence is until the first '.'-character in the description)
*/
description?: string | any,
description?: string | any
/**
* Example images, which show real-life pictures of what such a feature might look like
@ -246,24 +254,32 @@ export interface LayerConfigJson {
*
* If 'preferredBackgroundCategory' is set, the element will attempt to pick a background layer of that category.
*/
preciseInput?: true | {
/**
* The type of background picture
*/
preferredBackground: "osmbasedmap" | "photo" | "historicphoto" | "map" | string | string[],
/**
* If specified, these layers will be shown to and the new point will be snapped towards it
*/
snapToLayer?: string | string[],
/**
* If specified, a new point will only be snapped if it is within this range.
* Distance in meter
*
* Default: 10
*/
maxSnapDistance?: number
}
}[],
preciseInput?:
| true
| {
/**
* The type of background picture
*/
preferredBackground:
| "osmbasedmap"
| "photo"
| "historicphoto"
| "map"
| string
| string[]
/**
* If specified, these layers will be shown to and the new point will be snapped towards it
*/
snapToLayer?: string | string[]
/**
* If specified, a new point will only be snapped if it is within this range.
* Distance in meter
*
* Default: 10
*/
maxSnapDistance?: number
}
}[]
/**
* All the tag renderings.
@ -285,19 +301,24 @@ export interface LayerConfigJson {
* This is mainly create questions for a 'left' and a 'right' side of the road.
* These will be grouped and questions will be asked together
*/
tagRenderings?:
(string
| { builtin: string | string[], override: Partial<QuestionableTagRenderingConfigJson> }
| { id: string, builtin: string[], override: Partial<QuestionableTagRenderingConfigJson> }
| QuestionableTagRenderingConfigJson
| (RewritableConfigJson<(string | { builtin: string, override: Partial<QuestionableTagRenderingConfigJson> } | QuestionableTagRenderingConfigJson)[]> & {id: string})
) [],
tagRenderings?: (
| string
| { builtin: string | string[]; override: Partial<QuestionableTagRenderingConfigJson> }
| { id: string; builtin: string[]; override: Partial<QuestionableTagRenderingConfigJson> }
| QuestionableTagRenderingConfigJson
| (RewritableConfigJson<
(
| string
| { builtin: string; override: Partial<QuestionableTagRenderingConfigJson> }
| QuestionableTagRenderingConfigJson
)[]
> & { id: string })
)[]
/**
* All the extra questions for filtering
*/
filter?: (FilterConfigJson) [] | { sameAs: string },
filter?: FilterConfigJson[] | { sameAs: string }
/**
* This block defines under what circumstances the delete dialog is shown for objects of this layer.
@ -435,4 +456,4 @@ export interface LayerConfigJson {
* global: all layers with this ID will be synced accross all themes
*/
syncSelection?: "no" | "local" | "theme-only" | "global"
}
}

View file

@ -1,6 +1,6 @@
import {LayerConfigJson} from "./LayerConfigJson";
import TilesourceConfigJson from "./TilesourceConfigJson";
import ExtraLinkConfigJson from "./ExtraLinkConfigJson";
import { LayerConfigJson } from "./LayerConfigJson"
import TilesourceConfigJson from "./TilesourceConfigJson"
import ExtraLinkConfigJson from "./ExtraLinkConfigJson"
/**
* Defines the entire theme.
@ -15,7 +15,6 @@ import ExtraLinkConfigJson from "./ExtraLinkConfigJson";
* General remark: a type (string | any) indicates either a fixed or a translatable string.
*/
export interface LayoutConfigJson {
/**
* The id of this layout.
*
@ -25,16 +24,16 @@ export interface LayoutConfigJson {
* On official themes, it'll become the name of the page, e.g.
* 'cyclestreets' which become 'cyclestreets.html'
*/
id: string;
id: string
/**
* Who helped to create this theme and should be attributed?
*/
credits?: string;
credits?: string
/**
* Only used in 'generateLayerOverview': if present, every translation will be checked to make sure it is fully translated.
*
*
* This must be a list of two-letter, lowercase codes which identifies the language, e.g. "en", "nl", ...
*/
mustHaveLanguage?: string[]
@ -42,49 +41,49 @@ export interface LayoutConfigJson {
/**
* The title, as shown in the welcome message and the more-screen.
*/
title: string | any;
title: string | any
/**
* A short description, showed as social description and in the 'more theme'-buttons.
* Note that if this one is not defined, the first sentence of 'description' is used
*/
shortDescription?: string | any;
shortDescription?: string | any
/**
* The description, as shown in the welcome message and the more-screen
*/
description: string | any;
description: string | any
/**
* A part of the description, shown under the login-button.
*/
descriptionTail?: string | any;
descriptionTail?: string | any
/**
* The icon representing this theme.
* Used as logo in the more-screen and (for official themes) as favicon, webmanifest logo, ...
* Either a URL or a base64 encoded value (which should include 'data:image/svg+xml;base64)
*
*
* Type: icon
*/
icon: string;
icon: string
/**
* Link to a 'social image' which is included as og:image-tag on official themes.
* Useful to share the theme on social media.
* See https://www.h3xed.com/web-and-internet/how-to-use-og-image-meta-tag-facebook-reddit for more information$
*
*
* Type: image
*/
socialImage?: string;
socialImage?: string
/**
* Default location and zoom to start.
* Note that this is barely used. Once the user has visited mapcomplete at least once, the previous location of the user will be used
*/
startZoom: number;
startLat: number;
startLon: number;
startZoom: number
startLat: number
startLon: number
/**
* When a query is run, the data within bounds of the visible map is loaded.
@ -93,7 +92,7 @@ export interface LayoutConfigJson {
*
* IF widenfactor is 1, this feature is disabled. A recommended value is between 1 and 3
*/
widenFactor?: number;
widenFactor?: number
/**
* At low zoom levels, overpass is used to query features.
* At high zoom level, the OSM api is used to fetch one or more BBOX aligning with a slippy tile.
@ -139,12 +138,12 @@ export interface LayoutConfigJson {
*
* In the above scenario, `sometagrendering` will be added at the beginning of the tagrenderings of every layer
*/
overrideAll?: Partial<any | LayerConfigJson>;
overrideAll?: Partial<any | LayerConfigJson>
/**
* The id of the default background. BY default: vanilla OSM
*/
defaultBackgroundId?: string;
defaultBackgroundId?: string
/**
* Define some (overlay) slippy map tilesources
@ -174,7 +173,7 @@ export interface LayoutConfigJson {
* ```
* "layer": {
* "builtin": "nature_reserve",
* "override": {"source":
* "override": {"source":
* {"osmTags": {
* "+and":["operator=Natuurpunt"]
* }
@ -192,122 +191,129 @@ export interface LayoutConfigJson {
* }
*```
*/
layers: (LayerConfigJson | string |
{ builtin: string | string[],
override: any,
/**
* TagRenderings with any of these labels will be removed from the layer.
* Note that the 'id' and 'group' are considered labels too
*/
hideTagRenderingsWithLabels?: string[]})[],
layers: (
| LayerConfigJson
| string
| {
builtin: string | string[]
override: any
/**
* TagRenderings with any of these labels will be removed from the layer.
* Note that the 'id' and 'group' are considered labels too
*/
hideTagRenderingsWithLabels?: string[]
}
)[]
/**
* If defined, data will be clustered.
* Defaults to {maxZoom: 16, minNeeded: 500}
*/
clustering?: {
/**
* All zoom levels above 'maxzoom' are not clustered anymore.
* Defaults to 18
*/
maxZoom?: number,
/**
* The number of elements per tile needed to start clustering
* If clustering is defined, defaults to 250
*/
minNeededElements?: number
} | false,
clustering?:
| {
/**
* All zoom levels above 'maxzoom' are not clustered anymore.
* Defaults to 18
*/
maxZoom?: number
/**
* The number of elements per tile needed to start clustering
* If clustering is defined, defaults to 250
*/
minNeededElements?: number
}
| false
/**
* The URL of a custom CSS stylesheet to modify the layout
*/
customCss?: string;
customCss?: string
/**
* If set to true, this layout will not be shown in the overview with more themes
*/
hideFromOverview?: boolean;
hideFromOverview?: boolean
/**
* If set to true, the basemap will not scroll outside of the area visible on initial zoom.
* If set to [[lon, lat], [lon, lat]], the map will not scroll outside of those bounds.
* Off by default, which will enable panning to the entire world
*/
lockLocation?: [[number, number], [number, number]] | number[][];
lockLocation?: [[number, number], [number, number]] | number[][]
/**
* Adds an additional button on the top-left of the application.
* This can link to an arbitrary location.
*
*
* Note that {lat},{lon},{zoom}, {language} and {theme} will be replaced
*
* Default: {icon: "./assets/svg/pop-out.svg", href: 'https://mapcomplete.osm.be/{theme}.html?lat={lat}&lon={lon}&z={zoom}, requirements: ["iframe","no-welcome-message]},
*
*
* Default: {icon: "./assets/svg/pop-out.svg", href: 'https://mapcomplete.osm.be/{theme}.html?lat={lat}&lon={lon}&z={zoom}, requirements: ["iframe","no-welcome-message]},
*
*/
extraLink?: ExtraLinkConfigJson
/**
* If set to false, disables logging in.
* The userbadge will be hidden, all login-buttons will be hidden and editing will be disabled
*/
enableUserBadge?: true | boolean;
enableUserBadge?: true | boolean
/**
* If false, hides the tab 'share'-tab in the welcomeMessage
*/
enableShareScreen?: true | boolean;
enableShareScreen?: true | boolean
/**
* Hides the tab with more themes in the welcomeMessage
*/
enableMoreQuests?: true | boolean;
enableMoreQuests?: true | boolean
/**
* If false, the layer selection/filter view will be hidden
* The corresponding URL-parameter is 'fs-filters' instead of 'fs-layers'
*/
enableLayers?: true | boolean;
enableLayers?: true | boolean
/**
* If set to false, hides the search bar
*/
enableSearch?: true | boolean;
enableSearch?: true | boolean
/**
* If set to false, the ability to add new points or nodes will be disabled.
* Editing already existing features will still be possible
*/
enableAddNewPoints?: true | boolean;
enableAddNewPoints?: true | boolean
/**
* If set to false, the 'geolocation'-button will be hidden.
*/
enableGeolocation?: true | boolean;
enableGeolocation?: true | boolean
/**
* Enable switching the backgroundlayer.
* If false, the quickswitch-buttons are removed (bottom left) and the dropdown in the layer selection is removed as well
* If false, the quickswitch-buttons are removed (bottom left) and the dropdown in the layer selection is removed as well
*/
enableBackgroundLayerSelection?: true | boolean;
enableBackgroundLayerSelection?: true | boolean
/**
* If set to true, will show _all_ unanswered questions in a popup instead of just the next one
*/
enableShowAllQuestions?: false | boolean;
enableShowAllQuestions?: false | boolean
/**
* If set to true, download button for the data will be shown (offers downloading as geojson and csv)
*/
enableDownload?: false | boolean;
enableDownload?: false | boolean
/**
* If set to true, exporting a pdf is enabled
*/
enablePdfDownload?: false | boolean;
enablePdfDownload?: false | boolean
/**
* If true, notes will be loaded and parsed. If a note is an import (as created by the import_helper.html-tool from mapcomplete),
* these notes will be shown if a relevant layer is present.
*
*
* Default is true for official layers and false for unofficial (sideloaded) layers
*/
enableNoteImports?: true | boolean;
enableNoteImports?: true | boolean
/**
* Set one or more overpass URLs to use for this theme..
*/
overpassUrl?: string | string[];
overpassUrl?: string | string[]
/**
* Set a different timeout for overpass queries - in seconds. Default: 30s
*/
overpassTimeout?: number
}
}

View file

@ -1,4 +1,4 @@
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
import { TagRenderingConfigJson } from "./TagRenderingConfigJson"
/**
* The LineRenderingConfig gives all details onto how to render a single line of a feature.
@ -9,16 +9,15 @@ import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
* - The feature is an area
*/
export default interface LineRenderingConfigJson {
/**
* The color for way-elements and SVG-elements.
* If the value starts with "--", the style of the body element will be queried for the corresponding variable instead
*/
color?: string | TagRenderingConfigJson;
color?: string | TagRenderingConfigJson
/**
* The stroke-width for way-elements
*/
width?: string | number | TagRenderingConfigJson;
width?: string | number | TagRenderingConfigJson
/**
* A dasharray, e.g. "5 6"

View file

@ -9,4 +9,4 @@ export default interface MoveConfigJson {
* Set to false to disable this reason
*/
enableRelocation?: true | boolean
}
}

View file

@ -1,5 +1,5 @@
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
import {TagConfigJson} from "./TagConfigJson";
import { TagRenderingConfigJson } from "./TagRenderingConfigJson"
import { TagConfigJson } from "./TagConfigJson"
/**
* The PointRenderingConfig gives all details onto how to render a single point of a feature.
@ -10,7 +10,6 @@ import {TagConfigJson} from "./TagConfigJson";
* - To render something at the centroid of an area, or at the start, end or projected centroid of a way
*/
export default interface PointRenderingConfigJson {
/**
* All the locations that this point should be rendered at.
* Using `location: ["point", "centroid"] will always render centerpoint.
@ -30,7 +29,7 @@ export default interface PointRenderingConfigJson {
* Type: icon
*/
icon?: string | TagRenderingConfigJson;
icon?: string | TagRenderingConfigJson
/**
* A list of extra badges to show next to the icon as small badge
@ -38,26 +37,25 @@ export default interface PointRenderingConfigJson {
*
* Note: strings are interpreted as icons, so layering and substituting is supported. You can use `circle:white;./my_icon.svg` to add a background circle
*/
iconBadges?: {
if: TagConfigJson,
iconBadges?: {
if: TagConfigJson
/**
* Badge to show
* Type: icon
*/
then: string | TagRenderingConfigJson
then: string | TagRenderingConfigJson
}[]
/**
* A string containing "width,height" or "width,height,anchorpoint" where anchorpoint is any of 'center', 'top', 'bottom', 'left', 'right', 'bottomleft','topright', ...
* Default is '40,40,center'
*/
iconSize?: string | TagRenderingConfigJson;
iconSize?: string | TagRenderingConfigJson
/**
* The rotation of an icon, useful for e.g. directions.
* Usage: as if it were a css property for 'rotate', thus has to end with 'deg', e.g. `90deg`, `{direction}deg`, `calc(90deg - {camera:direction}deg)``
*/
rotation?: string | TagRenderingConfigJson;
rotation?: string | TagRenderingConfigJson
/**
* A HTML-fragment that is shown below the icon, for example:
* <div style="background: white">{name}</div>
@ -65,5 +63,5 @@ export default interface PointRenderingConfigJson {
* If the icon is undefined, then the label is shown in the center of the feature.
* Note that, if the wayhandling hides the icon then no label is shown as well.
*/
label?: string | TagRenderingConfigJson;
}
label?: string | TagRenderingConfigJson
}

View file

@ -1,33 +1,33 @@
import {TagConfigJson} from "./TagConfigJson";
import {TagRenderingConfigJson} from "./TagRenderingConfigJson";
import { TagConfigJson } from "./TagConfigJson"
import { TagRenderingConfigJson } from "./TagRenderingConfigJson"
export interface MappingConfigJson {
/**
* @inheritDoc
*/
if: TagConfigJson,
if: TagConfigJson
/**
* Shown if the 'if is fulfilled
* Type: rendered
*/
then: string | any,
then: string | any
/**
* An extra icon supporting the choice
* Type: icon
*/
icon?: string | {
/**
* The path to the icon
* Type: icon
*/
path: string,
/**
* Size of the image
*/
class: "small" | "medium" | "large" | string
}
icon?:
| string
| {
/**
* The path to the icon
* Type: icon
*/
path: string
/**
* Size of the image
*/
class: "small" | "medium" | "large" | string
}
/**
* In some cases, multiple taggings exist (e.g. a default assumption, or a commonly mapped abbreviation and a fully written variation).
@ -78,7 +78,7 @@ export interface MappingConfigJson {
* {"if":"changing_table:location=female","then":"In the female restroom"},
* {"if":"changing_table:location=male","then":"In the male restroom"},
* {"if":"changing_table:location=wheelchair","then":"In the wheelchair accessible restroom", "hideInAnswer": "wheelchair=no"},
*
*
* ]
* }
*
@ -89,7 +89,7 @@ export interface MappingConfigJson {
* hideInAnswer: "_country!=be"
* }
*/
hideInAnswer?: boolean | TagConfigJson,
hideInAnswer?: boolean | TagConfigJson
/**
* Only applicable if 'multiAnswer' is set.
* This is for situations such as:
@ -103,7 +103,7 @@ export interface MappingConfigJson {
/**
* If chosen as answer, these tags will be applied as well onto the object.
* Not compatible with multiAnswer.
*
*
* This can be used e.g. to erase other keys which indicate the 'not' value:
*```json
* {
@ -112,13 +112,13 @@ export interface MappingConfigJson {
* "addExtraTags": "not:crossing:marking="
* }
* ```
*
*
*/
addExtraTags?: string[]
/**
* If there are many options, the mappings-radiobuttons will be replaced by an element with a searchfunction
*
*
* Searchterms (per language) allow to easily find an option if there are many options
*/
searchTerms?: Record<string, string[]>
@ -128,7 +128,6 @@ export interface MappingConfigJson {
* Use this sparingly
*/
priorityIf?: TagConfigJson
}
/**
@ -136,19 +135,16 @@ export interface MappingConfigJson {
* If the desired tags are missing and a question is defined, a question will be shown instead.
*/
export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJson {
/**
* If it turns out that this tagRendering doesn't match _any_ value, then we show this question.
* If undefined, the question is never asked and this tagrendering is read-only
*/
question?: string | any,
question?: string | any
/**
* Allow freeform text input from the user
*/
freeform?: {
/**
* @inheritDoc
*/
@ -158,7 +154,7 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs
* The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...
* See Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values
*/
type?: string,
type?: string
/**
* A (translated) text that is shown (as gray text) within the textfield
*/
@ -168,12 +164,12 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs
* Extra parameters to initialize the input helper arguments.
* For semantics, see the 'SpecialInputElements.md'
*/
helperArgs?: (string | number | boolean | any)[];
helperArgs?: (string | number | boolean | any)[]
/**
* If a value is added with the textfield, these extra tag is addded.
* Useful to add a 'fixme=freeform textfield used - to be checked'
**/
addExtraTags?: string[];
addExtraTags?: string[]
/**
* When set, influences the way a question is asked.
@ -188,15 +184,15 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs
* Normally undefined (aka do not enter anything)
*/
default?: string
},
}
/**
* If true, use checkboxes instead of radio buttons when asking the question
*/
multiAnswer?: boolean,
multiAnswer?: boolean
/**
* Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes
*/
mappings?: MappingConfigJson[]
}
}

View file

@ -1,12 +1,12 @@
/**
* Rewrites and multiplies the given renderings of type T.
*
*
* This can be used for introducing many similar questions automatically,
* which also makes translations easier.
*
* (Note that the key does _not_ need to be wrapped in {}.
*
* (Note that the key does _not_ need to be wrapped in {}.
* However, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)
*
*
* For example:
*
* ```
@ -25,7 +25,7 @@
* }
* ```
* will result in _three_ copies (as the values to rewrite into have three values, namely:
*
*
* [
* {
* # The first pair: key --> X, a|b|c --> 0
@ -37,15 +37,15 @@
* {
* "Z": 2
* }
*
*
* ]
*
*
* @see ExpandRewrite
*/
export default interface RewritableConfigJson<T> {
rewrite: {
sourceString: string[],
sourceString: string[]
into: (string | any)[][]
},
}
renderings: T
}
}

View file

@ -4,7 +4,6 @@
*/
export type TagConfigJson = string | AndTagConfigJson | OrTagConfigJson
/**
* Chain many tags, to match, all of these should be true
* See https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation
@ -14,7 +13,7 @@ export type OrTagConfigJson = {
}
/**
* Chain many tags, to match, a single of these should be true
* See https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation
* See https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation
*/
export type AndTagConfigJson = {
and: TagConfigJson[]

View file

@ -1,18 +1,17 @@
import {TagConfigJson} from "./TagConfigJson";
import { TagConfigJson } from "./TagConfigJson"
/**
* A TagRenderingConfigJson is a single piece of code which converts one ore more tags into a HTML-snippet.
* For an _editable_ tagRendering, use 'QuestionableTagRenderingConfigJson' instead, which extends this one
*/
export interface TagRenderingConfigJson {
/**
* The id of the tagrendering, should be an unique string.
* Used to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.
*
* Use 'questions' to trigger the question box of this group (if a group is defined)
*/
id?: string,
id?: string
/**
* If 'group' is defined on many tagRenderings, these are grouped together when shown. The questions are grouped together as well.
@ -37,15 +36,15 @@ export interface TagRenderingConfigJson {
* Note that this is a HTML-interpreted value, so you can add links as e.g. '<a href='{website}'>{website}</a>' or include images such as `This is of type A <br><img src='typeA-icon.svg' />`
* type: rendered
*/
render?: string | any,
render?: string | any
/**
* Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`.
*
* This is useful to ask a follow-up question.
* For example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one.
* This can be done by adding `"condition": "changing_table=yes"`
*
*
* A full example would be:
* ```json
* {
@ -78,25 +77,23 @@ export interface TagRenderingConfigJson {
* },
* ```
* */
condition?: TagConfigJson;
condition?: TagConfigJson
/**
* Allow freeform text input from the user
*/
freeform?: {
/**
* If this key is present, then 'render' is used to display the value.
* If this is undefined, the rendering is _always_ shown
*/
key: string,
},
key: string
}
/**
* Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes
*/
mappings?: {
/**
* If this condition is met, then the text under `then` will be shown.
* If no value matches, and the user selects this mapping as an option, then these tags will be uploaded to OSM.
@ -105,29 +102,30 @@ export interface TagRenderingConfigJson {
*
* This can be an substituting-tag as well, e.g. {'if': 'addr:street:={_calculated_nearby_streetname}', 'then': '{_calculated_nearby_streetname}'}
*/
if: TagConfigJson,
if: TagConfigJson
/**
* If the condition `if` is met, the text `then` will be rendered.
* If not known yet, the user will be presented with `then` as an option
* Type: rendered
*/
then: string | any,
then: string | any
/**
* An icon supporting this mapping; typically shown pretty small
* Type: icon
*/
icon?: string | {
/**
* The path to the icon
* Type: icon
*/
path: string,
/**
* A hint to mapcomplete on how to render this icon within the mapping.
* This is translated to 'mapping-icon-<classtype>', so defining your own in combination with a custom CSS is possible (but discouraged)
*/
class: "small" | "medium" | "large" | string
}
icon?:
| string
| {
/**
* The path to the icon
* Type: icon
*/
path: string
/**
* A hint to mapcomplete on how to render this icon within the mapping.
* This is translated to 'mapping-icon-<classtype>', so defining your own in combination with a custom CSS is possible (but discouraged)
*/
class: "small" | "medium" | "large" | string
}
}[]
}

View file

@ -2,19 +2,18 @@
* Configuration for a tilesource config
*/
export default interface TilesourceConfigJson {
/**
* Id of this overlay, used in the URL-parameters to set the state
*/
id: string,
id: string
/**
* The path, where {x}, {y} and {z} will be substituted
*/
source: string,
source: string
/**
* Wether or not this is an overlay. Default: true
*/
isOverlay?: boolean,
isOverlay?: boolean
/**
* How this will be shown in the selection menu.
@ -32,10 +31,8 @@ export default interface TilesourceConfigJson {
*/
maxZoom?: number
/**
* The default state, set to false to hide by default
*/
defaultState: boolean;
}
defaultState: boolean
}

View file

@ -1,33 +1,29 @@
export default interface UnitConfigJson {
/**
* Every key from this list will be normalized.
*
* To render a united value properly, use
*
* To render a united value properly, use
*/
appliesToKey: string[],
appliesToKey: string[]
/**
* If set, invalid values will be erased in the MC application (but not in OSM of course!)
* Be careful with setting this
*/
eraseInvalidValues?: boolean;
eraseInvalidValues?: boolean
/**
* The possible denominations
*/
applicableUnits: DenominationConfigJson[]
}
export interface DenominationConfigJson {
/**
* If this evaluates to true and the value to interpret has _no_ unit given, assumes that this unit is meant.
* Alternatively, a list of country codes can be given where this acts as the default interpretation
*
*
* E.g., a denomination using "meter" would probably set this flag to "true";
* a denomination for "mp/h" will use the condition "_country=gb" to indicate that it is the default in the UK.
*
*
* If none of the units indicate that they are the default, the first denomination will be used instead
*/
useIfNoUnitGiven?: boolean | string[]
@ -42,24 +38,22 @@ export interface DenominationConfigJson {
* The canonical value for this denomination which will be added to the value in OSM.
* e.g. "m" for meters
* If the user inputs '42', the canonical value will be added and it'll become '42m'.
*
*
* Important: often, _no_ canonical values are expected, e.g. in the case of 'maxspeed' where 'km/h' is the default.
* In this case, an empty string should be used
*/
canonicalDenomination: string,
canonicalDenomination: string
/**
* The canonical denomination in the case that the unit is precisely '1'.
* Used for display purposes
*/
canonicalDenominationSingular?: string,
canonicalDenominationSingular?: string
/**
* A list of alternative values which can occur in the OSM database - used for parsing.
*/
alternativeDenomination?: string[],
alternativeDenomination?: string[]
/**
* The value for humans in the dropdown. This should not use abbreviations and should be translated, e.g.
@ -84,6 +78,4 @@ export interface DenominationConfigJson {
* Note that if all values use 'prefix', the dropdown might move to before the text field
*/
prefix?: boolean
}
}