ts-maps 0.2.7 → 0.3.0

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.
Files changed (225) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +202 -141
  3. package/dist/core-map/assets/embedded-icons.d.ts +8 -0
  4. package/dist/core-map/control/AttributionControl.d.ts +12 -0
  5. package/dist/core-map/control/Control.d.ts +14 -0
  6. package/dist/core-map/control/LayersControl.d.ts +38 -0
  7. package/dist/core-map/control/ScaleControl.d.ts +14 -0
  8. package/dist/core-map/control/ZoomControl.d.ts +14 -0
  9. package/dist/core-map/control/index.d.ts +5 -0
  10. package/dist/core-map/core/Browser.d.ts +24 -0
  11. package/dist/core-map/core/Class.d.ts +12 -0
  12. package/dist/core-map/core/Events.d.ts +31 -0
  13. package/dist/core-map/core/Handler.d.ts +12 -0
  14. package/dist/core-map/core/Util.d.ts +24 -0
  15. package/dist/core-map/core/index.d.ts +7 -0
  16. package/dist/core-map/dom/Animation.d.ts +50 -0
  17. package/dist/core-map/dom/DomEvent.DoubleTap.d.ts +6 -0
  18. package/dist/core-map/dom/DomEvent.PointerEvents.d.ts +4 -0
  19. package/dist/core-map/dom/DomEvent.d.ts +15 -0
  20. package/dist/core-map/dom/DomUtil.d.ts +22 -0
  21. package/dist/core-map/dom/Draggable.d.ts +26 -0
  22. package/dist/core-map/dom/PosAnimation.d.ts +19 -0
  23. package/dist/core-map/dom/easing.d.ts +41 -0
  24. package/dist/core-map/dom/index.d.ts +8 -0
  25. package/dist/core-map/geo/LatLng.d.ts +18 -0
  26. package/dist/core-map/geo/LatLngBounds.d.ts +27 -0
  27. package/dist/core-map/geo/TerrainSource.d.ts +35 -0
  28. package/dist/core-map/geo/crs/CRS.d.ts +23 -0
  29. package/dist/core-map/geo/crs/EPSG3395.d.ts +7 -0
  30. package/dist/core-map/geo/crs/EPSG3857.d.ts +10 -0
  31. package/dist/core-map/geo/crs/EPSG4326.d.ts +7 -0
  32. package/dist/core-map/geo/crs/EarthCRS.d.ts +7 -0
  33. package/dist/core-map/geo/crs/SimpleCRS.d.ts +11 -0
  34. package/dist/core-map/geo/crs/index.d.ts +6 -0
  35. package/dist/core-map/geo/elevation.d.ts +23 -0
  36. package/dist/core-map/geo/index.d.ts +13 -0
  37. package/dist/core-map/geo/index.js +1204 -0
  38. package/dist/core-map/geo/projection/Projection.Globe.d.ts +30 -0
  39. package/dist/core-map/geo/projection/Projection.LonLat.d.ts +11 -0
  40. package/dist/core-map/geo/projection/Projection.Mercator.d.ts +6 -0
  41. package/dist/core-map/geo/projection/Projection.SphericalMercator.d.ts +6 -0
  42. package/dist/core-map/geo/projection/index.d.ts +5 -0
  43. package/dist/core-map/geo/terrainMesh.d.ts +21 -0
  44. package/dist/core-map/geometry/Bounds.d.ts +23 -0
  45. package/dist/core-map/geometry/LineUtil.d.ts +13 -0
  46. package/dist/core-map/geometry/Point.d.ts +35 -0
  47. package/dist/core-map/geometry/PolyUtil.d.ts +6 -0
  48. package/dist/core-map/geometry/RTree.d.ts +35 -0
  49. package/dist/core-map/geometry/Transformation.d.ts +12 -0
  50. package/dist/core-map/geometry/earcut.d.ts +17 -0
  51. package/dist/core-map/geometry/index.d.ts +10 -0
  52. package/dist/core-map/geometry/index.js +1586 -0
  53. package/dist/core-map/index.d.ts +59 -0
  54. package/dist/core-map/layer/BlanketOverlay.d.ts +24 -0
  55. package/dist/core-map/layer/DivOverlay.d.ts +40 -0
  56. package/dist/core-map/layer/FeatureGroup.d.ts +11 -0
  57. package/dist/core-map/layer/GeoJSON.d.ts +17 -0
  58. package/dist/core-map/layer/GeoJSONClusterSource.d.ts +54 -0
  59. package/dist/core-map/layer/HeatmapLayer.d.ts +40 -0
  60. package/dist/core-map/layer/ImageOverlay.d.ts +27 -0
  61. package/dist/core-map/layer/Layer.d.ts +18 -0
  62. package/dist/core-map/layer/LayerGroup.d.ts +16 -0
  63. package/dist/core-map/layer/Popup.d.ts +18 -0
  64. package/dist/core-map/layer/SVGOverlay.d.ts +4 -0
  65. package/dist/core-map/layer/Tooltip.d.ts +15 -0
  66. package/dist/core-map/layer/VideoOverlay.d.ts +4 -0
  67. package/dist/core-map/layer/index.d.ts +18 -0
  68. package/dist/core-map/layer/marker/DefaultIcon.d.ts +7 -0
  69. package/dist/core-map/layer/marker/DivIcon.d.ts +5 -0
  70. package/dist/core-map/layer/marker/Icon.d.ts +10 -0
  71. package/dist/core-map/layer/marker/Marker.Drag.d.ts +17 -0
  72. package/dist/core-map/layer/marker/Marker.d.ts +37 -0
  73. package/dist/core-map/layer/marker/index.d.ts +5 -0
  74. package/dist/core-map/layer/tile/GridLayer.d.ts +88 -0
  75. package/dist/core-map/layer/tile/RasterDEMLayer.d.ts +46 -0
  76. package/dist/core-map/layer/tile/TileLayer.d.ts +22 -0
  77. package/dist/core-map/layer/tile/VectorTileMapLayer.d.ts +145 -0
  78. package/dist/core-map/layer/tile/WMSTileLayer.d.ts +12 -0
  79. package/dist/core-map/layer/tile/index.d.ts +15 -0
  80. package/dist/core-map/layer/tile/urlTemplate.d.ts +17 -0
  81. package/dist/core-map/layer/vector/Canvas.d.ts +52 -0
  82. package/dist/core-map/layer/vector/Circle.d.ts +7 -0
  83. package/dist/core-map/layer/vector/CircleMarker.d.ts +22 -0
  84. package/dist/core-map/layer/vector/Path.d.ts +20 -0
  85. package/dist/core-map/layer/vector/Polygon.d.ts +13 -0
  86. package/dist/core-map/layer/vector/Polyline.d.ts +30 -0
  87. package/dist/core-map/layer/vector/Rectangle.d.ts +6 -0
  88. package/dist/core-map/layer/vector/Renderer.d.ts +12 -0
  89. package/dist/core-map/layer/vector/Renderer.getRenderer.d.ts +1 -0
  90. package/dist/core-map/layer/vector/SVG.d.ts +21 -0
  91. package/dist/core-map/layer/vector/index.d.ts +10 -0
  92. package/dist/core-map/map/Map.d.ts +353 -0
  93. package/dist/core-map/map/Style.d.ts +29 -0
  94. package/dist/core-map/map/handler/BoxZoomHandler.d.ts +23 -0
  95. package/dist/core-map/map/handler/DoubleClickZoomHandler.d.ts +6 -0
  96. package/dist/core-map/map/handler/DragHandler.d.ts +27 -0
  97. package/dist/core-map/map/handler/KeyboardHandler.d.ts +18 -0
  98. package/dist/core-map/map/handler/PinchZoomHandler.d.ts +20 -0
  99. package/dist/core-map/map/handler/ScrollWheelZoomHandler.d.ts +12 -0
  100. package/dist/core-map/map/handler/TapHoldHandler.d.ts +15 -0
  101. package/dist/core-map/map/handler/TwoFingerPitchHandler.d.ts +21 -0
  102. package/dist/core-map/map/handler/TwoFingerRotateHandler.d.ts +17 -0
  103. package/dist/core-map/map/index.d.ts +11 -0
  104. package/dist/core-map/mvt/VectorTile.d.ts +9 -0
  105. package/dist/core-map/mvt/VectorTileFeature.d.ts +59 -0
  106. package/dist/core-map/mvt/VectorTileLayer.d.ts +13 -0
  107. package/dist/core-map/proto/Pbf.d.ts +84 -0
  108. package/dist/core-map/renderer/webgl/GLContext.d.ts +22 -0
  109. package/dist/core-map/renderer/webgl/WebGLTileRenderer.d.ts +86 -0
  110. package/dist/core-map/renderer/webgl/index.d.ts +9 -0
  111. package/dist/core-map/renderer/webgl/mat4.d.ts +14 -0
  112. package/dist/core-map/services/index.d.ts +26 -0
  113. package/dist/core-map/services/index.js +1230 -0
  114. package/dist/core-map/services/providers/Google.d.ts +16 -0
  115. package/dist/core-map/services/providers/Mapbox.d.ts +26 -0
  116. package/dist/core-map/services/providers/Maptiler.d.ts +11 -0
  117. package/dist/core-map/services/providers/Nominatim.d.ts +11 -0
  118. package/dist/core-map/services/providers/OSRM.d.ts +20 -0
  119. package/dist/core-map/services/providers/Photon.d.ts +10 -0
  120. package/dist/core-map/services/providers/Valhalla.d.ts +20 -0
  121. package/dist/core-map/services/types.d.ts +84 -0
  122. package/dist/core-map/storage/TileCache.d.ts +40 -0
  123. package/dist/core-map/storage/cachedFetch.d.ts +13 -0
  124. package/dist/core-map/storage/defaultCache.d.ts +3 -0
  125. package/dist/core-map/storage/index.d.ts +13 -0
  126. package/dist/core-map/storage/index.js +283 -0
  127. package/dist/core-map/storage/offlineRegion.d.ts +26 -0
  128. package/dist/core-map/style-spec/diff.d.ts +17 -0
  129. package/dist/core-map/style-spec/expressions/Color.d.ts +16 -0
  130. package/dist/core-map/style-spec/expressions/compile.d.ts +4 -0
  131. package/dist/core-map/style-spec/expressions/errors.d.ts +8 -0
  132. package/dist/core-map/style-spec/expressions/index.d.ts +16 -0
  133. package/dist/core-map/style-spec/expressions/legacyFilter.d.ts +6 -0
  134. package/dist/core-map/style-spec/expressions/operators/conversion.d.ts +1 -0
  135. package/dist/core-map/style-spec/expressions/operators/interpolate.d.ts +14 -0
  136. package/dist/core-map/style-spec/expressions/operators/logical.d.ts +1 -0
  137. package/dist/core-map/style-spec/expressions/operators/lookup.d.ts +1 -0
  138. package/dist/core-map/style-spec/expressions/operators/math.d.ts +1 -0
  139. package/dist/core-map/style-spec/expressions/operators/string.d.ts +1 -0
  140. package/dist/core-map/style-spec/expressions/registry.d.ts +29 -0
  141. package/dist/core-map/style-spec/expressions/types.d.ts +48 -0
  142. package/dist/core-map/style-spec/expressions/validate.d.ts +13 -0
  143. package/dist/core-map/style-spec/index.d.ts +68 -0
  144. package/dist/core-map/style-spec/index.js +2529 -0
  145. package/dist/core-map/style-spec/schema.d.ts +381 -0
  146. package/dist/core-map/style-spec/types.d.ts +375 -0
  147. package/dist/core-map/style-spec/validate.d.ts +14 -0
  148. package/dist/core-map/symbols/CollisionIndex.d.ts +21 -0
  149. package/dist/core-map/symbols/GlyphAtlas.d.ts +38 -0
  150. package/dist/core-map/symbols/IconAtlas.d.ts +18 -0
  151. package/dist/core-map/symbols/index.d.ts +6 -0
  152. package/dist/core-map/symbols/index.js +501 -0
  153. package/dist/index.d.ts +2 -4
  154. package/dist/index.js +18414 -1857
  155. package/package.json +50 -58
  156. package/src/core-map/ts-maps.css +725 -0
  157. package/dist/components/base.d.ts +0 -17
  158. package/dist/components/concerns/interactable.d.ts +0 -1
  159. package/dist/components/line.d.ts +0 -29
  160. package/dist/components/marker.d.ts +0 -50
  161. package/dist/components/region.d.ts +0 -46
  162. package/dist/components/tooltip.d.ts +0 -22
  163. package/dist/core/apply-transform.d.ts +0 -7
  164. package/dist/core/coords-to-point.d.ts +0 -12
  165. package/dist/core/create-lines.d.ts +0 -2
  166. package/dist/core/create-markers.d.ts +0 -2
  167. package/dist/core/create-regions.d.ts +0 -2
  168. package/dist/core/create-series.d.ts +0 -3
  169. package/dist/core/get-inset-for-point.d.ts +0 -13
  170. package/dist/core/get-marker-position.d.ts +0 -6
  171. package/dist/core/index.d.ts +0 -1
  172. package/dist/core/reposition-labels.d.ts +0 -2
  173. package/dist/core/reposition-lines.d.ts +0 -2
  174. package/dist/core/reposition-markers.d.ts +0 -2
  175. package/dist/core/resize.d.ts +0 -3
  176. package/dist/core/set-focus.d.ts +0 -2
  177. package/dist/core/set-scale.d.ts +0 -2
  178. package/dist/core/setup-container-events.d.ts +0 -2
  179. package/dist/core/setup-container-touch-events.d.ts +0 -2
  180. package/dist/core/setup-element-events.d.ts +0 -2
  181. package/dist/core/setup-zoom-buttons.d.ts +0 -2
  182. package/dist/core/update-size.d.ts +0 -2
  183. package/dist/data-visualization.d.ts +0 -17
  184. package/dist/defaults/events.d.ts +0 -1
  185. package/dist/defaults/options.d.ts +0 -1
  186. package/dist/event-handler.d.ts +0 -1
  187. package/dist/legend.d.ts +0 -17
  188. package/dist/map.d.ts +0 -81
  189. package/dist/maps/brasil.d.ts +0 -2
  190. package/dist/maps/brasil.js +0 -7
  191. package/dist/maps/canada.d.ts +0 -2
  192. package/dist/maps/canada.js +0 -7
  193. package/dist/maps/iraq.d.ts +0 -2
  194. package/dist/maps/iraq.js +0 -84
  195. package/dist/maps/italy.d.ts +0 -2
  196. package/dist/maps/italy.js +0 -7
  197. package/dist/maps/russia.d.ts +0 -2
  198. package/dist/maps/russia.js +0 -366
  199. package/dist/maps/spain.d.ts +0 -2
  200. package/dist/maps/spain.js +0 -7
  201. package/dist/maps/us-aea-en.d.ts +0 -2
  202. package/dist/maps/us-aea-en.js +0 -7
  203. package/dist/maps/us-lcc-en.d.ts +0 -2
  204. package/dist/maps/us-lcc-en.js +0 -7
  205. package/dist/maps/us-merc-en.d.ts +0 -2
  206. package/dist/maps/us-merc-en.js +0 -7
  207. package/dist/maps/us-mill-en.d.ts +0 -2
  208. package/dist/maps/us-mill-en.js +0 -7
  209. package/dist/maps/world-merc.d.ts +0 -2
  210. package/dist/maps/world-merc.js +0 -7
  211. package/dist/maps/world.d.ts +0 -2
  212. package/dist/maps/world.js +0 -7
  213. package/dist/projection.d.ts +0 -1
  214. package/dist/scales/ordinal-scale.d.ts +0 -12
  215. package/dist/series.d.ts +0 -14
  216. package/dist/svg/base-element.d.ts +0 -19
  217. package/dist/svg/canvas-element.d.ts +0 -21
  218. package/dist/svg/image-element.d.ts +0 -12
  219. package/dist/svg/shape-element.d.ts +0 -19
  220. package/dist/svg/text-element.d.ts +0 -7
  221. package/dist/types.d.ts +0 -418
  222. package/dist/util/deep-merge.d.ts +0 -2
  223. package/dist/util/index.d.ts +0 -18
  224. package/dist/utils.d.ts +0 -87
  225. package/dist/vector-map.d.ts +0 -5
@@ -0,0 +1,16 @@
1
+ import type { DirectionsOptions, DirectionsProvider, GeocoderOptions, GeocoderProvider, GeocodingResult, LatLngLike, Route } from '../types';
2
+ export declare interface GoogleOptions {
3
+ apiKey: string
4
+ baseUrl?: string
5
+ }
6
+ export declare class GoogleGeocoder implements GeocoderProvider {
7
+ name: string;
8
+ constructor(opts: GoogleOptions);
9
+ search(query: string, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
10
+ reverse(center: LatLngLike, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
11
+ }
12
+ export declare class GoogleDirections implements DirectionsProvider {
13
+ name: string;
14
+ constructor(opts: GoogleOptions);
15
+ getDirections(waypoints: LatLngLike[], opts?: DirectionsOptions): Promise<Route[]>;
16
+ }
@@ -0,0 +1,26 @@
1
+ import type { DirectionsOptions, DirectionsProvider, GeocoderOptions, GeocoderProvider, GeocodingResult, IsochroneOptions, IsochronePolygon, IsochroneProvider, LatLngLike, MatrixOptions, MatrixProvider, MatrixResult, Route } from '../types';
2
+ export declare interface MapboxOptions {
3
+ accessToken: string
4
+ baseUrl?: string
5
+ }
6
+ export declare class MapboxGeocoder implements GeocoderProvider {
7
+ name: string;
8
+ constructor(opts: MapboxOptions);
9
+ search(query: string, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
10
+ reverse(center: LatLngLike, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
11
+ }
12
+ export declare class MapboxDirections implements DirectionsProvider {
13
+ name: string;
14
+ constructor(opts: MapboxOptions);
15
+ getDirections(waypoints: LatLngLike[], opts?: DirectionsOptions): Promise<Route[]>;
16
+ }
17
+ export declare class MapboxIsochrone implements IsochroneProvider {
18
+ name: string;
19
+ constructor(opts: MapboxOptions);
20
+ getIsochrones(center: LatLngLike, opts: IsochroneOptions): Promise<IsochronePolygon[]>;
21
+ }
22
+ export declare class MapboxMatrix implements MatrixProvider {
23
+ name: string;
24
+ constructor(opts: MapboxOptions);
25
+ getMatrix(origins: LatLngLike[], destinations: LatLngLike[], opts?: MatrixOptions): Promise<MatrixResult>;
26
+ }
@@ -0,0 +1,11 @@
1
+ import type { GeocoderOptions, GeocoderProvider, GeocodingResult, LatLngLike } from '../types';
2
+ export declare interface MaptilerOptions {
3
+ apiKey: string
4
+ baseUrl?: string
5
+ }
6
+ export declare class MaptilerGeocoder implements GeocoderProvider {
7
+ name: string;
8
+ constructor(opts: MaptilerOptions);
9
+ search(query: string, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
10
+ reverse(center: LatLngLike, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { GeocoderOptions, GeocoderProvider, GeocodingResult, LatLngLike } from '../types';
2
+ export declare interface NominatimOptions {
3
+ baseUrl?: string
4
+ userAgent?: string
5
+ }
6
+ export declare class NominatimGeocoder implements GeocoderProvider {
7
+ name: string;
8
+ constructor(opts?: NominatimOptions);
9
+ search(query: string, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
10
+ reverse(center: LatLngLike, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
11
+ }
@@ -0,0 +1,20 @@
1
+ import type { DirectionsOptions, DirectionsProvider, LatLngLike, MatrixOptions, MatrixProvider, MatrixResult, Route } from '../types';
2
+ export declare interface OSRMOptions {
3
+ baseUrl?: string
4
+ }
5
+ export declare class OSRMDirections implements DirectionsProvider {
6
+ name: string;
7
+ constructor(opts?: OSRMOptions);
8
+ getDirections(waypoints: LatLngLike[], opts?: DirectionsOptions): Promise<Route[]>;
9
+ }
10
+ /**
11
+ * OSRM `/table` matrix — keyless default travel-time / distance matrix.
12
+ *
13
+ * Shares a baseUrl with `OSRMDirections`; point it at a self-hosted OSRM
14
+ * instance for production traffic.
15
+ */
16
+ export declare class OSRMMatrix implements MatrixProvider {
17
+ name: string;
18
+ constructor(opts?: OSRMOptions);
19
+ getMatrix(origins: LatLngLike[], destinations: LatLngLike[], opts?: MatrixOptions): Promise<MatrixResult>;
20
+ }
@@ -0,0 +1,10 @@
1
+ import type { GeocoderOptions, GeocoderProvider, GeocodingResult, LatLngLike } from '../types';
2
+ export declare interface PhotonOptions {
3
+ baseUrl?: string
4
+ }
5
+ export declare class PhotonGeocoder implements GeocoderProvider {
6
+ name: string;
7
+ constructor(opts?: PhotonOptions);
8
+ search(query: string, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
9
+ reverse(center: LatLngLike, opts?: GeocoderOptions): Promise<GeocodingResult[]>;
10
+ }
@@ -0,0 +1,20 @@
1
+ import type { DirectionsOptions, DirectionsProvider, IsochroneOptions, IsochronePolygon, IsochroneProvider, LatLngLike, MatrixOptions, MatrixProvider, MatrixResult, Route } from '../types';
2
+ export declare interface ValhallaOptions {
3
+ baseUrl?: string
4
+ apiKey?: string
5
+ }
6
+ export declare class ValhallaDirections implements DirectionsProvider {
7
+ name: string;
8
+ constructor(opts?: ValhallaOptions);
9
+ getDirections(waypoints: LatLngLike[], opts?: DirectionsOptions): Promise<Route[]>;
10
+ }
11
+ export declare class ValhallaIsochrone implements IsochroneProvider {
12
+ name: string;
13
+ constructor(opts?: ValhallaOptions);
14
+ getIsochrones(center: LatLngLike, opts: IsochroneOptions): Promise<IsochronePolygon[]>;
15
+ }
16
+ export declare class ValhallaMatrix implements MatrixProvider {
17
+ name: string;
18
+ constructor(opts?: ValhallaOptions);
19
+ getMatrix(origins: LatLngLike[], destinations: LatLngLike[], opts?: MatrixOptions): Promise<MatrixResult>;
20
+ }
@@ -0,0 +1,84 @@
1
+ // Provider-interface layer for geocoding, directions, isochrone, and matrix
2
+ // services. Consumers program against these interfaces; providers are
3
+ // implemented separately so upstream backends can be swapped without touching
4
+ // map code.
5
+ export declare interface LatLngLike {
6
+ lat: number
7
+ lng: number
8
+ }
9
+ export declare interface GeocodingResult {
10
+ text: string
11
+ center: LatLngLike
12
+ bbox?: [number, number, number, number]
13
+ placeType?: 'country' | 'region' | 'district' | 'postcode' | 'place' | 'address' | 'poi'
14
+ properties?: Record<string, unknown>
15
+ relevance?: number
16
+ }
17
+ export declare interface GeocoderOptions {
18
+ limit?: number
19
+ language?: string
20
+ proximity?: LatLngLike
21
+ bbox?: [number, number, number, number]
22
+ countries?: string[]
23
+ signal?: AbortSignal
24
+ }
25
+ export declare interface GeocoderProvider {
26
+ name: string
27
+ search: (query: string, opts?: GeocoderOptions) => Promise<GeocodingResult[]>
28
+ reverse: (center: LatLngLike, opts?: GeocoderOptions) => Promise<GeocodingResult[]>
29
+ }
30
+ export declare interface RouteStep {
31
+ distance: number
32
+ duration: number
33
+ instruction: string
34
+ geometry: LatLngLike[]
35
+ maneuver?: string
36
+ }
37
+ export declare interface Route {
38
+ distance: number
39
+ duration: number
40
+ geometry: LatLngLike[]
41
+ steps: RouteStep[]
42
+ legs?: Route[]
43
+ }
44
+ export declare interface DirectionsOptions {
45
+ profile?: TransportProfile
46
+ alternatives?: boolean
47
+ signal?: AbortSignal
48
+ language?: string
49
+ }
50
+ export declare interface DirectionsProvider {
51
+ name: string
52
+ getDirections: (waypoints: LatLngLike[], opts?: DirectionsOptions) => Promise<Route[]>
53
+ }
54
+ export declare interface IsochroneOptions {
55
+ profile?: TransportProfile
56
+ contours: number[]
57
+ contourMetric?: 'time' | 'distance'
58
+ denoise?: number
59
+ generalize?: number
60
+ signal?: AbortSignal
61
+ }
62
+ export declare interface IsochronePolygon {
63
+ geometry: LatLngLike[]
64
+ holes?: LatLngLike[][]
65
+ contour: number
66
+ }
67
+ export declare interface IsochroneProvider {
68
+ name: string
69
+ getIsochrones: (center: LatLngLike, opts: IsochroneOptions) => Promise<IsochronePolygon[]>
70
+ }
71
+ export declare interface MatrixOptions {
72
+ profile?: TransportProfile
73
+ metric?: 'time' | 'distance'
74
+ signal?: AbortSignal
75
+ }
76
+ export declare interface MatrixResult {
77
+ durations?: number[][]
78
+ distances?: number[][]
79
+ }
80
+ export declare interface MatrixProvider {
81
+ name: string
82
+ getMatrix: (origins: LatLngLike[], destinations: LatLngLike[], opts?: MatrixOptions) => Promise<MatrixResult>
83
+ }
84
+ export type TransportProfile = 'driving' | 'walking' | 'cycling';
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Async key-value store for tile bytes, with TTL + LRU pruning. The default
3
+ * backend is in-memory; callers may inject their own (e.g. an IndexedDB-backed
4
+ * one in browsers) via the `backend` option.
5
+ */
6
+ export declare interface Tile {
7
+ key: string
8
+ data: Uint8Array
9
+ mime: string
10
+ bytes: number
11
+ addedAt: number
12
+ }
13
+ export declare interface TileCacheBackend {
14
+ get: (key: string) => Promise<Tile | undefined>
15
+ put: (tile: Tile) => Promise<void>
16
+ delete: (key: string) => Promise<void>
17
+ clear: () => Promise<void>
18
+ all: () => Promise<Tile[]>
19
+ close?: () => void | Promise<void>
20
+ }
21
+ export declare interface TileCacheOptions {
22
+ ttlMs?: number
23
+ maxEntries?: number
24
+ maxBytes?: number
25
+ backend?: TileCacheBackend
26
+ }
27
+ export declare interface TileCacheSize {
28
+ entries: number
29
+ bytes: number
30
+ }
31
+ export declare class TileCache {
32
+ constructor(options?: TileCacheOptions);
33
+ get(key: string): Promise<Tile | undefined>;
34
+ put(key: string, data: Uint8Array, mime: string): Promise<void>;
35
+ delete(key: string): Promise<void>;
36
+ clear(): Promise<void>;
37
+ size(): Promise<TileCacheSize>;
38
+ prune(): Promise<void>;
39
+ close(): Promise<void>;
40
+ }
@@ -0,0 +1,13 @@
1
+ import type { TileCache } from './TileCache';
2
+ export declare function cachedFetch(url: string, options: CachedFetchOptions): Promise<CachedFetchResult>;
3
+ export declare interface CachedFetchOptions {
4
+ cache: TileCache
5
+ signal?: AbortSignal
6
+ noStore?: boolean
7
+ forceNetwork?: boolean
8
+ }
9
+ export declare interface CachedFetchResult {
10
+ data: Uint8Array
11
+ mime: string
12
+ fromCache: boolean
13
+ }
@@ -0,0 +1,3 @@
1
+ import { TileCache } from './TileCache';
2
+ export declare function getDefaultCache(): TileCache;
3
+ export declare function resetDefaultCache(): Promise<void>;
@@ -0,0 +1,13 @@
1
+ export type { CachedFetchOptions, CachedFetchResult } from './cachedFetch';
2
+ // `Bounds` and `TileCoord` are re-used names in geo/geometry barrels — keep
3
+ // them out of the storage re-export to avoid collisions in `core-map/index`.
4
+ export type {
5
+ OfflineRegionOptions,
6
+ OfflineRegionResult,
7
+ ProgressEmitter,
8
+ } from './offlineRegion';
9
+ export type { Tile, TileCacheBackend, TileCacheOptions, TileCacheSize } from './TileCache';
10
+ export { cachedFetch } from './cachedFetch';
11
+ export { getDefaultCache, resetDefaultCache } from './defaultCache';
12
+ export { computeTileCoords, saveOfflineRegion } from './offlineRegion';
13
+ export { TileCache } from './TileCache';
@@ -0,0 +1,283 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ function __accessProp(key) {
6
+ return this[key];
7
+ }
8
+ var __toCommonJS = (from) => {
9
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
10
+ if (entry)
11
+ return entry;
12
+ entry = __defProp({}, "__esModule", { value: true });
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(entry, key))
16
+ __defProp(entry, key, {
17
+ get: __accessProp.bind(from, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ __moduleCache.set(from, entry);
22
+ return entry;
23
+ };
24
+ var __moduleCache;
25
+ var __returnValue = (v) => v;
26
+ function __exportSetter(name, newValue) {
27
+ this[name] = __returnValue.bind(null, newValue);
28
+ }
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true,
34
+ configurable: true,
35
+ set: __exportSetter.bind(all, name)
36
+ });
37
+ };
38
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
39
+
40
+ // src/core-map/storage/cachedFetch.ts
41
+ function abortError() {
42
+ const err = new Error("The operation was aborted.");
43
+ err.name = "AbortError";
44
+ return err;
45
+ }
46
+ async function cachedFetch(url, options) {
47
+ const { cache, signal, noStore, forceNetwork } = options;
48
+ if (signal?.aborted)
49
+ throw abortError();
50
+ if (!forceNetwork) {
51
+ const cached = await cache.get(url);
52
+ if (cached) {
53
+ return { data: cached.data, mime: cached.mime, fromCache: true };
54
+ }
55
+ }
56
+ try {
57
+ const res = await fetch(url, { signal });
58
+ const buf = new Uint8Array(await res.arrayBuffer());
59
+ const mime = res.headers.get("content-type") ?? "application/octet-stream";
60
+ if (!noStore)
61
+ await cache.put(url, buf, mime);
62
+ return { data: buf, mime, fromCache: false };
63
+ } catch (err) {
64
+ if (signal?.aborted)
65
+ throw abortError();
66
+ const cached = await cache.get(url);
67
+ if (cached)
68
+ return { data: cached.data, mime: cached.mime, fromCache: true };
69
+ throw err;
70
+ }
71
+ }
72
+
73
+ // src/core-map/storage/TileCache.ts
74
+ function createMemoryBackend() {
75
+ let store = new Map;
76
+ return {
77
+ get: async (key) => store.get(key),
78
+ put: async (tile) => {
79
+ store.set(tile.key, tile);
80
+ },
81
+ delete: async (key) => {
82
+ store.delete(key);
83
+ },
84
+ clear: async () => {
85
+ store.clear();
86
+ },
87
+ all: async () => [...store.values()],
88
+ close: () => {
89
+ store = new Map;
90
+ }
91
+ };
92
+ }
93
+
94
+ class TileCache {
95
+ _ttlMs;
96
+ _maxEntries;
97
+ _maxBytes;
98
+ _customBackend;
99
+ _backend;
100
+ constructor(options = {}) {
101
+ this._ttlMs = options.ttlMs ?? 0;
102
+ this._maxEntries = options.maxEntries ?? Number.POSITIVE_INFINITY;
103
+ this._maxBytes = options.maxBytes ?? Number.POSITIVE_INFINITY;
104
+ this._customBackend = options.backend;
105
+ this._backend = options.backend ?? createMemoryBackend();
106
+ }
107
+ async get(key) {
108
+ const tile = await this._backend.get(key);
109
+ if (!tile)
110
+ return;
111
+ if (this._isExpired(tile)) {
112
+ await this._backend.delete(key);
113
+ return;
114
+ }
115
+ return tile;
116
+ }
117
+ async put(key, data, mime) {
118
+ const tile = {
119
+ key,
120
+ data,
121
+ mime,
122
+ bytes: data.byteLength,
123
+ addedAt: Date.now()
124
+ };
125
+ await this._backend.put(tile);
126
+ }
127
+ async delete(key) {
128
+ await this._backend.delete(key);
129
+ }
130
+ async clear() {
131
+ await this._backend.clear();
132
+ }
133
+ async size() {
134
+ const all = await this._backend.all();
135
+ let bytes = 0;
136
+ for (const t of all)
137
+ bytes += t.bytes;
138
+ return { entries: all.length, bytes };
139
+ }
140
+ async prune() {
141
+ const all = await this._backend.all();
142
+ const live = [];
143
+ for (const t of all) {
144
+ if (this._isExpired(t))
145
+ await this._backend.delete(t.key);
146
+ else
147
+ live.push(t);
148
+ }
149
+ live.sort((a, b) => a.addedAt - b.addedAt);
150
+ let totalBytes = 0;
151
+ for (const t of live)
152
+ totalBytes += t.bytes;
153
+ let entries = live.length;
154
+ while (live.length > 0 && (entries > this._maxEntries || totalBytes > this._maxBytes)) {
155
+ const oldest = live.shift();
156
+ await this._backend.delete(oldest.key);
157
+ totalBytes -= oldest.bytes;
158
+ entries -= 1;
159
+ }
160
+ }
161
+ async close() {
162
+ if (this._backend.close)
163
+ await this._backend.close();
164
+ if (this._customBackend) {
165
+ this._backend = createMemoryBackend();
166
+ } else {
167
+ this._backend = createMemoryBackend();
168
+ }
169
+ }
170
+ _isExpired(tile) {
171
+ if (this._ttlMs <= 0)
172
+ return false;
173
+ return Date.now() - tile.addedAt > this._ttlMs;
174
+ }
175
+ }
176
+
177
+ // src/core-map/storage/defaultCache.ts
178
+ function getDefaultCache() {
179
+ if (!_instance)
180
+ _instance = new TileCache;
181
+ return _instance;
182
+ }
183
+ async function resetDefaultCache() {
184
+ if (_instance) {
185
+ await _instance.close();
186
+ _instance = undefined;
187
+ }
188
+ }
189
+ var _instance;
190
+ var init_defaultCache = () => {};
191
+
192
+ // src/core-map/storage/offlineRegion.ts
193
+ function normalizeBounds(b) {
194
+ if (Array.isArray(b))
195
+ return { west: b[0], south: b[1], east: b[2], north: b[3] };
196
+ return b;
197
+ }
198
+ function lonToTileX(lon, z) {
199
+ return Math.floor((lon + 180) / 360 * 2 ** z);
200
+ }
201
+ function latToTileY(lat, z) {
202
+ const rad = lat * Math.PI / 180;
203
+ return Math.floor((1 - Math.log(Math.tan(rad) + 1 / Math.cos(rad)) / Math.PI) / 2 * 2 ** z);
204
+ }
205
+ function clampTile(v, z) {
206
+ const max = 2 ** z - 1;
207
+ if (v < 0)
208
+ return 0;
209
+ if (v > max)
210
+ return max;
211
+ return v;
212
+ }
213
+ function computeTileCoords(bounds, zoomRange) {
214
+ const { west, south, east, north } = normalizeBounds(bounds);
215
+ const [zMin, zMax] = zoomRange;
216
+ const out = [];
217
+ for (let z = zMin;z <= zMax; z++) {
218
+ const x0 = clampTile(lonToTileX(Math.min(west, east), z), z);
219
+ const x1 = clampTile(lonToTileX(Math.max(west, east), z), z);
220
+ const y0 = clampTile(latToTileY(Math.max(south, north), z), z);
221
+ const y1 = clampTile(latToTileY(Math.min(south, north), z), z);
222
+ for (let x = x0;x <= x1; x++) {
223
+ for (let y = y0;y <= y1; y++) {
224
+ out.push({ x, y, z });
225
+ }
226
+ }
227
+ }
228
+ return out;
229
+ }
230
+ function fillTileUrl(tmpl, c) {
231
+ return tmpl.replace("{z}", String(c.z)).replace("{x}", String(c.x)).replace("{y}", String(c.y));
232
+ }
233
+ async function saveOfflineRegion(options, emitter) {
234
+ const cache = options.cache ?? getDefaultCache();
235
+ const concurrency = Math.max(1, options.concurrency ?? 4);
236
+ const coords = computeTileCoords(options.bounds, options.zoomRange);
237
+ const total = coords.length;
238
+ const result = { saved: 0, failed: 0, skipped: 0 };
239
+ let cursor = 0;
240
+ let completed = 0;
241
+ async function worker() {
242
+ while (cursor < coords.length) {
243
+ const idx = cursor++;
244
+ const c = coords[idx];
245
+ const url = fillTileUrl(options.tileUrl, c);
246
+ try {
247
+ const res = await cachedFetch(url, { cache, signal: options.signal });
248
+ if (res.fromCache)
249
+ result.skipped++;
250
+ else
251
+ result.saved++;
252
+ } catch {
253
+ result.failed++;
254
+ }
255
+ completed++;
256
+ emitter?.fire("offline:progress", { completed, total, coord: c });
257
+ }
258
+ }
259
+ const workers = [];
260
+ for (let i = 0;i < Math.min(concurrency, coords.length); i++)
261
+ workers.push(worker());
262
+ await Promise.all(workers);
263
+ return result;
264
+ }
265
+ var init_offlineRegion = __esm(() => {
266
+ init_defaultCache();
267
+ });
268
+
269
+ // src/core-map/storage/index.ts
270
+ var init_storage = __esm(() => {
271
+ init_defaultCache();
272
+ init_offlineRegion();
273
+ });
274
+ init_storage();
275
+
276
+ export {
277
+ saveOfflineRegion,
278
+ resetDefaultCache,
279
+ getDefaultCache,
280
+ computeTileCoords,
281
+ cachedFetch,
282
+ TileCache
283
+ };
@@ -0,0 +1,26 @@
1
+ import type { TileCache } from './TileCache';
2
+ export declare function computeTileCoords(bounds: Bounds, zoomRange: readonly [number, number]): TileCoord[];
3
+ export declare function saveOfflineRegion(options: OfflineRegionOptions, emitter?: ProgressEmitter): Promise<OfflineRegionResult>;
4
+ export declare interface TileCoord {
5
+ x: number
6
+ y: number
7
+ z: number
8
+ }
9
+ export declare interface ProgressEmitter {
10
+ fire: (type: string, data?: Record<string, unknown>) => unknown
11
+ }
12
+ export declare interface OfflineRegionOptions {
13
+ bounds: Bounds
14
+ zoomRange: readonly [number, number]
15
+ tileUrl: string
16
+ cache?: TileCache
17
+ concurrency?: number
18
+ signal?: AbortSignal
19
+ }
20
+ export declare interface OfflineRegionResult {
21
+ saved: number
22
+ failed: number
23
+ skipped: number
24
+ }
25
+ export type Bounds = | { west: number, south: number, east: number, north: number }
26
+ | readonly [west: number, south: number, east: number, north: number];
@@ -0,0 +1,17 @@
1
+ import type { LayerSpecification, LightSpecification, SourceSpecification, Style, TransitionSpecification } from './types';
2
+ export declare function diffStyles(prev: Style, next: Style): StyleDiff;
3
+ export declare interface StyleDiff {
4
+ commands: StyleDiffCommand[]
5
+ }
6
+ export type StyleDiffCommand = | { command: 'setStyle', args: [Style] }
7
+ | { command: 'addLayer', args: [LayerSpecification, string | undefined] }
8
+ | { command: 'removeLayer', args: [string] }
9
+ | { command: 'setLayoutProperty', args: [string, string, unknown] }
10
+ | { command: 'setPaintProperty', args: [string, string, unknown] }
11
+ | { command: 'setLayerZoomRange', args: [string, number | undefined, number | undefined] }
12
+ | { command: 'setFilter', args: [string, unknown] }
13
+ | { command: 'addSource', args: [string, SourceSpecification] }
14
+ | { command: 'removeSource', args: [string] }
15
+ | { command: 'setSourceData', args: [string, unknown] }
16
+ | { command: 'setTransition', args: [TransitionSpecification] }
17
+ | { command: 'setLight', args: [LightSpecification] }
@@ -0,0 +1,16 @@
1
+ import type { RGBA } from './types';
2
+ /**
3
+ * Parse a CSS color string into an RGBA tuple with float channels in [0..1].
4
+ * Returns null if the string can't be recognised — callers decide whether to
5
+ * treat that as an error or substitute a default.
6
+ */
7
+ export declare function parseColor(css: string): RGBA | null;
8
+ /**
9
+ * Linearly blend two RGBA tuples in straight sRGB. t is clamped to [0..1].
10
+ */
11
+ export declare function lerpColor(a: RGBA, b: RGBA, t: number): RGBA;
12
+ /**
13
+ * Render an RGBA tuple as a CSS `rgba(...)` string. Used mainly for diagnostic
14
+ * output and as the canonical wire form when handing colors to canvas.
15
+ */
16
+ export declare function formatColor(c: RGBA): string;
@@ -0,0 +1,4 @@
1
+ import type { CompiledExpression, ExpressionType } from './types';
2
+ export declare function boot(): void;
3
+ // The recursive compiler.
4
+ export declare function compile(expr: unknown, expectedType?: ExpressionType, path?: (string | number)[]): CompiledExpression;
@@ -0,0 +1,8 @@
1
+ // A small error class for expression compilation and evaluation failures.
2
+ // Attaches the offending expression and the path through the AST so that
3
+ // style authors can locate the problem without guessing.
4
+ export declare class ExpressionError extends Error {
5
+ expression: unknown;
6
+ path: (string | number)[];
7
+ constructor(message: string, expression: unknown, path?: (string | number)[]);
8
+ }
@@ -0,0 +1,16 @@
1
+ import { compile } from './compile';
2
+ import { ExpressionError } from './errors';
3
+ import { isExpression } from './validate';
4
+ import type { CompiledExpression, EvaluationContext, ExpressionType } from './types';
5
+ export type { CompiledExpression, EvaluationContext, ExpressionType, RGBA } from './types';
6
+ /**
7
+ * Compile-and-run convenience for one-shot evaluation. Prefer `compile` +
8
+ * a long-lived `evaluate` closure on the render path — `evaluate` here
9
+ * recompiles every call and only makes sense for tests and diagnostics.
10
+ */
11
+ export declare function evaluate(expr: unknown, ctx: EvaluationContext, expectedType?: ExpressionType): unknown;
12
+ export { formatColor, lerpColor, parseColor } from './Color';
13
+ export { compile } from './compile';
14
+ export { ExpressionError } from './errors';
15
+ export { convertLegacyFilter } from './legacyFilter';
16
+ export { isExpression, validateExpression } from './validate';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Upgrade a legacy Mapbox filter to an equivalent expression-form filter.
3
+ * Already-upgraded filters pass through unchanged so callers can apply this
4
+ * blindly as a pre-pass.
5
+ */
6
+ export declare function convertLegacyFilter(filter: unknown[]): unknown[];
@@ -0,0 +1 @@
1
+ export declare function registerConversionOps(): void;