@d3-maps/vue 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -15
- package/dist/index.iife.js +1 -1
- package/dist/index.js +5 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@d3-maps/core/index.css";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue0 from "vue";
|
|
3
3
|
import { App, ComputedRef, InjectionKey, MaybeRef, StyleValue } from "vue";
|
|
4
4
|
import { ExtendedFeature, ExtendedFeatureCollection, GeoGraticuleGenerator, GeoPath, GeoProjection } from "d3-geo";
|
|
5
5
|
import { Topology } from "topojson-specification";
|
|
@@ -198,7 +198,7 @@ interface ZoomEvent extends D3ZoomEvent<SVGSVGElement, unknown> {}
|
|
|
198
198
|
type __VLS_Slots$3 = {
|
|
199
199
|
default?: (props: MapContext) => unknown;
|
|
200
200
|
};
|
|
201
|
-
declare const __VLS_base$3:
|
|
201
|
+
declare const __VLS_base$3: vue0.DefineComponent<MapConfig, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<MapConfig> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
202
202
|
declare const __VLS_export$6: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
|
|
203
203
|
declare const _default: typeof __VLS_export$6;
|
|
204
204
|
type __VLS_WithSlots$3<T, S> = T & {
|
|
@@ -209,7 +209,7 @@ type __VLS_WithSlots$3<T, S> = T & {
|
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/components/MapFeature.vue.d.ts
|
|
211
211
|
type __VLS_Props$1 = MapFeatureProps<StyleValue>;
|
|
212
|
-
declare const __VLS_export$5:
|
|
212
|
+
declare const __VLS_export$5: vue0.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
213
213
|
declare const _default$1: typeof __VLS_export$5;
|
|
214
214
|
//#endregion
|
|
215
215
|
//#region src/hooks/useMapObject.d.ts
|
|
@@ -234,9 +234,9 @@ declare var __VLS_1$2: {
|
|
|
234
234
|
type __VLS_Slots$2 = {} & {
|
|
235
235
|
default?: (props: typeof __VLS_1$2) => any;
|
|
236
236
|
};
|
|
237
|
-
declare const __VLS_base$2:
|
|
237
|
+
declare const __VLS_base$2: vue0.DefineComponent<Props$2, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<Props$2> & Readonly<{}>, {
|
|
238
238
|
idKey: string;
|
|
239
|
-
}, {}, {}, {}, string,
|
|
239
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
240
240
|
declare const __VLS_export$4: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
|
|
241
241
|
declare const _default$2: typeof __VLS_export$4;
|
|
242
242
|
type __VLS_WithSlots$2<T, S> = T & {
|
|
@@ -252,7 +252,7 @@ interface Props$1 {
|
|
|
252
252
|
border?: boolean | string;
|
|
253
253
|
styles?: MapObjectStyles;
|
|
254
254
|
}
|
|
255
|
-
declare const __VLS_export$3:
|
|
255
|
+
declare const __VLS_export$3: vue0.DefineComponent<Props$1, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
256
256
|
declare const _default$3: typeof __VLS_export$3;
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/components/MapMarker.vue.d.ts
|
|
@@ -261,9 +261,9 @@ declare var __VLS_1$1: {};
|
|
|
261
261
|
type __VLS_Slots$1 = {} & {
|
|
262
262
|
default?: (props: typeof __VLS_1$1) => any;
|
|
263
263
|
};
|
|
264
|
-
declare const __VLS_base$1:
|
|
264
|
+
declare const __VLS_base$1: vue0.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
265
265
|
coordinates: MapMarkerCoordinates;
|
|
266
|
-
}, {}, {}, {}, string,
|
|
266
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
267
267
|
declare const __VLS_export$2: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
|
|
268
268
|
declare const _default$4: typeof __VLS_export$2;
|
|
269
269
|
type __VLS_WithSlots$1<T, S> = T & {
|
|
@@ -276,7 +276,7 @@ type __VLS_WithSlots$1<T, S> = T & {
|
|
|
276
276
|
interface Props {
|
|
277
277
|
styles?: MapObjectStyles;
|
|
278
278
|
}
|
|
279
|
-
declare const __VLS_export$1:
|
|
279
|
+
declare const __VLS_export$1: vue0.DefineComponent<Props, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
280
280
|
declare const _default$5: typeof __VLS_export$1;
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/components/MapZoom.vue.d.ts
|
|
@@ -284,14 +284,14 @@ declare var __VLS_1: {};
|
|
|
284
284
|
type __VLS_Slots = {} & {
|
|
285
285
|
default?: (props: typeof __VLS_1) => any;
|
|
286
286
|
};
|
|
287
|
-
declare const __VLS_base:
|
|
288
|
-
container:
|
|
289
|
-
zoomBehavior:
|
|
290
|
-
}, {}, {}, {},
|
|
287
|
+
declare const __VLS_base: vue0.DefineComponent<ZoomProps, {
|
|
288
|
+
container: vue0.Ref<SVGGElement | null, SVGGElement | null>;
|
|
289
|
+
zoomBehavior: vue0.ComputedRef<DefaultZoomBehavior>;
|
|
290
|
+
}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {} & {
|
|
291
291
|
zoom: (payload: ZoomEvent) => any;
|
|
292
292
|
zoomstart: (payload: ZoomEvent) => any;
|
|
293
293
|
zoomend: (payload: ZoomEvent) => any;
|
|
294
|
-
}, string,
|
|
294
|
+
}, string, vue0.PublicProps, Readonly<ZoomProps> & Readonly<{
|
|
295
295
|
onZoom?: ((payload: ZoomEvent) => any) | undefined;
|
|
296
296
|
onZoomstart?: ((payload: ZoomEvent) => any) | undefined;
|
|
297
297
|
onZoomend?: ((payload: ZoomEvent) => any) | undefined;
|
|
@@ -300,7 +300,7 @@ declare const __VLS_base: vue6.DefineComponent<ZoomProps, {
|
|
|
300
300
|
zoom: number;
|
|
301
301
|
minZoom: number;
|
|
302
302
|
maxZoom: number;
|
|
303
|
-
}, {}, {}, {}, string,
|
|
303
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
304
304
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
305
305
|
declare const _default$6: typeof __VLS_export;
|
|
306
306
|
type __VLS_WithSlots<T, S> = T & {
|
package/dist/index.iife.js
CHANGED
|
@@ -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))}});function u(e){let t=(0,n.ref)(`default`),i=e=>()=>{t.value=(0,r.getObjectStateUpdate)(e)};return{style:(0,n.computed)(()=>(0,r.resolveObjectStyle)(t.value,(0,n.unref)(e))),onMouseenter:i(`mouseenter`),onMouseleave:i(`mouseleave`),onMousedown:i(`mousedown`),onMouseup:i(`mouseup`)}}let d=[`d`];var f=(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,d))}});let p={name:`features`};var m=(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`,p,[(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)(f,{key:(0,n.unref)(r.getFeatureKey)(t,e.idKey,i),data:t,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let h=[`d`,`fill`],g=[`d`],_=[`d`,`stroke`];var v=(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.computed)(()=>{if(i?.value)return(0,r.renderGraticule)(i.value,t.config)??void 0}),
|
|
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))}});function u(e){let t=(0,n.ref)(`default`),i=e=>()=>{t.value=(0,r.getObjectStateUpdate)(e)};return{style:(0,n.computed)(()=>(0,r.resolveObjectStyle)(t.value,(0,n.unref)(e))),onMouseenter:i(`mouseenter`),onMouseleave:i(`mouseleave`),onMousedown:i(`mousedown`),onMouseup:i(`mouseup`)}}let d=[`d`];var f=(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,d))}});let p={name:`features`};var m=(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`,p,[(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)(f,{key:(0,n.unref)(r.getFeatureKey)(t,e.idKey,i),data:t,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let h=[`d`,`fill`],g=[`d`],_=[`d`,`stroke`];var v=(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,h)):(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,g),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,_)):(0,n.createCommentVNode)(`v-if`,!0)]))}});let y=[`transform`];var b=(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}=u((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,y))}});let x=[`d`];var S=(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,x))}}),C=(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(),u=(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)(u,e=>{c.value&&(0,r.setupZoom)({element:c.value,behavior:e,center:a.center,zoom:a.zoom})},{immediate:!0}),(0,n.watch)(()=>[u.value,a.center[0],a.center[1],a.zoom],()=>{c.value&&(0,r.applyZoomTransform)({element:c.value,behavior:u.value,center:a.center,zoom:a.zoom})})}),t({container:c,zoomBehavior:u}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,{ref_key:`container`,ref:c,name:`zoom`},[(0,n.renderSlot)(e.$slots,`default`)],512))}}),w=a({Map:()=>l,MapFeature:()=>f,MapFeatures:()=>m,MapGraticule:()=>v,MapMarker:()=>b,MapMesh:()=>S,MapZoom:()=>C});e.Map=l,e.MapFeature=f,e.MapFeatures=m,e.MapGraticule=v,e.MapMarker=b,e.MapMesh=S,e.MapZoom=C,e.mapContextKey=o,e.plugin={install(e){Object.entries(w).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,5 +1,5 @@
|
|
|
1
1
|
import "@d3-maps/core/index.css";
|
|
2
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onMounted, openBlock, provide, ref, renderList, renderSlot, toRef, unref, watch } from "vue";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onMounted, openBlock, provide, ref, renderList, renderSlot, toRef, unref, useAttrs, watch } from "vue";
|
|
3
3
|
import { applyZoomGroupTransform, applyZoomTransform, createZoomBehavior, getFeatureKey, getMarkerTransform, getObjectStateUpdate, isString, makeMapContext, renderGraticule, renderOutline, resolveObjectStyle, setupZoom } from "@d3-maps/core";
|
|
4
4
|
|
|
5
5
|
//#region rolldown:runtime
|
|
@@ -149,6 +149,7 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
149
149
|
setup(__props) {
|
|
150
150
|
const props = __props;
|
|
151
151
|
const context = useMapContext();
|
|
152
|
+
const attrs = useAttrs();
|
|
152
153
|
const graticulePath = computed(() => {
|
|
153
154
|
if (!context?.value) return void 0;
|
|
154
155
|
return renderGraticule(context.value, props.config) ?? void 0;
|
|
@@ -169,17 +170,13 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
169
170
|
"pointer-events": "none",
|
|
170
171
|
name: "background"
|
|
171
172
|
}, null, 8, _hoisted_1$2)) : createCommentVNode("v-if", true),
|
|
172
|
-
|
|
173
|
-
key: 1,
|
|
173
|
+
createElementVNode("path", mergeProps({
|
|
174
174
|
d: graticulePath.value,
|
|
175
175
|
fill: "none",
|
|
176
176
|
style: unref(style)
|
|
177
|
-
}, {
|
|
178
|
-
..._ctx.$attrs,
|
|
179
|
-
...events
|
|
180
|
-
}, { name: "graticule" }), null, 16, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
177
|
+
}, mergeProps(events, unref(attrs)), { name: "graticule" }), null, 16, _hoisted_2),
|
|
181
178
|
__props.border ? (openBlock(), createElementBlock("path", {
|
|
182
|
-
key:
|
|
179
|
+
key: 1,
|
|
183
180
|
d: outlinePath.value,
|
|
184
181
|
fill: "none",
|
|
185
182
|
stroke: borderColor.value,
|
package/package.json
CHANGED