kor-mapi 0.1.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.
@@ -0,0 +1,221 @@
1
+ interface LatLng {
2
+ lat: number;
3
+ lng: number;
4
+ }
5
+ interface LatLngBounds {
6
+ sw: LatLng;
7
+ ne: LatLng;
8
+ }
9
+ interface Point {
10
+ x: number;
11
+ y: number;
12
+ }
13
+ interface Size {
14
+ width: number;
15
+ height: number;
16
+ }
17
+ interface Padding {
18
+ top: number;
19
+ right: number;
20
+ bottom: number;
21
+ left: number;
22
+ }
23
+ type MapProvider = 'naver' | 'kakao' | 'google';
24
+ declare enum MapTypeId {
25
+ ROADMAP = "roadmap",
26
+ SATELLITE = "satellite",
27
+ HYBRID = "hybrid",
28
+ TERRAIN = "terrain"
29
+ }
30
+ type KorMapFeature = 'tilt' | 'heading' | 'mapStyles' | 'elevation' | 'streetview' | 'trafficLayer' | 'heatmap' | 'drawing' | 'transit' | 'adminBoundaries';
31
+ interface KorMapApiKey {
32
+ /** Naver Maps: NCP client ID */
33
+ clientId?: string;
34
+ /** Kakao Maps: app key */
35
+ appKey?: string;
36
+ /** Google Maps: API key */
37
+ apiKey?: string;
38
+ }
39
+ interface KorMapConfig<P extends MapProvider = MapProvider> {
40
+ provider: P;
41
+ container: HTMLElement | string;
42
+ apiKey: string | KorMapApiKey;
43
+ locale?: 'ko' | 'en';
44
+ center?: LatLng;
45
+ /** Facade zoom level 0–22 (Google-style). Default: 10 */
46
+ zoom?: number;
47
+ mapType?: MapTypeId;
48
+ /** Google Maps: Map ID required for AdvancedMarkerElement. Defaults to 'DEMO_MAP_ID' for development. */
49
+ mapId?: string;
50
+ /** Proxy URL for Naver/Kakao routing REST calls (required for routing on these providers) */
51
+ proxyUrl?: string;
52
+ }
53
+ type KorMapEvent = 'click' | 'dblclick' | 'rightclick' | 'mousemove' | 'mouseover' | 'mouseout' | 'dragstart' | 'drag' | 'dragend' | 'zoom_changed' | 'center_changed' | 'bounds_changed' | 'maptype_changed' | 'idle' | 'tilesloaded' | 'load';
54
+ type OverlayEvent = 'click' | 'dblclick' | 'rightclick' | 'mouseover' | 'mouseout' | 'mousemove' | 'dragstart' | 'drag' | 'dragend' | 'position_changed' | 'visible_changed';
55
+ interface MapMouseEvent {
56
+ latlng: LatLng;
57
+ point?: Point;
58
+ domEvent?: MouseEvent;
59
+ }
60
+ /** Opaque token returned by on() / once(), used to call off() */
61
+ interface EventListener {
62
+ readonly _type: string;
63
+ readonly _id: number;
64
+ }
65
+ type MapEventHandler = (event: MapMouseEvent) => void;
66
+ type GenericEventHandler = () => void;
67
+ type AnyEventHandler = MapEventHandler | GenericEventHandler;
68
+ declare enum MarkerAnimation {
69
+ BOUNCE = "bounce",
70
+ DROP = "drop"
71
+ }
72
+ interface MarkerIcon {
73
+ url: string;
74
+ size?: Size;
75
+ scaledSize?: Size;
76
+ /** Offset from top-left of icon image to the pin point */
77
+ anchor?: Point;
78
+ /** Origin within a sprite sheet */
79
+ origin?: Point;
80
+ }
81
+ interface MarkerLabel {
82
+ text: string;
83
+ color?: string;
84
+ fontSize?: string;
85
+ fontWeight?: string;
86
+ }
87
+ interface MarkerOptions {
88
+ position: LatLng;
89
+ icon?: MarkerIcon | string;
90
+ title?: string;
91
+ zIndex?: number;
92
+ visible?: boolean;
93
+ draggable?: boolean;
94
+ opacity?: number;
95
+ label?: MarkerLabel;
96
+ clickable?: boolean;
97
+ animation?: MarkerAnimation;
98
+ }
99
+ interface InfoWindowOptions {
100
+ content: string | HTMLElement;
101
+ position?: LatLng;
102
+ maxWidth?: number;
103
+ disableAutoPan?: boolean;
104
+ zIndex?: number;
105
+ }
106
+ interface StrokeStyle {
107
+ strokeColor?: string;
108
+ strokeOpacity?: number;
109
+ strokeWeight?: number;
110
+ strokeStyle?: 'solid' | 'shortdash' | 'dot' | 'dashdot';
111
+ }
112
+ interface FillStyle {
113
+ fillColor?: string;
114
+ fillOpacity?: number;
115
+ }
116
+ interface PolylineOptions extends StrokeStyle {
117
+ path: LatLng[] | LatLng[][];
118
+ geodesic?: boolean;
119
+ clickable?: boolean;
120
+ zIndex?: number;
121
+ visible?: boolean;
122
+ }
123
+ interface PolygonOptions extends StrokeStyle, FillStyle {
124
+ /** First array = outer ring; subsequent arrays = holes */
125
+ paths: LatLng[] | LatLng[][];
126
+ geodesic?: boolean;
127
+ clickable?: boolean;
128
+ zIndex?: number;
129
+ visible?: boolean;
130
+ }
131
+ interface CircleOptions extends StrokeStyle, FillStyle {
132
+ center: LatLng;
133
+ /** Radius in meters */
134
+ radius: number;
135
+ clickable?: boolean;
136
+ zIndex?: number;
137
+ visible?: boolean;
138
+ }
139
+ interface RectangleOptions extends StrokeStyle, FillStyle {
140
+ bounds: LatLngBounds;
141
+ clickable?: boolean;
142
+ zIndex?: number;
143
+ visible?: boolean;
144
+ }
145
+ interface CustomOverlayOptions {
146
+ position: LatLng;
147
+ content: HTMLElement;
148
+ zIndex?: number;
149
+ visible?: boolean;
150
+ clickable?: boolean;
151
+ }
152
+ interface MapProjection {
153
+ fromLatLngToPoint(latlng: LatLng): Point;
154
+ fromPointToLatLng(point: Point): LatLng;
155
+ fromLatLngToDivPixel(latlng: LatLng): Point;
156
+ }
157
+ interface TileCoord {
158
+ x: number;
159
+ y: number;
160
+ }
161
+ interface TileLayerOptions {
162
+ getTileUrl: (coord: TileCoord, zoom: number) => string;
163
+ tileSize?: number;
164
+ minZoom?: number;
165
+ maxZoom?: number;
166
+ opacity?: number;
167
+ zIndex?: number;
168
+ attribution?: string;
169
+ }
170
+ interface FitBoundsOptions {
171
+ padding?: Partial<Padding> | number;
172
+ animate?: boolean;
173
+ }
174
+ interface PanOptions {
175
+ animate?: boolean;
176
+ duration?: number;
177
+ }
178
+ interface ClusterStyle {
179
+ /** Custom icon URL. If omitted, a default filled circle is rendered. */
180
+ url?: string;
181
+ width: number;
182
+ height: number;
183
+ textColor?: string;
184
+ textSize?: number;
185
+ backgroundColor?: string;
186
+ /** Pixel offset [x, y] from the anchor point to the top-left of the element. */
187
+ anchor?: [number, number];
188
+ }
189
+ interface ClusterOptions {
190
+ /** Minimum number of markers required to form a cluster. Default: 2 */
191
+ minClusterSize?: number;
192
+ /** Above this facade zoom level, clustering is disabled. Default: 15 */
193
+ maxZoom?: number;
194
+ /** Size of each grid cell in pixels. Default: 60 */
195
+ gridSize?: number;
196
+ /** Per-tier styles (index 0 = small, 1 = medium, 2 = large). Defaults to built-in circles. */
197
+ styles?: ClusterStyle[];
198
+ /** Place cluster pin at centroid of its markers. Default: false (uses first marker position) */
199
+ averageCenter?: boolean;
200
+ }
201
+
202
+ declare class KorMapError extends Error {
203
+ readonly provider: MapProvider | undefined;
204
+ readonly originalError: unknown;
205
+ constructor(message: string, options?: {
206
+ provider?: MapProvider;
207
+ cause?: unknown;
208
+ });
209
+ }
210
+ declare class ProviderLoadError extends KorMapError {
211
+ constructor(provider: MapProvider, cause?: unknown);
212
+ }
213
+ declare class ProviderNotSupportedError extends KorMapError {
214
+ readonly feature: KorMapFeature;
215
+ constructor(provider: MapProvider, feature: KorMapFeature);
216
+ }
217
+ declare class ConfigurationError extends KorMapError {
218
+ constructor(message: string);
219
+ }
220
+
221
+ export { type AnyEventHandler as A, type ClusterOptions as C, type EventListener as E, type FillStyle as F, type GenericEventHandler as G, type InfoWindowOptions as I, type KorMapApiKey as K, type LatLng as L, type MapMouseEvent as M, type OverlayEvent as O, type Padding as P, type RectangleOptions as R, type Size as S, type TileCoord as T, type CircleOptions as a, type ClusterStyle as b, ConfigurationError as c, type CustomOverlayOptions as d, type FitBoundsOptions as e, type KorMapConfig as f, KorMapError as g, type KorMapEvent as h, type KorMapFeature as i, type LatLngBounds as j, type MapProjection as k, type MapProvider as l, MapTypeId as m, MarkerAnimation as n, type MarkerIcon as o, type MarkerLabel as p, type MarkerOptions as q, type PanOptions as r, type Point as s, type PolygonOptions as t, type PolylineOptions as u, ProviderLoadError as v, ProviderNotSupportedError as w, type StrokeStyle as x, type TileLayerOptions as y, type MapEventHandler as z };
@@ -0,0 +1 @@
1
+ export { A as AnyEventHandler, a as CircleOptions, c as ConfigurationError, d as CustomOverlayOptions, E as EventListener, F as FillStyle, e as FitBoundsOptions, G as GenericEventHandler, I as InfoWindowOptions, K as KorMapApiKey, f as KorMapConfig, g as KorMapError, h as KorMapEvent, i as KorMapFeature, L as LatLng, j as LatLngBounds, z as MapEventHandler, M as MapMouseEvent, k as MapProjection, l as MapProvider, m as MapTypeId, n as MarkerAnimation, o as MarkerIcon, p as MarkerLabel, q as MarkerOptions, O as OverlayEvent, P as Padding, r as PanOptions, s as Point, t as PolygonOptions, u as PolylineOptions, v as ProviderLoadError, w as ProviderNotSupportedError, R as RectangleOptions, S as Size, x as StrokeStyle, T as TileCoord, y as TileLayerOptions } from './types-BWnSkE6e.js';
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ export { MapTypeId, MarkerAnimation } from './chunk-HUS54ONW.js';
2
+ //# sourceMappingURL=types.js.map
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "kor-mapi",
3
+ "version": "0.1.0",
4
+ "description": "Provider-agnostic Korean map facade for Naver Maps, Kakao Maps, and Google Maps",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "types": "./dist/index.d.ts"
10
+ },
11
+ "./core": {
12
+ "import": "./dist/core.js",
13
+ "types": "./dist/core.d.ts"
14
+ },
15
+ "./types": {
16
+ "types": "./dist/types.d.ts"
17
+ }
18
+ },
19
+ "main": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "files": ["dist"],
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "typecheck": "tsc --noEmit",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "demo": "vite demo --port 3000"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "^5.4.0",
31
+ "tsup": "^8.0.0",
32
+ "vitest": "^2.0.0",
33
+ "vite": "^5.0.0"
34
+ }
35
+ }