Skip to content

ui/map/customStyles

Interfaces

SavedMapStyle

Defined in: ui/map/customStyles.ts:8

A user-saved basemap style: a friendly display name paired with the style JSON URL it resolves to. Persisted so a custom style only has to be typed once and then re-selected by name from the style dropdown.

Properties

name
name: string;

Defined in: ui/map/customStyles.ts:9

url
url: string;

Defined in: ui/map/customStyles.ts:10

Functions

sanitizeStyles()

function sanitizeStyles(raw): SavedMapStyle[];

Defined in: ui/map/customStyles.ts:21

Coerce arbitrary stored data into a clean SavedMapStyle[]. Anything that is not an array of objects with non-empty string name/url is dropped, so a corrupted or legacy entry can never crash the dropdown rendering.

Parameters

raw

unknown

Returns

SavedMapStyle[]


loadSavedStyles()

function loadSavedStyles(): SavedMapStyle[];

Defined in: ui/map/customStyles.ts:36

Load the saved custom styles, tolerating malformed/missing storage.

Returns

SavedMapStyle[]


persistSavedStyles()

function persistSavedStyles(styles): void;

Defined in: ui/map/customStyles.ts:41

Persist the list of saved custom styles.

Parameters

styles

SavedMapStyle[]

Returns

void


upsertStyle()

function upsertStyle(
   styles, 
   name, 
   url): SavedMapStyle[];

Defined in: ui/map/customStyles.ts:51

Add (or update) a saved style. Both name and URL are unique keys: saving a name that already exists overwrites its URL, and saving a URL that already exists (under any name) replaces that entry — so the dropdown never grows a duplicate label or a second option with the same value. Returns a new array.

Parameters

styles

SavedMapStyle[]

name

string

url

string

Returns

SavedMapStyle[]


removeStyleByUrl()

function removeStyleByUrl(styles, url): SavedMapStyle[];

Defined in: ui/map/customStyles.ts:62

Remove the saved style with the given URL. Returns a new array.

Parameters

styles

SavedMapStyle[]

url

string

Returns

SavedMapStyle[]