@arenarium/maps 1.0.50 → 1.0.51
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 +200 -77
- package/dist/index.js +48 -48
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,31 @@ declare const mapCoordinateSchema: z.ZodObject<{
|
|
|
12
12
|
lat: number;
|
|
13
13
|
lng: number;
|
|
14
14
|
}>;
|
|
15
|
+
declare const mapPositionSchema: z.ZodObject<{
|
|
16
|
+
center: z.ZodObject<{
|
|
17
|
+
lat: z.ZodNumber;
|
|
18
|
+
lng: z.ZodNumber;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
lat: number;
|
|
21
|
+
lng: number;
|
|
22
|
+
}, {
|
|
23
|
+
lat: number;
|
|
24
|
+
lng: number;
|
|
25
|
+
}>;
|
|
26
|
+
zoom: z.ZodNumber;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
center: {
|
|
29
|
+
lat: number;
|
|
30
|
+
lng: number;
|
|
31
|
+
};
|
|
32
|
+
zoom: number;
|
|
33
|
+
}, {
|
|
34
|
+
center: {
|
|
35
|
+
lat: number;
|
|
36
|
+
lng: number;
|
|
37
|
+
};
|
|
38
|
+
zoom: number;
|
|
39
|
+
}>;
|
|
15
40
|
declare const mapBoundsSchema: z.ZodObject<{
|
|
16
41
|
sw: z.ZodObject<{
|
|
17
42
|
lat: z.ZodNumber;
|
|
@@ -115,6 +140,76 @@ declare const mapOptionsSchema: z.ZodObject<{
|
|
|
115
140
|
};
|
|
116
141
|
zoom: number;
|
|
117
142
|
}>;
|
|
143
|
+
restriction: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
minZoom: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
maxZoom: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
maxBounds: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
sw: z.ZodObject<{
|
|
148
|
+
lat: z.ZodNumber;
|
|
149
|
+
lng: z.ZodNumber;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
lat: number;
|
|
152
|
+
lng: number;
|
|
153
|
+
}, {
|
|
154
|
+
lat: number;
|
|
155
|
+
lng: number;
|
|
156
|
+
}>;
|
|
157
|
+
ne: z.ZodObject<{
|
|
158
|
+
lat: z.ZodNumber;
|
|
159
|
+
lng: z.ZodNumber;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
lat: number;
|
|
162
|
+
lng: number;
|
|
163
|
+
}, {
|
|
164
|
+
lat: number;
|
|
165
|
+
lng: number;
|
|
166
|
+
}>;
|
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
|
+
sw: {
|
|
169
|
+
lat: number;
|
|
170
|
+
lng: number;
|
|
171
|
+
};
|
|
172
|
+
ne: {
|
|
173
|
+
lat: number;
|
|
174
|
+
lng: number;
|
|
175
|
+
};
|
|
176
|
+
}, {
|
|
177
|
+
sw: {
|
|
178
|
+
lat: number;
|
|
179
|
+
lng: number;
|
|
180
|
+
};
|
|
181
|
+
ne: {
|
|
182
|
+
lat: number;
|
|
183
|
+
lng: number;
|
|
184
|
+
};
|
|
185
|
+
}>>;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
minZoom?: number | undefined;
|
|
188
|
+
maxZoom?: number | undefined;
|
|
189
|
+
maxBounds?: {
|
|
190
|
+
sw: {
|
|
191
|
+
lat: number;
|
|
192
|
+
lng: number;
|
|
193
|
+
};
|
|
194
|
+
ne: {
|
|
195
|
+
lat: number;
|
|
196
|
+
lng: number;
|
|
197
|
+
};
|
|
198
|
+
} | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
minZoom?: number | undefined;
|
|
201
|
+
maxZoom?: number | undefined;
|
|
202
|
+
maxBounds?: {
|
|
203
|
+
sw: {
|
|
204
|
+
lat: number;
|
|
205
|
+
lng: number;
|
|
206
|
+
};
|
|
207
|
+
ne: {
|
|
208
|
+
lat: number;
|
|
209
|
+
lng: number;
|
|
210
|
+
};
|
|
211
|
+
} | undefined;
|
|
212
|
+
}>>;
|
|
118
213
|
style: z.ZodObject<{
|
|
119
214
|
name: z.ZodUnion<[
|
|
120
215
|
z.ZodLiteral<"dark">,
|
|
@@ -151,56 +246,6 @@ declare const mapOptionsSchema: z.ZodObject<{
|
|
|
151
246
|
};
|
|
152
247
|
url?: string | undefined;
|
|
153
248
|
}>;
|
|
154
|
-
events: z.ZodOptional<z.ZodObject<{
|
|
155
|
-
onMapIdle: z.ZodOptional<z.ZodFunction<z.ZodTuple<[
|
|
156
|
-
], z.ZodUnknown>, z.ZodVoid>>;
|
|
157
|
-
onMapMove: z.ZodOptional<z.ZodFunction<z.ZodTuple<[
|
|
158
|
-
z.ZodObject<{
|
|
159
|
-
lat: z.ZodNumber;
|
|
160
|
-
lng: z.ZodNumber;
|
|
161
|
-
zoom: z.ZodNumber;
|
|
162
|
-
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
lat: number;
|
|
164
|
-
lng: number;
|
|
165
|
-
zoom: number;
|
|
166
|
-
}, {
|
|
167
|
-
lat: number;
|
|
168
|
-
lng: number;
|
|
169
|
-
zoom: number;
|
|
170
|
-
}>
|
|
171
|
-
], z.ZodUnknown>, z.ZodVoid>>;
|
|
172
|
-
onMapClick: z.ZodOptional<z.ZodFunction<z.ZodTuple<[
|
|
173
|
-
], z.ZodUnknown>, z.ZodVoid>>;
|
|
174
|
-
onPopupClick: z.ZodOptional<z.ZodFunction<z.ZodTuple<[
|
|
175
|
-
z.ZodString
|
|
176
|
-
], z.ZodUnknown>, z.ZodVoid>>;
|
|
177
|
-
onLoadingStart: z.ZodOptional<z.ZodFunction<z.ZodTuple<[
|
|
178
|
-
], z.ZodUnknown>, z.ZodVoid>>;
|
|
179
|
-
onLoadingEnd: z.ZodOptional<z.ZodFunction<z.ZodTuple<[
|
|
180
|
-
], z.ZodUnknown>, z.ZodVoid>>;
|
|
181
|
-
}, "strip", z.ZodTypeAny, {
|
|
182
|
-
onMapIdle?: ((...args: unknown[]) => void) | undefined;
|
|
183
|
-
onMapMove?: ((args_0: {
|
|
184
|
-
lat: number;
|
|
185
|
-
lng: number;
|
|
186
|
-
zoom: number;
|
|
187
|
-
}, ...args: unknown[]) => void) | undefined;
|
|
188
|
-
onMapClick?: ((...args: unknown[]) => void) | undefined;
|
|
189
|
-
onPopupClick?: ((args_0: string, ...args: unknown[]) => void) | undefined;
|
|
190
|
-
onLoadingStart?: ((...args: unknown[]) => void) | undefined;
|
|
191
|
-
onLoadingEnd?: ((...args: unknown[]) => void) | undefined;
|
|
192
|
-
}, {
|
|
193
|
-
onMapIdle?: ((...args: unknown[]) => void) | undefined;
|
|
194
|
-
onMapMove?: ((args_0: {
|
|
195
|
-
lat: number;
|
|
196
|
-
lng: number;
|
|
197
|
-
zoom: number;
|
|
198
|
-
}, ...args: unknown[]) => void) | undefined;
|
|
199
|
-
onMapClick?: ((...args: unknown[]) => void) | undefined;
|
|
200
|
-
onPopupClick?: ((args_0: string, ...args: unknown[]) => void) | undefined;
|
|
201
|
-
onLoadingStart?: ((...args: unknown[]) => void) | undefined;
|
|
202
|
-
onLoadingEnd?: ((...args: unknown[]) => void) | undefined;
|
|
203
|
-
}>>;
|
|
204
249
|
}, "strip", z.ZodTypeAny, {
|
|
205
250
|
container: string;
|
|
206
251
|
position: {
|
|
@@ -219,17 +264,19 @@ declare const mapOptionsSchema: z.ZodObject<{
|
|
|
219
264
|
};
|
|
220
265
|
url?: string | undefined;
|
|
221
266
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
267
|
+
restriction?: {
|
|
268
|
+
minZoom?: number | undefined;
|
|
269
|
+
maxZoom?: number | undefined;
|
|
270
|
+
maxBounds?: {
|
|
271
|
+
sw: {
|
|
272
|
+
lat: number;
|
|
273
|
+
lng: number;
|
|
274
|
+
};
|
|
275
|
+
ne: {
|
|
276
|
+
lat: number;
|
|
277
|
+
lng: number;
|
|
278
|
+
};
|
|
279
|
+
} | undefined;
|
|
233
280
|
} | undefined;
|
|
234
281
|
}, {
|
|
235
282
|
container: string;
|
|
@@ -249,19 +296,88 @@ declare const mapOptionsSchema: z.ZodObject<{
|
|
|
249
296
|
};
|
|
250
297
|
url?: string | undefined;
|
|
251
298
|
};
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
299
|
+
restriction?: {
|
|
300
|
+
minZoom?: number | undefined;
|
|
301
|
+
maxZoom?: number | undefined;
|
|
302
|
+
maxBounds?: {
|
|
303
|
+
sw: {
|
|
304
|
+
lat: number;
|
|
305
|
+
lng: number;
|
|
306
|
+
};
|
|
307
|
+
ne: {
|
|
308
|
+
lat: number;
|
|
309
|
+
lng: number;
|
|
310
|
+
};
|
|
311
|
+
} | undefined;
|
|
263
312
|
} | undefined;
|
|
264
313
|
}>;
|
|
314
|
+
export type MapCoordinate = z.infer<typeof mapCoordinateSchema>;
|
|
315
|
+
export type MapPosition = z.infer<typeof mapPositionSchema>;
|
|
316
|
+
export type MapBounds = z.infer<typeof mapBoundsSchema>;
|
|
317
|
+
export type MapOptions = z.infer<typeof mapOptionsSchema>;
|
|
318
|
+
export type MapStyle = z.infer<typeof mapStyleSchema>;
|
|
319
|
+
declare const mapEventIdleHandlerSchema: z.ZodFunction<z.ZodTuple<[
|
|
320
|
+
], z.ZodUnknown>, z.ZodVoid>;
|
|
321
|
+
declare const mapEventMoveHandlerSchema: z.ZodFunction<z.ZodTuple<[
|
|
322
|
+
z.ZodObject<{
|
|
323
|
+
center: z.ZodObject<{
|
|
324
|
+
lat: z.ZodNumber;
|
|
325
|
+
lng: z.ZodNumber;
|
|
326
|
+
}, "strip", z.ZodTypeAny, {
|
|
327
|
+
lat: number;
|
|
328
|
+
lng: number;
|
|
329
|
+
}, {
|
|
330
|
+
lat: number;
|
|
331
|
+
lng: number;
|
|
332
|
+
}>;
|
|
333
|
+
zoom: z.ZodNumber;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
center: {
|
|
336
|
+
lat: number;
|
|
337
|
+
lng: number;
|
|
338
|
+
};
|
|
339
|
+
zoom: number;
|
|
340
|
+
}, {
|
|
341
|
+
center: {
|
|
342
|
+
lat: number;
|
|
343
|
+
lng: number;
|
|
344
|
+
};
|
|
345
|
+
zoom: number;
|
|
346
|
+
}>
|
|
347
|
+
], z.ZodUnknown>, z.ZodVoid>;
|
|
348
|
+
declare const mapEventClickHandlerSchema: z.ZodFunction<z.ZodTuple<[
|
|
349
|
+
], z.ZodUnknown>, z.ZodVoid>;
|
|
350
|
+
declare const mapEventPopupClickHandlerSchema: z.ZodFunction<z.ZodTuple<[
|
|
351
|
+
z.ZodString
|
|
352
|
+
], z.ZodUnknown>, z.ZodVoid>;
|
|
353
|
+
declare const mapEventLoadingStartHandlerSchema: z.ZodFunction<z.ZodTuple<[
|
|
354
|
+
], z.ZodUnknown>, z.ZodVoid>;
|
|
355
|
+
declare const mapEventLoadingEndHandlerSchema: z.ZodFunction<z.ZodTuple<[
|
|
356
|
+
], z.ZodUnknown>, z.ZodVoid>;
|
|
357
|
+
export interface EventPayloadMap {
|
|
358
|
+
idle: null;
|
|
359
|
+
move: MapPosition;
|
|
360
|
+
click: null;
|
|
361
|
+
popup_click: string;
|
|
362
|
+
loading_start: null;
|
|
363
|
+
loading_end: null;
|
|
364
|
+
}
|
|
365
|
+
export interface EventHandlerMap {
|
|
366
|
+
idle: MapEventIdleHandler;
|
|
367
|
+
move: MapEventMoveHandler;
|
|
368
|
+
click: MapEventClickHandler;
|
|
369
|
+
popup_click: MapEventPopupClickHandler;
|
|
370
|
+
loading_start: MapEventLoadingStartHandler;
|
|
371
|
+
loading_end: MapEventLoadingEndHandler;
|
|
372
|
+
}
|
|
373
|
+
export type EventId = keyof EventHandlerMap;
|
|
374
|
+
export type EventHandler<E extends EventId> = (payload: EventPayloadMap[E]) => void;
|
|
375
|
+
export type MapEventIdleHandler = z.infer<typeof mapEventIdleHandlerSchema>;
|
|
376
|
+
export type MapEventMoveHandler = z.infer<typeof mapEventMoveHandlerSchema>;
|
|
377
|
+
export type MapEventClickHandler = z.infer<typeof mapEventClickHandlerSchema>;
|
|
378
|
+
export type MapEventPopupClickHandler = z.infer<typeof mapEventPopupClickHandlerSchema>;
|
|
379
|
+
export type MapEventLoadingStartHandler = z.infer<typeof mapEventLoadingStartHandlerSchema>;
|
|
380
|
+
export type MapEventLoadingEndHandler = z.infer<typeof mapEventLoadingEndHandlerSchema>;
|
|
265
381
|
declare const mapPopupSchema: z.ZodObject<{
|
|
266
382
|
id: z.ZodString;
|
|
267
383
|
rank: z.ZodNumber;
|
|
@@ -284,10 +400,6 @@ declare const mapPopupSchema: z.ZodObject<{
|
|
|
284
400
|
width: number;
|
|
285
401
|
height: number;
|
|
286
402
|
}>;
|
|
287
|
-
export type MapCoordinate = z.infer<typeof mapCoordinateSchema>;
|
|
288
|
-
export type MapBounds = z.infer<typeof mapBoundsSchema>;
|
|
289
|
-
export type MapOptions = z.infer<typeof mapOptionsSchema>;
|
|
290
|
-
export type MapStyle = z.infer<typeof mapStyleSchema>;
|
|
291
403
|
export type MapPopup = z.infer<typeof mapPopupSchema>;
|
|
292
404
|
declare namespace Types {
|
|
293
405
|
export interface Popup {
|
|
@@ -310,6 +422,11 @@ declare namespace Types {
|
|
|
310
422
|
number
|
|
311
423
|
][];
|
|
312
424
|
}
|
|
425
|
+
export interface MarkersRequest {
|
|
426
|
+
popups: Popup[];
|
|
427
|
+
minZoom: number;
|
|
428
|
+
maxZoom: number;
|
|
429
|
+
}
|
|
313
430
|
}
|
|
314
431
|
export declare namespace MapComponent {
|
|
315
432
|
type MapPopupContentCallback = (id: string) => Promise<HTMLElement>;
|
|
@@ -322,11 +439,17 @@ export interface MapComponent {
|
|
|
322
439
|
getBounds: () => MapBounds;
|
|
323
440
|
zoomIn: () => void;
|
|
324
441
|
zoomOut: () => void;
|
|
442
|
+
setMinZoom: (zoom: number) => void;
|
|
443
|
+
setMaxZoom: (zoom: number) => void;
|
|
444
|
+
setMaxBounds: (bounds: MapBounds) => void;
|
|
325
445
|
getStyle: () => MapStyle;
|
|
326
446
|
setStyle: (style: MapStyle) => void;
|
|
327
|
-
|
|
447
|
+
updatePopupContentCallback: (callback: MapComponent.MapPopupContentCallback) => Promise<HTMLElement>;
|
|
328
448
|
updatePopups: (popups: Types.Popup[]) => Promise<void>;
|
|
329
449
|
removePopups: () => void;
|
|
450
|
+
on: <E extends EventId>(eventId: E, handler: EventHandler<E>) => void;
|
|
451
|
+
off: <E extends EventId>(eventId: E, handler: EventHandler<E>) => void;
|
|
452
|
+
emit: <E extends EventId>(eventId: E, payload: EventPayloadMap[E]) => void;
|
|
330
453
|
}
|
|
331
454
|
export declare function mountMap(options: MapOptions): MapComponent;
|
|
332
455
|
export declare function unmountMap(map: ReturnType<typeof mountMap>): void;
|