@dacostafilipe/react-geoportail 0.1.4 → 0.1.6
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/README.md +6 -2
- package/dist/components/GeoportailMap.d.ts +2 -2
- package/dist/hooks/useGeocode.d.ts +1 -1
- package/dist/hooks/useLuxApi.d.ts +3 -3
- package/dist/hooks/useReverseGeocode.d.ts +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/react-geoportail.js +253 -208
- package/dist/react-geoportail.js.map +1 -1
- package/dist/react-geoportail.umd.cjs +2 -2
- package/dist/react-geoportail.umd.cjs.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lux.d.ts +89 -0
- package/dist/utils/loader.d.ts +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript declarations for the Geoportail Luxembourg lux API (v3).
|
|
3
|
+
* Loaded dynamically via the hosted Geoportail CSS and JS bundles.
|
|
4
|
+
*/
|
|
5
|
+
export interface LuxCoordinate {
|
|
6
|
+
/** X coordinate in EPSG:2169 (Luxembourg TM) */
|
|
7
|
+
easting: number;
|
|
8
|
+
/** Y coordinate in EPSG:2169 (Luxembourg TM) */
|
|
9
|
+
northing: number;
|
|
10
|
+
}
|
|
11
|
+
export interface LuxPosition {
|
|
12
|
+
/** Longitude in WGS84 (EPSG:4326) */
|
|
13
|
+
lon: number;
|
|
14
|
+
/** Latitude in WGS84 (EPSG:4326) */
|
|
15
|
+
lat: number;
|
|
16
|
+
}
|
|
17
|
+
export interface GeocodeResult {
|
|
18
|
+
easting: number;
|
|
19
|
+
northing: number;
|
|
20
|
+
accuracy: number;
|
|
21
|
+
street?: string;
|
|
22
|
+
num?: string;
|
|
23
|
+
zip?: string;
|
|
24
|
+
locality?: string;
|
|
25
|
+
country?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ReverseGeocodeResult {
|
|
28
|
+
easting: number;
|
|
29
|
+
northing: number;
|
|
30
|
+
name: string;
|
|
31
|
+
distance: number;
|
|
32
|
+
}
|
|
33
|
+
export interface GeocodeResponse {
|
|
34
|
+
results: GeocodeResult[];
|
|
35
|
+
success: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface ReverseGeocodeResponse {
|
|
38
|
+
results: ReverseGeocodeResult[];
|
|
39
|
+
success: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface LuxMapOptions {
|
|
42
|
+
/** DOM element ID or HTMLElement to render the map into */
|
|
43
|
+
target: string | HTMLElement;
|
|
44
|
+
/** Background layer identifier (e.g. 'basemap_2015_global') */
|
|
45
|
+
bgLayer?: string;
|
|
46
|
+
/** Initial zoom level */
|
|
47
|
+
zoom?: number;
|
|
48
|
+
/** Initial position as [lon, lat] in EPSG:4326 or [x, y] in EPSG:2169 */
|
|
49
|
+
position?: [number, number];
|
|
50
|
+
/** Additional layer IDs to add on top of the background */
|
|
51
|
+
layers?: (number | string)[];
|
|
52
|
+
layerOpacities?: number[];
|
|
53
|
+
layerVisibilities?: boolean[];
|
|
54
|
+
}
|
|
55
|
+
export interface LuxMapInstance {
|
|
56
|
+
getTarget(): HTMLElement;
|
|
57
|
+
getLayers(): unknown;
|
|
58
|
+
addLayerToMap(layerId: number | string, opacity?: number, visible?: boolean): void;
|
|
59
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
60
|
+
un(event: string, handler: (...args: unknown[]) => void): void;
|
|
61
|
+
getView(): {
|
|
62
|
+
getCenter(): [number, number];
|
|
63
|
+
getZoom(): number;
|
|
64
|
+
setCenter(center: [number, number]): void;
|
|
65
|
+
setZoom(zoom: number): void;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface LuxGeocoderInstance {
|
|
69
|
+
geocode(params: {
|
|
70
|
+
queryString?: string;
|
|
71
|
+
num?: string;
|
|
72
|
+
street?: string;
|
|
73
|
+
zip?: string;
|
|
74
|
+
locality?: string;
|
|
75
|
+
}, callback: (success: boolean, response: GeocodeResponse) => void): void;
|
|
76
|
+
reversegeocode(params: LuxCoordinate, callback: (success: boolean, response: ReverseGeocodeResponse) => void): void;
|
|
77
|
+
}
|
|
78
|
+
/** Global lux namespace injected by the hosted Geoportail bundles. */
|
|
79
|
+
export interface LuxNamespace {
|
|
80
|
+
Map: new (options: LuxMapOptions) => LuxMapInstance;
|
|
81
|
+
Geocoder: new () => LuxGeocoderInstance;
|
|
82
|
+
setBaseUrl(baseUrl: string, protocol: string): void;
|
|
83
|
+
setI18nUrl(url: string): void;
|
|
84
|
+
}
|
|
85
|
+
declare global {
|
|
86
|
+
interface Window {
|
|
87
|
+
lux?: LuxNamespace;
|
|
88
|
+
}
|
|
89
|
+
}
|
package/dist/utils/loader.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dynamically injects the Geoportail v3
|
|
2
|
+
* Dynamically injects the Geoportail v3 assets and resolves when
|
|
3
3
|
* the global `lux` namespace is available.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Loads the Geoportail
|
|
6
|
+
* Loads the Geoportail API assets exactly once.
|
|
7
7
|
* Safe to call multiple times — subsequent calls return the same promise.
|
|
8
8
|
*/
|
|
9
9
|
export declare function loadLuxApi(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dacostafilipe/react-geoportail",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "React SDK for the Geoportail Luxembourg v3 API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/react-geoportail.umd.cjs",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "vite",
|
|
21
21
|
"build": "tsc -p tsconfig.build.json && vite build",
|
|
22
|
+
"prepack": "npm run build",
|
|
22
23
|
"preview": "vite preview",
|
|
23
24
|
"type-check": "tsc --noEmit"
|
|
24
25
|
},
|