@superrouteca/smap-react 1.2.10 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +5 -2
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.12 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Released with the SDKs 1.2.12 (Swift and Android installs now come from the release repository
|
|
6
|
+
`https://github.com/Goodneo-Solutions/smap-sdk-releases`); no change in this package. The package page links to
|
|
7
|
+
https://open.superroute.ca/developer/smap.
|
|
8
|
+
|
|
9
|
+
## 1.2.11 — 2026-10-29
|
|
10
|
+
|
|
11
|
+
- Plan editor: a stop dropped on the map or an address picked for an insert has its legs measured before the insert
|
|
12
|
+
is confirmed, so the insert is answered faster (OPEN-ROUTE-EDIT E25 / E26). `editor.prepareInsert(points)` (and
|
|
13
|
+
the `insertWaitTimeout` prop) sends the points to the open snapshot at once, on the standard path, each once per
|
|
14
|
+
snapshot, never with an error; a job of no route dropped on a route does this by itself. An insert of such a point
|
|
15
|
+
first asks the server to wait for it, at most 1.2 s, and is sent then either way.
|
|
16
|
+
|
|
3
17
|
## 1.2.10 — 2026-10-29
|
|
4
18
|
|
|
5
19
|
- Released with the native SDKs 1.2.10 (view clusters no longer stay after their points split); no change in this
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<picture>
|
|
2
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Goodneo-Solutions/smap-sdk/main/assets/smap-logo-dark.svg">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/Goodneo-Solutions/smap-sdk/main/assets/smap-logo.svg" alt="sMap" height="56">
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Goodneo-Solutions/smap-sdk-releases/main/assets/smap-logo-dark.svg">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/Goodneo-Solutions/smap-sdk-releases/main/assets/smap-logo.svg" alt="sMap" height="56">
|
|
4
4
|
</picture>
|
|
5
5
|
|
|
6
6
|
# sMap for React: `@superrouteca/smap-react`
|
|
@@ -151,6 +151,9 @@ const editor = useRef<MapPlanEditor>(null);
|
|
|
151
151
|
- Fast path (no code change): a token answer with `fast_path.url`, or a map key whose configuration on the map's sMap
|
|
152
152
|
service names one, sends the calls there and falls back to the standard path by itself (see the Web SDK's *Plan
|
|
153
153
|
editor*); the state's `path` says which path answered.
|
|
154
|
+
- **Drop points** (OPEN-ROUTE-EDIT E25 / E26): `editor.prepareInsert(points)` on the editor the hook gives works as in
|
|
155
|
+
the Web SDK (points about to be inserted measured ahead; an insert of such a point waits at most
|
|
156
|
+
`insertWaitTimeout`, 1.2 s, a prop too).
|
|
154
157
|
|
|
155
158
|
## Basemap and custom styles
|
|
156
159
|
|
package/dist/index.cjs
CHANGED
|
@@ -600,7 +600,8 @@ function usePlanEditor(props) {
|
|
|
600
600
|
smapUrl: props.smapUrl,
|
|
601
601
|
fastPath: props.fastPath,
|
|
602
602
|
fastPathTimeout: props.fastPathTimeout,
|
|
603
|
-
fastPathRefineTimeout: props.fastPathRefineTimeout
|
|
603
|
+
fastPathRefineTimeout: props.fastPathRefineTimeout,
|
|
604
|
+
insertWaitTimeout: props.insertWaitTimeout
|
|
604
605
|
});
|
|
605
606
|
(0, import_react5.useEffect)(() => {
|
|
606
607
|
if (!map) {
|
|
@@ -628,7 +629,8 @@ function usePlanEditor(props) {
|
|
|
628
629
|
smapUrl: p.smapUrl,
|
|
629
630
|
fastPath: p.fastPath,
|
|
630
631
|
fastPathTimeout: p.fastPathTimeout,
|
|
631
|
-
fastPathRefineTimeout: p.fastPathRefineTimeout
|
|
632
|
+
fastPathRefineTimeout: p.fastPathRefineTimeout,
|
|
633
|
+
insertWaitTimeout: p.insertWaitTimeout
|
|
632
634
|
};
|
|
633
635
|
for (const k of Object.keys(options)) {
|
|
634
636
|
if (options[k] === void 0) {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/SMap.tsx","../src/layers.tsx","../src/tools.tsx","../src/features.tsx","../src/plan.tsx","../src/interop.tsx"],"sourcesContent":["export { SMap, useSMap } from './SMap';\nexport type { SMapProps } from './SMap';\nexport { Points, Lines, Polygons } from './layers';\nexport { Tool } from './tools';\nexport { CustomMarkers, Heatmap, Models, CanvasTiles, DrawTool } from './features';\nexport type { CustomMarkersProps, HeatmapProps, ModelsProps, CanvasTilesProps, DrawToolProps } from './features';\nexport type { ToolProps } from './tools';\nexport { PlanEditor, usePlanEditor } from './plan';\nexport type { PlanEditorProps, UsePlanEditorResult } from './plan';\nexport type { LayerProps, PointsProps, LinesProps, PolygonsProps } from './layers';\nexport {\n Source,\n StyleLayer,\n RasterLayer,\n WmsLayer,\n WmtsLayer,\n VectorTiles,\n ArcGisLayer,\n Data,\n Layers,\n DeckLayer,\n useRasterUrl,\n formats,\n} from './interop';\nexport type {\n SourceProps,\n StyleLayerProps,\n RasterLayerProps,\n WmsLayerProps,\n WmtsLayerProps,\n VectorTilesProps,\n ArcGisLayerProps,\n DataProps,\n LayersProps,\n DeckLayerProps,\n} from './interop';\nexport type {\n SMapMap,\n InteropMethods,\n TapHandler,\n PopupFunction,\n Slot,\n StyleSource,\n StyleLayerSpec,\n BasemapClassOverride,\n BasemapOverrides,\n CustomStyle,\n DataFormat,\n DataInput,\n ReadOptions,\n DataLayerOptions,\n AddDataOptions,\n RasterLayerOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n VectorTilesOptions,\n ArcGisLayerOptions,\n LayerDescription,\n DeckLayerLike,\n} from './types';\nexport { popupTemplate, planTexts } from '@superrouteca/smap';\nexport type {\n LayerData,\n LngLatLike,\n PointOptions,\n LineOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n MarkerOptions,\n StyleValue,\n StyleFlavor,\n GeoJSONFeature,\n GeoJSONFeatureCollection,\n ToolKind,\n ToolLayers,\n ToolPosition,\n ToolsOptions,\n ToolState,\n ToolsChangeEvent,\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanState,\n PlanJob,\n PlanVehicle,\n PlanRoute,\n PlanLocation,\n PlanCredentials,\n PlanTokenAnswer,\n PlanResult,\n PricedRoute,\n PricedStop,\n PlanSummary,\n PlanViolation,\n InsertChoice,\n InsertChoices,\n PlanChangeEvent,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n PlanPreview,\n PlanEditOutcome,\n PlanTextKey,\n PlanLanguage,\n} from '@superrouteca/smap';\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport { Map as BaseMap, type LngLatLike, type PopupOptions, type StyleFlavor, type ToolsChangeEvent, type ToolsOptions } from '@superrouteca/smap';\nimport type { BasemapOverrides, CustomStyle, SMapMap } from './types';\n\nexport type { SMapMap };\n\nconst MapContext = createContext<SMapMap | null>(null);\n\n/** Maps that were removed: their layers must not be touched any more. */\nexport const removedMaps = new WeakSet<SMapMap>();\n\n/** The map of the nearest `<SMap>` above, once it is ready (null before). */\nexport function useSMap(): SMapMap | null {\n return useContext(MapContext);\n}\n\nexport interface SMapProps {\n /** A map key (`smk_…`) whose allowlist names this site. Read when the map is created. */\n apiKey?: string;\n /** A map token. Read when the map is created; changing it creates the map again (use `getToken` to renew). */\n token?: string;\n /** Called at start and again two minutes before each token expires. */\n getToken?: () => string | Promise<string>;\n /**\n * A colour scheme, a saved custom style (`custom:sms_…`), or a style URL or object of your own. Changing it keeps\n * the layers and the basemap overrides.\n */\n style?: StyleFlavor | CustomStyle | string | Record<string, unknown>;\n /**\n * Basemap overrides by class (`{ water: { color: '#9cc0e6' }, pois: { visible: false } }`): a new value replaces the\n * previous overrides (`setBasemap`); removing the prop clears them. Kept across style and language changes.\n */\n basemap?: BasemapOverrides;\n /** Label language (`en`, `fr`, `zh-Hans`, …). Changing it keeps the layers. */\n language?: string;\n /** [longitude, latitude] or `{lng, lat}`; the camera follows a change. */\n center?: LngLatLike;\n zoom?: number;\n bearing?: number;\n pitch?: number;\n /** Node URLs known in advance, used while `baseUrl` is down. */\n nodes?: string[];\n /** The map service, `https://tile.srsr.ca` by default. */\n baseUrl?: string;\n /** Read from the nearest service node (default true). */\n nearest?: boolean;\n projection?: 'mercator' | 'globe';\n /** Buildings in 3D. */\n buildings3D?: boolean;\n /** Default popup options of every layer and of `openPopup`. Read when the map is created. */\n popup?: PopupOptions;\n /** Shown while a popup's content is a pending promise. Read when the map is created. */\n popupLoading?: string | Node;\n /**\n * Map tools: the ids hidden from the start, where the tools control sits (or false for none) and its labels. Read\n * when the map is created; register tools with `<Tool>`.\n */\n tools?: ToolsOptions;\n /** Called after every change of the tools' visibility; the map keeps no state itself. */\n onToolsChange?: (event: ToolsChangeEvent) => void;\n /** Further options handed to the map when it is created (minZoom, maxZoom, maxBounds, hash, …). */\n mapOptions?: Record<string, unknown>;\n /** Called once the first style has loaded, with the map. */\n onReady?: (map: SMapMap) => void;\n /** Called when the map cannot start. */\n onError?: (error: unknown) => void;\n /** Class and style of the element holding the map (it fills the element). */\n className?: string;\n containerStyle?: CSSProperties;\n id?: string;\n /** Layer components (`<Points>`, `<Source>`, `<StyleLayer>`, `<RasterLayer>`, `<Data>`, …), or anything to draw over the map. */\n children?: ReactNode;\n}\n\ntype Camera = { center?: LngLatLike; zoom?: number; bearing?: number; pitch?: number };\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\nfunction cameraChanges(prev: Camera, next: Camera): Camera | null {\n const out: Camera = {};\n let changed = false;\n if (next.center !== undefined && key(next.center) !== key(prev.center)) { out.center = next.center; changed = true; }\n for (const k of ['zoom', 'bearing', 'pitch'] as const) {\n if (next[k] !== undefined && next[k] !== prev[k]) { out[k] = next[k]; changed = true; }\n }\n return changed ? out : null;\n}\n\n/**\n * A map. Created in the browser only (after the component mounts), so it can be rendered on a server. The ref is\n * the SDK map once it is ready (null before).\n */\nexport const SMap = forwardRef<SMapMap | null, SMapProps>(function SMap(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const [map, setMap] = useState<SMapMap | null>(null);\n const latest = useRef(props);\n latest.current = props;\n // What the map shows now, so a prop that did not change is not applied again.\n const applied = useRef<{ style: string; language: string; camera: Camera; projection: string; buildings: boolean; basemap: string }>(\n { style: '', language: '', camera: {}, projection: '', buildings: false, basemap: key(undefined) });\n\n useImperativeHandle(ref, () => map as SMapMap, [map]);\n\n const nodesKey = key(props.nodes);\n const mapOptionsKey = key(props.mapOptions);\n const hasGetToken = !!props.getToken;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) { return undefined; }\n const p = latest.current;\n const options: Record<string, unknown> = {\n ...(p.mapOptions || {}),\n container,\n apiKey: p.apiKey,\n token: p.token,\n getToken: p.getToken ? () => latest.current.getToken!() : undefined,\n style: p.style,\n language: p.language,\n center: p.center,\n zoom: p.zoom,\n bearing: p.bearing,\n pitch: p.pitch,\n nodes: p.nodes,\n baseUrl: p.baseUrl,\n nearest: p.nearest,\n projection: p.projection,\n popup: p.popup,\n popupLoading: p.popupLoading,\n tools: p.tools,\n };\n for (const k of Object.keys(options)) { if (options[k] === undefined) { delete options[k]; } }\n let alive = true;\n let ready = false;\n let created: SMapMap;\n try {\n created = new BaseMap(options as unknown as ConstructorParameters<typeof BaseMap>[0]) as SMapMap;\n } catch (e) {\n latest.current.onError?.(e);\n return undefined;\n }\n applied.current = {\n style: key(p.style ?? 'light'),\n language: key(p.language ?? null),\n camera: { center: p.center, zoom: p.zoom, bearing: p.bearing, pitch: p.pitch },\n projection: p.projection ?? 'mercator',\n buildings: false,\n basemap: key(undefined),\n };\n created.onToolsChange((e) => latest.current.onToolsChange?.(e));\n created.ready.then(() => {\n ready = true;\n if (!alive) { created.remove(); return; }\n const overrides = latest.current.basemap;\n if (overrides !== undefined) {\n applied.current.basemap = key(overrides);\n try { created.setBasemap(overrides); } catch (e) { latest.current.onError?.(e); }\n }\n setMap(created);\n latest.current.onReady?.(created);\n }, (e: unknown) => {\n if (alive) { latest.current.onError?.(e); }\n });\n return () => {\n alive = false;\n removedMaps.add(created);\n setMap(null);\n // Before it is ready the map has nothing to remove yet; it is removed as soon as it is.\n if (ready) { created.remove(); }\n };\n }, [props.apiKey, props.token, props.baseUrl, nodesKey, props.nearest, mapOptionsKey, hasGetToken]);\n\n const styleKey = key(props.style ?? 'light');\n useEffect(() => {\n if (!map || applied.current.style === styleKey) { return; }\n applied.current.style = styleKey;\n map.setStyle(latest.current.style ?? 'light');\n }, [map, styleKey]);\n\n const languageKey = key(props.language ?? null);\n useEffect(() => {\n if (!map || applied.current.language === languageKey || props.language === undefined) { return; }\n applied.current.language = languageKey;\n map.setLanguage(props.language);\n }, [map, languageKey]);\n\n const centerKey = key(props.center);\n useEffect(() => {\n if (!map) { return; }\n const next: Camera = { center: props.center, zoom: props.zoom, bearing: props.bearing, pitch: props.pitch };\n const change = cameraChanges(applied.current.camera, next);\n applied.current.camera = next;\n if (change && map.engine) { map.engine.jumpTo(change); }\n }, [map, centerKey, props.zoom, props.bearing, props.pitch]);\n\n useEffect(() => {\n const projection = props.projection ?? 'mercator';\n if (!map || applied.current.projection === projection) { return; }\n applied.current.projection = projection;\n map.setProjection(projection);\n }, [map, props.projection]);\n\n const basemapKey = key(props.basemap);\n useEffect(() => {\n if (!map || applied.current.basemap === basemapKey) { return; }\n applied.current.basemap = basemapKey;\n try { map.setBasemap(latest.current.basemap ?? {}); } catch (e) { latest.current.onError?.(e); }\n }, [map, basemapKey]);\n\n useEffect(() => {\n const on = !!props.buildings3D;\n if (!map || applied.current.buildings === on) { return; }\n applied.current.buildings = on;\n map.setBuildings3D(on);\n }, [map, props.buildings3D]);\n\n return (\n <div\n id={props.id}\n className={props.className}\n style={{ position: 'relative', width: '100%', height: '100%', ...props.containerStyle }}\n >\n <div ref={containerRef} style={{ position: 'absolute', inset: 0 }} />\n <MapContext.Provider value={map}>{props.children}</MapContext.Provider>\n </div>\n );\n});\n","import { useEffect, useRef } from 'react';\nimport type {\n GeoJSONFeature,\n LayerClickEvent,\n LayerData,\n LineOptions,\n PointOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport type { Slot, TapHandler } from './types';\n\nexport type { TapHandler };\n\nexport interface LayerProps<O> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value replaces the data and keeps the look. */\n data: LayerData;\n /** How the layer is drawn; a change draws the layer again. */\n options?: O;\n /** Called when a feature of this layer is tapped or clicked. */\n onTap?: TapHandler;\n /** Shows or hides the layer (default true). */\n visible?: boolean;\n /**\n * The popup opened when the top feature at a click is this layer's (same as `options.popup`, which it replaces):\n * trusted HTML, a DOM node, or a promise of either. `popupTemplate('<b>{name}</b>')` gives a fast, escaped one.\n */\n popup?: (properties: Record<string, unknown>, feature: GeoJSONFeature) => PopupContent | Promise<PopupContent>;\n /** This layer's popup options, over the map's `popup` defaults (same as `options.popupOptions`). */\n popupOptions?: PopupOptions;\n /**\n * Where the layer draws among the basemap's layers (same as `options.slot`): `bottom`, `roads`, `labels` or `top`.\n * Without one the layer draws on top, in the order added, as in 1.0.\n */\n slot?: Slot;\n}\n\nexport type PointsProps = LayerProps<PointOptions>;\nexport type LinesProps = LayerProps<LineOptions>;\nexport type PolygonsProps = LayerProps<PolygonOptions>;\n\ntype Kind = 'addPoints' | 'addLines' | 'addPolygons';\n\n// Options compared by value; functions (popup, onClick) are read when called, so a new function is no change.\nexport function optionsKey(options: unknown): string {\n return JSON.stringify(options ?? {}, (_k, v) => (typeof v === 'function' ? '[fn]' : v));\n}\n\ntype OptionProps = Pick<LayerProps<PointOptions | LineOptions | PolygonOptions>, 'options' | 'onTap' | 'popup' | 'popupOptions' | 'slot'>;\n\n/**\n * The options handed to the SDK for a layer component: its `options` with `slot`, `popupOptions` and click and popup\n * functions that call the newest props (so a new function is no change).\n */\nexport function layerOptions(latest: { current: OptionProps }, hasTap: boolean, hasPopup: boolean): Record<string, unknown> {\n const o: Record<string, unknown> = { ...(latest.current.options || {}) };\n if (hasTap) {\n o.onClick = (feature: GeoJSONFeature, event: LayerClickEvent) => {\n const p = latest.current;\n p.options?.onClick?.(feature, event);\n p.onTap?.(feature.properties || {}, { lat: event.lngLat.lat, lng: event.lngLat.lng }, feature);\n };\n }\n if (hasPopup) {\n const given = latest.current.popup ?? latest.current.options?.popup;\n // A template (a string with {property} placeholders) goes to the SDK as it is; a function is called with the\n // newest props.\n o.popup = typeof given === 'string' ? given : (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const p = latest.current;\n const f = p.popup ?? p.options?.popup;\n return typeof f === 'function' ? f(properties, feature) : f;\n };\n }\n if (latest.current.slot) { o.slot = latest.current.slot; }\n if (latest.current.popupOptions) { o.popupOptions = { ...(o.popupOptions as object || {}), ...latest.current.popupOptions }; }\n return o;\n}\n\nfunction useLayer(kind: Kind, props: LayerProps<PointOptions | LineOptions | PolygonOptions>): null {\n const map = useSMap();\n const { id, data, options, onTap, visible = true, popupOptions, slot } = props;\n const latest = useRef(props);\n latest.current = props;\n const shown = useRef<{ map: SMapMap; data: LayerData } | null>(null);\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const o = layerOptions(latest, hasTap, hasPopup);\n const d = latest.current.data;\n (map[kind] as (id: string, data: LayerData, o: unknown) => SMapMap)(id, d, o);\n if (latest.current.visible === false) { map.setVisible(id, false); }\n shownVisible.current = latest.current.visible !== false;\n shown.current = { map, data: d };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.data === data) { return; }\n s.data = data;\n map.setData(id, data);\n }, [map, id, data]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n map.setVisible(id, visible);\n }, [map, id, visible]);\n\n return null;\n}\n\n/** Points at any scale, clustered or not. Must be inside `<SMap>`. */\nexport function Points(props: PointsProps): null {\n return useLayer('addPoints', props);\n}\n\n/** Lines (routes, tracks). Must be inside `<SMap>`. */\nexport function Lines(props: LinesProps): null {\n return useLayer('addLines', props);\n}\n\n/** Areas, flat or in 3D (`options.extrude`). Must be inside `<SMap>`. */\nexport function Polygons(props: PolygonsProps): null {\n return useLayer('addPolygons', props);\n}\n","import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { ToolKind, ToolPosition } from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface ToolProps {\n /** The tool id, unique on the map (1-64 letters, digits, '-', '_', '.'). */\n id: string;\n /** Shown on the tool's button in the tools control and read by screen readers. */\n label?: string;\n /**\n * A corner of the map (the children are drawn there), or 'none': the children stay where `<Tool>` is, over the\n * map's box. Default 'top-left' (a kind's own corner for `kind`).\n */\n position?: ToolPosition;\n /** A control the map makes instead of children: 'navigation', 'geolocate', 'fullscreen' or 'scale'. */\n kind?: ToolKind;\n /**\n * Data layers instead of children or a kind: one or more layer ids (of `<Points>`, `<Lines>`, `<Polygons>`, the\n * map's layer calls, or the basemap). Hiding the tool hides the layers (layout visibility), showing it shows them.\n */\n layer?: string | string[];\n /** Options of the kind's control (e.g. `{ showCompass: false }`). */\n options?: Record<string, unknown>;\n /** Class and style of the element holding the children. */\n className?: string;\n style?: CSSProperties;\n /** What the tool shows: a panel, a legend, a search box, … Kept while hidden, so its state stays. */\n children?: ReactNode;\n}\n\nconst optionsKey = (v: unknown) => JSON.stringify(v ?? null);\n\n/**\n * A tool floating on the map, shown or hidden by the map's tools control, `setToolVisible` and `setToolsVisible`.\n * Inside an `<SMap>`: `<Tool id=\"legend\" label=\"Legend\" position=\"bottom-left\"><Legend /></Tool>` or\n * `<Tool id=\"zoom\" kind=\"navigation\" />` or, for data layers, `<Tool id=\"stops\" label=\"Stops\" layer={['stops', 'stop-labels']} />`.\n * Removing it removes the tool.\n */\nexport function Tool(props: ToolProps) {\n const map = useSMap();\n const { id, label, kind } = props;\n const layer = props.layer;\n const layerKey = layer === undefined ? null : JSON.stringify(layer);\n const isLayer = layerKey !== null;\n const position = isLayer ? undefined : props.position ?? (kind ? undefined : 'top-left');\n const inPlace = !kind && !isLayer && position === 'none';\n // A corner tool's children live in an element of its own that the map places in the corner; React renders into it\n // through a portal, so the map may move it without React losing it. Made after mounting, so never on a server.\n const [box, setBox] = useState<HTMLDivElement | null>(null);\n useEffect(() => { if (!kind && !isLayer && !inPlace && !box) { setBox(document.createElement('div')); } }, [kind, isLayer, inPlace, box]);\n const inPlaceRef = useRef<HTMLDivElement | null>(null);\n const kindOptions = optionsKey(props.options);\n const latestOptions = useRef(props.options);\n latestOptions.current = props.options;\n\n if (box) {\n box.className = props.className ?? '';\n box.removeAttribute('style');\n Object.assign(box.style, props.style || {});\n }\n\n useEffect(() => {\n if (!map) { return undefined; }\n if (layerKey !== null) {\n map.addTool(id, { layer: JSON.parse(layerKey) as string | string[] }, { label });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }\n const target = kind ?? (inPlace ? inPlaceRef.current : box);\n if (!target) { return undefined; }\n map.addTool(id, target, { label, position, options: latestOptions.current });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }, [map, id, label, position, kind, inPlace, kindOptions, box, layerKey]);\n\n if (kind || isLayer) { return null; }\n if (inPlace) {\n return <div ref={inPlaceRef} className={props.className} style={props.style}>{props.children}</div>;\n }\n return box ? createPortal(props.children, box) : null;\n}\n","// The 1.2.0 calls as components (MOBILE-SDK-SPEC \"Native features\"; the map itself has them all, through the ref\n// or useSMap()): custom markers rendered by React, heat maps, 3D models, painted tiles and the drawing tool.\nimport { useEffect, useRef, useState, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type {\n CustomMarkerOptions,\n DrawEvent,\n DrawTool as SdkDrawTool,\n DrawToolOptions,\n GeoJSONFeature,\n HeatmapOptions,\n LayerData,\n ModelOptions,\n RasterLayerOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\nimport { optionsKey } from './layers';\n\nexport interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value moves the markers and keeps the others. */\n data: LayerData;\n /** The React content of one marker (rendered again when the feature's properties change). */\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => ReactNode;\n}\n\n/**\n * Custom markers (G1) whose content is React: the map makes each marker's element when its point comes into view and\n * React renders `render` into it through a portal (so context, state and events work as anywhere in the app).\n * Draggable with `draggable`; tooltips and popups as on any layer. Must be inside `<SMap>`.\n */\nexport function CustomMarkers(props: CustomMarkersProps) {\n const map = useSMap();\n const { id, data, render: _render, ...rest } = props;\n const latest = useRef(props);\n latest.current = props;\n // The element the map holds for each feature (by its key), with what React renders into it. The map keeps an\n // element while its point is out of view and shows it again later, so an entry goes only when the feature is\n // rendered again or leaves the data.\n const [entries, setEntries] = useState<Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>>(new Map());\n const held = useRef(new Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>());\n const shown = useRef<LayerData | null>(null);\n const looks = optionsKey(rest);\n const keyOf = (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const by = latest.current.idProperty;\n const v = by ? properties[by] : feature.id;\n return v === undefined || v === null ? `@${JSON.stringify(feature.geometry)}` : String(v);\n };\n\n useEffect(() => {\n if (!map) { return undefined; }\n held.current = new Map();\n let scheduled = false;\n const publish = () => {\n if (scheduled) { return; }\n scheduled = true;\n queueMicrotask(() => { scheduled = false; setEntries(new Map(held.current)); });\n };\n const options = {\n ...latest.current,\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const el = document.createElement('div');\n held.current.set(keyOf(properties, feature), { el, properties, feature });\n publish();\n return el;\n },\n } as unknown as CustomMarkerOptions & { id?: string; data?: unknown };\n delete options.id;\n delete options.data;\n map.addCustomMarkers(id, latest.current.data, options);\n shown.current = latest.current.data;\n return () => {\n shown.current = null;\n held.current = new Map();\n setEntries(new Map());\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks]);\n\n useEffect(() => {\n if (!map || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n // Features no longer in the data lose their content.\n const keep = new Set<string>();\n const features = (data && !Array.isArray(data) && (data as { features?: GeoJSONFeature[] }).features) || [];\n for (const f of features) { keep.add(keyOf((f.properties || {}) as Record<string, unknown>, f)); }\n const by = latest.current.idProperty;\n if (Array.isArray(data) && by) { (data as Record<string, unknown>[]).forEach((p) => keep.add(String(p[by]))); }\n // Points given as an array without idProperty have no key to compare: their content stays until the layer goes.\n if (!Array.isArray(data) || by) {\n let changed = false;\n for (const k of [...held.current.keys()]) { if (!keep.has(k)) { held.current.delete(k); changed = true; } }\n if (changed) { setEntries(new Map(held.current)); }\n }\n }, [map, id, data]);\n\n return (\n <>\n {[...entries.entries()].map(([k, e]) => createPortal(latest.current.render(e.properties, e.feature), e.el, `${id}\\u0000${k}`))}\n </>\n );\n}\n\nfunction useNativeLayer(add: (map: NonNullable<ReturnType<typeof useSMap>>) => void, id: string, looks: string, data?: LayerData): void {\n const map = useSMap();\n const shown = useRef<LayerData | undefined | null>(null);\n const addRef = useRef(add);\n addRef.current = add;\n useEffect(() => {\n if (!map) { return undefined; }\n addRef.current(map);\n shown.current = data;\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n // The data is set below; a new look adds the layer again.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map, id, looks]);\n useEffect(() => {\n if (!map || data === undefined || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n }, [map, id, data]);\n}\n\nexport interface HeatmapProps { id: string; data: LayerData; options?: HeatmapOptions }\n\n/** A heat map of points (G7). Must be inside `<SMap>`. */\nexport function Heatmap(props: HeatmapProps): null {\n useNativeLayer((m) => m.addHeatmap(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface ModelsProps { id: string; data: LayerData; options: ModelOptions }\n\n/** glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`). Must be inside `<SMap>`. */\nexport function Models(props: ModelsProps): null {\n useNativeLayer((m) => m.addModels(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface CanvasTilesProps {\n id: string;\n /** Paints one tile (a 2D context of the tile's canvas); called again for each tile that comes into view. */\n draw: Parameters<NonNullable<ReturnType<typeof useSMap>>['addCanvasTiles']>[1];\n options?: RasterLayerOptions;\n}\n\n/** Raster tiles you paint (G14). A new `draw` is used for the next tiles painted. Must be inside `<SMap>`. */\nexport function CanvasTiles(props: CanvasTilesProps): null {\n const draw = useRef(props.draw);\n draw.current = props.draw;\n useNativeLayer((m) => m.addCanvasTiles(props.id, (...a: Parameters<CanvasTilesProps['draw']>) => draw.current(...a), props.options), props.id, optionsKey(props.options));\n return null;\n}\n\nexport interface DrawToolProps extends Omit<DrawToolOptions, 'onChange'> {\n /** Called after each change: created, edited or deleted, with every shape. */\n onChange?: (event: DrawEvent) => void;\n /** Called with the tool once it exists (start, select, undo, getAll, …), and with null when it goes. */\n onTool?: (tool: SdkDrawTool | null) => void;\n}\n\n/** A drawing and editing tool (G3) for as long as it is mounted. Must be inside `<SMap>`. */\nexport function DrawTool(props: DrawToolProps): null {\n const map = useSMap();\n const latest = useRef(props);\n latest.current = props;\n const { onChange: _c, onTool: _t, ...rest } = props;\n const looks = optionsKey(rest);\n useEffect(() => {\n if (!map) { return undefined; }\n const { onChange: _a, onTool: _b, ...o } = latest.current;\n const tool = map.drawTool({ ...o, onChange: (e: DrawEvent) => latest.current.onChange?.(e) });\n latest.current.onTool?.(tool);\n return () => {\n latest.current.onTool?.(null);\n if (!removedMaps.has(map)) { tool.destroy(); }\n };\n }, [map, looks]);\n return null;\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport type {\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanChangeEvent,\n PlanCredentials,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface PlanEditorProps extends Omit<MapPlanEditorOptions, 'credentials' | 'plan' | 'fetch'> {\n /**\n * `{ token: () => Promise<string | PlanTokenAnswer> }` (a short-lived plan token from your own server, which mints it\n * with POST /v1/plan/token; the latest function is called)\n * or `{ key: 'smk_…' }`. Changing between a token and a key, or the key, starts a new editor.\n */\n credentials: PlanCredentials;\n /**\n * The plan to edit. A plan that differs from the one the editor holds replaces it (and its history); handing the\n * plan of `onChange` back is not a change.\n */\n plan?: Plan;\n /** The fetch to use (the page's by default). Read when the editor is made. */\n fetch?: typeof fetch;\n /** Called after every change: the plan to keep, its prices, and whether it is still on its way. */\n onChange?: (event: PlanChangeEvent) => void;\n onError?: (error: PlanEditorError, kind: string) => void;\n onBusy?: (busy: boolean) => void;\n onSnapshot?: (event: PlanSnapshotEvent) => void;\n /** Called once the editor exists, with it. */\n onReady?: (editor: MapPlanEditor) => void;\n}\n\n// The map was removed with its layers and tools: only the editor's own calls and snapshot are left to close.\nfunction destroyOffMap(made: MapPlanEditor) {\n made.layer.remove = () => {};\n try { made.destroy(); } catch { /* the map is gone */ }\n}\n\nexport interface UsePlanEditorResult extends PlanEditorState {\n /** The editor (null until the map is ready). */\n editor: MapPlanEditor | null;\n}\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\n// The plan's content without the routes the editor adds for vehicles without stops, so that a plan handed back from\n// onChange is recognised as the one the editor holds.\nfunction planKey(plan: Plan | null | undefined): string {\n if (!plan) { return key(null); }\n const routes = (plan.routes || [])\n .map((r) => ({ v: String(r.vehicle_id), s: (r.reverse ? r.stops.slice().reverse() : r.stops).map(String) }))\n .filter((r) => r.s.length)\n .sort((a, b) => (a.v < b.v ? -1 : a.v > b.v ? 1 : 0));\n const jobs = (plan.jobs || []).map((j) => j.id).sort();\n return key({ vehicles: plan.vehicles, jobs, routes, region: plan.region ?? null, profile: plan.profile ?? null, departed_at: plan.departed_at ?? null });\n}\n\nconst EMPTY: PlanEditorState = {\n plan: null, result: null, busy: false, error: null, canUndo: false, canRedo: false, choices: null, locked: [], last: null, preview: null, path: null,\n};\n\n/**\n * A plan editor on the map of the nearest `<SMap>`: its layers, the ready-made panel (unless `panel={false}`), and its\n * state for your own interface. The editor is made when the map is ready and destroyed when the component unmounts.\n */\nexport function usePlanEditor(props: PlanEditorProps): UsePlanEditorResult {\n const map = useSMap();\n const [editor, setEditor] = useState<MapPlanEditor | null>(null);\n const [state, setState] = useState<PlanEditorState>(EMPTY);\n const latest = useRef(props);\n latest.current = props;\n // The key of the last plan prop applied, so an unchanged prop is not applied again.\n const applied = useRef<string | null>(null);\n const credentialKey = 'key' in props.credentials ? 'key:' + props.credentials.key : 'token';\n const madeKey = key({\n baseUrl: props.baseUrl, app: props.app, region: props.region, profile: props.profile, snapshot: props.snapshot, geometry: props.geometry,\n insertLimit: props.insertLimit, objective: props.objective, id: props.id, colors: props.colors, preview: props.preview,\n panel: props.panel, labels: props.labels, smapUrl: props.smapUrl, fastPath: props.fastPath, fastPathTimeout: props.fastPathTimeout,\n fastPathRefineTimeout: props.fastPathRefineTimeout,\n });\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const credentials: PlanCredentials = 'key' in p.credentials\n ? { key: p.credentials.key }\n : { token: () => (latest.current.credentials as Extract<PlanCredentials, { token: unknown }>).token() };\n const options: MapPlanEditorOptions = {\n credentials, app: p.app, baseUrl: p.baseUrl, fetch: p.fetch, region: p.region, profile: p.profile, snapshot: p.snapshot,\n geometry: p.geometry, insertLimit: p.insertLimit, objective: p.objective, id: p.id, colors: p.colors,\n preview: p.preview, language: p.language, labels: p.labels, panel: p.panel,\n smapUrl: p.smapUrl, fastPath: p.fastPath, fastPathTimeout: p.fastPathTimeout, fastPathRefineTimeout: p.fastPathRefineTimeout,\n };\n for (const k of Object.keys(options) as Array<keyof MapPlanEditorOptions>) { if (options[k] === undefined) { delete options[k]; } }\n const made = map.planEditor(options);\n const refresh = () => setState(made.state());\n made.on('change', (e) => { refresh(); latest.current.onChange?.(e); });\n made.on('busy', (e) => { refresh(); latest.current.onBusy?.(e.busy); });\n made.on('error', (e) => { refresh(); latest.current.onError?.(e.error, e.kind); });\n made.on('preview', refresh);\n made.on('snapshot', (e) => latest.current.onSnapshot?.(e));\n applied.current = null;\n setEditor(made);\n latest.current.onReady?.(made);\n return () => {\n setEditor(null);\n setState(EMPTY);\n // Closes its calls and its snapshot; on a map that is still there it also takes its layers and panel away.\n if (!removedMaps.has(map)) { made.destroy(); } else { destroyOffMap(made); }\n };\n }, [map, credentialKey, madeKey]);\n\n // The plan prop: applied when it is not the plan the editor holds.\n const incoming = planKey(props.plan);\n useEffect(() => {\n if (!editor || !latest.current.plan) { return; }\n if (incoming === applied.current || incoming === planKey(editor.getPlan())) { applied.current = incoming; return; }\n applied.current = incoming;\n editor.setPlan(latest.current.plan).catch(() => {});\n }, [editor, incoming]);\n\n useEffect(() => {\n if (editor && editor.panel && props.language) { editor.panel.setLanguage(props.language); }\n }, [editor, props.language]);\n\n return { ...state, editor };\n}\n\n/**\n * `<PlanEditor>` inside an `<SMap>`: edits a plan on the map with the ready-made panel. The ref is the editor (undo,\n * redo, refine, insert, getPlan, …) once the map is ready. Renders nothing itself; the panel is a map tool.\n * <PlanEditor credentials={{ token: getPlanToken }} plan={plan} onChange={(e) => setPlan(e.plan)} language=\"fr\" />\n */\nexport const PlanEditor = forwardRef<MapPlanEditor | null, PlanEditorProps>(function PlanEditor(props, ref) {\n const { editor } = usePlanEditor(props);\n useImperativeHandle(ref, () => editor as MapPlanEditor, [editor]);\n return null;\n});\n","// Components of 1.1.0 (MAP-SDK-DESIGN M24–M36): each maps onto one call of `@superrouteca/smap` and removes what it\n// added when it unmounts.\nimport { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as sdk from '@superrouteca/smap';\nimport type { CustomStyleName, GeoJSONFeatureCollection, PopupOptions, StyleFlavor } from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport { layerOptions, optionsKey } from './layers';\nimport type {\n ArcGisLayerOptions,\n DataFormat,\n DataInput,\n DataLayerOptions,\n DeckLayerLike,\n LayerDescription,\n PopupFunction,\n RasterLayerOptions,\n ReadOptions,\n Slot,\n StyleLayerSpec,\n StyleSource,\n TapHandler,\n VectorTilesOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n} from './types';\n\n/** Calls `f` and drops an error: used when removing what may already be gone (a style change, a parent's removal). */\nfunction quietly(f: () => void): void {\n try { f(); } catch { /* already removed */ }\n}\n\n// ------------------------------------------------------------------ <Source>\n\ninterface SourceScope {\n id: string;\n /**\n * A style layer inside the source registers itself, so the source removes it before removing itself. The function\n * returned unregisters it and says whether it was still registered (false: the source removed it already).\n */\n register(layerId: string): () => boolean;\n}\n\nconst SourceContext = createContext<SourceScope | null>(null);\n\nexport interface SourceProps {\n /** The source id, unique on the map. */\n id: string;\n /**\n * A Style Specification v8 source object (`{ type: 'vector', url }`, `{ type: 'geojson', data }`, …). A new value\n * (compared by value) adds the source again with the layers inside it; keep it stable (a constant or `useMemo`).\n */\n source: StyleSource;\n /** `<StyleLayer>` elements drawing this source; their `source` is filled in. Drawn once the source is added. */\n children?: ReactNode;\n}\n\n/** A Style Specification source (`addSource` / `removeSource`). Must be inside `<SMap>`. */\nexport function Source(props: SourceProps): ReactNode {\n const map = useSMap();\n const { id, source, children } = props;\n const latest = useRef(source);\n latest.current = source;\n const inside = useRef(new Set<string>());\n const [shown, setShown] = useState<{ map: SMapMap; generation: number } | null>(null);\n const sourceKey = optionsKey(source);\n\n useEffect(() => {\n if (!map) { return undefined; }\n map.addSource(id, latest.current);\n setShown((s) => ({ map, generation: (s?.generation ?? 0) + 1 }));\n return () => {\n if (removedMaps.has(map)) { return; }\n // Layers first: a source still in use cannot be removed.\n inside.current.forEach((layerId) => quietly(() => map.removeLayer(layerId)));\n inside.current.clear();\n quietly(() => map.removeSource(id));\n };\n }, [map, id, sourceKey]);\n\n const scope = useMemo<SourceScope>(() => ({\n id,\n register: (layerId: string) => {\n inside.current.add(layerId);\n return () => inside.current.delete(layerId);\n },\n }), [id]);\n\n if (!map || !shown || shown.map !== map) { return null; }\n // A new generation (the source added again) mounts the children again, so their layers are added again.\n return (\n <SourceContext.Provider value={scope}>\n <Fragment key={shown.generation}>{children}</Fragment>\n </SourceContext.Provider>\n );\n}\n\n// ------------------------------------------------------------------ <StyleLayer>\n\nexport interface StyleLayerProps {\n /**\n * A Style Specification v8 layer, passed through unchanged (copied from Mapbox Studio, Maputnik or a MapLibre /\n * Mapbox GL JS page). Inside `<Source>` its `source` defaults to that source. A change of `paint`, `layout` or\n * `filter` is applied in place (`setPaint` / `setLayout` / `setFilter`); any other change adds the layer again.\n */\n layer: StyleLayerSpec;\n /** A layer id to draw under (a basemap layer or one of yours), instead of a slot. */\n before?: string;\n /** `bottom`, `roads`, `labels` or `top`. Without `slot` or `before` the layer draws on top, in the order added. */\n slot?: Slot;\n /** Shows or hides the layer (default true; the layout's `visibility`). */\n visible?: boolean;\n}\n\nfunction effectiveLayer(layer: StyleLayerSpec, sourceId: string | undefined, visible: boolean): StyleLayerSpec {\n const out: StyleLayerSpec = { ...layer };\n if (out.source === undefined && sourceId !== undefined) { out.source = sourceId; }\n if (!visible) { out.layout = { ...(layer.layout || {}), visibility: 'none' }; }\n return out;\n}\n\nfunction structureKey(layer: StyleLayerSpec, before?: string, slot?: Slot): string {\n const { paint: _p, layout: _l, filter: _f, ...rest } = layer;\n return optionsKey(rest) + '|' + (before ?? '') + '|' + (slot ?? '');\n}\n\n/** Calls `set(name, value)` for every key whose value differs (a removed key gets `undefined`, its default). */\nfunction applyDiff(prev: Record<string, unknown> | undefined, next: Record<string, unknown> | undefined,\n set: (name: string, value: unknown) => void): void {\n const a = prev || {};\n const b = next || {};\n for (const name of new Set([...Object.keys(a), ...Object.keys(b)])) {\n if (optionsKey(a[name]) !== optionsKey(b[name])) { set(name, b[name]); }\n }\n}\n\n/** A Style Specification layer (`addStyleLayer`). Must be inside `<SMap>`, and inside `<Source>` for its own source. */\nexport function StyleLayer(props: StyleLayerProps): null {\n const map = useSMap();\n const scope = useContext(SourceContext);\n const { layer, before, slot, visible = true } = props;\n const current = effectiveLayer(layer, scope?.id, visible);\n const latest = useRef(current);\n latest.current = current;\n const shown = useRef<{ map: SMapMap; layer: StyleLayerSpec } | null>(null);\n const structure = structureKey(current, before, slot);\n\n useEffect(() => {\n if (!map) { return undefined; }\n const l = latest.current;\n const options: { before?: string; slot?: Slot } = {};\n if (before !== undefined) { options.before = before; }\n if (slot !== undefined) { options.slot = slot; }\n map.addStyleLayer(l, options);\n shown.current = { map, layer: l };\n const unregister = scope?.register(l.id);\n return () => {\n shown.current = null;\n const stillMine = unregister ? unregister() : true;\n if (stillMine && !removedMaps.has(map)) { quietly(() => map.removeLayer(l.id)); }\n };\n }, [map, structure, scope]);\n\n const looks = optionsKey(current.paint) + optionsKey(current.layout) + optionsKey(current.filter);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map) { return; }\n const next = latest.current;\n const prev = s.layer;\n if (prev === next) { return; }\n applyDiff(prev.paint, next.paint, (name, value) => map.setPaint(next.id, name, value));\n applyDiff(prev.layout, next.layout, (name, value) => map.setLayout(next.id, name, value));\n if (optionsKey(prev.filter) !== optionsKey(next.filter)) { map.setFilter(next.id, (next.filter as unknown[] | undefined) ?? null); }\n s.layer = next;\n }, [map, looks]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ external layers\n\ntype AddMethod = 'addRasterLayer' | 'addWmsLayer' | 'addWmtsLayer' | 'addVectorTiles' | 'addArcGisLayer';\n\nfunction useAddedLayer(method: AddMethod, id: string, options: object, remove: (map: SMapMap) => void): null {\n const map = useSMap();\n const latest = useRef(options);\n latest.current = options;\n const removeLatest = useRef(remove);\n removeLatest.current = remove;\n const looks = optionsKey(options);\n useEffect(() => {\n if (!map) { return undefined; }\n (map[method] as (id: string, o: object) => unknown)(id, latest.current);\n const removeNow = removeLatest.current;\n return () => {\n if (!removedMaps.has(map)) { removeNow(map); }\n };\n }, [map, method, id, looks]);\n return null;\n}\n\nexport type RasterLayerProps = RasterLayerOptions & { id: string };\nexport type WmsLayerProps = WmsLayerOptions & { id: string };\nexport type WmtsLayerProps = WmtsLayerOptions & { id: string };\nexport type VectorTilesProps = VectorTilesOptions & { id: string };\nexport type ArcGisLayerProps = ArcGisLayerOptions & { id: string };\n\nfunction split<T extends { id: string }>(props: T): [string, Omit<T, 'id'>] {\n const { id, ...options } = props;\n return [id, options];\n}\n\n/** Raster tiles from `{z}/{x}/{y}` templates or a TileJSON URL (`addRasterLayer`). A change of a prop adds it again. */\nexport function RasterLayer(props: RasterLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addRasterLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMS service, one GetMap per tile (`addWmsLayer`). */\nexport function WmsLayer(props: WmsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMTS layer from a GetCapabilities URL or a REST template (`addWmtsLayer`). */\nexport function WmtsLayer(props: WmtsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmtsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** Vector tiles or a PMTiles archive from any URL, drawn by your style layers (`addVectorTiles`). */\nexport function VectorTiles(props: VectorTilesProps): null {\n const [id, options] = split(props);\n const layerIds = (options.layers || []).map((l) => l.id);\n return useAddedLayer('addVectorTiles', id, options, (map) => {\n layerIds.forEach((l) => quietly(() => map.removeLayer(l)));\n quietly(() => map.removeLayer(id));\n quietly(() => map.removeSource(id));\n });\n}\n\n/** An ArcGIS REST MapServer or VectorTileServer (`addArcGisLayer`). */\nexport function ArcGisLayer(props: ArcGisLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addArcGisLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n// ------------------------------------------------------------------ <Data>\n\nexport interface DataProps extends ReadOptions {\n /** The data id: points are the layer `<id>`, lines `<id>:lines`, areas `<id>:areas` (as `addData`). */\n id: string;\n /**\n * The file: KML, KMZ, GPX, an encoded polyline, WKT, WKB, CSV, TopoJSON or GeoJSON, as text, bytes, a Blob / File\n * or a parsed object. `format` is guessed when not given. A new value reads the file again.\n */\n data: DataInput;\n /** Layer options of the points, lines and areas (simplestyle properties draw when no colour is given). */\n options?: DataLayerOptions;\n /** Where the layers draw (same as `options.slot`); without one they draw on top, in the order added. */\n slot?: Slot;\n onTap?: TapHandler;\n /** Shows or hides the layers (default true). */\n visible?: boolean;\n popup?: PopupFunction;\n popupOptions?: PopupOptions;\n /** Called once the file is drawn. */\n onLoad?: () => void;\n /** Called when the file cannot be read. */\n onError?: (error: unknown) => void;\n}\n\nconst dataLayerIds = (id: string) => [id, `${id}:lines`, `${id}:areas`];\n\n/** A data file in any supported format, drawn as points, lines and areas (`addData`). Must be inside `<SMap>`. */\nexport function Data(props: DataProps): null {\n const map = useSMap();\n const { id, data, format, lat, lng, options, slot, onTap, visible = true, popupOptions } = props;\n const latest = useRef(props);\n latest.current = props;\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '') + '|' + (format ?? '') + '|' + (lat ?? '') + '|' + (lng ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const o: Record<string, unknown> = layerOptions(latest, hasTap, hasPopup);\n if (p.format !== undefined) { o.format = p.format; }\n if (p.lat !== undefined) { o.lat = p.lat; }\n if (p.lng !== undefined) { o.lng = p.lng; }\n const ids = dataLayerIds(id);\n let alive = true;\n // The file is read first (a promise), then drawn.\n Promise.resolve(map.addData(id, p.data, o)).then(() => {\n if (removedMaps.has(map)) { return; }\n if (!alive) { ids.forEach((l) => quietly(() => map.removeLayer(l))); return; }\n if (latest.current.visible === false) { map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, false)); }\n latest.current.onLoad?.();\n }, (e: unknown) => { if (alive) { latest.current.onError?.(e); } });\n shownVisible.current = p.visible !== false;\n return () => {\n alive = false;\n if (removedMaps.has(map)) { return; }\n ids.forEach((l) => quietly(() => map.removeLayer(l)));\n };\n }, [map, id, data, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n const ids = dataLayerIds(id);\n map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, visible));\n }, [map, id, visible]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ <Layers>\n\nexport interface LayersProps {\n /** A layer description (`toJSON()` of any sMap SDK), as an object or JSON text. A new value loads it again. */\n json: LayerDescription | string;\n}\n\n/** Loads a layer description (`loadLayers`); its layers and sources are removed when the component unmounts. */\nexport function Layers(props: LayersProps): null {\n const map = useSMap();\n const latest = useRef(props.json);\n latest.current = props.json;\n const jsonKey = typeof props.json === 'string' ? props.json : optionsKey(props.json);\n useEffect(() => {\n if (!map) { return undefined; }\n const json = latest.current;\n map.loadLayers(json);\n const d: LayerDescription = typeof json === 'string' ? JSON.parse(json) : json;\n return () => {\n if (removedMaps.has(map)) { return; }\n [...(d.layers || [])].reverse().forEach((l) => quietly(() => map.removeLayer(l.id)));\n Object.keys(d.sources || {}).forEach((s) => quietly(() => map.removeSource(s)));\n };\n }, [map, jsonKey]);\n return null;\n}\n\n// ------------------------------------------------------------------ <DeckLayer>\n\nexport interface DeckLayerProps {\n /** A deck.gl layer instance. A new instance with the same id replaces it (deck.gl's own way of updating). */\n layer: DeckLayerLike;\n}\n\n/** A deck.gl layer drawn interleaved with the map (`addDeckLayer`; web only). Must be inside `<SMap>`. */\nexport function DeckLayer(props: DeckLayerProps): null {\n const map = useSMap();\n const { layer } = props;\n const latest = useRef(layer);\n latest.current = layer;\n const shown = useRef<{ map: SMapMap; layer: DeckLayerLike } | null>(null);\n useEffect(() => {\n if (!map) { return undefined; }\n map.addDeckLayer(latest.current);\n shown.current = { map, layer: latest.current };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { quietly(() => map.removeDeckLayer(layer.id)); }\n };\n }, [map, layer.id]);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.layer === layer) { return; }\n s.layer = layer;\n map.addDeckLayer(layer);\n }, [map, layer]);\n return null;\n}\n\n// ------------------------------------------------------------------ hooks and helpers\n\n/**\n * A `{z}/{x}/{y}` raster tile URL template on the map's node for a scheme or `custom:<id>` (`rasterUrl`), for\n * tools without vector tiles. Null until the map is ready.\n */\nexport function useRasterUrl(style?: StyleFlavor | CustomStyleName, options?: { lang?: string; retina?: boolean }): string | null {\n const map = useSMap();\n const lang = options?.lang;\n const retina = options?.retina;\n return useMemo(() => {\n if (!map) { return null; }\n const o: { lang?: string; retina?: boolean } = {};\n if (lang !== undefined) { o.lang = lang; }\n if (retina !== undefined) { o.retina = retina; }\n return map.rasterUrl(style, o);\n }, [map, style, lang, retina]);\n}\n\ninterface Formats {\n read(input: DataInput, options?: ReadOptions): GeoJSONFeatureCollection | Promise<GeoJSONFeatureCollection>;\n}\n\n/**\n * Reads a file into a GeoJSON FeatureCollection on the device (`formats.read` of `@superrouteca/smap`), no map\n * needed. `format` is guessed from the content when not given.\n */\nexport const formats: Formats = {\n read(input: DataInput, options?: ReadOptions) {\n const f = (sdk as unknown as { formats?: Formats }).formats;\n if (!f) { throw new Error('sMap: formats need @superrouteca/smap 1.1.0 or later'); }\n return f.read(input, options);\n },\n};\n\nexport type { DataFormat };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAUO;AACP,kBAA+H;AAwN3H;AAnNJ,IAAM,iBAAa,4BAA8B,IAAI;AAG9C,IAAM,cAAc,oBAAI,QAAiB;AAGzC,SAAS,UAA0B;AACxC,aAAO,yBAAW,UAAU;AAC9B;AA8DA,IAAM,MAAM,CAAC,MAAe,KAAK,UAAU,KAAK,IAAI;AAEpD,SAAS,cAAc,MAAc,MAA6B;AAChE,QAAM,MAAc,CAAC;AACrB,MAAI,UAAU;AACd,MAAI,KAAK,WAAW,UAAa,IAAI,KAAK,MAAM,MAAM,IAAI,KAAK,MAAM,GAAG;AAAE,QAAI,SAAS,KAAK;AAAQ,cAAU;AAAA,EAAM;AACpH,aAAW,KAAK,CAAC,QAAQ,WAAW,OAAO,GAAY;AACrD,QAAI,KAAK,CAAC,MAAM,UAAa,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG;AAAE,UAAI,CAAC,IAAI,KAAK,CAAC;AAAG,gBAAU;AAAA,IAAM;AAAA,EACxF;AACA,SAAO,UAAU,MAAM;AACzB;AAMO,IAAM,WAAO,yBAAsC,SAASC,MAAK,OAAO,KAAK;AAClF,QAAM,m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MAAM,CAAC;AAC/B;AAUO,IAAMC,WAAmB;AAAA,EAC9B,KAAK,OAAkB,SAAuB;AAC5C,UAAM,IAA8C;AACpD,QAAI,CAAC,GAAG;AAAE,YAAM,IAAI,MAAM,sDAAsD;AAAA,IAAG;AACnF,WAAO,EAAE,KAAK,OAAO,OAAO;AAAA,EAC9B;AACF;;;AN9VA,IAAAC,eAAyC;","names":["formats","SMap","BaseMap","import_react","import_react","import_jsx_runtime","optionsKey","import_react","import_react_dom","import_jsx_runtime","import_react","key","PlanEditor","import_react","import_jsx_runtime","formats","import_smap"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/SMap.tsx","../src/layers.tsx","../src/tools.tsx","../src/features.tsx","../src/plan.tsx","../src/interop.tsx"],"sourcesContent":["export { SMap, useSMap } from './SMap';\nexport type { SMapProps } from './SMap';\nexport { Points, Lines, Polygons } from './layers';\nexport { Tool } from './tools';\nexport { CustomMarkers, Heatmap, Models, CanvasTiles, DrawTool } from './features';\nexport type { CustomMarkersProps, HeatmapProps, ModelsProps, CanvasTilesProps, DrawToolProps } from './features';\nexport type { ToolProps } from './tools';\nexport { PlanEditor, usePlanEditor } from './plan';\nexport type { PlanEditorProps, UsePlanEditorResult } from './plan';\nexport type { LayerProps, PointsProps, LinesProps, PolygonsProps } from './layers';\nexport {\n Source,\n StyleLayer,\n RasterLayer,\n WmsLayer,\n WmtsLayer,\n VectorTiles,\n ArcGisLayer,\n Data,\n Layers,\n DeckLayer,\n useRasterUrl,\n formats,\n} from './interop';\nexport type {\n SourceProps,\n StyleLayerProps,\n RasterLayerProps,\n WmsLayerProps,\n WmtsLayerProps,\n VectorTilesProps,\n ArcGisLayerProps,\n DataProps,\n LayersProps,\n DeckLayerProps,\n} from './interop';\nexport type {\n SMapMap,\n InteropMethods,\n TapHandler,\n PopupFunction,\n Slot,\n StyleSource,\n StyleLayerSpec,\n BasemapClassOverride,\n BasemapOverrides,\n CustomStyle,\n DataFormat,\n DataInput,\n ReadOptions,\n DataLayerOptions,\n AddDataOptions,\n RasterLayerOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n VectorTilesOptions,\n ArcGisLayerOptions,\n LayerDescription,\n DeckLayerLike,\n} from './types';\nexport { popupTemplate, planTexts } from '@superrouteca/smap';\nexport type {\n LayerData,\n LngLatLike,\n PointOptions,\n LineOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n MarkerOptions,\n StyleValue,\n StyleFlavor,\n GeoJSONFeature,\n GeoJSONFeatureCollection,\n ToolKind,\n ToolLayers,\n ToolPosition,\n ToolsOptions,\n ToolState,\n ToolsChangeEvent,\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanState,\n PlanJob,\n PlanVehicle,\n PlanRoute,\n PlanLocation,\n PlanCredentials,\n PlanTokenAnswer,\n PlanResult,\n PricedRoute,\n PricedStop,\n PlanSummary,\n PlanViolation,\n InsertChoice,\n InsertChoices,\n PlanChangeEvent,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n PlanPreview,\n PlanEditOutcome,\n PlanTextKey,\n PlanLanguage,\n} from '@superrouteca/smap';\n","import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport { Map as BaseMap, type LngLatLike, type PopupOptions, type StyleFlavor, type ToolsChangeEvent, type ToolsOptions } from '@superrouteca/smap';\nimport type { BasemapOverrides, CustomStyle, SMapMap } from './types';\n\nexport type { SMapMap };\n\nconst MapContext = createContext<SMapMap | null>(null);\n\n/** Maps that were removed: their layers must not be touched any more. */\nexport const removedMaps = new WeakSet<SMapMap>();\n\n/** The map of the nearest `<SMap>` above, once it is ready (null before). */\nexport function useSMap(): SMapMap | null {\n return useContext(MapContext);\n}\n\nexport interface SMapProps {\n /** A map key (`smk_…`) whose allowlist names this site. Read when the map is created. */\n apiKey?: string;\n /** A map token. Read when the map is created; changing it creates the map again (use `getToken` to renew). */\n token?: string;\n /** Called at start and again two minutes before each token expires. */\n getToken?: () => string | Promise<string>;\n /**\n * A colour scheme, a saved custom style (`custom:sms_…`), or a style URL or object of your own. Changing it keeps\n * the layers and the basemap overrides.\n */\n style?: StyleFlavor | CustomStyle | string | Record<string, unknown>;\n /**\n * Basemap overrides by class (`{ water: { color: '#9cc0e6' }, pois: { visible: false } }`): a new value replaces the\n * previous overrides (`setBasemap`); removing the prop clears them. Kept across style and language changes.\n */\n basemap?: BasemapOverrides;\n /** Label language (`en`, `fr`, `zh-Hans`, …). Changing it keeps the layers. */\n language?: string;\n /** [longitude, latitude] or `{lng, lat}`; the camera follows a change. */\n center?: LngLatLike;\n zoom?: number;\n bearing?: number;\n pitch?: number;\n /** Node URLs known in advance, used while `baseUrl` is down. */\n nodes?: string[];\n /** The map service, `https://tile.srsr.ca` by default. */\n baseUrl?: string;\n /** Read from the nearest service node (default true). */\n nearest?: boolean;\n projection?: 'mercator' | 'globe';\n /** Buildings in 3D. */\n buildings3D?: boolean;\n /** Default popup options of every layer and of `openPopup`. Read when the map is created. */\n popup?: PopupOptions;\n /** Shown while a popup's content is a pending promise. Read when the map is created. */\n popupLoading?: string | Node;\n /**\n * Map tools: the ids hidden from the start, where the tools control sits (or false for none) and its labels. Read\n * when the map is created; register tools with `<Tool>`.\n */\n tools?: ToolsOptions;\n /** Called after every change of the tools' visibility; the map keeps no state itself. */\n onToolsChange?: (event: ToolsChangeEvent) => void;\n /** Further options handed to the map when it is created (minZoom, maxZoom, maxBounds, hash, …). */\n mapOptions?: Record<string, unknown>;\n /** Called once the first style has loaded, with the map. */\n onReady?: (map: SMapMap) => void;\n /** Called when the map cannot start. */\n onError?: (error: unknown) => void;\n /** Class and style of the element holding the map (it fills the element). */\n className?: string;\n containerStyle?: CSSProperties;\n id?: string;\n /** Layer components (`<Points>`, `<Source>`, `<StyleLayer>`, `<RasterLayer>`, `<Data>`, …), or anything to draw over the map. */\n children?: ReactNode;\n}\n\ntype Camera = { center?: LngLatLike; zoom?: number; bearing?: number; pitch?: number };\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\nfunction cameraChanges(prev: Camera, next: Camera): Camera | null {\n const out: Camera = {};\n let changed = false;\n if (next.center !== undefined && key(next.center) !== key(prev.center)) { out.center = next.center; changed = true; }\n for (const k of ['zoom', 'bearing', 'pitch'] as const) {\n if (next[k] !== undefined && next[k] !== prev[k]) { out[k] = next[k]; changed = true; }\n }\n return changed ? out : null;\n}\n\n/**\n * A map. Created in the browser only (after the component mounts), so it can be rendered on a server. The ref is\n * the SDK map once it is ready (null before).\n */\nexport const SMap = forwardRef<SMapMap | null, SMapProps>(function SMap(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const [map, setMap] = useState<SMapMap | null>(null);\n const latest = useRef(props);\n latest.current = props;\n // What the map shows now, so a prop that did not change is not applied again.\n const applied = useRef<{ style: string; language: string; camera: Camera; projection: string; buildings: boolean; basemap: string }>(\n { style: '', language: '', camera: {}, projection: '', buildings: false, basemap: key(undefined) });\n\n useImperativeHandle(ref, () => map as SMapMap, [map]);\n\n const nodesKey = key(props.nodes);\n const mapOptionsKey = key(props.mapOptions);\n const hasGetToken = !!props.getToken;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) { return undefined; }\n const p = latest.current;\n const options: Record<string, unknown> = {\n ...(p.mapOptions || {}),\n container,\n apiKey: p.apiKey,\n token: p.token,\n getToken: p.getToken ? () => latest.current.getToken!() : undefined,\n style: p.style,\n language: p.language,\n center: p.center,\n zoom: p.zoom,\n bearing: p.bearing,\n pitch: p.pitch,\n nodes: p.nodes,\n baseUrl: p.baseUrl,\n nearest: p.nearest,\n projection: p.projection,\n popup: p.popup,\n popupLoading: p.popupLoading,\n tools: p.tools,\n };\n for (const k of Object.keys(options)) { if (options[k] === undefined) { delete options[k]; } }\n let alive = true;\n let ready = false;\n let created: SMapMap;\n try {\n created = new BaseMap(options as unknown as ConstructorParameters<typeof BaseMap>[0]) as SMapMap;\n } catch (e) {\n latest.current.onError?.(e);\n return undefined;\n }\n applied.current = {\n style: key(p.style ?? 'light'),\n language: key(p.language ?? null),\n camera: { center: p.center, zoom: p.zoom, bearing: p.bearing, pitch: p.pitch },\n projection: p.projection ?? 'mercator',\n buildings: false,\n basemap: key(undefined),\n };\n created.onToolsChange((e) => latest.current.onToolsChange?.(e));\n created.ready.then(() => {\n ready = true;\n if (!alive) { created.remove(); return; }\n const overrides = latest.current.basemap;\n if (overrides !== undefined) {\n applied.current.basemap = key(overrides);\n try { created.setBasemap(overrides); } catch (e) { latest.current.onError?.(e); }\n }\n setMap(created);\n latest.current.onReady?.(created);\n }, (e: unknown) => {\n if (alive) { latest.current.onError?.(e); }\n });\n return () => {\n alive = false;\n removedMaps.add(created);\n setMap(null);\n // Before it is ready the map has nothing to remove yet; it is removed as soon as it is.\n if (ready) { created.remove(); }\n };\n }, [props.apiKey, props.token, props.baseUrl, nodesKey, props.nearest, mapOptionsKey, hasGetToken]);\n\n const styleKey = key(props.style ?? 'light');\n useEffect(() => {\n if (!map || applied.current.style === styleKey) { return; }\n applied.current.style = styleKey;\n map.setStyle(latest.current.style ?? 'light');\n }, [map, styleKey]);\n\n const languageKey = key(props.language ?? null);\n useEffect(() => {\n if (!map || applied.current.language === languageKey || props.language === undefined) { return; }\n applied.current.language = languageKey;\n map.setLanguage(props.language);\n }, [map, languageKey]);\n\n const centerKey = key(props.center);\n useEffect(() => {\n if (!map) { return; }\n const next: Camera = { center: props.center, zoom: props.zoom, bearing: props.bearing, pitch: props.pitch };\n const change = cameraChanges(applied.current.camera, next);\n applied.current.camera = next;\n if (change && map.engine) { map.engine.jumpTo(change); }\n }, [map, centerKey, props.zoom, props.bearing, props.pitch]);\n\n useEffect(() => {\n const projection = props.projection ?? 'mercator';\n if (!map || applied.current.projection === projection) { return; }\n applied.current.projection = projection;\n map.setProjection(projection);\n }, [map, props.projection]);\n\n const basemapKey = key(props.basemap);\n useEffect(() => {\n if (!map || applied.current.basemap === basemapKey) { return; }\n applied.current.basemap = basemapKey;\n try { map.setBasemap(latest.current.basemap ?? {}); } catch (e) { latest.current.onError?.(e); }\n }, [map, basemapKey]);\n\n useEffect(() => {\n const on = !!props.buildings3D;\n if (!map || applied.current.buildings === on) { return; }\n applied.current.buildings = on;\n map.setBuildings3D(on);\n }, [map, props.buildings3D]);\n\n return (\n <div\n id={props.id}\n className={props.className}\n style={{ position: 'relative', width: '100%', height: '100%', ...props.containerStyle }}\n >\n <div ref={containerRef} style={{ position: 'absolute', inset: 0 }} />\n <MapContext.Provider value={map}>{props.children}</MapContext.Provider>\n </div>\n );\n});\n","import { useEffect, useRef } from 'react';\nimport type {\n GeoJSONFeature,\n LayerClickEvent,\n LayerData,\n LineOptions,\n PointOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport type { Slot, TapHandler } from './types';\n\nexport type { TapHandler };\n\nexport interface LayerProps<O> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value replaces the data and keeps the look. */\n data: LayerData;\n /** How the layer is drawn; a change draws the layer again. */\n options?: O;\n /** Called when a feature of this layer is tapped or clicked. */\n onTap?: TapHandler;\n /** Shows or hides the layer (default true). */\n visible?: boolean;\n /**\n * The popup opened when the top feature at a click is this layer's (same as `options.popup`, which it replaces):\n * trusted HTML, a DOM node, or a promise of either. `popupTemplate('<b>{name}</b>')` gives a fast, escaped one.\n */\n popup?: (properties: Record<string, unknown>, feature: GeoJSONFeature) => PopupContent | Promise<PopupContent>;\n /** This layer's popup options, over the map's `popup` defaults (same as `options.popupOptions`). */\n popupOptions?: PopupOptions;\n /**\n * Where the layer draws among the basemap's layers (same as `options.slot`): `bottom`, `roads`, `labels` or `top`.\n * Without one the layer draws on top, in the order added, as in 1.0.\n */\n slot?: Slot;\n}\n\nexport type PointsProps = LayerProps<PointOptions>;\nexport type LinesProps = LayerProps<LineOptions>;\nexport type PolygonsProps = LayerProps<PolygonOptions>;\n\ntype Kind = 'addPoints' | 'addLines' | 'addPolygons';\n\n// Options compared by value; functions (popup, onClick) are read when called, so a new function is no change.\nexport function optionsKey(options: unknown): string {\n return JSON.stringify(options ?? {}, (_k, v) => (typeof v === 'function' ? '[fn]' : v));\n}\n\ntype OptionProps = Pick<LayerProps<PointOptions | LineOptions | PolygonOptions>, 'options' | 'onTap' | 'popup' | 'popupOptions' | 'slot'>;\n\n/**\n * The options handed to the SDK for a layer component: its `options` with `slot`, `popupOptions` and click and popup\n * functions that call the newest props (so a new function is no change).\n */\nexport function layerOptions(latest: { current: OptionProps }, hasTap: boolean, hasPopup: boolean): Record<string, unknown> {\n const o: Record<string, unknown> = { ...(latest.current.options || {}) };\n if (hasTap) {\n o.onClick = (feature: GeoJSONFeature, event: LayerClickEvent) => {\n const p = latest.current;\n p.options?.onClick?.(feature, event);\n p.onTap?.(feature.properties || {}, { lat: event.lngLat.lat, lng: event.lngLat.lng }, feature);\n };\n }\n if (hasPopup) {\n const given = latest.current.popup ?? latest.current.options?.popup;\n // A template (a string with {property} placeholders) goes to the SDK as it is; a function is called with the\n // newest props.\n o.popup = typeof given === 'string' ? given : (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const p = latest.current;\n const f = p.popup ?? p.options?.popup;\n return typeof f === 'function' ? f(properties, feature) : f;\n };\n }\n if (latest.current.slot) { o.slot = latest.current.slot; }\n if (latest.current.popupOptions) { o.popupOptions = { ...(o.popupOptions as object || {}), ...latest.current.popupOptions }; }\n return o;\n}\n\nfunction useLayer(kind: Kind, props: LayerProps<PointOptions | LineOptions | PolygonOptions>): null {\n const map = useSMap();\n const { id, data, options, onTap, visible = true, popupOptions, slot } = props;\n const latest = useRef(props);\n latest.current = props;\n const shown = useRef<{ map: SMapMap; data: LayerData } | null>(null);\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const o = layerOptions(latest, hasTap, hasPopup);\n const d = latest.current.data;\n (map[kind] as (id: string, data: LayerData, o: unknown) => SMapMap)(id, d, o);\n if (latest.current.visible === false) { map.setVisible(id, false); }\n shownVisible.current = latest.current.visible !== false;\n shown.current = { map, data: d };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.data === data) { return; }\n s.data = data;\n map.setData(id, data);\n }, [map, id, data]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n map.setVisible(id, visible);\n }, [map, id, visible]);\n\n return null;\n}\n\n/** Points at any scale, clustered or not. Must be inside `<SMap>`. */\nexport function Points(props: PointsProps): null {\n return useLayer('addPoints', props);\n}\n\n/** Lines (routes, tracks). Must be inside `<SMap>`. */\nexport function Lines(props: LinesProps): null {\n return useLayer('addLines', props);\n}\n\n/** Areas, flat or in 3D (`options.extrude`). Must be inside `<SMap>`. */\nexport function Polygons(props: PolygonsProps): null {\n return useLayer('addPolygons', props);\n}\n","import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { ToolKind, ToolPosition } from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface ToolProps {\n /** The tool id, unique on the map (1-64 letters, digits, '-', '_', '.'). */\n id: string;\n /** Shown on the tool's button in the tools control and read by screen readers. */\n label?: string;\n /**\n * A corner of the map (the children are drawn there), or 'none': the children stay where `<Tool>` is, over the\n * map's box. Default 'top-left' (a kind's own corner for `kind`).\n */\n position?: ToolPosition;\n /** A control the map makes instead of children: 'navigation', 'geolocate', 'fullscreen' or 'scale'. */\n kind?: ToolKind;\n /**\n * Data layers instead of children or a kind: one or more layer ids (of `<Points>`, `<Lines>`, `<Polygons>`, the\n * map's layer calls, or the basemap). Hiding the tool hides the layers (layout visibility), showing it shows them.\n */\n layer?: string | string[];\n /** Options of the kind's control (e.g. `{ showCompass: false }`). */\n options?: Record<string, unknown>;\n /** Class and style of the element holding the children. */\n className?: string;\n style?: CSSProperties;\n /** What the tool shows: a panel, a legend, a search box, … Kept while hidden, so its state stays. */\n children?: ReactNode;\n}\n\nconst optionsKey = (v: unknown) => JSON.stringify(v ?? null);\n\n/**\n * A tool floating on the map, shown or hidden by the map's tools control, `setToolVisible` and `setToolsVisible`.\n * Inside an `<SMap>`: `<Tool id=\"legend\" label=\"Legend\" position=\"bottom-left\"><Legend /></Tool>` or\n * `<Tool id=\"zoom\" kind=\"navigation\" />` or, for data layers, `<Tool id=\"stops\" label=\"Stops\" layer={['stops', 'stop-labels']} />`.\n * Removing it removes the tool.\n */\nexport function Tool(props: ToolProps) {\n const map = useSMap();\n const { id, label, kind } = props;\n const layer = props.layer;\n const layerKey = layer === undefined ? null : JSON.stringify(layer);\n const isLayer = layerKey !== null;\n const position = isLayer ? undefined : props.position ?? (kind ? undefined : 'top-left');\n const inPlace = !kind && !isLayer && position === 'none';\n // A corner tool's children live in an element of its own that the map places in the corner; React renders into it\n // through a portal, so the map may move it without React losing it. Made after mounting, so never on a server.\n const [box, setBox] = useState<HTMLDivElement | null>(null);\n useEffect(() => { if (!kind && !isLayer && !inPlace && !box) { setBox(document.createElement('div')); } }, [kind, isLayer, inPlace, box]);\n const inPlaceRef = useRef<HTMLDivElement | null>(null);\n const kindOptions = optionsKey(props.options);\n const latestOptions = useRef(props.options);\n latestOptions.current = props.options;\n\n if (box) {\n box.className = props.className ?? '';\n box.removeAttribute('style');\n Object.assign(box.style, props.style || {});\n }\n\n useEffect(() => {\n if (!map) { return undefined; }\n if (layerKey !== null) {\n map.addTool(id, { layer: JSON.parse(layerKey) as string | string[] }, { label });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }\n const target = kind ?? (inPlace ? inPlaceRef.current : box);\n if (!target) { return undefined; }\n map.addTool(id, target, { label, position, options: latestOptions.current });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }, [map, id, label, position, kind, inPlace, kindOptions, box, layerKey]);\n\n if (kind || isLayer) { return null; }\n if (inPlace) {\n return <div ref={inPlaceRef} className={props.className} style={props.style}>{props.children}</div>;\n }\n return box ? createPortal(props.children, box) : null;\n}\n","// The 1.2.0 calls as components (MOBILE-SDK-SPEC \"Native features\"; the map itself has them all, through the ref\n// or useSMap()): custom markers rendered by React, heat maps, 3D models, painted tiles and the drawing tool.\nimport { useEffect, useRef, useState, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type {\n CustomMarkerOptions,\n DrawEvent,\n DrawTool as SdkDrawTool,\n DrawToolOptions,\n GeoJSONFeature,\n HeatmapOptions,\n LayerData,\n ModelOptions,\n RasterLayerOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\nimport { optionsKey } from './layers';\n\nexport interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value moves the markers and keeps the others. */\n data: LayerData;\n /** The React content of one marker (rendered again when the feature's properties change). */\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => ReactNode;\n}\n\n/**\n * Custom markers (G1) whose content is React: the map makes each marker's element when its point comes into view and\n * React renders `render` into it through a portal (so context, state and events work as anywhere in the app).\n * Draggable with `draggable`; tooltips and popups as on any layer. Must be inside `<SMap>`.\n */\nexport function CustomMarkers(props: CustomMarkersProps) {\n const map = useSMap();\n const { id, data, render: _render, ...rest } = props;\n const latest = useRef(props);\n latest.current = props;\n // The element the map holds for each feature (by its key), with what React renders into it. The map keeps an\n // element while its point is out of view and shows it again later, so an entry goes only when the feature is\n // rendered again or leaves the data.\n const [entries, setEntries] = useState<Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>>(new Map());\n const held = useRef(new Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>());\n const shown = useRef<LayerData | null>(null);\n const looks = optionsKey(rest);\n const keyOf = (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const by = latest.current.idProperty;\n const v = by ? properties[by] : feature.id;\n return v === undefined || v === null ? `@${JSON.stringify(feature.geometry)}` : String(v);\n };\n\n useEffect(() => {\n if (!map) { return undefined; }\n held.current = new Map();\n let scheduled = false;\n const publish = () => {\n if (scheduled) { return; }\n scheduled = true;\n queueMicrotask(() => { scheduled = false; setEntries(new Map(held.current)); });\n };\n const options = {\n ...latest.current,\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const el = document.createElement('div');\n held.current.set(keyOf(properties, feature), { el, properties, feature });\n publish();\n return el;\n },\n } as unknown as CustomMarkerOptions & { id?: string; data?: unknown };\n delete options.id;\n delete options.data;\n map.addCustomMarkers(id, latest.current.data, options);\n shown.current = latest.current.data;\n return () => {\n shown.current = null;\n held.current = new Map();\n setEntries(new Map());\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks]);\n\n useEffect(() => {\n if (!map || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n // Features no longer in the data lose their content.\n const keep = new Set<string>();\n const features = (data && !Array.isArray(data) && (data as { features?: GeoJSONFeature[] }).features) || [];\n for (const f of features) { keep.add(keyOf((f.properties || {}) as Record<string, unknown>, f)); }\n const by = latest.current.idProperty;\n if (Array.isArray(data) && by) { (data as Record<string, unknown>[]).forEach((p) => keep.add(String(p[by]))); }\n // Points given as an array without idProperty have no key to compare: their content stays until the layer goes.\n if (!Array.isArray(data) || by) {\n let changed = false;\n for (const k of [...held.current.keys()]) { if (!keep.has(k)) { held.current.delete(k); changed = true; } }\n if (changed) { setEntries(new Map(held.current)); }\n }\n }, [map, id, data]);\n\n return (\n <>\n {[...entries.entries()].map(([k, e]) => createPortal(latest.current.render(e.properties, e.feature), e.el, `${id}\\u0000${k}`))}\n </>\n );\n}\n\nfunction useNativeLayer(add: (map: NonNullable<ReturnType<typeof useSMap>>) => void, id: string, looks: string, data?: LayerData): void {\n const map = useSMap();\n const shown = useRef<LayerData | undefined | null>(null);\n const addRef = useRef(add);\n addRef.current = add;\n useEffect(() => {\n if (!map) { return undefined; }\n addRef.current(map);\n shown.current = data;\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n // The data is set below; a new look adds the layer again.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map, id, looks]);\n useEffect(() => {\n if (!map || data === undefined || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n }, [map, id, data]);\n}\n\nexport interface HeatmapProps { id: string; data: LayerData; options?: HeatmapOptions }\n\n/** A heat map of points (G7). Must be inside `<SMap>`. */\nexport function Heatmap(props: HeatmapProps): null {\n useNativeLayer((m) => m.addHeatmap(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface ModelsProps { id: string; data: LayerData; options: ModelOptions }\n\n/** glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`). Must be inside `<SMap>`. */\nexport function Models(props: ModelsProps): null {\n useNativeLayer((m) => m.addModels(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface CanvasTilesProps {\n id: string;\n /** Paints one tile (a 2D context of the tile's canvas); called again for each tile that comes into view. */\n draw: Parameters<NonNullable<ReturnType<typeof useSMap>>['addCanvasTiles']>[1];\n options?: RasterLayerOptions;\n}\n\n/** Raster tiles you paint (G14). A new `draw` is used for the next tiles painted. Must be inside `<SMap>`. */\nexport function CanvasTiles(props: CanvasTilesProps): null {\n const draw = useRef(props.draw);\n draw.current = props.draw;\n useNativeLayer((m) => m.addCanvasTiles(props.id, (...a: Parameters<CanvasTilesProps['draw']>) => draw.current(...a), props.options), props.id, optionsKey(props.options));\n return null;\n}\n\nexport interface DrawToolProps extends Omit<DrawToolOptions, 'onChange'> {\n /** Called after each change: created, edited or deleted, with every shape. */\n onChange?: (event: DrawEvent) => void;\n /** Called with the tool once it exists (start, select, undo, getAll, …), and with null when it goes. */\n onTool?: (tool: SdkDrawTool | null) => void;\n}\n\n/** A drawing and editing tool (G3) for as long as it is mounted. Must be inside `<SMap>`. */\nexport function DrawTool(props: DrawToolProps): null {\n const map = useSMap();\n const latest = useRef(props);\n latest.current = props;\n const { onChange: _c, onTool: _t, ...rest } = props;\n const looks = optionsKey(rest);\n useEffect(() => {\n if (!map) { return undefined; }\n const { onChange: _a, onTool: _b, ...o } = latest.current;\n const tool = map.drawTool({ ...o, onChange: (e: DrawEvent) => latest.current.onChange?.(e) });\n latest.current.onTool?.(tool);\n return () => {\n latest.current.onTool?.(null);\n if (!removedMaps.has(map)) { tool.destroy(); }\n };\n }, [map, looks]);\n return null;\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport type {\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanChangeEvent,\n PlanCredentials,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface PlanEditorProps extends Omit<MapPlanEditorOptions, 'credentials' | 'plan' | 'fetch'> {\n /**\n * `{ token: () => Promise<string | PlanTokenAnswer> }` (a short-lived plan token from your own server, which mints it\n * with POST /v1/plan/token; the latest function is called)\n * or `{ key: 'smk_…' }`. Changing between a token and a key, or the key, starts a new editor.\n */\n credentials: PlanCredentials;\n /**\n * The plan to edit. A plan that differs from the one the editor holds replaces it (and its history); handing the\n * plan of `onChange` back is not a change.\n */\n plan?: Plan;\n /** The fetch to use (the page's by default). Read when the editor is made. */\n fetch?: typeof fetch;\n /** Called after every change: the plan to keep, its prices, and whether it is still on its way. */\n onChange?: (event: PlanChangeEvent) => void;\n onError?: (error: PlanEditorError, kind: string) => void;\n onBusy?: (busy: boolean) => void;\n onSnapshot?: (event: PlanSnapshotEvent) => void;\n /** Called once the editor exists, with it. */\n onReady?: (editor: MapPlanEditor) => void;\n}\n\n// The map was removed with its layers and tools: only the editor's own calls and snapshot are left to close.\nfunction destroyOffMap(made: MapPlanEditor) {\n made.layer.remove = () => {};\n try { made.destroy(); } catch { /* the map is gone */ }\n}\n\nexport interface UsePlanEditorResult extends PlanEditorState {\n /** The editor (null until the map is ready). */\n editor: MapPlanEditor | null;\n}\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\n// The plan's content without the routes the editor adds for vehicles without stops, so that a plan handed back from\n// onChange is recognised as the one the editor holds.\nfunction planKey(plan: Plan | null | undefined): string {\n if (!plan) { return key(null); }\n const routes = (plan.routes || [])\n .map((r) => ({ v: String(r.vehicle_id), s: (r.reverse ? r.stops.slice().reverse() : r.stops).map(String) }))\n .filter((r) => r.s.length)\n .sort((a, b) => (a.v < b.v ? -1 : a.v > b.v ? 1 : 0));\n const jobs = (plan.jobs || []).map((j) => j.id).sort();\n return key({ vehicles: plan.vehicles, jobs, routes, region: plan.region ?? null, profile: plan.profile ?? null, departed_at: plan.departed_at ?? null });\n}\n\nconst EMPTY: PlanEditorState = {\n plan: null, result: null, busy: false, error: null, canUndo: false, canRedo: false, choices: null, locked: [], last: null, preview: null, path: null,\n};\n\n/**\n * A plan editor on the map of the nearest `<SMap>`: its layers, the ready-made panel (unless `panel={false}`), and its\n * state for your own interface. The editor is made when the map is ready and destroyed when the component unmounts.\n */\nexport function usePlanEditor(props: PlanEditorProps): UsePlanEditorResult {\n const map = useSMap();\n const [editor, setEditor] = useState<MapPlanEditor | null>(null);\n const [state, setState] = useState<PlanEditorState>(EMPTY);\n const latest = useRef(props);\n latest.current = props;\n // The key of the last plan prop applied, so an unchanged prop is not applied again.\n const applied = useRef<string | null>(null);\n const credentialKey = 'key' in props.credentials ? 'key:' + props.credentials.key : 'token';\n const madeKey = key({\n baseUrl: props.baseUrl, app: props.app, region: props.region, profile: props.profile, snapshot: props.snapshot, geometry: props.geometry,\n insertLimit: props.insertLimit, objective: props.objective, id: props.id, colors: props.colors, preview: props.preview,\n panel: props.panel, labels: props.labels, smapUrl: props.smapUrl, fastPath: props.fastPath, fastPathTimeout: props.fastPathTimeout,\n fastPathRefineTimeout: props.fastPathRefineTimeout, insertWaitTimeout: props.insertWaitTimeout,\n });\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const credentials: PlanCredentials = 'key' in p.credentials\n ? { key: p.credentials.key }\n : { token: () => (latest.current.credentials as Extract<PlanCredentials, { token: unknown }>).token() };\n const options: MapPlanEditorOptions = {\n credentials, app: p.app, baseUrl: p.baseUrl, fetch: p.fetch, region: p.region, profile: p.profile, snapshot: p.snapshot,\n geometry: p.geometry, insertLimit: p.insertLimit, objective: p.objective, id: p.id, colors: p.colors,\n preview: p.preview, language: p.language, labels: p.labels, panel: p.panel,\n smapUrl: p.smapUrl, fastPath: p.fastPath, fastPathTimeout: p.fastPathTimeout, fastPathRefineTimeout: p.fastPathRefineTimeout,\n insertWaitTimeout: p.insertWaitTimeout,\n };\n for (const k of Object.keys(options) as Array<keyof MapPlanEditorOptions>) { if (options[k] === undefined) { delete options[k]; } }\n const made = map.planEditor(options);\n const refresh = () => setState(made.state());\n made.on('change', (e) => { refresh(); latest.current.onChange?.(e); });\n made.on('busy', (e) => { refresh(); latest.current.onBusy?.(e.busy); });\n made.on('error', (e) => { refresh(); latest.current.onError?.(e.error, e.kind); });\n made.on('preview', refresh);\n made.on('snapshot', (e) => latest.current.onSnapshot?.(e));\n applied.current = null;\n setEditor(made);\n latest.current.onReady?.(made);\n return () => {\n setEditor(null);\n setState(EMPTY);\n // Closes its calls and its snapshot; on a map that is still there it also takes its layers and panel away.\n if (!removedMaps.has(map)) { made.destroy(); } else { destroyOffMap(made); }\n };\n }, [map, credentialKey, madeKey]);\n\n // The plan prop: applied when it is not the plan the editor holds.\n const incoming = planKey(props.plan);\n useEffect(() => {\n if (!editor || !latest.current.plan) { return; }\n if (incoming === applied.current || incoming === planKey(editor.getPlan())) { applied.current = incoming; return; }\n applied.current = incoming;\n editor.setPlan(latest.current.plan).catch(() => {});\n }, [editor, incoming]);\n\n useEffect(() => {\n if (editor && editor.panel && props.language) { editor.panel.setLanguage(props.language); }\n }, [editor, props.language]);\n\n return { ...state, editor };\n}\n\n/**\n * `<PlanEditor>` inside an `<SMap>`: edits a plan on the map with the ready-made panel. The ref is the editor (undo,\n * redo, refine, insert, getPlan, …) once the map is ready. Renders nothing itself; the panel is a map tool.\n * <PlanEditor credentials={{ token: getPlanToken }} plan={plan} onChange={(e) => setPlan(e.plan)} language=\"fr\" />\n */\nexport const PlanEditor = forwardRef<MapPlanEditor | null, PlanEditorProps>(function PlanEditor(props, ref) {\n const { editor } = usePlanEditor(props);\n useImperativeHandle(ref, () => editor as MapPlanEditor, [editor]);\n return null;\n});\n","// Components of 1.1.0 (MAP-SDK-DESIGN M24–M36): each maps onto one call of `@superrouteca/smap` and removes what it\n// added when it unmounts.\nimport { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as sdk from '@superrouteca/smap';\nimport type { CustomStyleName, GeoJSONFeatureCollection, PopupOptions, StyleFlavor } from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport { layerOptions, optionsKey } from './layers';\nimport type {\n ArcGisLayerOptions,\n DataFormat,\n DataInput,\n DataLayerOptions,\n DeckLayerLike,\n LayerDescription,\n PopupFunction,\n RasterLayerOptions,\n ReadOptions,\n Slot,\n StyleLayerSpec,\n StyleSource,\n TapHandler,\n VectorTilesOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n} from './types';\n\n/** Calls `f` and drops an error: used when removing what may already be gone (a style change, a parent's removal). */\nfunction quietly(f: () => void): void {\n try { f(); } catch { /* already removed */ }\n}\n\n// ------------------------------------------------------------------ <Source>\n\ninterface SourceScope {\n id: string;\n /**\n * A style layer inside the source registers itself, so the source removes it before removing itself. The function\n * returned unregisters it and says whether it was still registered (false: the source removed it already).\n */\n register(layerId: string): () => boolean;\n}\n\nconst SourceContext = createContext<SourceScope | null>(null);\n\nexport interface SourceProps {\n /** The source id, unique on the map. */\n id: string;\n /**\n * A Style Specification v8 source object (`{ type: 'vector', url }`, `{ type: 'geojson', data }`, …). A new value\n * (compared by value) adds the source again with the layers inside it; keep it stable (a constant or `useMemo`).\n */\n source: StyleSource;\n /** `<StyleLayer>` elements drawing this source; their `source` is filled in. Drawn once the source is added. */\n children?: ReactNode;\n}\n\n/** A Style Specification source (`addSource` / `removeSource`). Must be inside `<SMap>`. */\nexport function Source(props: SourceProps): ReactNode {\n const map = useSMap();\n const { id, source, children } = props;\n const latest = useRef(source);\n latest.current = source;\n const inside = useRef(new Set<string>());\n const [shown, setShown] = useState<{ map: SMapMap; generation: number } | null>(null);\n const sourceKey = optionsKey(source);\n\n useEffect(() => {\n if (!map) { return undefined; }\n map.addSource(id, latest.current);\n setShown((s) => ({ map, generation: (s?.generation ?? 0) + 1 }));\n return () => {\n if (removedMaps.has(map)) { return; }\n // Layers first: a source still in use cannot be removed.\n inside.current.forEach((layerId) => quietly(() => map.removeLayer(layerId)));\n inside.current.clear();\n quietly(() => map.removeSource(id));\n };\n }, [map, id, sourceKey]);\n\n const scope = useMemo<SourceScope>(() => ({\n id,\n register: (layerId: string) => {\n inside.current.add(layerId);\n return () => inside.current.delete(layerId);\n },\n }), [id]);\n\n if (!map || !shown || shown.map !== map) { return null; }\n // A new generation (the source added again) mounts the children again, so their layers are added again.\n return (\n <SourceContext.Provider value={scope}>\n <Fragment key={shown.generation}>{children}</Fragment>\n </SourceContext.Provider>\n );\n}\n\n// ------------------------------------------------------------------ <StyleLayer>\n\nexport interface StyleLayerProps {\n /**\n * A Style Specification v8 layer, passed through unchanged (copied from Mapbox Studio, Maputnik or a MapLibre /\n * Mapbox GL JS page). Inside `<Source>` its `source` defaults to that source. A change of `paint`, `layout` or\n * `filter` is applied in place (`setPaint` / `setLayout` / `setFilter`); any other change adds the layer again.\n */\n layer: StyleLayerSpec;\n /** A layer id to draw under (a basemap layer or one of yours), instead of a slot. */\n before?: string;\n /** `bottom`, `roads`, `labels` or `top`. Without `slot` or `before` the layer draws on top, in the order added. */\n slot?: Slot;\n /** Shows or hides the layer (default true; the layout's `visibility`). */\n visible?: boolean;\n}\n\nfunction effectiveLayer(layer: StyleLayerSpec, sourceId: string | undefined, visible: boolean): StyleLayerSpec {\n const out: StyleLayerSpec = { ...layer };\n if (out.source === undefined && sourceId !== undefined) { out.source = sourceId; }\n if (!visible) { out.layout = { ...(layer.layout || {}), visibility: 'none' }; }\n return out;\n}\n\nfunction structureKey(layer: StyleLayerSpec, before?: string, slot?: Slot): string {\n const { paint: _p, layout: _l, filter: _f, ...rest } = layer;\n return optionsKey(rest) + '|' + (before ?? '') + '|' + (slot ?? '');\n}\n\n/** Calls `set(name, value)` for every key whose value differs (a removed key gets `undefined`, its default). */\nfunction applyDiff(prev: Record<string, unknown> | undefined, next: Record<string, unknown> | undefined,\n set: (name: string, value: unknown) => void): void {\n const a = prev || {};\n const b = next || {};\n for (const name of new Set([...Object.keys(a), ...Object.keys(b)])) {\n if (optionsKey(a[name]) !== optionsKey(b[name])) { set(name, b[name]); }\n }\n}\n\n/** A Style Specification layer (`addStyleLayer`). Must be inside `<SMap>`, and inside `<Source>` for its own source. */\nexport function StyleLayer(props: StyleLayerProps): null {\n const map = useSMap();\n const scope = useContext(SourceContext);\n const { layer, before, slot, visible = true } = props;\n const current = effectiveLayer(layer, scope?.id, visible);\n const latest = useRef(current);\n latest.current = current;\n const shown = useRef<{ map: SMapMap; layer: StyleLayerSpec } | null>(null);\n const structure = structureKey(current, before, slot);\n\n useEffect(() => {\n if (!map) { return undefined; }\n const l = latest.current;\n const options: { before?: string; slot?: Slot } = {};\n if (before !== undefined) { options.before = before; }\n if (slot !== undefined) { options.slot = slot; }\n map.addStyleLayer(l, options);\n shown.current = { map, layer: l };\n const unregister = scope?.register(l.id);\n return () => {\n shown.current = null;\n const stillMine = unregister ? unregister() : true;\n if (stillMine && !removedMaps.has(map)) { quietly(() => map.removeLayer(l.id)); }\n };\n }, [map, structure, scope]);\n\n const looks = optionsKey(current.paint) + optionsKey(current.layout) + optionsKey(current.filter);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map) { return; }\n const next = latest.current;\n const prev = s.layer;\n if (prev === next) { return; }\n applyDiff(prev.paint, next.paint, (name, value) => map.setPaint(next.id, name, value));\n applyDiff(prev.layout, next.layout, (name, value) => map.setLayout(next.id, name, value));\n if (optionsKey(prev.filter) !== optionsKey(next.filter)) { map.setFilter(next.id, (next.filter as unknown[] | undefined) ?? null); }\n s.layer = next;\n }, [map, looks]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ external layers\n\ntype AddMethod = 'addRasterLayer' | 'addWmsLayer' | 'addWmtsLayer' | 'addVectorTiles' | 'addArcGisLayer';\n\nfunction useAddedLayer(method: AddMethod, id: string, options: object, remove: (map: SMapMap) => void): null {\n const map = useSMap();\n const latest = useRef(options);\n latest.current = options;\n const removeLatest = useRef(remove);\n removeLatest.current = remove;\n const looks = optionsKey(options);\n useEffect(() => {\n if (!map) { return undefined; }\n (map[method] as (id: string, o: object) => unknown)(id, latest.current);\n const removeNow = removeLatest.current;\n return () => {\n if (!removedMaps.has(map)) { removeNow(map); }\n };\n }, [map, method, id, looks]);\n return null;\n}\n\nexport type RasterLayerProps = RasterLayerOptions & { id: string };\nexport type WmsLayerProps = WmsLayerOptions & { id: string };\nexport type WmtsLayerProps = WmtsLayerOptions & { id: string };\nexport type VectorTilesProps = VectorTilesOptions & { id: string };\nexport type ArcGisLayerProps = ArcGisLayerOptions & { id: string };\n\nfunction split<T extends { id: string }>(props: T): [string, Omit<T, 'id'>] {\n const { id, ...options } = props;\n return [id, options];\n}\n\n/** Raster tiles from `{z}/{x}/{y}` templates or a TileJSON URL (`addRasterLayer`). A change of a prop adds it again. */\nexport function RasterLayer(props: RasterLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addRasterLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMS service, one GetMap per tile (`addWmsLayer`). */\nexport function WmsLayer(props: WmsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMTS layer from a GetCapabilities URL or a REST template (`addWmtsLayer`). */\nexport function WmtsLayer(props: WmtsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmtsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** Vector tiles or a PMTiles archive from any URL, drawn by your style layers (`addVectorTiles`). */\nexport function VectorTiles(props: VectorTilesProps): null {\n const [id, options] = split(props);\n const layerIds = (options.layers || []).map((l) => l.id);\n return useAddedLayer('addVectorTiles', id, options, (map) => {\n layerIds.forEach((l) => quietly(() => map.removeLayer(l)));\n quietly(() => map.removeLayer(id));\n quietly(() => map.removeSource(id));\n });\n}\n\n/** An ArcGIS REST MapServer or VectorTileServer (`addArcGisLayer`). */\nexport function ArcGisLayer(props: ArcGisLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addArcGisLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n// ------------------------------------------------------------------ <Data>\n\nexport interface DataProps extends ReadOptions {\n /** The data id: points are the layer `<id>`, lines `<id>:lines`, areas `<id>:areas` (as `addData`). */\n id: string;\n /**\n * The file: KML, KMZ, GPX, an encoded polyline, WKT, WKB, CSV, TopoJSON or GeoJSON, as text, bytes, a Blob / File\n * or a parsed object. `format` is guessed when not given. A new value reads the file again.\n */\n data: DataInput;\n /** Layer options of the points, lines and areas (simplestyle properties draw when no colour is given). */\n options?: DataLayerOptions;\n /** Where the layers draw (same as `options.slot`); without one they draw on top, in the order added. */\n slot?: Slot;\n onTap?: TapHandler;\n /** Shows or hides the layers (default true). */\n visible?: boolean;\n popup?: PopupFunction;\n popupOptions?: PopupOptions;\n /** Called once the file is drawn. */\n onLoad?: () => void;\n /** Called when the file cannot be read. */\n onError?: (error: unknown) => void;\n}\n\nconst dataLayerIds = (id: string) => [id, `${id}:lines`, `${id}:areas`];\n\n/** A data file in any supported format, drawn as points, lines and areas (`addData`). Must be inside `<SMap>`. */\nexport function Data(props: DataProps): null {\n const map = useSMap();\n const { id, data, format, lat, lng, options, slot, onTap, visible = true, popupOptions } = props;\n const latest = useRef(props);\n latest.current = props;\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '') + '|' + (format ?? '') + '|' + (lat ?? '') + '|' + (lng ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const o: Record<string, unknown> = layerOptions(latest, hasTap, hasPopup);\n if (p.format !== undefined) { o.format = p.format; }\n if (p.lat !== undefined) { o.lat = p.lat; }\n if (p.lng !== undefined) { o.lng = p.lng; }\n const ids = dataLayerIds(id);\n let alive = true;\n // The file is read first (a promise), then drawn.\n Promise.resolve(map.addData(id, p.data, o)).then(() => {\n if (removedMaps.has(map)) { return; }\n if (!alive) { ids.forEach((l) => quietly(() => map.removeLayer(l))); return; }\n if (latest.current.visible === false) { map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, false)); }\n latest.current.onLoad?.();\n }, (e: unknown) => { if (alive) { latest.current.onError?.(e); } });\n shownVisible.current = p.visible !== false;\n return () => {\n alive = false;\n if (removedMaps.has(map)) { return; }\n ids.forEach((l) => quietly(() => map.removeLayer(l)));\n };\n }, [map, id, data, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n const ids = dataLayerIds(id);\n map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, visible));\n }, [map, id, visible]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ <Layers>\n\nexport interface LayersProps {\n /** A layer description (`toJSON()` of any sMap SDK), as an object or JSON text. A new value loads it again. */\n json: LayerDescription | string;\n}\n\n/** Loads a layer description (`loadLayers`); its layers and sources are removed when the component unmounts. */\nexport function Layers(props: LayersProps): null {\n const map = useSMap();\n const latest = useRef(props.json);\n latest.current = props.json;\n const jsonKey = typeof props.json === 'string' ? props.json : optionsKey(props.json);\n useEffect(() => {\n if (!map) { return undefined; }\n const json = latest.current;\n map.loadLayers(json);\n const d: LayerDescription = typeof json === 'string' ? JSON.parse(json) : json;\n return () => {\n if (removedMaps.has(map)) { return; }\n [...(d.layers || [])].reverse().forEach((l) => quietly(() => map.removeLayer(l.id)));\n Object.keys(d.sources || {}).forEach((s) => quietly(() => map.removeSource(s)));\n };\n }, [map, jsonKey]);\n return null;\n}\n\n// ------------------------------------------------------------------ <DeckLayer>\n\nexport interface DeckLayerProps {\n /** A deck.gl layer instance. A new instance with the same id replaces it (deck.gl's own way of updating). */\n layer: DeckLayerLike;\n}\n\n/** A deck.gl layer drawn interleaved with the map (`addDeckLayer`; web only). Must be inside `<SMap>`. */\nexport function DeckLayer(props: DeckLayerProps): null {\n const map = useSMap();\n const { layer } = props;\n const latest = useRef(layer);\n latest.current = layer;\n const shown = useRef<{ map: SMapMap; layer: DeckLayerLike } | null>(null);\n useEffect(() => {\n if (!map) { return undefined; }\n map.addDeckLayer(latest.current);\n shown.current = { map, layer: latest.current };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { quietly(() => map.removeDeckLayer(layer.id)); }\n };\n }, [map, layer.id]);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.layer === layer) { return; }\n s.layer = layer;\n map.addDeckLayer(layer);\n }, [map, layer]);\n return null;\n}\n\n// ------------------------------------------------------------------ hooks and helpers\n\n/**\n * A `{z}/{x}/{y}` raster tile URL template on the map's node for a scheme or `custom:<id>` (`rasterUrl`), for\n * tools without vector tiles. Null until the map is ready.\n */\nexport function useRasterUrl(style?: StyleFlavor | CustomStyleName, options?: { lang?: string; retina?: boolean }): string | null {\n const map = useSMap();\n const lang = options?.lang;\n const retina = options?.retina;\n return useMemo(() => {\n if (!map) { return null; }\n const o: { lang?: string; retina?: boolean } = {};\n if (lang !== undefined) { o.lang = lang; }\n if (retina !== undefined) { o.retina = retina; }\n return map.rasterUrl(style, o);\n }, [map, style, lang, retina]);\n}\n\ninterface Formats {\n read(input: DataInput, options?: ReadOptions): GeoJSONFeatureCollection | Promise<GeoJSONFeatureCollection>;\n}\n\n/**\n * Reads a file into a GeoJSON FeatureCollection on the device (`formats.read` of `@superrouteca/smap`), no map\n * needed. `format` is guessed from the content when not given.\n */\nexport const formats: Formats = {\n read(input: DataInput, options?: ReadOptions) {\n const f = (sdk as unknown as { formats?: Formats }).formats;\n if (!f) { throw new Error('sMap: formats need @superrouteca/smap 1.1.0 or later'); }\n return f.read(input, options);\n },\n};\n\nexport type { DataFormat };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAUO;AACP,kBAA+H;AAwN3H;AAnNJ,IAAM,iBAAa,4BAA8B,IAAI;AAG9C,IAAM,cAAc,oBAAI,QAAiB;AAGzC,SAAS,UAA0B;AACxC,aAAO,yBAAW,UAAU;AAC9B;AA8DA,IAAM,MAAM,CAAC,MAAe,KAAK,UAAU,KAAK,IAAI;AAEpD,SAAS,cAAc,MAAc,MAA6B;AAChE,QAAM,MAAc,CAAC;AACrB,MAAI,UAAU;AACd,MAAI,KAAK,WAAW,UAAa,IAAI,KAAK,MAAM,MAAM,IAAI,KAAK,MAAM,GAAG;AAAE,QAAI,SAAS,KAAK;AAAQ,cAAU;AAAA,EAAM;AACpH,aAAW,KAAK,CAAC,QAAQ,WAAW,OAAO,GAAY;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S;AACxB,aAAO,uBAAQ,MAAM;AACnB,QAAI,CAAC,KAAK;AAAE,aAAO;AAAA,IAAM;AACzB,UAAM,IAAyC,CAAC;AAChD,QAAI,SAAS,QAAW;AAAE,QAAE,OAAO;AAAA,IAAM;AACzC,QAAI,WAAW,QAAW;AAAE,QAAE,SAAS;AAAA,IAAQ;AAC/C,WAAO,IAAI,UAAU,OAAO,CAAC;AAAA,EAC/B,GAAG,CAAC,KAAK,OAAO,MAAM,MAAM,CAAC;AAC/B;AAUO,IAAMC,WAAmB;AAAA,EAC9B,KAAK,OAAkB,SAAuB;AAC5C,UAAM,IAA8C;AACpD,QAAI,CAAC,GAAG;AAAE,YAAM,IAAI,MAAM,sDAAsD;AAAA,IAAG;AACnF,WAAO,EAAE,KAAK,OAAO,OAAO;AAAA,EAC9B;AACF;;;AN9VA,IAAAC,eAAyC;","names":["formats","SMap","BaseMap","import_react","import_react","import_jsx_runtime","optionsKey","import_react","import_react_dom","import_jsx_runtime","import_react","key","PlanEditor","import_react","import_jsx_runtime","formats","import_smap"]}
|
package/dist/index.js
CHANGED
|
@@ -547,7 +547,8 @@ function usePlanEditor(props) {
|
|
|
547
547
|
smapUrl: props.smapUrl,
|
|
548
548
|
fastPath: props.fastPath,
|
|
549
549
|
fastPathTimeout: props.fastPathTimeout,
|
|
550
|
-
fastPathRefineTimeout: props.fastPathRefineTimeout
|
|
550
|
+
fastPathRefineTimeout: props.fastPathRefineTimeout,
|
|
551
|
+
insertWaitTimeout: props.insertWaitTimeout
|
|
551
552
|
});
|
|
552
553
|
useEffect5(() => {
|
|
553
554
|
if (!map) {
|
|
@@ -575,7 +576,8 @@ function usePlanEditor(props) {
|
|
|
575
576
|
smapUrl: p.smapUrl,
|
|
576
577
|
fastPath: p.fastPath,
|
|
577
578
|
fastPathTimeout: p.fastPathTimeout,
|
|
578
|
-
fastPathRefineTimeout: p.fastPathRefineTimeout
|
|
579
|
+
fastPathRefineTimeout: p.fastPathRefineTimeout,
|
|
580
|
+
insertWaitTimeout: p.insertWaitTimeout
|
|
579
581
|
};
|
|
580
582
|
for (const k of Object.keys(options)) {
|
|
581
583
|
if (options[k] === void 0) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SMap.tsx","../src/layers.tsx","../src/tools.tsx","../src/features.tsx","../src/plan.tsx","../src/interop.tsx","../src/index.ts"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport { Map as BaseMap, type LngLatLike, type PopupOptions, type StyleFlavor, type ToolsChangeEvent, type ToolsOptions } from '@superrouteca/smap';\nimport type { BasemapOverrides, CustomStyle, SMapMap } from './types';\n\nexport type { SMapMap };\n\nconst MapContext = createContext<SMapMap | null>(null);\n\n/** Maps that were removed: their layers must not be touched any more. */\nexport const removedMaps = new WeakSet<SMapMap>();\n\n/** The map of the nearest `<SMap>` above, once it is ready (null before). */\nexport function useSMap(): SMapMap | null {\n return useContext(MapContext);\n}\n\nexport interface SMapProps {\n /** A map key (`smk_…`) whose allowlist names this site. Read when the map is created. */\n apiKey?: string;\n /** A map token. Read when the map is created; changing it creates the map again (use `getToken` to renew). */\n token?: string;\n /** Called at start and again two minutes before each token expires. */\n getToken?: () => string | Promise<string>;\n /**\n * A colour scheme, a saved custom style (`custom:sms_…`), or a style URL or object of your own. Changing it keeps\n * the layers and the basemap overrides.\n */\n style?: StyleFlavor | CustomStyle | string | Record<string, unknown>;\n /**\n * Basemap overrides by class (`{ water: { color: '#9cc0e6' }, pois: { visible: false } }`): a new value replaces the\n * previous overrides (`setBasemap`); removing the prop clears them. Kept across style and language changes.\n */\n basemap?: BasemapOverrides;\n /** Label language (`en`, `fr`, `zh-Hans`, …). Changing it keeps the layers. */\n language?: string;\n /** [longitude, latitude] or `{lng, lat}`; the camera follows a change. */\n center?: LngLatLike;\n zoom?: number;\n bearing?: number;\n pitch?: number;\n /** Node URLs known in advance, used while `baseUrl` is down. */\n nodes?: string[];\n /** The map service, `https://tile.srsr.ca` by default. */\n baseUrl?: string;\n /** Read from the nearest service node (default true). */\n nearest?: boolean;\n projection?: 'mercator' | 'globe';\n /** Buildings in 3D. */\n buildings3D?: boolean;\n /** Default popup options of every layer and of `openPopup`. Read when the map is created. */\n popup?: PopupOptions;\n /** Shown while a popup's content is a pending promise. Read when the map is created. */\n popupLoading?: string | Node;\n /**\n * Map tools: the ids hidden from the start, where the tools control sits (or false for none) and its labels. Read\n * when the map is created; register tools with `<Tool>`.\n */\n tools?: ToolsOptions;\n /** Called after every change of the tools' visibility; the map keeps no state itself. */\n onToolsChange?: (event: ToolsChangeEvent) => void;\n /** Further options handed to the map when it is created (minZoom, maxZoom, maxBounds, hash, …). */\n mapOptions?: Record<string, unknown>;\n /** Called once the first style has loaded, with the map. */\n onReady?: (map: SMapMap) => void;\n /** Called when the map cannot start. */\n onError?: (error: unknown) => void;\n /** Class and style of the element holding the map (it fills the element). */\n className?: string;\n containerStyle?: CSSProperties;\n id?: string;\n /** Layer components (`<Points>`, `<Source>`, `<StyleLayer>`, `<RasterLayer>`, `<Data>`, …), or anything to draw over the map. */\n children?: ReactNode;\n}\n\ntype Camera = { center?: LngLatLike; zoom?: number; bearing?: number; pitch?: number };\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\nfunction cameraChanges(prev: Camera, next: Camera): Camera | null {\n const out: Camera = {};\n let changed = false;\n if (next.center !== undefined && key(next.center) !== key(prev.center)) { out.center = next.center; changed = true; }\n for (const k of ['zoom', 'bearing', 'pitch'] as const) {\n if (next[k] !== undefined && next[k] !== prev[k]) { out[k] = next[k]; changed = true; }\n }\n return changed ? out : null;\n}\n\n/**\n * A map. Created in the browser only (after the component mounts), so it can be rendered on a server. The ref is\n * the SDK map once it is ready (null before).\n */\nexport const SMap = forwardRef<SMapMap | null, SMapProps>(function SMap(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const [map, setMap] = useState<SMapMap | null>(null);\n const latest = useRef(props);\n latest.current = props;\n // What the map shows now, so a prop that did not change is not applied again.\n const applied = useRef<{ style: string; language: string; camera: Camera; projection: string; buildings: boolean; basemap: string }>(\n { style: '', language: '', camera: {}, projection: '', buildings: false, basemap: key(undefined) });\n\n useImperativeHandle(ref, () => map as SMapMap, [map]);\n\n const nodesKey = key(props.nodes);\n const mapOptionsKey = key(props.mapOptions);\n const hasGetToken = !!props.getToken;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) { return undefined; }\n const p = latest.current;\n const options: Record<string, unknown> = {\n ...(p.mapOptions || {}),\n container,\n apiKey: p.apiKey,\n token: p.token,\n getToken: p.getToken ? () => latest.current.getToken!() : undefined,\n style: p.style,\n language: p.language,\n center: p.center,\n zoom: p.zoom,\n bearing: p.bearing,\n pitch: p.pitch,\n nodes: p.nodes,\n baseUrl: p.baseUrl,\n nearest: p.nearest,\n projection: p.projection,\n popup: p.popup,\n popupLoading: p.popupLoading,\n tools: p.tools,\n };\n for (const k of Object.keys(options)) { if (options[k] === undefined) { delete options[k]; } }\n let alive = true;\n let ready = false;\n let created: SMapMap;\n try {\n created = new BaseMap(options as unknown as ConstructorParameters<typeof BaseMap>[0]) as SMapMap;\n } catch (e) {\n latest.current.onError?.(e);\n return undefined;\n }\n applied.current = {\n style: key(p.style ?? 'light'),\n language: key(p.language ?? null),\n camera: { center: p.center, zoom: p.zoom, bearing: p.bearing, pitch: p.pitch },\n projection: p.projection ?? 'mercator',\n buildings: false,\n basemap: key(undefined),\n };\n created.onToolsChange((e) => latest.current.onToolsChange?.(e));\n created.ready.then(() => {\n ready = true;\n if (!alive) { created.remove(); return; }\n const overrides = latest.current.basemap;\n if (overrides !== undefined) {\n applied.current.basemap = key(overrides);\n try { created.setBasemap(overrides); } catch (e) { latest.current.onError?.(e); }\n }\n setMap(created);\n latest.current.onReady?.(created);\n }, (e: unknown) => {\n if (alive) { latest.current.onError?.(e); }\n });\n return () => {\n alive = false;\n removedMaps.add(created);\n setMap(null);\n // Before it is ready the map has nothing to remove yet; it is removed as soon as it is.\n if (ready) { created.remove(); }\n };\n }, [props.apiKey, props.token, props.baseUrl, nodesKey, props.nearest, mapOptionsKey, hasGetToken]);\n\n const styleKey = key(props.style ?? 'light');\n useEffect(() => {\n if (!map || applied.current.style === styleKey) { return; }\n applied.current.style = styleKey;\n map.setStyle(latest.current.style ?? 'light');\n }, [map, styleKey]);\n\n const languageKey = key(props.language ?? null);\n useEffect(() => {\n if (!map || applied.current.language === languageKey || props.language === undefined) { return; }\n applied.current.language = languageKey;\n map.setLanguage(props.language);\n }, [map, languageKey]);\n\n const centerKey = key(props.center);\n useEffect(() => {\n if (!map) { return; }\n const next: Camera = { center: props.center, zoom: props.zoom, bearing: props.bearing, pitch: props.pitch };\n const change = cameraChanges(applied.current.camera, next);\n applied.current.camera = next;\n if (change && map.engine) { map.engine.jumpTo(change); }\n }, [map, centerKey, props.zoom, props.bearing, props.pitch]);\n\n useEffect(() => {\n const projection = props.projection ?? 'mercator';\n if (!map || applied.current.projection === projection) { return; }\n applied.current.projection = projection;\n map.setProjection(projection);\n }, [map, props.projection]);\n\n const basemapKey = key(props.basemap);\n useEffect(() => {\n if (!map || applied.current.basemap === basemapKey) { return; }\n applied.current.basemap = basemapKey;\n try { map.setBasemap(latest.current.basemap ?? {}); } catch (e) { latest.current.onError?.(e); }\n }, [map, basemapKey]);\n\n useEffect(() => {\n const on = !!props.buildings3D;\n if (!map || applied.current.buildings === on) { return; }\n applied.current.buildings = on;\n map.setBuildings3D(on);\n }, [map, props.buildings3D]);\n\n return (\n <div\n id={props.id}\n className={props.className}\n style={{ position: 'relative', width: '100%', height: '100%', ...props.containerStyle }}\n >\n <div ref={containerRef} style={{ position: 'absolute', inset: 0 }} />\n <MapContext.Provider value={map}>{props.children}</MapContext.Provider>\n </div>\n );\n});\n","import { useEffect, useRef } from 'react';\nimport type {\n GeoJSONFeature,\n LayerClickEvent,\n LayerData,\n LineOptions,\n PointOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport type { Slot, TapHandler } from './types';\n\nexport type { TapHandler };\n\nexport interface LayerProps<O> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value replaces the data and keeps the look. */\n data: LayerData;\n /** How the layer is drawn; a change draws the layer again. */\n options?: O;\n /** Called when a feature of this layer is tapped or clicked. */\n onTap?: TapHandler;\n /** Shows or hides the layer (default true). */\n visible?: boolean;\n /**\n * The popup opened when the top feature at a click is this layer's (same as `options.popup`, which it replaces):\n * trusted HTML, a DOM node, or a promise of either. `popupTemplate('<b>{name}</b>')` gives a fast, escaped one.\n */\n popup?: (properties: Record<string, unknown>, feature: GeoJSONFeature) => PopupContent | Promise<PopupContent>;\n /** This layer's popup options, over the map's `popup` defaults (same as `options.popupOptions`). */\n popupOptions?: PopupOptions;\n /**\n * Where the layer draws among the basemap's layers (same as `options.slot`): `bottom`, `roads`, `labels` or `top`.\n * Without one the layer draws on top, in the order added, as in 1.0.\n */\n slot?: Slot;\n}\n\nexport type PointsProps = LayerProps<PointOptions>;\nexport type LinesProps = LayerProps<LineOptions>;\nexport type PolygonsProps = LayerProps<PolygonOptions>;\n\ntype Kind = 'addPoints' | 'addLines' | 'addPolygons';\n\n// Options compared by value; functions (popup, onClick) are read when called, so a new function is no change.\nexport function optionsKey(options: unknown): string {\n return JSON.stringify(options ?? {}, (_k, v) => (typeof v === 'function' ? '[fn]' : v));\n}\n\ntype OptionProps = Pick<LayerProps<PointOptions | LineOptions | PolygonOptions>, 'options' | 'onTap' | 'popup' | 'popupOptions' | 'slot'>;\n\n/**\n * The options handed to the SDK for a layer component: its `options` with `slot`, `popupOptions` and click and popup\n * functions that call the newest props (so a new function is no change).\n */\nexport function layerOptions(latest: { current: OptionProps }, hasTap: boolean, hasPopup: boolean): Record<string, unknown> {\n const o: Record<string, unknown> = { ...(latest.current.options || {}) };\n if (hasTap) {\n o.onClick = (feature: GeoJSONFeature, event: LayerClickEvent) => {\n const p = latest.current;\n p.options?.onClick?.(feature, event);\n p.onTap?.(feature.properties || {}, { lat: event.lngLat.lat, lng: event.lngLat.lng }, feature);\n };\n }\n if (hasPopup) {\n const given = latest.current.popup ?? latest.current.options?.popup;\n // A template (a string with {property} placeholders) goes to the SDK as it is; a function is called with the\n // newest props.\n o.popup = typeof given === 'string' ? given : (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const p = latest.current;\n const f = p.popup ?? p.options?.popup;\n return typeof f === 'function' ? f(properties, feature) : f;\n };\n }\n if (latest.current.slot) { o.slot = latest.current.slot; }\n if (latest.current.popupOptions) { o.popupOptions = { ...(o.popupOptions as object || {}), ...latest.current.popupOptions }; }\n return o;\n}\n\nfunction useLayer(kind: Kind, props: LayerProps<PointOptions | LineOptions | PolygonOptions>): null {\n const map = useSMap();\n const { id, data, options, onTap, visible = true, popupOptions, slot } = props;\n const latest = useRef(props);\n latest.current = props;\n const shown = useRef<{ map: SMapMap; data: LayerData } | null>(null);\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const o = layerOptions(latest, hasTap, hasPopup);\n const d = latest.current.data;\n (map[kind] as (id: string, data: LayerData, o: unknown) => SMapMap)(id, d, o);\n if (latest.current.visible === false) { map.setVisible(id, false); }\n shownVisible.current = latest.current.visible !== false;\n shown.current = { map, data: d };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.data === data) { return; }\n s.data = data;\n map.setData(id, data);\n }, [map, id, data]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n map.setVisible(id, visible);\n }, [map, id, visible]);\n\n return null;\n}\n\n/** Points at any scale, clustered or not. Must be inside `<SMap>`. */\nexport function Points(props: PointsProps): null {\n return useLayer('addPoints', props);\n}\n\n/** Lines (routes, tracks). Must be inside `<SMap>`. */\nexport function Lines(props: LinesProps): null {\n return useLayer('addLines', props);\n}\n\n/** Areas, flat or in 3D (`options.extrude`). Must be inside `<SMap>`. */\nexport function Polygons(props: PolygonsProps): null {\n return useLayer('addPolygons', props);\n}\n","import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { ToolKind, ToolPosition } from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface ToolProps {\n /** The tool id, unique on the map (1-64 letters, digits, '-', '_', '.'). */\n id: string;\n /** Shown on the tool's button in the tools control and read by screen readers. */\n label?: string;\n /**\n * A corner of the map (the children are drawn there), or 'none': the children stay where `<Tool>` is, over the\n * map's box. Default 'top-left' (a kind's own corner for `kind`).\n */\n position?: ToolPosition;\n /** A control the map makes instead of children: 'navigation', 'geolocate', 'fullscreen' or 'scale'. */\n kind?: ToolKind;\n /**\n * Data layers instead of children or a kind: one or more layer ids (of `<Points>`, `<Lines>`, `<Polygons>`, the\n * map's layer calls, or the basemap). Hiding the tool hides the layers (layout visibility), showing it shows them.\n */\n layer?: string | string[];\n /** Options of the kind's control (e.g. `{ showCompass: false }`). */\n options?: Record<string, unknown>;\n /** Class and style of the element holding the children. */\n className?: string;\n style?: CSSProperties;\n /** What the tool shows: a panel, a legend, a search box, … Kept while hidden, so its state stays. */\n children?: ReactNode;\n}\n\nconst optionsKey = (v: unknown) => JSON.stringify(v ?? null);\n\n/**\n * A tool floating on the map, shown or hidden by the map's tools control, `setToolVisible` and `setToolsVisible`.\n * Inside an `<SMap>`: `<Tool id=\"legend\" label=\"Legend\" position=\"bottom-left\"><Legend /></Tool>` or\n * `<Tool id=\"zoom\" kind=\"navigation\" />` or, for data layers, `<Tool id=\"stops\" label=\"Stops\" layer={['stops', 'stop-labels']} />`.\n * Removing it removes the tool.\n */\nexport function Tool(props: ToolProps) {\n const map = useSMap();\n const { id, label, kind } = props;\n const layer = props.layer;\n const layerKey = layer === undefined ? null : JSON.stringify(layer);\n const isLayer = layerKey !== null;\n const position = isLayer ? undefined : props.position ?? (kind ? undefined : 'top-left');\n const inPlace = !kind && !isLayer && position === 'none';\n // A corner tool's children live in an element of its own that the map places in the corner; React renders into it\n // through a portal, so the map may move it without React losing it. Made after mounting, so never on a server.\n const [box, setBox] = useState<HTMLDivElement | null>(null);\n useEffect(() => { if (!kind && !isLayer && !inPlace && !box) { setBox(document.createElement('div')); } }, [kind, isLayer, inPlace, box]);\n const inPlaceRef = useRef<HTMLDivElement | null>(null);\n const kindOptions = optionsKey(props.options);\n const latestOptions = useRef(props.options);\n latestOptions.current = props.options;\n\n if (box) {\n box.className = props.className ?? '';\n box.removeAttribute('style');\n Object.assign(box.style, props.style || {});\n }\n\n useEffect(() => {\n if (!map) { return undefined; }\n if (layerKey !== null) {\n map.addTool(id, { layer: JSON.parse(layerKey) as string | string[] }, { label });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }\n const target = kind ?? (inPlace ? inPlaceRef.current : box);\n if (!target) { return undefined; }\n map.addTool(id, target, { label, position, options: latestOptions.current });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }, [map, id, label, position, kind, inPlace, kindOptions, box, layerKey]);\n\n if (kind || isLayer) { return null; }\n if (inPlace) {\n return <div ref={inPlaceRef} className={props.className} style={props.style}>{props.children}</div>;\n }\n return box ? createPortal(props.children, box) : null;\n}\n","// The 1.2.0 calls as components (MOBILE-SDK-SPEC \"Native features\"; the map itself has them all, through the ref\n// or useSMap()): custom markers rendered by React, heat maps, 3D models, painted tiles and the drawing tool.\nimport { useEffect, useRef, useState, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type {\n CustomMarkerOptions,\n DrawEvent,\n DrawTool as SdkDrawTool,\n DrawToolOptions,\n GeoJSONFeature,\n HeatmapOptions,\n LayerData,\n ModelOptions,\n RasterLayerOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\nimport { optionsKey } from './layers';\n\nexport interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value moves the markers and keeps the others. */\n data: LayerData;\n /** The React content of one marker (rendered again when the feature's properties change). */\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => ReactNode;\n}\n\n/**\n * Custom markers (G1) whose content is React: the map makes each marker's element when its point comes into view and\n * React renders `render` into it through a portal (so context, state and events work as anywhere in the app).\n * Draggable with `draggable`; tooltips and popups as on any layer. Must be inside `<SMap>`.\n */\nexport function CustomMarkers(props: CustomMarkersProps) {\n const map = useSMap();\n const { id, data, render: _render, ...rest } = props;\n const latest = useRef(props);\n latest.current = props;\n // The element the map holds for each feature (by its key), with what React renders into it. The map keeps an\n // element while its point is out of view and shows it again later, so an entry goes only when the feature is\n // rendered again or leaves the data.\n const [entries, setEntries] = useState<Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>>(new Map());\n const held = useRef(new Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>());\n const shown = useRef<LayerData | null>(null);\n const looks = optionsKey(rest);\n const keyOf = (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const by = latest.current.idProperty;\n const v = by ? properties[by] : feature.id;\n return v === undefined || v === null ? `@${JSON.stringify(feature.geometry)}` : String(v);\n };\n\n useEffect(() => {\n if (!map) { return undefined; }\n held.current = new Map();\n let scheduled = false;\n const publish = () => {\n if (scheduled) { return; }\n scheduled = true;\n queueMicrotask(() => { scheduled = false; setEntries(new Map(held.current)); });\n };\n const options = {\n ...latest.current,\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const el = document.createElement('div');\n held.current.set(keyOf(properties, feature), { el, properties, feature });\n publish();\n return el;\n },\n } as unknown as CustomMarkerOptions & { id?: string; data?: unknown };\n delete options.id;\n delete options.data;\n map.addCustomMarkers(id, latest.current.data, options);\n shown.current = latest.current.data;\n return () => {\n shown.current = null;\n held.current = new Map();\n setEntries(new Map());\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks]);\n\n useEffect(() => {\n if (!map || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n // Features no longer in the data lose their content.\n const keep = new Set<string>();\n const features = (data && !Array.isArray(data) && (data as { features?: GeoJSONFeature[] }).features) || [];\n for (const f of features) { keep.add(keyOf((f.properties || {}) as Record<string, unknown>, f)); }\n const by = latest.current.idProperty;\n if (Array.isArray(data) && by) { (data as Record<string, unknown>[]).forEach((p) => keep.add(String(p[by]))); }\n // Points given as an array without idProperty have no key to compare: their content stays until the layer goes.\n if (!Array.isArray(data) || by) {\n let changed = false;\n for (const k of [...held.current.keys()]) { if (!keep.has(k)) { held.current.delete(k); changed = true; } }\n if (changed) { setEntries(new Map(held.current)); }\n }\n }, [map, id, data]);\n\n return (\n <>\n {[...entries.entries()].map(([k, e]) => createPortal(latest.current.render(e.properties, e.feature), e.el, `${id}\\u0000${k}`))}\n </>\n );\n}\n\nfunction useNativeLayer(add: (map: NonNullable<ReturnType<typeof useSMap>>) => void, id: string, looks: string, data?: LayerData): void {\n const map = useSMap();\n const shown = useRef<LayerData | undefined | null>(null);\n const addRef = useRef(add);\n addRef.current = add;\n useEffect(() => {\n if (!map) { return undefined; }\n addRef.current(map);\n shown.current = data;\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n // The data is set below; a new look adds the layer again.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map, id, looks]);\n useEffect(() => {\n if (!map || data === undefined || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n }, [map, id, data]);\n}\n\nexport interface HeatmapProps { id: string; data: LayerData; options?: HeatmapOptions }\n\n/** A heat map of points (G7). Must be inside `<SMap>`. */\nexport function Heatmap(props: HeatmapProps): null {\n useNativeLayer((m) => m.addHeatmap(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface ModelsProps { id: string; data: LayerData; options: ModelOptions }\n\n/** glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`). Must be inside `<SMap>`. */\nexport function Models(props: ModelsProps): null {\n useNativeLayer((m) => m.addModels(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface CanvasTilesProps {\n id: string;\n /** Paints one tile (a 2D context of the tile's canvas); called again for each tile that comes into view. */\n draw: Parameters<NonNullable<ReturnType<typeof useSMap>>['addCanvasTiles']>[1];\n options?: RasterLayerOptions;\n}\n\n/** Raster tiles you paint (G14). A new `draw` is used for the next tiles painted. Must be inside `<SMap>`. */\nexport function CanvasTiles(props: CanvasTilesProps): null {\n const draw = useRef(props.draw);\n draw.current = props.draw;\n useNativeLayer((m) => m.addCanvasTiles(props.id, (...a: Parameters<CanvasTilesProps['draw']>) => draw.current(...a), props.options), props.id, optionsKey(props.options));\n return null;\n}\n\nexport interface DrawToolProps extends Omit<DrawToolOptions, 'onChange'> {\n /** Called after each change: created, edited or deleted, with every shape. */\n onChange?: (event: DrawEvent) => void;\n /** Called with the tool once it exists (start, select, undo, getAll, …), and with null when it goes. */\n onTool?: (tool: SdkDrawTool | null) => void;\n}\n\n/** A drawing and editing tool (G3) for as long as it is mounted. Must be inside `<SMap>`. */\nexport function DrawTool(props: DrawToolProps): null {\n const map = useSMap();\n const latest = useRef(props);\n latest.current = props;\n const { onChange: _c, onTool: _t, ...rest } = props;\n const looks = optionsKey(rest);\n useEffect(() => {\n if (!map) { return undefined; }\n const { onChange: _a, onTool: _b, ...o } = latest.current;\n const tool = map.drawTool({ ...o, onChange: (e: DrawEvent) => latest.current.onChange?.(e) });\n latest.current.onTool?.(tool);\n return () => {\n latest.current.onTool?.(null);\n if (!removedMaps.has(map)) { tool.destroy(); }\n };\n }, [map, looks]);\n return null;\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport type {\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanChangeEvent,\n PlanCredentials,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface PlanEditorProps extends Omit<MapPlanEditorOptions, 'credentials' | 'plan' | 'fetch'> {\n /**\n * `{ token: () => Promise<string | PlanTokenAnswer> }` (a short-lived plan token from your own server, which mints it\n * with POST /v1/plan/token; the latest function is called)\n * or `{ key: 'smk_…' }`. Changing between a token and a key, or the key, starts a new editor.\n */\n credentials: PlanCredentials;\n /**\n * The plan to edit. A plan that differs from the one the editor holds replaces it (and its history); handing the\n * plan of `onChange` back is not a change.\n */\n plan?: Plan;\n /** The fetch to use (the page's by default). Read when the editor is made. */\n fetch?: typeof fetch;\n /** Called after every change: the plan to keep, its prices, and whether it is still on its way. */\n onChange?: (event: PlanChangeEvent) => void;\n onError?: (error: PlanEditorError, kind: string) => void;\n onBusy?: (busy: boolean) => void;\n onSnapshot?: (event: PlanSnapshotEvent) => void;\n /** Called once the editor exists, with it. */\n onReady?: (editor: MapPlanEditor) => void;\n}\n\n// The map was removed with its layers and tools: only the editor's own calls and snapshot are left to close.\nfunction destroyOffMap(made: MapPlanEditor) {\n made.layer.remove = () => {};\n try { made.destroy(); } catch { /* the map is gone */ }\n}\n\nexport interface UsePlanEditorResult extends PlanEditorState {\n /** The editor (null until the map is ready). */\n editor: MapPlanEditor | null;\n}\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\n// The plan's content without the routes the editor adds for vehicles without stops, so that a plan handed back from\n// onChange is recognised as the one the editor holds.\nfunction planKey(plan: Plan | null | undefined): string {\n if (!plan) { return key(null); }\n const routes = (plan.routes || [])\n .map((r) => ({ v: String(r.vehicle_id), s: (r.reverse ? r.stops.slice().reverse() : r.stops).map(String) }))\n .filter((r) => r.s.length)\n .sort((a, b) => (a.v < b.v ? -1 : a.v > b.v ? 1 : 0));\n const jobs = (plan.jobs || []).map((j) => j.id).sort();\n return key({ vehicles: plan.vehicles, jobs, routes, region: plan.region ?? null, profile: plan.profile ?? null, departed_at: plan.departed_at ?? null });\n}\n\nconst EMPTY: PlanEditorState = {\n plan: null, result: null, busy: false, error: null, canUndo: false, canRedo: false, choices: null, locked: [], last: null, preview: null, path: null,\n};\n\n/**\n * A plan editor on the map of the nearest `<SMap>`: its layers, the ready-made panel (unless `panel={false}`), and its\n * state for your own interface. The editor is made when the map is ready and destroyed when the component unmounts.\n */\nexport function usePlanEditor(props: PlanEditorProps): UsePlanEditorResult {\n const map = useSMap();\n const [editor, setEditor] = useState<MapPlanEditor | null>(null);\n const [state, setState] = useState<PlanEditorState>(EMPTY);\n const latest = useRef(props);\n latest.current = props;\n // The key of the last plan prop applied, so an unchanged prop is not applied again.\n const applied = useRef<string | null>(null);\n const credentialKey = 'key' in props.credentials ? 'key:' + props.credentials.key : 'token';\n const madeKey = key({\n baseUrl: props.baseUrl, app: props.app, region: props.region, profile: props.profile, snapshot: props.snapshot, geometry: props.geometry,\n insertLimit: props.insertLimit, objective: props.objective, id: props.id, colors: props.colors, preview: props.preview,\n panel: props.panel, labels: props.labels, smapUrl: props.smapUrl, fastPath: props.fastPath, fastPathTimeout: props.fastPathTimeout,\n fastPathRefineTimeout: props.fastPathRefineTimeout,\n });\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const credentials: PlanCredentials = 'key' in p.credentials\n ? { key: p.credentials.key }\n : { token: () => (latest.current.credentials as Extract<PlanCredentials, { token: unknown }>).token() };\n const options: MapPlanEditorOptions = {\n credentials, app: p.app, baseUrl: p.baseUrl, fetch: p.fetch, region: p.region, profile: p.profile, snapshot: p.snapshot,\n geometry: p.geometry, insertLimit: p.insertLimit, objective: p.objective, id: p.id, colors: p.colors,\n preview: p.preview, language: p.language, labels: p.labels, panel: p.panel,\n smapUrl: p.smapUrl, fastPath: p.fastPath, fastPathTimeout: p.fastPathTimeout, fastPathRefineTimeout: p.fastPathRefineTimeout,\n };\n for (const k of Object.keys(options) as Array<keyof MapPlanEditorOptions>) { if (options[k] === undefined) { delete options[k]; } }\n const made = map.planEditor(options);\n const refresh = () => setState(made.state());\n made.on('change', (e) => { refresh(); latest.current.onChange?.(e); });\n made.on('busy', (e) => { refresh(); latest.current.onBusy?.(e.busy); });\n made.on('error', (e) => { refresh(); latest.current.onError?.(e.error, e.kind); });\n made.on('preview', refresh);\n made.on('snapshot', (e) => latest.current.onSnapshot?.(e));\n applied.current = null;\n setEditor(made);\n latest.current.onReady?.(made);\n return () => {\n setEditor(null);\n setState(EMPTY);\n // Closes its calls and its snapshot; on a map that is still there it also takes its layers and panel away.\n if (!removedMaps.has(map)) { made.destroy(); } else { destroyOffMap(made); }\n };\n }, [map, credentialKey, madeKey]);\n\n // The plan prop: applied when it is not the plan the editor holds.\n const incoming = planKey(props.plan);\n useEffect(() => {\n if (!editor || !latest.current.plan) { return; }\n if (incoming === applied.current || incoming === planKey(editor.getPlan())) { applied.current = incoming; return; }\n applied.current = incoming;\n editor.setPlan(latest.current.plan).catch(() => {});\n }, [editor, incoming]);\n\n useEffect(() => {\n if (editor && editor.panel && props.language) { editor.panel.setLanguage(props.language); }\n }, [editor, props.language]);\n\n return { ...state, editor };\n}\n\n/**\n * `<PlanEditor>` inside an `<SMap>`: edits a plan on the map with the ready-made panel. The ref is the editor (undo,\n * redo, refine, insert, getPlan, …) once the map is ready. Renders nothing itself; the panel is a map tool.\n * <PlanEditor credentials={{ token: getPlanToken }} plan={plan} onChange={(e) => setPlan(e.plan)} language=\"fr\" />\n */\nexport const PlanEditor = forwardRef<MapPlanEditor | null, PlanEditorProps>(function PlanEditor(props, ref) {\n const { editor } = usePlanEditor(props);\n useImperativeHandle(ref, () => editor as MapPlanEditor, [editor]);\n return null;\n});\n","// Components of 1.1.0 (MAP-SDK-DESIGN M24–M36): each maps onto one call of `@superrouteca/smap` and removes what it\n// added when it unmounts.\nimport { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as sdk from '@superrouteca/smap';\nimport type { CustomStyleName, GeoJSONFeatureCollection, PopupOptions, StyleFlavor } from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport { layerOptions, optionsKey } from './layers';\nimport type {\n ArcGisLayerOptions,\n DataFormat,\n DataInput,\n DataLayerOptions,\n DeckLayerLike,\n LayerDescription,\n PopupFunction,\n RasterLayerOptions,\n ReadOptions,\n Slot,\n StyleLayerSpec,\n StyleSource,\n TapHandler,\n VectorTilesOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n} from './types';\n\n/** Calls `f` and drops an error: used when removing what may already be gone (a style change, a parent's removal). */\nfunction quietly(f: () => void): void {\n try { f(); } catch { /* already removed */ }\n}\n\n// ------------------------------------------------------------------ <Source>\n\ninterface SourceScope {\n id: string;\n /**\n * A style layer inside the source registers itself, so the source removes it before removing itself. The function\n * returned unregisters it and says whether it was still registered (false: the source removed it already).\n */\n register(layerId: string): () => boolean;\n}\n\nconst SourceContext = createContext<SourceScope | null>(null);\n\nexport interface SourceProps {\n /** The source id, unique on the map. */\n id: string;\n /**\n * A Style Specification v8 source object (`{ type: 'vector', url }`, `{ type: 'geojson', data }`, …). A new value\n * (compared by value) adds the source again with the layers inside it; keep it stable (a constant or `useMemo`).\n */\n source: StyleSource;\n /** `<StyleLayer>` elements drawing this source; their `source` is filled in. Drawn once the source is added. */\n children?: ReactNode;\n}\n\n/** A Style Specification source (`addSource` / `removeSource`). Must be inside `<SMap>`. */\nexport function Source(props: SourceProps): ReactNode {\n const map = useSMap();\n const { id, source, children } = props;\n const latest = useRef(source);\n latest.current = source;\n const inside = useRef(new Set<string>());\n const [shown, setShown] = useState<{ map: SMapMap; generation: number } | null>(null);\n const sourceKey = optionsKey(source);\n\n useEffect(() => {\n if (!map) { return undefined; }\n map.addSource(id, latest.current);\n setShown((s) => ({ map, generation: (s?.generation ?? 0) + 1 }));\n return () => {\n if (removedMaps.has(map)) { return; }\n // Layers first: a source still in use cannot be removed.\n inside.current.forEach((layerId) => quietly(() => map.removeLayer(layerId)));\n inside.current.clear();\n quietly(() => map.removeSource(id));\n };\n }, [map, id, sourceKey]);\n\n const scope = useMemo<SourceScope>(() => ({\n id,\n register: (layerId: string) => {\n inside.current.add(layerId);\n return () => inside.current.delete(layerId);\n },\n }), [id]);\n\n if (!map || !shown || shown.map !== map) { return null; }\n // A new generation (the source added again) mounts the children again, so their layers are added again.\n return (\n <SourceContext.Provider value={scope}>\n <Fragment key={shown.generation}>{children}</Fragment>\n </SourceContext.Provider>\n );\n}\n\n// ------------------------------------------------------------------ <StyleLayer>\n\nexport interface StyleLayerProps {\n /**\n * A Style Specification v8 layer, passed through unchanged (copied from Mapbox Studio, Maputnik or a MapLibre /\n * Mapbox GL JS page). Inside `<Source>` its `source` defaults to that source. A change of `paint`, `layout` or\n * `filter` is applied in place (`setPaint` / `setLayout` / `setFilter`); any other change adds the layer again.\n */\n layer: StyleLayerSpec;\n /** A layer id to draw under (a basemap layer or one of yours), instead of a slot. */\n before?: string;\n /** `bottom`, `roads`, `labels` or `top`. Without `slot` or `before` the layer draws on top, in the order added. */\n slot?: Slot;\n /** Shows or hides the layer (default true; the layout's `visibility`). */\n visible?: boolean;\n}\n\nfunction effectiveLayer(layer: StyleLayerSpec, sourceId: string | undefined, visible: boolean): StyleLayerSpec {\n const out: StyleLayerSpec = { ...layer };\n if (out.source === undefined && sourceId !== undefined) { out.source = sourceId; }\n if (!visible) { out.layout = { ...(layer.layout || {}), visibility: 'none' }; }\n return out;\n}\n\nfunction structureKey(layer: StyleLayerSpec, before?: string, slot?: Slot): string {\n const { paint: _p, layout: _l, filter: _f, ...rest } = layer;\n return optionsKey(rest) + '|' + (before ?? '') + '|' + (slot ?? '');\n}\n\n/** Calls `set(name, value)` for every key whose value differs (a removed key gets `undefined`, its default). */\nfunction applyDiff(prev: Record<string, unknown> | undefined, next: Record<string, unknown> | undefined,\n set: (name: string, value: unknown) => void): void {\n const a = prev || {};\n const b = next || {};\n for (const name of new Set([...Object.keys(a), ...Object.keys(b)])) {\n if (optionsKey(a[name]) !== optionsKey(b[name])) { set(name, b[name]); }\n }\n}\n\n/** A Style Specification layer (`addStyleLayer`). Must be inside `<SMap>`, and inside `<Source>` for its own source. */\nexport function StyleLayer(props: StyleLayerProps): null {\n const map = useSMap();\n const scope = useContext(SourceContext);\n const { layer, before, slot, visible = true } = props;\n const current = effectiveLayer(layer, scope?.id, visible);\n const latest = useRef(current);\n latest.current = current;\n const shown = useRef<{ map: SMapMap; layer: StyleLayerSpec } | null>(null);\n const structure = structureKey(current, before, slot);\n\n useEffect(() => {\n if (!map) { return undefined; }\n const l = latest.current;\n const options: { before?: string; slot?: Slot } = {};\n if (before !== undefined) { options.before = before; }\n if (slot !== undefined) { options.slot = slot; }\n map.addStyleLayer(l, options);\n shown.current = { map, layer: l };\n const unregister = scope?.register(l.id);\n return () => {\n shown.current = null;\n const stillMine = unregister ? unregister() : true;\n if (stillMine && !removedMaps.has(map)) { quietly(() => map.removeLayer(l.id)); }\n };\n }, [map, structure, scope]);\n\n const looks = optionsKey(current.paint) + optionsKey(current.layout) + optionsKey(current.filter);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map) { return; }\n const next = latest.current;\n const prev = s.layer;\n if (prev === next) { return; }\n applyDiff(prev.paint, next.paint, (name, value) => map.setPaint(next.id, name, value));\n applyDiff(prev.layout, next.layout, (name, value) => map.setLayout(next.id, name, value));\n if (optionsKey(prev.filter) !== optionsKey(next.filter)) { map.setFilter(next.id, (next.filter as unknown[] | undefined) ?? null); }\n s.layer = next;\n }, [map, looks]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ external layers\n\ntype AddMethod = 'addRasterLayer' | 'addWmsLayer' | 'addWmtsLayer' | 'addVectorTiles' | 'addArcGisLayer';\n\nfunction useAddedLayer(method: AddMethod, id: string, options: object, remove: (map: SMapMap) => void): null {\n const map = useSMap();\n const latest = useRef(options);\n latest.current = options;\n const removeLatest = useRef(remove);\n removeLatest.current = remove;\n const looks = optionsKey(options);\n useEffect(() => {\n if (!map) { return undefined; }\n (map[method] as (id: string, o: object) => unknown)(id, latest.current);\n const removeNow = removeLatest.current;\n return () => {\n if (!removedMaps.has(map)) { removeNow(map); }\n };\n }, [map, method, id, looks]);\n return null;\n}\n\nexport type RasterLayerProps = RasterLayerOptions & { id: string };\nexport type WmsLayerProps = WmsLayerOptions & { id: string };\nexport type WmtsLayerProps = WmtsLayerOptions & { id: string };\nexport type VectorTilesProps = VectorTilesOptions & { id: string };\nexport type ArcGisLayerProps = ArcGisLayerOptions & { id: string };\n\nfunction split<T extends { id: string }>(props: T): [string, Omit<T, 'id'>] {\n const { id, ...options } = props;\n return [id, options];\n}\n\n/** Raster tiles from `{z}/{x}/{y}` templates or a TileJSON URL (`addRasterLayer`). A change of a prop adds it again. */\nexport function RasterLayer(props: RasterLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addRasterLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMS service, one GetMap per tile (`addWmsLayer`). */\nexport function WmsLayer(props: WmsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMTS layer from a GetCapabilities URL or a REST template (`addWmtsLayer`). */\nexport function WmtsLayer(props: WmtsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmtsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** Vector tiles or a PMTiles archive from any URL, drawn by your style layers (`addVectorTiles`). */\nexport function VectorTiles(props: VectorTilesProps): null {\n const [id, options] = split(props);\n const layerIds = (options.layers || []).map((l) => l.id);\n return useAddedLayer('addVectorTiles', id, options, (map) => {\n layerIds.forEach((l) => quietly(() => map.removeLayer(l)));\n quietly(() => map.removeLayer(id));\n quietly(() => map.removeSource(id));\n });\n}\n\n/** An ArcGIS REST MapServer or VectorTileServer (`addArcGisLayer`). */\nexport function ArcGisLayer(props: ArcGisLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addArcGisLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n// ------------------------------------------------------------------ <Data>\n\nexport interface DataProps extends ReadOptions {\n /** The data id: points are the layer `<id>`, lines `<id>:lines`, areas `<id>:areas` (as `addData`). */\n id: string;\n /**\n * The file: KML, KMZ, GPX, an encoded polyline, WKT, WKB, CSV, TopoJSON or GeoJSON, as text, bytes, a Blob / File\n * or a parsed object. `format` is guessed when not given. A new value reads the file again.\n */\n data: DataInput;\n /** Layer options of the points, lines and areas (simplestyle properties draw when no colour is given). */\n options?: DataLayerOptions;\n /** Where the layers draw (same as `options.slot`); without one they draw on top, in the order added. */\n slot?: Slot;\n onTap?: TapHandler;\n /** Shows or hides the layers (default true). */\n visible?: boolean;\n popup?: PopupFunction;\n popupOptions?: PopupOptions;\n /** Called once the file is drawn. */\n onLoad?: () => void;\n /** Called when the file cannot be read. */\n onError?: (error: unknown) => void;\n}\n\nconst dataLayerIds = (id: string) => [id, `${id}:lines`, `${id}:areas`];\n\n/** A data file in any supported format, drawn as points, lines and areas (`addData`). Must be inside `<SMap>`. */\nexport function Data(props: DataProps): null {\n const map = useSMap();\n const { id, data, format, lat, lng, options, slot, onTap, visible = true, popupOptions } = props;\n const latest = useRef(props);\n latest.current = props;\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '') + '|' + (format ?? '') + '|' + (lat ?? '') + '|' + (lng ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const o: Record<string, unknown> = layerOptions(latest, hasTap, hasPopup);\n if (p.format !== undefined) { o.format = p.format; }\n if (p.lat !== undefined) { o.lat = p.lat; }\n if (p.lng !== undefined) { o.lng = p.lng; }\n const ids = dataLayerIds(id);\n let alive = true;\n // The file is read first (a promise), then drawn.\n Promise.resolve(map.addData(id, p.data, o)).then(() => {\n if (removedMaps.has(map)) { return; }\n if (!alive) { ids.forEach((l) => quietly(() => map.removeLayer(l))); return; }\n if (latest.current.visible === false) { map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, false)); }\n latest.current.onLoad?.();\n }, (e: unknown) => { if (alive) { latest.current.onError?.(e); } });\n shownVisible.current = p.visible !== false;\n return () => {\n alive = false;\n if (removedMaps.has(map)) { return; }\n ids.forEach((l) => quietly(() => map.removeLayer(l)));\n };\n }, [map, id, data, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n const ids = dataLayerIds(id);\n map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, visible));\n }, [map, id, visible]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ <Layers>\n\nexport interface LayersProps {\n /** A layer description (`toJSON()` of any sMap SDK), as an object or JSON text. A new value loads it again. */\n json: LayerDescription | string;\n}\n\n/** Loads a layer description (`loadLayers`); its layers and sources are removed when the component unmounts. */\nexport function Layers(props: LayersProps): null {\n const map = useSMap();\n const latest = useRef(props.json);\n latest.current = props.json;\n const jsonKey = typeof props.json === 'string' ? props.json : optionsKey(props.json);\n useEffect(() => {\n if (!map) { return undefined; }\n const json = latest.current;\n map.loadLayers(json);\n const d: LayerDescription = typeof json === 'string' ? JSON.parse(json) : json;\n return () => {\n if (removedMaps.has(map)) { return; }\n [...(d.layers || [])].reverse().forEach((l) => quietly(() => map.removeLayer(l.id)));\n Object.keys(d.sources || {}).forEach((s) => quietly(() => map.removeSource(s)));\n };\n }, [map, jsonKey]);\n return null;\n}\n\n// ------------------------------------------------------------------ <DeckLayer>\n\nexport interface DeckLayerProps {\n /** A deck.gl layer instance. A new instance with the same id replaces it (deck.gl's own way of updating). */\n layer: DeckLayerLike;\n}\n\n/** A deck.gl layer drawn interleaved with the map (`addDeckLayer`; web only). Must be inside `<SMap>`. */\nexport function DeckLayer(props: DeckLayerProps): null {\n const map = useSMap();\n const { layer } = props;\n const latest = useRef(layer);\n latest.current = layer;\n const shown = useRef<{ map: SMapMap; layer: DeckLayerLike } | null>(null);\n useEffect(() => {\n if (!map) { return undefined; }\n map.addDeckLayer(latest.current);\n shown.current = { map, layer: latest.current };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { quietly(() => map.removeDeckLayer(layer.id)); }\n };\n }, [map, layer.id]);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.layer === layer) { return; }\n s.layer = layer;\n map.addDeckLayer(layer);\n }, [map, layer]);\n return null;\n}\n\n// ------------------------------------------------------------------ hooks and helpers\n\n/**\n * A `{z}/{x}/{y}` raster tile URL template on the map's node for a scheme or `custom:<id>` (`rasterUrl`), for\n * tools without vector tiles. Null until the map is ready.\n */\nexport function useRasterUrl(style?: StyleFlavor | CustomStyleName, options?: { lang?: string; retina?: boolean }): string | null {\n const map = useSMap();\n const lang = options?.lang;\n const retina = options?.retina;\n return useMemo(() => {\n if (!map) { return null; }\n const o: { lang?: string; retina?: boolean } = {};\n if (lang !== undefined) { o.lang = lang; }\n if (retina !== undefined) { o.retina = retina; }\n return map.rasterUrl(style, o);\n }, [map, style, lang, retina]);\n}\n\ninterface Formats {\n read(input: DataInput, options?: ReadOptions): GeoJSONFeatureCollection | Promise<GeoJSONFeatureCollection>;\n}\n\n/**\n * Reads a file into a GeoJSON FeatureCollection on the device (`formats.read` of `@superrouteca/smap`), no map\n * needed. `format` is guessed from the content when not given.\n */\nexport const formats: Formats = {\n read(input: DataInput, options?: ReadOptions) {\n const f = (sdk as unknown as { formats?: Formats }).formats;\n if (!f) { throw new Error('sMap: formats need @superrouteca/smap 1.1.0 or later'); }\n return f.read(input, options);\n },\n};\n\nexport type { DataFormat };\n","export { SMap, useSMap } from './SMap';\nexport type { SMapProps } from './SMap';\nexport { Points, Lines, Polygons } from './layers';\nexport { Tool } from './tools';\nexport { CustomMarkers, Heatmap, Models, CanvasTiles, DrawTool } from './features';\nexport type { CustomMarkersProps, HeatmapProps, ModelsProps, CanvasTilesProps, DrawToolProps } from './features';\nexport type { ToolProps } from './tools';\nexport { PlanEditor, usePlanEditor } from './plan';\nexport type { PlanEditorProps, UsePlanEditorResult } from './plan';\nexport type { LayerProps, PointsProps, LinesProps, PolygonsProps } from './layers';\nexport {\n Source,\n StyleLayer,\n RasterLayer,\n WmsLayer,\n WmtsLayer,\n VectorTiles,\n ArcGisLayer,\n Data,\n Layers,\n DeckLayer,\n useRasterUrl,\n formats,\n} from './interop';\nexport type {\n SourceProps,\n StyleLayerProps,\n RasterLayerProps,\n WmsLayerProps,\n WmtsLayerProps,\n VectorTilesProps,\n ArcGisLayerProps,\n DataProps,\n LayersProps,\n DeckLayerProps,\n} from './interop';\nexport type {\n SMapMap,\n InteropMethods,\n TapHandler,\n PopupFunction,\n Slot,\n StyleSource,\n StyleLayerSpec,\n BasemapClassOverride,\n BasemapOverrides,\n CustomStyle,\n DataFormat,\n DataInput,\n ReadOptions,\n DataLayerOptions,\n AddDataOptions,\n RasterLayerOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n VectorTilesOptions,\n ArcGisLayerOptions,\n LayerDescription,\n DeckLayerLike,\n} from './types';\nexport { popupTemplate, planTexts } from '@superrouteca/smap';\nexport type {\n LayerData,\n LngLatLike,\n PointOptions,\n LineOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n MarkerOptions,\n StyleValue,\n StyleFlavor,\n GeoJSONFeature,\n GeoJSONFeatureCollection,\n ToolKind,\n ToolLayers,\n ToolPosition,\n ToolsOptions,\n ToolState,\n ToolsChangeEvent,\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanState,\n PlanJob,\n PlanVehicle,\n PlanRoute,\n PlanLocation,\n PlanCredentials,\n PlanTokenAnswer,\n PlanResult,\n PricedRoute,\n PricedStop,\n PlanSummary,\n PlanViolation,\n InsertChoice,\n InsertChoices,\n PlanChangeEvent,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n PlanPreview,\n PlanEditOutcome,\n PlanTextKey,\n PlanLanguage,\n} from '@superrouteca/smap';\n"],"mappings":";;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,OAAO,eAA+G;AAwN3H,SAKE,KALF;AAnNJ,IAAM,aAAa,cAA8B,IAAI;AAG9C,IAAM,cAAc,oBAAI,QAAiB;AAGzC,SAAS,UAA0B;AACxC,SAAO,WAAW,UAAU;AAC9B;AA8DA,IAAM,MAAM,CAAC,MAAe,KAAK,UAAU,KAAK,IAAI;AAEpD,SAAS,cAAc,MAAc,MAA6B;AAChE,QAAM,MAAc,CAAC;AACrB,MAAI,UAAU;AACd,MAAI,KAAK,WAAW,UAAa,IAAI,KAAK,MAAM,MAAM,IAAI,KAAK,MAAM,GAAG;AAAE,QAAI,SAAS,KAAK;AAAQ,cAAU;AAAA,EAAM;AACpH,aAAW,KAAK,CAAC,QAAQ,WAAW,OAAO,GAAY;AACrD,QAAI,KAAK,CAAC,MAAM,UAAa,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG;AAAE,UAAI,CAAC,IAAI,KAAK,CAAC;AAAG,gBAAU;AAAA,IAAM;AAAA,EACxF;AACA,SAAO,UAAU,MAAM;AACzB;AAMO,IAAM,OAAO,WAAsC,SAASA,MAAK,OAAO,KAAK;AAClF,QAAM,eAAe,OAA8B,IAAI;AACvD,QAAM,CAAC,KAAK,MAAM,IAAI,SAAyB,IAAI;AACnD,QAAM,SAAS,OAAO,KAAK;AAC3B,SAAO,UAAU;AAEjB,QAAM,UAAU;AAAA,IACd,EAAE,OAAO,IAAI,UAAU,IAAI,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AyC,CAAC;AAChD,QAAI,SAAS,QAAW;AAAE,QAAE,OAAO;AAAA,IAAM;AACzC,QAAI,WAAW,QAAW;AAAE,QAAE,SAAS;AAAA,IAAQ;AAC/C,WAAO,IAAI,UAAU,OAAO,CAAC;AAAA,EAC/B,GAAG,CAAC,KAAK,OAAO,MAAM,MAAM,CAAC;AAC/B;AAUO,IAAMG,WAAmB;AAAA,EAC9B,KAAK,OAAkB,SAAuB;AAC5C,UAAM,IAA8C;AACpD,QAAI,CAAC,GAAG;AAAE,YAAM,IAAI,MAAM,sDAAsD;AAAA,IAAG;AACnF,WAAO,EAAE,KAAK,OAAO,OAAO;AAAA,EAC9B;AACF;;;AC9VA,SAAS,eAAe,iBAAiB;","names":["SMap","useEffect","useRef","useRef","useEffect","useEffect","useRef","useState","jsx","optionsKey","useState","useEffect","useRef","useEffect","useRef","useState","createPortal","jsx","useRef","useState","useEffect","createPortal","forwardRef","useEffect","useImperativeHandle","useRef","useState","key","useState","useRef","useEffect","forwardRef","PlanEditor","useImperativeHandle","createContext","Fragment","useContext","useEffect","useRef","useState","jsx","createContext","useRef","useState","useEffect","Fragment","useContext","formats"]}
|
|
1
|
+
{"version":3,"sources":["../src/SMap.tsx","../src/layers.tsx","../src/tools.tsx","../src/features.tsx","../src/plan.tsx","../src/interop.tsx","../src/index.ts"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport { Map as BaseMap, type LngLatLike, type PopupOptions, type StyleFlavor, type ToolsChangeEvent, type ToolsOptions } from '@superrouteca/smap';\nimport type { BasemapOverrides, CustomStyle, SMapMap } from './types';\n\nexport type { SMapMap };\n\nconst MapContext = createContext<SMapMap | null>(null);\n\n/** Maps that were removed: their layers must not be touched any more. */\nexport const removedMaps = new WeakSet<SMapMap>();\n\n/** The map of the nearest `<SMap>` above, once it is ready (null before). */\nexport function useSMap(): SMapMap | null {\n return useContext(MapContext);\n}\n\nexport interface SMapProps {\n /** A map key (`smk_…`) whose allowlist names this site. Read when the map is created. */\n apiKey?: string;\n /** A map token. Read when the map is created; changing it creates the map again (use `getToken` to renew). */\n token?: string;\n /** Called at start and again two minutes before each token expires. */\n getToken?: () => string | Promise<string>;\n /**\n * A colour scheme, a saved custom style (`custom:sms_…`), or a style URL or object of your own. Changing it keeps\n * the layers and the basemap overrides.\n */\n style?: StyleFlavor | CustomStyle | string | Record<string, unknown>;\n /**\n * Basemap overrides by class (`{ water: { color: '#9cc0e6' }, pois: { visible: false } }`): a new value replaces the\n * previous overrides (`setBasemap`); removing the prop clears them. Kept across style and language changes.\n */\n basemap?: BasemapOverrides;\n /** Label language (`en`, `fr`, `zh-Hans`, …). Changing it keeps the layers. */\n language?: string;\n /** [longitude, latitude] or `{lng, lat}`; the camera follows a change. */\n center?: LngLatLike;\n zoom?: number;\n bearing?: number;\n pitch?: number;\n /** Node URLs known in advance, used while `baseUrl` is down. */\n nodes?: string[];\n /** The map service, `https://tile.srsr.ca` by default. */\n baseUrl?: string;\n /** Read from the nearest service node (default true). */\n nearest?: boolean;\n projection?: 'mercator' | 'globe';\n /** Buildings in 3D. */\n buildings3D?: boolean;\n /** Default popup options of every layer and of `openPopup`. Read when the map is created. */\n popup?: PopupOptions;\n /** Shown while a popup's content is a pending promise. Read when the map is created. */\n popupLoading?: string | Node;\n /**\n * Map tools: the ids hidden from the start, where the tools control sits (or false for none) and its labels. Read\n * when the map is created; register tools with `<Tool>`.\n */\n tools?: ToolsOptions;\n /** Called after every change of the tools' visibility; the map keeps no state itself. */\n onToolsChange?: (event: ToolsChangeEvent) => void;\n /** Further options handed to the map when it is created (minZoom, maxZoom, maxBounds, hash, …). */\n mapOptions?: Record<string, unknown>;\n /** Called once the first style has loaded, with the map. */\n onReady?: (map: SMapMap) => void;\n /** Called when the map cannot start. */\n onError?: (error: unknown) => void;\n /** Class and style of the element holding the map (it fills the element). */\n className?: string;\n containerStyle?: CSSProperties;\n id?: string;\n /** Layer components (`<Points>`, `<Source>`, `<StyleLayer>`, `<RasterLayer>`, `<Data>`, …), or anything to draw over the map. */\n children?: ReactNode;\n}\n\ntype Camera = { center?: LngLatLike; zoom?: number; bearing?: number; pitch?: number };\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\nfunction cameraChanges(prev: Camera, next: Camera): Camera | null {\n const out: Camera = {};\n let changed = false;\n if (next.center !== undefined && key(next.center) !== key(prev.center)) { out.center = next.center; changed = true; }\n for (const k of ['zoom', 'bearing', 'pitch'] as const) {\n if (next[k] !== undefined && next[k] !== prev[k]) { out[k] = next[k]; changed = true; }\n }\n return changed ? out : null;\n}\n\n/**\n * A map. Created in the browser only (after the component mounts), so it can be rendered on a server. The ref is\n * the SDK map once it is ready (null before).\n */\nexport const SMap = forwardRef<SMapMap | null, SMapProps>(function SMap(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const [map, setMap] = useState<SMapMap | null>(null);\n const latest = useRef(props);\n latest.current = props;\n // What the map shows now, so a prop that did not change is not applied again.\n const applied = useRef<{ style: string; language: string; camera: Camera; projection: string; buildings: boolean; basemap: string }>(\n { style: '', language: '', camera: {}, projection: '', buildings: false, basemap: key(undefined) });\n\n useImperativeHandle(ref, () => map as SMapMap, [map]);\n\n const nodesKey = key(props.nodes);\n const mapOptionsKey = key(props.mapOptions);\n const hasGetToken = !!props.getToken;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) { return undefined; }\n const p = latest.current;\n const options: Record<string, unknown> = {\n ...(p.mapOptions || {}),\n container,\n apiKey: p.apiKey,\n token: p.token,\n getToken: p.getToken ? () => latest.current.getToken!() : undefined,\n style: p.style,\n language: p.language,\n center: p.center,\n zoom: p.zoom,\n bearing: p.bearing,\n pitch: p.pitch,\n nodes: p.nodes,\n baseUrl: p.baseUrl,\n nearest: p.nearest,\n projection: p.projection,\n popup: p.popup,\n popupLoading: p.popupLoading,\n tools: p.tools,\n };\n for (const k of Object.keys(options)) { if (options[k] === undefined) { delete options[k]; } }\n let alive = true;\n let ready = false;\n let created: SMapMap;\n try {\n created = new BaseMap(options as unknown as ConstructorParameters<typeof BaseMap>[0]) as SMapMap;\n } catch (e) {\n latest.current.onError?.(e);\n return undefined;\n }\n applied.current = {\n style: key(p.style ?? 'light'),\n language: key(p.language ?? null),\n camera: { center: p.center, zoom: p.zoom, bearing: p.bearing, pitch: p.pitch },\n projection: p.projection ?? 'mercator',\n buildings: false,\n basemap: key(undefined),\n };\n created.onToolsChange((e) => latest.current.onToolsChange?.(e));\n created.ready.then(() => {\n ready = true;\n if (!alive) { created.remove(); return; }\n const overrides = latest.current.basemap;\n if (overrides !== undefined) {\n applied.current.basemap = key(overrides);\n try { created.setBasemap(overrides); } catch (e) { latest.current.onError?.(e); }\n }\n setMap(created);\n latest.current.onReady?.(created);\n }, (e: unknown) => {\n if (alive) { latest.current.onError?.(e); }\n });\n return () => {\n alive = false;\n removedMaps.add(created);\n setMap(null);\n // Before it is ready the map has nothing to remove yet; it is removed as soon as it is.\n if (ready) { created.remove(); }\n };\n }, [props.apiKey, props.token, props.baseUrl, nodesKey, props.nearest, mapOptionsKey, hasGetToken]);\n\n const styleKey = key(props.style ?? 'light');\n useEffect(() => {\n if (!map || applied.current.style === styleKey) { return; }\n applied.current.style = styleKey;\n map.setStyle(latest.current.style ?? 'light');\n }, [map, styleKey]);\n\n const languageKey = key(props.language ?? null);\n useEffect(() => {\n if (!map || applied.current.language === languageKey || props.language === undefined) { return; }\n applied.current.language = languageKey;\n map.setLanguage(props.language);\n }, [map, languageKey]);\n\n const centerKey = key(props.center);\n useEffect(() => {\n if (!map) { return; }\n const next: Camera = { center: props.center, zoom: props.zoom, bearing: props.bearing, pitch: props.pitch };\n const change = cameraChanges(applied.current.camera, next);\n applied.current.camera = next;\n if (change && map.engine) { map.engine.jumpTo(change); }\n }, [map, centerKey, props.zoom, props.bearing, props.pitch]);\n\n useEffect(() => {\n const projection = props.projection ?? 'mercator';\n if (!map || applied.current.projection === projection) { return; }\n applied.current.projection = projection;\n map.setProjection(projection);\n }, [map, props.projection]);\n\n const basemapKey = key(props.basemap);\n useEffect(() => {\n if (!map || applied.current.basemap === basemapKey) { return; }\n applied.current.basemap = basemapKey;\n try { map.setBasemap(latest.current.basemap ?? {}); } catch (e) { latest.current.onError?.(e); }\n }, [map, basemapKey]);\n\n useEffect(() => {\n const on = !!props.buildings3D;\n if (!map || applied.current.buildings === on) { return; }\n applied.current.buildings = on;\n map.setBuildings3D(on);\n }, [map, props.buildings3D]);\n\n return (\n <div\n id={props.id}\n className={props.className}\n style={{ position: 'relative', width: '100%', height: '100%', ...props.containerStyle }}\n >\n <div ref={containerRef} style={{ position: 'absolute', inset: 0 }} />\n <MapContext.Provider value={map}>{props.children}</MapContext.Provider>\n </div>\n );\n});\n","import { useEffect, useRef } from 'react';\nimport type {\n GeoJSONFeature,\n LayerClickEvent,\n LayerData,\n LineOptions,\n PointOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport type { Slot, TapHandler } from './types';\n\nexport type { TapHandler };\n\nexport interface LayerProps<O> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value replaces the data and keeps the look. */\n data: LayerData;\n /** How the layer is drawn; a change draws the layer again. */\n options?: O;\n /** Called when a feature of this layer is tapped or clicked. */\n onTap?: TapHandler;\n /** Shows or hides the layer (default true). */\n visible?: boolean;\n /**\n * The popup opened when the top feature at a click is this layer's (same as `options.popup`, which it replaces):\n * trusted HTML, a DOM node, or a promise of either. `popupTemplate('<b>{name}</b>')` gives a fast, escaped one.\n */\n popup?: (properties: Record<string, unknown>, feature: GeoJSONFeature) => PopupContent | Promise<PopupContent>;\n /** This layer's popup options, over the map's `popup` defaults (same as `options.popupOptions`). */\n popupOptions?: PopupOptions;\n /**\n * Where the layer draws among the basemap's layers (same as `options.slot`): `bottom`, `roads`, `labels` or `top`.\n * Without one the layer draws on top, in the order added, as in 1.0.\n */\n slot?: Slot;\n}\n\nexport type PointsProps = LayerProps<PointOptions>;\nexport type LinesProps = LayerProps<LineOptions>;\nexport type PolygonsProps = LayerProps<PolygonOptions>;\n\ntype Kind = 'addPoints' | 'addLines' | 'addPolygons';\n\n// Options compared by value; functions (popup, onClick) are read when called, so a new function is no change.\nexport function optionsKey(options: unknown): string {\n return JSON.stringify(options ?? {}, (_k, v) => (typeof v === 'function' ? '[fn]' : v));\n}\n\ntype OptionProps = Pick<LayerProps<PointOptions | LineOptions | PolygonOptions>, 'options' | 'onTap' | 'popup' | 'popupOptions' | 'slot'>;\n\n/**\n * The options handed to the SDK for a layer component: its `options` with `slot`, `popupOptions` and click and popup\n * functions that call the newest props (so a new function is no change).\n */\nexport function layerOptions(latest: { current: OptionProps }, hasTap: boolean, hasPopup: boolean): Record<string, unknown> {\n const o: Record<string, unknown> = { ...(latest.current.options || {}) };\n if (hasTap) {\n o.onClick = (feature: GeoJSONFeature, event: LayerClickEvent) => {\n const p = latest.current;\n p.options?.onClick?.(feature, event);\n p.onTap?.(feature.properties || {}, { lat: event.lngLat.lat, lng: event.lngLat.lng }, feature);\n };\n }\n if (hasPopup) {\n const given = latest.current.popup ?? latest.current.options?.popup;\n // A template (a string with {property} placeholders) goes to the SDK as it is; a function is called with the\n // newest props.\n o.popup = typeof given === 'string' ? given : (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const p = latest.current;\n const f = p.popup ?? p.options?.popup;\n return typeof f === 'function' ? f(properties, feature) : f;\n };\n }\n if (latest.current.slot) { o.slot = latest.current.slot; }\n if (latest.current.popupOptions) { o.popupOptions = { ...(o.popupOptions as object || {}), ...latest.current.popupOptions }; }\n return o;\n}\n\nfunction useLayer(kind: Kind, props: LayerProps<PointOptions | LineOptions | PolygonOptions>): null {\n const map = useSMap();\n const { id, data, options, onTap, visible = true, popupOptions, slot } = props;\n const latest = useRef(props);\n latest.current = props;\n const shown = useRef<{ map: SMapMap; data: LayerData } | null>(null);\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const o = layerOptions(latest, hasTap, hasPopup);\n const d = latest.current.data;\n (map[kind] as (id: string, data: LayerData, o: unknown) => SMapMap)(id, d, o);\n if (latest.current.visible === false) { map.setVisible(id, false); }\n shownVisible.current = latest.current.visible !== false;\n shown.current = { map, data: d };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.data === data) { return; }\n s.data = data;\n map.setData(id, data);\n }, [map, id, data]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n map.setVisible(id, visible);\n }, [map, id, visible]);\n\n return null;\n}\n\n/** Points at any scale, clustered or not. Must be inside `<SMap>`. */\nexport function Points(props: PointsProps): null {\n return useLayer('addPoints', props);\n}\n\n/** Lines (routes, tracks). Must be inside `<SMap>`. */\nexport function Lines(props: LinesProps): null {\n return useLayer('addLines', props);\n}\n\n/** Areas, flat or in 3D (`options.extrude`). Must be inside `<SMap>`. */\nexport function Polygons(props: PolygonsProps): null {\n return useLayer('addPolygons', props);\n}\n","import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { ToolKind, ToolPosition } from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface ToolProps {\n /** The tool id, unique on the map (1-64 letters, digits, '-', '_', '.'). */\n id: string;\n /** Shown on the tool's button in the tools control and read by screen readers. */\n label?: string;\n /**\n * A corner of the map (the children are drawn there), or 'none': the children stay where `<Tool>` is, over the\n * map's box. Default 'top-left' (a kind's own corner for `kind`).\n */\n position?: ToolPosition;\n /** A control the map makes instead of children: 'navigation', 'geolocate', 'fullscreen' or 'scale'. */\n kind?: ToolKind;\n /**\n * Data layers instead of children or a kind: one or more layer ids (of `<Points>`, `<Lines>`, `<Polygons>`, the\n * map's layer calls, or the basemap). Hiding the tool hides the layers (layout visibility), showing it shows them.\n */\n layer?: string | string[];\n /** Options of the kind's control (e.g. `{ showCompass: false }`). */\n options?: Record<string, unknown>;\n /** Class and style of the element holding the children. */\n className?: string;\n style?: CSSProperties;\n /** What the tool shows: a panel, a legend, a search box, … Kept while hidden, so its state stays. */\n children?: ReactNode;\n}\n\nconst optionsKey = (v: unknown) => JSON.stringify(v ?? null);\n\n/**\n * A tool floating on the map, shown or hidden by the map's tools control, `setToolVisible` and `setToolsVisible`.\n * Inside an `<SMap>`: `<Tool id=\"legend\" label=\"Legend\" position=\"bottom-left\"><Legend /></Tool>` or\n * `<Tool id=\"zoom\" kind=\"navigation\" />` or, for data layers, `<Tool id=\"stops\" label=\"Stops\" layer={['stops', 'stop-labels']} />`.\n * Removing it removes the tool.\n */\nexport function Tool(props: ToolProps) {\n const map = useSMap();\n const { id, label, kind } = props;\n const layer = props.layer;\n const layerKey = layer === undefined ? null : JSON.stringify(layer);\n const isLayer = layerKey !== null;\n const position = isLayer ? undefined : props.position ?? (kind ? undefined : 'top-left');\n const inPlace = !kind && !isLayer && position === 'none';\n // A corner tool's children live in an element of its own that the map places in the corner; React renders into it\n // through a portal, so the map may move it without React losing it. Made after mounting, so never on a server.\n const [box, setBox] = useState<HTMLDivElement | null>(null);\n useEffect(() => { if (!kind && !isLayer && !inPlace && !box) { setBox(document.createElement('div')); } }, [kind, isLayer, inPlace, box]);\n const inPlaceRef = useRef<HTMLDivElement | null>(null);\n const kindOptions = optionsKey(props.options);\n const latestOptions = useRef(props.options);\n latestOptions.current = props.options;\n\n if (box) {\n box.className = props.className ?? '';\n box.removeAttribute('style');\n Object.assign(box.style, props.style || {});\n }\n\n useEffect(() => {\n if (!map) { return undefined; }\n if (layerKey !== null) {\n map.addTool(id, { layer: JSON.parse(layerKey) as string | string[] }, { label });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }\n const target = kind ?? (inPlace ? inPlaceRef.current : box);\n if (!target) { return undefined; }\n map.addTool(id, target, { label, position, options: latestOptions.current });\n return () => { if (!removedMaps.has(map)) { map.removeTool(id); } };\n }, [map, id, label, position, kind, inPlace, kindOptions, box, layerKey]);\n\n if (kind || isLayer) { return null; }\n if (inPlace) {\n return <div ref={inPlaceRef} className={props.className} style={props.style}>{props.children}</div>;\n }\n return box ? createPortal(props.children, box) : null;\n}\n","// The 1.2.0 calls as components (MOBILE-SDK-SPEC \"Native features\"; the map itself has them all, through the ref\n// or useSMap()): custom markers rendered by React, heat maps, 3D models, painted tiles and the drawing tool.\nimport { useEffect, useRef, useState, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport type {\n CustomMarkerOptions,\n DrawEvent,\n DrawTool as SdkDrawTool,\n DrawToolOptions,\n GeoJSONFeature,\n HeatmapOptions,\n LayerData,\n ModelOptions,\n RasterLayerOptions,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\nimport { optionsKey } from './layers';\n\nexport interface CustomMarkersProps extends Omit<CustomMarkerOptions, 'render'> {\n /** The layer id, unique on the map. */\n id: string;\n /** GeoJSON, or an array of points `{lng, lat, …properties}`. A new value moves the markers and keeps the others. */\n data: LayerData;\n /** The React content of one marker (rendered again when the feature's properties change). */\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => ReactNode;\n}\n\n/**\n * Custom markers (G1) whose content is React: the map makes each marker's element when its point comes into view and\n * React renders `render` into it through a portal (so context, state and events work as anywhere in the app).\n * Draggable with `draggable`; tooltips and popups as on any layer. Must be inside `<SMap>`.\n */\nexport function CustomMarkers(props: CustomMarkersProps) {\n const map = useSMap();\n const { id, data, render: _render, ...rest } = props;\n const latest = useRef(props);\n latest.current = props;\n // The element the map holds for each feature (by its key), with what React renders into it. The map keeps an\n // element while its point is out of view and shows it again later, so an entry goes only when the feature is\n // rendered again or leaves the data.\n const [entries, setEntries] = useState<Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>>(new Map());\n const held = useRef(new Map<string, { el: HTMLElement; properties: Record<string, unknown>; feature: GeoJSONFeature }>());\n const shown = useRef<LayerData | null>(null);\n const looks = optionsKey(rest);\n const keyOf = (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const by = latest.current.idProperty;\n const v = by ? properties[by] : feature.id;\n return v === undefined || v === null ? `@${JSON.stringify(feature.geometry)}` : String(v);\n };\n\n useEffect(() => {\n if (!map) { return undefined; }\n held.current = new Map();\n let scheduled = false;\n const publish = () => {\n if (scheduled) { return; }\n scheduled = true;\n queueMicrotask(() => { scheduled = false; setEntries(new Map(held.current)); });\n };\n const options = {\n ...latest.current,\n render: (properties: Record<string, unknown>, feature: GeoJSONFeature) => {\n const el = document.createElement('div');\n held.current.set(keyOf(properties, feature), { el, properties, feature });\n publish();\n return el;\n },\n } as unknown as CustomMarkerOptions & { id?: string; data?: unknown };\n delete options.id;\n delete options.data;\n map.addCustomMarkers(id, latest.current.data, options);\n shown.current = latest.current.data;\n return () => {\n shown.current = null;\n held.current = new Map();\n setEntries(new Map());\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n }, [map, id, looks]);\n\n useEffect(() => {\n if (!map || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n // Features no longer in the data lose their content.\n const keep = new Set<string>();\n const features = (data && !Array.isArray(data) && (data as { features?: GeoJSONFeature[] }).features) || [];\n for (const f of features) { keep.add(keyOf((f.properties || {}) as Record<string, unknown>, f)); }\n const by = latest.current.idProperty;\n if (Array.isArray(data) && by) { (data as Record<string, unknown>[]).forEach((p) => keep.add(String(p[by]))); }\n // Points given as an array without idProperty have no key to compare: their content stays until the layer goes.\n if (!Array.isArray(data) || by) {\n let changed = false;\n for (const k of [...held.current.keys()]) { if (!keep.has(k)) { held.current.delete(k); changed = true; } }\n if (changed) { setEntries(new Map(held.current)); }\n }\n }, [map, id, data]);\n\n return (\n <>\n {[...entries.entries()].map(([k, e]) => createPortal(latest.current.render(e.properties, e.feature), e.el, `${id}\\u0000${k}`))}\n </>\n );\n}\n\nfunction useNativeLayer(add: (map: NonNullable<ReturnType<typeof useSMap>>) => void, id: string, looks: string, data?: LayerData): void {\n const map = useSMap();\n const shown = useRef<LayerData | undefined | null>(null);\n const addRef = useRef(add);\n addRef.current = add;\n useEffect(() => {\n if (!map) { return undefined; }\n addRef.current(map);\n shown.current = data;\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { map.removeLayer(id); }\n };\n // The data is set below; a new look adds the layer again.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [map, id, looks]);\n useEffect(() => {\n if (!map || data === undefined || shown.current === null || shown.current === data) { return; }\n shown.current = data;\n map.setData(id, data);\n }, [map, id, data]);\n}\n\nexport interface HeatmapProps { id: string; data: LayerData; options?: HeatmapOptions }\n\n/** A heat map of points (G7). Must be inside `<SMap>`. */\nexport function Heatmap(props: HeatmapProps): null {\n useNativeLayer((m) => m.addHeatmap(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface ModelsProps { id: string; data: LayerData; options: ModelOptions }\n\n/** glTF 3D models at points (G12; three.js is handed to the SDK with `useThree`). Must be inside `<SMap>`. */\nexport function Models(props: ModelsProps): null {\n useNativeLayer((m) => m.addModels(props.id, props.data, props.options), props.id, optionsKey(props.options), props.data);\n return null;\n}\n\nexport interface CanvasTilesProps {\n id: string;\n /** Paints one tile (a 2D context of the tile's canvas); called again for each tile that comes into view. */\n draw: Parameters<NonNullable<ReturnType<typeof useSMap>>['addCanvasTiles']>[1];\n options?: RasterLayerOptions;\n}\n\n/** Raster tiles you paint (G14). A new `draw` is used for the next tiles painted. Must be inside `<SMap>`. */\nexport function CanvasTiles(props: CanvasTilesProps): null {\n const draw = useRef(props.draw);\n draw.current = props.draw;\n useNativeLayer((m) => m.addCanvasTiles(props.id, (...a: Parameters<CanvasTilesProps['draw']>) => draw.current(...a), props.options), props.id, optionsKey(props.options));\n return null;\n}\n\nexport interface DrawToolProps extends Omit<DrawToolOptions, 'onChange'> {\n /** Called after each change: created, edited or deleted, with every shape. */\n onChange?: (event: DrawEvent) => void;\n /** Called with the tool once it exists (start, select, undo, getAll, …), and with null when it goes. */\n onTool?: (tool: SdkDrawTool | null) => void;\n}\n\n/** A drawing and editing tool (G3) for as long as it is mounted. Must be inside `<SMap>`. */\nexport function DrawTool(props: DrawToolProps): null {\n const map = useSMap();\n const latest = useRef(props);\n latest.current = props;\n const { onChange: _c, onTool: _t, ...rest } = props;\n const looks = optionsKey(rest);\n useEffect(() => {\n if (!map) { return undefined; }\n const { onChange: _a, onTool: _b, ...o } = latest.current;\n const tool = map.drawTool({ ...o, onChange: (e: DrawEvent) => latest.current.onChange?.(e) });\n latest.current.onTool?.(tool);\n return () => {\n latest.current.onTool?.(null);\n if (!removedMaps.has(map)) { tool.destroy(); }\n };\n }, [map, looks]);\n return null;\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport type {\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanChangeEvent,\n PlanCredentials,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n} from '@superrouteca/smap';\nimport { removedMaps, useSMap } from './SMap';\n\nexport interface PlanEditorProps extends Omit<MapPlanEditorOptions, 'credentials' | 'plan' | 'fetch'> {\n /**\n * `{ token: () => Promise<string | PlanTokenAnswer> }` (a short-lived plan token from your own server, which mints it\n * with POST /v1/plan/token; the latest function is called)\n * or `{ key: 'smk_…' }`. Changing between a token and a key, or the key, starts a new editor.\n */\n credentials: PlanCredentials;\n /**\n * The plan to edit. A plan that differs from the one the editor holds replaces it (and its history); handing the\n * plan of `onChange` back is not a change.\n */\n plan?: Plan;\n /** The fetch to use (the page's by default). Read when the editor is made. */\n fetch?: typeof fetch;\n /** Called after every change: the plan to keep, its prices, and whether it is still on its way. */\n onChange?: (event: PlanChangeEvent) => void;\n onError?: (error: PlanEditorError, kind: string) => void;\n onBusy?: (busy: boolean) => void;\n onSnapshot?: (event: PlanSnapshotEvent) => void;\n /** Called once the editor exists, with it. */\n onReady?: (editor: MapPlanEditor) => void;\n}\n\n// The map was removed with its layers and tools: only the editor's own calls and snapshot are left to close.\nfunction destroyOffMap(made: MapPlanEditor) {\n made.layer.remove = () => {};\n try { made.destroy(); } catch { /* the map is gone */ }\n}\n\nexport interface UsePlanEditorResult extends PlanEditorState {\n /** The editor (null until the map is ready). */\n editor: MapPlanEditor | null;\n}\n\nconst key = (v: unknown) => JSON.stringify(v ?? null);\n\n// The plan's content without the routes the editor adds for vehicles without stops, so that a plan handed back from\n// onChange is recognised as the one the editor holds.\nfunction planKey(plan: Plan | null | undefined): string {\n if (!plan) { return key(null); }\n const routes = (plan.routes || [])\n .map((r) => ({ v: String(r.vehicle_id), s: (r.reverse ? r.stops.slice().reverse() : r.stops).map(String) }))\n .filter((r) => r.s.length)\n .sort((a, b) => (a.v < b.v ? -1 : a.v > b.v ? 1 : 0));\n const jobs = (plan.jobs || []).map((j) => j.id).sort();\n return key({ vehicles: plan.vehicles, jobs, routes, region: plan.region ?? null, profile: plan.profile ?? null, departed_at: plan.departed_at ?? null });\n}\n\nconst EMPTY: PlanEditorState = {\n plan: null, result: null, busy: false, error: null, canUndo: false, canRedo: false, choices: null, locked: [], last: null, preview: null, path: null,\n};\n\n/**\n * A plan editor on the map of the nearest `<SMap>`: its layers, the ready-made panel (unless `panel={false}`), and its\n * state for your own interface. The editor is made when the map is ready and destroyed when the component unmounts.\n */\nexport function usePlanEditor(props: PlanEditorProps): UsePlanEditorResult {\n const map = useSMap();\n const [editor, setEditor] = useState<MapPlanEditor | null>(null);\n const [state, setState] = useState<PlanEditorState>(EMPTY);\n const latest = useRef(props);\n latest.current = props;\n // The key of the last plan prop applied, so an unchanged prop is not applied again.\n const applied = useRef<string | null>(null);\n const credentialKey = 'key' in props.credentials ? 'key:' + props.credentials.key : 'token';\n const madeKey = key({\n baseUrl: props.baseUrl, app: props.app, region: props.region, profile: props.profile, snapshot: props.snapshot, geometry: props.geometry,\n insertLimit: props.insertLimit, objective: props.objective, id: props.id, colors: props.colors, preview: props.preview,\n panel: props.panel, labels: props.labels, smapUrl: props.smapUrl, fastPath: props.fastPath, fastPathTimeout: props.fastPathTimeout,\n fastPathRefineTimeout: props.fastPathRefineTimeout, insertWaitTimeout: props.insertWaitTimeout,\n });\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const credentials: PlanCredentials = 'key' in p.credentials\n ? { key: p.credentials.key }\n : { token: () => (latest.current.credentials as Extract<PlanCredentials, { token: unknown }>).token() };\n const options: MapPlanEditorOptions = {\n credentials, app: p.app, baseUrl: p.baseUrl, fetch: p.fetch, region: p.region, profile: p.profile, snapshot: p.snapshot,\n geometry: p.geometry, insertLimit: p.insertLimit, objective: p.objective, id: p.id, colors: p.colors,\n preview: p.preview, language: p.language, labels: p.labels, panel: p.panel,\n smapUrl: p.smapUrl, fastPath: p.fastPath, fastPathTimeout: p.fastPathTimeout, fastPathRefineTimeout: p.fastPathRefineTimeout,\n insertWaitTimeout: p.insertWaitTimeout,\n };\n for (const k of Object.keys(options) as Array<keyof MapPlanEditorOptions>) { if (options[k] === undefined) { delete options[k]; } }\n const made = map.planEditor(options);\n const refresh = () => setState(made.state());\n made.on('change', (e) => { refresh(); latest.current.onChange?.(e); });\n made.on('busy', (e) => { refresh(); latest.current.onBusy?.(e.busy); });\n made.on('error', (e) => { refresh(); latest.current.onError?.(e.error, e.kind); });\n made.on('preview', refresh);\n made.on('snapshot', (e) => latest.current.onSnapshot?.(e));\n applied.current = null;\n setEditor(made);\n latest.current.onReady?.(made);\n return () => {\n setEditor(null);\n setState(EMPTY);\n // Closes its calls and its snapshot; on a map that is still there it also takes its layers and panel away.\n if (!removedMaps.has(map)) { made.destroy(); } else { destroyOffMap(made); }\n };\n }, [map, credentialKey, madeKey]);\n\n // The plan prop: applied when it is not the plan the editor holds.\n const incoming = planKey(props.plan);\n useEffect(() => {\n if (!editor || !latest.current.plan) { return; }\n if (incoming === applied.current || incoming === planKey(editor.getPlan())) { applied.current = incoming; return; }\n applied.current = incoming;\n editor.setPlan(latest.current.plan).catch(() => {});\n }, [editor, incoming]);\n\n useEffect(() => {\n if (editor && editor.panel && props.language) { editor.panel.setLanguage(props.language); }\n }, [editor, props.language]);\n\n return { ...state, editor };\n}\n\n/**\n * `<PlanEditor>` inside an `<SMap>`: edits a plan on the map with the ready-made panel. The ref is the editor (undo,\n * redo, refine, insert, getPlan, …) once the map is ready. Renders nothing itself; the panel is a map tool.\n * <PlanEditor credentials={{ token: getPlanToken }} plan={plan} onChange={(e) => setPlan(e.plan)} language=\"fr\" />\n */\nexport const PlanEditor = forwardRef<MapPlanEditor | null, PlanEditorProps>(function PlanEditor(props, ref) {\n const { editor } = usePlanEditor(props);\n useImperativeHandle(ref, () => editor as MapPlanEditor, [editor]);\n return null;\n});\n","// Components of 1.1.0 (MAP-SDK-DESIGN M24–M36): each maps onto one call of `@superrouteca/smap` and removes what it\n// added when it unmounts.\nimport { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as sdk from '@superrouteca/smap';\nimport type { CustomStyleName, GeoJSONFeatureCollection, PopupOptions, StyleFlavor } from '@superrouteca/smap';\nimport { removedMaps, useSMap, type SMapMap } from './SMap';\nimport { layerOptions, optionsKey } from './layers';\nimport type {\n ArcGisLayerOptions,\n DataFormat,\n DataInput,\n DataLayerOptions,\n DeckLayerLike,\n LayerDescription,\n PopupFunction,\n RasterLayerOptions,\n ReadOptions,\n Slot,\n StyleLayerSpec,\n StyleSource,\n TapHandler,\n VectorTilesOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n} from './types';\n\n/** Calls `f` and drops an error: used when removing what may already be gone (a style change, a parent's removal). */\nfunction quietly(f: () => void): void {\n try { f(); } catch { /* already removed */ }\n}\n\n// ------------------------------------------------------------------ <Source>\n\ninterface SourceScope {\n id: string;\n /**\n * A style layer inside the source registers itself, so the source removes it before removing itself. The function\n * returned unregisters it and says whether it was still registered (false: the source removed it already).\n */\n register(layerId: string): () => boolean;\n}\n\nconst SourceContext = createContext<SourceScope | null>(null);\n\nexport interface SourceProps {\n /** The source id, unique on the map. */\n id: string;\n /**\n * A Style Specification v8 source object (`{ type: 'vector', url }`, `{ type: 'geojson', data }`, …). A new value\n * (compared by value) adds the source again with the layers inside it; keep it stable (a constant or `useMemo`).\n */\n source: StyleSource;\n /** `<StyleLayer>` elements drawing this source; their `source` is filled in. Drawn once the source is added. */\n children?: ReactNode;\n}\n\n/** A Style Specification source (`addSource` / `removeSource`). Must be inside `<SMap>`. */\nexport function Source(props: SourceProps): ReactNode {\n const map = useSMap();\n const { id, source, children } = props;\n const latest = useRef(source);\n latest.current = source;\n const inside = useRef(new Set<string>());\n const [shown, setShown] = useState<{ map: SMapMap; generation: number } | null>(null);\n const sourceKey = optionsKey(source);\n\n useEffect(() => {\n if (!map) { return undefined; }\n map.addSource(id, latest.current);\n setShown((s) => ({ map, generation: (s?.generation ?? 0) + 1 }));\n return () => {\n if (removedMaps.has(map)) { return; }\n // Layers first: a source still in use cannot be removed.\n inside.current.forEach((layerId) => quietly(() => map.removeLayer(layerId)));\n inside.current.clear();\n quietly(() => map.removeSource(id));\n };\n }, [map, id, sourceKey]);\n\n const scope = useMemo<SourceScope>(() => ({\n id,\n register: (layerId: string) => {\n inside.current.add(layerId);\n return () => inside.current.delete(layerId);\n },\n }), [id]);\n\n if (!map || !shown || shown.map !== map) { return null; }\n // A new generation (the source added again) mounts the children again, so their layers are added again.\n return (\n <SourceContext.Provider value={scope}>\n <Fragment key={shown.generation}>{children}</Fragment>\n </SourceContext.Provider>\n );\n}\n\n// ------------------------------------------------------------------ <StyleLayer>\n\nexport interface StyleLayerProps {\n /**\n * A Style Specification v8 layer, passed through unchanged (copied from Mapbox Studio, Maputnik or a MapLibre /\n * Mapbox GL JS page). Inside `<Source>` its `source` defaults to that source. A change of `paint`, `layout` or\n * `filter` is applied in place (`setPaint` / `setLayout` / `setFilter`); any other change adds the layer again.\n */\n layer: StyleLayerSpec;\n /** A layer id to draw under (a basemap layer or one of yours), instead of a slot. */\n before?: string;\n /** `bottom`, `roads`, `labels` or `top`. Without `slot` or `before` the layer draws on top, in the order added. */\n slot?: Slot;\n /** Shows or hides the layer (default true; the layout's `visibility`). */\n visible?: boolean;\n}\n\nfunction effectiveLayer(layer: StyleLayerSpec, sourceId: string | undefined, visible: boolean): StyleLayerSpec {\n const out: StyleLayerSpec = { ...layer };\n if (out.source === undefined && sourceId !== undefined) { out.source = sourceId; }\n if (!visible) { out.layout = { ...(layer.layout || {}), visibility: 'none' }; }\n return out;\n}\n\nfunction structureKey(layer: StyleLayerSpec, before?: string, slot?: Slot): string {\n const { paint: _p, layout: _l, filter: _f, ...rest } = layer;\n return optionsKey(rest) + '|' + (before ?? '') + '|' + (slot ?? '');\n}\n\n/** Calls `set(name, value)` for every key whose value differs (a removed key gets `undefined`, its default). */\nfunction applyDiff(prev: Record<string, unknown> | undefined, next: Record<string, unknown> | undefined,\n set: (name: string, value: unknown) => void): void {\n const a = prev || {};\n const b = next || {};\n for (const name of new Set([...Object.keys(a), ...Object.keys(b)])) {\n if (optionsKey(a[name]) !== optionsKey(b[name])) { set(name, b[name]); }\n }\n}\n\n/** A Style Specification layer (`addStyleLayer`). Must be inside `<SMap>`, and inside `<Source>` for its own source. */\nexport function StyleLayer(props: StyleLayerProps): null {\n const map = useSMap();\n const scope = useContext(SourceContext);\n const { layer, before, slot, visible = true } = props;\n const current = effectiveLayer(layer, scope?.id, visible);\n const latest = useRef(current);\n latest.current = current;\n const shown = useRef<{ map: SMapMap; layer: StyleLayerSpec } | null>(null);\n const structure = structureKey(current, before, slot);\n\n useEffect(() => {\n if (!map) { return undefined; }\n const l = latest.current;\n const options: { before?: string; slot?: Slot } = {};\n if (before !== undefined) { options.before = before; }\n if (slot !== undefined) { options.slot = slot; }\n map.addStyleLayer(l, options);\n shown.current = { map, layer: l };\n const unregister = scope?.register(l.id);\n return () => {\n shown.current = null;\n const stillMine = unregister ? unregister() : true;\n if (stillMine && !removedMaps.has(map)) { quietly(() => map.removeLayer(l.id)); }\n };\n }, [map, structure, scope]);\n\n const looks = optionsKey(current.paint) + optionsKey(current.layout) + optionsKey(current.filter);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map) { return; }\n const next = latest.current;\n const prev = s.layer;\n if (prev === next) { return; }\n applyDiff(prev.paint, next.paint, (name, value) => map.setPaint(next.id, name, value));\n applyDiff(prev.layout, next.layout, (name, value) => map.setLayout(next.id, name, value));\n if (optionsKey(prev.filter) !== optionsKey(next.filter)) { map.setFilter(next.id, (next.filter as unknown[] | undefined) ?? null); }\n s.layer = next;\n }, [map, looks]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ external layers\n\ntype AddMethod = 'addRasterLayer' | 'addWmsLayer' | 'addWmtsLayer' | 'addVectorTiles' | 'addArcGisLayer';\n\nfunction useAddedLayer(method: AddMethod, id: string, options: object, remove: (map: SMapMap) => void): null {\n const map = useSMap();\n const latest = useRef(options);\n latest.current = options;\n const removeLatest = useRef(remove);\n removeLatest.current = remove;\n const looks = optionsKey(options);\n useEffect(() => {\n if (!map) { return undefined; }\n (map[method] as (id: string, o: object) => unknown)(id, latest.current);\n const removeNow = removeLatest.current;\n return () => {\n if (!removedMaps.has(map)) { removeNow(map); }\n };\n }, [map, method, id, looks]);\n return null;\n}\n\nexport type RasterLayerProps = RasterLayerOptions & { id: string };\nexport type WmsLayerProps = WmsLayerOptions & { id: string };\nexport type WmtsLayerProps = WmtsLayerOptions & { id: string };\nexport type VectorTilesProps = VectorTilesOptions & { id: string };\nexport type ArcGisLayerProps = ArcGisLayerOptions & { id: string };\n\nfunction split<T extends { id: string }>(props: T): [string, Omit<T, 'id'>] {\n const { id, ...options } = props;\n return [id, options];\n}\n\n/** Raster tiles from `{z}/{x}/{y}` templates or a TileJSON URL (`addRasterLayer`). A change of a prop adds it again. */\nexport function RasterLayer(props: RasterLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addRasterLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMS service, one GetMap per tile (`addWmsLayer`). */\nexport function WmsLayer(props: WmsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** An OGC WMTS layer from a GetCapabilities URL or a REST template (`addWmtsLayer`). */\nexport function WmtsLayer(props: WmtsLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addWmtsLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n/** Vector tiles or a PMTiles archive from any URL, drawn by your style layers (`addVectorTiles`). */\nexport function VectorTiles(props: VectorTilesProps): null {\n const [id, options] = split(props);\n const layerIds = (options.layers || []).map((l) => l.id);\n return useAddedLayer('addVectorTiles', id, options, (map) => {\n layerIds.forEach((l) => quietly(() => map.removeLayer(l)));\n quietly(() => map.removeLayer(id));\n quietly(() => map.removeSource(id));\n });\n}\n\n/** An ArcGIS REST MapServer or VectorTileServer (`addArcGisLayer`). */\nexport function ArcGisLayer(props: ArcGisLayerProps): null {\n const [id, options] = split(props);\n return useAddedLayer('addArcGisLayer', id, options, (map) => quietly(() => map.removeLayer(id)));\n}\n\n// ------------------------------------------------------------------ <Data>\n\nexport interface DataProps extends ReadOptions {\n /** The data id: points are the layer `<id>`, lines `<id>:lines`, areas `<id>:areas` (as `addData`). */\n id: string;\n /**\n * The file: KML, KMZ, GPX, an encoded polyline, WKT, WKB, CSV, TopoJSON or GeoJSON, as text, bytes, a Blob / File\n * or a parsed object. `format` is guessed when not given. A new value reads the file again.\n */\n data: DataInput;\n /** Layer options of the points, lines and areas (simplestyle properties draw when no colour is given). */\n options?: DataLayerOptions;\n /** Where the layers draw (same as `options.slot`); without one they draw on top, in the order added. */\n slot?: Slot;\n onTap?: TapHandler;\n /** Shows or hides the layers (default true). */\n visible?: boolean;\n popup?: PopupFunction;\n popupOptions?: PopupOptions;\n /** Called once the file is drawn. */\n onLoad?: () => void;\n /** Called when the file cannot be read. */\n onError?: (error: unknown) => void;\n}\n\nconst dataLayerIds = (id: string) => [id, `${id}:lines`, `${id}:areas`];\n\n/** A data file in any supported format, drawn as points, lines and areas (`addData`). Must be inside `<SMap>`. */\nexport function Data(props: DataProps): null {\n const map = useSMap();\n const { id, data, format, lat, lng, options, slot, onTap, visible = true, popupOptions } = props;\n const latest = useRef(props);\n latest.current = props;\n const shownVisible = useRef(true);\n const hasTap = !!onTap || typeof options?.onClick === 'function';\n const hasPopup = !!props.popup || typeof options?.popup === 'function';\n const looks = optionsKey(options) + optionsKey(popupOptions) + (slot ?? '') + '|' + (format ?? '') + '|' + (lat ?? '') + '|' + (lng ?? '');\n\n useEffect(() => {\n if (!map) { return undefined; }\n const p = latest.current;\n const o: Record<string, unknown> = layerOptions(latest, hasTap, hasPopup);\n if (p.format !== undefined) { o.format = p.format; }\n if (p.lat !== undefined) { o.lat = p.lat; }\n if (p.lng !== undefined) { o.lng = p.lng; }\n const ids = dataLayerIds(id);\n let alive = true;\n // The file is read first (a promise), then drawn.\n Promise.resolve(map.addData(id, p.data, o)).then(() => {\n if (removedMaps.has(map)) { return; }\n if (!alive) { ids.forEach((l) => quietly(() => map.removeLayer(l))); return; }\n if (latest.current.visible === false) { map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, false)); }\n latest.current.onLoad?.();\n }, (e: unknown) => { if (alive) { latest.current.onError?.(e); } });\n shownVisible.current = p.visible !== false;\n return () => {\n alive = false;\n if (removedMaps.has(map)) { return; }\n ids.forEach((l) => quietly(() => map.removeLayer(l)));\n };\n }, [map, id, data, looks, hasTap, hasPopup]);\n\n useEffect(() => {\n if (!map || shownVisible.current === visible) { return; }\n shownVisible.current = visible;\n const ids = dataLayerIds(id);\n map.layers().filter((l) => ids.includes(l)).forEach((l) => map.setVisible(l, visible));\n }, [map, id, visible]);\n\n return null;\n}\n\n// ------------------------------------------------------------------ <Layers>\n\nexport interface LayersProps {\n /** A layer description (`toJSON()` of any sMap SDK), as an object or JSON text. A new value loads it again. */\n json: LayerDescription | string;\n}\n\n/** Loads a layer description (`loadLayers`); its layers and sources are removed when the component unmounts. */\nexport function Layers(props: LayersProps): null {\n const map = useSMap();\n const latest = useRef(props.json);\n latest.current = props.json;\n const jsonKey = typeof props.json === 'string' ? props.json : optionsKey(props.json);\n useEffect(() => {\n if (!map) { return undefined; }\n const json = latest.current;\n map.loadLayers(json);\n const d: LayerDescription = typeof json === 'string' ? JSON.parse(json) : json;\n return () => {\n if (removedMaps.has(map)) { return; }\n [...(d.layers || [])].reverse().forEach((l) => quietly(() => map.removeLayer(l.id)));\n Object.keys(d.sources || {}).forEach((s) => quietly(() => map.removeSource(s)));\n };\n }, [map, jsonKey]);\n return null;\n}\n\n// ------------------------------------------------------------------ <DeckLayer>\n\nexport interface DeckLayerProps {\n /** A deck.gl layer instance. A new instance with the same id replaces it (deck.gl's own way of updating). */\n layer: DeckLayerLike;\n}\n\n/** A deck.gl layer drawn interleaved with the map (`addDeckLayer`; web only). Must be inside `<SMap>`. */\nexport function DeckLayer(props: DeckLayerProps): null {\n const map = useSMap();\n const { layer } = props;\n const latest = useRef(layer);\n latest.current = layer;\n const shown = useRef<{ map: SMapMap; layer: DeckLayerLike } | null>(null);\n useEffect(() => {\n if (!map) { return undefined; }\n map.addDeckLayer(latest.current);\n shown.current = { map, layer: latest.current };\n return () => {\n shown.current = null;\n if (!removedMaps.has(map)) { quietly(() => map.removeDeckLayer(layer.id)); }\n };\n }, [map, layer.id]);\n useEffect(() => {\n const s = shown.current;\n if (!map || !s || s.map !== map || s.layer === layer) { return; }\n s.layer = layer;\n map.addDeckLayer(layer);\n }, [map, layer]);\n return null;\n}\n\n// ------------------------------------------------------------------ hooks and helpers\n\n/**\n * A `{z}/{x}/{y}` raster tile URL template on the map's node for a scheme or `custom:<id>` (`rasterUrl`), for\n * tools without vector tiles. Null until the map is ready.\n */\nexport function useRasterUrl(style?: StyleFlavor | CustomStyleName, options?: { lang?: string; retina?: boolean }): string | null {\n const map = useSMap();\n const lang = options?.lang;\n const retina = options?.retina;\n return useMemo(() => {\n if (!map) { return null; }\n const o: { lang?: string; retina?: boolean } = {};\n if (lang !== undefined) { o.lang = lang; }\n if (retina !== undefined) { o.retina = retina; }\n return map.rasterUrl(style, o);\n }, [map, style, lang, retina]);\n}\n\ninterface Formats {\n read(input: DataInput, options?: ReadOptions): GeoJSONFeatureCollection | Promise<GeoJSONFeatureCollection>;\n}\n\n/**\n * Reads a file into a GeoJSON FeatureCollection on the device (`formats.read` of `@superrouteca/smap`), no map\n * needed. `format` is guessed from the content when not given.\n */\nexport const formats: Formats = {\n read(input: DataInput, options?: ReadOptions) {\n const f = (sdk as unknown as { formats?: Formats }).formats;\n if (!f) { throw new Error('sMap: formats need @superrouteca/smap 1.1.0 or later'); }\n return f.read(input, options);\n },\n};\n\nexport type { DataFormat };\n","export { SMap, useSMap } from './SMap';\nexport type { SMapProps } from './SMap';\nexport { Points, Lines, Polygons } from './layers';\nexport { Tool } from './tools';\nexport { CustomMarkers, Heatmap, Models, CanvasTiles, DrawTool } from './features';\nexport type { CustomMarkersProps, HeatmapProps, ModelsProps, CanvasTilesProps, DrawToolProps } from './features';\nexport type { ToolProps } from './tools';\nexport { PlanEditor, usePlanEditor } from './plan';\nexport type { PlanEditorProps, UsePlanEditorResult } from './plan';\nexport type { LayerProps, PointsProps, LinesProps, PolygonsProps } from './layers';\nexport {\n Source,\n StyleLayer,\n RasterLayer,\n WmsLayer,\n WmtsLayer,\n VectorTiles,\n ArcGisLayer,\n Data,\n Layers,\n DeckLayer,\n useRasterUrl,\n formats,\n} from './interop';\nexport type {\n SourceProps,\n StyleLayerProps,\n RasterLayerProps,\n WmsLayerProps,\n WmtsLayerProps,\n VectorTilesProps,\n ArcGisLayerProps,\n DataProps,\n LayersProps,\n DeckLayerProps,\n} from './interop';\nexport type {\n SMapMap,\n InteropMethods,\n TapHandler,\n PopupFunction,\n Slot,\n StyleSource,\n StyleLayerSpec,\n BasemapClassOverride,\n BasemapOverrides,\n CustomStyle,\n DataFormat,\n DataInput,\n ReadOptions,\n DataLayerOptions,\n AddDataOptions,\n RasterLayerOptions,\n WmsLayerOptions,\n WmtsLayerOptions,\n VectorTilesOptions,\n ArcGisLayerOptions,\n LayerDescription,\n DeckLayerLike,\n} from './types';\nexport { popupTemplate, planTexts } from '@superrouteca/smap';\nexport type {\n LayerData,\n LngLatLike,\n PointOptions,\n LineOptions,\n PolygonOptions,\n PopupContent,\n PopupOptions,\n MarkerOptions,\n StyleValue,\n StyleFlavor,\n GeoJSONFeature,\n GeoJSONFeatureCollection,\n ToolKind,\n ToolLayers,\n ToolPosition,\n ToolsOptions,\n ToolState,\n ToolsChangeEvent,\n MapPlanEditor,\n MapPlanEditorOptions,\n Plan,\n PlanState,\n PlanJob,\n PlanVehicle,\n PlanRoute,\n PlanLocation,\n PlanCredentials,\n PlanTokenAnswer,\n PlanResult,\n PricedRoute,\n PricedStop,\n PlanSummary,\n PlanViolation,\n InsertChoice,\n InsertChoices,\n PlanChangeEvent,\n PlanEditorError,\n PlanEditorState,\n PlanSnapshotEvent,\n PlanPreview,\n PlanEditOutcome,\n PlanTextKey,\n PlanLanguage,\n} from '@superrouteca/smap';\n"],"mappings":";;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,OAAO,eAA+G;AAwN3H,SAKE,KALF;AAnNJ,IAAM,aAAa,cAA8B,IAAI;AAG9C,IAAM,cAAc,oBAAI,QAAiB;AAGzC,SAAS,UAA0B;AACxC,SAAO,WAAW,UAAU;AAC9B;AA8DA,IAAM,MAAM,CAAC,MAAe,KAAK,UAAU,KAAK,IAAI;AAEpD,SAAS,cAAc,MAAc,MAA6B;AACh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,UAAM,UAAU,EAAE,KAAK,OAAO,OAAO,QAAQ;AAC7C,WAAO,MAAM;AACX,YAAM,UAAU;AAChB,UAAI,CAAC,YAAY,IAAI,GAAG,GAAG;AAAE,gBAAQ,MAAM,IAAI,gBAAgB,MAAM,EAAE,CAAC;AAAA,MAAG;AAAA,IAC7E;AAAA,EACF,GAAG,CAAC,KAAK,MAAM,EAAE,CAAC;AAClB,EAAAA,WAAU,MAAM;AACd,UAAM,IAAI,MAAM;AAChB,QAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,OAAO,EAAE,UAAU,OAAO;AAAE;AAAA,IAAQ;AAChE,MAAE,QAAQ;AACV,QAAI,aAAa,KAAK;AAAA,EACxB,GAAG,CAAC,KAAK,KAAK,CAAC;AACf,SAAO;AACT;AAQO,SAAS,aAAa,OAAuC,SAA8D;AAChI,QAAM,MAAM,QAAQ;AACpB,QAAM,OAAO,SAAS;AACtB,QAAM,SAAS,SAAS;AACxB,SAAO,QAAQ,MAAM;AACnB,QAAI,CAAC,KAAK;AAAE,aAAO;AAAA,IAAM;AACzB,UAAM,IAAyC,CAAC;AAChD,QAAI,SAAS,QAAW;AAAE,QAAE,OAAO;AAAA,IAAM;AACzC,QAAI,WAAW,QAAW;AAAE,QAAE,SAAS;AAAA,IAAQ;AAC/C,WAAO,IAAI,UAAU,OAAO,CAAC;AAAA,EAC/B,GAAG,CAAC,KAAK,OAAO,MAAM,MAAM,CAAC;AAC/B;AAUO,IAAMG,WAAmB;AAAA,EAC9B,KAAK,OAAkB,SAAuB;AAC5C,UAAM,IAA8C;AACpD,QAAI,CAAC,GAAG;AAAE,YAAM,IAAI,MAAM,sDAAsD;AAAA,IAAG;AACnF,WAAO,EAAE,KAAK,OAAO,OAAO;AAAA,EAC9B;AACF;;;AC9VA,SAAS,eAAe,iBAAiB;","names":["SMap","useEffect","useRef","useRef","useEffect","useEffect","useRef","useState","jsx","optionsKey","useState","useEffect","useRef","useEffect","useRef","useState","createPortal","jsx","useRef","useState","useEffect","createPortal","forwardRef","useEffect","useImperativeHandle","useRef","useState","key","useState","useRef","useEffect","forwardRef","PlanEditor","useImperativeHandle","createContext","Fragment","useContext","useEffect","useRef","useState","jsx","createContext","useRef","useState","useEffect","Fragment","useContext","formats"]}
|
package/package.json
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superrouteca/smap-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"description": "sMap for React: components for maps from Superroute's sMap service, with standard style layers, basemap overrides, data formats and external layers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Goodneo Solutions",
|
|
7
|
-
"homepage": "https://
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/Goodneo-Solutions/smap-sdk.git",
|
|
11
|
-
"directory": "react"
|
|
12
|
-
},
|
|
7
|
+
"homepage": "https://open.superroute.ca/developer/smap",
|
|
13
8
|
"keywords": [
|
|
14
9
|
"map",
|
|
15
10
|
"maps",
|
|
@@ -55,7 +50,7 @@
|
|
|
55
50
|
"prepack": "cp ../LICENSE LICENSE && npm run build"
|
|
56
51
|
},
|
|
57
52
|
"peerDependencies": {
|
|
58
|
-
"@superrouteca/smap": "1.2.
|
|
53
|
+
"@superrouteca/smap": "1.2.12",
|
|
59
54
|
"react": ">=18",
|
|
60
55
|
"react-dom": ">=18"
|
|
61
56
|
},
|