@yappkit/front-module-map 0.2.0 → 0.2.1
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/lib/types/main.d.ts +95 -1
- package/lib/types/providers/DeckGL.d.ts +95 -3
- package/lib/types/providers/DeckGLOverlay.d.ts +62 -8
- package/lib/types/providers/GoogleMaps.d.ts +311 -31
- package/lib/types/providers/Mapbox.d.ts +201 -105
- package/lib/types/providers/Maplibre.d.ts +27 -3
- package/lib/types/searoute/searoute.d.ts +45 -1
- package/lib/types/utils/getAirRoute.d.ts +71 -6
- package/lib/types/utils/getWaterRoute.d.ts +40 -6
- package/lib/types/utils/normalizeRoute.d.ts +8 -1
- package/package.json +1 -1
package/lib/types/main.d.ts
CHANGED
|
@@ -19,9 +19,103 @@ export declare const mapProviders: {
|
|
|
19
19
|
deckgl: typeof DeckGL;
|
|
20
20
|
'deck-gl': typeof DeckGL;
|
|
21
21
|
};
|
|
22
|
+
export type GoogleMapsConfig = {
|
|
23
|
+
/**
|
|
24
|
+
* - Provider discriminant.
|
|
25
|
+
*/
|
|
26
|
+
type: 'google' | 'google-maps';
|
|
27
|
+
/**
|
|
28
|
+
* - Google Maps API key. Required: without it the entry is warn+skipped (#255).
|
|
29
|
+
*/
|
|
30
|
+
apiKey: string;
|
|
31
|
+
/**
|
|
32
|
+
* - Google Maps libraries, all loaded in a single loader call (e.g.
|
|
33
|
+
* 'maps', 'maps3d', 'elevation'); each becomes available through getSDK(name).
|
|
34
|
+
*/
|
|
35
|
+
libraries?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* - Google Maps JS API version channel — Map3D requires 'alpha'
|
|
38
|
+
* (plus a pre-authorized key).
|
|
39
|
+
*/
|
|
40
|
+
version?: string;
|
|
41
|
+
};
|
|
42
|
+
export type MapboxConfig = {
|
|
43
|
+
/**
|
|
44
|
+
* - Provider discriminant.
|
|
45
|
+
*/
|
|
46
|
+
type: 'mapbox';
|
|
47
|
+
/**
|
|
48
|
+
* - Mapbox public access token. Required: without it the entry is warn+skipped (#255).
|
|
49
|
+
*/
|
|
50
|
+
apiKey: string;
|
|
51
|
+
/**
|
|
52
|
+
* - Mapbox REST SDK services to preload; each becomes available through getSDK(name).
|
|
53
|
+
*/
|
|
54
|
+
services?: Array<'datasets' | 'directions' | 'geocoding' | 'geocodingV6' | 'mapMatching' | 'matrix' | 'optimization' | 'static' | 'styles' | 'tilequery' | 'tilesets' | 'tokens' | 'uploads' | 'isochrone'>;
|
|
55
|
+
};
|
|
56
|
+
export type MaplibreConfig = {
|
|
57
|
+
/**
|
|
58
|
+
* - Provider discriminant.
|
|
59
|
+
*/
|
|
60
|
+
type: 'maplibre' | 'maplibre-gl';
|
|
61
|
+
};
|
|
62
|
+
export type DeckGLConfig = {
|
|
63
|
+
/**
|
|
64
|
+
* - Provider discriminant.
|
|
65
|
+
*/
|
|
66
|
+
type: 'deckgl' | 'deck-gl';
|
|
67
|
+
};
|
|
68
|
+
export type MapConfig = GoogleMapsConfig | MapboxConfig | MaplibreConfig | DeckGLConfig;
|
|
69
|
+
export type MapsConfig = Record<string, MapConfig>;
|
|
70
|
+
/**
|
|
71
|
+
* Google Maps provider config (`type: 'google'` / `'google-maps'`).
|
|
72
|
+
* @typedef {object} GoogleMapsConfig
|
|
73
|
+
* @property {'google'|'google-maps'} type - Provider discriminant.
|
|
74
|
+
* @property {string} apiKey - Google Maps API key. Required: without it the entry is warn+skipped (#255).
|
|
75
|
+
* @property {string[]} [libraries] - Google Maps libraries, all loaded in a single loader call (e.g.
|
|
76
|
+
* 'maps', 'maps3d', 'elevation'); each becomes available through getSDK(name).
|
|
77
|
+
* @property {string} [version='weekly'] - Google Maps JS API version channel — Map3D requires 'alpha'
|
|
78
|
+
* (plus a pre-authorized key).
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Mapbox provider config (`type: 'mapbox'`), rendering on the mapbox-gl peer.
|
|
82
|
+
* @typedef {object} MapboxConfig
|
|
83
|
+
* @property {'mapbox'} type - Provider discriminant.
|
|
84
|
+
* @property {string} apiKey - Mapbox public access token. Required: without it the entry is warn+skipped (#255).
|
|
85
|
+
* @property {Array<'datasets'|'directions'|'geocoding'|'geocodingV6'|'mapMatching'|'matrix'|'optimization'|'static'|'styles'|'tilequery'|'tilesets'|'tokens'|'uploads'|'isochrone'>} [services]
|
|
86
|
+
* - Mapbox REST SDK services to preload; each becomes available through getSDK(name).
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* MapLibre provider config (`type: 'maplibre'` / `'maplibre-gl'`) — the token-less mapbox-gl fork
|
|
90
|
+
* (#154): no apiKey, and no Mapbox REST services (getSDK refuses them).
|
|
91
|
+
* @typedef {object} MaplibreConfig
|
|
92
|
+
* @property {'maplibre'|'maplibre-gl'} type - Provider discriminant.
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* DeckGL provider config (`type: 'deckgl'` / `'deck-gl'`) — no key: composes over the other providers.
|
|
96
|
+
* @typedef {object} DeckGLConfig
|
|
97
|
+
* @property {'deckgl'|'deck-gl'} type - Provider discriminant.
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* One entry of the `maps` config: a per-instance provider config, discriminated by `type`.
|
|
101
|
+
* @typedef {GoogleMapsConfig|MapboxConfig|MaplibreConfig|DeckGLConfig} MapConfig
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* The `maps` config key: instance key → provider config. Each valid entry becomes
|
|
105
|
+
* `yAppKit.maps.<key>`; a faulty one is warn+skipped (#166/#255/#351).
|
|
106
|
+
* @typedef {Record<string, MapConfig>} MapsConfig
|
|
107
|
+
*/
|
|
22
108
|
export default class MapModule {
|
|
23
|
-
|
|
109
|
+
/** Builds `yAppKit.maps` — one provider instance per entry of the `maps` config key ({@link MapsConfig}).
|
|
110
|
+
* @param {object} yAppKit - The yAppKit instance (untyped: @yappkit/front exports no types).
|
|
111
|
+
* @returns {{onAfterSetup: () => void}} The module's yAppKit lifecycle hooks.
|
|
112
|
+
*/
|
|
113
|
+
install(yAppKit: object): {
|
|
24
114
|
onAfterSetup: () => void;
|
|
25
115
|
};
|
|
26
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Module factory for createYAppKit's `modules` list.
|
|
119
|
+
* @returns {MapModule} A fresh module instance.
|
|
120
|
+
*/
|
|
27
121
|
export declare const loadMapModule: () => MapModule;
|
|
@@ -1,10 +1,102 @@
|
|
|
1
|
+
export type DeckGLMapWrapperOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* - Vue watcher options for the options watcher (defaults: `immediate: true, deep: true`).
|
|
4
|
+
*/
|
|
5
|
+
watchOptionsOptions?: import('vue').WatchOptions;
|
|
6
|
+
/**
|
|
7
|
+
* - Vue watcher options for the layers watcher (default: `immediate: true`; intentionally not deep — layers are shallow-compared, swap array/layer identity to update).
|
|
8
|
+
*/
|
|
9
|
+
watchLayersOptions?: import('vue').WatchOptions;
|
|
10
|
+
/**
|
|
11
|
+
* - Defers map creation: called on mount with the create function instead of creating right away — call `loadMap()` when ready.
|
|
12
|
+
*/
|
|
13
|
+
onMounted?: (loadMap: () => void) => void;
|
|
14
|
+
};
|
|
15
|
+
export type DeckGLMapOptions = import('@deck.gl/core').DeckProps & DeckGLMapWrapperOptions;
|
|
16
|
+
/**
|
|
17
|
+
* Wrapper-specific keys of the map options bag — every other key is handed verbatim to the
|
|
18
|
+
* deck.gl `Deck` constructor (and re-applied through `setProps` on change).
|
|
19
|
+
* @typedef {object} DeckGLMapWrapperOptions
|
|
20
|
+
* @property {import('vue').WatchOptions} [watchOptionsOptions] - Vue watcher options for the options watcher (defaults: `immediate: true, deep: true`).
|
|
21
|
+
* @property {import('vue').WatchOptions} [watchLayersOptions] - Vue watcher options for the layers watcher (default: `immediate: true`; intentionally not deep — layers are shallow-compared, swap array/layer identity to update).
|
|
22
|
+
* @property {(loadMap: () => void) => void} [onMounted] - Defers map creation: called on mount with the create function instead of creating right away — call `loadMap()` when ready.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Options accepted by the deckGL `Map` component's `:options` prop and by `createMap`: the
|
|
26
|
+
* deck.gl `Deck` constructor props plus the wrapper keys.
|
|
27
|
+
* @typedef {import('@deck.gl/core').DeckProps & DeckGLMapWrapperOptions} DeckGLMapOptions
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Resolved map wrapper — `createMap`'s resolution and the `Map` component's `@loaded` payload:
|
|
31
|
+
* the raw `Deck` instance on `.map`, plus reactive watchers taking Vue refs.
|
|
32
|
+
*/
|
|
33
|
+
declare class DeckGLMap {
|
|
34
|
+
/**
|
|
35
|
+
* The raw deck.gl instance (e.g. `pickObject`, `redraw`); null until created and after unmount.
|
|
36
|
+
* @type {import('@deck.gl/core').Deck | null}
|
|
37
|
+
*/
|
|
38
|
+
map: import('@deck.gl/core').Deck | null;
|
|
39
|
+
watching: {
|
|
40
|
+
options: boolean;
|
|
41
|
+
layers: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Stop handles of the active watchers, called on unmount.
|
|
45
|
+
* @type {import('vue').WatchHandle[]}
|
|
46
|
+
*/
|
|
47
|
+
unwatchFn: import('vue').WatchHandle[];
|
|
48
|
+
constructor();
|
|
49
|
+
/**
|
|
50
|
+
* Keep the map's props in sync with the ref: re-applies its value through `Deck.setProps` on
|
|
51
|
+
* change (immediate + deep by default). One shot per wrapper: further calls warn and no-op.
|
|
52
|
+
* @param {import('vue').Ref<DeckGLMapOptions>} opts - Ref to the options bag applied to the map.
|
|
53
|
+
* @param {import('vue').WatchOptions} [options] - Overrides for the underlying Vue watcher.
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
watchOptions(opts: import('vue').Ref<DeckGLMapOptions>, options?: import('vue').WatchOptions): void;
|
|
57
|
+
/**
|
|
58
|
+
* Keep the map's `layers` prop in sync with the ref (immediate, NOT deep: layers are
|
|
59
|
+
* shallow-compared — swap array/layer identity to update). One shot per wrapper: further calls
|
|
60
|
+
* warn and no-op.
|
|
61
|
+
* @param {import('vue').Ref<import('@deck.gl/core').LayersList>} layers - Ref to the deck.gl layers array.
|
|
62
|
+
* @param {import('vue').WatchOptions} [options] - Overrides for the underlying Vue watcher.
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
watchLayers(layers: import('vue').Ref<import('@deck.gl/core').LayersList>, options?: import('vue').WatchOptions): void;
|
|
66
|
+
}
|
|
1
67
|
export default class DeckGL {
|
|
2
68
|
deckgl: {
|
|
3
69
|
Deck: typeof import("@deck.gl/core").Deck;
|
|
4
70
|
} | null;
|
|
5
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Memoized component definition (#139), see the `get Map` comment.
|
|
73
|
+
* @type {import('vue').Component | null}
|
|
74
|
+
*/
|
|
75
|
+
_MapComponent: import('vue').Component | null;
|
|
6
76
|
constructor();
|
|
7
|
-
|
|
77
|
+
/**
|
|
78
|
+
* The deckGL `Map` component. Props: `options` ({@link DeckGLMapOptions}, watched deep) and
|
|
79
|
+
* `layers` (deck.gl layers, shallow-compared). Emits `loaded` with the {@link DeckGLMap}
|
|
80
|
+
* wrapper, and `error`. Provides to descendants: `deckGLMap` (ShallowRef<DeckGLMap | null>,
|
|
81
|
+
* set once loaded), `deckGLPrependLayers` (ShallowRef<LayersList> — layers rendered UNDER the
|
|
82
|
+
* `layers` prop's, e.g. the google-maps DeckGL3DTileLayer's tiles) and `deckGLAppendVNodeFn`
|
|
83
|
+
* (Ref<Array<() => VNodeChild>> — vnode factories rendered after the map's div, e.g. a child's
|
|
84
|
+
* #appendMap credits slot).
|
|
85
|
+
* @returns {import('vue').Component} The map component definition.
|
|
86
|
+
*/
|
|
87
|
+
get Map(): import('vue').Component;
|
|
88
|
+
/**
|
|
89
|
+
* Lazy-load and memoize the deck.gl `Deck` class (one dynamic import per provider instance).
|
|
90
|
+
* @returns {Promise<void>}
|
|
91
|
+
*/
|
|
8
92
|
loadDeckGL(): Promise<void>;
|
|
9
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Imperative SDK entry — must run during a component's `setup()` (it registers the
|
|
95
|
+
* onMounted/onUnmounted hooks that create and destroy the map).
|
|
96
|
+
* @param {import('vue').Ref<HTMLElement | null>} elemRef - Template ref of the element the map renders into (becomes `Deck`'s `parent`).
|
|
97
|
+
* @param {DeckGLMapOptions} [options] - `Deck` constructor props plus the wrapper keys.
|
|
98
|
+
* @returns {Promise<DeckGLMap>} Resolves with the map wrapper once created; rejects with `error.code === 'MAP_UNMOUNTED'` when the component unmounts before the map loads (#148).
|
|
99
|
+
*/
|
|
100
|
+
createMap(elemRef: import('vue').Ref<HTMLElement | null>, options?: DeckGLMapOptions): Promise<DeckGLMap>;
|
|
10
101
|
}
|
|
102
|
+
export {};
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
export type DeckGLOverlayWrapperOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* - Vue watcher options for the options watcher (defaults: `immediate: true, deep: true`).
|
|
4
|
+
*/
|
|
5
|
+
watchOptionsOptions?: import('vue').WatchOptions;
|
|
6
|
+
/**
|
|
7
|
+
* - Vue watcher options for the layers watcher (default: `immediate: true`; intentionally not deep — layers are shallow-compared, swap array/layer identity to update).
|
|
8
|
+
*/
|
|
9
|
+
watchLayersOptions?: import('vue').WatchOptions;
|
|
10
|
+
};
|
|
11
|
+
export type DeckGLOverlayOptions = (import('@deck.gl/mapbox').MapboxOverlayProps | import('@deck.gl/google-maps').GoogleMapsOverlayProps) & DeckGLOverlayWrapperOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper-specific keys of the overlay options bag — every other key is handed verbatim to the
|
|
14
|
+
* provider overlay's constructor (and re-applied through `setProps` on change).
|
|
15
|
+
* @typedef {object} DeckGLOverlayWrapperOptions
|
|
16
|
+
* @property {import('vue').WatchOptions} [watchOptionsOptions] - Vue watcher options for the options watcher (defaults: `immediate: true, deep: true`).
|
|
17
|
+
* @property {import('vue').WatchOptions} [watchLayersOptions] - Vue watcher options for the layers watcher (default: `immediate: true`; intentionally not deep — layers are shallow-compared, swap array/layer identity to update).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Options accepted by the provider `DeckGLOverlay` components' `:options` prop and by
|
|
21
|
+
* `setDeckGLOverlay()`: the raw overlay's constructor props (`MapboxOverlayProps` on
|
|
22
|
+
* mapbox/maplibre maps, `GoogleMapsOverlayProps` on google maps) plus the wrapper keys.
|
|
23
|
+
* @typedef {(import('@deck.gl/mapbox').MapboxOverlayProps | import('@deck.gl/google-maps').GoogleMapsOverlayProps) & DeckGLOverlayWrapperOptions} DeckGLOverlayOptions
|
|
24
|
+
*/
|
|
1
25
|
/**
|
|
2
26
|
* Shared deck.gl overlay wiring (#174): the class and the component below used to be duplicated
|
|
3
27
|
* verbatim in Mapbox.js and GoogleMaps.js — every fix (#151, #156, #165) had to be applied twice.
|
|
@@ -5,25 +29,55 @@
|
|
|
5
29
|
* makeDeckGLOverlayComponent with their inject key.
|
|
6
30
|
*/
|
|
7
31
|
export declare class DeckGLOverlay {
|
|
8
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The raw deck.gl overlay (a @deck.gl/mapbox MapboxOverlay on mapbox/maplibre maps, a
|
|
34
|
+
* @deck.gl/google-maps GoogleMapsOverlay on google maps), attached by the provider subclass;
|
|
35
|
+
* null until then and after destroy.
|
|
36
|
+
* @type {import('@deck.gl/mapbox').MapboxOverlay | import('@deck.gl/google-maps').GoogleMapsOverlay | null}
|
|
37
|
+
*/
|
|
38
|
+
overlay: import('@deck.gl/mapbox').MapboxOverlay | import('@deck.gl/google-maps').GoogleMapsOverlay | null;
|
|
9
39
|
watching: {
|
|
10
40
|
options: boolean;
|
|
11
41
|
layers: boolean;
|
|
12
42
|
};
|
|
13
|
-
unwatchFn:
|
|
14
|
-
trackedIn:
|
|
43
|
+
unwatchFn: import("vue").WatchHandle[];
|
|
44
|
+
trackedIn: DeckGLOverlay[] | null;
|
|
45
|
+
/**
|
|
46
|
+
* Built by the provider's `setDeckGLOverlay()`, not by consumers directly.
|
|
47
|
+
* @param {object} config - Wiring handed over by the provider subclass.
|
|
48
|
+
* @param {import('vue').WatchHandle[]} config.unwatchFn - List collecting the overlay's watcher stop handles (all called and emptied on destroy).
|
|
49
|
+
* @param {DeckGLOverlay[] | null} [config.trackedIn] - The map wrapper's overlays list this instance is tracked in.
|
|
50
|
+
*/
|
|
15
51
|
constructor({ unwatchFn, trackedIn }: {
|
|
16
|
-
|
|
17
|
-
|
|
52
|
+
unwatchFn: import('vue').WatchHandle[];
|
|
53
|
+
trackedIn?: DeckGLOverlay[] | null;
|
|
18
54
|
});
|
|
19
55
|
/** Stop the watchers, leave the map's tracking list and detach the overlay from the map (#151).
|
|
20
56
|
* @returns {void}
|
|
21
57
|
*/
|
|
22
58
|
destroy(): void;
|
|
23
|
-
|
|
24
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Keep the overlay's props in sync with the ref: re-applies its value through `setProps` on
|
|
61
|
+
* change (immediate + deep by default). One shot per wrapper: further calls warn and no-op.
|
|
62
|
+
* @param {import('vue').Ref<DeckGLOverlayOptions>} opts - Ref to the options bag applied to the overlay.
|
|
63
|
+
* @param {import('vue').WatchOptions} [options] - Overrides for the underlying Vue watcher.
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
watchOptions(opts: import('vue').Ref<DeckGLOverlayOptions>, options?: import('vue').WatchOptions): void;
|
|
67
|
+
/**
|
|
68
|
+
* Keep the overlay's `layers` prop in sync with the ref (immediate, NOT deep: layers are
|
|
69
|
+
* shallow-compared — swap array/layer identity to update). One shot per wrapper: further calls
|
|
70
|
+
* warn and no-op.
|
|
71
|
+
* @param {import('vue').Ref<import('@deck.gl/core').LayersList>} layers - Ref to the deck.gl layers array.
|
|
72
|
+
* @param {import('vue').WatchOptions} [options] - Overrides for the underlying Vue watcher.
|
|
73
|
+
* @returns {void}
|
|
74
|
+
*/
|
|
75
|
+
watchLayers(layers: import('vue').Ref<import('@deck.gl/core').LayersList>, options?: import('vue').WatchOptions): void;
|
|
25
76
|
}
|
|
26
|
-
/** Build the provider's DeckGLOverlay component, bound to its injected map key (#174)
|
|
77
|
+
/** Build the provider's DeckGLOverlay component, bound to its injected map key (#174) — it must
|
|
78
|
+
* nest inside that provider's Map. Props: `options` ({@link DeckGLOverlayOptions}, watched deep)
|
|
79
|
+
* and `layers` (deck.gl layers, shallow-compared). Emits `loaded` with the {@link DeckGLOverlay}
|
|
80
|
+
* wrapper, and `error` (#194). Renders nothing itself.
|
|
27
81
|
* @param {string} mapInjectKey - The provide/inject key of the provider's map ref.
|
|
28
82
|
* @returns {import('vue').Component} The overlay component definition.
|
|
29
83
|
*/
|
|
@@ -1,41 +1,321 @@
|
|
|
1
|
+
import { DeckGLOverlay } from './DeckGLOverlay.js';
|
|
2
|
+
declare class GoogleMapsDeckGLOverlay extends DeckGLOverlay {
|
|
3
|
+
/** setMap(null) only detaches: finalize() is deck.gl's full GL-resource release (#156).
|
|
4
|
+
* @returns {void}
|
|
5
|
+
*/
|
|
6
|
+
_detach(): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 2D map wrapper, resolved by createMap and emitted by the Map component's `loaded` event. Its
|
|
10
|
+
* public surface is ONLY setDeckGLOverlay() and the raw `.map` — the Google 2D map has no
|
|
11
|
+
* watchOptions/watchLayers (imperative updates go through Google's own setters on `.map`).
|
|
12
|
+
*/
|
|
13
|
+
declare class GoogleMapsMap {
|
|
14
|
+
/** @type {object|null} The raw google.maps.Map (runtime-loaded API — untyped here). */
|
|
15
|
+
map: object | null;
|
|
16
|
+
/** @type {import('vue').WatchStopHandle[]} Stopped by createMap's unmount (#148/#165). */
|
|
17
|
+
unwatchFn: import('vue').WatchStopHandle[];
|
|
18
|
+
/** @type {GoogleMapsDeckGLOverlay[]} Overlays attached via setDeckGLOverlay. */
|
|
19
|
+
overlays: GoogleMapsDeckGLOverlay[];
|
|
20
|
+
constructor();
|
|
21
|
+
/** Create a deck.gl GoogleMapsOverlay (lazy-imported) and attach it to the map.
|
|
22
|
+
* @param {import('@deck.gl/google-maps').GoogleMapsOverlayProps} [options] - GoogleMapsOverlay constructor props (deck props plus `interleaved`).
|
|
23
|
+
* @returns {Promise<GoogleMapsDeckGLOverlay>} The overlay wrapper: watchOptions/watchLayers/destroy.
|
|
24
|
+
*/
|
|
25
|
+
setDeckGLOverlay(options?: import('@deck.gl/google-maps').GoogleMapsOverlayProps): Promise<GoogleMapsDeckGLOverlay>;
|
|
26
|
+
}
|
|
27
|
+
export type GoogleMapsMap3DLayer = {
|
|
28
|
+
/**
|
|
29
|
+
* - Unique layer id: written to the element's `name` attribute and used by the by-id diff.
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
/**
|
|
33
|
+
* - The layer's DOM element (a gmp-* Maps 3D element), inserted into the <gmp-map-3d> at its array position (array order = z-order).
|
|
34
|
+
*/
|
|
35
|
+
element: Element;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A Map3D layer entry (the Map3D component's `layers` items / watchLayers input): a pre-built
|
|
39
|
+
* layer element keyed for the by-id diff (#195).
|
|
40
|
+
* @typedef {object} GoogleMapsMap3DLayer
|
|
41
|
+
* @property {string} id - Unique layer id: written to the element's `name` attribute and used by the by-id diff.
|
|
42
|
+
* @property {Element} element - The layer's DOM element (a gmp-* Maps 3D element), inserted into the <gmp-map-3d> at its array position (array order = z-order).
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* 3D map wrapper, resolved by createMap3D and emitted by the Map3D component's `loaded` event,
|
|
46
|
+
* around the runtime-loaded <gmp-map-3d> Map3DElement.
|
|
47
|
+
*/
|
|
48
|
+
declare class GoogleMapsMap3D {
|
|
49
|
+
/** @type {HTMLElement|null} The <gmp-map-3d> Map3DElement — a DOM element whose Maps-specific API is runtime-loaded and untyped here. */
|
|
50
|
+
map: HTMLElement | null;
|
|
51
|
+
watching: {
|
|
52
|
+
options: boolean;
|
|
53
|
+
layers: boolean;
|
|
54
|
+
};
|
|
55
|
+
/** @type {import('vue').WatchStopHandle[]} Stopped by createMap3D's unmount (#148/#165). */
|
|
56
|
+
unwatchFn: import('vue').WatchStopHandle[];
|
|
57
|
+
constructor();
|
|
58
|
+
/** Collect the element's Web IDL attribute names: enumerable ACCESSOR descriptors on its prototype.
|
|
59
|
+
* @param {object} obj - The element (or nested element state) to inspect.
|
|
60
|
+
* @returns {string[]} The accessor property names.
|
|
61
|
+
*/
|
|
62
|
+
_getSetters(obj: object): string[];
|
|
63
|
+
/** Snapshot the element's Web IDL attributes into a plain options object.
|
|
64
|
+
* @param {object} obj - The element (or nested element state) to snapshot.
|
|
65
|
+
* @param {WeakSet<object>} [seen] - Guards accessor cycles across the recursion.
|
|
66
|
+
* @returns {Record<string, any>} Attribute name → current value (nested element state recursed into plain objects).
|
|
67
|
+
*/
|
|
68
|
+
_getOptions(obj: object, seen?: WeakSet<object>): Record<string, any>;
|
|
69
|
+
/** Assign a bag of Map3DElement attributes — the imperative sibling of watchOptions.
|
|
70
|
+
* @param {Record<string, any>} [props] - Attribute name → value, assigned onto the element (runtime-loaded API — untyped here).
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
setProps(props?: Record<string, any>): void;
|
|
74
|
+
/** Snapshot the map's current Web IDL attributes — the imperative sibling of getProps-less reads.
|
|
75
|
+
* @returns {Record<string, any>} Attribute name → current value.
|
|
76
|
+
*/
|
|
77
|
+
getProps(): Record<string, any>;
|
|
78
|
+
/** Get a layer element added under the <gmp-map-3d> by its id (the element's `name` attribute).
|
|
79
|
+
* @param {string} id - The layer id.
|
|
80
|
+
* @returns {Element|null} The layer's element, or null when absent.
|
|
81
|
+
*/
|
|
82
|
+
getLayer(id: string): Element | null;
|
|
83
|
+
/** Keep the Map3DElement in sync with a reactive options object (per-key JSON diff). One
|
|
84
|
+
* watcher per wrapper: further calls warn and return.
|
|
85
|
+
* @param {import('vue').Ref<Record<string, any>>} opts - Reactive options bag; every changed key is assigned onto the element.
|
|
86
|
+
* @param {import('vue').WatchOptions} [options] - Extra vue watch options, merged over `{ immediate: true, deep: true }`.
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
watchOptions(opts: import('vue').Ref<Record<string, any>>, options?: import('vue').WatchOptions): void;
|
|
90
|
+
/** Keep the <gmp-map-3d> children in sync with a reactive layers array: by-id diff (#195),
|
|
91
|
+
* array order = z-order via insertBefore. One watcher per wrapper: further calls warn and return.
|
|
92
|
+
* @param {import('vue').Ref<GoogleMapsMap3DLayer[]>} layers - Reactive layers; shallow-compared — swap array/layer identity (shallowRef) to update.
|
|
93
|
+
* @param {import('vue').WatchOptions} [options] - Extra vue watch options, merged over `{ immediate: true }`.
|
|
94
|
+
* @returns {void}
|
|
95
|
+
*/
|
|
96
|
+
watchLayers(layers: import('vue').Ref<GoogleMapsMap3DLayer[]>, options?: import('vue').WatchOptions): void;
|
|
97
|
+
}
|
|
98
|
+
export type GoogleMapsMountHook = {
|
|
99
|
+
/**
|
|
100
|
+
* - Defers map creation: called at component mount with `loadMap` instead of an immediate load — the map exists only once you invoke it.
|
|
101
|
+
*/
|
|
102
|
+
onMounted?: (loadMap: () => void) => void;
|
|
103
|
+
};
|
|
104
|
+
export type GoogleMapsMapOptions = GoogleMapsMountHook & Record<string, any>;
|
|
105
|
+
export type GoogleMapsWatcherOptions = {
|
|
106
|
+
/**
|
|
107
|
+
* - Vue watch options for the internal options watcher.
|
|
108
|
+
*/
|
|
109
|
+
watchOptionsOptions?: import('vue').WatchOptions;
|
|
110
|
+
/**
|
|
111
|
+
* - Vue watch options for the internal layers watcher.
|
|
112
|
+
*/
|
|
113
|
+
watchLayersOptions?: import('vue').WatchOptions;
|
|
114
|
+
};
|
|
115
|
+
export type GoogleMapsMap3DOptions = GoogleMapsMountHook & GoogleMapsWatcherOptions & Record<string, any>;
|
|
116
|
+
export type GoogleMapsMapProps = {
|
|
117
|
+
/**
|
|
118
|
+
* - Passed once to google.maps.Map — NOT reactive (an update logs an error; drive the loaded wrapper's `.map` through Google's own setters instead).
|
|
119
|
+
*/
|
|
120
|
+
options?: GoogleMapsMapOptions;
|
|
121
|
+
};
|
|
122
|
+
export type GoogleMapsMap3DProps = {
|
|
123
|
+
/**
|
|
124
|
+
* - Watched (per-key JSON diff) and assigned onto the Map3DElement.
|
|
125
|
+
*/
|
|
126
|
+
options?: GoogleMapsMap3DOptions;
|
|
127
|
+
/**
|
|
128
|
+
* - Watched with a by-id diff (#195); shallow-compared — swap array/layer identity (shallowRef) to update.
|
|
129
|
+
*/
|
|
130
|
+
layers?: GoogleMapsMap3DLayer[];
|
|
131
|
+
};
|
|
132
|
+
export type GoogleMapsDeckGLOverlayProps = {
|
|
133
|
+
/**
|
|
134
|
+
* - GoogleMapsOverlay props, watched deep → overlay.setProps().
|
|
135
|
+
*/
|
|
136
|
+
options?: import('@deck.gl/google-maps').GoogleMapsOverlayProps & GoogleMapsWatcherOptions;
|
|
137
|
+
/**
|
|
138
|
+
* - deck.gl layers, watched → setProps({ layers }); shallow-compared — swap identity to update.
|
|
139
|
+
*/
|
|
140
|
+
layers?: import('@deck.gl/core').LayersList;
|
|
141
|
+
};
|
|
142
|
+
export type GoogleMapsDeckGL3DTileLayerProps = {
|
|
143
|
+
/**
|
|
144
|
+
* - Tile3DLayer prop overrides (over the Google 3D Tiles defaults) — NOT reactive: replace the component to change them.
|
|
145
|
+
*/
|
|
146
|
+
options?: Partial<import('@deck.gl/geo-layers').Tile3DLayerProps>;
|
|
147
|
+
};
|
|
148
|
+
export type GoogleMapsMapComponent = import('vue').DefineSetupFnComponent<GoogleMapsMapProps, {
|
|
149
|
+
loaded: (map: GoogleMapsMap) => void;
|
|
150
|
+
error: (error: Error) => void;
|
|
151
|
+
}>;
|
|
152
|
+
export type GoogleMapsMap3DComponent = import('vue').DefineSetupFnComponent<GoogleMapsMap3DProps, {
|
|
153
|
+
loaded: (map: GoogleMapsMap3D) => void;
|
|
154
|
+
error: (error: Error) => void;
|
|
155
|
+
}>;
|
|
156
|
+
export type GoogleMapsDeckGLOverlayComponent = import('vue').DefineSetupFnComponent<GoogleMapsDeckGLOverlayProps, {
|
|
157
|
+
loaded: (overlay: GoogleMapsDeckGLOverlay) => void;
|
|
158
|
+
error: (error: Error) => void;
|
|
159
|
+
}>;
|
|
160
|
+
export type GoogleMapsDeckGL3DTileLayerComponent = import('vue').DefineSetupFnComponent<GoogleMapsDeckGL3DTileLayerProps, {
|
|
161
|
+
error: (error: Error) => void;
|
|
162
|
+
}, import('vue').SlotsType<{
|
|
163
|
+
appendMap?: {
|
|
164
|
+
credits: string;
|
|
165
|
+
};
|
|
166
|
+
}>>;
|
|
167
|
+
/**
|
|
168
|
+
* Module-side mount hook recognised by createMap/createMap3D (every other option key is forwarded
|
|
169
|
+
* to Google untouched).
|
|
170
|
+
* @typedef {object} GoogleMapsMountHook
|
|
171
|
+
* @property {(loadMap: () => void) => void} [onMounted] - Defers map creation: called at component mount with `loadMap` instead of an immediate load — the map exists only once you invoke it.
|
|
172
|
+
*/
|
|
173
|
+
/**
|
|
174
|
+
* Options for createMap / the 2D Map component's `options` prop: google.maps.MapOptions
|
|
175
|
+
* (runtime-loaded API — untyped here: center/zoom/mapId/…) plus {@link GoogleMapsMountHook}.
|
|
176
|
+
* @typedef {GoogleMapsMountHook & Record<string, any>} GoogleMapsMapOptions
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* Per-watcher tuning read by the Map3D and DeckGLOverlay components from their `options` prop.
|
|
180
|
+
* @typedef {object} GoogleMapsWatcherOptions
|
|
181
|
+
* @property {import('vue').WatchOptions} [watchOptionsOptions] - Vue watch options for the internal options watcher.
|
|
182
|
+
* @property {import('vue').WatchOptions} [watchLayersOptions] - Vue watch options for the internal layers watcher.
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* Options for createMap3D / the Map3D component's `options` prop: Map3DElement attributes
|
|
186
|
+
* (runtime-loaded API — untyped here: center/range/tilt/…) plus the module-side keys.
|
|
187
|
+
* @typedef {GoogleMapsMountHook & GoogleMapsWatcherOptions & Record<string, any>} GoogleMapsMap3DOptions
|
|
188
|
+
*/
|
|
189
|
+
/**
|
|
190
|
+
* Props of the 2D Map component. NO `layers` prop: deck.gl layers on a Google 2D map go through
|
|
191
|
+
* DeckGLOverlay only.
|
|
192
|
+
* @typedef {object} GoogleMapsMapProps
|
|
193
|
+
* @property {GoogleMapsMapOptions} [options] - Passed once to google.maps.Map — NOT reactive (an update logs an error; drive the loaded wrapper's `.map` through Google's own setters instead).
|
|
194
|
+
*/
|
|
195
|
+
/**
|
|
196
|
+
* Props of the Map3D component.
|
|
197
|
+
* @typedef {object} GoogleMapsMap3DProps
|
|
198
|
+
* @property {GoogleMapsMap3DOptions} [options] - Watched (per-key JSON diff) and assigned onto the Map3DElement.
|
|
199
|
+
* @property {GoogleMapsMap3DLayer[]} [layers] - Watched with a by-id diff (#195); shallow-compared — swap array/layer identity (shallowRef) to update.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* Props of the DeckGLOverlay component (nests inside the 2D Map).
|
|
203
|
+
* @typedef {object} GoogleMapsDeckGLOverlayProps
|
|
204
|
+
* @property {import('@deck.gl/google-maps').GoogleMapsOverlayProps & GoogleMapsWatcherOptions} [options] - GoogleMapsOverlay props, watched deep → overlay.setProps().
|
|
205
|
+
* @property {import('@deck.gl/core').LayersList} [layers] - deck.gl layers, watched → setProps({ layers }); shallow-compared — swap identity to update.
|
|
206
|
+
*/
|
|
207
|
+
/**
|
|
208
|
+
* Props of the DeckGL3DTileLayer component (nests inside the deckGL provider's Map).
|
|
209
|
+
* @typedef {object} GoogleMapsDeckGL3DTileLayerProps
|
|
210
|
+
* @property {Partial<import('@deck.gl/geo-layers').Tile3DLayerProps>} [options] - Tile3DLayer prop overrides (over the Google 3D Tiles defaults) — NOT reactive: replace the component to change them.
|
|
211
|
+
*/
|
|
212
|
+
/**
|
|
213
|
+
* The 2D Map component type: `loaded` emits the {@link GoogleMapsMap} wrapper, `error` every load failure (#148/#378).
|
|
214
|
+
* @typedef {import('vue').DefineSetupFnComponent<GoogleMapsMapProps, { loaded: (map: GoogleMapsMap) => void, error: (error: Error) => void }>} GoogleMapsMapComponent
|
|
215
|
+
*/
|
|
216
|
+
/**
|
|
217
|
+
* The Map3D component type: `loaded` emits the {@link GoogleMapsMap3D} wrapper, `error` every load failure (#148/#378).
|
|
218
|
+
* @typedef {import('vue').DefineSetupFnComponent<GoogleMapsMap3DProps, { loaded: (map: GoogleMapsMap3D) => void, error: (error: Error) => void }>} GoogleMapsMap3DComponent
|
|
219
|
+
*/
|
|
220
|
+
/**
|
|
221
|
+
* The DeckGLOverlay component type: `loaded` emits the {@link GoogleMapsDeckGLOverlay} wrapper, `error` every load failure (#194).
|
|
222
|
+
* @typedef {import('vue').DefineSetupFnComponent<GoogleMapsDeckGLOverlayProps, { loaded: (overlay: GoogleMapsDeckGLOverlay) => void, error: (error: Error) => void }>} GoogleMapsDeckGLOverlayComponent
|
|
223
|
+
*/
|
|
224
|
+
/**
|
|
225
|
+
* The DeckGL3DTileLayer component type: `error` on load failure (#194); the #appendMap slot
|
|
226
|
+
* receives `{ credits }` — Google's 3D Tiles attribution, which must stay visible.
|
|
227
|
+
* @typedef {import('vue').DefineSetupFnComponent<GoogleMapsDeckGL3DTileLayerProps, { error: (error: Error) => void }, import('vue').SlotsType<{ appendMap?: { credits: string } }>>} GoogleMapsDeckGL3DTileLayerComponent
|
|
228
|
+
*/
|
|
229
|
+
/**
|
|
230
|
+
* Google Maps provider: one instance per `maps` config entry with `type: 'google'`/`'google-maps'`,
|
|
231
|
+
* exposed as `yAppKit.maps.<key>` — Vue components (Map, Map3D, DeckGLOverlay, DeckGL3DTileLayer)
|
|
232
|
+
* plus the imperative SDK (getSDK, createMap, createMap3D, createDeckGL3DTileLayer).
|
|
233
|
+
*/
|
|
1
234
|
export default class GoogleMaps {
|
|
2
|
-
apiKey:
|
|
3
|
-
libraries:
|
|
4
|
-
version:
|
|
235
|
+
apiKey: string;
|
|
236
|
+
libraries: string[];
|
|
237
|
+
version: string;
|
|
5
238
|
_mapsApiConfigured: boolean;
|
|
6
239
|
authFailed: boolean;
|
|
7
|
-
|
|
240
|
+
/** @type {Record<string, object>} Loaded google library namespaces by name (runtime-loaded API — untyped here), filled by getSDK. */
|
|
241
|
+
sdk: Record<string, object>;
|
|
8
242
|
deckgl: {
|
|
9
243
|
Tile3DLayer: typeof import("@deck.gl/geo-layers").Tile3DLayer;
|
|
10
244
|
} | null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
245
|
+
/** @type {GoogleMapsMapComponent|null} 2D Map memo. */
|
|
246
|
+
_MapComponent: GoogleMapsMapComponent | null;
|
|
247
|
+
/** @type {GoogleMapsMap3DComponent|null} Map3D memo. */
|
|
248
|
+
_Map3DComponent: GoogleMapsMap3DComponent | null;
|
|
249
|
+
/** @type {GoogleMapsDeckGLOverlayComponent|null} DeckGLOverlay memo. */
|
|
250
|
+
_DeckGLOverlayComponent: GoogleMapsDeckGLOverlayComponent | null;
|
|
251
|
+
/** @type {GoogleMapsDeckGL3DTileLayerComponent|null} DeckGL3DTileLayer memo. */
|
|
252
|
+
_DeckGL3DTileLayerComponent: GoogleMapsDeckGL3DTileLayerComponent | null;
|
|
253
|
+
/** @type {Promise<Record<string, object>>} The initial libraries preload: resolves with the `sdk` map, rejects like getSDK(). */
|
|
254
|
+
ready: Promise<Record<string, object>>;
|
|
255
|
+
/** Validates the config and starts the SDK preload (`this.ready`, #149).
|
|
256
|
+
* @param {import('../main.js').GoogleMapsConfig} mapConfig - The provider's `maps` config entry (apiKey/libraries/version; `type` is consumed by the module loader).
|
|
257
|
+
*/
|
|
258
|
+
constructor(mapConfig: import('../main.js').GoogleMapsConfig);
|
|
259
|
+
/** The 2D Map component (memoized per provider instance, #139): `options` prop only — nest
|
|
260
|
+
* DeckGLOverlay inside for deck.gl layers; `@loaded` emits the {@link GoogleMapsMap} wrapper.
|
|
261
|
+
* @returns {GoogleMapsMapComponent} The memoized component definition.
|
|
262
|
+
*/
|
|
263
|
+
get Map(): GoogleMapsMapComponent;
|
|
264
|
+
/** The Map3D component (memoized, #139): `options` + `layers` props, both watched; `@loaded`
|
|
265
|
+
* emits the {@link GoogleMapsMap3D} wrapper.
|
|
266
|
+
* @returns {GoogleMapsMap3DComponent} The memoized component definition.
|
|
267
|
+
*/
|
|
268
|
+
get Map3D(): GoogleMapsMap3DComponent;
|
|
269
|
+
/** The DeckGLOverlay component (memoized, #139; shared wiring #174): nests inside the 2D Map;
|
|
270
|
+
* `options`/`layers` props, `@loaded` emits the {@link GoogleMapsDeckGLOverlay} wrapper.
|
|
271
|
+
* @returns {GoogleMapsDeckGLOverlayComponent} The memoized component definition.
|
|
272
|
+
*/
|
|
273
|
+
get DeckGLOverlay(): GoogleMapsDeckGLOverlayComponent;
|
|
274
|
+
/** The DeckGL3DTileLayer component (memoized, #139): nests inside the deckGL provider's Map and
|
|
275
|
+
* prepends the Google 3D Tiles layer; its #appendMap slot receives `{ credits }` (attribution
|
|
276
|
+
* that must stay visible).
|
|
277
|
+
* @returns {GoogleMapsDeckGL3DTileLayerComponent} The memoized component definition.
|
|
278
|
+
*/
|
|
279
|
+
get DeckGL3DTileLayer(): GoogleMapsDeckGL3DTileLayerComponent;
|
|
280
|
+
/** Configure the js-api-loader once (page-level, #188) and import every wanted library into
|
|
281
|
+
* `this.sdk` (already-loaded ones are reused).
|
|
282
|
+
* @param {object} [options] - Load options.
|
|
283
|
+
* @param {string[]} [options.libraries] - Extra libraries to load on top of the config's.
|
|
284
|
+
* @returns {Promise<void>} Resolves once every wanted library is in `this.sdk`.
|
|
285
|
+
*/
|
|
21
286
|
loadGoogleMapsSDK({ libraries }?: {
|
|
22
|
-
libraries?:
|
|
287
|
+
libraries?: string[];
|
|
23
288
|
}): Promise<void>;
|
|
24
|
-
getSDK(options:
|
|
25
|
-
|
|
26
|
-
|
|
289
|
+
getSDK(options: string): Promise<object>;
|
|
290
|
+
getSDK(options?: {
|
|
291
|
+
libraries?: string[];
|
|
292
|
+
}): Promise<Record<string, object>>;
|
|
293
|
+
/** Create a google.maps.Map into `elemRef` and resolve with its wrapper. Must run during a
|
|
294
|
+
* component's setup(): it registers onMounted/onUnmounted (teardown, #148/#156).
|
|
295
|
+
* @param {import('vue').Ref<HTMLElement|null>} elemRef - Template ref of the map's container element.
|
|
296
|
+
* @param {GoogleMapsMapOptions} [options] - google.maps.MapOptions plus the module's mount hook.
|
|
297
|
+
* @returns {Promise<GoogleMapsMap>} The 2D wrapper (setDeckGLOverlay/.map); rejects on unmount-before-load (error.code 'MAP_UNMOUNTED'), SDK failure, or page-level auth failure (#378).
|
|
298
|
+
*/
|
|
299
|
+
createMap(elemRef: import('vue').Ref<HTMLElement | null>, options?: GoogleMapsMapOptions): Promise<GoogleMapsMap>;
|
|
300
|
+
/** Create a <gmp-map-3d> Map3DElement into `elemRef` and resolve with its wrapper. Must run
|
|
301
|
+
* during a component's setup(): it registers onMounted/onUnmounted (teardown, #148/#156).
|
|
302
|
+
* Requires the 'maps3d' library — `version: 'alpha'` plus a pre-authorized key.
|
|
303
|
+
* @param {import('vue').Ref<HTMLElement|null>} elemRef - Template ref of the map's container element.
|
|
304
|
+
* @param {GoogleMapsMap3DOptions} [options] - Map3DElement attributes plus the module-side keys.
|
|
305
|
+
* @returns {Promise<GoogleMapsMap3D>} The 3D wrapper (watchOptions/watchLayers/setProps/…); rejects on unmount-before-load (error.code 'MAP_UNMOUNTED'), SDK failure, or page-level auth failure (#378).
|
|
306
|
+
*/
|
|
307
|
+
createMap3D(elemRef: import('vue').Ref<HTMLElement | null>, options?: GoogleMapsMap3DOptions): Promise<GoogleMapsMap3D>;
|
|
308
|
+
/** Lazy-import Tile3DLayer into `this.deckgl`.
|
|
309
|
+
* @returns {Promise<void>} Resolves once Tile3DLayer is available.
|
|
310
|
+
*/
|
|
27
311
|
loadDeckGL(): Promise<void>;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
onTilesetLoad: (tileset3d: import("@loaders.gl/tiles").Tileset3D) => void;
|
|
39
|
-
operation: "terrain+draw";
|
|
40
|
-
}>>;
|
|
312
|
+
/** Build a Tile3DLayer preconfigured for Google's photorealistic 3D Tiles (keyed with this
|
|
313
|
+
* provider's apiKey), wiring the tileset copyrights into `credits` — Google's terms require
|
|
314
|
+
* showing them (the DeckGL3DTileLayer component's #appendMap slot).
|
|
315
|
+
* @param {import('vue').Ref<string>} credits - Written on every tileset traversal with the '; '-joined copyrights (#328).
|
|
316
|
+
* @param {Partial<import('@deck.gl/geo-layers').Tile3DLayerProps>} [options] - Tile3DLayer prop overrides; a consumer `onTilesetLoad` is composed after the credits wiring, not clobbering it (#391).
|
|
317
|
+
* @returns {Promise<import('@deck.gl/geo-layers').Tile3DLayer>} The layer, for the deckGL provider Map's `layers`.
|
|
318
|
+
*/
|
|
319
|
+
createDeckGL3DTileLayer(credits: import('vue').Ref<string>, options?: Partial<import('@deck.gl/geo-layers').Tile3DLayerProps>): Promise<import('@deck.gl/geo-layers').Tile3DLayer>;
|
|
41
320
|
}
|
|
321
|
+
export {};
|
|
@@ -1,114 +1,210 @@
|
|
|
1
|
+
import { DeckGLOverlay } from './DeckGLOverlay.js';
|
|
2
|
+
/** Shared wiring lives in DeckGLOverlay.js (#174); only the detach mode is provider-specific. */
|
|
3
|
+
declare class MapboxDeckGLOverlay extends DeckGLOverlay {
|
|
4
|
+
/** @type {import('mapbox-gl').Map|import('maplibre-gl').Map|null} The host map; released by destroy (#284). */
|
|
5
|
+
map: import('mapbox-gl').Map | import('maplibre-gl').Map | null;
|
|
6
|
+
/** Wire the shared overlay state and keep the host map for `_detach` (#151).
|
|
7
|
+
* @param {object} args - Constructor args.
|
|
8
|
+
* @param {import('vue').WatchStopHandle[]} args.unwatchFn - The overlay's own watcher stop handles (#151).
|
|
9
|
+
* @param {import('mapbox-gl').Map|import('maplibre-gl').Map} args.map - The host map (maplibre-gl's on the Maplibre provider).
|
|
10
|
+
* @param {MapboxDeckGLOverlay[]} [args.trackedIn] - The owning map wrapper's overlays list (#156).
|
|
11
|
+
*/
|
|
12
|
+
constructor({ unwatchFn, map, trackedIn }: {
|
|
13
|
+
unwatchFn: import('vue').WatchStopHandle[];
|
|
14
|
+
map: import('mapbox-gl').Map | import('maplibre-gl').Map;
|
|
15
|
+
trackedIn?: MapboxDeckGLOverlay[];
|
|
16
|
+
});
|
|
17
|
+
/** mapbox-gl's removeControl triggers MapboxOverlay's onRemove, which finalizes the
|
|
18
|
+
* underlying deck instance (#151).
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*/
|
|
21
|
+
_detach(): void;
|
|
22
|
+
/** Release the provider-specific Map reference after the base cleanup: a destroyed wrapper still
|
|
23
|
+
* held by the consumer (setDeckGLOverlay return, @loaded payload) retained the whole mapbox-gl
|
|
24
|
+
* Map graph — the base destroy only clears what IT owns (#212 covered the list→wrapper side). (#284)
|
|
25
|
+
* @returns {void}
|
|
26
|
+
*/
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
29
|
+
export type MapSourceDef = (Parameters<import('mapbox-gl').Map['addSource']>[1] | Parameters<import('maplibre-gl').Map['addSource']>[1]) & {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
export type MapLayerDef = Parameters<import('mapbox-gl').Map['addLayer']>[0] | Parameters<import('maplibre-gl').Map['addLayer']>[0];
|
|
33
|
+
/**
|
|
34
|
+
* One entry of the `sources` array/prop: whatever the underlying map's `addSource` accepts (a source
|
|
35
|
+
* specification — GeoJSON, vector, raster… — or a custom source), plus the `id` the wrapper diffs by (#143).
|
|
36
|
+
* @typedef {(Parameters<import('mapbox-gl').Map['addSource']>[1]|Parameters<import('maplibre-gl').Map['addSource']>[1]) & { id: string }} MapSourceDef
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* One entry of the `layers` array/prop: whatever the underlying map's `addLayer` accepts — a layer
|
|
40
|
+
* specification (whose `source` may be an inline source object, see the #9135 workaround in
|
|
41
|
+
* watchLayers) or a custom layer.
|
|
42
|
+
* @typedef {Parameters<import('mapbox-gl').Map['addLayer']>[0]|Parameters<import('maplibre-gl').Map['addLayer']>[0]} MapLayerDef
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* The resolved map wrapper: the raw map on `.map`, the reactive watchers, and setDeckGLOverlay.
|
|
46
|
+
* Shared by the Mapbox and Maplibre providers (createMap is not overridden, #154).
|
|
47
|
+
*/
|
|
48
|
+
declare class MapboxMap {
|
|
49
|
+
/** @type {import('mapbox-gl').Map|import('maplibre-gl').Map|null} The raw underlying map (maplibre-gl's on the Maplibre provider), set by createMap. */
|
|
50
|
+
map: import('mapbox-gl').Map | import('maplibre-gl').Map | null;
|
|
51
|
+
watching: {
|
|
52
|
+
sources: boolean;
|
|
53
|
+
layers: boolean;
|
|
54
|
+
};
|
|
55
|
+
/** @type {import('vue').WatchStopHandle[]} Stop handles of every watcher owned by the map, run on unmount. */
|
|
56
|
+
unwatchFn: import('vue').WatchStopHandle[];
|
|
57
|
+
/** @type {MapboxDeckGLOverlay[]} */
|
|
58
|
+
overlays: MapboxDeckGLOverlay[];
|
|
59
|
+
/** @type {WeakMap<object, string>} */
|
|
60
|
+
_propsIds: WeakMap<object, string>;
|
|
61
|
+
constructor();
|
|
62
|
+
/** Signature of a source's non-data props, cached per object identity (#158).
|
|
63
|
+
* @param {MapSourceDef} source - A source object from the `sources` prop.
|
|
64
|
+
* @returns {string} The JSON signature of the source without its `data`.
|
|
65
|
+
*/
|
|
66
|
+
_propsIdOf(source: MapSourceDef): string;
|
|
67
|
+
/** Keep the map's sources in sync with the reactive array, diffed by source id (#143): sources are
|
|
68
|
+
* shallow-compared — swap array/object identity to update — except a data-only change (same
|
|
69
|
+
* propsId), applied in place through setData.
|
|
70
|
+
* @template {MapSourceDef[]|undefined} T
|
|
71
|
+
* @param {import('vue').Ref<T>} sources - The reactive sources array.
|
|
72
|
+
* @param {import('vue').WatchOptions} [options] - Extra vue watch options, merged over `{ immediate: true }`.
|
|
73
|
+
* @returns {void}
|
|
74
|
+
*/
|
|
75
|
+
watchSources<T extends MapSourceDef[] | undefined>(sources: import('vue').Ref<T>, options?: import('vue').WatchOptions): void;
|
|
76
|
+
/** Keep the map's layers in sync with the reactive array, diffed by layer id (#144): layers are
|
|
77
|
+
* shallow-compared — swap array/layer identity to update; added/changed layers land at their array
|
|
78
|
+
* position in the z-order (#301).
|
|
79
|
+
* @template {MapLayerDef[]|undefined} T
|
|
80
|
+
* @param {import('vue').Ref<T>} layers - The reactive layers array.
|
|
81
|
+
* @param {import('vue').WatchOptions} [options] - Extra vue watch options, merged over `{ immediate: true }`.
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
watchLayers<T extends MapLayerDef[] | undefined>(layers: import('vue').Ref<T>, options?: import('vue').WatchOptions): void;
|
|
85
|
+
/** Attach a deck.gl overlay (lazy-loaded MapboxOverlay) to the map.
|
|
86
|
+
* @param {import('@deck.gl/mapbox').MapboxOverlayProps} [options] - The overlay's constructor props (deck.gl layers, interleaved, …).
|
|
87
|
+
* @returns {Promise<MapboxDeckGLOverlay>} The overlay wrapper: its own watchOptions/watchLayers/destroy.
|
|
88
|
+
*/
|
|
89
|
+
setDeckGLOverlay(options?: import('@deck.gl/mapbox').MapboxOverlayProps): Promise<MapboxDeckGLOverlay>;
|
|
90
|
+
}
|
|
91
|
+
export type MapboxServiceName = NonNullable<import('../main.js').MapboxConfig['services']>[number];
|
|
92
|
+
export type MapboxMapExtraOptions = {
|
|
93
|
+
/**
|
|
94
|
+
* - Take over map creation timing: receives the
|
|
95
|
+
* `loadMap` thunk and decides when to call it.
|
|
96
|
+
*/
|
|
97
|
+
onMounted?: (loadMap: () => void) => void;
|
|
98
|
+
/**
|
|
99
|
+
* - Vue watch options for the component's sources watcher.
|
|
100
|
+
*/
|
|
101
|
+
watchSourcesOptions?: import('vue').WatchOptions;
|
|
102
|
+
/**
|
|
103
|
+
* - Vue watch options for the component's layers watcher.
|
|
104
|
+
*/
|
|
105
|
+
watchLayersOptions?: import('vue').WatchOptions;
|
|
106
|
+
};
|
|
107
|
+
export type MapboxMapOptions = Omit<import('mapbox-gl').MapOptions, 'container'> & MapboxMapExtraOptions;
|
|
108
|
+
/**
|
|
109
|
+
* A Mapbox REST SDK service name (the keys of `servicesLoader`).
|
|
110
|
+
* @typedef {NonNullable<import('../main.js').MapboxConfig['services']>[number]} MapboxServiceName
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* Wrapper-specific options riding along the map constructor options.
|
|
114
|
+
* @typedef {object} MapboxMapExtraOptions
|
|
115
|
+
* @property {(loadMap: () => void) => void} [onMounted] - Take over map creation timing: receives the
|
|
116
|
+
* `loadMap` thunk and decides when to call it.
|
|
117
|
+
* @property {import('vue').WatchOptions} [watchSourcesOptions] - Vue watch options for the component's sources watcher.
|
|
118
|
+
* @property {import('vue').WatchOptions} [watchLayersOptions] - Vue watch options for the component's layers watcher.
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* Options of the Mapbox `Map` component / `createMap`: mapbox-gl's `MapOptions` minus `container`
|
|
122
|
+
* (the component's element / `elemRef` provides it) — `accessToken` defaults to the config `apiKey` —
|
|
123
|
+
* plus the wrapper extras.
|
|
124
|
+
* @typedef {Omit<import('mapbox-gl').MapOptions, 'container'> & MapboxMapExtraOptions} MapboxMapOptions
|
|
125
|
+
*/
|
|
126
|
+
/** Mapbox provider (`type: 'mapbox'`): the `Map`/`DeckGLOverlay` components, `createMap` and the REST SDK. */
|
|
1
127
|
export default class Mapbox {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
LngLat: typeof import("mapbox-gl/esm").LngLat;
|
|
20
|
-
LngLatBounds: typeof import("mapbox-gl/esm").LngLatBounds;
|
|
21
|
-
Map: typeof import("mapbox-gl/esm").Map;
|
|
22
|
-
MapMouseEvent: typeof import("mapbox-gl/esm").MapMouseEvent;
|
|
23
|
-
MapTouchEvent: typeof import("mapbox-gl/esm").MapTouchEvent;
|
|
24
|
-
MapWheelEvent: typeof import("mapbox-gl/esm").MapWheelEvent;
|
|
25
|
-
Marker: typeof import("mapbox-gl/esm").Marker;
|
|
26
|
-
MercatorCoordinate: typeof import("mapbox-gl/esm").MercatorCoordinate;
|
|
27
|
-
ModelSource: typeof import("mapbox-gl/esm").ModelSource;
|
|
28
|
-
NavigationControl: typeof import("mapbox-gl/esm").NavigationControl;
|
|
29
|
-
Point: typeof import("mapbox-gl/esm").Point;
|
|
30
|
-
Popup: typeof import("mapbox-gl/esm").Popup;
|
|
31
|
-
RasterArrayTileSource: typeof import("mapbox-gl/esm").RasterArrayTileSource;
|
|
32
|
-
RasterDemTileSource: typeof import("mapbox-gl/esm").RasterDemTileSource;
|
|
33
|
-
RasterTileSource: typeof import("mapbox-gl/esm").RasterTileSource;
|
|
34
|
-
ResourceType: {
|
|
35
|
-
readonly Unknown: "Unknown";
|
|
36
|
-
readonly Style: "Style";
|
|
37
|
-
readonly Source: "Source";
|
|
38
|
-
readonly Tile: "Tile";
|
|
39
|
-
readonly Glyphs: "Glyphs";
|
|
40
|
-
readonly SpriteImage: "SpriteImage";
|
|
41
|
-
readonly SpriteJSON: "SpriteJSON";
|
|
42
|
-
readonly Iconset: "Iconset";
|
|
43
|
-
readonly Image: "Image";
|
|
44
|
-
readonly Model: "Model";
|
|
45
|
-
};
|
|
46
|
-
ScaleControl: typeof import("mapbox-gl/esm").ScaleControl;
|
|
47
|
-
Style: typeof import("mapbox-gl/esm").Style;
|
|
48
|
-
TargetFeature: typeof import("mapbox-gl/esm").TargetFeature;
|
|
49
|
-
Tiled3DModelSource: typeof import("mapbox-gl/esm").Tiled3DModelSource;
|
|
50
|
-
VectorTileSource: typeof import("mapbox-gl/esm").VectorTileSource;
|
|
51
|
-
VideoSource: typeof import("mapbox-gl/esm").VideoSource;
|
|
52
|
-
addTileProvider: typeof import("mapbox-gl/esm").addTileProvider;
|
|
53
|
-
clearPrewarmedResources: typeof import("mapbox-gl/esm").clearPrewarmedResources;
|
|
54
|
-
clearStorage: typeof import("mapbox-gl/esm").clearStorage;
|
|
55
|
-
getBuildingGenUrl: typeof import("mapbox-gl/esm").getBuildingGenUrl;
|
|
56
|
-
getDracoUrl: typeof import("mapbox-gl/esm").getDracoUrl;
|
|
57
|
-
getMeshoptUrl: typeof import("mapbox-gl/esm").getMeshoptUrl;
|
|
58
|
-
getRTLTextPluginStatus: () => import("mapbox-gl/esm").PluginStatus;
|
|
59
|
-
getWorkerCount: typeof import("mapbox-gl/esm").getWorkerCount;
|
|
60
|
-
prewarm: typeof import("mapbox-gl/esm").prewarm;
|
|
61
|
-
restoreNow: () => void;
|
|
62
|
-
setAccessToken: typeof import("mapbox-gl/esm").setAccessToken;
|
|
63
|
-
setBaseApiUrl: typeof import("mapbox-gl/esm").setBaseApiUrl;
|
|
64
|
-
setBuildingGenUrl: typeof import("mapbox-gl/esm").setBuildingGenUrl;
|
|
65
|
-
setDracoUrl: typeof import("mapbox-gl/esm").setDracoUrl;
|
|
66
|
-
setMaxParallelImageRequests: typeof import("mapbox-gl/esm").setMaxParallelImageRequests;
|
|
67
|
-
setMeshoptUrl: typeof import("mapbox-gl/esm").setMeshoptUrl;
|
|
68
|
-
setNow: (time: number) => void;
|
|
69
|
-
setRTLTextPlugin: (url: string, callback?: ((error?: Error | null, result?: {
|
|
70
|
-
err: Error | null | undefined;
|
|
71
|
-
} | null | undefined) => void) | null, deferred?: boolean) => void;
|
|
72
|
-
setSdkInfo: typeof import("mapbox-gl/esm").setSdkInfo;
|
|
73
|
-
setWorkerCount: typeof import("mapbox-gl/esm").setWorkerCount;
|
|
74
|
-
setWorkerUrl: typeof import("mapbox-gl/esm").setWorkerUrl;
|
|
75
|
-
supported: typeof import("mapbox-gl/esm").supported;
|
|
76
|
-
version: string;
|
|
77
|
-
default: typeof import("mapbox-gl/esm");
|
|
78
|
-
} | null;
|
|
79
|
-
_MapComponent: any;
|
|
80
|
-
_DeckGLOverlayComponent: any;
|
|
81
|
-
ready: Promise<any>;
|
|
128
|
+
/** @type {string|undefined} The configured access token (undefined on the token-less Maplibre subclass, #154). */
|
|
129
|
+
apiKey: string | undefined;
|
|
130
|
+
/** @type {MapboxServiceName[]} The REST SDK services to (pre)load. */
|
|
131
|
+
services: MapboxServiceName[];
|
|
132
|
+
/** @type {Partial<Record<MapboxServiceName, object>>} The loaded REST service clients by name (plain objects: the mapbox SDK ships no types). */
|
|
133
|
+
sdk: Partial<Record<MapboxServiceName, object>>;
|
|
134
|
+
/** @type {typeof import('mapbox-gl/esm')|typeof import('maplibre-gl')|null} The lazily loaded gl namespace (maplibre-gl's on the Maplibre subclass). */
|
|
135
|
+
mapboxgl: typeof import('mapbox-gl/esm') | typeof import('maplibre-gl') | null;
|
|
136
|
+
/** @type {import('vue').Component|null} */
|
|
137
|
+
_MapComponent: import('vue').Component | null;
|
|
138
|
+
/** @type {import('vue').Component|null} */
|
|
139
|
+
_DeckGLOverlayComponent: import('vue').Component | null;
|
|
140
|
+
/** @type {Promise<object>} The SDK preload: resolves with the `sdk` registry, rejects like getSDK(). */
|
|
141
|
+
ready: Promise<object>;
|
|
142
|
+
/** Subclasses can opt out of the token requirement (#154): MapLibre works without any key.
|
|
143
|
+
* @returns {boolean} Whether the constructor requires an apiKey.
|
|
144
|
+
*/
|
|
82
145
|
get requiresApiKey(): boolean;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
146
|
+
/** Build the provider from its `maps` config entry and kick off the SDK preload (#149).
|
|
147
|
+
* @param {import('../main.js').MapboxConfig|import('../main.js').MaplibreConfig} mapConfig - The
|
|
148
|
+
* `maps.<key>` config entry (the token-less MaplibreConfig on the Maplibre subclass, #154).
|
|
149
|
+
*/
|
|
150
|
+
constructor(mapConfig: import('../main.js').MapboxConfig | import('../main.js').MaplibreConfig);
|
|
151
|
+
/** The map Vue component: `:options` ({@link MapboxMapOptions}), `:layers` ({@link MapLayerDef}
|
|
152
|
+
* array), `:sources` ({@link MapSourceDef} array); emits `loaded` with the {@link MapboxMap}
|
|
153
|
+
* wrapper, and `error`.
|
|
154
|
+
* @returns {import('vue').Component} The memoized component definition (#139).
|
|
155
|
+
*/
|
|
156
|
+
get Map(): import('vue').Component;
|
|
157
|
+
/** The deck.gl overlay Vue component (nests inside `Map`): `:options`, `:layers`; emits `loaded`
|
|
158
|
+
* with the overlay wrapper, and `error`.
|
|
159
|
+
* @returns {import('vue').Component} The memoized component definition (#139).
|
|
160
|
+
*/
|
|
161
|
+
get DeckGLOverlay(): import('vue').Component;
|
|
162
|
+
/** Lazy-load the gl namespace (and its css) into `this.mapboxgl`, once.
|
|
163
|
+
* @returns {Promise<void>}
|
|
164
|
+
*/
|
|
86
165
|
loadMapbox(): Promise<void>;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
uploads: () => Promise<any>;
|
|
101
|
-
isochrone: () => Promise<any>;
|
|
102
|
-
};
|
|
166
|
+
/** The lazy REST SDK service loaders — one dynamic import per service, so only the requested
|
|
167
|
+
* services are fetched; its keys are the valid {@link MapboxServiceName}s.
|
|
168
|
+
* @returns {Record<MapboxServiceName, () => Promise<{ default: (client: object) => object }>>} Service
|
|
169
|
+
* name → loader of the service module, whose `default` builds the client-bound service.
|
|
170
|
+
*/
|
|
171
|
+
get servicesLoader(): Record<MapboxServiceName, () => Promise<{
|
|
172
|
+
default: (client: object) => object;
|
|
173
|
+
}>>;
|
|
174
|
+
/** Build the token-bound SDK client and load the wanted services into `this.sdk` (#150).
|
|
175
|
+
* @param {object} [options] - Options.
|
|
176
|
+
* @param {MapboxServiceName[]} [options.services] - Services to load on top of the configured ones.
|
|
177
|
+
* @returns {Promise<void>}
|
|
178
|
+
*/
|
|
103
179
|
loadMapboxSDK({ services }?: {
|
|
104
|
-
services?:
|
|
180
|
+
services?: MapboxServiceName[];
|
|
105
181
|
}): Promise<void>;
|
|
106
|
-
|
|
182
|
+
/** Load and return Mapbox REST SDK services (the config `services` plus the requested ones).
|
|
183
|
+
* @param {MapboxServiceName|{services?: MapboxServiceName[]}} [options] - A single service name, or
|
|
184
|
+
* `{ services }` to load several at once.
|
|
185
|
+
* @returns {Promise<object>} The named service client for a string argument, the whole `sdk`
|
|
186
|
+
* registry otherwise (plain objects: the mapbox SDK ships no types).
|
|
187
|
+
* @throws {Error} When a service name is unknown (#150) or its client is not loaded.
|
|
188
|
+
*/
|
|
189
|
+
getSDK(options?: MapboxServiceName | {
|
|
190
|
+
services?: MapboxServiceName[];
|
|
191
|
+
}): Promise<object>;
|
|
107
192
|
/** Map constructor options, overridable per subclass (maplibre-gl has no accessToken option, #154).
|
|
108
193
|
* @param {HTMLElement} container - The map container element.
|
|
109
|
-
* @param {
|
|
110
|
-
* @returns {
|
|
194
|
+
* @param {MapboxMapOptions} options - Consumer-provided map options.
|
|
195
|
+
* @returns {import('mapbox-gl').MapOptions} The options passed to `new mapboxgl.Map()`.
|
|
196
|
+
*/
|
|
197
|
+
_getMapOptions(container: HTMLElement, options: MapboxMapOptions): import('mapbox-gl').MapOptions;
|
|
198
|
+
/** Create the map imperatively (must run in a component's setup(): the lifecycle hooks drive it):
|
|
199
|
+
* resolves the wrapper once the map emits 'load', rejects on ANY failure (#148/#228) — with
|
|
200
|
+
* `error.code === 'MAP_UNMOUNTED'` when the component unmounted first — and tears the map, its
|
|
201
|
+
* watchers and its overlays down on unmount.
|
|
202
|
+
* @template {HTMLElement|null|undefined} TEl
|
|
203
|
+
* @param {import('vue').Ref<TEl>} elemRef - Template ref to the map's container element.
|
|
204
|
+
* @param {MapboxMapOptions} [options] - Map constructor options plus the wrapper extras
|
|
205
|
+
* (maplibre-gl's own options on the Maplibre subclass).
|
|
206
|
+
* @returns {Promise<MapboxMap>} The map wrapper.
|
|
111
207
|
*/
|
|
112
|
-
|
|
113
|
-
createMap(elemRef: any, options?: {}): Promise<any>;
|
|
208
|
+
createMap<TEl extends HTMLElement | null | undefined>(elemRef: import('vue').Ref<TEl>, options?: MapboxMapOptions): Promise<MapboxMap>;
|
|
114
209
|
}
|
|
210
|
+
export {};
|
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
import Mapbox from './Mapbox.js';
|
|
2
|
+
export type MaplibreMapOptions = Omit<import('maplibre-gl').MapOptions, 'container'> & import('./Mapbox.js').MapboxMapExtraOptions;
|
|
3
|
+
/**
|
|
4
|
+
* Options of the Maplibre `Map` component / `createMap`: maplibre-gl's `MapOptions` minus `container`
|
|
5
|
+
* (the component's element / `elemRef` provides it), plus the wrapper extras shared with Mapbox.
|
|
6
|
+
* @typedef {Omit<import('maplibre-gl').MapOptions, 'container'> & import('./Mapbox.js').MapboxMapExtraOptions} MaplibreMapOptions
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Maplibre provider (`type: 'maplibre'`/`'maplibre-gl'`): the token-less mapbox-gl fork — same
|
|
10
|
+
* Map/DeckGLOverlay/createMap surface as Mapbox, minus the REST SDK (#154).
|
|
11
|
+
*/
|
|
2
12
|
export default class Maplibre extends Mapbox {
|
|
13
|
+
/** MapLibre is the token-less mapbox-gl fork (#154).
|
|
14
|
+
* @returns {boolean} Always false: no apiKey needed.
|
|
15
|
+
*/
|
|
3
16
|
get requiresApiKey(): boolean;
|
|
17
|
+
/** Lazy-load the maplibre-gl namespace (and its css) into `this.mapboxgl`, once, pinning its web
|
|
18
|
+
* worker — the whole story below.
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
4
21
|
loadMapbox(): Promise<void>;
|
|
5
22
|
/** No Mapbox REST SDK on maplibre (#154): the constructor preload resolves to an empty sdk,
|
|
6
23
|
* and requesting a service (argument or configured `services`) is a consumer error.
|
|
7
|
-
* @param {string|
|
|
24
|
+
* @param {string|{services?: string[]}} [options] - Service name or `{ services }` object, like Mapbox's getSDK.
|
|
8
25
|
* @returns {Promise<object>} The (empty) sdk registry.
|
|
9
26
|
* @throws {Error} When a service is requested.
|
|
10
27
|
*/
|
|
11
|
-
getSDK(options?: string |
|
|
12
|
-
|
|
28
|
+
getSDK(options?: string | {
|
|
29
|
+
services?: string[];
|
|
30
|
+
}): Promise<object>;
|
|
31
|
+
/** maplibre-gl has no accessToken option (#154): container + consumer options only.
|
|
32
|
+
* @param {HTMLElement} container - The map container element.
|
|
33
|
+
* @param {MaplibreMapOptions} options - Consumer-provided map options.
|
|
34
|
+
* @returns {import('maplibre-gl').MapOptions} The options passed to `new maplibregl.Map()`.
|
|
35
|
+
*/
|
|
36
|
+
_getMapOptions(container: HTMLElement, options: MaplibreMapOptions): import('maplibre-gl').MapOptions;
|
|
13
37
|
}
|
|
@@ -1 +1,45 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type SeaRouteFeature = {
|
|
2
|
+
/**
|
|
3
|
+
* - GeoJSON object type.
|
|
4
|
+
*/
|
|
5
|
+
type: 'Feature';
|
|
6
|
+
/**
|
|
7
|
+
* - The `[lng, lat]` network
|
|
8
|
+
* path, from origin's snap to destination's snap.
|
|
9
|
+
*/
|
|
10
|
+
geometry: {
|
|
11
|
+
type: 'LineString';
|
|
12
|
+
coordinates: number[][];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* - The route
|
|
16
|
+
* length, expressed in `units`.
|
|
17
|
+
*/
|
|
18
|
+
properties: {
|
|
19
|
+
units: 'nm' | import('@turf/turf').Units;
|
|
20
|
+
length: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The returned route: the GeoJSON LineString Feature built by turf's lineString() over the snapped
|
|
25
|
+
* network path, with the measured length stamped on `properties` (#138, same contract as the air
|
|
26
|
+
* twin, #257).
|
|
27
|
+
* @typedef {object} SeaRouteFeature
|
|
28
|
+
* @property {'Feature'} type - GeoJSON object type.
|
|
29
|
+
* @property {{type: 'LineString', coordinates: number[][]}} geometry - The `[lng, lat]` network
|
|
30
|
+
* path, from origin's snap to destination's snap.
|
|
31
|
+
* @property {{units: 'nm'|import('@turf/turf').Units, length: number}} properties - The route
|
|
32
|
+
* length, expressed in `units`.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Shortest sea route between two points, each snapped to the Marnet network first, via
|
|
36
|
+
* geojson-path-finder (weight() bridges the anti-meridian edges).
|
|
37
|
+
* @param {import('@turf/turf').Coord} origin - Start point: a turf point() Feature, a bare Point
|
|
38
|
+
* geometry, or a `[lng, lat]` position.
|
|
39
|
+
* @param {import('@turf/turf').Coord} destination - End point, same accepted shapes.
|
|
40
|
+
* @param {'nm'|import('@turf/turf').Units} [units='nm'] - Unit of `properties.length`; 'nm' is the
|
|
41
|
+
* module's alias for turf's 'nauticalmiles' (#138).
|
|
42
|
+
* @returns {SeaRouteFeature|null} The snapped route — null when no path exists (reachable on valid
|
|
43
|
+
* inputs, the network is fragmented, #141).
|
|
44
|
+
*/
|
|
45
|
+
export default function searoute(origin: import('@turf/turf').Coord, destination: import('@turf/turf').Coord, units?: 'nm' | import('@turf/turf').Units): SeaRouteFeature | null;
|
|
@@ -1,6 +1,71 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export type AirRouteOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* - Start position, `[lng, lat]`.
|
|
4
|
+
*/
|
|
5
|
+
origin: number[];
|
|
6
|
+
/**
|
|
7
|
+
* - End position, `[lng, lat]`.
|
|
8
|
+
*/
|
|
9
|
+
destination: number[];
|
|
10
|
+
/**
|
|
11
|
+
* - Number of arc segments (the geometry holds `step` interpolated
|
|
12
|
+
* positions plus the destination, before dedupe); a non-integer or non-positive value falls back
|
|
13
|
+
* to 100 (#157).
|
|
14
|
+
*/
|
|
15
|
+
step?: number;
|
|
16
|
+
/**
|
|
17
|
+
* - Unit of `properties.length`; 'nm' is
|
|
18
|
+
* the module's alias for turf's 'nauticalmiles' (#138).
|
|
19
|
+
*/
|
|
20
|
+
units?: 'nm' | import('@turf/turf').Units;
|
|
21
|
+
};
|
|
22
|
+
export type AirRouteFeature = {
|
|
23
|
+
/**
|
|
24
|
+
* - GeoJSON object type.
|
|
25
|
+
*/
|
|
26
|
+
type: 'Feature';
|
|
27
|
+
/**
|
|
28
|
+
* - The arc's `[lng, lat]`
|
|
29
|
+
* positions; longitudes are unfolded by normalizeRoute and may run past ±180 (#159).
|
|
30
|
+
*/
|
|
31
|
+
geometry: {
|
|
32
|
+
type: 'LineString';
|
|
33
|
+
coordinates: number[][];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* - The route
|
|
37
|
+
* length, expressed in `units`.
|
|
38
|
+
*/
|
|
39
|
+
properties: {
|
|
40
|
+
units: 'nm' | import('@turf/turf').Units;
|
|
41
|
+
length: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Arguments of getAirRoute.
|
|
46
|
+
* @typedef {object} AirRouteOptions
|
|
47
|
+
* @property {number[]} origin - Start position, `[lng, lat]`.
|
|
48
|
+
* @property {number[]} destination - End position, `[lng, lat]`.
|
|
49
|
+
* @property {number} [step=100] - Number of arc segments (the geometry holds `step` interpolated
|
|
50
|
+
* positions plus the destination, before dedupe); a non-integer or non-positive value falls back
|
|
51
|
+
* to 100 (#157).
|
|
52
|
+
* @property {'nm'|import('@turf/turf').Units} [units='nm'] - Unit of `properties.length`; 'nm' is
|
|
53
|
+
* the module's alias for turf's 'nauticalmiles' (#138).
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* The returned route: the GeoJSON LineString Feature built by turf's lineString(), with the
|
|
57
|
+
* measured length stamped on `properties` (#257).
|
|
58
|
+
* @typedef {object} AirRouteFeature
|
|
59
|
+
* @property {'Feature'} type - GeoJSON object type.
|
|
60
|
+
* @property {{type: 'LineString', coordinates: number[][]}} geometry - The arc's `[lng, lat]`
|
|
61
|
+
* positions; longitudes are unfolded by normalizeRoute and may run past ±180 (#159).
|
|
62
|
+
* @property {{units: 'nm'|import('@turf/turf').Units, length: number}} properties - The route
|
|
63
|
+
* length, expressed in `units`.
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* Great-circle ("air") route between origin and destination: a geodesic arc interpolated with
|
|
67
|
+
* turf's along(), then unfolded across the anti-meridian and measured on the final geometry.
|
|
68
|
+
* @param {AirRouteOptions} options - Route endpoints and arc options.
|
|
69
|
+
* @returns {AirRouteFeature} The arc as a GeoJSON LineString Feature.
|
|
70
|
+
*/
|
|
71
|
+
export default function getAirRoute({ origin, destination, step, units }: AirRouteOptions): AirRouteFeature;
|
|
@@ -1,6 +1,40 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export type WaterRouteOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* - Start position, `[lng, lat]`.
|
|
4
|
+
*/
|
|
5
|
+
origin: number[];
|
|
6
|
+
/**
|
|
7
|
+
* - End position, `[lng, lat]`.
|
|
8
|
+
*/
|
|
9
|
+
destination: number[];
|
|
10
|
+
/**
|
|
11
|
+
* - Prepend/append the REAL origin/destination to the
|
|
12
|
+
* snapped network path (boundary legs), and recompute `properties.length` over the extended
|
|
13
|
+
* geometry (#159).
|
|
14
|
+
*/
|
|
15
|
+
includeBoundaries?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* - Unit of `properties.length`; 'nm' is
|
|
18
|
+
* the module's alias for turf's 'nauticalmiles' (#138).
|
|
19
|
+
*/
|
|
20
|
+
units?: 'nm' | import('@turf/turf').Units;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Arguments of getWaterRoute.
|
|
24
|
+
* @typedef {object} WaterRouteOptions
|
|
25
|
+
* @property {number[]} origin - Start position, `[lng, lat]`.
|
|
26
|
+
* @property {number[]} destination - End position, `[lng, lat]`.
|
|
27
|
+
* @property {boolean} [includeBoundaries=false] - Prepend/append the REAL origin/destination to the
|
|
28
|
+
* snapped network path (boundary legs), and recompute `properties.length` over the extended
|
|
29
|
+
* geometry (#159).
|
|
30
|
+
* @property {'nm'|import('@turf/turf').Units} [units='nm'] - Unit of `properties.length`; 'nm' is
|
|
31
|
+
* the module's alias for turf's 'nauticalmiles' (#138).
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Sea ("water") route between origin and destination over the Marnet network, computed by the
|
|
35
|
+
* dynamically-imported searoute engine, then unfolded across the anti-meridian.
|
|
36
|
+
* @param {WaterRouteOptions} options - Route endpoints and options.
|
|
37
|
+
* @returns {Promise<import('../searoute/searoute.js').SeaRouteFeature|null>} The route as a GeoJSON
|
|
38
|
+
* LineString Feature (`properties.units`/`length` set) — null when no path exists (#141).
|
|
39
|
+
*/
|
|
40
|
+
export default function getWaterRoute({ origin, destination, includeBoundaries, units }: WaterRouteOptions): Promise<import('../searoute/searoute.js').SeaRouteFeature | null>;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Unfold a route's longitudes across anti-meridian crossings: whenever two consecutive longitudes
|
|
3
|
+
* jump by more than 180°, shift by ±360 so the line never wraps — the unfolded longitudes may run
|
|
4
|
+
* past ±180 (turf's haversine handles them, #159). Drops any altitude member on the way.
|
|
5
|
+
* @param {number[][]} coords - The route positions, `[lng, lat]` first.
|
|
6
|
+
* @returns {Array<[number, number]>} The unfolded `[lng, lat]` pairs, consecutive duplicates removed.
|
|
7
|
+
*/
|
|
8
|
+
export default function normalizeRoute(coords: number[][]): Array<[number, number]>;
|