@d3-maps/vue 0.7.0 → 0.9.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.
package/README.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # @d3-maps/vue
2
2
 
3
- Reactive SVG maps, powered by D3.
3
+ Reactive SVG maps, powered by D3
4
4
 
5
- [docs](https://souljorje.github.io/d3-maps)
5
+ [**Docs**](https://souljorje.github.io/d3-maps/guide) · [**Examples**](https://souljorje.github.io/d3-maps/examples)
6
+
7
+ ## Features
8
+
9
+ - Drop-in components, powerful defaults
10
+ - Zoom, drag, lines, markers, and more
11
+ - Reactive rerender
12
+ - Responsive by default
13
+ - Lightweight and tree-shakable
14
+ - SSR friendly
15
+ - Supports TopoJSON and GeoJSON
6
16
 
7
17
  ## Installation
8
18
 
@@ -26,6 +36,27 @@ bun add @d3-maps/vue
26
36
 
27
37
  ## Usage
28
38
 
39
+ ```html
40
+ <script setup lang="ts">
41
+ import type { MapData } from '@d3-maps/core'
42
+
43
+ import { MapBase, MapFeatures } from '@d3-maps/vue'
44
+ defineProps<{
45
+ data: MapData
46
+ }>()
47
+ </script>
48
+
49
+ <template>
50
+ <MapBase :data="data">
51
+ <MapFeatures />
52
+ </MapBase>
53
+ </template>
54
+ ```
55
+
56
+ ### Plugin
57
+
58
+ Registers all components in the app
59
+
29
60
  ```js
30
61
  import { createApp } from 'vue'
31
62
  import { plugin as D3MapsVue } from '@d3-maps/vue'
@@ -47,12 +78,6 @@ export default defineNuxtPlugin((nuxtApp) => {
47
78
  })
48
79
  ```
49
80
 
50
- ## Styling
51
-
52
- Importing `@d3-maps/vue` automatically includes `@d3-maps/core/index.css`
53
-
54
- If you need strict stylesheet ordering, load your global reset/theme styles before importing the adapter entry
55
-
56
81
  ## License
57
82
 
58
83
  MIT licensed. Copyright © 2020 Georgii Bukharov. See [LICENSE](./LICENSE) for more details.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import "@d3-maps/core/index.css";
2
- import * as vue6 from "vue";
3
- import { App, ComputedRef, InjectionKey, MaybeRef, StyleValue } from "vue";
4
- import { ExtendedFeature, ExtendedFeatureCollection, GeoGraticuleGenerator, GeoPath, GeoProjection } from "d3-geo";
2
+ import * as vue0 from "vue";
3
+ import { App, ComputedRef, InjectionKey, MaybeRef, Ref, StyleValue } from "vue";
4
+ import { CurveFactory, CurveFactoryLineOnly } from "d3-shape";
5
+ import { ExtendedFeature, ExtendedFeatureCollection, GeoGraticuleGenerator, GeoPath, GeoPermissibleObjects, GeoProjection } from "d3-geo";
5
6
  import { Topology } from "topojson-specification";
6
7
  import "topojson-client";
7
8
  import { D3ZoomEvent, ZoomBehavior } from "d3-zoom";
@@ -10,7 +11,7 @@ import { D3ZoomEvent, ZoomBehavior } from "d3-zoom";
10
11
  /**
11
12
  * Supported interaction states for map objects.
12
13
  */
13
- declare const mapObjectState: readonly ["default", "hover", "active"];
14
+ declare const mapObjectState: readonly ["default", "hover", "active", "focus"];
14
15
  type MapObjectState = typeof mapObjectState[number];
15
16
  interface MapObjectProps<TStyle = unknown> {
16
17
  styles?: Partial<Record<MapObjectState, TStyle>>;
@@ -109,8 +110,8 @@ type MapData = ExtendedFeatureCollection | Topology;
109
110
  type DataTransformer = (features: MapFeature[]) => MapFeature[];
110
111
  /**
111
112
  * Extra projection method calls to apply before rendering.
112
- *
113
113
  * Use projection method names as keys and method arguments as values.
114
+ *
114
115
  * Example: `{ center: [[0, 20]], rotate: [[0, 0, 0]], scale: 160 }`
115
116
  *
116
117
  * @see https://d3js.org/d3-geo/projection
@@ -152,12 +153,78 @@ interface MapProps {
152
153
  * Adapters provide this context to child layers (features, markers, custom SVG).
153
154
  */
154
155
  interface MapContext {
156
+ /**
157
+ * Resolved SVG width used by the map.
158
+ */
155
159
  width: number;
160
+ /**
161
+ * Resolved SVG height used by the map.
162
+ */
156
163
  height: number;
157
- projection?: GeoProjection;
164
+ /**
165
+ * Configured projection instance shared by map layers.
166
+ */
167
+ projection: GeoProjection;
168
+ /**
169
+ * Normalized feature list after optional transformation.
170
+ */
158
171
  features: MapFeature[];
172
+ /**
173
+ * Shared path generator bound to the map projection.
174
+ */
159
175
  path: GeoPath;
160
- renderMesh: () => ReturnType<GeoPath>;
176
+ /**
177
+ * Renders a TopoJSON mesh path when one is available.
178
+ */
179
+ renderMesh: () => string | null;
180
+ }
181
+ //#endregion
182
+ //#region ../core/src/lib/line.d.ts
183
+ /**
184
+ * Geographic or cartesian line coordinates expressed as ordered `[x, y]` pairs
185
+ */
186
+ type MapLineCoordinates = [number, number][];
187
+ /**
188
+ * D3 curve factory used by custom and cartesian line rendering
189
+ */
190
+ type MapLineCurve = CurveFactory | CurveFactoryLineOnly;
191
+ /**
192
+ * Midpoint adjustment expressed as percentages of the segment length
193
+ *
194
+ * - first value: moves the generated midpoint along the segment direction
195
+ * - second value: moves the generated midpoint perpendicular to the segment direction
196
+ */
197
+ type MapLineMidpoint = [number, number];
198
+ /**
199
+ * Core line rendering options shared by framework adapters
200
+ */
201
+ interface MapLineOptions {
202
+ coordinates: MapLineCoordinates;
203
+ cartesian?: boolean;
204
+ custom?: boolean;
205
+ curve?: MapLineCurve;
206
+ midpoint?: MapLineMidpoint;
207
+ }
208
+ /**
209
+ * Public map line props including map object styling and interaction support
210
+ */
211
+ interface MapLineProps<TStyle = unknown> extends MapObjectProps<TStyle>, MapLineOptions {}
212
+ //#endregion
213
+ //#region ../core/src/lib/annotation.d.ts
214
+ /**
215
+ * Geographic anchor coordinate for an annotation
216
+ */
217
+ type MapAnnotationCoordinates = [number, number];
218
+ /**
219
+ * Public annotation props shared across adapters
220
+ */
221
+ interface MapAnnotationProps<TStyle = unknown> extends MapObjectProps<TStyle> {
222
+ coordinates: MapAnnotationCoordinates;
223
+ length?: number;
224
+ angle?: number;
225
+ margin?: number;
226
+ curve?: MapLineCurve;
227
+ midpoint?: MapLineMidpoint;
161
228
  }
162
229
  //#endregion
163
230
  //#region ../core/src/lib/graticule.d.ts
@@ -185,11 +252,12 @@ type MapMarkerCoordinates = [number, number];
185
252
  * Shared props contract for marker layers.
186
253
  */
187
254
  interface MapMarkerProps<TStyle = unknown> extends MapObjectProps<TStyle> {
188
- coordinates?: MapMarkerCoordinates;
255
+ coordinates: MapMarkerCoordinates;
189
256
  }
190
257
  //#endregion
191
258
  //#region ../core/src/lib/zoom.d.ts
192
259
  interface DefaultZoomBehavior extends ZoomBehavior<SVGSVGElement, unknown> {}
260
+ type ZoomObject = GeoPermissibleObjects;
193
261
  /**
194
262
  * Extra zoom method calls to apply before rendering.
195
263
  *
@@ -200,21 +268,82 @@ interface DefaultZoomBehavior extends ZoomBehavior<SVGSVGElement, unknown> {}
200
268
  */
201
269
  interface ZoomModifiers extends MethodsToModifiers<DefaultZoomBehavior> {}
202
270
  interface ZoomProps {
271
+ /**
272
+ * Projected map-space point to keep centered in the viewport.
273
+ *
274
+ * If omitted, changing `zoom` alone preserves the current viewport center.
275
+ */
203
276
  center?: [number, number];
204
277
  zoom?: number;
205
278
  minZoom?: number;
206
279
  maxZoom?: number;
280
+ transition?: ZoomTransition;
207
281
  config?: ZoomModifiers;
208
282
  }
283
+ /**
284
+ * D3 zoom event used by adapter components and hooks.
285
+ */
209
286
  interface ZoomEvent extends D3ZoomEvent<SVGSVGElement, unknown> {}
287
+ /**
288
+ * Zoom lifecycle callbacks forwarded from the underlying D3 zoom behavior.
289
+ */
290
+ interface ZoomEvents {
291
+ onZoomStart?: (event: ZoomEvent) => void;
292
+ onZoom?: (event: ZoomEvent) => void;
293
+ onZoomEnd?: (event: ZoomEvent) => void;
294
+ }
295
+ /**
296
+ * Full zoom behavior configuration, including view props and event callbacks.
297
+ */
298
+ interface ZoomBehaviorOptions extends ZoomProps, ZoomEvents {}
299
+ /**
300
+ * Transition settings for programmatic zoom updates.
301
+ */
302
+ interface ZoomTransition {
303
+ duration?: number;
304
+ delay?: number;
305
+ ease?: (normalizedTime: number) => number;
306
+ }
307
+ /**
308
+ * Computed zoom target for an object fit operation.
309
+ */
310
+ interface ObjectZoomView {
311
+ center: [number, number];
312
+ zoom: number;
313
+ }
314
+ /**
315
+ * Creates a D3 zoom behavior configured for the current map viewport.
316
+ */
317
+ declare function createZoomBehavior(context?: Pick<MapContext, 'width' | 'height'>, options?: ZoomBehaviorOptions): DefaultZoomBehavior;
318
+ //#endregion
319
+ //#region src/components/MapAnnotation.vue.d.ts
320
+ type __VLS_Props$5 = MapAnnotationProps<StyleValue>;
321
+ declare var __VLS_13: {};
322
+ type __VLS_Slots$4 = {} & {
323
+ default?: (props: typeof __VLS_13) => any;
324
+ };
325
+ declare const __VLS_base$4: vue0.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props$5> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
326
+ declare const __VLS_export$8: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
327
+ declare const _default: typeof __VLS_export$8;
328
+ type __VLS_WithSlots$4<T, S> = T & {
329
+ new (): {
330
+ $slots: S;
331
+ };
332
+ };
210
333
  //#endregion
211
334
  //#region src/components/MapBase.vue.d.ts
335
+ type MapConfigProps = MapProps & {
336
+ context?: undefined;
337
+ };
338
+ type MapContextProps = Partial<MapProps> & {
339
+ context: MapContext;
340
+ };
212
341
  type __VLS_Slots$3 = {
213
342
  default?: (props: MapContext) => unknown;
214
343
  };
215
- declare const __VLS_base$3: vue6.DefineComponent<MapProps, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<MapProps> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
216
- declare const __VLS_export$6: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
217
- declare const _default: typeof __VLS_export$6;
344
+ declare const __VLS_base$3: vue0.DefineComponent<MapConfigProps | MapContextProps, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<MapConfigProps | MapContextProps> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
345
+ declare const __VLS_export$7: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
346
+ declare const _default$1: typeof __VLS_export$7;
218
347
  type __VLS_WithSlots$3<T, S> = T & {
219
348
  new (): {
220
349
  $slots: S;
@@ -223,8 +352,8 @@ type __VLS_WithSlots$3<T, S> = T & {
223
352
  //#endregion
224
353
  //#region src/components/MapFeature.vue.d.ts
225
354
  type __VLS_Props$4 = MapFeatureProps<StyleValue>;
226
- declare const __VLS_export$5: vue6.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$4> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
227
- declare const _default$1: typeof __VLS_export$5;
355
+ declare const __VLS_export$6: vue0.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props$4> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
356
+ declare const _default$2: typeof __VLS_export$6;
228
357
  //#endregion
229
358
  //#region src/components/MapFeatures.vue.d.ts
230
359
  type __VLS_Props$3 = MapFeaturesProps<StyleValue>;
@@ -234,11 +363,11 @@ declare var __VLS_1$2: {
234
363
  type __VLS_Slots$2 = {} & {
235
364
  default?: (props: typeof __VLS_1$2) => any;
236
365
  };
237
- declare const __VLS_base$2: vue6.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$3> & Readonly<{}>, {
366
+ declare const __VLS_base$2: vue0.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props$3> & Readonly<{}>, {
238
367
  idKey: string;
239
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
240
- declare const __VLS_export$4: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
241
- declare const _default$2: typeof __VLS_export$4;
368
+ }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
369
+ declare const __VLS_export$5: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
370
+ declare const _default$3: typeof __VLS_export$5;
242
371
  type __VLS_WithSlots$2<T, S> = T & {
243
372
  new (): {
244
373
  $slots: S;
@@ -247,20 +376,30 @@ type __VLS_WithSlots$2<T, S> = T & {
247
376
  //#endregion
248
377
  //#region src/components/MapGraticule.vue.d.ts
249
378
  type __VLS_Props$2 = MapGraticuleProps<StyleValue>;
250
- declare const __VLS_export$3: vue6.DefineComponent<__VLS_Props$2, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$2> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
251
- declare const _default$3: typeof __VLS_export$3;
379
+ declare const __VLS_export$4: vue0.DefineComponent<__VLS_Props$2, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props$2> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
380
+ declare const _default$4: typeof __VLS_export$4;
381
+ //#endregion
382
+ //#region src/components/MapLine.vue.d.ts
383
+ type __VLS_Props$1 = MapLineProps<StyleValue>;
384
+ declare const __VLS_export$3: vue0.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {
385
+ cartesian: boolean;
386
+ custom: boolean;
387
+ }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
388
+ declare const _default$5: typeof __VLS_export$3;
252
389
  //#endregion
253
390
  //#region src/components/MapMarker.vue.d.ts
254
- type __VLS_Props$1 = MapMarkerProps<StyleValue>;
391
+ interface Props extends MapMarkerProps<StyleValue> {
392
+ name?: string;
393
+ }
255
394
  declare var __VLS_1$1: {};
256
395
  type __VLS_Slots$1 = {} & {
257
396
  default?: (props: typeof __VLS_1$1) => any;
258
397
  };
259
- declare const __VLS_base$1: vue6.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {
260
- coordinates: MapMarkerCoordinates;
261
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
398
+ declare const __VLS_base$1: vue0.DefineComponent<Props, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<Props> & Readonly<{}>, {
399
+ name: string;
400
+ }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
262
401
  declare const __VLS_export$2: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
263
- declare const _default$4: typeof __VLS_export$2;
402
+ declare const _default$6: typeof __VLS_export$2;
264
403
  type __VLS_WithSlots$1<T, S> = T & {
265
404
  new (): {
266
405
  $slots: S;
@@ -269,53 +408,88 @@ type __VLS_WithSlots$1<T, S> = T & {
269
408
  //#endregion
270
409
  //#region src/components/MapMesh.vue.d.ts
271
410
  type __VLS_Props = MapObjectProps<StyleValue>;
272
- declare const __VLS_export$1: vue6.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
273
- declare const _default$5: typeof __VLS_export$1;
411
+ declare const __VLS_export$1: vue0.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
412
+ declare const _default$7: typeof __VLS_export$1;
274
413
  //#endregion
275
414
  //#region src/components/MapZoom.vue.d.ts
276
415
  declare var __VLS_1: {};
277
416
  type __VLS_Slots = {} & {
278
417
  default?: (props: typeof __VLS_1) => any;
279
418
  };
280
- declare const __VLS_base: vue6.DefineComponent<ZoomProps, {
281
- container: vue6.Ref<SVGGElement | null, SVGGElement | null>;
282
- zoomBehavior: vue6.ComputedRef<DefaultZoomBehavior>;
283
- }, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {} & {
419
+ declare const __VLS_base: vue0.DefineComponent<ZoomProps, {
420
+ container: vue0.Ref<SVGGElement | null, SVGGElement | null>;
421
+ zoomBehavior: vue0.ComputedRef<DefaultZoomBehavior>;
422
+ }, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {} & {
284
423
  zoom: (payload: ZoomEvent) => any;
285
- zoomstart: (payload: ZoomEvent) => any;
286
- zoomend: (payload: ZoomEvent) => any;
287
- }, string, vue6.PublicProps, Readonly<ZoomProps> & Readonly<{
424
+ zoomStart: (payload: ZoomEvent) => any;
425
+ zoomEnd: (payload: ZoomEvent) => any;
426
+ "update:center": (payload: [number, number]) => any;
427
+ "update:zoom": (payload: number) => any;
428
+ }, string, vue0.PublicProps, Readonly<ZoomProps> & Readonly<{
288
429
  onZoom?: ((payload: ZoomEvent) => any) | undefined;
289
- onZoomstart?: ((payload: ZoomEvent) => any) | undefined;
290
- onZoomend?: ((payload: ZoomEvent) => any) | undefined;
430
+ onZoomStart?: ((payload: ZoomEvent) => any) | undefined;
431
+ onZoomEnd?: ((payload: ZoomEvent) => any) | undefined;
432
+ "onUpdate:center"?: ((payload: [number, number]) => any) | undefined;
433
+ "onUpdate:zoom"?: ((payload: number) => any) | undefined;
291
434
  }>, {
292
- center: [number, number];
293
435
  zoom: number;
294
436
  minZoom: number;
295
437
  maxZoom: number;
296
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
438
+ }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
297
439
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
298
- declare const _default$6: typeof __VLS_export;
440
+ declare const _default$8: typeof __VLS_export;
299
441
  type __VLS_WithSlots<T, S> = T & {
300
442
  new (): {
301
443
  $slots: S;
302
444
  };
303
445
  };
304
446
  //#endregion
447
+ //#region src/hooks/useCreateMapContext.d.ts
448
+ declare function useCreateMapContext(config?: MaybeRef<Partial<MapProps> | undefined>, context?: MaybeRef<MapContext | undefined>): ComputedRef<MapContext | undefined>;
449
+ //#endregion
305
450
  //#region src/hooks/useMapContext.d.ts
306
451
  declare const mapContextKey: InjectionKey<ComputedRef<MapContext>>;
307
- declare function useMapContext(): ComputedRef<MapContext> | undefined;
452
+ declare function useMapContext(): ComputedRef<MapContext>;
308
453
  //#endregion
309
454
  //#region src/hooks/useMapObject.d.ts
310
455
  interface UseMapObjectResult {
311
456
  style: ComputedRef<StyleValue | undefined>;
312
- onMouseenter: (event: MouseEvent) => void;
313
- onMouseleave: (event: MouseEvent) => void;
457
+ onMouseenter: () => void;
458
+ onMouseleave: () => void;
314
459
  onMousedown: (event: MouseEvent) => void;
315
- onMouseup: (event: MouseEvent) => void;
460
+ onMouseup: () => void;
461
+ onFocus: () => void;
462
+ onBlur: () => void;
316
463
  }
317
464
  declare function useMapObject(styles: MaybeRef<Partial<Record<MapObjectState, StyleValue>> | undefined>): UseMapObjectResult;
318
465
  //#endregion
466
+ //#region src/hooks/useMapZoom.d.ts
467
+ type ZoomToObjectCallback = (view: ObjectZoomView) => void;
468
+ interface UseMapZoomResult {
469
+ center: ComputedRef<[number, number] | undefined>;
470
+ zoom: ComputedRef<number>;
471
+ minZoom: ComputedRef<number>;
472
+ maxZoom: ComputedRef<number>;
473
+ zoomToObject: (object: ZoomObject, callback: ZoomToObjectCallback) => void;
474
+ }
475
+ declare const mapZoomKey: InjectionKey<UseMapZoomResult>;
476
+ interface MapZoomEventCallbacks {
477
+ onZoomStart?: (event: ZoomEvent) => void;
478
+ onZoom?: (event: ZoomEvent) => void;
479
+ onZoomEnd?: (event: ZoomEvent) => void;
480
+ }
481
+ interface ZoomPropsWithDefaults extends ZoomProps {
482
+ zoom: number;
483
+ minZoom: number;
484
+ maxZoom: number;
485
+ }
486
+ interface CreateMapZoomResult {
487
+ zoomBehavior: ComputedRef<ReturnType<typeof createZoomBehavior>>;
488
+ zoomContext: UseMapZoomResult;
489
+ }
490
+ declare function useCreateMapZoom(container: Ref<SVGGElement | null>, props: Readonly<ZoomPropsWithDefaults>, eventCallbacks: MapZoomEventCallbacks): CreateMapZoomResult;
491
+ declare function useMapZoom(): UseMapZoomResult | undefined;
492
+ //#endregion
319
493
  //#region src/plugin.d.ts
320
494
  /**
321
495
  * Vue plugin that registers all d3-maps components globally.
@@ -324,4 +498,4 @@ declare const plugin: {
324
498
  install(app: App): void;
325
499
  };
326
500
  //#endregion
327
- export { _default as MapBase, _default$1 as MapFeature, _default$2 as MapFeatures, _default$3 as MapGraticule, _default$4 as MapMarker, _default$5 as MapMesh, _default$6 as MapZoom, UseMapObjectResult, mapContextKey, plugin, useMapContext, useMapObject };
501
+ export { CreateMapZoomResult, _default as MapAnnotation, _default$1 as MapBase, _default$2 as MapFeature, _default$3 as MapFeatures, _default$4 as MapGraticule, _default$5 as MapLine, _default$6 as MapMarker, _default$7 as MapMesh, _default$8 as MapZoom, MapZoomEventCallbacks, UseMapObjectResult, UseMapZoomResult, ZoomPropsWithDefaults, ZoomToObjectCallback, mapContextKey, mapZoomKey, plugin, useCreateMapContext, useCreateMapZoom, useMapContext, useMapObject, useMapZoom };
@@ -1 +1 @@
1
- (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t&&i(n,Symbol.toStringTag,{value:`Module`}),n};let o=Symbol(`MapContext`);function s(){return(0,n.inject)(o)}let c=[`viewBox`];var l=(0,n.defineComponent)({__name:`MapBase`,props:{width:{},height:{},aspectRatio:{},projection:{type:Function},projectionConfig:{},data:{},dataTransformer:{type:Function}},setup(e){let t=e,i=(0,n.computed)(()=>(0,r.makeMapContext)({width:t.width,height:t.height,aspectRatio:t.aspectRatio,projection:t.projection,projectionConfig:t.projectionConfig,data:t.data,dataTransformer:t.dataTransformer}));return(0,n.provide)(o,i),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`svg`,(0,n.mergeProps)({viewBox:`0 0 ${i.value.width} ${i.value.height}`},e.$attrs,{class:`d3-map`}),[(0,n.renderSlot)(e.$slots,`default`,(0,n.normalizeProps)((0,n.guardReactiveProps)(i.value)))],16,c))}});let u=Symbol(`InsideZoom`);function d(){return(0,n.inject)(u,!1)}function f(e){let t=(0,n.ref)(`default`),{onMouseenter:i,onMouseleave:a,onMouseup:o,onMousedown:s,dispose:c}=(0,r.useMapObjectEvents)(e=>{t.value=e},d());return(0,n.onBeforeUnmount)(()=>{c()}),{style:(0,n.computed)(()=>(0,r.resolveObjectStyle)(t.value,(0,n.unref)(e))),onMouseenter:i,onMouseleave:a,onMousedown:s,onMouseup:o}}let p=[`d`];var m=(0,n.defineComponent)({__name:`MapFeature`,props:{data:{},styles:{}},setup(e){let t=e,{style:r,...i}=f((0,n.toRef)(t,`styles`)),a=s(),o=(0,n.computed)(()=>a?.value.path(t.data)??void 0);return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)({d:o.value,style:(0,n.unref)(r)},i,{name:`feature`}),null,16,p))}});let h={name:`features`};var g=(0,n.defineComponent)({__name:`MapFeatures`,props:{idKey:{default:`id`},styles:{}},setup(e){let t=s(),i=(0,n.computed)(()=>t?.value.features??[]);return(t,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,h,[(0,n.renderSlot)(t.$slots,`default`,{features:i.value},()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,(t,i)=>((0,n.openBlock)(),(0,n.createBlock)(m,{key:(0,n.unref)(r.getFeatureKey)(t,e.idKey,i),data:t,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let _=[`d`,`fill`],v=[`d`],y=[`d`,`stroke`];var b=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapGraticule`,props:{config:{},background:{type:[Boolean,String]},border:{type:[Boolean,String]},styles:{}},setup(e){let t=e,i=s(),a=(0,n.useAttrs)(),o=(0,n.computed)(()=>{if(i?.value)return(0,r.renderGraticule)(i.value,t.config)??void 0}),c=(0,n.computed)(()=>{if(i?.value)return(0,r.renderOutline)(i.value)??void 0}),l=(0,n.computed)(()=>(0,r.isString)(t.background)?t.background:void 0),u=(0,n.computed)(()=>(0,r.isString)(t.border)?t.border:void 0),{style:d,...p}=f((0,n.toRef)(t,`styles`));return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,null,[e.background?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:0,d:c.value,fill:l.value,"pointer-events":`none`,name:`background`},null,8,_)):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`path`,(0,n.mergeProps)({d:o.value,fill:`none`,style:(0,n.unref)(d)},(0,n.mergeProps)(p,(0,n.unref)(a)),{name:`graticule`}),null,16,v),e.border?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:1,d:c.value,fill:`none`,stroke:u.value,"pointer-events":`none`,name:`border`},null,8,y)):(0,n.createCommentVNode)(`v-if`,!0)]))}});let x=[`transform`];var S=(0,n.defineComponent)({__name:`MapMarker`,props:{coordinates:{default:()=>[0,0]},styles:{}},setup(e){let t=e,i=s(),a=(0,n.computed)(()=>(0,r.getMarkerTransform)(i?.value,t.coordinates)),{style:o,...c}=f((0,n.toRef)(t,`styles`));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,(0,n.mergeProps)({transform:a.value,style:(0,n.unref)(o)},c,{name:`marker`}),[(0,n.renderSlot)(e.$slots,`default`)],16,x))}});let C=[`d`];var w=(0,n.defineComponent)({__name:`MapMesh`,props:{styles:{}},setup(e){let t=e,r=s(),i=(0,n.computed)(()=>r?.value.renderMesh()??void 0),{style:a,...o}=f((0,n.toRef)(t,`styles`));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)({d:i.value,fill:`none`,style:(0,n.unref)(a)},o,{name:`mesh`}),null,16,C))}}),T=(0,n.defineComponent)({__name:`MapZoom`,props:{center:{default:()=>[0,0]},zoom:{default:1},minZoom:{default:1},maxZoom:{default:8},config:{}},emits:[`zoomstart`,`zoom`,`zoomend`],setup(e,{expose:t,emit:i}){let a=e,o=i,c=(0,n.ref)(null),l=s();(0,n.provide)(u,!0);let d=(0,n.computed)(()=>(0,r.createZoomBehavior)(l?.value,{minZoom:a.minZoom,maxZoom:a.maxZoom,config:a.config,onZoomStart:e=>o(`zoomstart`,e),onZoom:e=>{(0,r.applyZoomGroupTransform)(c.value,e.transform),o(`zoom`,e)},onZoomEnd:e=>o(`zoomend`,e)}));return(0,n.onMounted)(()=>{(0,n.watch)(d,e=>{c.value&&(0,r.setupZoom)({element:c.value,behavior:e,center:a.center,zoom:a.zoom})},{immediate:!0}),(0,n.watch)(()=>[d.value,a.center[0],a.center[1],a.zoom],()=>{c.value&&(0,r.applyZoomTransform)({element:c.value,behavior:d.value,center:a.center,zoom:a.zoom})})}),t({container:c,zoomBehavior:d}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,{ref_key:`container`,ref:c,name:`zoom`},[(0,n.renderSlot)(e.$slots,`default`)],512))}}),E=a({MapBase:()=>l,MapFeature:()=>m,MapFeatures:()=>g,MapGraticule:()=>b,MapMarker:()=>S,MapMesh:()=>w,MapZoom:()=>T});e.MapBase=l,e.MapFeature=m,e.MapFeatures=g,e.MapGraticule=b,e.MapMarker=S,e.MapMesh=w,e.MapZoom=T,e.mapContextKey=o,e.plugin={install(e){Object.entries(E).forEach(([t,n])=>{e.component(t,n)})}},e.useMapContext=s,e.useMapObject=f})(this.D3Maps=this.D3Maps||{},_d3_maps_core_index_css,Vue,D3Maps);
1
+ (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t&&i(n,Symbol.toStringTag,{value:`Module`}),n};let o=Symbol(`MapContext`);function s(){let e=(0,n.inject)(o);if(!e)throw Error(`useMapContext must be used inside Map`);return e}let c=Symbol(`MapZoom`);function l(e,t,i){let a=s(),o=(0,n.computed)(()=>t.center?.[0]),l=(0,n.computed)(()=>t.center?.[1]),u=(0,n.computed)(()=>(0,r.createZoomBehavior)(a.value,{minZoom:t.minZoom,maxZoom:t.maxZoom,config:t.config,onZoomStart:e=>i.onZoomStart?.(e),onZoom:t=>{(0,r.applyZoomGroupTransform)(e.value,t.transform),i.onZoom?.(t)},onZoomEnd:e=>i.onZoomEnd?.(e)})),d={center:(0,n.computed)(()=>t.center),zoom:(0,n.computed)(()=>t.zoom),minZoom:(0,n.computed)(()=>t.minZoom),maxZoom:(0,n.computed)(()=>t.maxZoom),zoomToObject:(e,n)=>{let i=(0,r.getObjectZoomView)(a.value,e,{minZoom:t.minZoom,maxZoom:t.maxZoom});i&&n(i)}};(0,n.provide)(c,d);let f,p;return(0,n.onMounted)(()=>{f=(0,n.watch)(u,t=>{e.value&&(0,r.setupZoom)({element:e.value,behavior:t})},{immediate:!0}),p=(0,n.watch)([o,l,()=>t.zoom,()=>t.transition,u],()=>{e.value&&(0,r.applyZoom)({element:e.value,behavior:u.value,center:t.center,zoom:t.zoom,transition:t.transition})},{immediate:!0})}),(0,n.onUnmounted)(()=>{f?.(),p?.()}),{zoomBehavior:u,zoomContext:d}}function u(){let e=(0,n.inject)(c,void 0),t=(0,n.inject)(o,void 0);if(e)return{...e,zoomToObject:(n,i)=>{if(!t?.value)return;let a=(0,r.getObjectZoomView)(t.value,n,{minZoom:e.minZoom.value,maxZoom:e.maxZoom.value});a&&i(a)}}}function d(e){let t=(0,n.ref)(`default`),{onMouseenter:i,onMouseleave:a,onMouseup:o,onMousedown:s,onFocus:c,onBlur:l,dispose:d}=(0,r.useMapObjectEvents)(e=>{t.value=e},!!u());return(0,n.onBeforeUnmount)(()=>{d()}),{style:(0,n.computed)(()=>(0,r.resolveObjectStyle)(t.value,(0,n.unref)(e))),onMouseenter:i,onMouseleave:a,onMousedown:s,onMouseup:o,onFocus:c,onBlur:l}}let f=[`d`,`fill`];var p=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapLine`,props:{styles:{},coordinates:{},cartesian:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},curve:{},midpoint:{}},setup(e){let t=e,i=(0,n.useAttrs)(),a=s(),o=(0,n.computed)(()=>(0,r.getLinePath)(a.value,{coordinates:t.coordinates,custom:t.custom,curve:t.curve,cartesian:t.cartesian,midpoint:t.midpoint})),c=(0,n.computed)(()=>i.name??`line`),l=(0,n.computed)(()=>i.fill??`none`),{style:u,...p}=d((0,n.toRef)(t,`styles`)),m=(0,n.computed)(()=>({...i,...p,name:c.value}));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)(m.value,{d:o.value,fill:l.value,style:(0,n.unref)(u)}),null,16,f))}});let m=[`transform`,`name`];var h=(0,n.defineComponent)({__name:`MapMarker`,props:{name:{default:`marker`},coordinates:{},styles:{}},setup(e){let t=e,i=s(),a=(0,n.computed)(()=>(0,r.getMarkerTransform)(i.value,t.coordinates)),{style:o,...c}=d((0,n.toRef)(t,`styles`));return(t,r)=>a.value?((0,n.openBlock)(),(0,n.createElementBlock)(`g`,(0,n.mergeProps)({key:0,transform:a.value,style:(0,n.unref)(o),name:e.name},c),[(0,n.renderSlot)(t.$slots,`default`)],16,m)):(0,n.createCommentVNode)(`v-if`,!0)}});let g=[`transform`],_=[`transform`];var v=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapAnnotation`,props:{coordinates:{},length:{},angle:{},margin:{},curve:{type:Function},midpoint:{},styles:{}},setup(e){let t=e,i=(0,n.computed)(()=>(0,r.getAnnotationGeometry)({length:t.length,angle:t.angle,margin:t.margin}));return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(h,{coordinates:e.coordinates,name:`annotation`},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`g`,{transform:i.value.lineTransform},[(0,n.createVNode)(p,(0,n.mergeProps)(t.$attrs,{coordinates:i.value.lineCoordinates,cartesian:``,curve:e.curve,midpoint:e.midpoint,styles:e.styles,fill:`none`,name:`annotation-line`}),null,16,[`coordinates`,`curve`,`midpoint`,`styles`])],8,g),(0,n.createElementVNode)(`g`,{transform:i.value.contentTransform,name:`annotation-content`},[(0,n.renderSlot)(t.$slots,`default`)],8,_)]),_:3},8,[`coordinates`]))}});function y(e,t){return(0,n.computed)(()=>{let i=(0,n.unref)(t);if(i)return i;let a=(0,n.unref)(e);if(a?.data)return(0,r.makeMapContext)(a)})}let b=[`viewBox`];var x=(0,n.defineComponent)({__name:`MapBase`,props:{width:{},height:{},aspectRatio:{},projection:{type:Function},projectionConfig:{},data:{},dataTransformer:{type:Function},context:{}},setup(e){let t=e,r=y(t,(0,n.toRef)(t,`context`)),i=(0,n.computed)(()=>{if(!r.value)throw Error(`Map requires data or context`);return r.value});return(0,n.provide)(o,i),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`svg`,(0,n.mergeProps)({viewBox:`0 0 ${i.value.width} ${i.value.height}`},e.$attrs,{class:`d3-map`}),[(0,n.renderSlot)(e.$slots,`default`,(0,n.normalizeProps)((0,n.guardReactiveProps)(i.value)))],16,b))}});let S=[`d`];var C=(0,n.defineComponent)({__name:`MapFeature`,props:{data:{},styles:{}},setup(e){let t=e,{style:r,...i}=d((0,n.toRef)(t,`styles`)),a=s(),o=(0,n.computed)(()=>a.value.path(t.data)??void 0);return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)({d:o.value,style:(0,n.unref)(r)},i,{name:`feature`}),null,16,S))}});let w={name:`features`};var T=(0,n.defineComponent)({__name:`MapFeatures`,props:{idKey:{default:`id`},styles:{}},setup(e){let t=s(),i=(0,n.computed)(()=>t.value.features);return(t,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,w,[(0,n.renderSlot)(t.$slots,`default`,{features:i.value},()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,(t,i)=>((0,n.openBlock)(),(0,n.createBlock)(C,{key:(0,n.unref)(r.getFeatureKey)(t,e.idKey,i),data:t,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let E=[`d`,`fill`],D=[`d`],O=[`d`,`stroke`];var k=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapGraticule`,props:{config:{},background:{type:[Boolean,String]},border:{type:[Boolean,String]},styles:{}},setup(e){let t=e,i=s(),a=(0,n.useAttrs)(),o=(0,n.computed)(()=>(0,r.renderGraticule)(i.value,t.config)??void 0),c=(0,n.computed)(()=>(0,r.renderOutline)(i.value)??void 0),l=(0,n.computed)(()=>(0,r.isString)(t.background)?t.background:void 0),u=(0,n.computed)(()=>(0,r.isString)(t.border)?t.border:void 0),{style:f,...p}=d((0,n.toRef)(t,`styles`));return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,null,[e.background?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:0,d:c.value,fill:l.value,"pointer-events":`none`,name:`background`},null,8,E)):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`path`,(0,n.mergeProps)({d:o.value,fill:`none`,style:(0,n.unref)(f)},(0,n.mergeProps)(p,(0,n.unref)(a)),{name:`graticule`}),null,16,D),e.border?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:1,d:c.value,fill:`none`,stroke:u.value,"pointer-events":`none`,name:`border`},null,8,O)):(0,n.createCommentVNode)(`v-if`,!0)]))}});let A=[`d`];var j=(0,n.defineComponent)({__name:`MapMesh`,props:{styles:{}},setup(e){let t=e,r=s(),i=(0,n.computed)(()=>r.value.renderMesh()??void 0),{style:a,...o}=d((0,n.toRef)(t,`styles`));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)({d:i.value,fill:`none`,style:(0,n.unref)(a)},o,{name:`mesh`}),null,16,A))}}),M=(0,n.defineComponent)({__name:`MapZoom`,props:{center:{},zoom:{default:1},minZoom:{default:1},maxZoom:{default:8},transition:{},config:{}},emits:[`zoomStart`,`zoom`,`zoomEnd`,`update:center`,`update:zoom`],setup(e,{expose:t,emit:i}){let a=e,o=i,c=(0,n.ref)(null),u=s();function d(e,t){return!!(t&&e[0]===t[0]&&e[1]===t[1])}let{zoomBehavior:f}=l(c,a,{onZoomStart:e=>o(`zoomStart`,e),onZoom:e=>{let t=(0,r.getZoomViewportCenter)(u.value,e.transform),n=e.transform.k;d(t,a.center)||o(`update:center`,t),n!==a.zoom&&o(`update:zoom`,n),o(`zoom`,e)},onZoomEnd:e=>o(`zoomEnd`,e)});return t({container:c,zoomBehavior:f}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,{ref_key:`container`,ref:c,name:`zoom`},[(0,n.renderSlot)(e.$slots,`default`)],512))}}),N=a({MapAnnotation:()=>v,MapBase:()=>x,MapFeature:()=>C,MapFeatures:()=>T,MapGraticule:()=>k,MapLine:()=>p,MapMarker:()=>h,MapMesh:()=>j,MapZoom:()=>M});e.MapAnnotation=v,e.MapBase=x,e.MapFeature=C,e.MapFeatures=T,e.MapGraticule=k,e.MapLine=p,e.MapMarker=h,e.MapMesh=j,e.MapZoom=M,e.mapContextKey=o,e.mapZoomKey=c,e.plugin={install(e){Object.entries(N).forEach(([t,n])=>{e.component(t,n)})}},e.useCreateMapContext=y,e.useCreateMapZoom=l,e.useMapContext=s,e.useMapObject=d,e.useMapZoom=u})(this.D3Maps=this.D3Maps||{},_d3_maps_core_index_css,Vue,D3Maps);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "@d3-maps/core/index.css";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderList, renderSlot, toRef, unref, useAttrs, watch } from "vue";
3
- import { applyZoomGroupTransform, applyZoomTransform, createZoomBehavior, getFeatureKey, getMarkerTransform, isString, makeMapContext, renderGraticule, renderOutline, resolveObjectStyle, setupZoom, useMapObjectEvents } from "@d3-maps/core";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, toRef, unref, useAttrs, watch, withCtx } from "vue";
3
+ import { applyZoom, applyZoomGroupTransform, createZoomBehavior, getAnnotationGeometry, getFeatureKey, getLinePath, getMarkerTransform, getObjectZoomView, getZoomViewportCenter, isString, makeMapContext, renderGraticule, renderOutline, resolveObjectStyle, setupZoom, useMapObjectEvents } from "@d3-maps/core";
4
4
 
5
5
  //#region rolldown:runtime
6
6
  var __defProp = Object.defineProperty;
@@ -22,12 +22,278 @@ var __exportAll = (all, symbols) => {
22
22
  //#region src/hooks/useMapContext.ts
23
23
  const mapContextKey = Symbol("MapContext");
24
24
  function useMapContext() {
25
- return inject(mapContextKey);
25
+ const context = inject(mapContextKey);
26
+ if (!context) throw new Error("useMapContext must be used inside Map");
27
+ return context;
28
+ }
29
+
30
+ //#endregion
31
+ //#region src/hooks/useMapZoom.ts
32
+ const mapZoomKey = Symbol("MapZoom");
33
+ function useCreateMapZoom(container, props, eventCallbacks) {
34
+ const context = useMapContext();
35
+ const centerX = computed(() => props.center?.[0]);
36
+ const centerY = computed(() => props.center?.[1]);
37
+ const zoomBehavior = computed(() => {
38
+ return createZoomBehavior(context.value, {
39
+ minZoom: props.minZoom,
40
+ maxZoom: props.maxZoom,
41
+ config: props.config,
42
+ onZoomStart: (event) => eventCallbacks.onZoomStart?.(event),
43
+ onZoom: (event) => {
44
+ applyZoomGroupTransform(container.value, event.transform);
45
+ eventCallbacks.onZoom?.(event);
46
+ },
47
+ onZoomEnd: (event) => eventCallbacks.onZoomEnd?.(event)
48
+ });
49
+ });
50
+ const zoomContext = {
51
+ center: computed(() => props.center),
52
+ zoom: computed(() => props.zoom),
53
+ minZoom: computed(() => props.minZoom),
54
+ maxZoom: computed(() => props.maxZoom),
55
+ zoomToObject: (object, callback) => {
56
+ const view = getObjectZoomView(context.value, object, {
57
+ minZoom: props.minZoom,
58
+ maxZoom: props.maxZoom
59
+ });
60
+ if (!view) return;
61
+ callback(view);
62
+ }
63
+ };
64
+ provide(mapZoomKey, zoomContext);
65
+ let stopBehaviorWatch;
66
+ let stopViewWatch;
67
+ onMounted(() => {
68
+ stopBehaviorWatch = watch(zoomBehavior, (behavior) => {
69
+ if (!container.value) return;
70
+ setupZoom({
71
+ element: container.value,
72
+ behavior
73
+ });
74
+ }, { immediate: true });
75
+ stopViewWatch = watch([
76
+ centerX,
77
+ centerY,
78
+ () => props.zoom,
79
+ () => props.transition,
80
+ zoomBehavior
81
+ ], () => {
82
+ if (!container.value) return;
83
+ applyZoom({
84
+ element: container.value,
85
+ behavior: zoomBehavior.value,
86
+ center: props.center,
87
+ zoom: props.zoom,
88
+ transition: props.transition
89
+ });
90
+ }, { immediate: true });
91
+ });
92
+ onUnmounted(() => {
93
+ stopBehaviorWatch?.();
94
+ stopViewWatch?.();
95
+ });
96
+ return {
97
+ zoomBehavior,
98
+ zoomContext
99
+ };
100
+ }
101
+ function useMapZoom() {
102
+ const zoomContext = inject(mapZoomKey, void 0);
103
+ const mapContext = inject(mapContextKey, void 0);
104
+ if (!zoomContext) return void 0;
105
+ return {
106
+ ...zoomContext,
107
+ zoomToObject: (object, callback) => {
108
+ if (!mapContext?.value) return;
109
+ const view = getObjectZoomView(mapContext.value, object, {
110
+ minZoom: zoomContext.minZoom.value,
111
+ maxZoom: zoomContext.maxZoom.value
112
+ });
113
+ if (!view) return;
114
+ callback(view);
115
+ }
116
+ };
117
+ }
118
+
119
+ //#endregion
120
+ //#region src/hooks/useMapObject.ts
121
+ function useMapObject(styles) {
122
+ const state = ref("default");
123
+ const { onMouseenter, onMouseleave, onMouseup, onMousedown, onFocus, onBlur, dispose } = useMapObjectEvents((nextState) => {
124
+ state.value = nextState;
125
+ }, Boolean(useMapZoom()));
126
+ onBeforeUnmount(() => {
127
+ dispose();
128
+ });
129
+ return {
130
+ style: computed(() => resolveObjectStyle(state.value, unref(styles))),
131
+ onMouseenter,
132
+ onMouseleave,
133
+ onMousedown,
134
+ onMouseup,
135
+ onFocus,
136
+ onBlur
137
+ };
138
+ }
139
+
140
+ //#endregion
141
+ //#region src/components/MapLine.vue?vue&type=script&setup=true&lang.ts
142
+ const _hoisted_1$7 = ["d", "fill"];
143
+ var MapLine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
144
+ inheritAttrs: false,
145
+ __name: "MapLine",
146
+ props: {
147
+ styles: {},
148
+ coordinates: {},
149
+ cartesian: {
150
+ type: Boolean,
151
+ default: false
152
+ },
153
+ custom: {
154
+ type: Boolean,
155
+ default: false
156
+ },
157
+ curve: {},
158
+ midpoint: {}
159
+ },
160
+ setup(__props) {
161
+ const props = __props;
162
+ const attrs = useAttrs();
163
+ const context = useMapContext();
164
+ const path = computed(() => {
165
+ return getLinePath(context.value, {
166
+ coordinates: props.coordinates,
167
+ custom: props.custom,
168
+ curve: props.curve,
169
+ cartesian: props.cartesian,
170
+ midpoint: props.midpoint
171
+ });
172
+ });
173
+ const pathName = computed(() => attrs.name ?? "line");
174
+ const fill = computed(() => attrs.fill ?? "none");
175
+ const { style, ...events } = useMapObject(toRef(props, "styles"));
176
+ const pathAttrs = computed(() => ({
177
+ ...attrs,
178
+ ...events,
179
+ name: pathName.value
180
+ }));
181
+ return (_ctx, _cache) => {
182
+ return openBlock(), createElementBlock("path", mergeProps(pathAttrs.value, {
183
+ d: path.value,
184
+ fill: fill.value,
185
+ style: unref(style)
186
+ }), null, 16, _hoisted_1$7);
187
+ };
188
+ }
189
+ });
190
+
191
+ //#endregion
192
+ //#region src/components/MapLine.vue
193
+ var MapLine_default = MapLine_vue_vue_type_script_setup_true_lang_default;
194
+
195
+ //#endregion
196
+ //#region src/components/MapMarker.vue?vue&type=script&setup=true&lang.ts
197
+ const _hoisted_1$6 = ["transform", "name"];
198
+ var MapMarker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
199
+ __name: "MapMarker",
200
+ props: {
201
+ name: { default: "marker" },
202
+ coordinates: {},
203
+ styles: {}
204
+ },
205
+ setup(__props) {
206
+ const props = __props;
207
+ const context = useMapContext();
208
+ const transform = computed(() => {
209
+ return getMarkerTransform(context.value, props.coordinates);
210
+ });
211
+ const { style, ...events } = useMapObject(toRef(props, "styles"));
212
+ return (_ctx, _cache) => {
213
+ return transform.value ? (openBlock(), createElementBlock("g", mergeProps({
214
+ key: 0,
215
+ transform: transform.value,
216
+ style: unref(style),
217
+ name: __props.name
218
+ }, events), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$6)) : createCommentVNode("v-if", true);
219
+ };
220
+ }
221
+ });
222
+
223
+ //#endregion
224
+ //#region src/components/MapMarker.vue
225
+ var MapMarker_default = MapMarker_vue_vue_type_script_setup_true_lang_default;
226
+
227
+ //#endregion
228
+ //#region src/components/MapAnnotation.vue?vue&type=script&setup=true&lang.ts
229
+ const _hoisted_1$5 = ["transform"];
230
+ const _hoisted_2$1 = ["transform"];
231
+ var MapAnnotation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
232
+ inheritAttrs: false,
233
+ __name: "MapAnnotation",
234
+ props: {
235
+ coordinates: {},
236
+ length: {},
237
+ angle: {},
238
+ margin: {},
239
+ curve: { type: Function },
240
+ midpoint: {},
241
+ styles: {}
242
+ },
243
+ setup(__props) {
244
+ const props = __props;
245
+ const geometry = computed(() => getAnnotationGeometry({
246
+ length: props.length,
247
+ angle: props.angle,
248
+ margin: props.margin
249
+ }));
250
+ return (_ctx, _cache) => {
251
+ return openBlock(), createBlock(MapMarker_default, {
252
+ coordinates: __props.coordinates,
253
+ name: "annotation"
254
+ }, {
255
+ default: withCtx(() => [createElementVNode("g", { transform: geometry.value.lineTransform }, [createVNode(MapLine_default, mergeProps(_ctx.$attrs, {
256
+ coordinates: geometry.value.lineCoordinates,
257
+ cartesian: "",
258
+ curve: __props.curve,
259
+ midpoint: __props.midpoint,
260
+ styles: __props.styles,
261
+ fill: "none",
262
+ name: "annotation-line"
263
+ }), null, 16, [
264
+ "coordinates",
265
+ "curve",
266
+ "midpoint",
267
+ "styles"
268
+ ])], 8, _hoisted_1$5), createElementVNode("g", {
269
+ transform: geometry.value.contentTransform,
270
+ name: "annotation-content"
271
+ }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_2$1)]),
272
+ _: 3
273
+ }, 8, ["coordinates"]);
274
+ };
275
+ }
276
+ });
277
+
278
+ //#endregion
279
+ //#region src/components/MapAnnotation.vue
280
+ var MapAnnotation_default = MapAnnotation_vue_vue_type_script_setup_true_lang_default;
281
+
282
+ //#endregion
283
+ //#region src/hooks/useCreateMapContext.ts
284
+ function useCreateMapContext(config, context) {
285
+ return computed(() => {
286
+ const resolvedContext = unref(context);
287
+ if (resolvedContext) return resolvedContext;
288
+ const resolvedConfig = unref(config);
289
+ if (!resolvedConfig?.data) return void 0;
290
+ return makeMapContext(resolvedConfig);
291
+ });
26
292
  }
27
293
 
28
294
  //#endregion
29
295
  //#region src/components/MapBase.vue?vue&type=script&setup=true&lang.ts
30
- const _hoisted_1$5 = ["viewBox"];
296
+ const _hoisted_1$4 = ["viewBox"];
31
297
  var MapBase_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
32
298
  __name: "MapBase",
33
299
  props: {
@@ -37,22 +303,19 @@ var MapBase_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
37
303
  projection: { type: Function },
38
304
  projectionConfig: {},
39
305
  data: {},
40
- dataTransformer: { type: Function }
306
+ dataTransformer: { type: Function },
307
+ context: {}
41
308
  },
42
309
  setup(__props) {
43
310
  const props = __props;
44
- const context = computed(() => makeMapContext({
45
- width: props.width,
46
- height: props.height,
47
- aspectRatio: props.aspectRatio,
48
- projection: props.projection,
49
- projectionConfig: props.projectionConfig,
50
- data: props.data,
51
- dataTransformer: props.dataTransformer
52
- }));
311
+ const unresolvedContext = useCreateMapContext(props, toRef(props, "context"));
312
+ const context = computed(() => {
313
+ if (!unresolvedContext.value) throw new Error("Map requires data or context");
314
+ return unresolvedContext.value;
315
+ });
53
316
  provide(mapContextKey, context);
54
317
  return (_ctx, _cache) => {
55
- return openBlock(), createElementBlock("svg", mergeProps({ viewBox: `0 0 ${context.value.width} ${context.value.height}` }, _ctx.$attrs, { class: "d3-map" }), [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(context.value)))], 16, _hoisted_1$5);
318
+ return openBlock(), createElementBlock("svg", mergeProps({ viewBox: `0 0 ${context.value.width} ${context.value.height}` }, _ctx.$attrs, { class: "d3-map" }), [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(context.value)))], 16, _hoisted_1$4);
56
319
  };
57
320
  }
58
321
  });
@@ -61,35 +324,9 @@ var MapBase_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
61
324
  //#region src/components/MapBase.vue
62
325
  var MapBase_default = MapBase_vue_vue_type_script_setup_true_lang_default;
63
326
 
64
- //#endregion
65
- //#region src/hooks/useInsideZoom.ts
66
- const insideZoomKey = Symbol("InsideZoom");
67
- function useInsideZoom() {
68
- return inject(insideZoomKey, false);
69
- }
70
-
71
- //#endregion
72
- //#region src/hooks/useMapObject.ts
73
- function useMapObject(styles) {
74
- const state = ref("default");
75
- const { onMouseenter, onMouseleave, onMouseup, onMousedown, dispose } = useMapObjectEvents((nextState) => {
76
- state.value = nextState;
77
- }, useInsideZoom());
78
- onBeforeUnmount(() => {
79
- dispose();
80
- });
81
- return {
82
- style: computed(() => resolveObjectStyle(state.value, unref(styles))),
83
- onMouseenter,
84
- onMouseleave,
85
- onMousedown,
86
- onMouseup
87
- };
88
- }
89
-
90
327
  //#endregion
91
328
  //#region src/components/MapFeature.vue?vue&type=script&setup=true&lang.ts
92
- const _hoisted_1$4 = ["d"];
329
+ const _hoisted_1$3 = ["d"];
93
330
  var MapFeature_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
94
331
  __name: "MapFeature",
95
332
  props: {
@@ -100,12 +337,12 @@ var MapFeature_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
100
337
  const props = __props;
101
338
  const { style, ...events } = useMapObject(toRef(props, "styles"));
102
339
  const context = useMapContext();
103
- const path = computed(() => context?.value.path(props.data) ?? void 0);
340
+ const path = computed(() => context.value.path(props.data) ?? void 0);
104
341
  return (_ctx, _cache) => {
105
342
  return openBlock(), createElementBlock("path", mergeProps({
106
343
  d: path.value,
107
344
  style: unref(style)
108
- }, events, { name: "feature" }), null, 16, _hoisted_1$4);
345
+ }, events, { name: "feature" }), null, 16, _hoisted_1$3);
109
346
  };
110
347
  }
111
348
  });
@@ -116,7 +353,7 @@ var MapFeature_default = MapFeature_vue_vue_type_script_setup_true_lang_default;
116
353
 
117
354
  //#endregion
118
355
  //#region src/components/MapFeatures.vue?vue&type=script&setup=true&lang.ts
119
- const _hoisted_1$3 = { name: "features" };
356
+ const _hoisted_1$2 = { name: "features" };
120
357
  var MapFeatures_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
121
358
  __name: "MapFeatures",
122
359
  props: {
@@ -125,9 +362,9 @@ var MapFeatures_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
125
362
  },
126
363
  setup(__props) {
127
364
  const context = useMapContext();
128
- const features = computed(() => context?.value.features ?? []);
365
+ const features = computed(() => context.value.features);
129
366
  return (_ctx, _cache) => {
130
- return openBlock(), createElementBlock("g", _hoisted_1$3, [renderSlot(_ctx.$slots, "default", { features: features.value }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(features.value, (feature, index) => {
367
+ return openBlock(), createElementBlock("g", _hoisted_1$2, [renderSlot(_ctx.$slots, "default", { features: features.value }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(features.value, (feature, index) => {
131
368
  return openBlock(), createBlock(MapFeature_default, {
132
369
  key: unref(getFeatureKey)(feature, __props.idKey, index),
133
370
  data: feature,
@@ -144,7 +381,7 @@ var MapFeatures_default = MapFeatures_vue_vue_type_script_setup_true_lang_defaul
144
381
 
145
382
  //#endregion
146
383
  //#region src/components/MapGraticule.vue?vue&type=script&setup=true&lang.ts
147
- const _hoisted_1$2 = ["d", "fill"];
384
+ const _hoisted_1$1 = ["d", "fill"];
148
385
  const _hoisted_2 = ["d"];
149
386
  const _hoisted_3 = ["d", "stroke"];
150
387
  var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
@@ -161,11 +398,9 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
161
398
  const context = useMapContext();
162
399
  const attrs = useAttrs();
163
400
  const graticulePath = computed(() => {
164
- if (!context?.value) return void 0;
165
401
  return renderGraticule(context.value, props.config) ?? void 0;
166
402
  });
167
403
  const outlinePath = computed(() => {
168
- if (!context?.value) return void 0;
169
404
  return renderOutline(context.value) ?? void 0;
170
405
  });
171
406
  const backgroundColor = computed(() => isString(props.background) ? props.background : void 0);
@@ -179,7 +414,7 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
179
414
  fill: backgroundColor.value,
180
415
  "pointer-events": "none",
181
416
  name: "background"
182
- }, null, 8, _hoisted_1$2)) : createCommentVNode("v-if", true),
417
+ }, null, 8, _hoisted_1$1)) : createCommentVNode("v-if", true),
183
418
  createElementVNode("path", mergeProps({
184
419
  d: graticulePath.value,
185
420
  fill: "none",
@@ -202,35 +437,6 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
202
437
  //#region src/components/MapGraticule.vue
203
438
  var MapGraticule_default = MapGraticule_vue_vue_type_script_setup_true_lang_default;
204
439
 
205
- //#endregion
206
- //#region src/components/MapMarker.vue?vue&type=script&setup=true&lang.ts
207
- const _hoisted_1$1 = ["transform"];
208
- var MapMarker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
209
- __name: "MapMarker",
210
- props: {
211
- coordinates: { default: () => [0, 0] },
212
- styles: {}
213
- },
214
- setup(__props) {
215
- const props = __props;
216
- const context = useMapContext();
217
- const transform = computed(() => {
218
- return getMarkerTransform(context?.value, props.coordinates);
219
- });
220
- const { style, ...events } = useMapObject(toRef(props, "styles"));
221
- return (_ctx, _cache) => {
222
- return openBlock(), createElementBlock("g", mergeProps({
223
- transform: transform.value,
224
- style: unref(style)
225
- }, events, { name: "marker" }), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$1);
226
- };
227
- }
228
- });
229
-
230
- //#endregion
231
- //#region src/components/MapMarker.vue
232
- var MapMarker_default = MapMarker_vue_vue_type_script_setup_true_lang_default;
233
-
234
440
  //#endregion
235
441
  //#region src/components/MapMesh.vue?vue&type=script&setup=true&lang.ts
236
442
  const _hoisted_1 = ["d"];
@@ -240,7 +446,7 @@ var MapMesh_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
240
446
  setup(__props) {
241
447
  const props = __props;
242
448
  const context = useMapContext();
243
- const path = computed(() => context?.value.renderMesh() ?? void 0);
449
+ const path = computed(() => context.value.renderMesh() ?? void 0);
244
450
  const { style, ...events } = useMapObject(toRef(props, "styles"));
245
451
  return (_ctx, _cache) => {
246
452
  return openBlock(), createElementBlock("path", mergeProps({
@@ -261,60 +467,38 @@ var MapMesh_default = MapMesh_vue_vue_type_script_setup_true_lang_default;
261
467
  var MapZoom_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
262
468
  __name: "MapZoom",
263
469
  props: {
264
- center: { default: () => [0, 0] },
470
+ center: {},
265
471
  zoom: { default: 1 },
266
472
  minZoom: { default: 1 },
267
473
  maxZoom: { default: 8 },
474
+ transition: {},
268
475
  config: {}
269
476
  },
270
477
  emits: [
271
- "zoomstart",
478
+ "zoomStart",
272
479
  "zoom",
273
- "zoomend"
480
+ "zoomEnd",
481
+ "update:center",
482
+ "update:zoom"
274
483
  ],
275
484
  setup(__props, { expose: __expose, emit: __emit }) {
276
485
  const props = __props;
277
486
  const emit = __emit;
278
487
  const container = ref(null);
279
488
  const context = useMapContext();
280
- provide(insideZoomKey, true);
281
- const zoomBehavior = computed(() => {
282
- return createZoomBehavior(context?.value, {
283
- minZoom: props.minZoom,
284
- maxZoom: props.maxZoom,
285
- config: props.config,
286
- onZoomStart: (event) => emit("zoomstart", event),
287
- onZoom: (event) => {
288
- applyZoomGroupTransform(container.value, event.transform);
289
- emit("zoom", event);
290
- },
291
- onZoomEnd: (event) => emit("zoomend", event)
292
- });
293
- });
294
- onMounted(() => {
295
- watch(zoomBehavior, (behavior) => {
296
- if (!container.value) return;
297
- setupZoom({
298
- element: container.value,
299
- behavior,
300
- center: props.center,
301
- zoom: props.zoom
302
- });
303
- }, { immediate: true });
304
- watch(() => [
305
- zoomBehavior.value,
306
- props.center[0],
307
- props.center[1],
308
- props.zoom
309
- ], () => {
310
- if (!container.value) return;
311
- applyZoomTransform({
312
- element: container.value,
313
- behavior: zoomBehavior.value,
314
- center: props.center,
315
- zoom: props.zoom
316
- });
317
- });
489
+ function isSameCenter(nextCenter, currentCenter) {
490
+ return Boolean(currentCenter && nextCenter[0] === currentCenter[0] && nextCenter[1] === currentCenter[1]);
491
+ }
492
+ const { zoomBehavior } = useCreateMapZoom(container, props, {
493
+ onZoomStart: (event) => emit("zoomStart", event),
494
+ onZoom: (event) => {
495
+ const nextCenter = getZoomViewportCenter(context.value, event.transform);
496
+ const nextZoom = event.transform.k;
497
+ if (!isSameCenter(nextCenter, props.center)) emit("update:center", nextCenter);
498
+ if (nextZoom !== props.zoom) emit("update:zoom", nextZoom);
499
+ emit("zoom", event);
500
+ },
501
+ onZoomEnd: (event) => emit("zoomEnd", event)
318
502
  });
319
503
  __expose({
320
504
  container,
@@ -337,10 +521,12 @@ var MapZoom_default = MapZoom_vue_vue_type_script_setup_true_lang_default;
337
521
  //#endregion
338
522
  //#region src/components/index.ts
339
523
  var components_exports = /* @__PURE__ */ __exportAll({
524
+ MapAnnotation: () => MapAnnotation_default,
340
525
  MapBase: () => MapBase_default,
341
526
  MapFeature: () => MapFeature_default,
342
527
  MapFeatures: () => MapFeatures_default,
343
528
  MapGraticule: () => MapGraticule_default,
529
+ MapLine: () => MapLine_default,
344
530
  MapMarker: () => MapMarker_default,
345
531
  MapMesh: () => MapMesh_default,
346
532
  MapZoom: () => MapZoom_default
@@ -358,4 +544,4 @@ const plugin = { install(app) {
358
544
  } };
359
545
 
360
546
  //#endregion
361
- export { MapBase_default as MapBase, MapFeature_default as MapFeature, MapFeatures_default as MapFeatures, MapGraticule_default as MapGraticule, MapMarker_default as MapMarker, MapMesh_default as MapMesh, MapZoom_default as MapZoom, mapContextKey, plugin, useMapContext, useMapObject };
547
+ export { MapAnnotation_default as MapAnnotation, MapBase_default as MapBase, MapFeature_default as MapFeature, MapFeatures_default as MapFeatures, MapGraticule_default as MapGraticule, MapLine_default as MapLine, MapMarker_default as MapMarker, MapMesh_default as MapMesh, MapZoom_default as MapZoom, mapContextKey, mapZoomKey, plugin, useCreateMapContext, useCreateMapZoom, useMapContext, useMapObject, useMapZoom };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d3-maps/vue",
3
3
  "type": "module",
4
- "version": "0.7.0",
4
+ "version": "0.9.0",
5
5
  "private": false,
6
6
  "description": "Vue bindings for @d3-maps/core to build reactive D3 SVG maps",
7
7
  "author": "Georgii Bukharov <souljorje@gmail.com>",
@@ -44,7 +44,7 @@
44
44
  "vue": "3.5.25"
45
45
  },
46
46
  "dependencies": {
47
- "@d3-maps/core": "0.7.0"
47
+ "@d3-maps/core": "0.9.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/geojson": "^7946.0.16",