@d3-maps/vue 0.6.0 → 0.8.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,6 +1,6 @@
1
1
  # @d3-maps/vue
2
2
 
3
- `@d3-maps/vue` provides Vue bindings for `@d3-maps/core` to build SVG maps with Vue, [d3](https://github.com/d3/d3) and [TopoJSON-client](https://github.com/TopoJSON/TopoJSON-client).
3
+ Reactive SVG maps, powered by D3.
4
4
 
5
5
  [docs](https://souljorje.github.io/d3-maps)
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import "@d3-maps/core/index.css";
2
2
  import * as vue6 from "vue";
3
3
  import { App, ComputedRef, InjectionKey, MaybeRef, StyleValue } from "vue";
4
+ import { CurveFactory, CurveFactoryLineOnly } from "d3-shape";
4
5
  import { ExtendedFeature, ExtendedFeatureCollection, GeoGraticuleGenerator, GeoPath, GeoProjection } from "d3-geo";
5
6
  import { Topology } from "topojson-specification";
6
7
  import "topojson-client";
@@ -12,7 +13,7 @@ import { D3ZoomEvent, ZoomBehavior } from "d3-zoom";
12
13
  */
13
14
  declare const mapObjectState: readonly ["default", "hover", "active"];
14
15
  type MapObjectState = typeof mapObjectState[number];
15
- interface MapObject<TStyle = unknown> {
16
+ interface MapObjectProps<TStyle = unknown> {
16
17
  styles?: Partial<Record<MapObjectState, TStyle>>;
17
18
  }
18
19
  //#endregion
@@ -26,9 +27,15 @@ type MapFeature = (ExtendedFeature & Record<string, unknown>) | ExtendedFeature;
26
27
  /**
27
28
  * Shared props contract for a single rendered feature.
28
29
  */
29
- interface MapFeatureProps<TStyle = unknown> extends MapObject<TStyle> {
30
+ interface MapFeatureProps<TStyle = unknown> extends MapObjectProps<TStyle> {
30
31
  data: MapFeature;
31
32
  }
33
+ /**
34
+ * Shared props contract for feature collections rendered from the current map context.
35
+ */
36
+ interface MapFeaturesProps<TStyle = unknown> extends Omit<MapFeatureProps<TStyle>, 'data'> {
37
+ idKey?: string;
38
+ }
32
39
  //#endregion
33
40
  //#region ../core/src/lib/utils.d.ts
34
41
  type AnyFn = (...args: any) => any;
@@ -111,11 +118,11 @@ type DataTransformer = (features: MapFeature[]) => MapFeature[];
111
118
  */
112
119
  interface ProjectionConfig extends Omit<MethodsToModifiers<GeoProjection>, 'invert' | 'stream'> {}
113
120
  /**
114
- * Input configuration for creating a map context.
121
+ * Shared props contract for the `Map` component.
115
122
  *
116
123
  * In adapters, this is usually passed as component props.
117
124
  */
118
- interface MapConfig {
125
+ interface MapProps {
119
126
  width?: number;
120
127
  height?: number;
121
128
  aspectRatio?: number;
@@ -148,12 +155,46 @@ interface MapConfig {
148
155
  interface MapContext {
149
156
  width: number;
150
157
  height: number;
151
- projection?: GeoProjection;
158
+ projection: GeoProjection;
152
159
  features: MapFeature[];
153
160
  path: GeoPath;
154
161
  renderMesh: () => ReturnType<GeoPath>;
155
162
  }
156
163
  //#endregion
164
+ //#region ../core/src/lib/line.d.ts
165
+ /**
166
+ * Geographic or cartesian line coordinates expressed as ordered `[x, y]` pairs
167
+ */
168
+ type MapLineCoordinates = [number, number][];
169
+ /**
170
+ * D3 curve factory used by custom and cartesian line rendering
171
+ */
172
+ type MapLineCurve = CurveFactory | CurveFactoryLineOnly;
173
+ /**
174
+ * Midpoint adjustment expressed as percentages of the segment length
175
+ *
176
+ * - first value: moves the generated midpoint along the segment direction
177
+ * - second value: moves the generated midpoint perpendicular to the segment direction
178
+ */
179
+ type MapLineMidpoint = [number, number];
180
+ //#endregion
181
+ //#region ../core/src/lib/annotation.d.ts
182
+ /**
183
+ * Geographic anchor coordinate for an annotation
184
+ */
185
+ type MapAnnotationCoordinates = [number, number];
186
+ /**
187
+ * Public annotation props shared across adapters
188
+ */
189
+ interface MapAnnotationProps<TStyle = unknown> extends MapObjectProps<TStyle> {
190
+ coordinates: MapAnnotationCoordinates;
191
+ length?: number;
192
+ angle?: number;
193
+ margin?: number;
194
+ curve?: MapLineCurve;
195
+ midpoint?: MapLineMidpoint;
196
+ }
197
+ //#endregion
157
198
  //#region ../core/src/lib/graticule.d.ts
158
199
  /**
159
200
  * Extra graticule generator method calls to apply before rendering.
@@ -164,14 +205,22 @@ interface MapContext {
164
205
  * @see https://d3js.org/d3-geo/shape#geoGraticule
165
206
  */
166
207
  interface GraticuleConfig extends MethodsToModifiers<GeoGraticuleGenerator> {}
208
+ /**
209
+ * Shared props contract for graticule layers.
210
+ */
211
+ interface MapGraticuleProps<TStyle = unknown> extends MapObjectProps<TStyle> {
212
+ config?: GraticuleConfig;
213
+ background?: boolean | string;
214
+ border?: boolean | string;
215
+ }
167
216
  //#endregion
168
217
  //#region ../core/src/lib/marker.d.ts
169
218
  type MapMarkerCoordinates = [number, number];
170
219
  /**
171
220
  * Shared props contract for marker layers.
172
221
  */
173
- interface MapMarkerProps<TStyle = unknown> extends MapObject<TStyle> {
174
- coordinates?: MapMarkerCoordinates;
222
+ interface MapMarkerProps<TStyle = unknown> extends MapObjectProps<TStyle> {
223
+ coordinates: MapMarkerCoordinates;
175
224
  }
176
225
  //#endregion
177
226
  //#region ../core/src/lib/zoom.d.ts
@@ -194,13 +243,28 @@ interface ZoomProps {
194
243
  }
195
244
  interface ZoomEvent extends D3ZoomEvent<SVGSVGElement, unknown> {}
196
245
  //#endregion
197
- //#region src/components/Map.vue.d.ts
246
+ //#region src/components/MapAnnotation.vue.d.ts
247
+ type __VLS_Props$4 = MapAnnotationProps<StyleValue>;
248
+ declare var __VLS_13: {};
249
+ type __VLS_Slots$4 = {} & {
250
+ default?: (props: typeof __VLS_13) => any;
251
+ };
252
+ declare const __VLS_base$4: vue6.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$4> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
253
+ declare const __VLS_export$8: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
254
+ declare const _default: typeof __VLS_export$8;
255
+ type __VLS_WithSlots$4<T, S> = T & {
256
+ new (): {
257
+ $slots: S;
258
+ };
259
+ };
260
+ //#endregion
261
+ //#region src/components/MapBase.vue.d.ts
198
262
  type __VLS_Slots$3 = {
199
263
  default?: (props: MapContext) => unknown;
200
264
  };
201
- declare const __VLS_base$3: vue6.DefineComponent<MapConfig, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<MapConfig> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
202
- declare const __VLS_export$6: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
203
- declare const _default: typeof __VLS_export$6;
265
+ declare const __VLS_base$3: vue6.DefineComponent<MapProps, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<MapProps> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
266
+ declare const __VLS_export$7: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
267
+ declare const _default$1: typeof __VLS_export$7;
204
268
  type __VLS_WithSlots$3<T, S> = T & {
205
269
  new (): {
206
270
  $slots: S;
@@ -208,25 +272,23 @@ type __VLS_WithSlots$3<T, S> = T & {
208
272
  };
209
273
  //#endregion
210
274
  //#region src/components/MapFeature.vue.d.ts
211
- type __VLS_Props$1 = MapFeatureProps<StyleValue>;
212
- declare const __VLS_export$5: vue6.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
213
- declare const _default$1: typeof __VLS_export$5;
275
+ type __VLS_Props$3 = MapFeatureProps<StyleValue>;
276
+ declare const __VLS_export$6: vue6.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$3> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
277
+ declare const _default$2: typeof __VLS_export$6;
214
278
  //#endregion
215
279
  //#region src/components/MapFeatures.vue.d.ts
216
- interface Props$2 extends MapObject<StyleValue> {
217
- idKey?: string;
218
- }
280
+ type __VLS_Props$2 = MapFeaturesProps<StyleValue>;
219
281
  declare var __VLS_1$2: {
220
282
  features: MapFeature[];
221
283
  };
222
284
  type __VLS_Slots$2 = {} & {
223
285
  default?: (props: typeof __VLS_1$2) => any;
224
286
  };
225
- declare const __VLS_base$2: vue6.DefineComponent<Props$2, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props$2> & Readonly<{}>, {
287
+ declare const __VLS_base$2: vue6.DefineComponent<__VLS_Props$2, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$2> & Readonly<{}>, {
226
288
  idKey: string;
227
289
  }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
228
- declare const __VLS_export$4: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
229
- declare const _default$2: typeof __VLS_export$4;
290
+ declare const __VLS_export$5: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
291
+ declare const _default$3: typeof __VLS_export$5;
230
292
  type __VLS_WithSlots$2<T, S> = T & {
231
293
  new (): {
232
294
  $slots: S;
@@ -234,25 +296,37 @@ type __VLS_WithSlots$2<T, S> = T & {
234
296
  };
235
297
  //#endregion
236
298
  //#region src/components/MapGraticule.vue.d.ts
237
- interface Props$1 extends MapObject<StyleValue> {
238
- config?: GraticuleConfig;
239
- background?: boolean | string;
240
- border?: boolean | string;
299
+ type __VLS_Props$1 = MapGraticuleProps<StyleValue>;
300
+ declare const __VLS_export$4: vue6.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
301
+ declare const _default$4: typeof __VLS_export$4;
302
+ //#endregion
303
+ //#region src/components/MapLine.vue.d.ts
304
+ interface Props$1 extends MapObjectProps<StyleValue> {
305
+ coordinates: MapLineCoordinates;
306
+ cartesian?: boolean;
307
+ custom?: boolean;
308
+ curve?: MapLineCurve;
309
+ midpoint?: [number, number];
241
310
  }
242
- declare const __VLS_export$3: vue6.DefineComponent<Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
243
- declare const _default$3: typeof __VLS_export$3;
311
+ declare const __VLS_export$3: vue6.DefineComponent<Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props$1> & Readonly<{}>, {
312
+ cartesian: boolean;
313
+ custom: boolean;
314
+ }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
315
+ declare const _default$5: typeof __VLS_export$3;
244
316
  //#endregion
245
317
  //#region src/components/MapMarker.vue.d.ts
246
- type __VLS_Props = MapMarkerProps<StyleValue>;
318
+ interface Props extends MapMarkerProps<StyleValue> {
319
+ name?: string;
320
+ }
247
321
  declare var __VLS_1$1: {};
248
322
  type __VLS_Slots$1 = {} & {
249
323
  default?: (props: typeof __VLS_1$1) => any;
250
324
  };
251
- declare const __VLS_base$1: vue6.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
252
- coordinates: MapMarkerCoordinates;
325
+ declare const __VLS_base$1: vue6.DefineComponent<Props, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props> & Readonly<{}>, {
326
+ name: string;
253
327
  }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
254
328
  declare const __VLS_export$2: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
255
- declare const _default$4: typeof __VLS_export$2;
329
+ declare const _default$6: typeof __VLS_export$2;
256
330
  type __VLS_WithSlots$1<T, S> = T & {
257
331
  new (): {
258
332
  $slots: S;
@@ -260,9 +334,9 @@ type __VLS_WithSlots$1<T, S> = T & {
260
334
  };
261
335
  //#endregion
262
336
  //#region src/components/MapMesh.vue.d.ts
263
- interface Props extends MapObject<StyleValue> {}
264
- declare const __VLS_export$1: vue6.DefineComponent<Props, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
265
- declare const _default$5: typeof __VLS_export$1;
337
+ type __VLS_Props = MapObjectProps<StyleValue>;
338
+ 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>;
339
+ declare const _default$7: typeof __VLS_export$1;
266
340
  //#endregion
267
341
  //#region src/components/MapZoom.vue.d.ts
268
342
  declare var __VLS_1: {};
@@ -287,7 +361,7 @@ declare const __VLS_base: vue6.DefineComponent<ZoomProps, {
287
361
  maxZoom: number;
288
362
  }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
289
363
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
290
- declare const _default$6: typeof __VLS_export;
364
+ declare const _default$8: typeof __VLS_export;
291
365
  type __VLS_WithSlots<T, S> = T & {
292
366
  new (): {
293
367
  $slots: S;
@@ -316,4 +390,4 @@ declare const plugin: {
316
390
  install(app: App): void;
317
391
  };
318
392
  //#endregion
319
- export { _default as Map, _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 };
393
+ export { _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, UseMapObjectResult, mapContextKey, plugin, useMapContext, useMapObject };
@@ -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:`Map`,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({Map:()=>l,MapFeature:()=>m,MapFeatures:()=>g,MapGraticule:()=>b,MapMarker:()=>S,MapMesh:()=>w,MapZoom:()=>T});e.Map=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(){return(0,n.inject)(o)}let c=Symbol(`InsideZoom`);function l(){return(0,n.inject)(c,!1)}function u(e){let t=(0,n.ref)(`default`),{onMouseenter:i,onMouseleave:a,onMouseup:o,onMousedown:s,dispose:c}=(0,r.useMapObjectEvents)(e=>{t.value=e},l());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 d=[`d`];var f=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapLine`,props:{coordinates:{},cartesian:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},curve:{},midpoint:{},styles:{}},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`),{style:l,...f}=u((0,n.toRef)(t,`styles`)),p=(0,n.computed)(()=>({...i,...f,name:c.value}));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)(p.value,{d:o.value,fill:`none`,style:(0,n.unref)(l)}),null,16,d))}});let p=[`transform`,`name`];var m=(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}=u((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,p)):(0,n.createCommentVNode)(`v-if`,!0)}});let h=[`transform`],g=[`transform`];var _=(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)(m,{coordinates:e.coordinates,name:`annotation`},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`g`,{transform:i.value.lineTransform},[(0,n.createVNode)(f,(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,h),(0,n.createElementVNode)(`g`,{transform:i.value.contentTransform,name:`annotation-content`},[(0,n.renderSlot)(t.$slots,`default`)],8,g)]),_:3},8,[`coordinates`]))}});let v=[`viewBox`];var y=(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,v))}});let b=[`d`];var x=(0,n.defineComponent)({__name:`MapFeature`,props:{data:{},styles:{}},setup(e){let t=e,{style:r,...i}=u((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,b))}});let S={name:`features`};var C=(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`,S,[(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)(x,{key:(0,n.unref)(r.getFeatureKey)(t,e.idKey,i),data:t,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let w=[`d`,`fill`],T=[`d`],E=[`d`,`stroke`];var D=(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),d=(0,n.computed)(()=>(0,r.isString)(t.border)?t.border:void 0),{style:f,...p}=u((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,w)):(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,T),e.border?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:1,d:c.value,fill:`none`,stroke:d.value,"pointer-events":`none`,name:`border`},null,8,E)):(0,n.createCommentVNode)(`v-if`,!0)]))}});let O=[`d`];var k=(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}=u((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,O))}}),A=(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,l=(0,n.ref)(null),u=s();(0,n.provide)(c,!0);let d=(0,n.computed)(()=>(0,r.createZoomBehavior)(u?.value,{minZoom:a.minZoom,maxZoom:a.maxZoom,config:a.config,onZoomStart:e=>o(`zoomstart`,e),onZoom:e=>{(0,r.applyZoomGroupTransform)(l.value,e.transform),o(`zoom`,e)},onZoomEnd:e=>o(`zoomend`,e)}));return(0,n.onMounted)(()=>{(0,n.watch)(d,e=>{l.value&&(0,r.setupZoom)({element:l.value,behavior:e,center:a.center,zoom:a.zoom})},{immediate:!0}),(0,n.watch)(()=>[d.value,a.center[0],a.center[1],a.zoom],()=>{l.value&&(0,r.applyZoomTransform)({element:l.value,behavior:d.value,center:a.center,zoom:a.zoom})})}),t({container:l,zoomBehavior:d}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,{ref_key:`container`,ref:l,name:`zoom`},[(0,n.renderSlot)(e.$slots,`default`)],512))}}),j=a({MapAnnotation:()=>_,MapBase:()=>y,MapFeature:()=>x,MapFeatures:()=>C,MapGraticule:()=>D,MapLine:()=>f,MapMarker:()=>m,MapMesh:()=>k,MapZoom:()=>A});e.MapAnnotation=_,e.MapBase=y,e.MapFeature=x,e.MapFeatures=C,e.MapGraticule=D,e.MapLine=f,e.MapMarker=m,e.MapMesh=k,e.MapZoom=A,e.mapContextKey=o,e.plugin={install(e){Object.entries(j).forEach(([t,n])=>{e.component(t,n)})}},e.useMapContext=s,e.useMapObject=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, openBlock, provide, ref, renderList, renderSlot, toRef, unref, useAttrs, watch, withCtx } from "vue";
3
+ import { applyZoomGroupTransform, applyZoomTransform, createZoomBehavior, getAnnotationGeometry, getFeatureKey, getLinePath, getMarkerTransform, isString, makeMapContext, renderGraticule, renderOutline, resolveObjectStyle, setupZoom, useMapObjectEvents } from "@d3-maps/core";
4
4
 
5
5
  //#region rolldown:runtime
6
6
  var __defProp = Object.defineProperty;
@@ -26,10 +26,175 @@ function useMapContext() {
26
26
  }
27
27
 
28
28
  //#endregion
29
- //#region src/components/Map.vue?vue&type=script&setup=true&lang.ts
30
- const _hoisted_1$5 = ["viewBox"];
31
- var Map_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
32
- __name: "Map",
29
+ //#region src/hooks/useInsideZoom.ts
30
+ const insideZoomKey = Symbol("InsideZoom");
31
+ function useInsideZoom() {
32
+ return inject(insideZoomKey, false);
33
+ }
34
+
35
+ //#endregion
36
+ //#region src/hooks/useMapObject.ts
37
+ function useMapObject(styles) {
38
+ const state = ref("default");
39
+ const { onMouseenter, onMouseleave, onMouseup, onMousedown, dispose } = useMapObjectEvents((nextState) => {
40
+ state.value = nextState;
41
+ }, useInsideZoom());
42
+ onBeforeUnmount(() => {
43
+ dispose();
44
+ });
45
+ return {
46
+ style: computed(() => resolveObjectStyle(state.value, unref(styles))),
47
+ onMouseenter,
48
+ onMouseleave,
49
+ onMousedown,
50
+ onMouseup
51
+ };
52
+ }
53
+
54
+ //#endregion
55
+ //#region src/components/MapLine.vue?vue&type=script&setup=true&lang.ts
56
+ const _hoisted_1$7 = ["d"];
57
+ var MapLine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
58
+ inheritAttrs: false,
59
+ __name: "MapLine",
60
+ props: {
61
+ coordinates: {},
62
+ cartesian: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ custom: {
67
+ type: Boolean,
68
+ default: false
69
+ },
70
+ curve: {},
71
+ midpoint: {},
72
+ styles: {}
73
+ },
74
+ setup(__props) {
75
+ const props = __props;
76
+ const attrs = useAttrs();
77
+ const context = useMapContext();
78
+ const path = computed(() => {
79
+ return getLinePath(context?.value, {
80
+ coordinates: props.coordinates,
81
+ custom: props.custom,
82
+ curve: props.curve,
83
+ cartesian: props.cartesian,
84
+ midpoint: props.midpoint
85
+ });
86
+ });
87
+ const pathName = computed(() => attrs.name ?? "line");
88
+ const { style, ...events } = useMapObject(toRef(props, "styles"));
89
+ const pathAttrs = computed(() => ({
90
+ ...attrs,
91
+ ...events,
92
+ name: pathName.value
93
+ }));
94
+ return (_ctx, _cache) => {
95
+ return openBlock(), createElementBlock("path", mergeProps(pathAttrs.value, {
96
+ d: path.value,
97
+ fill: "none",
98
+ style: unref(style)
99
+ }), null, 16, _hoisted_1$7);
100
+ };
101
+ }
102
+ });
103
+
104
+ //#endregion
105
+ //#region src/components/MapLine.vue
106
+ var MapLine_default = MapLine_vue_vue_type_script_setup_true_lang_default;
107
+
108
+ //#endregion
109
+ //#region src/components/MapMarker.vue?vue&type=script&setup=true&lang.ts
110
+ const _hoisted_1$6 = ["transform", "name"];
111
+ var MapMarker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
112
+ __name: "MapMarker",
113
+ props: {
114
+ name: { default: "marker" },
115
+ coordinates: {},
116
+ styles: {}
117
+ },
118
+ setup(__props) {
119
+ const props = __props;
120
+ const context = useMapContext();
121
+ const transform = computed(() => getMarkerTransform(context?.value, props.coordinates));
122
+ const { style, ...events } = useMapObject(toRef(props, "styles"));
123
+ return (_ctx, _cache) => {
124
+ return transform.value ? (openBlock(), createElementBlock("g", mergeProps({
125
+ key: 0,
126
+ transform: transform.value,
127
+ style: unref(style),
128
+ name: __props.name
129
+ }, events), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$6)) : createCommentVNode("v-if", true);
130
+ };
131
+ }
132
+ });
133
+
134
+ //#endregion
135
+ //#region src/components/MapMarker.vue
136
+ var MapMarker_default = MapMarker_vue_vue_type_script_setup_true_lang_default;
137
+
138
+ //#endregion
139
+ //#region src/components/MapAnnotation.vue?vue&type=script&setup=true&lang.ts
140
+ const _hoisted_1$5 = ["transform"];
141
+ const _hoisted_2$1 = ["transform"];
142
+ var MapAnnotation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
143
+ inheritAttrs: false,
144
+ __name: "MapAnnotation",
145
+ props: {
146
+ coordinates: {},
147
+ length: {},
148
+ angle: {},
149
+ margin: {},
150
+ curve: { type: Function },
151
+ midpoint: {},
152
+ styles: {}
153
+ },
154
+ setup(__props) {
155
+ const props = __props;
156
+ const geometry = computed(() => getAnnotationGeometry({
157
+ length: props.length,
158
+ angle: props.angle,
159
+ margin: props.margin
160
+ }));
161
+ return (_ctx, _cache) => {
162
+ return openBlock(), createBlock(MapMarker_default, {
163
+ coordinates: __props.coordinates,
164
+ name: "annotation"
165
+ }, {
166
+ default: withCtx(() => [createElementVNode("g", { transform: geometry.value.lineTransform }, [createVNode(MapLine_default, mergeProps(_ctx.$attrs, {
167
+ coordinates: geometry.value.lineCoordinates,
168
+ cartesian: "",
169
+ curve: __props.curve,
170
+ midpoint: __props.midpoint,
171
+ styles: __props.styles,
172
+ fill: "none",
173
+ name: "annotation-line"
174
+ }), null, 16, [
175
+ "coordinates",
176
+ "curve",
177
+ "midpoint",
178
+ "styles"
179
+ ])], 8, _hoisted_1$5), createElementVNode("g", {
180
+ transform: geometry.value.contentTransform,
181
+ name: "annotation-content"
182
+ }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_2$1)]),
183
+ _: 3
184
+ }, 8, ["coordinates"]);
185
+ };
186
+ }
187
+ });
188
+
189
+ //#endregion
190
+ //#region src/components/MapAnnotation.vue
191
+ var MapAnnotation_default = MapAnnotation_vue_vue_type_script_setup_true_lang_default;
192
+
193
+ //#endregion
194
+ //#region src/components/MapBase.vue?vue&type=script&setup=true&lang.ts
195
+ const _hoisted_1$4 = ["viewBox"];
196
+ var MapBase_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
197
+ __name: "MapBase",
33
198
  props: {
34
199
  width: {},
35
200
  height: {},
@@ -52,44 +217,18 @@ var Map_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
52
217
  }));
53
218
  provide(mapContextKey, context);
54
219
  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);
220
+ 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
221
  };
57
222
  }
58
223
  });
59
224
 
60
225
  //#endregion
61
- //#region src/components/Map.vue
62
- var Map_default = Map_vue_vue_type_script_setup_true_lang_default;
63
-
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
- }
226
+ //#region src/components/MapBase.vue
227
+ var MapBase_default = MapBase_vue_vue_type_script_setup_true_lang_default;
89
228
 
90
229
  //#endregion
91
230
  //#region src/components/MapFeature.vue?vue&type=script&setup=true&lang.ts
92
- const _hoisted_1$4 = ["d"];
231
+ const _hoisted_1$3 = ["d"];
93
232
  var MapFeature_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
94
233
  __name: "MapFeature",
95
234
  props: {
@@ -105,7 +244,7 @@ var MapFeature_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
105
244
  return openBlock(), createElementBlock("path", mergeProps({
106
245
  d: path.value,
107
246
  style: unref(style)
108
- }, events, { name: "feature" }), null, 16, _hoisted_1$4);
247
+ }, events, { name: "feature" }), null, 16, _hoisted_1$3);
109
248
  };
110
249
  }
111
250
  });
@@ -116,7 +255,7 @@ var MapFeature_default = MapFeature_vue_vue_type_script_setup_true_lang_default;
116
255
 
117
256
  //#endregion
118
257
  //#region src/components/MapFeatures.vue?vue&type=script&setup=true&lang.ts
119
- const _hoisted_1$3 = { name: "features" };
258
+ const _hoisted_1$2 = { name: "features" };
120
259
  var MapFeatures_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
121
260
  __name: "MapFeatures",
122
261
  props: {
@@ -127,7 +266,7 @@ var MapFeatures_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
127
266
  const context = useMapContext();
128
267
  const features = computed(() => context?.value.features ?? []);
129
268
  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) => {
269
+ 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
270
  return openBlock(), createBlock(MapFeature_default, {
132
271
  key: unref(getFeatureKey)(feature, __props.idKey, index),
133
272
  data: feature,
@@ -144,7 +283,7 @@ var MapFeatures_default = MapFeatures_vue_vue_type_script_setup_true_lang_defaul
144
283
 
145
284
  //#endregion
146
285
  //#region src/components/MapGraticule.vue?vue&type=script&setup=true&lang.ts
147
- const _hoisted_1$2 = ["d", "fill"];
286
+ const _hoisted_1$1 = ["d", "fill"];
148
287
  const _hoisted_2 = ["d"];
149
288
  const _hoisted_3 = ["d", "stroke"];
150
289
  var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
@@ -179,7 +318,7 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
179
318
  fill: backgroundColor.value,
180
319
  "pointer-events": "none",
181
320
  name: "background"
182
- }, null, 8, _hoisted_1$2)) : createCommentVNode("v-if", true),
321
+ }, null, 8, _hoisted_1$1)) : createCommentVNode("v-if", true),
183
322
  createElementVNode("path", mergeProps({
184
323
  d: graticulePath.value,
185
324
  fill: "none",
@@ -202,35 +341,6 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
202
341
  //#region src/components/MapGraticule.vue
203
342
  var MapGraticule_default = MapGraticule_vue_vue_type_script_setup_true_lang_default;
204
343
 
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
344
  //#endregion
235
345
  //#region src/components/MapMesh.vue?vue&type=script&setup=true&lang.ts
236
346
  const _hoisted_1 = ["d"];
@@ -337,10 +447,12 @@ var MapZoom_default = MapZoom_vue_vue_type_script_setup_true_lang_default;
337
447
  //#endregion
338
448
  //#region src/components/index.ts
339
449
  var components_exports = /* @__PURE__ */ __exportAll({
340
- Map: () => Map_default,
450
+ MapAnnotation: () => MapAnnotation_default,
451
+ MapBase: () => MapBase_default,
341
452
  MapFeature: () => MapFeature_default,
342
453
  MapFeatures: () => MapFeatures_default,
343
454
  MapGraticule: () => MapGraticule_default,
455
+ MapLine: () => MapLine_default,
344
456
  MapMarker: () => MapMarker_default,
345
457
  MapMesh: () => MapMesh_default,
346
458
  MapZoom: () => MapZoom_default
@@ -358,4 +470,4 @@ const plugin = { install(app) {
358
470
  } };
359
471
 
360
472
  //#endregion
361
- export { Map_default as Map, 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 };
473
+ 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, plugin, useMapContext, useMapObject };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d3-maps/vue",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.8.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.6.0"
47
+ "@d3-maps/core": "0.8.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/geojson": "^7946.0.16",