vvplot 0.4.3 → 0.4.5
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 +288 -163
- package/dist/vvplot.esm.min.js +18 -18
- package/dist/vvplot.global.js +287 -162
- package/dist/vvplot.global.min.js +18 -18
- package/package.json +1 -1
package/dist/vvplot.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, isRef, reactive, unref, getCurrentScope, onScopeDispose,
|
|
1
|
+
import { computed, isRef, reactive, unref, getCurrentScope, onScopeDispose, watch, getCurrentInstance, hasInjectionContext, inject, toValue, shallowRef, readonly, watchEffect, onMounted, useTemplateRef, nextTick, openBlock, createElementBlock, mergeProps, renderSlot, toDisplayString, createCommentVNode, createTextVNode, Fragment, renderList, normalizeStyle, createElementVNode, createBlock, toHandlers, normalizeProps, resolveDynamicComponent, guardReactiveProps, createVNode, useModel, createPropsRestProxy, mergeModels, ref, useId, Teleport, useSlots, useAttrs, provide } from "vue";
|
|
2
2
|
function tryOnScopeDispose(fn) {
|
|
3
3
|
if (getCurrentScope()) {
|
|
4
4
|
onScopeDispose(fn);
|
|
@@ -6,6 +6,17 @@ function tryOnScopeDispose(fn) {
|
|
|
6
6
|
}
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
|
+
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const key = args[0];
|
|
13
|
+
const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
14
|
+
if (instance == null && !hasInjectionContext())
|
|
15
|
+
throw new Error("injectLocal must be called in setup");
|
|
16
|
+
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
17
|
+
return localProvidedStateMap.get(instance)[key];
|
|
18
|
+
return inject(...args);
|
|
19
|
+
};
|
|
9
20
|
function toReactive(objectRef) {
|
|
10
21
|
if (!isRef(objectRef))
|
|
11
22
|
return reactive(objectRef);
|
|
@@ -43,12 +54,79 @@ function reactiveComputed(fn) {
|
|
|
43
54
|
}
|
|
44
55
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
45
56
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
57
|
+
const toString = Object.prototype.toString;
|
|
58
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
59
|
+
const noop$1 = () => {
|
|
60
|
+
};
|
|
61
|
+
function pxValue(px) {
|
|
62
|
+
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
|
|
63
|
+
}
|
|
64
|
+
function toArray(value) {
|
|
65
|
+
return Array.isArray(value) ? value : [value];
|
|
66
|
+
}
|
|
67
|
+
function watchImmediate(source, cb, options) {
|
|
68
|
+
return watch(
|
|
69
|
+
source,
|
|
70
|
+
cb,
|
|
71
|
+
{
|
|
72
|
+
...options,
|
|
73
|
+
immediate: true
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
46
77
|
const defaultWindow = isClient ? window : void 0;
|
|
47
78
|
function unrefElement(elRef) {
|
|
48
79
|
var _a;
|
|
49
80
|
const plain = toValue(elRef);
|
|
50
81
|
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
51
82
|
}
|
|
83
|
+
function useEventListener(...args) {
|
|
84
|
+
const cleanups = [];
|
|
85
|
+
const cleanup = () => {
|
|
86
|
+
cleanups.forEach((fn) => fn());
|
|
87
|
+
cleanups.length = 0;
|
|
88
|
+
};
|
|
89
|
+
const register = (el2, event, listener, options) => {
|
|
90
|
+
el2.addEventListener(event, listener, options);
|
|
91
|
+
return () => el2.removeEventListener(event, listener, options);
|
|
92
|
+
};
|
|
93
|
+
const firstParamTargets = computed(() => {
|
|
94
|
+
const test = toArray(toValue(args[0])).filter((e) => e != null);
|
|
95
|
+
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
96
|
+
});
|
|
97
|
+
const stopWatch = watchImmediate(
|
|
98
|
+
() => {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
return [
|
|
101
|
+
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
102
|
+
toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
103
|
+
toArray(unref(firstParamTargets.value ? args[2] : args[1])),
|
|
104
|
+
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
105
|
+
toValue(firstParamTargets.value ? args[3] : args[2])
|
|
106
|
+
];
|
|
107
|
+
},
|
|
108
|
+
([raw_targets, raw_events, raw_listeners, raw_options]) => {
|
|
109
|
+
cleanup();
|
|
110
|
+
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))
|
|
111
|
+
return;
|
|
112
|
+
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
113
|
+
cleanups.push(
|
|
114
|
+
...raw_targets.flatMap(
|
|
115
|
+
(el2) => raw_events.flatMap(
|
|
116
|
+
(event) => raw_listeners.map((listener) => register(el2, event, listener, optionsClone))
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
{ flush: "post" }
|
|
122
|
+
);
|
|
123
|
+
const stop = () => {
|
|
124
|
+
stopWatch();
|
|
125
|
+
cleanup();
|
|
126
|
+
};
|
|
127
|
+
tryOnScopeDispose(cleanup);
|
|
128
|
+
return stop;
|
|
129
|
+
}
|
|
52
130
|
// @__NO_SIDE_EFFECTS__
|
|
53
131
|
function useMounted() {
|
|
54
132
|
const isMounted = shallowRef(false);
|
|
@@ -68,6 +146,64 @@ function useSupported(callback) {
|
|
|
68
146
|
return Boolean(callback());
|
|
69
147
|
});
|
|
70
148
|
}
|
|
149
|
+
const ssrWidthSymbol = /* @__PURE__ */ Symbol("vueuse-ssr-width");
|
|
150
|
+
// @__NO_SIDE_EFFECTS__
|
|
151
|
+
function useSSRWidth() {
|
|
152
|
+
const ssrWidth = hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
|
|
153
|
+
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
154
|
+
}
|
|
155
|
+
function useMediaQuery(query, options = {}) {
|
|
156
|
+
const { window: window2 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
157
|
+
const isSupported = /* @__PURE__ */ useSupported(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
|
|
158
|
+
const ssrSupport = shallowRef(typeof ssrWidth === "number");
|
|
159
|
+
const mediaQuery = shallowRef();
|
|
160
|
+
const matches = shallowRef(false);
|
|
161
|
+
const handler = (event) => {
|
|
162
|
+
matches.value = event.matches;
|
|
163
|
+
};
|
|
164
|
+
watchEffect(() => {
|
|
165
|
+
if (ssrSupport.value) {
|
|
166
|
+
ssrSupport.value = !isSupported.value;
|
|
167
|
+
const queryStrings = toValue(query).split(",");
|
|
168
|
+
matches.value = queryStrings.some((queryString) => {
|
|
169
|
+
const not2 = queryString.includes("not all");
|
|
170
|
+
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
171
|
+
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
172
|
+
let res = Boolean(minWidth || maxWidth);
|
|
173
|
+
if (minWidth && res) {
|
|
174
|
+
res = ssrWidth >= pxValue(minWidth[1]);
|
|
175
|
+
}
|
|
176
|
+
if (maxWidth && res) {
|
|
177
|
+
res = ssrWidth <= pxValue(maxWidth[1]);
|
|
178
|
+
}
|
|
179
|
+
return not2 ? !res : res;
|
|
180
|
+
});
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (!isSupported.value)
|
|
184
|
+
return;
|
|
185
|
+
mediaQuery.value = window2.matchMedia(toValue(query));
|
|
186
|
+
matches.value = mediaQuery.value.matches;
|
|
187
|
+
});
|
|
188
|
+
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
189
|
+
return computed(() => matches.value);
|
|
190
|
+
}
|
|
191
|
+
// @__NO_SIDE_EFFECTS__
|
|
192
|
+
function useDevicePixelRatio(options = {}) {
|
|
193
|
+
const {
|
|
194
|
+
window: window2 = defaultWindow
|
|
195
|
+
} = options;
|
|
196
|
+
const pixelRatio = shallowRef(1);
|
|
197
|
+
const query = useMediaQuery(() => `(resolution: ${pixelRatio.value}dppx)`, options);
|
|
198
|
+
let stop = noop$1;
|
|
199
|
+
if (window2) {
|
|
200
|
+
stop = watchImmediate(query, () => pixelRatio.value = window2.devicePixelRatio);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
pixelRatio: readonly(pixelRatio),
|
|
204
|
+
stop
|
|
205
|
+
};
|
|
206
|
+
}
|
|
71
207
|
function useResizeObserver(target2, callback, options = {}) {
|
|
72
208
|
const { window: window2 = defaultWindow, ...observerOptions } = options;
|
|
73
209
|
let observer;
|
|
@@ -1682,7 +1818,7 @@ class AsisNumber extends Number {
|
|
|
1682
1818
|
AsisNumber.#cache.set(n, this);
|
|
1683
1819
|
}
|
|
1684
1820
|
}
|
|
1685
|
-
class Asis
|
|
1821
|
+
class Asis {
|
|
1686
1822
|
static #cache = /* @__PURE__ */ new Map();
|
|
1687
1823
|
constructor(value) {
|
|
1688
1824
|
if (typeof value === "string" || value instanceof String) {
|
|
@@ -1726,7 +1862,7 @@ class EnumLevel extends Array {
|
|
|
1726
1862
|
static from(x2) {
|
|
1727
1863
|
if (x2 instanceof this) return x2;
|
|
1728
1864
|
if (x2[Symbol.iterator]) {
|
|
1729
|
-
let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis)).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1865
|
+
let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis) && x3 != null).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1730
1866
|
return new this(...lvl);
|
|
1731
1867
|
} else if (typeof x2 === "object") {
|
|
1732
1868
|
let lvl = Object.keys(x2).map((x3) => String(x3)).sort((a, b) => compare(x2[a], x2[b]));
|
|
@@ -1780,6 +1916,9 @@ class EnumLevel extends Array {
|
|
|
1780
1916
|
function is_continuous(x2) {
|
|
1781
1917
|
return typeof x2 === "number" || x2 instanceof Number || x2 instanceof Date;
|
|
1782
1918
|
}
|
|
1919
|
+
function is_categorical(v) {
|
|
1920
|
+
return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && v !== null && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
|
|
1921
|
+
}
|
|
1783
1922
|
function plus$1(a, b = 0) {
|
|
1784
1923
|
if (b == 0 || a == null) return a;
|
|
1785
1924
|
if (a instanceof Date) return new a.constructor(+a + b);
|
|
@@ -2030,7 +2169,16 @@ function parseLinetype(linetype) {
|
|
|
2030
2169
|
if (linetype.includes(" ")) return linetype.split(" ").map((v) => +v);
|
|
2031
2170
|
return linetype.split("").map((v) => +("0x" + v));
|
|
2032
2171
|
}
|
|
2033
|
-
|
|
2172
|
+
const unitInPx = {
|
|
2173
|
+
"": 1,
|
|
2174
|
+
"px": 1,
|
|
2175
|
+
"in": 96,
|
|
2176
|
+
"cm": 96 / 2.54,
|
|
2177
|
+
"mm": 96 / 25.4,
|
|
2178
|
+
"pt": 96 / 72,
|
|
2179
|
+
"pc": 16
|
|
2180
|
+
};
|
|
2181
|
+
function serializeSVG(svgElement, { unit: unit2 = "mm" } = {}) {
|
|
2034
2182
|
if (!(svgElement instanceof SVGElement)) return null;
|
|
2035
2183
|
function removeComments(node) {
|
|
2036
2184
|
let i = node.childNodes.length;
|
|
@@ -2064,8 +2212,9 @@ function serializeSVG(svgElement) {
|
|
|
2064
2212
|
svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2065
2213
|
svgClone.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
|
|
2066
2214
|
svgClone.setAttribute("version", "1.1");
|
|
2067
|
-
|
|
2068
|
-
svgClone.setAttribute("
|
|
2215
|
+
if (!unitInPx[unit2]) unit2 = "";
|
|
2216
|
+
svgClone.setAttribute("width", svgElement.scrollWidth / unitInPx[unit2] + unit2);
|
|
2217
|
+
svgClone.setAttribute("height", svgElement.scrollHeight / unitInPx[unit2] + unit2);
|
|
2069
2218
|
svgClone.setAttribute("viewBox", `0 0 ${svgElement.scrollWidth} ${svgElement.scrollHeight}`);
|
|
2070
2219
|
const serializer = new XMLSerializer();
|
|
2071
2220
|
return serializer.serializeToString(svgClone);
|
|
@@ -2361,7 +2510,7 @@ const boxplot$1 = {
|
|
|
2361
2510
|
y2,
|
|
2362
2511
|
ds.outliers ?? [],
|
|
2363
2512
|
xnudge
|
|
2364
|
-
), $xmin = psum$a(ds.
|
|
2513
|
+
), $xmin = psum$a(ds.min, xnudge), $xmax = psum$a(ds.max, xnudge);
|
|
2365
2514
|
return {
|
|
2366
2515
|
y: y2,
|
|
2367
2516
|
ymin,
|
|
@@ -2661,8 +2810,8 @@ const boxplot = Object.assign(function(data, {}) {
|
|
|
2661
2810
|
let missingAes = ["x", "y"].filter((a) => data[a] == null);
|
|
2662
2811
|
if (missingAes.length > 0)
|
|
2663
2812
|
throw new Error(`Missing aesthetics for "StatBoxplot": "${missingAes.join('", "')}"`);
|
|
2664
|
-
let isXdiscrete = data.x.some(
|
|
2665
|
-
let isYdiscrete = data.y.some(
|
|
2813
|
+
let isXdiscrete = data.x.some(is_categorical);
|
|
2814
|
+
let isYdiscrete = data.y.some(is_categorical);
|
|
2666
2815
|
if (isXdiscrete && isYdiscrete)
|
|
2667
2816
|
throw new Error(`Both "x" and "y" are discrete, "StatBoxplot" requires one continuous and one discrete aesthetic`);
|
|
2668
2817
|
if (!isXdiscrete && !isYdiscrete)
|
|
@@ -6646,9 +6795,6 @@ function object_map(obj, expr) {
|
|
|
6646
6795
|
if (obj == null) return {};
|
|
6647
6796
|
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, expr(k, v)]));
|
|
6648
6797
|
}
|
|
6649
|
-
function is_categorical(v) {
|
|
6650
|
-
return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && v !== null && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
|
|
6651
|
-
}
|
|
6652
6798
|
class GLayer {
|
|
6653
6799
|
/**
|
|
6654
6800
|
* Create a graphic layer from schema
|
|
@@ -14831,7 +14977,6 @@ const _sfc_main$11 = {
|
|
|
14831
14977
|
pointermove(e) {
|
|
14832
14978
|
emit("pointermove", e, getPosition(e));
|
|
14833
14979
|
},
|
|
14834
|
-
pointerdown: axisMovePointerdown,
|
|
14835
14980
|
wheel: axisWheel
|
|
14836
14981
|
};
|
|
14837
14982
|
return (_ctx, _cache) => {
|
|
@@ -14869,27 +15014,26 @@ const _sfc_main$11 = {
|
|
|
14869
15014
|
height: 10,
|
|
14870
15015
|
y: -5
|
|
14871
15016
|
}, toHandlers(axisVOn, true), {
|
|
15017
|
+
onPointerdown: axisMovePointerdown,
|
|
14872
15018
|
cursor: __props.action.some?.((a) => a.action == "move") ? "grab" : null
|
|
14873
15019
|
}), null, 16, _hoisted_4$3)
|
|
14874
15020
|
]),
|
|
14875
15021
|
_cache[4] || (_cache[4] = createTextVNode()),
|
|
14876
15022
|
__props.action.some?.((a) => a.action == "rescale") ? (openBlock(), createElementBlock("g", _hoisted_5$2, [
|
|
14877
|
-
createElementVNode("rect", {
|
|
15023
|
+
createElementVNode("rect", mergeProps({
|
|
14878
15024
|
width: 20,
|
|
14879
15025
|
height: 10,
|
|
14880
15026
|
y: -5,
|
|
14881
|
-
style: { "cursor": "ew-resize" }
|
|
14882
|
-
|
|
14883
|
-
}, null, 32),
|
|
15027
|
+
style: { "cursor": "ew-resize" }
|
|
15028
|
+
}, toHandlers(axisVOn, true), { onPointerdown: axisRescaleLeftPointerdown }), null, 16),
|
|
14884
15029
|
_cache[0] || (_cache[0] = createTextVNode()),
|
|
14885
|
-
createElementVNode("rect", {
|
|
15030
|
+
createElementVNode("rect", mergeProps({
|
|
14886
15031
|
width: 20,
|
|
14887
15032
|
height: 10,
|
|
14888
15033
|
y: -5,
|
|
14889
15034
|
x: width.value - 20,
|
|
14890
|
-
style: { "cursor": "ew-resize" }
|
|
14891
|
-
|
|
14892
|
-
}, null, 40, _hoisted_6$2)
|
|
15035
|
+
style: { "cursor": "ew-resize" }
|
|
15036
|
+
}, toHandlers(axisVOn, true), { onPointerdown: axisRescaleRightPointerdown }), null, 16, _hoisted_6$2)
|
|
14893
15037
|
])) : createCommentVNode("", true),
|
|
14894
15038
|
_cache[5] || (_cache[5] = createTextVNode()),
|
|
14895
15039
|
axisTitle.value.text ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
@@ -15258,7 +15402,6 @@ const _sfc_main$10 = {
|
|
|
15258
15402
|
pointermove(e) {
|
|
15259
15403
|
emit("pointermove", e, getPosition(e));
|
|
15260
15404
|
},
|
|
15261
|
-
pointerdown: axisMovePointerdown,
|
|
15262
15405
|
wheel: axisWheel
|
|
15263
15406
|
};
|
|
15264
15407
|
return (_ctx, _cache) => {
|
|
@@ -15296,27 +15439,26 @@ const _sfc_main$10 = {
|
|
|
15296
15439
|
height: height.value,
|
|
15297
15440
|
x: -5
|
|
15298
15441
|
}, toHandlers(axisVOn, true), {
|
|
15442
|
+
onPointerdown: axisMovePointerdown,
|
|
15299
15443
|
cursor: __props.action.some?.((a) => a.action == "move") ? "grab" : null
|
|
15300
15444
|
}), null, 16, _hoisted_4$2)
|
|
15301
15445
|
]),
|
|
15302
15446
|
_cache[4] || (_cache[4] = createTextVNode()),
|
|
15303
15447
|
__props.action.some?.((a) => a.action == "rescale") ? (openBlock(), createElementBlock("g", _hoisted_5$1, [
|
|
15304
|
-
createElementVNode("rect", {
|
|
15448
|
+
createElementVNode("rect", mergeProps({
|
|
15305
15449
|
width: 10,
|
|
15306
15450
|
height: 20,
|
|
15307
15451
|
x: -5,
|
|
15308
|
-
style: { "cursor": "ns-resize" }
|
|
15309
|
-
|
|
15310
|
-
}, null, 32),
|
|
15452
|
+
style: { "cursor": "ns-resize" }
|
|
15453
|
+
}, toHandlers(axisVOn, true), { onPointerdown: axisRescaleTopPointerdown }), null, 16),
|
|
15311
15454
|
_cache[0] || (_cache[0] = createTextVNode()),
|
|
15312
|
-
createElementVNode("rect", {
|
|
15455
|
+
createElementVNode("rect", mergeProps({
|
|
15313
15456
|
width: 10,
|
|
15314
15457
|
height: 20,
|
|
15315
15458
|
x: -5,
|
|
15316
15459
|
y: height.value - 20,
|
|
15317
|
-
style: { "cursor": "ns-resize" }
|
|
15318
|
-
|
|
15319
|
-
}, null, 40, _hoisted_6$1)
|
|
15460
|
+
style: { "cursor": "ns-resize" }
|
|
15461
|
+
}, toHandlers(axisVOn, true), { onPointerdown: axisRescaleBottomPointerdown }), null, 16, _hoisted_6$1)
|
|
15320
15462
|
])) : createCommentVNode("", true),
|
|
15321
15463
|
_cache[5] || (_cache[5] = createTextVNode()),
|
|
15322
15464
|
axisTitle.value.text ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
@@ -15501,7 +15643,8 @@ const _sfc_main$Y = {
|
|
|
15501
15643
|
data: Object,
|
|
15502
15644
|
coord2pos: Function,
|
|
15503
15645
|
getCoord: Function,
|
|
15504
|
-
layout: Object
|
|
15646
|
+
layout: Object,
|
|
15647
|
+
dpi: { type: Number, default: 96 }
|
|
15505
15648
|
},
|
|
15506
15649
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15507
15650
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15517,10 +15660,13 @@ const _sfc_main$Y = {
|
|
|
15517
15660
|
const layerCanvas = computed(() => {
|
|
15518
15661
|
if (containerRef.value == null) return;
|
|
15519
15662
|
const canvas2 = document.createElement("canvas");
|
|
15520
|
-
canvas2.width =
|
|
15521
|
-
canvas2.height =
|
|
15663
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15664
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15665
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15666
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15522
15667
|
const ctx = canvas2.getContext("2d");
|
|
15523
15668
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15669
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15524
15670
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15525
15671
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15526
15672
|
for (const group of __props.data) {
|
|
@@ -15644,7 +15790,8 @@ const _sfc_main$X = {
|
|
|
15644
15790
|
data: Object,
|
|
15645
15791
|
coord2pos: Function,
|
|
15646
15792
|
getCoord: Function,
|
|
15647
|
-
layout: Object
|
|
15793
|
+
layout: Object,
|
|
15794
|
+
dpi: { type: Number, default: 96 }
|
|
15648
15795
|
},
|
|
15649
15796
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15650
15797
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15660,10 +15807,13 @@ const _sfc_main$X = {
|
|
|
15660
15807
|
const layerCanvas = computed(() => {
|
|
15661
15808
|
if (containerRef.value == null) return;
|
|
15662
15809
|
const canvas2 = document.createElement("canvas");
|
|
15663
|
-
canvas2.width =
|
|
15664
|
-
canvas2.height =
|
|
15810
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15811
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15812
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15813
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15665
15814
|
const ctx = canvas2.getContext("2d");
|
|
15666
15815
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15816
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15667
15817
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15668
15818
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15669
15819
|
for (const group of __props.data) {
|
|
@@ -15746,7 +15896,8 @@ const _sfc_main$W = {
|
|
|
15746
15896
|
data: Object,
|
|
15747
15897
|
coord2pos: Function,
|
|
15748
15898
|
getCoord: Function,
|
|
15749
|
-
layout: Object
|
|
15899
|
+
layout: Object,
|
|
15900
|
+
dpi: { type: Number, default: 96 }
|
|
15750
15901
|
},
|
|
15751
15902
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15752
15903
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15762,10 +15913,13 @@ const _sfc_main$W = {
|
|
|
15762
15913
|
const layerCanvas = computed(() => {
|
|
15763
15914
|
if (containerRef.value == null) return;
|
|
15764
15915
|
const canvas2 = document.createElement("canvas");
|
|
15765
|
-
canvas2.width =
|
|
15766
|
-
canvas2.height =
|
|
15916
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15917
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15918
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15919
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15767
15920
|
const ctx = canvas2.getContext("2d");
|
|
15768
15921
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15922
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15769
15923
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15770
15924
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15771
15925
|
for (const group of __props.data) {
|
|
@@ -15786,14 +15940,14 @@ const _sfc_main$W = {
|
|
|
15786
15940
|
} of group) {
|
|
15787
15941
|
let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
|
|
15788
15942
|
const { h: ch, v: cv } = __props.coord2pos({ x: cx, y: cy });
|
|
15789
|
-
let {
|
|
15790
|
-
let scaleX = (
|
|
15943
|
+
let { h: h1, v: v1 } = __props.coord2pos({ x: cx - dx, y: cy - dy }), { h: h2, v: v2 } = __props.coord2pos({ x: cx + dx, y: cy + dy });
|
|
15944
|
+
let scaleX = (h2 - h1) / (2 * dx), scaleY = (v2 - v1) / (2 * dy);
|
|
15791
15945
|
A /= scaleX * scaleX;
|
|
15792
15946
|
B /= scaleX * scaleY;
|
|
15793
15947
|
C /= scaleY * scaleY;
|
|
15794
15948
|
const tr = A + C, det = A * C - B * B;
|
|
15795
15949
|
const disc = Math.sqrt(Math.max(0, tr * tr / 4 - det));
|
|
15796
|
-
let rx2 = 1 / Math.sqrt(tr / 2 + disc), ry = 1 / Math.sqrt(tr / 2 - disc), angle2 =
|
|
15950
|
+
let rx2 = 1 / Math.sqrt(tr / 2 + disc), ry = 1 / Math.sqrt(tr / 2 - disc), angle2 = Math.atan2(2 * B, A - C) / 2;
|
|
15797
15951
|
const path2d = new Path2D();
|
|
15798
15952
|
path2d.ellipse(ch + translateX, cv + translateY, rx2, ry, angle2, 0, 2 * Math.PI);
|
|
15799
15953
|
_path_data.set(path2d, $raw);
|
|
@@ -15847,7 +16001,8 @@ const _sfc_main$V = {
|
|
|
15847
16001
|
data: Object,
|
|
15848
16002
|
coord2pos: Function,
|
|
15849
16003
|
getCoord: Function,
|
|
15850
|
-
layout: Object
|
|
16004
|
+
layout: Object,
|
|
16005
|
+
dpi: { type: Number, default: 96 }
|
|
15851
16006
|
},
|
|
15852
16007
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15853
16008
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15863,10 +16018,13 @@ const _sfc_main$V = {
|
|
|
15863
16018
|
const layerCanvas = computed(() => {
|
|
15864
16019
|
if (containerRef.value == null) return;
|
|
15865
16020
|
const canvas2 = document.createElement("canvas");
|
|
15866
|
-
canvas2.width =
|
|
15867
|
-
canvas2.height =
|
|
16021
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16022
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16023
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16024
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15868
16025
|
const ctx = canvas2.getContext("2d");
|
|
15869
16026
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16027
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15870
16028
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15871
16029
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15872
16030
|
for (const group of __props.data) {
|
|
@@ -15936,7 +16094,8 @@ const _sfc_main$U = {
|
|
|
15936
16094
|
data: Object,
|
|
15937
16095
|
coord2pos: Function,
|
|
15938
16096
|
getCoord: Function,
|
|
15939
|
-
layout: Object
|
|
16097
|
+
layout: Object,
|
|
16098
|
+
dpi: { type: Number, default: 96 }
|
|
15940
16099
|
},
|
|
15941
16100
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15942
16101
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15959,10 +16118,13 @@ const _sfc_main$U = {
|
|
|
15959
16118
|
const layerCanvas = computed(() => {
|
|
15960
16119
|
if (containerRef.value == null) return;
|
|
15961
16120
|
const canvas2 = document.createElement("canvas");
|
|
15962
|
-
canvas2.width =
|
|
15963
|
-
canvas2.height =
|
|
16121
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16122
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16123
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16124
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15964
16125
|
const ctx = canvas2.getContext("2d");
|
|
15965
16126
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16127
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15966
16128
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15967
16129
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15968
16130
|
for (const group of __props.data) {
|
|
@@ -16047,7 +16209,8 @@ const _sfc_main$T = {
|
|
|
16047
16209
|
data: Object,
|
|
16048
16210
|
coord2pos: Function,
|
|
16049
16211
|
getCoord: Function,
|
|
16050
|
-
layout: Object
|
|
16212
|
+
layout: Object,
|
|
16213
|
+
dpi: { type: Number, default: 96 }
|
|
16051
16214
|
},
|
|
16052
16215
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16053
16216
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16063,10 +16226,13 @@ const _sfc_main$T = {
|
|
|
16063
16226
|
const layerCanvas = computed(() => {
|
|
16064
16227
|
if (containerRef.value == null) return;
|
|
16065
16228
|
const canvas2 = document.createElement("canvas");
|
|
16066
|
-
canvas2.width =
|
|
16067
|
-
canvas2.height =
|
|
16229
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16230
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16231
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16232
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16068
16233
|
const ctx = canvas2.getContext("2d");
|
|
16069
16234
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16235
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16070
16236
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16071
16237
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16072
16238
|
for (const group of __props.data) {
|
|
@@ -16140,7 +16306,8 @@ const _sfc_main$S = {
|
|
|
16140
16306
|
data: Object,
|
|
16141
16307
|
coord2pos: Function,
|
|
16142
16308
|
getCoord: Function,
|
|
16143
|
-
layout: Object
|
|
16309
|
+
layout: Object,
|
|
16310
|
+
dpi: { type: Number, default: 96 }
|
|
16144
16311
|
},
|
|
16145
16312
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16146
16313
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16156,10 +16323,13 @@ const _sfc_main$S = {
|
|
|
16156
16323
|
const layerCanvas = computed(() => {
|
|
16157
16324
|
if (containerRef.value == null) return;
|
|
16158
16325
|
const canvas2 = document.createElement("canvas");
|
|
16159
|
-
canvas2.width =
|
|
16160
|
-
canvas2.height =
|
|
16326
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16327
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16328
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16329
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16161
16330
|
const ctx = canvas2.getContext("2d");
|
|
16162
16331
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16332
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16163
16333
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16164
16334
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16165
16335
|
for (const group of __props.data) {
|
|
@@ -16231,7 +16401,8 @@ const _sfc_main$R = {
|
|
|
16231
16401
|
data: Object,
|
|
16232
16402
|
coord2pos: Function,
|
|
16233
16403
|
getCoord: Function,
|
|
16234
|
-
layout: Object
|
|
16404
|
+
layout: Object,
|
|
16405
|
+
dpi: { type: Number, default: 96 }
|
|
16235
16406
|
},
|
|
16236
16407
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16237
16408
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16247,10 +16418,13 @@ const _sfc_main$R = {
|
|
|
16247
16418
|
const layerCanvas = computed(() => {
|
|
16248
16419
|
if (containerRef.value == null) return;
|
|
16249
16420
|
const canvas2 = document.createElement("canvas");
|
|
16250
|
-
canvas2.width =
|
|
16251
|
-
canvas2.height =
|
|
16421
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16422
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16423
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16424
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16252
16425
|
const ctx = canvas2.getContext("2d");
|
|
16253
16426
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16427
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16254
16428
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16255
16429
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16256
16430
|
for (const group of __props.data) {
|
|
@@ -16357,7 +16531,8 @@ const _sfc_main$Q = {
|
|
|
16357
16531
|
data: Object,
|
|
16358
16532
|
coord2pos: Function,
|
|
16359
16533
|
getCoord: Function,
|
|
16360
|
-
layout: Object
|
|
16534
|
+
layout: Object,
|
|
16535
|
+
dpi: { type: Number, default: 96 }
|
|
16361
16536
|
},
|
|
16362
16537
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16363
16538
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16373,10 +16548,13 @@ const _sfc_main$Q = {
|
|
|
16373
16548
|
const layerCanvas = computed(() => {
|
|
16374
16549
|
if (containerRef.value == null) return;
|
|
16375
16550
|
const canvas2 = document.createElement("canvas");
|
|
16376
|
-
canvas2.width =
|
|
16377
|
-
canvas2.height =
|
|
16551
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16552
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16553
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16554
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16378
16555
|
const ctx = canvas2.getContext("2d");
|
|
16379
16556
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16557
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16380
16558
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16381
16559
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16382
16560
|
for (const group of __props.data) {
|
|
@@ -16539,7 +16717,9 @@ const _sfc_main$P = {
|
|
|
16539
16717
|
data: Object,
|
|
16540
16718
|
coord2pos: Function,
|
|
16541
16719
|
getCoord: Function,
|
|
16542
|
-
layout: Object
|
|
16720
|
+
layout: Object,
|
|
16721
|
+
groupClass: null,
|
|
16722
|
+
groupStyle: null
|
|
16543
16723
|
},
|
|
16544
16724
|
emits: ["click", "contextmenu", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup"],
|
|
16545
16725
|
setup(__props, { emit: __emit }) {
|
|
@@ -17068,9 +17248,9 @@ const _sfc_main$H = {
|
|
|
17068
17248
|
}) => {
|
|
17069
17249
|
let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
|
|
17070
17250
|
const { h: ch, v: cv } = __props.coord2pos({ x: cx, y: cy });
|
|
17071
|
-
let {
|
|
17072
|
-
if (
|
|
17073
|
-
let scaleX = (
|
|
17251
|
+
let { h: h1, v: v1 } = __props.coord2pos({ x: cx - dx, y: cy - dy }), { h: h2, v: v2 } = __props.coord2pos({ x: cx + dx, y: cy + dy });
|
|
17252
|
+
if (h1 < xlim_min && h2 < xlim_min || h2 > xlim_max && h1 > xlim_max || v1 < ylim_min && v2 < ylim_min || v2 > ylim_max && v1 > ylim_max) return null;
|
|
17253
|
+
let scaleX = (h2 - h1) / (2 * dx), scaleY = (v2 - v1) / (2 * dy);
|
|
17074
17254
|
A /= scaleX * scaleX;
|
|
17075
17255
|
B /= scaleX * scaleY;
|
|
17076
17256
|
C /= scaleY * scaleY;
|
|
@@ -17081,7 +17261,7 @@ const _sfc_main$H = {
|
|
|
17081
17261
|
cy: cv,
|
|
17082
17262
|
rx: 1 / Math.sqrt(tr / 2 + disc) || 0,
|
|
17083
17263
|
ry: 1 / Math.sqrt(tr / 2 - disc) || 0,
|
|
17084
|
-
angle:
|
|
17264
|
+
angle: Math.atan2(2 * B, A - C) / 2 * 180 / Math.PI || 0,
|
|
17085
17265
|
fill,
|
|
17086
17266
|
color: color2,
|
|
17087
17267
|
linetype,
|
|
@@ -17310,6 +17490,8 @@ const _sfc_main$E = {
|
|
|
17310
17490
|
alpha: alpha2,
|
|
17311
17491
|
"translate-x": translateX = 0,
|
|
17312
17492
|
"translate-y": translateY = 0,
|
|
17493
|
+
"anchor-x": anchorX,
|
|
17494
|
+
"anchor-y": anchorY = 0.5,
|
|
17313
17495
|
"font-family": fontFamily = "sans-serif",
|
|
17314
17496
|
"text-align": textAlign = "start",
|
|
17315
17497
|
inset = 0,
|
|
@@ -17323,140 +17505,72 @@ const _sfc_main$E = {
|
|
|
17323
17505
|
if (x1 < xlim_min && x22 < xlim_min || x1 > xlim_max && x22 > xlim_max || y1 < ylim_min && y22 < ylim_min || y1 > ylim_max && y22 > ylim_max) return null;
|
|
17324
17506
|
let radian = Math.atan2(y22 - y1, x22 - x1);
|
|
17325
17507
|
let vbind = {
|
|
17326
|
-
|
|
17327
|
-
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
|
|
17508
|
+
text: String(label),
|
|
17509
|
+
title: String(title ?? label),
|
|
17510
|
+
color: color2,
|
|
17511
|
+
alpha: alpha2,
|
|
17512
|
+
size,
|
|
17513
|
+
stroke,
|
|
17514
|
+
linewidth,
|
|
17515
|
+
linetype,
|
|
17516
|
+
fontFamily,
|
|
17335
17517
|
class: className,
|
|
17336
17518
|
style
|
|
17337
17519
|
};
|
|
17338
17520
|
let von = Object.fromEntries(
|
|
17339
17521
|
events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
|
|
17340
17522
|
);
|
|
17341
|
-
let tx, ty
|
|
17523
|
+
let tx, ty;
|
|
17342
17524
|
switch (textAlign) {
|
|
17343
17525
|
case "stretch":
|
|
17344
17526
|
tx = (x1 + x22) / 2;
|
|
17345
17527
|
ty = (y1 + y22) / 2;
|
|
17346
|
-
|
|
17528
|
+
anchorX = 0.5;
|
|
17347
17529
|
vbind.textLength = Math.hypot(x22 - x1 || 0, y22 - y1 || 0);
|
|
17348
|
-
vbind.lengthAdjust = "spacingAndGlyphs";
|
|
17349
17530
|
break;
|
|
17350
17531
|
case "center":
|
|
17351
17532
|
tx = (x1 + x22) / 2;
|
|
17352
17533
|
ty = (y1 + y22) / 2;
|
|
17353
|
-
|
|
17534
|
+
anchorX ??= 0.5;
|
|
17354
17535
|
break;
|
|
17355
17536
|
case "pre":
|
|
17356
17537
|
tx = x1;
|
|
17357
17538
|
ty = y1;
|
|
17358
17539
|
translateX -= Math.cos(radian) * inset;
|
|
17359
17540
|
translateY -= Math.sin(radian) * inset;
|
|
17360
|
-
|
|
17541
|
+
anchorX ??= 1;
|
|
17361
17542
|
break;
|
|
17362
17543
|
case "end":
|
|
17363
17544
|
tx = x22;
|
|
17364
17545
|
ty = y22;
|
|
17365
17546
|
translateX -= Math.cos(radian) * inset;
|
|
17366
17547
|
translateY -= Math.sin(radian) * inset;
|
|
17367
|
-
|
|
17548
|
+
anchorX ??= 1;
|
|
17368
17549
|
break;
|
|
17369
17550
|
case "post":
|
|
17370
17551
|
tx = x22;
|
|
17371
17552
|
ty = y22;
|
|
17372
17553
|
translateX += Math.cos(radian) * inset;
|
|
17373
17554
|
translateY += Math.sin(radian) * inset;
|
|
17374
|
-
|
|
17555
|
+
anchorX ??= 0;
|
|
17375
17556
|
break;
|
|
17376
17557
|
default:
|
|
17377
17558
|
tx = x1;
|
|
17378
17559
|
ty = y1;
|
|
17379
17560
|
translateX += Math.cos(radian) * inset;
|
|
17380
17561
|
translateY += Math.sin(radian) * inset;
|
|
17381
|
-
|
|
17562
|
+
anchorX ??= 0;
|
|
17382
17563
|
}
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
if (radian) transform.push(`rotate(${radian * 180 / Math.PI})`);
|
|
17386
|
-
Object.assign(vbind, {
|
|
17387
|
-
x: tx,
|
|
17388
|
-
y: ty,
|
|
17389
|
-
"dominant-baseline": "central",
|
|
17390
|
-
"transform-origin": `${tx} ${ty}`,
|
|
17391
|
-
transform: transform.join(" ") || null
|
|
17392
|
-
});
|
|
17393
|
-
return [vbind, von, content, String(title ?? String(label).replace(/\x01|\x02/g, ""))];
|
|
17564
|
+
Object.assign(vbind, { x: tx, y: ty, translateX, translateY, anchorX, anchorY, angle: radian * 180 / Math.PI });
|
|
17565
|
+
return [vbind, von];
|
|
17394
17566
|
}).filter((x2) => x2 != null));
|
|
17395
17567
|
});
|
|
17396
|
-
const parser = new Parser();
|
|
17397
|
-
function parseMarkdownInline(markdown2) {
|
|
17398
|
-
const walker = parser.parse(markdown2).walker();
|
|
17399
|
-
const fragments = [];
|
|
17400
|
-
let stack2 = [], scales = [1], offset = 0;
|
|
17401
|
-
let ev;
|
|
17402
|
-
while (ev = walker.next()) {
|
|
17403
|
-
let { node: { type, literal }, entering } = ev;
|
|
17404
|
-
let scale = scales.at(-1);
|
|
17405
|
-
if (entering) {
|
|
17406
|
-
if (type === "text" || type === "code") {
|
|
17407
|
-
const vbind = Object.assign({
|
|
17408
|
-
dy: str_c(offset || null, "em")
|
|
17409
|
-
}, ...stack2, {
|
|
17410
|
-
"font-family": type === "code" ? "monospace" : null,
|
|
17411
|
-
"font-size": scale === 1 ? null : `${scale}em`
|
|
17412
|
-
});
|
|
17413
|
-
offset = 0;
|
|
17414
|
-
fragments.push({ text: literal, vbind });
|
|
17415
|
-
} else if (type === "strong") {
|
|
17416
|
-
stack2.push({ "font-weight": "bold" });
|
|
17417
|
-
} else if (type === "emph") {
|
|
17418
|
-
stack2.push({ "font-style": "italic" });
|
|
17419
|
-
} else if (type === "softbreak" || type === "paragraph") {
|
|
17420
|
-
fragments.push({ text: " " });
|
|
17421
|
-
} else if (type === "html_inline") {
|
|
17422
|
-
const tag2 = literal;
|
|
17423
|
-
if (tag2.includes("color=")) {
|
|
17424
|
-
const fill = tag2.match(/color=(['"])(.*?)\1/i)?.[2] ?? tag2.match(/color=(\S*)/)?.[1];
|
|
17425
|
-
if (fill) stack2.push({ fill });
|
|
17426
|
-
} else if (tag2.includes("</font>")) {
|
|
17427
|
-
stack2.pop();
|
|
17428
|
-
} else if (tag2.includes("<sup>")) {
|
|
17429
|
-
offset -= 0.4 * scale;
|
|
17430
|
-
scales.push(scale * 0.7);
|
|
17431
|
-
} else if (tag2.includes("</sup>")) {
|
|
17432
|
-
offset += 0.4 * scales.at(-1);
|
|
17433
|
-
scales.pop();
|
|
17434
|
-
} else if (tag2.includes("<sub>")) {
|
|
17435
|
-
offset += 0.25 * scale;
|
|
17436
|
-
scales.push(scale * 0.7);
|
|
17437
|
-
} else if (tag2.includes("</sub>")) {
|
|
17438
|
-
offset -= 0.25 * scales.at(-1);
|
|
17439
|
-
scales.pop();
|
|
17440
|
-
}
|
|
17441
|
-
}
|
|
17442
|
-
} else {
|
|
17443
|
-
if (["strong", "emph"].includes(type)) stack2.pop();
|
|
17444
|
-
}
|
|
17445
|
-
}
|
|
17446
|
-
return fragments;
|
|
17447
|
-
}
|
|
17448
17568
|
return (_ctx, _cache) => {
|
|
17449
17569
|
return openBlock(), createElementBlock("g", null, [
|
|
17450
17570
|
(openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
|
|
17451
17571
|
return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
|
|
17452
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von
|
|
17453
|
-
return openBlock(),
|
|
17454
|
-
createElementVNode("title", null, toDisplayString(title), 1),
|
|
17455
|
-
_cache[0] || (_cache[0] = createTextVNode()),
|
|
17456
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(textFragments, (tspan) => {
|
|
17457
|
-
return openBlock(), createElementBlock("tspan", mergeProps({ ref_for: true }, tspan.vbind), toDisplayString(tspan.text), 17);
|
|
17458
|
-
}), 256))
|
|
17459
|
-
], 16);
|
|
17572
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
|
|
17573
|
+
return openBlock(), createBlock(_sfc_main$12, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
|
|
17460
17574
|
}), 256))
|
|
17461
17575
|
], 16);
|
|
17462
17576
|
}), 256))
|
|
@@ -18005,7 +18119,9 @@ const _sfc_main$x = {
|
|
|
18005
18119
|
data: Object,
|
|
18006
18120
|
geom: String,
|
|
18007
18121
|
render: String,
|
|
18008
|
-
defaultRender: { type: String, default: "auto" }
|
|
18122
|
+
defaultRender: { type: String, default: "auto" },
|
|
18123
|
+
dpi: Number,
|
|
18124
|
+
defaultDpi: Number
|
|
18009
18125
|
},
|
|
18010
18126
|
setup(__props, { expose: __expose }) {
|
|
18011
18127
|
const geoms = { svg, canvas };
|
|
@@ -18024,13 +18140,15 @@ const _sfc_main$x = {
|
|
|
18024
18140
|
render: rend,
|
|
18025
18141
|
dispatchEvent: (e) => layer.value?.dispatchEvent?.(e)
|
|
18026
18142
|
});
|
|
18143
|
+
const dpi = computed(() => rend.value === "canvas" ? __props.dpi ?? __props.defaultDpi : void 0);
|
|
18027
18144
|
return (_ctx, _cache) => {
|
|
18028
18145
|
return openBlock(), createBlock(resolveDynamicComponent(geoms[rend.value][__props.geom]), {
|
|
18029
18146
|
ref_key: "layer",
|
|
18030
18147
|
ref: layer,
|
|
18031
18148
|
style: normalizeStyle(style.value),
|
|
18032
|
-
data: __props.data
|
|
18033
|
-
|
|
18149
|
+
data: __props.data,
|
|
18150
|
+
dpi: dpi.value
|
|
18151
|
+
}, null, 8, ["style", "data", "dpi"]);
|
|
18034
18152
|
};
|
|
18035
18153
|
}
|
|
18036
18154
|
};
|
|
@@ -18570,6 +18688,7 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
18570
18688
|
theme: Object,
|
|
18571
18689
|
render: String,
|
|
18572
18690
|
clip: Boolean,
|
|
18691
|
+
dpi: Number,
|
|
18573
18692
|
action: { type: Array, default: () => [] },
|
|
18574
18693
|
selections: { type: Array, default: () => [] },
|
|
18575
18694
|
legendTeleport: null
|
|
@@ -19283,8 +19402,9 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
19283
19402
|
geom: layer.geom,
|
|
19284
19403
|
coord2pos,
|
|
19285
19404
|
getCoord,
|
|
19286
|
-
"default-render": props.render
|
|
19287
|
-
|
|
19405
|
+
"default-render": props.render,
|
|
19406
|
+
"default-dpi": props.dpi
|
|
19407
|
+
}), null, 16, ["data", "layout", "geom", "default-render", "default-dpi"]);
|
|
19288
19408
|
}), 256))
|
|
19289
19409
|
], 16),
|
|
19290
19410
|
_cache[3] || (_cache[3] = createTextVNode()),
|
|
@@ -19571,7 +19691,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
19571
19691
|
flip: Boolean,
|
|
19572
19692
|
clip: { type: Boolean, default: true },
|
|
19573
19693
|
resize: null,
|
|
19574
|
-
legendTeleport: null
|
|
19694
|
+
legendTeleport: null,
|
|
19695
|
+
dpi: Number
|
|
19575
19696
|
}, {
|
|
19576
19697
|
"selectionPreview": { default: () => ({}) },
|
|
19577
19698
|
"selectionPreviewModifiers": {},
|
|
@@ -19679,6 +19800,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
19679
19800
|
let arr = Array.isArray($attrs[key]) ? $attrs[key] : [$attrs[key]];
|
|
19680
19801
|
plot[key] = arr.filter((f) => typeof f === "function");
|
|
19681
19802
|
wrapper[key] = arr.filter((f) => typeof f !== "function");
|
|
19803
|
+
} else if (key.startsWith("svg-")) {
|
|
19804
|
+
plot[key.slice(4)] = $attrs[key];
|
|
19682
19805
|
} else {
|
|
19683
19806
|
wrapper[key] = $attrs[key];
|
|
19684
19807
|
}
|
|
@@ -19759,7 +19882,7 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
19759
19882
|
aes[key] = etc[key];
|
|
19760
19883
|
}
|
|
19761
19884
|
} else {
|
|
19762
|
-
if (["class", "style", "group-class", "group-style", "render"].includes(key)) {
|
|
19885
|
+
if (["class", "style", "group-class", "group-style", "dpi", "render"].includes(key)) {
|
|
19763
19886
|
vBind2[key] = etc[key];
|
|
19764
19887
|
} else if (["item-class", "item-style"].includes(key)) {
|
|
19765
19888
|
attrs2[key.slice(5)] = etc[key];
|
|
@@ -20058,6 +20181,7 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
20058
20181
|
};
|
|
20059
20182
|
});
|
|
20060
20183
|
});
|
|
20184
|
+
const { pixelRatio } = /* @__PURE__ */ useDevicePixelRatio();
|
|
20061
20185
|
const wrapperRef = useTemplateRef("wrapper");
|
|
20062
20186
|
const plotRef = useTemplateRef("plot");
|
|
20063
20187
|
const width = useModel(__props, "width");
|
|
@@ -20104,8 +20228,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
20104
20228
|
get svg() {
|
|
20105
20229
|
return plotRef.value.svg;
|
|
20106
20230
|
},
|
|
20107
|
-
serialize() {
|
|
20108
|
-
return serializeSVG(plotRef.value.svg);
|
|
20231
|
+
serialize(options) {
|
|
20232
|
+
return serializeSVG(plotRef.value.svg, options);
|
|
20109
20233
|
}
|
|
20110
20234
|
});
|
|
20111
20235
|
return (_ctx, _cache) => {
|
|
@@ -20140,9 +20264,10 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
|
20140
20264
|
action: action.value,
|
|
20141
20265
|
clip: __props.clip,
|
|
20142
20266
|
render: __props.render,
|
|
20267
|
+
dpi: __props.dpi ?? 96 * unref(pixelRatio),
|
|
20143
20268
|
legendTeleport: __props.legendTeleport,
|
|
20144
20269
|
onSelect: _cache[3] || (_cache[3] = (d, e) => emit("select", d, e))
|
|
20145
|
-
}), 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"]),
|
|
20270
|
+
}), 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"]),
|
|
20146
20271
|
_cache[4] || (_cache[4] = createTextVNode()),
|
|
20147
20272
|
createElementVNode("div", {
|
|
20148
20273
|
class: "vvplot-panel-container",
|