@aapicoits/powermap-web-sdk 1.0.0 → 1.0.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/dist/index.d.ts +226 -0
- package/package.json +6 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// PowerMap Web SDK — TypeScript Declaration File
|
|
3
|
+
// Auto-generated from src/index.js JSDoc
|
|
4
|
+
// ============================================================
|
|
5
|
+
|
|
6
|
+
export interface PowerMapAuthOptions {
|
|
7
|
+
clientId: string;
|
|
8
|
+
clientSecret: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PowerMapOptions {
|
|
12
|
+
/** The HTML element ID or element reference to mount the map into */
|
|
13
|
+
container: string | HTMLElement;
|
|
14
|
+
/** Initial map center as [longitude, latitude] */
|
|
15
|
+
center?: [number, number];
|
|
16
|
+
/** Initial zoom level */
|
|
17
|
+
zoom?: number;
|
|
18
|
+
/** Minimum zoom level */
|
|
19
|
+
minZoom?: number;
|
|
20
|
+
/** Maximum zoom level */
|
|
21
|
+
maxZoom?: number;
|
|
22
|
+
/** Map style name: 'th' | 'en' | 'dark' | 'gray' or a custom style URL */
|
|
23
|
+
style?: 'th' | 'en' | 'dark' | 'gray' | string;
|
|
24
|
+
/** API Key for map tiles */
|
|
25
|
+
mapApiKey: string;
|
|
26
|
+
/** Authentication credentials for services */
|
|
27
|
+
auth: PowerMapAuthOptions;
|
|
28
|
+
/** Disable all map interactions (zoom, pan, rotate) — preview mode */
|
|
29
|
+
previewOnly?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MarkerOptions {
|
|
33
|
+
/** [longitude, latitude] */
|
|
34
|
+
position: [number, number];
|
|
35
|
+
/** Marker type */
|
|
36
|
+
type?: 'start' | 'destination' | 'waypoint' | string;
|
|
37
|
+
/** Custom image URL */
|
|
38
|
+
iconUrl?: string;
|
|
39
|
+
/** Custom hex color for pinpoint marker (e.g. '#ff4444') */
|
|
40
|
+
color?: string;
|
|
41
|
+
/** FontAwesome icon class (e.g. 'fas fa-car') */
|
|
42
|
+
icon?: string;
|
|
43
|
+
/** Enable marker dragging */
|
|
44
|
+
draggable?: boolean;
|
|
45
|
+
/** HTML content or structured popup object */
|
|
46
|
+
popupContent?: string | { title?: string; body?: string; tag?: string; footer?: string };
|
|
47
|
+
/** Unique identifier for the marker */
|
|
48
|
+
id?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface MarkerInstance {
|
|
52
|
+
id: string;
|
|
53
|
+
position: [number, number];
|
|
54
|
+
remove(): void;
|
|
55
|
+
setLngLat(lngLat: [number, number]): this;
|
|
56
|
+
getLngLat(): { lng: number; lat: number };
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RouteOptions {
|
|
61
|
+
start: [number, number];
|
|
62
|
+
destination: [number, number];
|
|
63
|
+
waypoints?: [number, number][];
|
|
64
|
+
optimize?: boolean;
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface RouteStep {
|
|
69
|
+
distance: number;
|
|
70
|
+
distanceStr: string;
|
|
71
|
+
duration: number;
|
|
72
|
+
durationStr: string;
|
|
73
|
+
instruction?: string;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface RouteDetails {
|
|
78
|
+
distance: number;
|
|
79
|
+
distanceStr: string;
|
|
80
|
+
duration: number;
|
|
81
|
+
durationStr: string;
|
|
82
|
+
steps: RouteStep[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface RouteSummary {
|
|
86
|
+
distanceStr: string;
|
|
87
|
+
durationStr: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SearchResult {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
address?: string;
|
|
94
|
+
position: [number, number];
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface SearchOptions {
|
|
99
|
+
location?: [number, number];
|
|
100
|
+
lang?: string;
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface FlyToOptions {
|
|
105
|
+
center?: [number, number];
|
|
106
|
+
zoom?: number;
|
|
107
|
+
pitch?: number;
|
|
108
|
+
bearing?: number;
|
|
109
|
+
speed?: number;
|
|
110
|
+
curve?: number;
|
|
111
|
+
[key: string]: unknown;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface FitBoundsOptions {
|
|
115
|
+
padding?: number | { top: number; bottom: number; left: number; right: number };
|
|
116
|
+
maxZoom?: number;
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type PowerMapEventName =
|
|
121
|
+
| 'mapLoaded'
|
|
122
|
+
| 'mapClick'
|
|
123
|
+
| 'mapLongClick'
|
|
124
|
+
| 'markerClick'
|
|
125
|
+
| 'markerDrag'
|
|
126
|
+
| 'markerDragEnd'
|
|
127
|
+
| 'poiClick'
|
|
128
|
+
| 'routeCalculated'
|
|
129
|
+
| 'modeChanged'
|
|
130
|
+
| 'error'
|
|
131
|
+
| string;
|
|
132
|
+
|
|
133
|
+
export type PowerMapMode = 'standard' | 'indoor';
|
|
134
|
+
|
|
135
|
+
export interface SetModeOptions {
|
|
136
|
+
buildingId?: string;
|
|
137
|
+
floorId?: string;
|
|
138
|
+
center?: [number, number];
|
|
139
|
+
[key: string]: unknown;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* PowerMap SDK Main Class
|
|
144
|
+
*
|
|
145
|
+
* Provides a high-level API for map rendering, markers, routing,
|
|
146
|
+
* indoor navigation, and vehicle simulation.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* const map = new PowerMap({
|
|
150
|
+
* container: 'map',
|
|
151
|
+
* mapApiKey: 'YOUR_KEY',
|
|
152
|
+
* auth: { clientId: '...', clientSecret: '...' }
|
|
153
|
+
* })
|
|
154
|
+
* .on('mapLoaded', () => console.log('Ready!'))
|
|
155
|
+
* .setStyle('dark');
|
|
156
|
+
*/
|
|
157
|
+
export declare class PowerMap {
|
|
158
|
+
constructor(options: PowerMapOptions);
|
|
159
|
+
|
|
160
|
+
// --- Events ---
|
|
161
|
+
on(event: PowerMapEventName, callback: (...args: unknown[]) => void): this;
|
|
162
|
+
off(event: PowerMapEventName, callback: (...args: unknown[]) => void): this;
|
|
163
|
+
onMapLoaded(callback: (data: { map: PowerMap }) => void): this;
|
|
164
|
+
onClick(callback: (event: unknown) => void): this;
|
|
165
|
+
onMapLongClick(callback: (event: unknown) => void): this;
|
|
166
|
+
onMarkerClick(callback: (data: { marker: MarkerInstance; originalEvent: unknown; options: unknown }) => void): this;
|
|
167
|
+
onPoiClick(callback: (data: { feature: unknown; lngLat: unknown; point: unknown }) => void): this;
|
|
168
|
+
onMarkerDrag(callback: (data: { marker: MarkerInstance; lngLat: [number, number] }) => void): this;
|
|
169
|
+
onMarkerDragEnd(callback: (data: { marker: MarkerInstance; lngLat: [number, number] }) => void): this;
|
|
170
|
+
onRouteCalculated(callback: (route: unknown) => void): this;
|
|
171
|
+
onError(callback: (error: Error) => void): this;
|
|
172
|
+
|
|
173
|
+
// --- Map Style & Mode ---
|
|
174
|
+
setStyle(name: 'th' | 'en' | 'dark' | 'gray' | string): this;
|
|
175
|
+
setMode(mode: PowerMapMode, options?: SetModeOptions): this;
|
|
176
|
+
|
|
177
|
+
// --- Controls ---
|
|
178
|
+
setNavigationControl(options: boolean | object): this;
|
|
179
|
+
setFullscreenControl(options: boolean | object): this;
|
|
180
|
+
|
|
181
|
+
// --- Camera ---
|
|
182
|
+
flyTo(options: FlyToOptions): this;
|
|
183
|
+
easeTo(options: FlyToOptions): this;
|
|
184
|
+
fitBounds(bounds: [[number, number], [number, number]], options?: FitBoundsOptions): this;
|
|
185
|
+
jumpTo(options: FlyToOptions): this;
|
|
186
|
+
setPitch(pitch: number, animate?: boolean): this;
|
|
187
|
+
setBearing(bearing: number, animate?: boolean): this;
|
|
188
|
+
zoomIn(): this;
|
|
189
|
+
zoomOut(): this;
|
|
190
|
+
rotateLeft(): this;
|
|
191
|
+
rotateRight(): this;
|
|
192
|
+
getCenter(): { lng: number; lat: number };
|
|
193
|
+
getZoom(): number;
|
|
194
|
+
getPitch(): number;
|
|
195
|
+
getBearing(): number;
|
|
196
|
+
|
|
197
|
+
// --- Markers ---
|
|
198
|
+
addMarker(options: MarkerOptions): MarkerInstance;
|
|
199
|
+
getMarker(id: string): MarkerInstance | null;
|
|
200
|
+
removeMarker(markerOrId: MarkerInstance | string): this;
|
|
201
|
+
updatePopup(marker: MarkerInstance, content: string | object): this;
|
|
202
|
+
clearMarkers(): this;
|
|
203
|
+
|
|
204
|
+
// --- Routing ---
|
|
205
|
+
addRoute(options: RouteOptions): Promise<unknown>;
|
|
206
|
+
clearRoutes(): this;
|
|
207
|
+
getRouteDetails(): RouteDetails | null;
|
|
208
|
+
getRouteSummary(): RouteSummary | null;
|
|
209
|
+
formatDistance(meters: number): string;
|
|
210
|
+
formatDuration(seconds: number): string;
|
|
211
|
+
|
|
212
|
+
// --- Search ---
|
|
213
|
+
search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
214
|
+
|
|
215
|
+
// --- Layers ---
|
|
216
|
+
showLayer(layerId: string): Promise<this>;
|
|
217
|
+
hideLayer(layerId: string): this;
|
|
218
|
+
toggleLayer(layerId: string): Promise<this>;
|
|
219
|
+
|
|
220
|
+
// --- Managers (advanced access) ---
|
|
221
|
+
readonly layers: unknown;
|
|
222
|
+
readonly geometry: unknown;
|
|
223
|
+
readonly indoor: unknown;
|
|
224
|
+
readonly editor: unknown;
|
|
225
|
+
debug(): unknown;
|
|
226
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
+
"//": "@powermap/web-sdk",
|
|
2
3
|
"name": "@aapicoits/powermap-web-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"files": [
|
|
6
7
|
"dist"
|
|
7
8
|
],
|
|
8
9
|
"main": "./dist/powermap-web-sdk.umd.cjs",
|
|
9
10
|
"module": "./dist/powermap-web-sdk.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
10
12
|
"exports": {
|
|
11
13
|
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
12
15
|
"import": "./dist/powermap-web-sdk.js",
|
|
13
16
|
"require": "./dist/powermap-web-sdk.umd.cjs"
|
|
14
17
|
},
|
|
@@ -28,6 +31,7 @@
|
|
|
28
31
|
"three": "^0.162.0"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"vite": "^5.1.4"
|
|
34
|
+
"vite": "^5.1.4",
|
|
35
|
+
"vite-plugin-dts": "^5.0.0"
|
|
32
36
|
}
|
|
33
37
|
}
|