vvplot 0.4.3 → 0.4.4
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 +12 -7
- package/dist/style.css +1 -0
- package/dist/vvplot.esm.js +237 -42
- package/dist/vvplot.esm.min.js +18 -18
- package/dist/vvplot.global.js +236 -41
- package/dist/vvplot.global.min.js +18 -18
- package/package.json +1 -1
package/dist/vvplot.global.js
CHANGED
|
@@ -7,6 +7,17 @@ var VVPlot = (function(exports, vue) {
|
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
+
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const key = args[0];
|
|
14
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
15
|
+
if (instance == null && !vue.hasInjectionContext())
|
|
16
|
+
throw new Error("injectLocal must be called in setup");
|
|
17
|
+
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
18
|
+
return localProvidedStateMap.get(instance)[key];
|
|
19
|
+
return vue.inject(...args);
|
|
20
|
+
};
|
|
10
21
|
function toReactive(objectRef) {
|
|
11
22
|
if (!vue.isRef(objectRef))
|
|
12
23
|
return vue.reactive(objectRef);
|
|
@@ -44,12 +55,79 @@ var VVPlot = (function(exports, vue) {
|
|
|
44
55
|
}
|
|
45
56
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
46
57
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
58
|
+
const toString = Object.prototype.toString;
|
|
59
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
60
|
+
const noop$1 = () => {
|
|
61
|
+
};
|
|
62
|
+
function pxValue(px) {
|
|
63
|
+
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
|
|
64
|
+
}
|
|
65
|
+
function toArray(value) {
|
|
66
|
+
return Array.isArray(value) ? value : [value];
|
|
67
|
+
}
|
|
68
|
+
function watchImmediate(source, cb, options) {
|
|
69
|
+
return vue.watch(
|
|
70
|
+
source,
|
|
71
|
+
cb,
|
|
72
|
+
{
|
|
73
|
+
...options,
|
|
74
|
+
immediate: true
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
47
78
|
const defaultWindow = isClient ? window : void 0;
|
|
48
79
|
function unrefElement(elRef) {
|
|
49
80
|
var _a;
|
|
50
81
|
const plain = vue.toValue(elRef);
|
|
51
82
|
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
52
83
|
}
|
|
84
|
+
function useEventListener(...args) {
|
|
85
|
+
const cleanups = [];
|
|
86
|
+
const cleanup = () => {
|
|
87
|
+
cleanups.forEach((fn) => fn());
|
|
88
|
+
cleanups.length = 0;
|
|
89
|
+
};
|
|
90
|
+
const register = (el2, event, listener, options) => {
|
|
91
|
+
el2.addEventListener(event, listener, options);
|
|
92
|
+
return () => el2.removeEventListener(event, listener, options);
|
|
93
|
+
};
|
|
94
|
+
const firstParamTargets = vue.computed(() => {
|
|
95
|
+
const test = toArray(vue.toValue(args[0])).filter((e) => e != null);
|
|
96
|
+
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
97
|
+
});
|
|
98
|
+
const stopWatch = watchImmediate(
|
|
99
|
+
() => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
return [
|
|
102
|
+
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
103
|
+
toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
104
|
+
toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
|
|
105
|
+
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
106
|
+
vue.toValue(firstParamTargets.value ? args[3] : args[2])
|
|
107
|
+
];
|
|
108
|
+
},
|
|
109
|
+
([raw_targets, raw_events, raw_listeners, raw_options]) => {
|
|
110
|
+
cleanup();
|
|
111
|
+
if (!(raw_targets == null ? void 0 : raw_targets.length) || !(raw_events == null ? void 0 : raw_events.length) || !(raw_listeners == null ? void 0 : raw_listeners.length))
|
|
112
|
+
return;
|
|
113
|
+
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
114
|
+
cleanups.push(
|
|
115
|
+
...raw_targets.flatMap(
|
|
116
|
+
(el2) => raw_events.flatMap(
|
|
117
|
+
(event) => raw_listeners.map((listener) => register(el2, event, listener, optionsClone))
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
{ flush: "post" }
|
|
123
|
+
);
|
|
124
|
+
const stop = () => {
|
|
125
|
+
stopWatch();
|
|
126
|
+
cleanup();
|
|
127
|
+
};
|
|
128
|
+
tryOnScopeDispose(cleanup);
|
|
129
|
+
return stop;
|
|
130
|
+
}
|
|
53
131
|
// @__NO_SIDE_EFFECTS__
|
|
54
132
|
function useMounted() {
|
|
55
133
|
const isMounted = vue.shallowRef(false);
|
|
@@ -69,6 +147,64 @@ var VVPlot = (function(exports, vue) {
|
|
|
69
147
|
return Boolean(callback());
|
|
70
148
|
});
|
|
71
149
|
}
|
|
150
|
+
const ssrWidthSymbol = /* @__PURE__ */ Symbol("vueuse-ssr-width");
|
|
151
|
+
// @__NO_SIDE_EFFECTS__
|
|
152
|
+
function useSSRWidth() {
|
|
153
|
+
const ssrWidth = vue.hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
|
|
154
|
+
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
155
|
+
}
|
|
156
|
+
function useMediaQuery(query, options = {}) {
|
|
157
|
+
const { window: window2 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
158
|
+
const isSupported = /* @__PURE__ */ useSupported(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
|
|
159
|
+
const ssrSupport = vue.shallowRef(typeof ssrWidth === "number");
|
|
160
|
+
const mediaQuery = vue.shallowRef();
|
|
161
|
+
const matches = vue.shallowRef(false);
|
|
162
|
+
const handler = (event) => {
|
|
163
|
+
matches.value = event.matches;
|
|
164
|
+
};
|
|
165
|
+
vue.watchEffect(() => {
|
|
166
|
+
if (ssrSupport.value) {
|
|
167
|
+
ssrSupport.value = !isSupported.value;
|
|
168
|
+
const queryStrings = vue.toValue(query).split(",");
|
|
169
|
+
matches.value = queryStrings.some((queryString) => {
|
|
170
|
+
const not2 = queryString.includes("not all");
|
|
171
|
+
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
172
|
+
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
173
|
+
let res = Boolean(minWidth || maxWidth);
|
|
174
|
+
if (minWidth && res) {
|
|
175
|
+
res = ssrWidth >= pxValue(minWidth[1]);
|
|
176
|
+
}
|
|
177
|
+
if (maxWidth && res) {
|
|
178
|
+
res = ssrWidth <= pxValue(maxWidth[1]);
|
|
179
|
+
}
|
|
180
|
+
return not2 ? !res : res;
|
|
181
|
+
});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (!isSupported.value)
|
|
185
|
+
return;
|
|
186
|
+
mediaQuery.value = window2.matchMedia(vue.toValue(query));
|
|
187
|
+
matches.value = mediaQuery.value.matches;
|
|
188
|
+
});
|
|
189
|
+
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
190
|
+
return vue.computed(() => matches.value);
|
|
191
|
+
}
|
|
192
|
+
// @__NO_SIDE_EFFECTS__
|
|
193
|
+
function useDevicePixelRatio(options = {}) {
|
|
194
|
+
const {
|
|
195
|
+
window: window2 = defaultWindow
|
|
196
|
+
} = options;
|
|
197
|
+
const pixelRatio = vue.shallowRef(1);
|
|
198
|
+
const query = useMediaQuery(() => `(resolution: ${pixelRatio.value}dppx)`, options);
|
|
199
|
+
let stop = noop$1;
|
|
200
|
+
if (window2) {
|
|
201
|
+
stop = watchImmediate(query, () => pixelRatio.value = window2.devicePixelRatio);
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
pixelRatio: vue.readonly(pixelRatio),
|
|
205
|
+
stop
|
|
206
|
+
};
|
|
207
|
+
}
|
|
72
208
|
function useResizeObserver(target2, callback, options = {}) {
|
|
73
209
|
const { window: window2 = defaultWindow, ...observerOptions } = options;
|
|
74
210
|
let observer;
|
|
@@ -2031,7 +2167,16 @@ var VVPlot = (function(exports, vue) {
|
|
|
2031
2167
|
if (linetype.includes(" ")) return linetype.split(" ").map((v) => +v);
|
|
2032
2168
|
return linetype.split("").map((v) => +("0x" + v));
|
|
2033
2169
|
}
|
|
2034
|
-
|
|
2170
|
+
const unitInPx = {
|
|
2171
|
+
"": 1,
|
|
2172
|
+
"px": 1,
|
|
2173
|
+
"in": 96,
|
|
2174
|
+
"cm": 96 / 2.54,
|
|
2175
|
+
"mm": 96 / 25.4,
|
|
2176
|
+
"pt": 96 / 72,
|
|
2177
|
+
"pc": 16
|
|
2178
|
+
};
|
|
2179
|
+
function serializeSVG(svgElement, { unit: unit2 = "mm" } = {}) {
|
|
2035
2180
|
if (!(svgElement instanceof SVGElement)) return null;
|
|
2036
2181
|
function removeComments(node) {
|
|
2037
2182
|
let i = node.childNodes.length;
|
|
@@ -2065,8 +2210,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
2065
2210
|
svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2066
2211
|
svgClone.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
|
|
2067
2212
|
svgClone.setAttribute("version", "1.1");
|
|
2068
|
-
|
|
2069
|
-
svgClone.setAttribute("
|
|
2213
|
+
if (!unitInPx[unit2]) unit2 = "";
|
|
2214
|
+
svgClone.setAttribute("width", svgElement.scrollWidth / unitInPx[unit2] + unit2);
|
|
2215
|
+
svgClone.setAttribute("height", svgElement.scrollHeight / unitInPx[unit2] + unit2);
|
|
2070
2216
|
svgClone.setAttribute("viewBox", `0 0 ${svgElement.scrollWidth} ${svgElement.scrollHeight}`);
|
|
2071
2217
|
const serializer = new XMLSerializer();
|
|
2072
2218
|
return serializer.serializeToString(svgClone);
|
|
@@ -15502,7 +15648,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15502
15648
|
data: Object,
|
|
15503
15649
|
coord2pos: Function,
|
|
15504
15650
|
getCoord: Function,
|
|
15505
|
-
layout: Object
|
|
15651
|
+
layout: Object,
|
|
15652
|
+
dpi: { type: Number, default: 96 }
|
|
15506
15653
|
},
|
|
15507
15654
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15508
15655
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15518,10 +15665,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15518
15665
|
const layerCanvas = vue.computed(() => {
|
|
15519
15666
|
if (containerRef.value == null) return;
|
|
15520
15667
|
const canvas2 = document.createElement("canvas");
|
|
15521
|
-
canvas2.width =
|
|
15522
|
-
canvas2.height =
|
|
15668
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15669
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15670
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15671
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15523
15672
|
const ctx = canvas2.getContext("2d");
|
|
15524
15673
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15674
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15525
15675
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15526
15676
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15527
15677
|
for (const group of __props.data) {
|
|
@@ -15645,7 +15795,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15645
15795
|
data: Object,
|
|
15646
15796
|
coord2pos: Function,
|
|
15647
15797
|
getCoord: Function,
|
|
15648
|
-
layout: Object
|
|
15798
|
+
layout: Object,
|
|
15799
|
+
dpi: { type: Number, default: 96 }
|
|
15649
15800
|
},
|
|
15650
15801
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15651
15802
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15661,10 +15812,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15661
15812
|
const layerCanvas = vue.computed(() => {
|
|
15662
15813
|
if (containerRef.value == null) return;
|
|
15663
15814
|
const canvas2 = document.createElement("canvas");
|
|
15664
|
-
canvas2.width =
|
|
15665
|
-
canvas2.height =
|
|
15815
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15816
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15817
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15818
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15666
15819
|
const ctx = canvas2.getContext("2d");
|
|
15667
15820
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15821
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15668
15822
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15669
15823
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15670
15824
|
for (const group of __props.data) {
|
|
@@ -15747,7 +15901,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15747
15901
|
data: Object,
|
|
15748
15902
|
coord2pos: Function,
|
|
15749
15903
|
getCoord: Function,
|
|
15750
|
-
layout: Object
|
|
15904
|
+
layout: Object,
|
|
15905
|
+
dpi: { type: Number, default: 96 }
|
|
15751
15906
|
},
|
|
15752
15907
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15753
15908
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15763,10 +15918,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15763
15918
|
const layerCanvas = vue.computed(() => {
|
|
15764
15919
|
if (containerRef.value == null) return;
|
|
15765
15920
|
const canvas2 = document.createElement("canvas");
|
|
15766
|
-
canvas2.width =
|
|
15767
|
-
canvas2.height =
|
|
15921
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15922
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15923
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15924
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15768
15925
|
const ctx = canvas2.getContext("2d");
|
|
15769
15926
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15927
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15770
15928
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15771
15929
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15772
15930
|
for (const group of __props.data) {
|
|
@@ -15848,7 +16006,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15848
16006
|
data: Object,
|
|
15849
16007
|
coord2pos: Function,
|
|
15850
16008
|
getCoord: Function,
|
|
15851
|
-
layout: Object
|
|
16009
|
+
layout: Object,
|
|
16010
|
+
dpi: { type: Number, default: 96 }
|
|
15852
16011
|
},
|
|
15853
16012
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15854
16013
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15864,10 +16023,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15864
16023
|
const layerCanvas = vue.computed(() => {
|
|
15865
16024
|
if (containerRef.value == null) return;
|
|
15866
16025
|
const canvas2 = document.createElement("canvas");
|
|
15867
|
-
canvas2.width =
|
|
15868
|
-
canvas2.height =
|
|
16026
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16027
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16028
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16029
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15869
16030
|
const ctx = canvas2.getContext("2d");
|
|
15870
16031
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16032
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15871
16033
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15872
16034
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15873
16035
|
for (const group of __props.data) {
|
|
@@ -15937,7 +16099,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15937
16099
|
data: Object,
|
|
15938
16100
|
coord2pos: Function,
|
|
15939
16101
|
getCoord: Function,
|
|
15940
|
-
layout: Object
|
|
16102
|
+
layout: Object,
|
|
16103
|
+
dpi: { type: Number, default: 96 }
|
|
15941
16104
|
},
|
|
15942
16105
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15943
16106
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15960,10 +16123,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15960
16123
|
const layerCanvas = vue.computed(() => {
|
|
15961
16124
|
if (containerRef.value == null) return;
|
|
15962
16125
|
const canvas2 = document.createElement("canvas");
|
|
15963
|
-
canvas2.width =
|
|
15964
|
-
canvas2.height =
|
|
16126
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16127
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16128
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16129
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15965
16130
|
const ctx = canvas2.getContext("2d");
|
|
15966
16131
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16132
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15967
16133
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15968
16134
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15969
16135
|
for (const group of __props.data) {
|
|
@@ -16048,7 +16214,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16048
16214
|
data: Object,
|
|
16049
16215
|
coord2pos: Function,
|
|
16050
16216
|
getCoord: Function,
|
|
16051
|
-
layout: Object
|
|
16217
|
+
layout: Object,
|
|
16218
|
+
dpi: { type: Number, default: 96 }
|
|
16052
16219
|
},
|
|
16053
16220
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16054
16221
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16064,10 +16231,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16064
16231
|
const layerCanvas = vue.computed(() => {
|
|
16065
16232
|
if (containerRef.value == null) return;
|
|
16066
16233
|
const canvas2 = document.createElement("canvas");
|
|
16067
|
-
canvas2.width =
|
|
16068
|
-
canvas2.height =
|
|
16234
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16235
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16236
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16237
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16069
16238
|
const ctx = canvas2.getContext("2d");
|
|
16070
16239
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16240
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16071
16241
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16072
16242
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16073
16243
|
for (const group of __props.data) {
|
|
@@ -16141,7 +16311,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16141
16311
|
data: Object,
|
|
16142
16312
|
coord2pos: Function,
|
|
16143
16313
|
getCoord: Function,
|
|
16144
|
-
layout: Object
|
|
16314
|
+
layout: Object,
|
|
16315
|
+
dpi: { type: Number, default: 96 }
|
|
16145
16316
|
},
|
|
16146
16317
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16147
16318
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16157,10 +16328,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16157
16328
|
const layerCanvas = vue.computed(() => {
|
|
16158
16329
|
if (containerRef.value == null) return;
|
|
16159
16330
|
const canvas2 = document.createElement("canvas");
|
|
16160
|
-
canvas2.width =
|
|
16161
|
-
canvas2.height =
|
|
16331
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16332
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16333
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16334
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16162
16335
|
const ctx = canvas2.getContext("2d");
|
|
16163
16336
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16337
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16164
16338
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16165
16339
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16166
16340
|
for (const group of __props.data) {
|
|
@@ -16232,7 +16406,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16232
16406
|
data: Object,
|
|
16233
16407
|
coord2pos: Function,
|
|
16234
16408
|
getCoord: Function,
|
|
16235
|
-
layout: Object
|
|
16409
|
+
layout: Object,
|
|
16410
|
+
dpi: { type: Number, default: 96 }
|
|
16236
16411
|
},
|
|
16237
16412
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16238
16413
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16248,10 +16423,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16248
16423
|
const layerCanvas = vue.computed(() => {
|
|
16249
16424
|
if (containerRef.value == null) return;
|
|
16250
16425
|
const canvas2 = document.createElement("canvas");
|
|
16251
|
-
canvas2.width =
|
|
16252
|
-
canvas2.height =
|
|
16426
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16427
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16428
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16429
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16253
16430
|
const ctx = canvas2.getContext("2d");
|
|
16254
16431
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16432
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16255
16433
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16256
16434
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16257
16435
|
for (const group of __props.data) {
|
|
@@ -16358,7 +16536,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16358
16536
|
data: Object,
|
|
16359
16537
|
coord2pos: Function,
|
|
16360
16538
|
getCoord: Function,
|
|
16361
|
-
layout: Object
|
|
16539
|
+
layout: Object,
|
|
16540
|
+
dpi: { type: Number, default: 96 }
|
|
16362
16541
|
},
|
|
16363
16542
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16364
16543
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16374,10 +16553,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16374
16553
|
const layerCanvas = vue.computed(() => {
|
|
16375
16554
|
if (containerRef.value == null) return;
|
|
16376
16555
|
const canvas2 = document.createElement("canvas");
|
|
16377
|
-
canvas2.width =
|
|
16378
|
-
canvas2.height =
|
|
16556
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16557
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16558
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16559
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16379
16560
|
const ctx = canvas2.getContext("2d");
|
|
16380
16561
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16562
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16381
16563
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16382
16564
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16383
16565
|
for (const group of __props.data) {
|
|
@@ -16540,7 +16722,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
16540
16722
|
data: Object,
|
|
16541
16723
|
coord2pos: Function,
|
|
16542
16724
|
getCoord: Function,
|
|
16543
|
-
layout: Object
|
|
16725
|
+
layout: Object,
|
|
16726
|
+
groupClass: null,
|
|
16727
|
+
groupStyle: null
|
|
16544
16728
|
},
|
|
16545
16729
|
emits: ["click", "contextmenu", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup"],
|
|
16546
16730
|
setup(__props, { emit: __emit }) {
|
|
@@ -18006,7 +18190,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
18006
18190
|
data: Object,
|
|
18007
18191
|
geom: String,
|
|
18008
18192
|
render: String,
|
|
18009
|
-
defaultRender: { type: String, default: "auto" }
|
|
18193
|
+
defaultRender: { type: String, default: "auto" },
|
|
18194
|
+
dpi: Number,
|
|
18195
|
+
defaultDpi: Number
|
|
18010
18196
|
},
|
|
18011
18197
|
setup(__props, { expose: __expose }) {
|
|
18012
18198
|
const geoms = { svg, canvas };
|
|
@@ -18025,13 +18211,15 @@ var VVPlot = (function(exports, vue) {
|
|
|
18025
18211
|
render: rend,
|
|
18026
18212
|
dispatchEvent: (e) => layer.value?.dispatchEvent?.(e)
|
|
18027
18213
|
});
|
|
18214
|
+
const dpi = vue.computed(() => rend.value === "canvas" ? __props.dpi ?? __props.defaultDpi : void 0);
|
|
18028
18215
|
return (_ctx, _cache) => {
|
|
18029
18216
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(geoms[rend.value][__props.geom]), {
|
|
18030
18217
|
ref_key: "layer",
|
|
18031
18218
|
ref: layer,
|
|
18032
18219
|
style: vue.normalizeStyle(style.value),
|
|
18033
|
-
data: __props.data
|
|
18034
|
-
|
|
18220
|
+
data: __props.data,
|
|
18221
|
+
dpi: dpi.value
|
|
18222
|
+
}, null, 8, ["style", "data", "dpi"]);
|
|
18035
18223
|
};
|
|
18036
18224
|
}
|
|
18037
18225
|
};
|
|
@@ -18571,6 +18759,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
18571
18759
|
theme: Object,
|
|
18572
18760
|
render: String,
|
|
18573
18761
|
clip: Boolean,
|
|
18762
|
+
dpi: Number,
|
|
18574
18763
|
action: { type: Array, default: () => [] },
|
|
18575
18764
|
selections: { type: Array, default: () => [] },
|
|
18576
18765
|
legendTeleport: null
|
|
@@ -19284,8 +19473,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
19284
19473
|
geom: layer.geom,
|
|
19285
19474
|
coord2pos,
|
|
19286
19475
|
getCoord,
|
|
19287
|
-
"default-render": props.render
|
|
19288
|
-
|
|
19476
|
+
"default-render": props.render,
|
|
19477
|
+
"default-dpi": props.dpi
|
|
19478
|
+
}), null, 16, ["data", "layout", "geom", "default-render", "default-dpi"]);
|
|
19289
19479
|
}), 256))
|
|
19290
19480
|
], 16),
|
|
19291
19481
|
_cache[3] || (_cache[3] = vue.createTextVNode()),
|
|
@@ -19572,7 +19762,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
19572
19762
|
flip: Boolean,
|
|
19573
19763
|
clip: { type: Boolean, default: true },
|
|
19574
19764
|
resize: null,
|
|
19575
|
-
legendTeleport: null
|
|
19765
|
+
legendTeleport: null,
|
|
19766
|
+
dpi: Number
|
|
19576
19767
|
}, {
|
|
19577
19768
|
"selectionPreview": { default: () => ({}) },
|
|
19578
19769
|
"selectionPreviewModifiers": {},
|
|
@@ -19680,6 +19871,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
19680
19871
|
let arr = Array.isArray($attrs[key]) ? $attrs[key] : [$attrs[key]];
|
|
19681
19872
|
plot[key] = arr.filter((f) => typeof f === "function");
|
|
19682
19873
|
wrapper[key] = arr.filter((f) => typeof f !== "function");
|
|
19874
|
+
} else if (key.startsWith("svg-")) {
|
|
19875
|
+
plot[key.slice(4)] = $attrs[key];
|
|
19683
19876
|
} else {
|
|
19684
19877
|
wrapper[key] = $attrs[key];
|
|
19685
19878
|
}
|
|
@@ -19760,7 +19953,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
19760
19953
|
aes[key] = etc[key];
|
|
19761
19954
|
}
|
|
19762
19955
|
} else {
|
|
19763
|
-
if (["class", "style", "group-class", "group-style", "render"].includes(key)) {
|
|
19956
|
+
if (["class", "style", "group-class", "group-style", "dpi", "render"].includes(key)) {
|
|
19764
19957
|
vBind2[key] = etc[key];
|
|
19765
19958
|
} else if (["item-class", "item-style"].includes(key)) {
|
|
19766
19959
|
attrs2[key.slice(5)] = etc[key];
|
|
@@ -20059,6 +20252,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
20059
20252
|
};
|
|
20060
20253
|
});
|
|
20061
20254
|
});
|
|
20255
|
+
const { pixelRatio } = /* @__PURE__ */ useDevicePixelRatio();
|
|
20062
20256
|
const wrapperRef = vue.useTemplateRef("wrapper");
|
|
20063
20257
|
const plotRef = vue.useTemplateRef("plot");
|
|
20064
20258
|
const width = vue.useModel(__props, "width");
|
|
@@ -20105,8 +20299,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
20105
20299
|
get svg() {
|
|
20106
20300
|
return plotRef.value.svg;
|
|
20107
20301
|
},
|
|
20108
|
-
serialize() {
|
|
20109
|
-
return serializeSVG(plotRef.value.svg);
|
|
20302
|
+
serialize(options) {
|
|
20303
|
+
return serializeSVG(plotRef.value.svg, options);
|
|
20110
20304
|
}
|
|
20111
20305
|
});
|
|
20112
20306
|
return (_ctx, _cache) => {
|
|
@@ -20141,9 +20335,10 @@ var VVPlot = (function(exports, vue) {
|
|
|
20141
20335
|
action: action.value,
|
|
20142
20336
|
clip: __props.clip,
|
|
20143
20337
|
render: __props.render,
|
|
20338
|
+
dpi: __props.dpi ?? 96 * vue.unref(pixelRatio),
|
|
20144
20339
|
legendTeleport: __props.legendTeleport,
|
|
20145
20340
|
onSelect: _cache[3] || (_cache[3] = (d, e) => emit("select", d, e))
|
|
20146
|
-
}), null, 16, ["paddings", "schema", "layers", "min-range", "expand-add", "expand-mult", "reverse", "flip", "coord-levels", "levels", "scales", "axes", "theme", "selections", "transition", "selection-preview", "selection-preview-theme", "action", "clip", "render", "legendTeleport"]),
|
|
20341
|
+
}), null, 16, ["paddings", "schema", "layers", "min-range", "expand-add", "expand-mult", "reverse", "flip", "coord-levels", "levels", "scales", "axes", "theme", "selections", "transition", "selection-preview", "selection-preview-theme", "action", "clip", "render", "dpi", "legendTeleport"]),
|
|
20147
20342
|
_cache[4] || (_cache[4] = vue.createTextVNode()),
|
|
20148
20343
|
vue.createElementVNode("div", {
|
|
20149
20344
|
class: "vvplot-panel-container",
|